List of usage examples for javafx.beans.value ChangeListener ChangeListener
ChangeListener
From source file:ch.unibas.fittingwizard.presentation.fitting.FitResultPage.java
private void initializeFits() { ArrayList<Fit> fits = fitRepository.loadAll(); for (Fit fit : fits) { cbFitResults.getItems().add(new FitViewModel(fit)); }//w ww . j a v a2s .c o m cbFitResults.autosize(); cbFitResults.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<FitViewModel>() { @Override public void changed(ObservableValue<? extends FitViewModel> observableValue, FitViewModel fitOld, FitViewModel fitNew) { logger.info("Fit selection changed to " + (fitNew != null ? fitNew : "nothing")); Fit fit = fitNew.getFit(); setRmse(fit); generateTableData(fit); selectAllMolecules(); } private void setRmse(Fit fit) { lblRmse.setText(String.valueOf(fit.getRmse())); } private void selectAllMolecules() { cbMolecules.getSelectionModel().selectFirst(); } }); }
From source file:com.vladsch.idea.multimarkdown.editor.MultiMarkdownFxPreviewEditor.java
protected void addStateChangeListener() { webEngine.getLoadWorker().stateProperty().addListener(new ChangeListener<Worker.State>() { @Override// ww w . j a v a2 s . c om public void changed(ObservableValue<? extends Worker.State> observable, Worker.State oldState, Worker.State newState) { if (project.isDisposed()) return; workerStateChanged(observable, oldState, newState); } }); }
From source file:net.sourceforge.msscodefactory.cfbamcustom.v2_9.CFBamCustomEditor.CFBamCustomEditorParamListPane.java
public CFBamCustomEditorParamListPane(ICFFormManager formManager, ICFBamJavaFXSchema argSchema, ICFBamServerMethodObj argContainer, ICFBamParamObj argFocus, Collection<ICFBamParamObj> argDataCollection, ICFRefreshCallback refreshCallback, boolean sortByChain) { super();/*from w w w . ja v a 2 s. c om*/ final String S_ProcName = "construct-schema-focus"; if (formManager == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 1, "formManager"); } cfFormManager = formManager; if (argSchema == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 2, "argSchema"); } // argFocus is optional; focus may be set later during execution as // conditions of the runtime change. javafxSchema = argSchema; javaFXFocus = argFocus; javafxContainer = argContainer; javafxRefreshCallback = refreshCallback; javafxSortByChain = sortByChain; setJavaFXDataCollection(argDataCollection); dataTable = new TableView<ICFBamParamObj>(); tableColumnId = new TableColumn<ICFBamParamObj, Long>("Id"); tableColumnId .setCellValueFactory(new Callback<CellDataFeatures<ICFBamParamObj, Long>, ObservableValue<Long>>() { public ObservableValue<Long> call(CellDataFeatures<ICFBamParamObj, Long> p) { ICFBamParamObj obj = p.getValue(); if (obj == null) { return (null); } else { long value = obj.getRequiredId(); Long wrapped = new Long(value); ReadOnlyObjectWrapper<Long> observable = new ReadOnlyObjectWrapper<Long>(); observable.setValue(wrapped); return (observable); } } }); tableColumnId .setCellFactory(new Callback<TableColumn<ICFBamParamObj, Long>, TableCell<ICFBamParamObj, Long>>() { @Override public TableCell<ICFBamParamObj, Long> call(TableColumn<ICFBamParamObj, Long> arg) { return new CFInt64TableCell<ICFBamParamObj>(); } }); dataTable.getColumns().add(tableColumnId); tableColumnName = new TableColumn<ICFBamParamObj, String>("Name"); tableColumnName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamParamObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamParamObj, String> p) { ICFBamParamObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getRequiredName(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnName.setCellFactory( new Callback<TableColumn<ICFBamParamObj, String>, TableCell<ICFBamParamObj, String>>() { @Override public TableCell<ICFBamParamObj, String> call(TableColumn<ICFBamParamObj, String> arg) { return new CFStringTableCell<ICFBamParamObj>(); } }); dataTable.getColumns().add(tableColumnName); tableColumnLookupDefSchema = new TableColumn<ICFBamParamObj, ICFBamSchemaDefObj>("Defining Schema"); tableColumnLookupDefSchema.setCellValueFactory( new Callback<CellDataFeatures<ICFBamParamObj, ICFBamSchemaDefObj>, ObservableValue<ICFBamSchemaDefObj>>() { public ObservableValue<ICFBamSchemaDefObj> call( CellDataFeatures<ICFBamParamObj, ICFBamSchemaDefObj> p) { ICFBamParamObj obj = p.getValue(); if (obj == null) { return (null); } else { ICFBamSchemaDefObj ref = obj.getOptionalLookupDefSchema(); ReadOnlyObjectWrapper<ICFBamSchemaDefObj> observable = new ReadOnlyObjectWrapper<ICFBamSchemaDefObj>(); observable.setValue(ref); return (observable); } } }); tableColumnLookupDefSchema.setCellFactory( new Callback<TableColumn<ICFBamParamObj, ICFBamSchemaDefObj>, TableCell<ICFBamParamObj, ICFBamSchemaDefObj>>() { @Override public TableCell<ICFBamParamObj, ICFBamSchemaDefObj> call( TableColumn<ICFBamParamObj, ICFBamSchemaDefObj> arg) { return new CFReferenceTableCell<ICFBamParamObj, ICFBamSchemaDefObj>(); } }); dataTable.getColumns().add(tableColumnLookupDefSchema); tableColumnDescription = new TableColumn<ICFBamParamObj, String>("Description"); tableColumnDescription.setCellValueFactory( new Callback<CellDataFeatures<ICFBamParamObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamParamObj, String> p) { ICFBamParamObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getOptionalDescription(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnDescription.setCellFactory( new Callback<TableColumn<ICFBamParamObj, String>, TableCell<ICFBamParamObj, String>>() { @Override public TableCell<ICFBamParamObj, String> call(TableColumn<ICFBamParamObj, String> arg) { return new CFStringTableCell<ICFBamParamObj>(); } }); dataTable.getColumns().add(tableColumnDescription); tableColumnShortDescription = new TableColumn<ICFBamParamObj, String>("Short Description"); tableColumnShortDescription.setCellValueFactory( new Callback<CellDataFeatures<ICFBamParamObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamParamObj, String> p) { ICFBamParamObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getOptionalShortDescription(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnShortDescription.setCellFactory( new Callback<TableColumn<ICFBamParamObj, String>, TableCell<ICFBamParamObj, String>>() { @Override public TableCell<ICFBamParamObj, String> call(TableColumn<ICFBamParamObj, String> arg) { return new CFStringTableCell<ICFBamParamObj>(); } }); dataTable.getColumns().add(tableColumnShortDescription); tableColumnLookupType = new TableColumn<ICFBamParamObj, ICFBamValueObj>("Type Specification"); tableColumnLookupType.setCellValueFactory( new Callback<CellDataFeatures<ICFBamParamObj, ICFBamValueObj>, ObservableValue<ICFBamValueObj>>() { public ObservableValue<ICFBamValueObj> call( CellDataFeatures<ICFBamParamObj, ICFBamValueObj> p) { ICFBamParamObj obj = p.getValue(); if (obj == null) { return (null); } else { ICFBamValueObj ref = obj.getRequiredLookupType(); ReadOnlyObjectWrapper<ICFBamValueObj> observable = new ReadOnlyObjectWrapper<ICFBamValueObj>(); observable.setValue(ref); return (observable); } } }); tableColumnLookupType.setCellFactory( new Callback<TableColumn<ICFBamParamObj, ICFBamValueObj>, TableCell<ICFBamParamObj, ICFBamValueObj>>() { @Override public TableCell<ICFBamParamObj, ICFBamValueObj> call( TableColumn<ICFBamParamObj, ICFBamValueObj> arg) { return new CFReferenceTableCell<ICFBamParamObj, ICFBamValueObj>(); } }); dataTable.getColumns().add(tableColumnLookupType); dataTable.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<ICFBamParamObj>() { @Override public void changed(ObservableValue<? extends ICFBamParamObj> observable, ICFBamParamObj oldValue, ICFBamParamObj newValue) { setJavaFXFocus(newValue); } }); tableColumnIsNullable = new TableColumn<ICFBamParamObj, Boolean>("Is Nullable"); tableColumnIsNullable.setCellValueFactory( new Callback<CellDataFeatures<ICFBamParamObj, Boolean>, ObservableValue<Boolean>>() { public ObservableValue<Boolean> call(CellDataFeatures<ICFBamParamObj, Boolean> p) { ICFBamParamObj obj = p.getValue(); if (obj == null) { return (null); } else { boolean value = obj.getRequiredIsNullable(); Boolean wrapped = new Boolean(value); ReadOnlyObjectWrapper<Boolean> observable = new ReadOnlyObjectWrapper<Boolean>(); observable.setValue(wrapped); return (observable); } } }); tableColumnIsNullable.setCellFactory( new Callback<TableColumn<ICFBamParamObj, Boolean>, TableCell<ICFBamParamObj, Boolean>>() { @Override public TableCell<ICFBamParamObj, Boolean> call(TableColumn<ICFBamParamObj, Boolean> arg) { return new CFBoolTableCell<ICFBamParamObj>(); } }); dataTable.getColumns().add(tableColumnIsNullable); scrollMenu = new ScrollPane(); scrollMenu.setVbarPolicy(ScrollBarPolicy.NEVER); scrollMenu.setHbarPolicy(ScrollBarPolicy.AS_NEEDED); scrollMenu.setFitToHeight(true); scrollMenu.setContent(getPanelHBoxMenu()); setTop(scrollMenu); setCenter(dataTable); javafxIsInitializing = false; if (observableListOfParam != null) { dataTable.setItems(observableListOfParam); } adjustListButtons(); }
From source file:net.sourceforge.msscodefactory.cfbam.v2_7.CFBamJavaFX.CFBamJavaFXParamPickerPane.java
public CFBamJavaFXParamPickerPane(ICFFormManager formManager, ICFBamJavaFXSchema argSchema, ICFBamParamObj argFocus, ICFBamServerMethodObj argContainer, Collection<ICFBamParamObj> argDataCollection, ICFBamJavaFXParamChosen whenChosen) { super();/*from w ww . j a v a 2s .c om*/ final String S_ProcName = "construct-schema-focus"; if (formManager == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 1, "formManager"); } cfFormManager = formManager; if (argSchema == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 2, "argSchema"); } if (whenChosen == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 6, "whenChosen"); } invokeWhenChosen = whenChosen; // argFocus is optional; focus may be set later during execution as // conditions of the runtime change. javafxSchema = argSchema; javaFXFocus = argFocus; javafxContainer = argContainer; setJavaFXDataCollection(argDataCollection); dataTable = new TableView<ICFBamParamObj>(); tableColumnId = new TableColumn<ICFBamParamObj, Long>("Id"); tableColumnId .setCellValueFactory(new Callback<CellDataFeatures<ICFBamParamObj, Long>, ObservableValue<Long>>() { public ObservableValue<Long> call(CellDataFeatures<ICFBamParamObj, Long> p) { ICFBamParamObj obj = p.getValue(); if (obj == null) { return (null); } else { long value = obj.getRequiredId(); Long wrapped = new Long(value); ReadOnlyObjectWrapper<Long> observable = new ReadOnlyObjectWrapper<Long>(); observable.setValue(wrapped); return (observable); } } }); tableColumnId .setCellFactory(new Callback<TableColumn<ICFBamParamObj, Long>, TableCell<ICFBamParamObj, Long>>() { @Override public TableCell<ICFBamParamObj, Long> call(TableColumn<ICFBamParamObj, Long> arg) { return new CFInt64TableCell<ICFBamParamObj>(); } }); dataTable.getColumns().add(tableColumnId); tableColumnName = new TableColumn<ICFBamParamObj, String>("Name"); tableColumnName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamParamObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamParamObj, String> p) { ICFBamParamObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getRequiredName(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnName.setCellFactory( new Callback<TableColumn<ICFBamParamObj, String>, TableCell<ICFBamParamObj, String>>() { @Override public TableCell<ICFBamParamObj, String> call(TableColumn<ICFBamParamObj, String> arg) { return new CFStringTableCell<ICFBamParamObj>(); } }); dataTable.getColumns().add(tableColumnName); tableColumnShortDescription = new TableColumn<ICFBamParamObj, String>("Short Description"); tableColumnShortDescription.setCellValueFactory( new Callback<CellDataFeatures<ICFBamParamObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamParamObj, String> p) { ICFBamParamObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getOptionalShortDescription(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnShortDescription.setCellFactory( new Callback<TableColumn<ICFBamParamObj, String>, TableCell<ICFBamParamObj, String>>() { @Override public TableCell<ICFBamParamObj, String> call(TableColumn<ICFBamParamObj, String> arg) { return new CFStringTableCell<ICFBamParamObj>(); } }); dataTable.getColumns().add(tableColumnShortDescription); tableColumnDescription = new TableColumn<ICFBamParamObj, String>("Description"); tableColumnDescription.setCellValueFactory( new Callback<CellDataFeatures<ICFBamParamObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamParamObj, String> p) { ICFBamParamObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getOptionalDescription(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnDescription.setCellFactory( new Callback<TableColumn<ICFBamParamObj, String>, TableCell<ICFBamParamObj, String>>() { @Override public TableCell<ICFBamParamObj, String> call(TableColumn<ICFBamParamObj, String> arg) { return new CFStringTableCell<ICFBamParamObj>(); } }); dataTable.getColumns().add(tableColumnDescription); tableColumnIsNullable = new TableColumn<ICFBamParamObj, Boolean>("IsNullable"); tableColumnIsNullable.setCellValueFactory( new Callback<CellDataFeatures<ICFBamParamObj, Boolean>, ObservableValue<Boolean>>() { public ObservableValue<Boolean> call(CellDataFeatures<ICFBamParamObj, Boolean> p) { ICFBamParamObj obj = p.getValue(); if (obj == null) { return (null); } else { boolean value = obj.getRequiredIsNullable(); Boolean wrapped = new Boolean(value); ReadOnlyObjectWrapper<Boolean> observable = new ReadOnlyObjectWrapper<Boolean>(); observable.setValue(wrapped); return (observable); } } }); tableColumnIsNullable.setCellFactory( new Callback<TableColumn<ICFBamParamObj, Boolean>, TableCell<ICFBamParamObj, Boolean>>() { @Override public TableCell<ICFBamParamObj, Boolean> call(TableColumn<ICFBamParamObj, Boolean> arg) { return new CFBoolTableCell<ICFBamParamObj>(); } }); dataTable.getColumns().add(tableColumnIsNullable); tableColumnLookupDefSchema = new TableColumn<ICFBamParamObj, ICFBamSchemaDefObj>( "Defining Schema Definition"); tableColumnLookupDefSchema.setCellValueFactory( new Callback<CellDataFeatures<ICFBamParamObj, ICFBamSchemaDefObj>, ObservableValue<ICFBamSchemaDefObj>>() { public ObservableValue<ICFBamSchemaDefObj> call( CellDataFeatures<ICFBamParamObj, ICFBamSchemaDefObj> p) { ICFBamParamObj obj = p.getValue(); if (obj == null) { return (null); } else { ICFBamSchemaDefObj ref = obj.getOptionalLookupDefSchema(); ReadOnlyObjectWrapper<ICFBamSchemaDefObj> observable = new ReadOnlyObjectWrapper<ICFBamSchemaDefObj>(); observable.setValue(ref); return (observable); } } }); tableColumnLookupDefSchema.setCellFactory( new Callback<TableColumn<ICFBamParamObj, ICFBamSchemaDefObj>, TableCell<ICFBamParamObj, ICFBamSchemaDefObj>>() { @Override public TableCell<ICFBamParamObj, ICFBamSchemaDefObj> call( TableColumn<ICFBamParamObj, ICFBamSchemaDefObj> arg) { return new CFReferenceTableCell<ICFBamParamObj, ICFBamSchemaDefObj>(); } }); dataTable.getColumns().add(tableColumnLookupDefSchema); tableColumnLookupType = new TableColumn<ICFBamParamObj, ICFBamValueObj>("Type Specification"); tableColumnLookupType.setCellValueFactory( new Callback<CellDataFeatures<ICFBamParamObj, ICFBamValueObj>, ObservableValue<ICFBamValueObj>>() { public ObservableValue<ICFBamValueObj> call( CellDataFeatures<ICFBamParamObj, ICFBamValueObj> p) { ICFBamParamObj obj = p.getValue(); if (obj == null) { return (null); } else { ICFBamValueObj ref = obj.getRequiredLookupType(); ReadOnlyObjectWrapper<ICFBamValueObj> observable = new ReadOnlyObjectWrapper<ICFBamValueObj>(); observable.setValue(ref); return (observable); } } }); tableColumnLookupType.setCellFactory( new Callback<TableColumn<ICFBamParamObj, ICFBamValueObj>, TableCell<ICFBamParamObj, ICFBamValueObj>>() { @Override public TableCell<ICFBamParamObj, ICFBamValueObj> call( TableColumn<ICFBamParamObj, ICFBamValueObj> arg) { return new CFReferenceTableCell<ICFBamParamObj, ICFBamValueObj>(); } }); dataTable.getColumns().add(tableColumnLookupType); dataTable.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<ICFBamParamObj>() { @Override public void changed(ObservableValue<? extends ICFBamParamObj> observable, ICFBamParamObj oldValue, ICFBamParamObj newValue) { setJavaFXFocus(newValue); if (buttonChooseSelected != null) { if (newValue != null) { buttonChooseSelected.setDisable(false); } else { buttonChooseSelected.setDisable(true); } } } }); hboxMenu = new CFHBox(10); buttonCancel = new CFButton(); buttonCancel.setMinWidth(200); buttonCancel.setText("Cancel"); buttonCancel.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { cfFormManager.closeCurrentForm(); } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); hboxMenu.getChildren().add(buttonCancel); buttonChooseNone = new CFButton(); buttonChooseNone.setMinWidth(200); buttonChooseNone.setText("ChooseNone"); buttonChooseNone.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "schemaObj"); } invokeWhenChosen.choseParam(null); cfFormManager.closeCurrentForm(); } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); hboxMenu.getChildren().add(buttonChooseNone); buttonChooseSelected = new CFButton(); buttonChooseSelected.setMinWidth(200); buttonChooseSelected.setText("ChooseSelected"); buttonChooseSelected.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "schemaObj"); } ICFBamParamObj selectedInstance = getJavaFXFocusAsParam(); invokeWhenChosen.choseParam(selectedInstance); cfFormManager.closeCurrentForm(); } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); hboxMenu.getChildren().add(buttonChooseSelected); if (argFocus != null) { dataTable.getSelectionModel().select(argFocus); } setTop(hboxMenu); setCenter(dataTable); }
From source file:org.jevis.jeconfig.JEConfig.java
/** * Build an new JEConfig Login and main frame/stage * * @param primaryStage//w ww . ja v a2 s . c o m */ //@AITBilal - Dieses Method wird nirgendwo aufgerufen! private void buildGUI(Stage primaryStage) { try { LoginDialog loginD = new LoginDialog(); // ds = loginD.showSQL(primaryStage, _config.get<LoginIcon()); ds = loginD.showSQL(primaryStage);//Default // ds = loginD.showSQL(primaryStage, _config.getLoginIcon(), _config.getEnabledSSL(), _config.getShowServer(), _config.getDefaultServer());//KAUST // ds = loginD.showSQL(primaryStage, _config.getLoginIcon(), _config.getEnabledSSL(), _config.getShowServer(), _config.getDefaultServer());//Coffee // while (ds == null) { // Thread.sleep(100); // } // if (ds == null) { // System.exit(0); // } // System.exit(1); // ds = new JEVisDataSourceSQL("192.168.2.55", "3306", "jevis", "jevis", "jevistest", "Sys Admin", "jevis"); // ds.connect("Sys Admin", "jevis"); } catch (Exception ex) { Logger.getLogger(JEConfig.class.getName()).log(Level.SEVERE, null, ex); ExceptionDialog dia = new ExceptionDialog(); dia.show(primaryStage, "Error", "Could not connect to Server", ex, PROGRAMM_INFO); } _mainDS = ds; JEConfig.PROGRAMM_INFO.setJEVisAPI(ds.getInfo()); JEConfig.PROGRAMM_INFO.addLibrary(org.jevis.commons.application.Info.INFO); JEConfig.PROGRAMM_INFO.addLibrary(org.jevis.application.Info.INFO); PluginManager pMan = new PluginManager(ds); GlobalToolBar toolbar = new GlobalToolBar(pMan); pMan.addPluginsByUserSetting(null); StackPane root = new StackPane(); root.setId("mainpane"); BorderPane border = new BorderPane(); VBox vbox = new VBox(); vbox.getChildren().addAll(new TopMenu(), toolbar.ToolBarFactory()); border.setTop(vbox); border.setCenter(pMan.getView()); Statusbar statusBar = new Statusbar(ds); border.setBottom(statusBar); root.getChildren().addAll(border); Scene scene = new Scene(root, 300, 250); scene.getStylesheets().add("/styles/Styles.css"); primaryStage.getIcons().add(getImage("1393354629_Config-Tools.png")); primaryStage.setTitle("JEConfig"); primaryStage.setScene(scene); maximize(primaryStage); primaryStage.show(); try { // WelcomePage welcome = new WelcomePage(primaryStage, new URI("http://coffee-project.eu/")); // WelcomePage welcome = new WelcomePage(primaryStage, new URI("http://openjevis.org/projects/openjevis/wiki/JEConfig3#JEConfig-Version-3")); WelcomePage welcome = new WelcomePage(primaryStage, _config.getWelcomeURL()); } catch (URISyntaxException ex) { Logger.getLogger(JEConfig.class.getName()).log(Level.SEVERE, null, ex); } catch (MalformedURLException ex) { Logger.getLogger(JEConfig.class.getName()).log(Level.SEVERE, null, ex); } //Disable GUI is StatusBar note an disconnect root.disableProperty().bind(statusBar.connectedProperty.not()); primaryStage.onCloseRequestProperty().addListener(new ChangeListener<EventHandler<WindowEvent>>() { @Override public void changed(ObservableValue<? extends EventHandler<WindowEvent>> ov, EventHandler<WindowEvent> t, EventHandler<WindowEvent> t1) { try { System.out.println("Disconnect"); ds.disconnect(); } catch (JEVisException ex) { Logger.getLogger(JEConfig.class.getName()).log(Level.SEVERE, null, ex); } } }); }
From source file:org.sandsoft.acefx.AceEditor.java
private void loadThemeList() { themeListBox.setItems(FXCollections.observableArrayList(Themes.SUPPORTED_THEMES)); themeListBox.getSelectionModel().selectedItemProperty().addListener(new ChangeListener() { @Override//from w w w .j a v a 2 s. c o m public void changed(ObservableValue observable, Object oldValue, Object newValue) { if (newValue != null && oldValue != newValue) { Object data = themeListBox.getSelectionModel().getSelectedItem(); getEditor().setTheme(((ThemeData) data).getAlias()); } } }); }
From source file:view.FXApplicationController.java
@Override public void initialize(URL arg0, ResourceBundle arg1) { System.out.println("initialize called"); overlay3.addEventHandler(MouseEvent.ANY, new EventHandler<MouseEvent>() { @Override//from w w w .ja va 2 s .co m public void handle(MouseEvent mouse) { mouseX.set(mouse.getX()); mouseY.set(mouse.getY()); if (kComplexFlag) { if (mouse.getEventType() == MouseEvent.MOUSE_PRESSED) { Line line = new Line(); line.setStyle("-fx-stroke: red;"); overlay3.getChildren().add(line); line.setStartX(0); line.setStartY(0); line.setLayoutX(mouseX.get()); line.setLayoutY(mouseY.get()); lines.add(line); } if (mouse.isPrimaryButtonDown() && (!lines.isEmpty())) { Line line = lines.getLast(); double endXPos = mouseX.get() - line.getLayoutX(); double endYPos = mouseY.get() - line.getLayoutY(); line.setEndX(endXPos); line.setEndY(endYPos); calculatePercentageKComplex(); } } if (help1Flag) { double offsetSize = 1. / (activeChannels.size() + 1.); double posOnOverlay = mouse.getY(); double zoom = 1.0; for (int i = 0; i < activeChannels.size(); i++) { double realOffset = (1 - (i + 1.) * offsetSize); double upperBound = yAxis.getDisplayPosition( (realOffset - offsetSize / 2.) * yAxis.getUpperBound()) + yAxis.getLayoutY(); double lowerBound = yAxis.getDisplayPosition( (realOffset + offsetSize / 2.) * yAxis.getUpperBound()) + yAxis.getLayoutY(); if ((posOnOverlay <= upperBound) && (posOnOverlay > lowerBound)) { zoom = getZoomFromChannel(activeChannels.get(i)); } } space.set(75.0 * zoom / yAxis.getUpperBound() * yAxis.getHeight()); line1.setVisible(true); line2.setVisible(true); } else { line1.setVisible(false); line2.setVisible(false); } } }); //Key Listener lineChart.addEventHandler(KeyEvent.KEY_PRESSED, new EventHandler<KeyEvent>() { @Override public void handle(KeyEvent ke) { keyAction(ke); } }); toolBarGoto.addEventHandler(KeyEvent.KEY_PRESSED, new EventHandler<KeyEvent>() { @Override public void handle(KeyEvent ke) { if (ke.getCode() == KeyCode.ENTER) { int valueTextField = -1; try { valueTextField = Integer.parseInt(toolBarGoto.getText()); } catch (NumberFormatException e) { toolBarGoto.setText((currentEpoch + 1) + ""); valueTextField = currentEpoch + 1; Logger.getLogger(this.getClass().getName()).log(Level.INFO, "Error during handling enter key.", e); } if (valueTextField > dataModel.getNumberOf30sEpochs()) { valueTextField = dataModel.getNumberOf30sEpochs(); } else if (valueTextField < 1) { valueTextField = 1; } currentEpoch = valueTextField - 1; goToEpoch(currentEpoch); if (kComplexFlag) { calculatePercentageKComplex(); } } } }); choiceBox.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<String>() { @Override public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) { System.out.println(newValue); if (newValue != null) { featureModel.setFeatureChannel(Arrays.asList(channelNames).indexOf(newValue)); System.out.println("########" + Arrays.asList(channelNames).indexOf(newValue)); System.out.println(featureModel.getFeatureChannel()); featureModel.setTsneComputed(false); featureModel.setFeaturesComputed(false); featureModel.setClassificationDone(false); featureModel.setReadinDone(false); classifyButton.setDisable(false); recompute = true; if (viewModel.isKcMarkersActive()) { computeKCfeatures(); } else { overlay4.getChildren().clear(); } } } }); choiceBoxModel.getSelectionModel().selectedIndexProperty().addListener(new ChangeListener<Number>() { @Override public void changed(ObservableValue<? extends Number> observable, Number oldValue, Number newValue) { classifier = classifierList.get(newValue.intValue()); System.out.println(classifier); featureModel.setClassificationDone(false); featureModel.setReadinDone(false); classifyButton.setDisable(false); recompute = true; } }); primaryStage.setOnCloseRequest(new EventHandler<WindowEvent>() { @Override public void handle(WindowEvent event) { System.out.println("RandomAccessFile closed"); dataModel.getReader().close(); Platform.exit(); } }); kComplexOnAction(); help1OnAction(); }
From source file:org.sandsoft.acefx.AceEditor.java
private void loadModeList() { modeListBox.setItems(FXCollections.observableArrayList(Modes.SUPPORTED_MODES)); modeListBox.getSelectionModel().selectedItemProperty().addListener(new ChangeListener() { @Override/*from w w w .j a va 2 s . c o m*/ public void changed(ObservableValue observable, Object oldValue, Object newValue) { if (newValue != null && oldValue != newValue) { Object data = modeListBox.getSelectionModel().getSelectedItem(); getEditor().getSession().setMode(((ModeData) data).getAlias()); } } }); }
From source file:utilitybasedfx.MainGUIController.java
private boolean addChildren(TreeItem parentBranch, File parentFile) { boolean containsJavaFiles = false; File children[] = parentFile.listFiles(); if (children != null) { ArrayList<File> directories = new ArrayList<File>(); ArrayList<File> files = new ArrayList<File>(); for (File child : children) { if (child.isDirectory()) { directories.add(child);/*from ww w . ja v a 2 s . co m*/ } else { files.add(child); } } for (File dir : directories) { CheckBoxTreeItem<String> treeItem = new CheckBoxTreeItem<>(dir.getName()); treeItem.setExpanded(true); if (addChildren(treeItem, dir)) { containsJavaFiles = true; parentBranch.getChildren().add(treeItem); } } for (File file : files) { if (file.getName().endsWith(".java")) { CheckBoxTreeItem<String> treeItem = new CheckBoxTreeItem<>(file.getName()); treeItem.selectedProperty().addListener(new ChangeListener<Boolean>() { public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) { if (newValue) { addFilepathToArraylist(treeItem); } else { removeFilepathFromArraylist(treeItem); } } }); parentBranch.getChildren().add(treeItem); containsJavaFiles = true; } } } return containsJavaFiles; }
From source file:net.sourceforge.msscodefactory.cfbam.v2_7.CFBamJavaFX.CFBamJavaFXParamListPane.java
public CFBamJavaFXParamListPane(ICFFormManager formManager, ICFBamJavaFXSchema argSchema, ICFBamServerMethodObj argContainer, ICFBamParamObj argFocus, Collection<ICFBamParamObj> argDataCollection, ICFRefreshCallback refreshCallback, boolean sortByChain) { super();//from www . ja va 2 s. c om final String S_ProcName = "construct-schema-focus"; if (formManager == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 1, "formManager"); } cfFormManager = formManager; if (argSchema == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 2, "argSchema"); } // argFocus is optional; focus may be set later during execution as // conditions of the runtime change. javafxSchema = argSchema; javaFXFocus = argFocus; javafxContainer = argContainer; javafxRefreshCallback = refreshCallback; javafxSortByChain = sortByChain; setJavaFXDataCollection(argDataCollection); dataTable = new TableView<ICFBamParamObj>(); tableColumnId = new TableColumn<ICFBamParamObj, Long>("Id"); tableColumnId .setCellValueFactory(new Callback<CellDataFeatures<ICFBamParamObj, Long>, ObservableValue<Long>>() { public ObservableValue<Long> call(CellDataFeatures<ICFBamParamObj, Long> p) { ICFBamParamObj obj = p.getValue(); if (obj == null) { return (null); } else { long value = obj.getRequiredId(); Long wrapped = new Long(value); ReadOnlyObjectWrapper<Long> observable = new ReadOnlyObjectWrapper<Long>(); observable.setValue(wrapped); return (observable); } } }); tableColumnId .setCellFactory(new Callback<TableColumn<ICFBamParamObj, Long>, TableCell<ICFBamParamObj, Long>>() { @Override public TableCell<ICFBamParamObj, Long> call(TableColumn<ICFBamParamObj, Long> arg) { return new CFInt64TableCell<ICFBamParamObj>(); } }); dataTable.getColumns().add(tableColumnId); tableColumnName = new TableColumn<ICFBamParamObj, String>("Name"); tableColumnName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamParamObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamParamObj, String> p) { ICFBamParamObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getRequiredName(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnName.setCellFactory( new Callback<TableColumn<ICFBamParamObj, String>, TableCell<ICFBamParamObj, String>>() { @Override public TableCell<ICFBamParamObj, String> call(TableColumn<ICFBamParamObj, String> arg) { return new CFStringTableCell<ICFBamParamObj>(); } }); dataTable.getColumns().add(tableColumnName); tableColumnShortDescription = new TableColumn<ICFBamParamObj, String>("Short Description"); tableColumnShortDescription.setCellValueFactory( new Callback<CellDataFeatures<ICFBamParamObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamParamObj, String> p) { ICFBamParamObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getOptionalShortDescription(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnShortDescription.setCellFactory( new Callback<TableColumn<ICFBamParamObj, String>, TableCell<ICFBamParamObj, String>>() { @Override public TableCell<ICFBamParamObj, String> call(TableColumn<ICFBamParamObj, String> arg) { return new CFStringTableCell<ICFBamParamObj>(); } }); dataTable.getColumns().add(tableColumnShortDescription); tableColumnDescription = new TableColumn<ICFBamParamObj, String>("Description"); tableColumnDescription.setCellValueFactory( new Callback<CellDataFeatures<ICFBamParamObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamParamObj, String> p) { ICFBamParamObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getOptionalDescription(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnDescription.setCellFactory( new Callback<TableColumn<ICFBamParamObj, String>, TableCell<ICFBamParamObj, String>>() { @Override public TableCell<ICFBamParamObj, String> call(TableColumn<ICFBamParamObj, String> arg) { return new CFStringTableCell<ICFBamParamObj>(); } }); dataTable.getColumns().add(tableColumnDescription); tableColumnIsNullable = new TableColumn<ICFBamParamObj, Boolean>("IsNullable"); tableColumnIsNullable.setCellValueFactory( new Callback<CellDataFeatures<ICFBamParamObj, Boolean>, ObservableValue<Boolean>>() { public ObservableValue<Boolean> call(CellDataFeatures<ICFBamParamObj, Boolean> p) { ICFBamParamObj obj = p.getValue(); if (obj == null) { return (null); } else { boolean value = obj.getRequiredIsNullable(); Boolean wrapped = new Boolean(value); ReadOnlyObjectWrapper<Boolean> observable = new ReadOnlyObjectWrapper<Boolean>(); observable.setValue(wrapped); return (observable); } } }); tableColumnIsNullable.setCellFactory( new Callback<TableColumn<ICFBamParamObj, Boolean>, TableCell<ICFBamParamObj, Boolean>>() { @Override public TableCell<ICFBamParamObj, Boolean> call(TableColumn<ICFBamParamObj, Boolean> arg) { return new CFBoolTableCell<ICFBamParamObj>(); } }); dataTable.getColumns().add(tableColumnIsNullable); tableColumnLookupDefSchema = new TableColumn<ICFBamParamObj, ICFBamSchemaDefObj>( "Defining Schema Definition"); tableColumnLookupDefSchema.setCellValueFactory( new Callback<CellDataFeatures<ICFBamParamObj, ICFBamSchemaDefObj>, ObservableValue<ICFBamSchemaDefObj>>() { public ObservableValue<ICFBamSchemaDefObj> call( CellDataFeatures<ICFBamParamObj, ICFBamSchemaDefObj> p) { ICFBamParamObj obj = p.getValue(); if (obj == null) { return (null); } else { ICFBamSchemaDefObj ref = obj.getOptionalLookupDefSchema(); ReadOnlyObjectWrapper<ICFBamSchemaDefObj> observable = new ReadOnlyObjectWrapper<ICFBamSchemaDefObj>(); observable.setValue(ref); return (observable); } } }); tableColumnLookupDefSchema.setCellFactory( new Callback<TableColumn<ICFBamParamObj, ICFBamSchemaDefObj>, TableCell<ICFBamParamObj, ICFBamSchemaDefObj>>() { @Override public TableCell<ICFBamParamObj, ICFBamSchemaDefObj> call( TableColumn<ICFBamParamObj, ICFBamSchemaDefObj> arg) { return new CFReferenceTableCell<ICFBamParamObj, ICFBamSchemaDefObj>(); } }); dataTable.getColumns().add(tableColumnLookupDefSchema); tableColumnLookupType = new TableColumn<ICFBamParamObj, ICFBamValueObj>("Type Specification"); tableColumnLookupType.setCellValueFactory( new Callback<CellDataFeatures<ICFBamParamObj, ICFBamValueObj>, ObservableValue<ICFBamValueObj>>() { public ObservableValue<ICFBamValueObj> call( CellDataFeatures<ICFBamParamObj, ICFBamValueObj> p) { ICFBamParamObj obj = p.getValue(); if (obj == null) { return (null); } else { ICFBamValueObj ref = obj.getRequiredLookupType(); ReadOnlyObjectWrapper<ICFBamValueObj> observable = new ReadOnlyObjectWrapper<ICFBamValueObj>(); observable.setValue(ref); return (observable); } } }); tableColumnLookupType.setCellFactory( new Callback<TableColumn<ICFBamParamObj, ICFBamValueObj>, TableCell<ICFBamParamObj, ICFBamValueObj>>() { @Override public TableCell<ICFBamParamObj, ICFBamValueObj> call( TableColumn<ICFBamParamObj, ICFBamValueObj> arg) { return new CFReferenceTableCell<ICFBamParamObj, ICFBamValueObj>(); } }); dataTable.getColumns().add(tableColumnLookupType); dataTable.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<ICFBamParamObj>() { @Override public void changed(ObservableValue<? extends ICFBamParamObj> observable, ICFBamParamObj oldValue, ICFBamParamObj newValue) { setJavaFXFocus(newValue); } }); scrollMenu = new ScrollPane(); scrollMenu.setVbarPolicy(ScrollBarPolicy.NEVER); scrollMenu.setHbarPolicy(ScrollBarPolicy.AS_NEEDED); scrollMenu.setFitToHeight(true); scrollMenu.setContent(getPanelHBoxMenu()); setTop(scrollMenu); setCenter(dataTable); javafxIsInitializing = false; if (observableListOfParam != null) { dataTable.setItems(observableListOfParam); } adjustListButtons(); }