+ }, es).whenCompleteAsync((ret, ex) -> {
+ if(ex != null) {
+ logger.error("Exception was thrown during concurrent process", ex);
+ CrashHandler handle = new CrashHandler(new IllegalStateException(ex));
+ handle.execute();
+ }
+ }, es);
+ getWholeDataFuture.thenAcceptAsync(list -> this.logger.info("Scraping data size:" + list.size()), es);
+ getFromJsonFuture.thenAcceptAsync(list -> this.logger.info("Currently database size:" + list.size()), es);
+ // easter phase
+ CompletableFuture.runAsync(() -> {
+ this.easter = new Easter();
+ this.setTitle(this.easter.getTodaysBirth());
+ }, es);
+ this.logger.debug("Version: {}", CheckVersion.getVersion());
+ this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+ // this.setBounds(100, 100, 960, 643);
+ this.contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
+ this.setContentPane(this.contentPane);
+ contentPane.setLayout(new CardLayout(0, 0));
+
+ panelMain = new JPanel();
+ panelMain.setLayout(new BorderLayout(0, 0));
+
+ panelNorthMain = new JPanel();
+ panelMain.add(panelNorthMain, BorderLayout.NORTH);
+ panelNorthMain.setLayout(new FormLayout(new ColumnSpec[] {
+ ColumnSpec.decode("829px"),
+ FormSpecs.LABEL_COMPONENT_GAP_COLSPEC,
+ ColumnSpec.decode("center:94px"),},
+ new RowSpec[] {
+ RowSpec.decode("20px"),}));
+
+ labelTitle = new JLabel(Messages.MSGTitle.toString());
+ labelTitle.setFont(new Font("UD デジタル 教科書体 NP-B", Font.BOLD, 16));
+ panelNorthMain.add(labelTitle, "1, 1, center, top");
+
+ labelVersion = new JLabel(CheckVersion.getVersion());
+ labelVersion.setFont(new Font("SansSerif", Font.BOLD, 12));
+ panelNorthMain.add(labelVersion, "3, 1, center, center");
+
+ panelWestMain = new JPanel();
+ panelMain.add(panelWestMain, BorderLayout.WEST);
+ panelWestMain.setLayout(new FormLayout(new ColumnSpec[] {
+ FormSpecs.LABEL_COMPONENT_GAP_COLSPEC,
+ ColumnSpec.decode("120px"),},
+ new RowSpec[] {
+ FormSpecs.LINE_GAP_ROWSPEC,
+ RowSpec.decode("25px"),
+ FormSpecs.RELATED_GAP_ROWSPEC,
+ FormSpecs.DEFAULT_ROWSPEC,
+ FormSpecs.RELATED_GAP_ROWSPEC,
+ FormSpecs.DEFAULT_ROWSPEC,
+ FormSpecs.RELATED_GAP_ROWSPEC,
+ FormSpecs.DEFAULT_ROWSPEC,
+ FormSpecs.RELATED_GAP_ROWSPEC,
+ FormSpecs.DEFAULT_ROWSPEC,
+ FormSpecs.RELATED_GAP_ROWSPEC,
+ FormSpecs.DEFAULT_ROWSPEC,
+ FormSpecs.RELATED_GAP_ROWSPEC,
+ FormSpecs.DEFAULT_ROWSPEC,
+ FormSpecs.RELATED_GAP_ROWSPEC,
+ RowSpec.decode("max(41dlu;default)"),}));
+
+ labelDifficulty = new JLabel(Messages.MSGSelectDifficulty.toString());
+ labelDifficulty.setFont(new Font("UD デジタル 教科書体 NP-B", Font.BOLD, 13));
+ panelWestMain.add(labelDifficulty, "2, 2, center, center");
+
+ comboDifficultySelect = new JComboBox<>();
+ comboDifficultySelect.setModel(new DefaultComboBoxModel(new String[] {Messages.MSGNonSelected.toString(), "DEBUT", "REGULAR", "PRO", "MASTER", "MASTER+", "ⓁMASTER+", "LIGHT", "TRICK", "PIANO", "FORTE", "WITCH"}));
+ comboDifficultySelect.setFont(new Font("Dialog", Font.BOLD, 12));
+ panelWestMain.add(comboDifficultySelect, "2, 4, fill, fill");
+
+ comboAttribute = new JComboBox<>();
+ comboAttribute.setModel(new DefaultComboBoxModel(new String[] {Messages.MSGNonSelected.toString(), "全タイプ", "キュート", "クール", "パッション"}));
+ comboAttribute.setFont(new Font("UD デジタル 教科書体 NP-B", Font.BOLD, 13));
+ panelWestMain.add(comboAttribute, "2, 6, fill, top");
+
+ labelLevel = new JLabel(Messages.MSGSongLevel.toString());
+ labelLevel.setFont(new Font("UD デジタル 教科書体 NP-B", Font.BOLD, 13));
+ panelWestMain.add(labelLevel, "2, 8, center, center");
+
+ spinnerLevel = new JSpinner();
+ panelWestMain.add(spinnerLevel, "2, 10, fill, center");
+
+ checkLessLv = new JCheckBox(Messages.MSGBelowSpecificLevel.toString());
+ checkLessLv.setFont(new Font("UD デジタル 教科書体 NP-B", Font.BOLD, 13));
+ panelWestMain.add(checkLessLv, "2, 12, left, top");
+
+ checkMoreLv = new JCheckBox(Messages.MSGOverSpecificLevel.toString());
+ checkMoreLv.setFont(new Font("UD デジタル 教科書体 NP-B", Font.BOLD, 13));
+ panelWestMain.add(checkMoreLv, "2, 14, left, top");
+
+ labelLvCaution = new JLabel(Messages.MSGLevelCheckboxInfo.toString());
+ labelLvCaution.setFont(new Font("UD デジタル 教科書体 NP-B", Font.BOLD, 13));
+ panelWestMain.add(labelLvCaution, "2, 16, left, center");
+
+ panelEastMain = new JPanel();
+ panelMain.add(panelEastMain, BorderLayout.EAST);
+ panelEastMain.setLayout(new FormLayout(new ColumnSpec[] {
+ FormSpecs.LABEL_COMPONENT_GAP_COLSPEC,
+ ColumnSpec.decode("100px"),},
+ new RowSpec[] {
+ FormSpecs.LINE_GAP_ROWSPEC,
+ RowSpec.decode("77px"),
+ FormSpecs.RELATED_GAP_ROWSPEC,
+ FormSpecs.DEFAULT_ROWSPEC,
+ FormSpecs.RELATED_GAP_ROWSPEC,
+ FormSpecs.DEFAULT_ROWSPEC,
+ FormSpecs.RELATED_GAP_ROWSPEC,
+ FormSpecs.DEFAULT_ROWSPEC,
+ FormSpecs.RELATED_GAP_ROWSPEC,
+ RowSpec.decode("max(36dlu;default)"),
+ FormSpecs.RELATED_GAP_ROWSPEC,
+ FormSpecs.DEFAULT_ROWSPEC,}));
+
+ btnImport = new JButton(Messages.MSGUpdatingDatabase.toString());
+ btnImport.addActionListener(e -> {
+ CompletableFuture.runAsync(() -> {
+ if(impl != null) {
+ if(!impl.getFlag()) {
+ JOptionPane.showMessageDialog(null, Messages.MSGManualUpdateNotCompleteYet.toString());
+ }
+ }
+ ArrayList<Song> fromJson = Scraping.getFromJson();
+ ArrayList<Song> specificlevelList = Scraping.getSpecificLevelSongs(fromJson, (Integer)DelesteRandomSelector.this.spinnerLevel.getValue(), DelesteRandomSelector.this.checkLessLv.isSelected(), DelesteRandomSelector.this.checkMoreLv.isSelected());
+ ArrayList<Song> specificDifficultyList = Scraping.getSpecificDifficultySongs(specificlevelList, DelesteRandomSelector.this.comboDifficultySelect.getSelectedItem().toString());
+ ArrayList<Song> specificAttributeList = Scraping.getSpecificAttributeSongs(specificDifficultyList, DelesteRandomSelector.this.comboAttribute.getSelectedItem().toString());
+ ArrayList<Song> specificTypeList = Scraping.getSpecificAlbumTypeSongs(specificAttributeList, EstimateAlbumTypeCycle.getCurrentCycle());
+ if(!selectedSongsList.isEmpty()) {
+ selectedSongsList.clear();
+ }
+ selectedSongsList.addAll((DelesteRandomSelector.this.comboDifficultySelect.getSelectedItem().equals(Scraping.MASTERPLUS) || DelesteRandomSelector.this.comboDifficultySelect.getSelectedItem().equals(Scraping.LEGACYMASTERPLUS)) ? specificTypeList : specificAttributeList);
+ DelesteRandomSelector.this.logger.info("Songs are selected.We are Ready to go.");
+ JOptionPane.showMessageDialog(null, Messages.MSGCompleteNarrowDown.toString());
+ }, es).whenCompleteAsync((ret, ex) -> {
+ if(ex != null) {
+ logger.error("Exception was thrown during concurrent process", ex);
+ CrashHandler handle = new CrashHandler(new IllegalStateException(ex));
+ handle.execute();
+ }
+ }, es);
+ });
+ btnImport.setFont(new Font("UD デジタル 教科書体 NP-B", Font.BOLD, 13));
+ btnImport.setEnabled(false);
+ panelEastMain.add(btnImport, "2, 2, fill, fill");
+
+ btnConfig = new JButton(Messages.MSGConfigurations.toString());
+ btnConfig.addActionListener(e -> {
+ CompletableFuture.runAsync(() -> {
+ ProcessBuilder builder = new ProcessBuilder("java", "-jar", "Configurations.jar");
+ try {
+ builder.start();
+ } catch (IOException e1) {
+ logger.error("Exception was thrown during concurrent process", e1);
+ CrashHandler handle = new CrashHandler(new IllegalStateException(e1));
+ handle.execute();
+ }
+ }, es).whenCompleteAsync((ret, ex) -> {
+ if(ex != null) {
+ logger.error("Exception was thrown during concurrent process", ex);
+ CrashHandler handle = new CrashHandler(new IllegalStateException(ex));
+ handle.execute();
+ }
+ }, es);
+ });
+ panelEastMain.add(btnConfig, "2, 6, fill, fill");
+
+ btnStart = new JButton(Messages.MSGCalcStart.toString());
+ btnStart.addActionListener(e -> {
+ CompletableFuture.runAsync(() -> {
+ Random random = new Random(System.currentTimeMillis());
+ toolIntegrateList = new ArrayList<>();
+ StringBuilder paneBuilder = new StringBuilder();
+ DelesteRandomSelector.this.integratorArray = new String[DelesteRandomSelector.this.property.getSongLimit()];
+ for(int i = 0; i < DelesteRandomSelector.this.property.getSongLimit(); i++) {
+ int randomInt = random.nextInt(selectedSongsList.size());
+ String typeString = DelesteRandomSelector.this.comboDifficultySelect.getSelectedItem().equals(Scraping.MASTERPLUS) || DelesteRandomSelector.this.comboDifficultySelect.getSelectedItem().equals(Scraping.LEGACYMASTERPLUS) ? EstimateAlbumTypeCycle.getCurrentCycle() : "";
+ paneBuilder.append(i + 1)
+ .append(Messages.MSGNumberOfSongs.toString())
+ .append(" ")
+ .append(selectedSongsList.get(randomInt).getAttribute())
+ .append("[")
+ .append(selectedSongsList.get(randomInt).getDifficulty())
+ .append("]「")
+ .append(selectedSongsList.get(randomInt).getName())
+ .append("」!(Lv:")
+ .append(selectedSongsList.get(randomInt).getLevel())
+ .append(" ")
+ .append(typeString)
+ .append(")\n\n");
+ this.integratorArray[i] = selectedSongsList.get(randomInt).getName() + "(Lv" + selectedSongsList.get(randomInt).getLevel() + ")\n";
+ toolIntegrateList.add(selectedSongsList.get(randomInt));
+ }
+ paneBuilder.append(Messages.MSGThisPhrase.toString())
+ .append(this.property.getSongLimit())
+ .append(Messages.MSGPlayPhrase.toString());
+ DelesteRandomSelector.this.textArea.setText(paneBuilder.toString());
+ DelesteRandomSelector.this.integratorBool = true;
+ DelesteRandomSelector.this.logger.info("show up completed.");
+ labelCurrentSongOrderTool.setText("null");
+ progressTool.setValue(0);
+ listToolMapDataFuture = CompletableFuture.supplyAsync(() -> {
+ List<String> data = toolIntegrateList.stream()
+ .map(s -> s.getName())
+ .collect(Collectors.toList());
+ fetchData = new FetchFromAPI(data.toArray(new String[0]));
+ return fetchData.getInformation();
+ }, es);
+ logger.debug("api fetch inquery published");
+ }, es).whenCompleteAsync((ret, ex) -> {
+ if(ex != null) {
+ logger.error("Exception was thrown during concurrent process", ex);
+ CrashHandler handle = new CrashHandler(new IllegalStateException(ex));
+ handle.execute();
+ }
+ }, es);
+ });
+ btnStart.setFont(new Font("UD デジタル 教科書体 NP-B", Font.BOLD, 13));
+ panelEastMain.add(btnStart, "2, 4, fill, fill");
+
+ btnManualUpdate = new JButton(Messages.MSGManualUpdate.toString());
+ btnManualUpdate.addActionListener(e -> {
+ impl = new ManualUpdateThreadImpl();
+ CompletableFuture.runAsync(impl, es).whenCompleteAsync((t, u) -> {
+ if(u != null) {
+ logger.warn("Exception while processing update manually.", u);
+ CrashHandler handle = new CrashHandler(new IllegalStateException(u));
+ handle.execute();
+ JOptionPane.showMessageDialog(null, "There was a problem during processing library update manually.\nIf this appears repeatedly, please contact developer with your app log.");
+ }
+ }, es);
+ });
+ panelEastMain.add(btnManualUpdate, "2, 8, fill, fill");
+
+ btnTwitterIntegration = new JButton(Messages.MSGTwitterIntegration.toString());
+ btnTwitterIntegration.addActionListener(e -> {
+ CompletableFuture.runAsync(() -> {
+ boolean authorizationStatus = TwitterIntegration.authorization();
+ String updatedStatus = Messages.MSGUsingThisAppPhrase.toString();
+ int lengthLimit = updatedStatus.length();
+ boolean isBroken = false;
+ if(!DelesteRandomSelector.this.integratorBool) {
+ JOptionPane.showMessageDialog(null, Messages.MSGNotPlayYet.toString());
+ return;
+ }
+ for (String element : DelesteRandomSelector.this.integratorArray) {
+ updatedStatus = updatedStatus + element;
+ lengthLimit += element.length();
+ if(lengthLimit > 69) {
+ isBroken = true;
+ break;
+ }
+ }
+ if(isBroken) {
+ updatedStatus = updatedStatus + Messages.MSGTwitterPlayOtherwisePhrase.toString() + "\n#DelesteRandomSelector #デレステ ";