List of usage examples for javafx.application Platform runLater
public static void runLater(Runnable runnable)
From source file:org.cryptomator.ui.controllers.UnlockController.java
private void unlock(CharSequence password) { try {/* w w w . jav a 2s . c o m*/ vault.activateFrontend(frontendFactory.get(), settings, password); vault.reveal(); Platform.runLater(() -> { messageText.setText(null); listener.ifPresent(lstnr -> lstnr.didUnlock(vault)); }); if (keychainAccess.isPresent() && savePassword.isSelected()) { keychainAccess.get().storePassphrase(vault.getId(), password); } else { Platform.runLater(passwordField::swipe); } } catch (InvalidPassphraseException e) { Platform.runLater(() -> { messageText.setText(localization.getString("unlock.errorMessage.wrongPassword")); passwordField.selectAll(); passwordField.requestFocus(); }); } catch (UnsupportedVaultFormatException e) { Platform.runLater(() -> { if (e.isVaultOlderThanSoftware()) { // whitespace after localized text used as separator between text and hyperlink messageText.setText( localization.getString("unlock.errorMessage.unsupportedVersion.vaultOlderThanSoftware") + " "); downloadsPageLink.setVisible(true); } else if (e.isSoftwareOlderThanVault()) { messageText.setText( localization.getString("unlock.errorMessage.unsupportedVersion.softwareOlderThanVault") + " "); downloadsPageLink.setVisible(true); } else if (e.getDetectedVersion() == Integer.MAX_VALUE) { messageText.setText(localization.getString("unlock.errorMessage.unauthenticVersionMac")); } }); } catch (FrontendCreationFailedException | CommandFailedException e) { LOG.error("Decryption failed for technical reasons.", e); Platform.runLater(() -> { messageText.setText(localization.getString("unlock.errorMessage.mountingFailed")); }); } finally { Platform.runLater(() -> { mountName.setDisable(false); advancedOptionsButton.setDisable(false); progressIndicator.setVisible(false); }); } }
From source file:acmi.l2.clientmod.l2smr.Controller.java
private void initializeUnr() { mapsDirProperty().addListener((observable, oldValue, newValue) -> { unrChooser.getSelectionModel().clearSelection(); unrChooser.getItems().clear();/* w w w . j a va 2 s .c om*/ unrChooser.setDisable(true); if (newValue == null) return; unrChooser.getItems().addAll(Arrays.stream(newValue.listFiles(MAP_FILE_FILTER)).map(File::getName) .collect(Collectors.toList())); unrChooser.setDisable(false); AutoCompleteComboBox.autoCompleteComboBox(unrChooser, AutoCompleteComboBox.AutoCompleteMode.CONTAINING); }); this.unrChooser.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> { table.getSelectionModel().clearSelection(); filterPane.setDisable(true); actors.set(null); actorStaticMeshChooser.getItems().clear(); System.gc(); if (newValue == null) return; try (UnrealPackage up = new UnrealPackage(new File(getMapsDir(), newValue), true)) { longTask(progress -> { List<UnrealPackage.ImportEntry> staticMeshes = up.getImportTable().parallelStream() .filter(ie -> ie.getFullClassName().equalsIgnoreCase("Engine.StaticMesh")) .sorted((ie1, ie2) -> String.CASE_INSENSITIVE_ORDER .compare(ie1.getObjectInnerFullName(), ie2.getObjectInnerFullName())) .collect(Collectors.toList()); Platform.runLater(() -> { actorStaticMeshChooser.getItems().setAll(staticMeshes); AutoCompleteComboBox.autoCompleteComboBox(actorStaticMeshChooser, AutoCompleteComboBox.AutoCompleteMode.CONTAINING); }); List<Actor> actors = up .getExportTable().parallelStream().filter(e -> UnrealPackage.ObjectFlag .getFlags(e.getObjectFlags()).contains(UnrealPackage.ObjectFlag.HasStack)) .map(entry -> { try { return new Actor(entry.getIndex(), entry.getObjectInnerFullName(), entry.getObjectRawDataExternally(), up); } catch (Throwable e) { return null; } }).filter(Objects::nonNull) .filter(actor -> actor.getStaticMeshRef() != 0 && actor.getOffsets().location != 0) .collect(Collectors.toList()); Platform.runLater(() -> Controller.this.actors.set(FXCollections.observableArrayList(actors))); }, e -> onException("Import failed", e)); } catch (Exception e) { onException("Read failed", e); } resetFilter(); filterPane.setDisable(false); }); this.actorColumn.setCellValueFactory(actorStringCellDataFeatures -> new SimpleStringProperty( actorStringCellDataFeatures.getValue().getActorName())); this.staticMeshColumn.setCellValueFactory(actorStringCellDataFeatures -> new SimpleStringProperty( actorStringCellDataFeatures.getValue().getStaticMesh())); this.table.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE); this.table.getSelectionModel().selectedItemProperty().addListener((observable) -> updateSMAPane()); this.table.setOnMouseClicked(event -> { if (event.getButton() == MouseButton.PRIMARY && event.getClickCount() == 2) { String obj = table.getSelectionModel().getSelectedItem().getStaticMesh(); String file = obj.substring(0, obj.indexOf('.')) + ".usx"; showUmodel(obj, file); } }); }
From source file:photobooth.views.ExplorerPane.java
private void addPrevButton() throws IOException { Button button = new Button(); button.setGraphic(/* w w w.j a va 2s . c o m*/ new ImageView(new Image(getClass().getResource("/photobooth/images/prev.png").openStream()))); button.setStyle("-fx-background-radius: 50%; "); button.setStyle("-fx-background-color: transparent;"); button.setLayoutX(10); button.setLayoutY(220); button.setMaxSize(50, 50); button.setMinSize(50, 50); this.getChildren().add(button); button.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { Global.getInstance().setSceneRoot(LoadingPane.getInstance()); Platform.runLater(() -> { new Thread(new Runnable() { @Override public void run() { ExplorerPane.getInstance().setDir(dir, offset - limit, limit, directoryLevel); Global.getInstance().setSceneRoot(ExplorerPane.getInstance()); } }).start(); }); } }); }
From source file:com.bekwam.resignator.ResignatorAppMainViewController.java
@FXML public void initialize() { try {//from w ww. java 2s .c o m miHelp.setAccelerator(KeyCombination.keyCombination("F1")); cbType.getItems().add(SigningArgumentsType.JAR); cbType.getItems().add(SigningArgumentsType.FOLDER); cbType.getSelectionModel().select(SigningArgumentsType.JAR); cbType.setConverter(new StringConverter<SigningArgumentsType>() { @Override public String toString(SigningArgumentsType type) { return StringUtils.capitalize(StringUtils.lowerCase(String.valueOf(type))); } @Override public SigningArgumentsType fromString(String type) { return Enum.valueOf(SigningArgumentsType.class, StringUtils.upperCase(type)); } }); activeConfiguration.activeProfileProperty().bindBidirectional(activeProfile.profileNameProperty()); tfSourceFile.textProperty().bindBidirectional(activeProfile.sourceFileFileNameProperty()); tfTargetFile.textProperty().bindBidirectional(activeProfile.targetFileFileNameProperty()); ckReplace.selectedProperty().bindBidirectional(activeProfile.replaceSignaturesProperty()); cbType.valueProperty().bindBidirectional(activeProfile.argsTypeProperty()); miSave.disableProperty().bind(needsSave.not()); tfSourceFile.textProperty().addListener(new WeakInvalidationListener(needsSaveListener)); tfTargetFile.textProperty().addListener(new WeakInvalidationListener(needsSaveListener)); ckReplace.selectedProperty().addListener(new WeakInvalidationListener(needsSaveListener)); cbType.valueProperty().addListener(new WeakInvalidationListener(needsSaveListener)); lblSource.setText(SOURCE_LABEL_JAR); lblTarget.setText(TARGET_LABEL_JAR); cbType.getSelectionModel().selectedItemProperty().addListener((ov, old_v, new_v) -> { if (new_v == SigningArgumentsType.FOLDER) { if (!lblSource.getText().equalsIgnoreCase(SOURCE_LABEL_FOLDER)) { lblSource.setText(SOURCE_LABEL_FOLDER); } if (!lblSource.getText().equalsIgnoreCase(TARGET_LABEL_FOLDER)) { lblTarget.setText(TARGET_LABEL_FOLDER); } } else { if (!lblSource.getText().equalsIgnoreCase(SOURCE_LABEL_JAR)) { lblSource.setText(SOURCE_LABEL_JAR); } if (!lblSource.getText().equalsIgnoreCase(TARGET_LABEL_JAR)) { lblTarget.setText(TARGET_LABEL_JAR); } } }); lvProfiles.getSelectionModel().selectedItemProperty().addListener((ov, old_v, new_v) -> { if (new_v == null) { // coming from clearSelection or sort return; } if (needsSave.getValue()) { Alert alert = new Alert(Alert.AlertType.CONFIRMATION, "Discard unsaved profile?"); alert.setHeaderText("Unsaved profile"); Optional<ButtonType> response = alert.showAndWait(); if (!response.isPresent() || response.get() != ButtonType.OK) { if (logger.isDebugEnabled()) { logger.debug("[SELECT] discard canceled"); } return; } } if (logger.isDebugEnabled()) { logger.debug("[SELECT] nv={}", new_v); } doLoadProfile(new_v); }); lvProfiles.setCellFactory(TextFieldListCell.forListView()); Task<Void> t = new Task<Void>() { @Override protected Void call() throws Exception { updateMessage("Loading configuration"); configurationDS.loadConfiguration(); if (!configurationDS.isSecured()) { if (logger.isDebugEnabled()) { logger.debug("[CALL] config not secured; getting password"); } NewPasswordController npc = newPasswordControllerProvider.get(); if (logger.isDebugEnabled()) { logger.debug("[INIT TASK] npc id={}", npc.hashCode()); } Platform.runLater(() -> { try { npc.showAndWait(); } catch (Exception exc) { logger.error("error showing npc", exc); } }); synchronized (npc) { try { npc.wait(MAX_WAIT_TIME); // 10 minutes to enter the password } catch (InterruptedException exc) { logger.error("new password operation interrupted", exc); } } if (logger.isDebugEnabled()) { logger.debug("[INIT TASK] npc={}", npc.getHashedPassword()); } if (StringUtils.isNotEmpty(npc.getHashedPassword())) { activeConfiguration.setHashedPassword(npc.getHashedPassword()); activeConfiguration.setUnhashedPassword(npc.getUnhashedPassword()); activeConfiguration.setLastUpdatedDateTime(LocalDateTime.now()); configurationDS.saveConfiguration(); configurationDS.loadConfiguration(); configurationDS.decrypt(activeConfiguration.getUnhashedPassword()); } else { Platform.runLater(() -> { Alert noPassword = new Alert(Alert.AlertType.INFORMATION, "You'll need to provide a password to save your keystore credentials."); noPassword.showAndWait(); }); return null; } } else { PasswordController pc = passwordControllerProvider.get(); Platform.runLater(() -> { try { pc.showAndWait(); } catch (Exception exc) { logger.error("error showing pc", exc); } }); synchronized (pc) { try { pc.wait(MAX_WAIT_TIME); // 10 minutes to enter the password } catch (InterruptedException exc) { logger.error("password operation interrupted", exc); } } Platform.runLater(() -> { if (pc.getStage().isShowing()) { // ended in timeout timeout pc.getStage().hide(); } if (pc.wasCancelled() || pc.wasReset() || !pc.doesPasswordMatch()) { if (logger.isDebugEnabled()) { logger.debug("[INIT TASK] was cancelled or the number of retries was exceeded"); } String msg = ""; if (pc.wasCancelled()) { msg = "You must provide a password to the datastore. Exitting..."; } else if (pc.wasReset()) { msg = "Data file removed. Exitting..."; } else { msg = "Exceeded maximum number of retries. Exitting..."; } Alert alert = new Alert(Alert.AlertType.WARNING, msg); alert.setOnCloseRequest((evt) -> { Platform.exit(); System.exit(1); }); alert.showAndWait(); } else { // // save password for later decryption ops // activeConfiguration.setUnhashedPassword(pc.getPassword()); configurationDS.decrypt(activeConfiguration.getUnhashedPassword()); // // init profileBrowser // if (logger.isDebugEnabled()) { logger.debug("[INIT TASK] loading profiles from source"); } long startTimeMillis = System.currentTimeMillis(); final List<String> profileNames = configurationDS.getProfiles().stream() .map(Profile::getProfileName).sorted((o1, o2) -> o1.compareToIgnoreCase(o2)) .collect(Collectors.toList()); final List<String> recentProfiles = configurationDS.getRecentProfileNames(); if (logger.isDebugEnabled()) { logger.debug("[INIT TASK] loading profiles into UI"); } lvProfiles.setItems(FXCollections.observableArrayList(profileNames)); if (CollectionUtils.isNotEmpty(recentProfiles)) { mRecentProfiles.getItems().clear(); mRecentProfiles.getItems().addAll( FXCollections.observableArrayList(recentProfiles.stream().map((s) -> { MenuItem mi = new MenuItem(s); mi.setOnAction(recentProfileLoadHandler); return mi; }).collect(Collectors.toList()))); } // // #31 preload the last active profile // if (StringUtils.isNotEmpty(activeConfiguration.getActiveProfile())) { if (logger.isDebugEnabled()) { logger.debug("[INIT TASK] preloading last active profile={}", activeConfiguration.getActiveProfile()); } doLoadProfile(activeConfiguration.getActiveProfile()); } long endTimeMillis = System.currentTimeMillis(); if (logger.isDebugEnabled()) { logger.debug("[INIT TASK] loading profiles took {} ms", (endTimeMillis - startTimeMillis)); } } }); } return null; } @Override protected void succeeded() { super.succeeded(); updateMessage(""); lblStatus.textProperty().unbind(); } @Override protected void cancelled() { super.cancelled(); logger.error("task cancelled", getException()); updateMessage(""); lblStatus.textProperty().unbind(); } @Override protected void failed() { super.failed(); logger.error("task failed", getException()); updateMessage(""); lblStatus.textProperty().unbind(); } }; lblStatus.textProperty().bind(t.messageProperty()); new Thread(t).start(); } catch (Exception exc) { logger.error("can't load configuration", exc); String msg = "Verify that the user has access to the directory '" + configFile + "' under " + System.getProperty("user.home") + "."; Alert alert = new Alert(Alert.AlertType.ERROR, msg); alert.setHeaderText("Can't load config file"); alert.showAndWait(); Platform.exit(); } }
From source file:org.sleuthkit.autopsy.imageanalyzer.gui.navpanel.NavPanel.java
@Deprecated private void rebuildHashTree() { hashTreeRoot = new GroupTreeItem("", null, sortByBox.getSelectionModel().getSelectedItem()); //TODO: can we do this as db query? List<String> hashSetNames = controller.getGroupManager().findValuesForAttribute(DrawableAttribute.HASHSET, GroupSortBy.NONE);// w w w. j a va2 s. c o m for (String name : hashSetNames) { try { List<Long> fileIDsInGroup = controller.getGroupManager() .getFileIDsInGroup(new GroupKey<String>(DrawableAttribute.HASHSET, name)); for (Long fileId : fileIDsInGroup) { DrawableFile<?> file = controller.getFileFromId(fileId); Collection<GroupKey<?>> groupKeysForFile = controller.getGroupManager() .getGroupKeysForFile(file); for (GroupKey<?> k : groupKeysForFile) { final DrawableGroup groupForKey = controller.getGroupManager().getGroupForKey(k); if (groupForKey != null) { insertIntoHashTree(groupForKey); } } } } catch (TskCoreException ex) { Exceptions.printStackTrace(ex); } } Platform.runLater(() -> { hashTree.setRoot(hashTreeRoot); hashTreeRoot.setExpanded(true); }); }
From source file:org.sleuthkit.autopsy.imagegallery.grouping.GroupManager.java
private synchronized void populateAnalyzedGroup(final DrawableGroup g, ReGroupTask<?> task) { if (task == null || (task.isCancelled() == false)) { final boolean groupSeen = db.isGroupSeen(g.getGroupKey()); Platform.runLater(() -> { if (analyzedGroups.contains(g) == false) { analyzedGroups.add(g);/* w ww. j av a 2 s . c om*/ } markGroupSeen(g, groupSeen); }); } }
From source file:org.mskcc.shenkers.view.IntervalViewNGTest.java
public void testStackIntervalView() throws InterruptedException { System.out.println("testStackIntervalView"); int[][] d = new int[][] { { 2, 6 }, { 7, 10 }, { 1, 3 }, { 4, 6 }, { 8, 10 }, { 1, 2 }, { 3, 7 }, { 9, 10 }, { 1, 2 }, { 3, 5 }, { 6, 7 }, { 8, 10 }, { 2, 5 }, { 8, 10 } }; List<int[]> asList = Arrays.asList(d); Collections.sort(asList, new Comparator<int[]>() { @Override//www . j a v a 2 s .c o m public int compare(int[] o1, int[] o2) { return o1[0] - o2[0]; } }); List<TreeRangeSet<Integer>> rows = new ArrayList<>(); rows.add(TreeRangeSet.create()); for (int[] r : d) { Range<Integer> R = Range.closed(r[0], r[1]); int i = 0; added: { while (i < rows.size()) { TreeRangeSet<Integer> set = rows.get(i); RangeSet<Integer> intersection = set.subRangeSet(Range.closed(r[0] - 1, r[1] + 1)); if (intersection.isEmpty()) { set.add(R); break added; } i++; } // Stri i = ; TreeRangeSet<Integer> row = TreeRangeSet.create(); row.add(R); rows.add(row); } } TilePane p = new TilePane(); p.setSnapToPixel(false); for (int i = 0; i < rows.size(); i++) { p.getChildren().add(get(rows.get(i), 0, 11)); System.out.println(rows.get(i).toString()); StringBuilder sb = new StringBuilder(11); sb.append(StringUtils.repeat(".", 11)); for (int j = 0; j < 11; j++) { if (rows.get(i).contains(j)) { sb.setCharAt(j, 'X'); } } System.out.println(sb.toString()); } // p.prefWidth(100); // p.prefHeight(100); ScrollPane sp = new ScrollPane(p); ScrollBar sb = new ScrollBar(); sb.maxProperty().bind(sp.vmaxProperty()); sb.minProperty().bind(sp.vminProperty()); sb.visibleAmountProperty().bind(sp.heightProperty().divide(p.prefHeightProperty())); sb.setOrientation(Orientation.VERTICAL); sp.vvalueProperty().bindBidirectional(sb.valueProperty()); HiddenSidesPane hsp = new HiddenSidesPane(); hsp.setContent(sp); hsp.setRight(sb); sp.setVbarPolicy(ScrollPane.ScrollBarPolicy.NEVER); sp.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER); p.setOrientation(Orientation.VERTICAL); p.prefTileHeightProperty().bind(new SimpleDoubleProperty(40)); // p.minHeightProperty().bind(new SimpleDoubleProperty(20).multiply(Bindings.size(p.getChildren()))); p.prefTileWidthProperty().bind(sp.widthProperty()); p.prefHeightProperty() .bind(new SimpleDoubleProperty(50).multiply(Bindings.size(p.getChildren())).subtract(10)); p.prefWidthProperty().bind(sp.widthProperty()); sp.setPadding(Insets.EMPTY); p.setVgap(10); CountDownLatch l = new CountDownLatch(1); Platform.runLater(() -> { Stage stage = new Stage(); stage.setOnHidden(e -> { l.countDown(); }); Scene scene = new Scene(hsp, 300, 300, Color.GRAY); stage.setTitle("JavaFX Scene Graph Demo"); stage.setScene(scene); stage.show(); }); l.await(); }
From source file:com.heliosdecompiler.helios.gui.controller.FileTreeController.java
public void updateTree(List<TreeNode> add, List<TreeNode> remove) { Set<TreeItem<TreeNode>> updated = new HashSet<>(); ArrayDeque<TreeNode> queue = new ArrayDeque<>(); queue.addAll(add);//from ww w.j av a 2 s. c o m while (!queue.isEmpty()) { TreeNode thisNode = queue.pop(); TreeItem<TreeNode> parent; if (thisNode.getParent() == null) { parent = rootItem; } else { parent = itemMap.get(thisNode.getParent()); } updated.add(parent); TreeItem<TreeNode> thisItem = new TreeItem<>(thisNode); thisItem.addEventHandler(TreeItem.<TreeNode>branchExpandedEvent(), event -> { if (thisItem.getChildren().size() == 1) { thisItem.getChildren().get(0).setExpanded(true); } }); thisItem.setGraphic(new ImageView(new Image(getIconForTreeItem(thisNode)))); FutureTask<Void> call = new FutureTask<>(() -> { parent.getChildren().add(thisItem); return null; }); Platform.runLater(call); try { call.get(); } catch (InterruptedException | ExecutionException e) { e.printStackTrace(); } itemMap.put(thisNode, thisItem); queue.addAll(thisNode.getChildren()); } for (TreeItem<TreeNode> parent : updated) { if (parent.getChildren().size() > 1) { FutureTask<Void> call = new FutureTask<>(() -> { parent.getChildren().sort((a, b) -> { int ac = a.getValue().getChildren().size(); int bc = b.getValue().getChildren().size(); if (ac == 0 && bc != 0) return 1; else if (ac != 0 && bc == 0) return -1; return a.getValue().getDisplayName().compareTo(b.getValue().getDisplayName()); }); return null; }); Platform.runLater(call); try { call.get(); } catch (InterruptedException | ExecutionException e) { e.printStackTrace(); } } } queue.addAll(remove); while (!queue.isEmpty()) { TreeNode thisNode = queue.pop(); TreeItem<TreeNode> thisItem = itemMap.remove(thisNode); thisItem.getParent().getChildren().remove(thisItem); queue.addAll(thisNode.getChildren()); } }
From source file:cz.lbenda.dataman.rc.DatamanApp.java
@SuppressWarnings("unchecked") @Override/*from ww w . j a v a2 s .co m*/ public void start(Stage primaryStage) throws Exception { StatusHelper.getInstance().setStatusBar(statusBar); Thread.currentThread().setUncaughtExceptionHandler((thread, throwable) -> ExceptionMessageFrmController .showException(MessageFactory.getInstance().getMessage("UncaughtException"), throwable)); ribbon = new Ribbon(MessageFactory.getInstance().getMessage("app.name"), IconFactory.getInstance().image(this, "dataman.png", IconFactory.IconLocation.APP_ICON)); primaryStage.getIcons().add(new Image(this.getClass().getResourceAsStream("dataman16.png"))); primaryStage.getIcons().add(new Image(this.getClass().getResourceAsStream("dataman32.png"))); primaryStage.getIcons().add(new Image(this.getClass().getResourceAsStream("dataman48.png"))); primaryStage.getIcons().add(new Image(this.getClass().getResourceAsStream("dataman64.png"))); primaryStage.getIcons().add(new Image(this.getClass().getResourceAsStream("dataman128.png"))); primaryStage.setTitle(MessageFactory.getInstance().getMessage("app.name")); DbConfigFactory.reloadConfiguration(); ObjectProperty<DbConfig> currentDbProperty = new SimpleObjectProperty<>(); ObjectProperty<TableDesc> selectedTableDescProperty = new SimpleObjectProperty<>(); prepareMainPane(); ribbon.itemsProperty().addAll(new AddDatabaseHandler(), new ImportDatabaseHandler(), new ExportDatabaseHandler(currentDbProperty), new DbConfigMenuOptions(currentDbProperty), new ConnectDatabaseHandler(currentDbProperty), new EditDatabaseHandler(currentDbProperty), new CopyDatabaseHandler(currentDbProperty), new RemoveDatabaseHandler(currentDbProperty), new ReloadDatabaseHandler(currentDbProperty), new RemoveRowsHandler(tableViewObjectProperty), new AddRowHandler(tableViewObjectProperty), new ReloadTableHandler(tableViewObjectProperty), new SaveTableHandler(tableViewObjectProperty), new SaveAllTableHandler(currentDbProperty), new OpenConnectedTablesHandler(tableViewObjectProperty, detailDescriptor -> addRemoveToDetail(detailDescriptor.getTitle(), detailDescriptor.getNode(), detailDescriptor.getClosable())), new ExportTableHandler(sqlQueryRowsObjectProperty), new ExportTableWithTemplateHandler(sqlQueryRowsObjectProperty), new AboutApplicationHandler()); Scene scene = new Scene(mainPane); te = new SQLEditorController(ribbon::addItem, scene, currentDbProperty, nodeShower); addToCenter(SQLEditorController.WINDOW_TITLE, te.getNode(), false); Tuple2<Parent, DbTableStructureFrmController> dbTableStructureFrmController = DbTableStructureFrmController .createNewInstance(); addToCenter(DbTableStructureFrmController.WINDOW_TITLE, dbTableStructureFrmController.get1(), false); selectedTableDescProperty.addListener( (observable, oldValue, newValue) -> dbTableStructureFrmController.get2().setTableDesc(newValue)); DbStructureFrmController dfc = new DbStructureFrmController(currentDbProperty, td -> new Thread(() -> { StatusHelper.getInstance().progressStart(td, DataTableFrmController.TASK_NAME, 2); StatusHelper.getInstance().progressNextStep(td, td.getName(), 0); DataTableFrmController controller = new DataTableFrmController(td); StatusHelper.getInstance().progressNextStep(td, td.getName(), 0); Platform.runLater(() -> addToCenter(controller.titleProperty(), controller.getTabView(), true)); StatusHelper.getInstance().progressFinish(td, DataTableFrmController.STEP_FINISH); }).start(), selectedTableDescProperty); leftPane.getChildren().add(dfc.getControlledNode()); RowEditorFrmController rowEditorFrmController = new RowEditorFrmController(tableViewObjectProperty); addToRight(RowEditorFrmController.WINDOW_TITLE, rowEditorFrmController.getPane()); // Scene scene = te.createScene(); primaryStage.setScene(scene); primaryStage.setOnCloseRequest(event -> { if (!DialogHelper.getInstance().showUnsavedObjectDialog(SavableRegistry.getInstance())) { event.consume(); } }); primaryStage.show(); /* try { // AquaFx.style(); // FlatterFX.style(); //AeroFX.style(); } catch (Exception e) { LOG.error("Problem with switch to AquaFx style", e); } */ }
From source file:calendarioSeries.vistas.MainViewController.java
public void showDetallesMes(Mes mes) { // System.out.println(mes.getNumAno() + " - " + mes.getNumMes() + "(" + mes.getDiasMes() + ")"); Platform.runLater(new Runnable() { @Override/* w ww .j a v a 2s . c o m*/ public void run() { for (Label diasMe : diasMes) { diasMe.setStyle(""); diasMe.setId(""); } labelNombreMes.setText(mes.getNombreMes().toUpperCase()); labelNumMes.setText(Integer.toString(mes.getNumMes() + 1)); labelNumAno.setText(Integer.toString(mes.getNumAno())); Calendar cal = Calendar.getInstance(); cal.set(Calendar.MONTH, mes.getNumMes()); cal.set(Calendar.YEAR, mes.getNumAno()); cal.set(Calendar.DAY_OF_MONTH, 1); int firstDay = cal.getTime().getDay(); if (firstDay != 0) { firstDay -= 1; } else { firstDay = 6; } int count = 1; for (int i = 0; i < mes.getDiasMes(); i++) { String caps = ""; for (Serie serie : series) { Map<Integer, String> capitulosMes = serie.getCapitulosMes(mes.getNumAno(), mes.getNumMes() + 1); if (capitulosMes.get(count) != null) { for (Map.Entry<Integer, String> entry : capitulosMes.entrySet()) { if (entry.getKey() == count) { if (entry.getValue().length() >= 30) { caps += serie.getTitulo() + ": +2 caps"; } else { caps += serie.getTitulo() + ": " + entry.getValue(); caps += "\n"; } } } } } diasMes.get(firstDay + i).setText(Integer.toString(count) + "\n\n" + caps); if (mes.getNumAno() == esteAno) { if (mes.getNumMes() == esteMes) { if (count == hoy) { diasMes.get(firstDay + i).setId("hoy"); } else if (count < hoy) { diasMes.get(firstDay + i).setStyle("-fx-text-fill: grey;"); } } else if (mes.getNumMes() < esteMes) { diasMes.get(firstDay + i).setStyle("-fx-text-fill: grey;"); } } else if (mes.getNumAno() < esteAno) { diasMes.get(firstDay + i).setStyle("-fx-text-fill: grey;"); } count++; } } }); }