List of usage examples for javafx.beans.value ChangeListener ChangeListener
ChangeListener
From source file:eu.ggnet.dwoss.report.entity.ReportLine.java
public DoubleProperty priceProperty() { if (priceProperty == null) { priceProperty = new SimpleDoubleProperty(price); priceProperty.addListener(new ChangeListener<Number>() { @Override/*w ww .j ava2s. c om*/ public void changed(ObservableValue<? extends Number> ov, Number oldValue, Number newValue) { price = newValue.doubleValue(); } }); } return priceProperty; }
From source file:org.noroomattheinn.visibletesla.NotifierController.java
@Override protected void initializeState() { lastOdoCheck = prefs.storage().getDouble(OdoCheckKey, 0); socHitsTrigger = new GenericTrigger<>(socHits.selectedProperty(), bdHelper, "SOC", NotifySOCHitsKey, GenericTrigger.Predicate.HitsOrExceeds, socHitsField.numberProperty(), new BigDecimal(88.0), TypicalDebounce);//from www . j av a 2 s . c o m socHitsMessageTarget = new MessageTarget(prefs, vinKey("MT_" + NotifySOCHitsKey), SOCHitSubj, SOCHitMsg); socFallsTrigger = new GenericTrigger<>(socFalls.selectedProperty(), bdHelper, "SOC", NotifySOCFallsKey, GenericTrigger.Predicate.FallsBelow, socFallsField.numberProperty(), new BigDecimal(50.0), TypicalDebounce); socFallsMessageTarget = new MessageTarget(prefs, vinKey("MT_" + NotifySOCFallsKey), SOCFellSubj, SOCFellMsg); speedHitsTrigger = new GenericTrigger<>(speedHits.selectedProperty(), bdHelper, "Speed", NotifySpeedKey, GenericTrigger.Predicate.HitsOrExceeds, speedHitsField.numberProperty(), new BigDecimal(70.0), SpeedDebounce); shMessageTarget = new MessageTarget(prefs, vinKey("MT_" + NotifySpeedKey), SpeedHitSubj, SpeedHitMsg); odoHitsTrigger = new GenericTrigger<>(odoHits.selectedProperty(), bdHelper, "Odometer", NotifyOdoKey, GenericTrigger.Predicate.GT, odoHitsField.numberProperty(), new BigDecimal(14325), TypicalDebounce); ohMessageTarget = new MessageTarget(prefs, vinKey("MT_" + NotifyOdoKey), OdoHitsSubj, OdoHitsMsg); seTrigger = new GenericTrigger<>(schedulerEvent.selectedProperty(), stringHelper, "Scheduler", NotifySEKey, GenericTrigger.Predicate.AnyChange, new SimpleObjectProperty<>("Anything"), "Anything", 0L); seMessageTarget = new MessageTarget(prefs, vinKey("MT_" + NotifySEKey), SchedEventSubj, SchedEventMsg); csTrigger = new GenericTrigger<>(chargeState.selectedProperty(), stringListHelper, "Charge State", NotifyCSKey, GenericTrigger.Predicate.Becomes, csSelectProp, new StringList("Anything"), 0L); csMessageTarget = new MessageTarget(prefs, vinKey("MT_" + NotifyCSKey), ChargeStateSubj, ChargeStateMsg); for (int i = 0; i < 4; i++) { GeoTrigger gt = geoTriggers[i]; gt.trigger = new GenericTrigger<>(gt.enabled.selectedProperty(), areaHelper, "Enter GeoUtils.CircularArea", NotifyEnterKey + i, GenericTrigger.Predicate.HitsOrExceeds, gt.prop, new GeoUtils.CircularArea(), GeoDebounce); gt.messageTarget = new MessageTarget(prefs, vinKey("MT_" + NotifyEnterKey + i), EnterAreaSubj, EnterAreaMsg); } for (int i = 4; i < 8; i++) { GeoTrigger gt = geoTriggers[i]; gt.trigger = new GenericTrigger<>(gt.enabled.selectedProperty(), areaHelper, "Left GeoUtils.CircularArea", NotifyLeftKey + i, GenericTrigger.Predicate.FallsBelow, gt.prop, new GeoUtils.CircularArea(), GeoDebounce); gt.messageTarget = new MessageTarget(prefs, vinKey("MT_" + NotifyLeftKey + i), LeftAreaSubj, LeftAreaMsg); } for (final GeoTrigger g : geoTriggers) { String name = g.prop.get().name; if (name != null && !name.isEmpty()) { g.enabled.setText(name); } g.prop.addListener(new ChangeListener<GeoUtils.CircularArea>() { @Override public void changed(ObservableValue<? extends GeoUtils.CircularArea> ov, GeoUtils.CircularArea t, GeoUtils.CircularArea t1) { if (t1.name != null && !t1.name.isEmpty()) { g.enabled.setText(t1.name); } } }); } // Other types of trigger ccTrigger = new DeviationTrigger(0.19, 5 * 60 * 1000); pcTrigger = new DeviationTrigger(0.19, 5 * 60 * 1000); caMessageTarget = new MessageTarget(prefs, vinKey("MT_" + NotifyCAKey), ChargeAnomalySubj, ChargeAnomalyMsg); chargeAnomaly.setSelected(prefs.storage().getBoolean(vinKey(NotifyCAKey), false)); unlockedTrigger = new StationaryTrigger(unlocked.selectedProperty(), unlockedDoorsField.numberProperty()); ulMessageTarget = new MessageTarget(prefs, vinKey("MT_" + NotifyULKey), UnlockedSubj, UnlockedMsg); unlocked.setSelected(prefs.storage().getBoolean(vinKey(NotifyULKey), false)); unlockedDoorsField.numberProperty() .set(new BigDecimal(prefs.storage().getLong(vinKey(NotifyULValKey), UnlockedThreshold))); checkForUnlocked = false; startListening(); }
From source file:eu.ggnet.dwoss.report.entity.ReportLine.java
public DoubleProperty afterTaxPriceProperty() { if (afterTaxPriceProperty == null) { afterTaxPriceProperty = new SimpleDoubleProperty(afterTaxPrice); afterTaxPriceProperty.addListener(new ChangeListener<Number>() { @Override// ww w . j a v a 2s. com public void changed(ObservableValue<? extends Number> ov, Number oldValue, Number newValue) { afterTaxPrice = newValue.doubleValue(); } }); } return afterTaxPriceProperty; }
From source file:de.dkfz.roddy.client.fxuiclient.RoddyUIController.java
/** * Recursive helper method to load projects from configuration files. *///from w w w . ja va 2 s . c o m private void loadProjectsRecursivelyFromXMLFiles(final TreeItem<FXICCWrapper> root, List<InformationalConfigurationContent> availableProjectConfigurations) { int count = 0; String path = Roddy.getApplicationProperty(RunMode.UI, RoddyUIController.APP_PROPERTY_LAST_OPEN_PROJECT_PATH, ""); for (InformationalConfigurationContent icc : availableProjectConfigurations) { FXICCWrapper fpw = new FXICCWrapper(icc, count++); TreeItem<FXICCWrapper> newItem = new TreeItem<>(fpw); root.getChildren().add(newItem); try { Map<String, String> analyses = fpw.getAnalyses(); for (String analysisID : analyses.keySet()) { FXICCWrapper fpwAnalysis = new FXICCWrapper(icc, analysisID, count++); newItem.getChildren().add(new TreeItem<>(fpwAnalysis)); } loadProjectsRecursivelyFromXMLFiles(newItem, icc.getSubContent()); } catch (Exception e) { e.printStackTrace(); } } //Add an expand listener to the topmost nodes if (root.getValue() != null) { for (final TreeItem<FXICCWrapper> treeItem : root.getChildren()) { treeItem.setExpanded(true); } return; } for (final TreeItem<FXICCWrapper> treeItem : root.getChildren()) { treeItem.expandedProperty().addListener(new ChangeListener<Boolean>() { @Override public void changed(ObservableValue<? extends Boolean> observableValue, Boolean aBoolean, Boolean newValue) { if (!newValue) return; //Upon expand close all other nodes. for (TreeItem<FXICCWrapper> sister : root.getChildren()) { if (treeItem == sister) { Roddy.setApplicationProperty(RunMode.UI, RoddyUIController.APP_PROPERTY_LAST_OPEN_PROJECT_PATH, treeItem.getValue().getID()); } else { sister.setExpanded(false); } } } }); if (treeItem.getValue().getID().equals(path)) treeItem.setExpanded(true); } }
From source file:net.sourceforge.msscodefactory.cfbam.v2_7.CFBamJavaFX.CFBamJavaFXIndexColPickerPane.java
public CFBamJavaFXIndexColPickerPane(ICFFormManager formManager, ICFBamJavaFXSchema argSchema, ICFBamIndexColObj argFocus, ICFBamIndexObj argContainer, Collection<ICFBamIndexColObj> argDataCollection, ICFBamJavaFXIndexColChosen whenChosen) { super();//w w w. j a va2 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"); } 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<ICFBamIndexColObj>(); tableColumnId = new TableColumn<ICFBamIndexColObj, Long>("Id"); tableColumnId.setCellValueFactory( new Callback<CellDataFeatures<ICFBamIndexColObj, Long>, ObservableValue<Long>>() { public ObservableValue<Long> call(CellDataFeatures<ICFBamIndexColObj, Long> p) { ICFBamIndexColObj 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<ICFBamIndexColObj, Long>, TableCell<ICFBamIndexColObj, Long>>() { @Override public TableCell<ICFBamIndexColObj, Long> call(TableColumn<ICFBamIndexColObj, Long> arg) { return new CFInt64TableCell<ICFBamIndexColObj>(); } }); dataTable.getColumns().add(tableColumnId); tableColumnName = new TableColumn<ICFBamIndexColObj, String>("Name"); tableColumnName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamIndexColObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamIndexColObj, String> p) { ICFBamIndexColObj 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<ICFBamIndexColObj, String>, TableCell<ICFBamIndexColObj, String>>() { @Override public TableCell<ICFBamIndexColObj, String> call(TableColumn<ICFBamIndexColObj, String> arg) { return new CFStringTableCell<ICFBamIndexColObj>(); } }); dataTable.getColumns().add(tableColumnName); tableColumnShortName = new TableColumn<ICFBamIndexColObj, String>("Short Name"); tableColumnShortName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamIndexColObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamIndexColObj, String> p) { ICFBamIndexColObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getOptionalShortName(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnShortName.setCellFactory( new Callback<TableColumn<ICFBamIndexColObj, String>, TableCell<ICFBamIndexColObj, String>>() { @Override public TableCell<ICFBamIndexColObj, String> call(TableColumn<ICFBamIndexColObj, String> arg) { return new CFStringTableCell<ICFBamIndexColObj>(); } }); dataTable.getColumns().add(tableColumnShortName); tableColumnLabel = new TableColumn<ICFBamIndexColObj, String>("Label"); tableColumnLabel.setCellValueFactory( new Callback<CellDataFeatures<ICFBamIndexColObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamIndexColObj, String> p) { ICFBamIndexColObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getOptionalLabel(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnLabel.setCellFactory( new Callback<TableColumn<ICFBamIndexColObj, String>, TableCell<ICFBamIndexColObj, String>>() { @Override public TableCell<ICFBamIndexColObj, String> call(TableColumn<ICFBamIndexColObj, String> arg) { return new CFStringTableCell<ICFBamIndexColObj>(); } }); dataTable.getColumns().add(tableColumnLabel); tableColumnShortDescription = new TableColumn<ICFBamIndexColObj, String>("Short Description"); tableColumnShortDescription.setCellValueFactory( new Callback<CellDataFeatures<ICFBamIndexColObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamIndexColObj, String> p) { ICFBamIndexColObj 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<ICFBamIndexColObj, String>, TableCell<ICFBamIndexColObj, String>>() { @Override public TableCell<ICFBamIndexColObj, String> call(TableColumn<ICFBamIndexColObj, String> arg) { return new CFStringTableCell<ICFBamIndexColObj>(); } }); dataTable.getColumns().add(tableColumnShortDescription); tableColumnDescription = new TableColumn<ICFBamIndexColObj, String>("Description"); tableColumnDescription.setCellValueFactory( new Callback<CellDataFeatures<ICFBamIndexColObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamIndexColObj, String> p) { ICFBamIndexColObj 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<ICFBamIndexColObj, String>, TableCell<ICFBamIndexColObj, String>>() { @Override public TableCell<ICFBamIndexColObj, String> call(TableColumn<ICFBamIndexColObj, String> arg) { return new CFStringTableCell<ICFBamIndexColObj>(); } }); dataTable.getColumns().add(tableColumnDescription); tableColumnIsAscending = new TableColumn<ICFBamIndexColObj, Boolean>("IsAscending"); tableColumnIsAscending.setCellValueFactory( new Callback<CellDataFeatures<ICFBamIndexColObj, Boolean>, ObservableValue<Boolean>>() { public ObservableValue<Boolean> call(CellDataFeatures<ICFBamIndexColObj, Boolean> p) { ICFBamIndexColObj obj = p.getValue(); if (obj == null) { return (null); } else { boolean value = obj.getRequiredIsAscending(); Boolean wrapped = new Boolean(value); ReadOnlyObjectWrapper<Boolean> observable = new ReadOnlyObjectWrapper<Boolean>(); observable.setValue(wrapped); return (observable); } } }); tableColumnIsAscending.setCellFactory( new Callback<TableColumn<ICFBamIndexColObj, Boolean>, TableCell<ICFBamIndexColObj, Boolean>>() { @Override public TableCell<ICFBamIndexColObj, Boolean> call(TableColumn<ICFBamIndexColObj, Boolean> arg) { return new CFBoolTableCell<ICFBamIndexColObj>(); } }); dataTable.getColumns().add(tableColumnIsAscending); tableColumnDefaultVisibility = new TableColumn<ICFBamIndexColObj, Boolean>("Default Visibility"); tableColumnDefaultVisibility.setCellValueFactory( new Callback<CellDataFeatures<ICFBamIndexColObj, Boolean>, ObservableValue<Boolean>>() { public ObservableValue<Boolean> call(CellDataFeatures<ICFBamIndexColObj, Boolean> p) { ICFBamIndexColObj obj = p.getValue(); if (obj == null) { return (null); } else { boolean value = obj.getRequiredDefaultVisibility(); Boolean wrapped = new Boolean(value); ReadOnlyObjectWrapper<Boolean> observable = new ReadOnlyObjectWrapper<Boolean>(); observable.setValue(wrapped); return (observable); } } }); tableColumnDefaultVisibility.setCellFactory( new Callback<TableColumn<ICFBamIndexColObj, Boolean>, TableCell<ICFBamIndexColObj, Boolean>>() { @Override public TableCell<ICFBamIndexColObj, Boolean> call(TableColumn<ICFBamIndexColObj, Boolean> arg) { return new CFBoolTableCell<ICFBamIndexColObj>(); } }); dataTable.getColumns().add(tableColumnDefaultVisibility); tableColumnLookupDefSchema = new TableColumn<ICFBamIndexColObj, ICFBamSchemaDefObj>( "Defining Schema Definition"); tableColumnLookupDefSchema.setCellValueFactory( new Callback<CellDataFeatures<ICFBamIndexColObj, ICFBamSchemaDefObj>, ObservableValue<ICFBamSchemaDefObj>>() { public ObservableValue<ICFBamSchemaDefObj> call( CellDataFeatures<ICFBamIndexColObj, ICFBamSchemaDefObj> p) { ICFBamIndexColObj 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<ICFBamIndexColObj, ICFBamSchemaDefObj>, TableCell<ICFBamIndexColObj, ICFBamSchemaDefObj>>() { @Override public TableCell<ICFBamIndexColObj, ICFBamSchemaDefObj> call( TableColumn<ICFBamIndexColObj, ICFBamSchemaDefObj> arg) { return new CFReferenceTableCell<ICFBamIndexColObj, ICFBamSchemaDefObj>(); } }); dataTable.getColumns().add(tableColumnLookupDefSchema); tableColumnLookupColumn = new TableColumn<ICFBamIndexColObj, ICFBamValueObj>("Column"); tableColumnLookupColumn.setCellValueFactory( new Callback<CellDataFeatures<ICFBamIndexColObj, ICFBamValueObj>, ObservableValue<ICFBamValueObj>>() { public ObservableValue<ICFBamValueObj> call( CellDataFeatures<ICFBamIndexColObj, ICFBamValueObj> p) { ICFBamIndexColObj obj = p.getValue(); if (obj == null) { return (null); } else { ICFBamValueObj ref = obj.getRequiredLookupColumn(); ReadOnlyObjectWrapper<ICFBamValueObj> observable = new ReadOnlyObjectWrapper<ICFBamValueObj>(); observable.setValue(ref); return (observable); } } }); tableColumnLookupColumn.setCellFactory( new Callback<TableColumn<ICFBamIndexColObj, ICFBamValueObj>, TableCell<ICFBamIndexColObj, ICFBamValueObj>>() { @Override public TableCell<ICFBamIndexColObj, ICFBamValueObj> call( TableColumn<ICFBamIndexColObj, ICFBamValueObj> arg) { return new CFReferenceTableCell<ICFBamIndexColObj, ICFBamValueObj>(); } }); dataTable.getColumns().add(tableColumnLookupColumn); dataTable.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<ICFBamIndexColObj>() { @Override public void changed(ObservableValue<? extends ICFBamIndexColObj> observable, ICFBamIndexColObj oldValue, ICFBamIndexColObj 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.choseIndexCol(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"); } ICFBamIndexColObj selectedInstance = getJavaFXFocusAsIndexCol(); invokeWhenChosen.choseIndexCol(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:utilitybasedfx.MainGUIController.java
private void fillTreeFromArray(String[] ops, CheckBoxTreeItem<String> root, ArrayList<String> listForOpsEvent) { CheckBoxTreeItem<String> subFolder = null; for (String op : ops) { if (op.startsWith("-")) { subFolder = new CheckBoxTreeItem<String>(op.substring(1)); subFolder.setExpanded(true); root.getChildren().add(subFolder); } else {/*from www .j a v a2 s. c o m*/ CheckBoxTreeItem<String> opTreeItem = new CheckBoxTreeItem<String>(op); if (subFolder != null) { subFolder.getChildren().add(opTreeItem); opTreeItem.selectedProperty().addListener(new ChangeListener<Boolean>() { public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) { if (newValue) { addOpToArraylist(opTreeItem, listForOpsEvent); } else { removeOpFromArraylist(opTreeItem, listForOpsEvent); } } }); } } } }
From source file:nl.mvdr.umvc3replayanalyser.controller.Umvc3ReplayManagerController.java
/** Adds listeners to the filter input fields. */ private void initFilterListeners() { ChangeListener<Object> listener = new ChangeListener<Object>() { /** Used to prevent infinite recursion. */ private boolean suspended = false; /** {@inheritDoc} */ @Override/* ww w . j a v a2 s .co m*/ public void changed(ObservableValue<? extends Object> observable, Object oldValue, Object newValue) { if (!suspended) { suspended = true; if (log.isDebugEnabled()) { log.debug(String.format("Filter value changed. Old value: %s, new value: %s", oldValue, newValue)); } updateAssistComboBox(observable); updateReplayTable(); suspended = false; } } }; playerOneTextField.textProperty().addListener(listener); playerTwoTextField.textProperty().addListener(listener); playerOneCharacterOneComboBox.valueProperty().addListener(listener); playerOneCharacterTwoComboBox.valueProperty().addListener(listener); playerOneCharacterThreeComboBox.valueProperty().addListener(listener); playerTwoCharacterOneComboBox.valueProperty().addListener(listener); playerTwoCharacterTwoComboBox.valueProperty().addListener(listener); playerTwoCharacterThreeComboBox.valueProperty().addListener(listener); playerOneAssistOneComboBox.valueProperty().addListener(listener); playerOneAssistTwoComboBox.valueProperty().addListener(listener); playerOneAssistThreeComboBox.valueProperty().addListener(listener); playerTwoAssistOneComboBox.valueProperty().addListener(listener); playerTwoAssistTwoComboBox.valueProperty().addListener(listener); playerTwoAssistThreeComboBox.valueProperty().addListener(listener); maintainPlayerOrderCheckBox.selectedProperty().addListener(listener); maintainCharacterOrderCheckBox.selectedProperty().addListener(listener); }
From source file:net.sourceforge.msscodefactory.cfbam.v2_7.CFBamJavaFX.CFBamJavaFXRelationColPickerPane.java
public CFBamJavaFXRelationColPickerPane(ICFFormManager formManager, ICFBamJavaFXSchema argSchema, ICFBamRelationColObj argFocus, ICFBamRelationObj argContainer, Collection<ICFBamRelationColObj> argDataCollection, ICFBamJavaFXRelationColChosen whenChosen) { super();//w w w .ja 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"); } 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<ICFBamRelationColObj>(); tableColumnId = new TableColumn<ICFBamRelationColObj, Long>("Id"); tableColumnId.setCellValueFactory( new Callback<CellDataFeatures<ICFBamRelationColObj, Long>, ObservableValue<Long>>() { public ObservableValue<Long> call(CellDataFeatures<ICFBamRelationColObj, Long> p) { ICFBamRelationColObj 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<ICFBamRelationColObj, Long>, TableCell<ICFBamRelationColObj, Long>>() { @Override public TableCell<ICFBamRelationColObj, Long> call(TableColumn<ICFBamRelationColObj, Long> arg) { return new CFInt64TableCell<ICFBamRelationColObj>(); } }); dataTable.getColumns().add(tableColumnId); tableColumnName = new TableColumn<ICFBamRelationColObj, String>("Name"); tableColumnName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamRelationColObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamRelationColObj, String> p) { ICFBamRelationColObj 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<ICFBamRelationColObj, String>, TableCell<ICFBamRelationColObj, String>>() { @Override public TableCell<ICFBamRelationColObj, String> call( TableColumn<ICFBamRelationColObj, String> arg) { return new CFStringTableCell<ICFBamRelationColObj>(); } }); dataTable.getColumns().add(tableColumnName); tableColumnShortName = new TableColumn<ICFBamRelationColObj, String>("Short Name"); tableColumnShortName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamRelationColObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamRelationColObj, String> p) { ICFBamRelationColObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getOptionalShortName(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnShortName.setCellFactory( new Callback<TableColumn<ICFBamRelationColObj, String>, TableCell<ICFBamRelationColObj, String>>() { @Override public TableCell<ICFBamRelationColObj, String> call( TableColumn<ICFBamRelationColObj, String> arg) { return new CFStringTableCell<ICFBamRelationColObj>(); } }); dataTable.getColumns().add(tableColumnShortName); tableColumnLabel = new TableColumn<ICFBamRelationColObj, String>("Label"); tableColumnLabel.setCellValueFactory( new Callback<CellDataFeatures<ICFBamRelationColObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamRelationColObj, String> p) { ICFBamRelationColObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getOptionalLabel(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnLabel.setCellFactory( new Callback<TableColumn<ICFBamRelationColObj, String>, TableCell<ICFBamRelationColObj, String>>() { @Override public TableCell<ICFBamRelationColObj, String> call( TableColumn<ICFBamRelationColObj, String> arg) { return new CFStringTableCell<ICFBamRelationColObj>(); } }); dataTable.getColumns().add(tableColumnLabel); tableColumnShortDescription = new TableColumn<ICFBamRelationColObj, String>("Short Description"); tableColumnShortDescription.setCellValueFactory( new Callback<CellDataFeatures<ICFBamRelationColObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamRelationColObj, String> p) { ICFBamRelationColObj 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<ICFBamRelationColObj, String>, TableCell<ICFBamRelationColObj, String>>() { @Override public TableCell<ICFBamRelationColObj, String> call( TableColumn<ICFBamRelationColObj, String> arg) { return new CFStringTableCell<ICFBamRelationColObj>(); } }); dataTable.getColumns().add(tableColumnShortDescription); tableColumnDescription = new TableColumn<ICFBamRelationColObj, String>("Description"); tableColumnDescription.setCellValueFactory( new Callback<CellDataFeatures<ICFBamRelationColObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamRelationColObj, String> p) { ICFBamRelationColObj 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<ICFBamRelationColObj, String>, TableCell<ICFBamRelationColObj, String>>() { @Override public TableCell<ICFBamRelationColObj, String> call( TableColumn<ICFBamRelationColObj, String> arg) { return new CFStringTableCell<ICFBamRelationColObj>(); } }); dataTable.getColumns().add(tableColumnDescription); tableColumnDefaultVisibility = new TableColumn<ICFBamRelationColObj, Boolean>("Default Visibility"); tableColumnDefaultVisibility.setCellValueFactory( new Callback<CellDataFeatures<ICFBamRelationColObj, Boolean>, ObservableValue<Boolean>>() { public ObservableValue<Boolean> call(CellDataFeatures<ICFBamRelationColObj, Boolean> p) { ICFBamRelationColObj obj = p.getValue(); if (obj == null) { return (null); } else { boolean value = obj.getRequiredDefaultVisibility(); Boolean wrapped = new Boolean(value); ReadOnlyObjectWrapper<Boolean> observable = new ReadOnlyObjectWrapper<Boolean>(); observable.setValue(wrapped); return (observable); } } }); tableColumnDefaultVisibility.setCellFactory( new Callback<TableColumn<ICFBamRelationColObj, Boolean>, TableCell<ICFBamRelationColObj, Boolean>>() { @Override public TableCell<ICFBamRelationColObj, Boolean> call( TableColumn<ICFBamRelationColObj, Boolean> arg) { return new CFBoolTableCell<ICFBamRelationColObj>(); } }); dataTable.getColumns().add(tableColumnDefaultVisibility); tableColumnLookupDefSchema = new TableColumn<ICFBamRelationColObj, ICFBamSchemaDefObj>( "Defining Schema Definition"); tableColumnLookupDefSchema.setCellValueFactory( new Callback<CellDataFeatures<ICFBamRelationColObj, ICFBamSchemaDefObj>, ObservableValue<ICFBamSchemaDefObj>>() { public ObservableValue<ICFBamSchemaDefObj> call( CellDataFeatures<ICFBamRelationColObj, ICFBamSchemaDefObj> p) { ICFBamRelationColObj 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<ICFBamRelationColObj, ICFBamSchemaDefObj>, TableCell<ICFBamRelationColObj, ICFBamSchemaDefObj>>() { @Override public TableCell<ICFBamRelationColObj, ICFBamSchemaDefObj> call( TableColumn<ICFBamRelationColObj, ICFBamSchemaDefObj> arg) { return new CFReferenceTableCell<ICFBamRelationColObj, ICFBamSchemaDefObj>(); } }); dataTable.getColumns().add(tableColumnLookupDefSchema); tableColumnLookupFromCol = new TableColumn<ICFBamRelationColObj, ICFBamIndexColObj>("From Column"); tableColumnLookupFromCol.setCellValueFactory( new Callback<CellDataFeatures<ICFBamRelationColObj, ICFBamIndexColObj>, ObservableValue<ICFBamIndexColObj>>() { public ObservableValue<ICFBamIndexColObj> call( CellDataFeatures<ICFBamRelationColObj, ICFBamIndexColObj> p) { ICFBamRelationColObj obj = p.getValue(); if (obj == null) { return (null); } else { ICFBamIndexColObj ref = obj.getRequiredLookupFromCol(); ReadOnlyObjectWrapper<ICFBamIndexColObj> observable = new ReadOnlyObjectWrapper<ICFBamIndexColObj>(); observable.setValue(ref); return (observable); } } }); tableColumnLookupFromCol.setCellFactory( new Callback<TableColumn<ICFBamRelationColObj, ICFBamIndexColObj>, TableCell<ICFBamRelationColObj, ICFBamIndexColObj>>() { @Override public TableCell<ICFBamRelationColObj, ICFBamIndexColObj> call( TableColumn<ICFBamRelationColObj, ICFBamIndexColObj> arg) { return new CFReferenceTableCell<ICFBamRelationColObj, ICFBamIndexColObj>(); } }); dataTable.getColumns().add(tableColumnLookupFromCol); tableColumnLookupToCol = new TableColumn<ICFBamRelationColObj, ICFBamIndexColObj>("To Column"); tableColumnLookupToCol.setCellValueFactory( new Callback<CellDataFeatures<ICFBamRelationColObj, ICFBamIndexColObj>, ObservableValue<ICFBamIndexColObj>>() { public ObservableValue<ICFBamIndexColObj> call( CellDataFeatures<ICFBamRelationColObj, ICFBamIndexColObj> p) { ICFBamRelationColObj obj = p.getValue(); if (obj == null) { return (null); } else { ICFBamIndexColObj ref = obj.getRequiredLookupToCol(); ReadOnlyObjectWrapper<ICFBamIndexColObj> observable = new ReadOnlyObjectWrapper<ICFBamIndexColObj>(); observable.setValue(ref); return (observable); } } }); tableColumnLookupToCol.setCellFactory( new Callback<TableColumn<ICFBamRelationColObj, ICFBamIndexColObj>, TableCell<ICFBamRelationColObj, ICFBamIndexColObj>>() { @Override public TableCell<ICFBamRelationColObj, ICFBamIndexColObj> call( TableColumn<ICFBamRelationColObj, ICFBamIndexColObj> arg) { return new CFReferenceTableCell<ICFBamRelationColObj, ICFBamIndexColObj>(); } }); dataTable.getColumns().add(tableColumnLookupToCol); dataTable.getSelectionModel().selectedItemProperty() .addListener(new ChangeListener<ICFBamRelationColObj>() { @Override public void changed(ObservableValue<? extends ICFBamRelationColObj> observable, ICFBamRelationColObj oldValue, ICFBamRelationColObj 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.choseRelationCol(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"); } ICFBamRelationColObj selectedInstance = getJavaFXFocusAsRelationCol(); invokeWhenChosen.choseRelationCol(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:net.sourceforge.msscodefactory.cfbam.v2_7.CFBamJavaFX.CFBamJavaFXValuePickerPane.java
public CFBamJavaFXValuePickerPane(ICFFormManager formManager, ICFBamJavaFXSchema argSchema, ICFBamValueObj argFocus, ICFBamScopeObj argContainer, Collection<ICFBamValueObj> argDataCollection, ICFBamJavaFXValueChosen whenChosen) { super();/*w w w . j a v a 2s . 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"); } 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<ICFBamValueObj>(); tableColumnObjKind = new TableColumn<ICFBamValueObj, String>("Class Code"); tableColumnObjKind.setCellValueFactory( new Callback<CellDataFeatures<ICFBamValueObj, String>, ObservableValue<String>>() { @Override public ObservableValue<String> call(CellDataFeatures<ICFBamValueObj, String> p) { ICFBamValueObj 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<ICFBamValueObj, String>, TableCell<ICFBamValueObj, String>>() { @Override public TableCell<ICFBamValueObj, String> call(TableColumn<ICFBamValueObj, String> arg) { return new CFStringTableCell<ICFBamValueObj>(); } }); dataTable.getColumns().add(tableColumnObjKind); tableColumnId = new TableColumn<ICFBamValueObj, Long>("Id"); tableColumnId .setCellValueFactory(new Callback<CellDataFeatures<ICFBamValueObj, Long>, ObservableValue<Long>>() { public ObservableValue<Long> call(CellDataFeatures<ICFBamValueObj, Long> p) { ICFBamValueObj 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<ICFBamValueObj, Long>, TableCell<ICFBamValueObj, Long>>() { @Override public TableCell<ICFBamValueObj, Long> call(TableColumn<ICFBamValueObj, Long> arg) { return new CFInt64TableCell<ICFBamValueObj>(); } }); dataTable.getColumns().add(tableColumnId); tableColumnName = new TableColumn<ICFBamValueObj, String>("Name"); tableColumnName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamValueObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamValueObj, String> p) { ICFBamValueObj 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<ICFBamValueObj, String>, TableCell<ICFBamValueObj, String>>() { @Override public TableCell<ICFBamValueObj, String> call(TableColumn<ICFBamValueObj, String> arg) { return new CFStringTableCell<ICFBamValueObj>(); } }); dataTable.getColumns().add(tableColumnName); tableColumnShortName = new TableColumn<ICFBamValueObj, String>("Short Name"); tableColumnShortName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamValueObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamValueObj, String> p) { ICFBamValueObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getOptionalShortName(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnShortName.setCellFactory( new Callback<TableColumn<ICFBamValueObj, String>, TableCell<ICFBamValueObj, String>>() { @Override public TableCell<ICFBamValueObj, String> call(TableColumn<ICFBamValueObj, String> arg) { return new CFStringTableCell<ICFBamValueObj>(); } }); dataTable.getColumns().add(tableColumnShortName); tableColumnLabel = new TableColumn<ICFBamValueObj, String>("Label"); tableColumnLabel.setCellValueFactory( new Callback<CellDataFeatures<ICFBamValueObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamValueObj, String> p) { ICFBamValueObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getOptionalLabel(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnLabel.setCellFactory( new Callback<TableColumn<ICFBamValueObj, String>, TableCell<ICFBamValueObj, String>>() { @Override public TableCell<ICFBamValueObj, String> call(TableColumn<ICFBamValueObj, String> arg) { return new CFStringTableCell<ICFBamValueObj>(); } }); dataTable.getColumns().add(tableColumnLabel); tableColumnShortDescription = new TableColumn<ICFBamValueObj, String>("Short Description"); tableColumnShortDescription.setCellValueFactory( new Callback<CellDataFeatures<ICFBamValueObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamValueObj, String> p) { ICFBamValueObj 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<ICFBamValueObj, String>, TableCell<ICFBamValueObj, String>>() { @Override public TableCell<ICFBamValueObj, String> call(TableColumn<ICFBamValueObj, String> arg) { return new CFStringTableCell<ICFBamValueObj>(); } }); dataTable.getColumns().add(tableColumnShortDescription); tableColumnDescription = new TableColumn<ICFBamValueObj, String>("Description"); tableColumnDescription.setCellValueFactory( new Callback<CellDataFeatures<ICFBamValueObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamValueObj, String> p) { ICFBamValueObj 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<ICFBamValueObj, String>, TableCell<ICFBamValueObj, String>>() { @Override public TableCell<ICFBamValueObj, String> call(TableColumn<ICFBamValueObj, String> arg) { return new CFStringTableCell<ICFBamValueObj>(); } }); dataTable.getColumns().add(tableColumnDescription); tableColumnIsNullable = new TableColumn<ICFBamValueObj, Boolean>("Is Nullable"); tableColumnIsNullable.setCellValueFactory( new Callback<CellDataFeatures<ICFBamValueObj, Boolean>, ObservableValue<Boolean>>() { public ObservableValue<Boolean> call(CellDataFeatures<ICFBamValueObj, Boolean> p) { ICFBamValueObj 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<ICFBamValueObj, Boolean>, TableCell<ICFBamValueObj, Boolean>>() { @Override public TableCell<ICFBamValueObj, Boolean> call(TableColumn<ICFBamValueObj, Boolean> arg) { return new CFBoolTableCell<ICFBamValueObj>(); } }); dataTable.getColumns().add(tableColumnIsNullable); tableColumnGenerateId = new TableColumn<ICFBamValueObj, Boolean>("Generate Id"); tableColumnGenerateId.setCellValueFactory( new Callback<CellDataFeatures<ICFBamValueObj, Boolean>, ObservableValue<Boolean>>() { public ObservableValue<Boolean> call(CellDataFeatures<ICFBamValueObj, Boolean> p) { ICFBamValueObj obj = p.getValue(); if (obj == null) { return (null); } else { Boolean value = obj.getOptionalGenerateId(); ReadOnlyObjectWrapper<Boolean> observable = new ReadOnlyObjectWrapper<Boolean>(); observable.setValue(value); return (observable); } } }); tableColumnGenerateId.setCellFactory( new Callback<TableColumn<ICFBamValueObj, Boolean>, TableCell<ICFBamValueObj, Boolean>>() { @Override public TableCell<ICFBamValueObj, Boolean> call(TableColumn<ICFBamValueObj, Boolean> arg) { return new CFBoolTableCell<ICFBamValueObj>(); } }); dataTable.getColumns().add(tableColumnGenerateId); tableColumnDefaultVisibility = new TableColumn<ICFBamValueObj, Boolean>("Default Visibility"); tableColumnDefaultVisibility.setCellValueFactory( new Callback<CellDataFeatures<ICFBamValueObj, Boolean>, ObservableValue<Boolean>>() { public ObservableValue<Boolean> call(CellDataFeatures<ICFBamValueObj, Boolean> p) { ICFBamValueObj obj = p.getValue(); if (obj == null) { return (null); } else { boolean value = obj.getRequiredDefaultVisibility(); Boolean wrapped = new Boolean(value); ReadOnlyObjectWrapper<Boolean> observable = new ReadOnlyObjectWrapper<Boolean>(); observable.setValue(wrapped); return (observable); } } }); tableColumnDefaultVisibility.setCellFactory( new Callback<TableColumn<ICFBamValueObj, Boolean>, TableCell<ICFBamValueObj, Boolean>>() { @Override public TableCell<ICFBamValueObj, Boolean> call(TableColumn<ICFBamValueObj, Boolean> arg) { return new CFBoolTableCell<ICFBamValueObj>(); } }); dataTable.getColumns().add(tableColumnDefaultVisibility); tableColumnLookupDefSchema = new TableColumn<ICFBamValueObj, ICFBamSchemaDefObj>( "Defining Schema Definition"); tableColumnLookupDefSchema.setCellValueFactory( new Callback<CellDataFeatures<ICFBamValueObj, ICFBamSchemaDefObj>, ObservableValue<ICFBamSchemaDefObj>>() { public ObservableValue<ICFBamSchemaDefObj> call( CellDataFeatures<ICFBamValueObj, ICFBamSchemaDefObj> p) { ICFBamValueObj 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<ICFBamValueObj, ICFBamSchemaDefObj>, TableCell<ICFBamValueObj, ICFBamSchemaDefObj>>() { @Override public TableCell<ICFBamValueObj, ICFBamSchemaDefObj> call( TableColumn<ICFBamValueObj, ICFBamSchemaDefObj> arg) { return new CFReferenceTableCell<ICFBamValueObj, ICFBamSchemaDefObj>(); } }); dataTable.getColumns().add(tableColumnLookupDefSchema); dataTable.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<ICFBamValueObj>() { @Override public void changed(ObservableValue<? extends ICFBamValueObj> observable, ICFBamValueObj oldValue, ICFBamValueObj 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.choseValue(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"); } ICFBamValueObj selectedInstance = getJavaFXFocusAsValue(); invokeWhenChosen.choseValue(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:eu.ggnet.dwoss.report.entity.ReportLine.java
public DoubleProperty marginPercentageProperty() { if (marginPercentageProperty == null) { marginPercentageProperty = new SimpleDoubleProperty(marginPercentage); marginPercentageProperty.addListener(new ChangeListener<Number>() { @Override//from w w w . j a v a2 s.c o m public void changed(ObservableValue<? extends Number> ov, Number oldValue, Number newValue) { marginPercentage = newValue.doubleValue(); } }); } return marginPercentageProperty; }