List of usage examples for javafx.beans.value ChangeListener ChangeListener
ChangeListener
From source file:net.sourceforge.msscodefactory.cfbam.v2_7.CFBamJavaFX.CFBamJavaFXScopeListPane.java
public CFBamJavaFXScopeListPane(ICFFormManager formManager, ICFBamJavaFXSchema argSchema, ICFLibAnyObj argContainer, ICFBamScopeObj argFocus, Collection<ICFBamScopeObj> argDataCollection, ICFRefreshCallback refreshCallback, boolean sortByChain) { super();/*from www . jav 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"); } // 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<ICFBamScopeObj>(); tableColumnObjKind = new TableColumn<ICFBamScopeObj, String>("Class Code"); tableColumnObjKind.setCellValueFactory( new Callback<CellDataFeatures<ICFBamScopeObj, String>, ObservableValue<String>>() { @Override public ObservableValue<String> call(CellDataFeatures<ICFBamScopeObj, String> p) { ICFBamScopeObj obj = p.getValue(); if (obj == null) { return (null); } else { String classCode = obj.getClassCode(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(classCode); return (observable); } } }); tableColumnObjKind.setCellFactory( new Callback<TableColumn<ICFBamScopeObj, String>, TableCell<ICFBamScopeObj, String>>() { @Override public TableCell<ICFBamScopeObj, String> call(TableColumn<ICFBamScopeObj, String> arg) { return new CFStringTableCell<ICFBamScopeObj>(); } }); dataTable.getColumns().add(tableColumnObjKind); tableColumnId = new TableColumn<ICFBamScopeObj, Long>("Id"); tableColumnId .setCellValueFactory(new Callback<CellDataFeatures<ICFBamScopeObj, Long>, ObservableValue<Long>>() { public ObservableValue<Long> call(CellDataFeatures<ICFBamScopeObj, Long> p) { ICFBamScopeObj 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<ICFBamScopeObj, Long>, TableCell<ICFBamScopeObj, Long>>() { @Override public TableCell<ICFBamScopeObj, Long> call(TableColumn<ICFBamScopeObj, Long> arg) { return new CFInt64TableCell<ICFBamScopeObj>(); } }); dataTable.getColumns().add(tableColumnId); dataTable.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<ICFBamScopeObj>() { @Override public void changed(ObservableValue<? extends ICFBamScopeObj> observable, ICFBamScopeObj oldValue, ICFBamScopeObj 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 (observableListOfScope != null) { dataTable.setItems(observableListOfScope); } adjustListButtons(); }
From source file:dsfixgui.view.DSFHudPane.java
private void initializeEventHandlers() { applySettingsButton.setOnAction(e -> { ui.applyDSFConfig();//from ww w.ja v a 2 s .c o m }); restoreDefaultsButton.setOnAction(e -> { ContinueDialog cD = new ContinueDialog(300.0, 80.0, DIALOG_TITLE_RESET, DIALOG_MSG_RESTORE_SETTINGS, DIALOG_BUTTON_TEXTS[2], DIALOG_BUTTON_TEXTS[1]); if (cD.show()) { config.restoreDefaultHUDOptions(); ui.refreshUI(); } }); hudModsPicker.setOnAction(e -> { if (hudModsPicker.getValue().equals(DISABLE_ENABLE[0])) { minimalHUDPicker.setDisable(true); hudScaleField.setDisable(true); topLeftHUDOpField.setDisable(true); bottomLeftHUDOpField.setDisable(true); bottomRightHUDOpField.setDisable(true); config.enableHudMod.set(0); } else { minimalHUDPicker.setDisable(false); hudScaleField.setDisable(false); topLeftHUDOpField.setDisable(false); bottomLeftHUDOpField.setDisable(false); bottomRightHUDOpField.setDisable(false); config.enableHudMod.set(1); } }); minimalHUDPicker.setOnAction(e -> { if (minimalHUDPicker.getValue().equals(DISABLE_ENABLE[0])) { config.enableMinimalHud.set(0); } else { config.enableMinimalHud.set(1); } }); hudScaleField.textProperty().addListener(new ChangeListener<String>() { @Override public void changed(ObservableValue<? extends String> observable, String oldText, String newText) { try { if (!NumberUtils.isParsable(newText) || Double.parseDouble(newText) < 0.0 || Double.parseDouble(newText) > 1.0) { hudScaleField.pseudoClassStateChanged(INVALID_INPUT, true); hudScaleField.setTooltip(new Tooltip(INVALID_DOUBLE_0_1)); } else { hudScaleField.pseudoClassStateChanged(INVALID_INPUT, false); hudScaleField.setTooltip(new Tooltip("")); config.hudScaleFactor.replace(0, config.hudScaleFactor.length(), Double.parseDouble(decimalFormat.format(Double.parseDouble(newText))) + ""); } } catch (NumberFormatException nFE) { ui.printConsole(INPUT_TOO_LARGE); hudScaleField.setText(""); } } }); topLeftHUDOpField.textProperty().addListener(new ChangeListener<String>() { @Override public void changed(ObservableValue<? extends String> observable, String oldText, String newText) { try { if (!NumberUtils.isParsable(newText) || Double.parseDouble(newText) < 0.0 || Double.parseDouble(newText) > 1.0) { topLeftHUDOpField.pseudoClassStateChanged(INVALID_INPUT, true); topLeftHUDOpField.setTooltip(new Tooltip(INVALID_DOUBLE_0_1)); } else { topLeftHUDOpField.pseudoClassStateChanged(INVALID_INPUT, false); topLeftHUDOpField.setTooltip(new Tooltip("")); config.hudTopLeftOpacity.replace(0, config.hudTopLeftOpacity.length(), decimalFormat.format(Double.parseDouble(newText)) + "f"); } } catch (NumberFormatException nFE) { ui.printConsole(INPUT_TOO_LARGE); topLeftHUDOpField.setText(""); } } }); bottomLeftHUDOpField.textProperty().addListener(new ChangeListener<String>() { @Override public void changed(ObservableValue<? extends String> observable, String oldText, String newText) { try { if (!NumberUtils.isParsable(newText) || Double.parseDouble(newText) < 0.0 || Double.parseDouble(newText) > 1.0) { bottomLeftHUDOpField.pseudoClassStateChanged(INVALID_INPUT, true); bottomLeftHUDOpField.setTooltip(new Tooltip(INVALID_DOUBLE_0_1)); } else { bottomLeftHUDOpField.pseudoClassStateChanged(INVALID_INPUT, false); bottomLeftHUDOpField.setTooltip(new Tooltip("")); config.hudBottomLeftOpacity.replace(0, config.hudBottomLeftOpacity.length(), decimalFormat.format(Double.parseDouble(newText)) + "f"); } } catch (NumberFormatException nFE) { ui.printConsole(INPUT_TOO_LARGE); bottomLeftHUDOpField.setText(""); } } }); bottomRightHUDOpField.textProperty().addListener(new ChangeListener<String>() { @Override public void changed(ObservableValue<? extends String> observable, String oldText, String newText) { try { if (!NumberUtils.isParsable(newText) || Double.parseDouble(newText) < 0.0 || Double.parseDouble(newText) > 1.0) { bottomRightHUDOpField.pseudoClassStateChanged(INVALID_INPUT, true); bottomRightHUDOpField.setTooltip(new Tooltip(INVALID_DOUBLE_0_1)); } else { bottomRightHUDOpField.pseudoClassStateChanged(INVALID_INPUT, false); bottomRightHUDOpField.setTooltip(new Tooltip("")); config.hudBottomRightOpacity.replace(0, config.hudBottomRightOpacity.length(), decimalFormat.format(Double.parseDouble(newText)) + "f"); } } catch (NumberFormatException nFE) { ui.printConsole(INPUT_TOO_LARGE); bottomRightHUDOpField.setText(""); } } }); }
From source file:de.bayern.gdi.gui.Controller.java
/** * Initializes gui elements.// ww w .ja v a 2 s.c o m */ @FXML protected void initialize() { logHistoryParent.expandedProperty().addListener(new ChangeListener() { @Override public void changed(ObservableValue o, Object oldVal, Object newVal) { boolean val = (boolean) newVal; if (val) { logHistoryParent.getTooltip().setText(I18n.format("tooltip.log_history_expanded")); } else { logHistoryParent.getTooltip().setText(I18n.format("tooltip.log_history_hidden")); } } }); }
From source file:com.core.meka.SOMController.java
private void initListeners() { entradas_text.textProperty().addListener(new ChangeListener<String>() { @Override// www.ja v a 2 s . co m public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) { if (!newValue.matches("\\d*")) { entradas_text.setText(newValue.replaceAll("[^\\d]", "")); } } }); epocas_text.textProperty().addListener(new ChangeListener<String>() { @Override public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) { if (!newValue.matches("\\d*")) { epocas_text.setText(newValue.replaceAll("[^\\d]", "")); } } }); neuronas_text.textProperty().addListener(new ChangeListener<String>() { @Override public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) { if (!newValue.matches("\\d*")) { neuronas_text.setText(newValue.replaceAll("[^\\d]", "")); } } }); pesos_check.selectedProperty().addListener(new ChangeListener<Boolean>() { @Override public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) { if (!newValue) { pesos_label.setVisible(true); pesos_text.setVisible(true); } else { pesos_label.setVisible(false); pesos_text.setVisible(false); } } }); base.setOnKeyReleased(new EventHandler<KeyEvent>() { @Override public void handle(KeyEvent event) { if (event.getCode().equals(KeyCode.ESCAPE)) { Util.closeWindow(ac); } } }); cargar_patrones_menuitem.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { try { String patrones = cargarArrayDesdeArchivo(); patrones_train_text.setText(patrones); } catch (IOException ex) { Logger.getLogger(SOMController.class.getName()).log(Level.SEVERE, null, ex); result_text.setText("Excepcion capturada, verifique la pila: \n" + ex.getMessage()); } } }); cargar_pesos_menuitem.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { try { String patrones = cargarArrayDesdeArchivo(); pesos_text.setText(patrones); } catch (IOException ex) { Logger.getLogger(SOMController.class.getName()).log(Level.SEVERE, null, ex); result_text.setText("Excepcion capturada, verifique la pila: \n" + ex.getMessage()); } } }); patrones_test_menuitem.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { try { String patrones = cargarArrayDesdeArchivo(); patrones_test_text.setText(patrones); } catch (IOException ex) { Logger.getLogger(SOMController.class.getName()).log(Level.SEVERE, null, ex); result_text.setText("Excepcion capturada, verifique la pila: \n" + ex.getMessage()); } } }); nueva_simulacion_menuitem.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { borrar(neuronas_text, epocas_text, entradas_text); borrar(patrones_train_text, pesos_text); } }); ejecutar_entrenamiento_menuitem.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { tab.getSelectionModel().select(train_tab); train(); } }); ejecutar_test_menuitem.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { test(); } }); guardar_patrones_menuitem.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { String patrones = formatArray(patrones_train_text.getText()); tab.getSelectionModel().selectFirst(); try { guardarArrayAArchivo(patrones.replaceAll(";", ";\n"), result_text); } catch (IOException ex) { result_text.setText("Excepcion capturada:\n" + ex.getMessage().replaceAll("\\)", "\\)\n") + result_text.getText()); Logger.getLogger(SOMController.class.getName()).log(Level.SEVERE, null, ex); } } }); guardar_pesos_menuitem.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { String patrones = formatArray(pesos_text.getText()); tab.getSelectionModel().selectFirst(); try { guardarArrayAArchivo(patrones.replaceAll(";", ";\n"), result_text); } catch (IOException ex) { result_text.setText("Excepcion capturada:\n" + ex.getMessage().replaceAll("\\)", "\\)\n") + result_text.getText()); Logger.getLogger(SOMController.class.getName()).log(Level.SEVERE, null, ex); } } }); guardar_patrones_test_menuitem.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { String patrones = formatArray(patrones_test_text.getText()); tab.getSelectionModel().selectFirst(); try { guardarArrayAArchivo(patrones.replaceAll(";", ";\n"), result_text); } catch (IOException ex) { result_text.setText("Excepcion capturada:\n" + ex.getMessage().replaceAll("\\)", "\\)\n") + result_text.getText()); Logger.getLogger(SOMController.class.getName()).log(Level.SEVERE, null, ex); } } }); }
From source file:net.sourceforge.msscodefactory.cfbam.v2_7.CFBamJavaFX.CFBamJavaFXEnumTagListPane.java
public CFBamJavaFXEnumTagListPane(ICFFormManager formManager, ICFBamJavaFXSchema argSchema, ICFBamEnumDefObj argContainer, ICFBamEnumTagObj argFocus, Collection<ICFBamEnumTagObj> argDataCollection, ICFRefreshCallback refreshCallback, boolean sortByChain) { super();/*from w w w. j a v a 2 s. co m*/ 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<ICFBamEnumTagObj>(); tableColumnId = new TableColumn<ICFBamEnumTagObj, Long>("Id"); tableColumnId.setCellValueFactory( new Callback<CellDataFeatures<ICFBamEnumTagObj, Long>, ObservableValue<Long>>() { public ObservableValue<Long> call(CellDataFeatures<ICFBamEnumTagObj, Long> p) { ICFBamEnumTagObj 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<ICFBamEnumTagObj, Long>, TableCell<ICFBamEnumTagObj, Long>>() { @Override public TableCell<ICFBamEnumTagObj, Long> call(TableColumn<ICFBamEnumTagObj, Long> arg) { return new CFInt64TableCell<ICFBamEnumTagObj>(); } }); dataTable.getColumns().add(tableColumnId); tableColumnEnumCode = new TableColumn<ICFBamEnumTagObj, Short>("EnumCode"); tableColumnEnumCode.setCellValueFactory( new Callback<CellDataFeatures<ICFBamEnumTagObj, Short>, ObservableValue<Short>>() { public ObservableValue<Short> call(CellDataFeatures<ICFBamEnumTagObj, Short> p) { ICFBamEnumTagObj obj = p.getValue(); if (obj == null) { return (null); } else { Short value = obj.getOptionalEnumCode(); ReadOnlyObjectWrapper<Short> observable = new ReadOnlyObjectWrapper<Short>(); observable.setValue(value); return (observable); } } }); tableColumnEnumCode.setCellFactory( new Callback<TableColumn<ICFBamEnumTagObj, Short>, TableCell<ICFBamEnumTagObj, Short>>() { @Override public TableCell<ICFBamEnumTagObj, Short> call(TableColumn<ICFBamEnumTagObj, Short> arg) { return new CFInt16TableCell<ICFBamEnumTagObj>(); } }); dataTable.getColumns().add(tableColumnEnumCode); tableColumnName = new TableColumn<ICFBamEnumTagObj, String>("Name"); tableColumnName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamEnumTagObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamEnumTagObj, String> p) { ICFBamEnumTagObj 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<ICFBamEnumTagObj, String>, TableCell<ICFBamEnumTagObj, String>>() { @Override public TableCell<ICFBamEnumTagObj, String> call(TableColumn<ICFBamEnumTagObj, String> arg) { return new CFStringTableCell<ICFBamEnumTagObj>(); } }); dataTable.getColumns().add(tableColumnName); tableColumnLookupDefSchema = new TableColumn<ICFBamEnumTagObj, ICFBamSchemaDefObj>( "Defining Schema Definition"); tableColumnLookupDefSchema.setCellValueFactory( new Callback<CellDataFeatures<ICFBamEnumTagObj, ICFBamSchemaDefObj>, ObservableValue<ICFBamSchemaDefObj>>() { public ObservableValue<ICFBamSchemaDefObj> call( CellDataFeatures<ICFBamEnumTagObj, ICFBamSchemaDefObj> p) { ICFBamEnumTagObj 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<ICFBamEnumTagObj, ICFBamSchemaDefObj>, TableCell<ICFBamEnumTagObj, ICFBamSchemaDefObj>>() { @Override public TableCell<ICFBamEnumTagObj, ICFBamSchemaDefObj> call( TableColumn<ICFBamEnumTagObj, ICFBamSchemaDefObj> arg) { return new CFReferenceTableCell<ICFBamEnumTagObj, ICFBamSchemaDefObj>(); } }); dataTable.getColumns().add(tableColumnLookupDefSchema); dataTable.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<ICFBamEnumTagObj>() { @Override public void changed(ObservableValue<? extends ICFBamEnumTagObj> observable, ICFBamEnumTagObj oldValue, ICFBamEnumTagObj 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 (observableListOfEnumTag != null) { dataTable.setItems(observableListOfEnumTag); } adjustListButtons(); }
From source file:net.sourceforge.msscodefactory.cfbam.v2_7.CFBamJavaFX.CFBamJavaFXSchemaRefPickerPane.java
public CFBamJavaFXSchemaRefPickerPane(ICFFormManager formManager, ICFBamJavaFXSchema argSchema, ICFBamSchemaRefObj argFocus, ICFBamSchemaDefObj argContainer, Collection<ICFBamSchemaRefObj> argDataCollection, ICFBamJavaFXSchemaRefChosen whenChosen) { super();/*from w w w .j a va2 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"); } 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<ICFBamSchemaRefObj>(); tableColumnId = new TableColumn<ICFBamSchemaRefObj, Long>("Id"); tableColumnId.setCellValueFactory( new Callback<CellDataFeatures<ICFBamSchemaRefObj, Long>, ObservableValue<Long>>() { public ObservableValue<Long> call(CellDataFeatures<ICFBamSchemaRefObj, Long> p) { ICFBamScopeObj 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<ICFBamSchemaRefObj, Long>, TableCell<ICFBamSchemaRefObj, Long>>() { @Override public TableCell<ICFBamSchemaRefObj, Long> call(TableColumn<ICFBamSchemaRefObj, Long> arg) { return new CFInt64TableCell<ICFBamSchemaRefObj>(); } }); dataTable.getColumns().add(tableColumnId); tableColumnName = new TableColumn<ICFBamSchemaRefObj, String>("Name"); tableColumnName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamSchemaRefObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamSchemaRefObj, String> p) { ICFBamSchemaRefObj 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<ICFBamSchemaRefObj, String>, TableCell<ICFBamSchemaRefObj, String>>() { @Override public TableCell<ICFBamSchemaRefObj, String> call(TableColumn<ICFBamSchemaRefObj, String> arg) { return new CFStringTableCell<ICFBamSchemaRefObj>(); } }); dataTable.getColumns().add(tableColumnName); tableColumnRefModelName = new TableColumn<ICFBamSchemaRefObj, String>("Ref. Model Name"); tableColumnRefModelName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamSchemaRefObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamSchemaRefObj, String> p) { ICFBamSchemaRefObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getRequiredRefModelName(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnRefModelName.setCellFactory( new Callback<TableColumn<ICFBamSchemaRefObj, String>, TableCell<ICFBamSchemaRefObj, String>>() { @Override public TableCell<ICFBamSchemaRefObj, String> call(TableColumn<ICFBamSchemaRefObj, String> arg) { return new CFStringTableCell<ICFBamSchemaRefObj>(); } }); dataTable.getColumns().add(tableColumnRefModelName); tableColumnIncludeRoot = new TableColumn<ICFBamSchemaRefObj, String>("Include Root"); tableColumnIncludeRoot.setCellValueFactory( new Callback<CellDataFeatures<ICFBamSchemaRefObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamSchemaRefObj, String> p) { ICFBamSchemaRefObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getRequiredIncludeRoot(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnIncludeRoot.setCellFactory( new Callback<TableColumn<ICFBamSchemaRefObj, String>, TableCell<ICFBamSchemaRefObj, String>>() { @Override public TableCell<ICFBamSchemaRefObj, String> call(TableColumn<ICFBamSchemaRefObj, String> arg) { return new CFStringTableCell<ICFBamSchemaRefObj>(); } }); dataTable.getColumns().add(tableColumnIncludeRoot); tableColumnLookupRefSchema = new TableColumn<ICFBamSchemaRefObj, ICFBamSchemaDefObj>("Referenced Schema"); tableColumnLookupRefSchema.setCellValueFactory( new Callback<CellDataFeatures<ICFBamSchemaRefObj, ICFBamSchemaDefObj>, ObservableValue<ICFBamSchemaDefObj>>() { public ObservableValue<ICFBamSchemaDefObj> call( CellDataFeatures<ICFBamSchemaRefObj, ICFBamSchemaDefObj> p) { ICFBamSchemaRefObj obj = p.getValue(); if (obj == null) { return (null); } else { ICFBamSchemaDefObj ref = obj.getOptionalLookupRefSchema(); ReadOnlyObjectWrapper<ICFBamSchemaDefObj> observable = new ReadOnlyObjectWrapper<ICFBamSchemaDefObj>(); observable.setValue(ref); return (observable); } } }); tableColumnLookupRefSchema.setCellFactory( new Callback<TableColumn<ICFBamSchemaRefObj, ICFBamSchemaDefObj>, TableCell<ICFBamSchemaRefObj, ICFBamSchemaDefObj>>() { @Override public TableCell<ICFBamSchemaRefObj, ICFBamSchemaDefObj> call( TableColumn<ICFBamSchemaRefObj, ICFBamSchemaDefObj> arg) { return new CFReferenceTableCell<ICFBamSchemaRefObj, ICFBamSchemaDefObj>(); } }); dataTable.getColumns().add(tableColumnLookupRefSchema); dataTable.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<ICFBamSchemaRefObj>() { @Override public void changed(ObservableValue<? extends ICFBamSchemaRefObj> observable, ICFBamSchemaRefObj oldValue, ICFBamSchemaRefObj 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.choseSchemaRef(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"); } ICFBamSchemaRefObj selectedInstance = getJavaFXFocusAsSchemaRef(); invokeWhenChosen.choseSchemaRef(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:jduagui.Controller.java
private ChangeListener setListener() { return new ChangeListener() { @Override//w w w . j a v a2s . c o m public void changed(ObservableValue observable, Object oldValue, Object newValue) { TreeItem<File> selectedItem = (TreeItem<File>) newValue; if (selectedItem.getValue().getAbsolutePath().equals(rootPath)) selectedPath = rootPath; else if (selectedItem.getValue().isDirectory()) selectedPath = selectedItem.getValue().getAbsolutePath(); else if (selectedItem.getValue().isFile()) selectedPath = selectedItem.getValue().getParent(); } }; }
From source file:de.thomasbolz.renamer.RenamerGUI.java
/** * Initialize the property bindings.//ww w .jav a 2s. co m */ private void initBindings() { // reflect changes of srcDirectory in the GUI and store the new source dir to the preferences srcDirectory.addListener(new ChangeListener<File>() { @Override public void changed(ObservableValue<? extends File> observableValue, File oldFile, File newFile) { if (newFile != null) { String path = newFile.getAbsolutePath(); lblSource.setText(path); setSourceDirectoryToPrefs(path); } setSimulationMode(true); } }); // reflect changes of targetDirectory in the GUI and store the new target dir to the preferences targetDirectory.addListener(new ChangeListener<File>() { @Override public void changed(ObservableValue<? extends File> observableValue, File oldFile, File newFile) { if (newFile != null) { String path = newFile.getAbsolutePath(); lblTarget.setText(path); setTargetDirectoryToPrefs(path); } setSimulationMode(true); } }); btnRename.textProperty() .bind(new When(simulationMode).then("Simulate renaming").otherwise("Execute renaming")); }
From source file:net.sourceforge.msscodefactory.cfbam.v2_7.CFBamJavaFX.CFBamJavaFXPopTopDepListPane.java
public CFBamJavaFXPopTopDepListPane(ICFFormManager formManager, ICFBamJavaFXSchema argSchema, ICFBamRelationObj argContainer, ICFBamPopTopDepObj argFocus, Collection<ICFBamPopTopDepObj> argDataCollection, ICFRefreshCallback refreshCallback, boolean sortByChain) { super();//from w ww.j av 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"); } // 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<ICFBamPopTopDepObj>(); tableColumnId = new TableColumn<ICFBamPopTopDepObj, Long>("Id"); tableColumnId.setCellValueFactory( new Callback<CellDataFeatures<ICFBamPopTopDepObj, Long>, ObservableValue<Long>>() { public ObservableValue<Long> call(CellDataFeatures<ICFBamPopTopDepObj, Long> p) { ICFBamScopeObj 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<ICFBamPopTopDepObj, Long>, TableCell<ICFBamPopTopDepObj, Long>>() { @Override public TableCell<ICFBamPopTopDepObj, Long> call(TableColumn<ICFBamPopTopDepObj, Long> arg) { return new CFInt64TableCell<ICFBamPopTopDepObj>(); } }); dataTable.getColumns().add(tableColumnId); tableColumnName = new TableColumn<ICFBamPopTopDepObj, String>("Name"); tableColumnName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamPopTopDepObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamPopTopDepObj, String> p) { ICFBamPopTopDepObj 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<ICFBamPopTopDepObj, String>, TableCell<ICFBamPopTopDepObj, String>>() { @Override public TableCell<ICFBamPopTopDepObj, String> call(TableColumn<ICFBamPopTopDepObj, String> arg) { return new CFStringTableCell<ICFBamPopTopDepObj>(); } }); dataTable.getColumns().add(tableColumnName); tableColumnLookupRelation = new TableColumn<ICFBamPopTopDepObj, ICFBamRelationObj>("Relation"); tableColumnLookupRelation.setCellValueFactory( new Callback<CellDataFeatures<ICFBamPopTopDepObj, ICFBamRelationObj>, ObservableValue<ICFBamRelationObj>>() { public ObservableValue<ICFBamRelationObj> call( CellDataFeatures<ICFBamPopTopDepObj, ICFBamRelationObj> p) { ICFBamPopTopDepObj obj = p.getValue(); if (obj == null) { return (null); } else { ICFBamRelationObj ref = obj.getRequiredLookupRelation(); ReadOnlyObjectWrapper<ICFBamRelationObj> observable = new ReadOnlyObjectWrapper<ICFBamRelationObj>(); observable.setValue(ref); return (observable); } } }); tableColumnLookupRelation.setCellFactory( new Callback<TableColumn<ICFBamPopTopDepObj, ICFBamRelationObj>, TableCell<ICFBamPopTopDepObj, ICFBamRelationObj>>() { @Override public TableCell<ICFBamPopTopDepObj, ICFBamRelationObj> call( TableColumn<ICFBamPopTopDepObj, ICFBamRelationObj> arg) { return new CFReferenceTableCell<ICFBamPopTopDepObj, ICFBamRelationObj>(); } }); dataTable.getColumns().add(tableColumnLookupRelation); tableColumnLookupDefSchema = new TableColumn<ICFBamPopTopDepObj, ICFBamSchemaDefObj>( "Defining Schema Definition"); tableColumnLookupDefSchema.setCellValueFactory( new Callback<CellDataFeatures<ICFBamPopTopDepObj, ICFBamSchemaDefObj>, ObservableValue<ICFBamSchemaDefObj>>() { public ObservableValue<ICFBamSchemaDefObj> call( CellDataFeatures<ICFBamPopTopDepObj, ICFBamSchemaDefObj> p) { ICFBamPopTopDepObj 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<ICFBamPopTopDepObj, ICFBamSchemaDefObj>, TableCell<ICFBamPopTopDepObj, ICFBamSchemaDefObj>>() { @Override public TableCell<ICFBamPopTopDepObj, ICFBamSchemaDefObj> call( TableColumn<ICFBamPopTopDepObj, ICFBamSchemaDefObj> arg) { return new CFReferenceTableCell<ICFBamPopTopDepObj, ICFBamSchemaDefObj>(); } }); dataTable.getColumns().add(tableColumnLookupDefSchema); dataTable.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<ICFBamPopTopDepObj>() { @Override public void changed(ObservableValue<? extends ICFBamPopTopDepObj> observable, ICFBamPopTopDepObj oldValue, ICFBamPopTopDepObj 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 (observableListOfPopTopDep != null) { dataTable.setItems(observableListOfPopTopDep); } adjustListButtons(); }
From source file:net.sourceforge.msscodefactory.cfbam.v2_7.CFBamJavaFX.CFBamJavaFXDelSubDep1ListPane.java
public CFBamJavaFXDelSubDep1ListPane(ICFFormManager formManager, ICFBamJavaFXSchema argSchema, ICFBamDelTopDepObj argContainer, ICFBamDelSubDep1Obj argFocus, Collection<ICFBamDelSubDep1Obj> argDataCollection, ICFRefreshCallback refreshCallback, boolean sortByChain) { super();/* w ww.ja v a 2 s . c o m*/ 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<ICFBamDelSubDep1Obj>(); tableColumnId = new TableColumn<ICFBamDelSubDep1Obj, Long>("Id"); tableColumnId.setCellValueFactory( new Callback<CellDataFeatures<ICFBamDelSubDep1Obj, Long>, ObservableValue<Long>>() { public ObservableValue<Long> call(CellDataFeatures<ICFBamDelSubDep1Obj, Long> p) { ICFBamScopeObj 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<ICFBamDelSubDep1Obj, Long>, TableCell<ICFBamDelSubDep1Obj, Long>>() { @Override public TableCell<ICFBamDelSubDep1Obj, Long> call(TableColumn<ICFBamDelSubDep1Obj, Long> arg) { return new CFInt64TableCell<ICFBamDelSubDep1Obj>(); } }); dataTable.getColumns().add(tableColumnId); tableColumnName = new TableColumn<ICFBamDelSubDep1Obj, String>("Name"); tableColumnName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamDelSubDep1Obj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamDelSubDep1Obj, String> p) { ICFBamDelSubDep1Obj 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<ICFBamDelSubDep1Obj, String>, TableCell<ICFBamDelSubDep1Obj, String>>() { @Override public TableCell<ICFBamDelSubDep1Obj, String> call( TableColumn<ICFBamDelSubDep1Obj, String> arg) { return new CFStringTableCell<ICFBamDelSubDep1Obj>(); } }); dataTable.getColumns().add(tableColumnName); tableColumnLookupRelation = new TableColumn<ICFBamDelSubDep1Obj, ICFBamRelationObj>("Relation"); tableColumnLookupRelation.setCellValueFactory( new Callback<CellDataFeatures<ICFBamDelSubDep1Obj, ICFBamRelationObj>, ObservableValue<ICFBamRelationObj>>() { public ObservableValue<ICFBamRelationObj> call( CellDataFeatures<ICFBamDelSubDep1Obj, ICFBamRelationObj> p) { ICFBamDelSubDep1Obj obj = p.getValue(); if (obj == null) { return (null); } else { ICFBamRelationObj ref = obj.getRequiredLookupRelation(); ReadOnlyObjectWrapper<ICFBamRelationObj> observable = new ReadOnlyObjectWrapper<ICFBamRelationObj>(); observable.setValue(ref); return (observable); } } }); tableColumnLookupRelation.setCellFactory( new Callback<TableColumn<ICFBamDelSubDep1Obj, ICFBamRelationObj>, TableCell<ICFBamDelSubDep1Obj, ICFBamRelationObj>>() { @Override public TableCell<ICFBamDelSubDep1Obj, ICFBamRelationObj> call( TableColumn<ICFBamDelSubDep1Obj, ICFBamRelationObj> arg) { return new CFReferenceTableCell<ICFBamDelSubDep1Obj, ICFBamRelationObj>(); } }); dataTable.getColumns().add(tableColumnLookupRelation); tableColumnLookupDefSchema = new TableColumn<ICFBamDelSubDep1Obj, ICFBamSchemaDefObj>( "Defining Schema Definition"); tableColumnLookupDefSchema.setCellValueFactory( new Callback<CellDataFeatures<ICFBamDelSubDep1Obj, ICFBamSchemaDefObj>, ObservableValue<ICFBamSchemaDefObj>>() { public ObservableValue<ICFBamSchemaDefObj> call( CellDataFeatures<ICFBamDelSubDep1Obj, ICFBamSchemaDefObj> p) { ICFBamDelSubDep1Obj 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<ICFBamDelSubDep1Obj, ICFBamSchemaDefObj>, TableCell<ICFBamDelSubDep1Obj, ICFBamSchemaDefObj>>() { @Override public TableCell<ICFBamDelSubDep1Obj, ICFBamSchemaDefObj> call( TableColumn<ICFBamDelSubDep1Obj, ICFBamSchemaDefObj> arg) { return new CFReferenceTableCell<ICFBamDelSubDep1Obj, ICFBamSchemaDefObj>(); } }); dataTable.getColumns().add(tableColumnLookupDefSchema); dataTable.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<ICFBamDelSubDep1Obj>() { @Override public void changed(ObservableValue<? extends ICFBamDelSubDep1Obj> observable, ICFBamDelSubDep1Obj oldValue, ICFBamDelSubDep1Obj 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 (observableListOfDelSubDep1 != null) { dataTable.setItems(observableListOfDelSubDep1); } adjustListButtons(); }