List of usage examples for javafx.beans.value ChangeListener ChangeListener
ChangeListener
From source file:net.sourceforge.msscodefactory.cfbam.v2_7.CFBamJavaFX.CFBamJavaFXNumberDefPickerPane.java
public CFBamJavaFXNumberDefPickerPane(ICFFormManager formManager, ICFBamJavaFXSchema argSchema, ICFBamNumberDefObj argFocus, ICFBamScopeObj argContainer, Collection<ICFBamNumberDefObj> argDataCollection, ICFBamJavaFXNumberDefChosen whenChosen) { super();// w w w . java 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"); } 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<ICFBamNumberDefObj>(); tableColumnObjKind = new TableColumn<ICFBamNumberDefObj, String>("Class Code"); tableColumnObjKind.setCellValueFactory( new Callback<CellDataFeatures<ICFBamNumberDefObj, String>, ObservableValue<String>>() { @Override public ObservableValue<String> call(CellDataFeatures<ICFBamNumberDefObj, String> p) { ICFBamNumberDefObj 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<ICFBamNumberDefObj, String>, TableCell<ICFBamNumberDefObj, String>>() { @Override public TableCell<ICFBamNumberDefObj, String> call(TableColumn<ICFBamNumberDefObj, String> arg) { return new CFStringTableCell<ICFBamNumberDefObj>(); } }); dataTable.getColumns().add(tableColumnObjKind); tableColumnId = new TableColumn<ICFBamNumberDefObj, Long>("Id"); tableColumnId.setCellValueFactory( new Callback<CellDataFeatures<ICFBamNumberDefObj, Long>, ObservableValue<Long>>() { public ObservableValue<Long> call(CellDataFeatures<ICFBamNumberDefObj, 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<ICFBamNumberDefObj, Long>, TableCell<ICFBamNumberDefObj, Long>>() { @Override public TableCell<ICFBamNumberDefObj, Long> call(TableColumn<ICFBamNumberDefObj, Long> arg) { return new CFInt64TableCell<ICFBamNumberDefObj>(); } }); dataTable.getColumns().add(tableColumnId); tableColumnName = new TableColumn<ICFBamNumberDefObj, String>("Name"); tableColumnName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamNumberDefObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamNumberDefObj, 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<ICFBamNumberDefObj, String>, TableCell<ICFBamNumberDefObj, String>>() { @Override public TableCell<ICFBamNumberDefObj, String> call(TableColumn<ICFBamNumberDefObj, String> arg) { return new CFStringTableCell<ICFBamNumberDefObj>(); } }); dataTable.getColumns().add(tableColumnName); tableColumnShortName = new TableColumn<ICFBamNumberDefObj, String>("Short Name"); tableColumnShortName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamNumberDefObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamNumberDefObj, 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<ICFBamNumberDefObj, String>, TableCell<ICFBamNumberDefObj, String>>() { @Override public TableCell<ICFBamNumberDefObj, String> call(TableColumn<ICFBamNumberDefObj, String> arg) { return new CFStringTableCell<ICFBamNumberDefObj>(); } }); dataTable.getColumns().add(tableColumnShortName); tableColumnLabel = new TableColumn<ICFBamNumberDefObj, String>("Label"); tableColumnLabel.setCellValueFactory( new Callback<CellDataFeatures<ICFBamNumberDefObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamNumberDefObj, 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<ICFBamNumberDefObj, String>, TableCell<ICFBamNumberDefObj, String>>() { @Override public TableCell<ICFBamNumberDefObj, String> call(TableColumn<ICFBamNumberDefObj, String> arg) { return new CFStringTableCell<ICFBamNumberDefObj>(); } }); dataTable.getColumns().add(tableColumnLabel); tableColumnShortDescription = new TableColumn<ICFBamNumberDefObj, String>("Short Description"); tableColumnShortDescription.setCellValueFactory( new Callback<CellDataFeatures<ICFBamNumberDefObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamNumberDefObj, 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<ICFBamNumberDefObj, String>, TableCell<ICFBamNumberDefObj, String>>() { @Override public TableCell<ICFBamNumberDefObj, String> call(TableColumn<ICFBamNumberDefObj, String> arg) { return new CFStringTableCell<ICFBamNumberDefObj>(); } }); dataTable.getColumns().add(tableColumnShortDescription); tableColumnDescription = new TableColumn<ICFBamNumberDefObj, String>("Description"); tableColumnDescription.setCellValueFactory( new Callback<CellDataFeatures<ICFBamNumberDefObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamNumberDefObj, 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<ICFBamNumberDefObj, String>, TableCell<ICFBamNumberDefObj, String>>() { @Override public TableCell<ICFBamNumberDefObj, String> call(TableColumn<ICFBamNumberDefObj, String> arg) { return new CFStringTableCell<ICFBamNumberDefObj>(); } }); dataTable.getColumns().add(tableColumnDescription); tableColumnIsNullable = new TableColumn<ICFBamNumberDefObj, Boolean>("Is Nullable"); tableColumnIsNullable.setCellValueFactory( new Callback<CellDataFeatures<ICFBamNumberDefObj, Boolean>, ObservableValue<Boolean>>() { public ObservableValue<Boolean> call(CellDataFeatures<ICFBamNumberDefObj, 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<ICFBamNumberDefObj, Boolean>, TableCell<ICFBamNumberDefObj, Boolean>>() { @Override public TableCell<ICFBamNumberDefObj, Boolean> call( TableColumn<ICFBamNumberDefObj, Boolean> arg) { return new CFBoolTableCell<ICFBamNumberDefObj>(); } }); dataTable.getColumns().add(tableColumnIsNullable); tableColumnGenerateId = new TableColumn<ICFBamNumberDefObj, Boolean>("Generate Id"); tableColumnGenerateId.setCellValueFactory( new Callback<CellDataFeatures<ICFBamNumberDefObj, Boolean>, ObservableValue<Boolean>>() { public ObservableValue<Boolean> call(CellDataFeatures<ICFBamNumberDefObj, 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<ICFBamNumberDefObj, Boolean>, TableCell<ICFBamNumberDefObj, Boolean>>() { @Override public TableCell<ICFBamNumberDefObj, Boolean> call( TableColumn<ICFBamNumberDefObj, Boolean> arg) { return new CFBoolTableCell<ICFBamNumberDefObj>(); } }); dataTable.getColumns().add(tableColumnGenerateId); tableColumnDefaultVisibility = new TableColumn<ICFBamNumberDefObj, Boolean>("Default Visibility"); tableColumnDefaultVisibility.setCellValueFactory( new Callback<CellDataFeatures<ICFBamNumberDefObj, Boolean>, ObservableValue<Boolean>>() { public ObservableValue<Boolean> call(CellDataFeatures<ICFBamNumberDefObj, 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<ICFBamNumberDefObj, Boolean>, TableCell<ICFBamNumberDefObj, Boolean>>() { @Override public TableCell<ICFBamNumberDefObj, Boolean> call( TableColumn<ICFBamNumberDefObj, Boolean> arg) { return new CFBoolTableCell<ICFBamNumberDefObj>(); } }); dataTable.getColumns().add(tableColumnDefaultVisibility); tableColumnDbName = new TableColumn<ICFBamNumberDefObj, String>("Db Name"); tableColumnDbName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamNumberDefObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamNumberDefObj, String> p) { ICFBamAtomObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getOptionalDbName(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnDbName.setCellFactory( new Callback<TableColumn<ICFBamNumberDefObj, String>, TableCell<ICFBamNumberDefObj, String>>() { @Override public TableCell<ICFBamNumberDefObj, String> call(TableColumn<ICFBamNumberDefObj, String> arg) { return new CFStringTableCell<ICFBamNumberDefObj>(); } }); dataTable.getColumns().add(tableColumnDbName); tableColumnDigits = new TableColumn<ICFBamNumberDefObj, Short>("Digits"); tableColumnDigits.setCellValueFactory( new Callback<CellDataFeatures<ICFBamNumberDefObj, Short>, ObservableValue<Short>>() { public ObservableValue<Short> call(CellDataFeatures<ICFBamNumberDefObj, Short> p) { ICFBamNumberDefObj obj = p.getValue(); if (obj == null) { return (null); } else { short value = obj.getRequiredDigits(); Short wrapped = new Short(value); ReadOnlyObjectWrapper<Short> observable = new ReadOnlyObjectWrapper<Short>(); observable.setValue(wrapped); return (observable); } } }); tableColumnDigits.setCellFactory( new Callback<TableColumn<ICFBamNumberDefObj, Short>, TableCell<ICFBamNumberDefObj, Short>>() { @Override public TableCell<ICFBamNumberDefObj, Short> call(TableColumn<ICFBamNumberDefObj, Short> arg) { return new CFInt16TableCell<ICFBamNumberDefObj>(); } }); dataTable.getColumns().add(tableColumnDigits); tableColumnPrecis = new TableColumn<ICFBamNumberDefObj, Short>("Precision"); tableColumnPrecis.setCellValueFactory( new Callback<CellDataFeatures<ICFBamNumberDefObj, Short>, ObservableValue<Short>>() { public ObservableValue<Short> call(CellDataFeatures<ICFBamNumberDefObj, Short> p) { ICFBamNumberDefObj obj = p.getValue(); if (obj == null) { return (null); } else { short value = obj.getRequiredPrecis(); Short wrapped = new Short(value); ReadOnlyObjectWrapper<Short> observable = new ReadOnlyObjectWrapper<Short>(); observable.setValue(wrapped); return (observable); } } }); tableColumnPrecis.setCellFactory( new Callback<TableColumn<ICFBamNumberDefObj, Short>, TableCell<ICFBamNumberDefObj, Short>>() { @Override public TableCell<ICFBamNumberDefObj, Short> call(TableColumn<ICFBamNumberDefObj, Short> arg) { return new CFInt16TableCell<ICFBamNumberDefObj>(); } }); dataTable.getColumns().add(tableColumnPrecis); tableColumnInitValue = new TableColumn<ICFBamNumberDefObj, BigDecimal>("Init. Value"); tableColumnInitValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamNumberDefObj, BigDecimal>, ObservableValue<BigDecimal>>() { public ObservableValue<BigDecimal> call(CellDataFeatures<ICFBamNumberDefObj, BigDecimal> p) { ICFBamNumberDefObj obj = p.getValue(); if (obj == null) { return (null); } else { BigDecimal value = obj.getOptionalInitValue(); ReadOnlyObjectWrapper<BigDecimal> observable = new ReadOnlyObjectWrapper<BigDecimal>(); observable.setValue(value); return (observable); } } }); tableColumnInitValue.setCellFactory( new Callback<TableColumn<ICFBamNumberDefObj, BigDecimal>, TableCell<ICFBamNumberDefObj, BigDecimal>>() { @Override public TableCell<ICFBamNumberDefObj, BigDecimal> call( TableColumn<ICFBamNumberDefObj, BigDecimal> arg) { return new CFNumberTableCell<ICFBamNumberDefObj>(31, 5); } }); dataTable.getColumns().add(tableColumnInitValue); tableColumnDefaultValue = new TableColumn<ICFBamNumberDefObj, BigDecimal>("Default Value"); tableColumnDefaultValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamNumberDefObj, BigDecimal>, ObservableValue<BigDecimal>>() { public ObservableValue<BigDecimal> call(CellDataFeatures<ICFBamNumberDefObj, BigDecimal> p) { ICFBamNumberDefObj obj = p.getValue(); if (obj == null) { return (null); } else { BigDecimal value = obj.getOptionalDefaultValue(); ReadOnlyObjectWrapper<BigDecimal> observable = new ReadOnlyObjectWrapper<BigDecimal>(); observable.setValue(value); return (observable); } } }); tableColumnDefaultValue.setCellFactory( new Callback<TableColumn<ICFBamNumberDefObj, BigDecimal>, TableCell<ICFBamNumberDefObj, BigDecimal>>() { @Override public TableCell<ICFBamNumberDefObj, BigDecimal> call( TableColumn<ICFBamNumberDefObj, BigDecimal> arg) { return new CFNumberTableCell<ICFBamNumberDefObj>(31, 5); } }); dataTable.getColumns().add(tableColumnDefaultValue); tableColumnMinValue = new TableColumn<ICFBamNumberDefObj, BigDecimal>("Min. Value"); tableColumnMinValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamNumberDefObj, BigDecimal>, ObservableValue<BigDecimal>>() { public ObservableValue<BigDecimal> call(CellDataFeatures<ICFBamNumberDefObj, BigDecimal> p) { ICFBamNumberDefObj obj = p.getValue(); if (obj == null) { return (null); } else { BigDecimal value = obj.getOptionalMinValue(); ReadOnlyObjectWrapper<BigDecimal> observable = new ReadOnlyObjectWrapper<BigDecimal>(); observable.setValue(value); return (observable); } } }); tableColumnMinValue.setCellFactory( new Callback<TableColumn<ICFBamNumberDefObj, BigDecimal>, TableCell<ICFBamNumberDefObj, BigDecimal>>() { @Override public TableCell<ICFBamNumberDefObj, BigDecimal> call( TableColumn<ICFBamNumberDefObj, BigDecimal> arg) { return new CFNumberTableCell<ICFBamNumberDefObj>(31, 5); } }); dataTable.getColumns().add(tableColumnMinValue); tableColumnMaxValue = new TableColumn<ICFBamNumberDefObj, BigDecimal>("Max. Value"); tableColumnMaxValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamNumberDefObj, BigDecimal>, ObservableValue<BigDecimal>>() { public ObservableValue<BigDecimal> call(CellDataFeatures<ICFBamNumberDefObj, BigDecimal> p) { ICFBamNumberDefObj obj = p.getValue(); if (obj == null) { return (null); } else { BigDecimal value = obj.getOptionalMaxValue(); ReadOnlyObjectWrapper<BigDecimal> observable = new ReadOnlyObjectWrapper<BigDecimal>(); observable.setValue(value); return (observable); } } }); tableColumnMaxValue.setCellFactory( new Callback<TableColumn<ICFBamNumberDefObj, BigDecimal>, TableCell<ICFBamNumberDefObj, BigDecimal>>() { @Override public TableCell<ICFBamNumberDefObj, BigDecimal> call( TableColumn<ICFBamNumberDefObj, BigDecimal> arg) { return new CFNumberTableCell<ICFBamNumberDefObj>(31, 5); } }); dataTable.getColumns().add(tableColumnMaxValue); tableColumnNullValue = new TableColumn<ICFBamNumberDefObj, BigDecimal>("Null Value"); tableColumnNullValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamNumberDefObj, BigDecimal>, ObservableValue<BigDecimal>>() { public ObservableValue<BigDecimal> call(CellDataFeatures<ICFBamNumberDefObj, BigDecimal> p) { ICFBamNumberDefObj obj = p.getValue(); if (obj == null) { return (null); } else { BigDecimal value = obj.getOptionalNullValue(); ReadOnlyObjectWrapper<BigDecimal> observable = new ReadOnlyObjectWrapper<BigDecimal>(); observable.setValue(value); return (observable); } } }); tableColumnNullValue.setCellFactory( new Callback<TableColumn<ICFBamNumberDefObj, BigDecimal>, TableCell<ICFBamNumberDefObj, BigDecimal>>() { @Override public TableCell<ICFBamNumberDefObj, BigDecimal> call( TableColumn<ICFBamNumberDefObj, BigDecimal> arg) { return new CFNumberTableCell<ICFBamNumberDefObj>(31, 5); } }); dataTable.getColumns().add(tableColumnNullValue); tableColumnUnknownValue = new TableColumn<ICFBamNumberDefObj, BigDecimal>("Unknown Value"); tableColumnUnknownValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamNumberDefObj, BigDecimal>, ObservableValue<BigDecimal>>() { public ObservableValue<BigDecimal> call(CellDataFeatures<ICFBamNumberDefObj, BigDecimal> p) { ICFBamNumberDefObj obj = p.getValue(); if (obj == null) { return (null); } else { BigDecimal value = obj.getOptionalUnknownValue(); ReadOnlyObjectWrapper<BigDecimal> observable = new ReadOnlyObjectWrapper<BigDecimal>(); observable.setValue(value); return (observable); } } }); tableColumnUnknownValue.setCellFactory( new Callback<TableColumn<ICFBamNumberDefObj, BigDecimal>, TableCell<ICFBamNumberDefObj, BigDecimal>>() { @Override public TableCell<ICFBamNumberDefObj, BigDecimal> call( TableColumn<ICFBamNumberDefObj, BigDecimal> arg) { return new CFNumberTableCell<ICFBamNumberDefObj>(31, 5); } }); dataTable.getColumns().add(tableColumnUnknownValue); tableColumnLookupDefSchema = new TableColumn<ICFBamNumberDefObj, ICFBamSchemaDefObj>( "Defining Schema Definition"); tableColumnLookupDefSchema.setCellValueFactory( new Callback<CellDataFeatures<ICFBamNumberDefObj, ICFBamSchemaDefObj>, ObservableValue<ICFBamSchemaDefObj>>() { public ObservableValue<ICFBamSchemaDefObj> call( CellDataFeatures<ICFBamNumberDefObj, ICFBamSchemaDefObj> p) { ICFBamNumberDefObj 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<ICFBamNumberDefObj, ICFBamSchemaDefObj>, TableCell<ICFBamNumberDefObj, ICFBamSchemaDefObj>>() { @Override public TableCell<ICFBamNumberDefObj, ICFBamSchemaDefObj> call( TableColumn<ICFBamNumberDefObj, ICFBamSchemaDefObj> arg) { return new CFReferenceTableCell<ICFBamNumberDefObj, ICFBamSchemaDefObj>(); } }); dataTable.getColumns().add(tableColumnLookupDefSchema); dataTable.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<ICFBamNumberDefObj>() { @Override public void changed(ObservableValue<? extends ICFBamNumberDefObj> observable, ICFBamNumberDefObj oldValue, ICFBamNumberDefObj 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.choseNumberDef(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"); } ICFBamNumberDefObj selectedInstance = getJavaFXFocusAsNumberDef(); invokeWhenChosen.choseNumberDef(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.CFBamJavaFXNumberTypeListPane.java
public CFBamJavaFXNumberTypeListPane(ICFFormManager formManager, ICFBamJavaFXSchema argSchema, ICFBamSchemaDefObj argContainer, ICFBamNumberTypeObj argFocus, Collection<ICFBamNumberTypeObj> argDataCollection, ICFRefreshCallback refreshCallback, boolean sortByChain) { super();//from w w w . ja 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"); } // 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<ICFBamNumberTypeObj>(); tableColumnId = new TableColumn<ICFBamNumberTypeObj, Long>("Id"); tableColumnId.setCellValueFactory( new Callback<CellDataFeatures<ICFBamNumberTypeObj, Long>, ObservableValue<Long>>() { public ObservableValue<Long> call(CellDataFeatures<ICFBamNumberTypeObj, 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<ICFBamNumberTypeObj, Long>, TableCell<ICFBamNumberTypeObj, Long>>() { @Override public TableCell<ICFBamNumberTypeObj, Long> call(TableColumn<ICFBamNumberTypeObj, Long> arg) { return new CFInt64TableCell<ICFBamNumberTypeObj>(); } }); dataTable.getColumns().add(tableColumnId); tableColumnName = new TableColumn<ICFBamNumberTypeObj, String>("Name"); tableColumnName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamNumberTypeObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamNumberTypeObj, 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<ICFBamNumberTypeObj, String>, TableCell<ICFBamNumberTypeObj, String>>() { @Override public TableCell<ICFBamNumberTypeObj, String> call( TableColumn<ICFBamNumberTypeObj, String> arg) { return new CFStringTableCell<ICFBamNumberTypeObj>(); } }); dataTable.getColumns().add(tableColumnName); tableColumnShortName = new TableColumn<ICFBamNumberTypeObj, String>("Short Name"); tableColumnShortName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamNumberTypeObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamNumberTypeObj, 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<ICFBamNumberTypeObj, String>, TableCell<ICFBamNumberTypeObj, String>>() { @Override public TableCell<ICFBamNumberTypeObj, String> call( TableColumn<ICFBamNumberTypeObj, String> arg) { return new CFStringTableCell<ICFBamNumberTypeObj>(); } }); dataTable.getColumns().add(tableColumnShortName); tableColumnLabel = new TableColumn<ICFBamNumberTypeObj, String>("Label"); tableColumnLabel.setCellValueFactory( new Callback<CellDataFeatures<ICFBamNumberTypeObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamNumberTypeObj, 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<ICFBamNumberTypeObj, String>, TableCell<ICFBamNumberTypeObj, String>>() { @Override public TableCell<ICFBamNumberTypeObj, String> call( TableColumn<ICFBamNumberTypeObj, String> arg) { return new CFStringTableCell<ICFBamNumberTypeObj>(); } }); dataTable.getColumns().add(tableColumnLabel); tableColumnShortDescription = new TableColumn<ICFBamNumberTypeObj, String>("Short Description"); tableColumnShortDescription.setCellValueFactory( new Callback<CellDataFeatures<ICFBamNumberTypeObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamNumberTypeObj, 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<ICFBamNumberTypeObj, String>, TableCell<ICFBamNumberTypeObj, String>>() { @Override public TableCell<ICFBamNumberTypeObj, String> call( TableColumn<ICFBamNumberTypeObj, String> arg) { return new CFStringTableCell<ICFBamNumberTypeObj>(); } }); dataTable.getColumns().add(tableColumnShortDescription); tableColumnDescription = new TableColumn<ICFBamNumberTypeObj, String>("Description"); tableColumnDescription.setCellValueFactory( new Callback<CellDataFeatures<ICFBamNumberTypeObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamNumberTypeObj, 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<ICFBamNumberTypeObj, String>, TableCell<ICFBamNumberTypeObj, String>>() { @Override public TableCell<ICFBamNumberTypeObj, String> call( TableColumn<ICFBamNumberTypeObj, String> arg) { return new CFStringTableCell<ICFBamNumberTypeObj>(); } }); dataTable.getColumns().add(tableColumnDescription); tableColumnIsNullable = new TableColumn<ICFBamNumberTypeObj, Boolean>("Is Nullable"); tableColumnIsNullable.setCellValueFactory( new Callback<CellDataFeatures<ICFBamNumberTypeObj, Boolean>, ObservableValue<Boolean>>() { public ObservableValue<Boolean> call(CellDataFeatures<ICFBamNumberTypeObj, 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<ICFBamNumberTypeObj, Boolean>, TableCell<ICFBamNumberTypeObj, Boolean>>() { @Override public TableCell<ICFBamNumberTypeObj, Boolean> call( TableColumn<ICFBamNumberTypeObj, Boolean> arg) { return new CFBoolTableCell<ICFBamNumberTypeObj>(); } }); dataTable.getColumns().add(tableColumnIsNullable); tableColumnGenerateId = new TableColumn<ICFBamNumberTypeObj, Boolean>("Generate Id"); tableColumnGenerateId.setCellValueFactory( new Callback<CellDataFeatures<ICFBamNumberTypeObj, Boolean>, ObservableValue<Boolean>>() { public ObservableValue<Boolean> call(CellDataFeatures<ICFBamNumberTypeObj, 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<ICFBamNumberTypeObj, Boolean>, TableCell<ICFBamNumberTypeObj, Boolean>>() { @Override public TableCell<ICFBamNumberTypeObj, Boolean> call( TableColumn<ICFBamNumberTypeObj, Boolean> arg) { return new CFBoolTableCell<ICFBamNumberTypeObj>(); } }); dataTable.getColumns().add(tableColumnGenerateId); tableColumnDefaultVisibility = new TableColumn<ICFBamNumberTypeObj, Boolean>("Default Visibility"); tableColumnDefaultVisibility.setCellValueFactory( new Callback<CellDataFeatures<ICFBamNumberTypeObj, Boolean>, ObservableValue<Boolean>>() { public ObservableValue<Boolean> call(CellDataFeatures<ICFBamNumberTypeObj, 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<ICFBamNumberTypeObj, Boolean>, TableCell<ICFBamNumberTypeObj, Boolean>>() { @Override public TableCell<ICFBamNumberTypeObj, Boolean> call( TableColumn<ICFBamNumberTypeObj, Boolean> arg) { return new CFBoolTableCell<ICFBamNumberTypeObj>(); } }); dataTable.getColumns().add(tableColumnDefaultVisibility); tableColumnDbName = new TableColumn<ICFBamNumberTypeObj, String>("Db Name"); tableColumnDbName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamNumberTypeObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamNumberTypeObj, String> p) { ICFBamAtomObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getOptionalDbName(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnDbName.setCellFactory( new Callback<TableColumn<ICFBamNumberTypeObj, String>, TableCell<ICFBamNumberTypeObj, String>>() { @Override public TableCell<ICFBamNumberTypeObj, String> call( TableColumn<ICFBamNumberTypeObj, String> arg) { return new CFStringTableCell<ICFBamNumberTypeObj>(); } }); dataTable.getColumns().add(tableColumnDbName); tableColumnDigits = new TableColumn<ICFBamNumberTypeObj, Short>("Digits"); tableColumnDigits.setCellValueFactory( new Callback<CellDataFeatures<ICFBamNumberTypeObj, Short>, ObservableValue<Short>>() { public ObservableValue<Short> call(CellDataFeatures<ICFBamNumberTypeObj, Short> p) { ICFBamNumberDefObj obj = p.getValue(); if (obj == null) { return (null); } else { short value = obj.getRequiredDigits(); Short wrapped = new Short(value); ReadOnlyObjectWrapper<Short> observable = new ReadOnlyObjectWrapper<Short>(); observable.setValue(wrapped); return (observable); } } }); tableColumnDigits.setCellFactory( new Callback<TableColumn<ICFBamNumberTypeObj, Short>, TableCell<ICFBamNumberTypeObj, Short>>() { @Override public TableCell<ICFBamNumberTypeObj, Short> call(TableColumn<ICFBamNumberTypeObj, Short> arg) { return new CFInt16TableCell<ICFBamNumberTypeObj>(); } }); dataTable.getColumns().add(tableColumnDigits); tableColumnPrecis = new TableColumn<ICFBamNumberTypeObj, Short>("Precision"); tableColumnPrecis.setCellValueFactory( new Callback<CellDataFeatures<ICFBamNumberTypeObj, Short>, ObservableValue<Short>>() { public ObservableValue<Short> call(CellDataFeatures<ICFBamNumberTypeObj, Short> p) { ICFBamNumberDefObj obj = p.getValue(); if (obj == null) { return (null); } else { short value = obj.getRequiredPrecis(); Short wrapped = new Short(value); ReadOnlyObjectWrapper<Short> observable = new ReadOnlyObjectWrapper<Short>(); observable.setValue(wrapped); return (observable); } } }); tableColumnPrecis.setCellFactory( new Callback<TableColumn<ICFBamNumberTypeObj, Short>, TableCell<ICFBamNumberTypeObj, Short>>() { @Override public TableCell<ICFBamNumberTypeObj, Short> call(TableColumn<ICFBamNumberTypeObj, Short> arg) { return new CFInt16TableCell<ICFBamNumberTypeObj>(); } }); dataTable.getColumns().add(tableColumnPrecis); tableColumnInitValue = new TableColumn<ICFBamNumberTypeObj, BigDecimal>("Init. Value"); tableColumnInitValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamNumberTypeObj, BigDecimal>, ObservableValue<BigDecimal>>() { public ObservableValue<BigDecimal> call(CellDataFeatures<ICFBamNumberTypeObj, BigDecimal> p) { ICFBamNumberDefObj obj = p.getValue(); if (obj == null) { return (null); } else { BigDecimal value = obj.getOptionalInitValue(); ReadOnlyObjectWrapper<BigDecimal> observable = new ReadOnlyObjectWrapper<BigDecimal>(); observable.setValue(value); return (observable); } } }); tableColumnInitValue.setCellFactory( new Callback<TableColumn<ICFBamNumberTypeObj, BigDecimal>, TableCell<ICFBamNumberTypeObj, BigDecimal>>() { @Override public TableCell<ICFBamNumberTypeObj, BigDecimal> call( TableColumn<ICFBamNumberTypeObj, BigDecimal> arg) { return new CFNumberTableCell<ICFBamNumberTypeObj>(31, 5); } }); dataTable.getColumns().add(tableColumnInitValue); tableColumnDefaultValue = new TableColumn<ICFBamNumberTypeObj, BigDecimal>("Default Value"); tableColumnDefaultValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamNumberTypeObj, BigDecimal>, ObservableValue<BigDecimal>>() { public ObservableValue<BigDecimal> call(CellDataFeatures<ICFBamNumberTypeObj, BigDecimal> p) { ICFBamNumberDefObj obj = p.getValue(); if (obj == null) { return (null); } else { BigDecimal value = obj.getOptionalDefaultValue(); ReadOnlyObjectWrapper<BigDecimal> observable = new ReadOnlyObjectWrapper<BigDecimal>(); observable.setValue(value); return (observable); } } }); tableColumnDefaultValue.setCellFactory( new Callback<TableColumn<ICFBamNumberTypeObj, BigDecimal>, TableCell<ICFBamNumberTypeObj, BigDecimal>>() { @Override public TableCell<ICFBamNumberTypeObj, BigDecimal> call( TableColumn<ICFBamNumberTypeObj, BigDecimal> arg) { return new CFNumberTableCell<ICFBamNumberTypeObj>(31, 5); } }); dataTable.getColumns().add(tableColumnDefaultValue); tableColumnMinValue = new TableColumn<ICFBamNumberTypeObj, BigDecimal>("Min. Value"); tableColumnMinValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamNumberTypeObj, BigDecimal>, ObservableValue<BigDecimal>>() { public ObservableValue<BigDecimal> call(CellDataFeatures<ICFBamNumberTypeObj, BigDecimal> p) { ICFBamNumberDefObj obj = p.getValue(); if (obj == null) { return (null); } else { BigDecimal value = obj.getOptionalMinValue(); ReadOnlyObjectWrapper<BigDecimal> observable = new ReadOnlyObjectWrapper<BigDecimal>(); observable.setValue(value); return (observable); } } }); tableColumnMinValue.setCellFactory( new Callback<TableColumn<ICFBamNumberTypeObj, BigDecimal>, TableCell<ICFBamNumberTypeObj, BigDecimal>>() { @Override public TableCell<ICFBamNumberTypeObj, BigDecimal> call( TableColumn<ICFBamNumberTypeObj, BigDecimal> arg) { return new CFNumberTableCell<ICFBamNumberTypeObj>(31, 5); } }); dataTable.getColumns().add(tableColumnMinValue); tableColumnMaxValue = new TableColumn<ICFBamNumberTypeObj, BigDecimal>("Max. Value"); tableColumnMaxValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamNumberTypeObj, BigDecimal>, ObservableValue<BigDecimal>>() { public ObservableValue<BigDecimal> call(CellDataFeatures<ICFBamNumberTypeObj, BigDecimal> p) { ICFBamNumberDefObj obj = p.getValue(); if (obj == null) { return (null); } else { BigDecimal value = obj.getOptionalMaxValue(); ReadOnlyObjectWrapper<BigDecimal> observable = new ReadOnlyObjectWrapper<BigDecimal>(); observable.setValue(value); return (observable); } } }); tableColumnMaxValue.setCellFactory( new Callback<TableColumn<ICFBamNumberTypeObj, BigDecimal>, TableCell<ICFBamNumberTypeObj, BigDecimal>>() { @Override public TableCell<ICFBamNumberTypeObj, BigDecimal> call( TableColumn<ICFBamNumberTypeObj, BigDecimal> arg) { return new CFNumberTableCell<ICFBamNumberTypeObj>(31, 5); } }); dataTable.getColumns().add(tableColumnMaxValue); tableColumnNullValue = new TableColumn<ICFBamNumberTypeObj, BigDecimal>("Null Value"); tableColumnNullValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamNumberTypeObj, BigDecimal>, ObservableValue<BigDecimal>>() { public ObservableValue<BigDecimal> call(CellDataFeatures<ICFBamNumberTypeObj, BigDecimal> p) { ICFBamNumberDefObj obj = p.getValue(); if (obj == null) { return (null); } else { BigDecimal value = obj.getOptionalNullValue(); ReadOnlyObjectWrapper<BigDecimal> observable = new ReadOnlyObjectWrapper<BigDecimal>(); observable.setValue(value); return (observable); } } }); tableColumnNullValue.setCellFactory( new Callback<TableColumn<ICFBamNumberTypeObj, BigDecimal>, TableCell<ICFBamNumberTypeObj, BigDecimal>>() { @Override public TableCell<ICFBamNumberTypeObj, BigDecimal> call( TableColumn<ICFBamNumberTypeObj, BigDecimal> arg) { return new CFNumberTableCell<ICFBamNumberTypeObj>(31, 5); } }); dataTable.getColumns().add(tableColumnNullValue); tableColumnUnknownValue = new TableColumn<ICFBamNumberTypeObj, BigDecimal>("Unknown Value"); tableColumnUnknownValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamNumberTypeObj, BigDecimal>, ObservableValue<BigDecimal>>() { public ObservableValue<BigDecimal> call(CellDataFeatures<ICFBamNumberTypeObj, BigDecimal> p) { ICFBamNumberDefObj obj = p.getValue(); if (obj == null) { return (null); } else { BigDecimal value = obj.getOptionalUnknownValue(); ReadOnlyObjectWrapper<BigDecimal> observable = new ReadOnlyObjectWrapper<BigDecimal>(); observable.setValue(value); return (observable); } } }); tableColumnUnknownValue.setCellFactory( new Callback<TableColumn<ICFBamNumberTypeObj, BigDecimal>, TableCell<ICFBamNumberTypeObj, BigDecimal>>() { @Override public TableCell<ICFBamNumberTypeObj, BigDecimal> call( TableColumn<ICFBamNumberTypeObj, BigDecimal> arg) { return new CFNumberTableCell<ICFBamNumberTypeObj>(31, 5); } }); dataTable.getColumns().add(tableColumnUnknownValue); tableColumnLookupDefSchema = new TableColumn<ICFBamNumberTypeObj, ICFBamSchemaDefObj>( "Defining Schema Definition"); tableColumnLookupDefSchema.setCellValueFactory( new Callback<CellDataFeatures<ICFBamNumberTypeObj, ICFBamSchemaDefObj>, ObservableValue<ICFBamSchemaDefObj>>() { public ObservableValue<ICFBamSchemaDefObj> call( CellDataFeatures<ICFBamNumberTypeObj, ICFBamSchemaDefObj> p) { ICFBamNumberTypeObj 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<ICFBamNumberTypeObj, ICFBamSchemaDefObj>, TableCell<ICFBamNumberTypeObj, ICFBamSchemaDefObj>>() { @Override public TableCell<ICFBamNumberTypeObj, ICFBamSchemaDefObj> call( TableColumn<ICFBamNumberTypeObj, ICFBamSchemaDefObj> arg) { return new CFReferenceTableCell<ICFBamNumberTypeObj, ICFBamSchemaDefObj>(); } }); dataTable.getColumns().add(tableColumnLookupDefSchema); dataTable.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<ICFBamNumberTypeObj>() { @Override public void changed(ObservableValue<? extends ICFBamNumberTypeObj> observable, ICFBamNumberTypeObj oldValue, ICFBamNumberTypeObj 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 (observableListOfNumberType != null) { dataTable.setItems(observableListOfNumberType); } adjustListButtons(); }
From source file:net.sourceforge.msscodefactory.cfbam.v2_7.CFBamJavaFX.CFBamJavaFXId64GenListPane.java
public CFBamJavaFXId64GenListPane(ICFFormManager formManager, ICFBamJavaFXSchema argSchema, ICFBamSchemaDefObj argContainer, ICFBamId64GenObj argFocus, Collection<ICFBamId64GenObj> argDataCollection, ICFRefreshCallback refreshCallback, boolean sortByChain) { super();/*from w ww .jav a2 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<ICFBamId64GenObj>(); tableColumnId = new TableColumn<ICFBamId64GenObj, Long>("Id"); tableColumnId.setCellValueFactory( new Callback<CellDataFeatures<ICFBamId64GenObj, Long>, ObservableValue<Long>>() { public ObservableValue<Long> call(CellDataFeatures<ICFBamId64GenObj, 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<ICFBamId64GenObj, Long>, TableCell<ICFBamId64GenObj, Long>>() { @Override public TableCell<ICFBamId64GenObj, Long> call(TableColumn<ICFBamId64GenObj, Long> arg) { return new CFInt64TableCell<ICFBamId64GenObj>(); } }); dataTable.getColumns().add(tableColumnId); tableColumnName = new TableColumn<ICFBamId64GenObj, String>("Name"); tableColumnName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamId64GenObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamId64GenObj, 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<ICFBamId64GenObj, String>, TableCell<ICFBamId64GenObj, String>>() { @Override public TableCell<ICFBamId64GenObj, String> call(TableColumn<ICFBamId64GenObj, String> arg) { return new CFStringTableCell<ICFBamId64GenObj>(); } }); dataTable.getColumns().add(tableColumnName); tableColumnShortName = new TableColumn<ICFBamId64GenObj, String>("Short Name"); tableColumnShortName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamId64GenObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamId64GenObj, 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<ICFBamId64GenObj, String>, TableCell<ICFBamId64GenObj, String>>() { @Override public TableCell<ICFBamId64GenObj, String> call(TableColumn<ICFBamId64GenObj, String> arg) { return new CFStringTableCell<ICFBamId64GenObj>(); } }); dataTable.getColumns().add(tableColumnShortName); tableColumnLabel = new TableColumn<ICFBamId64GenObj, String>("Label"); tableColumnLabel.setCellValueFactory( new Callback<CellDataFeatures<ICFBamId64GenObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamId64GenObj, 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<ICFBamId64GenObj, String>, TableCell<ICFBamId64GenObj, String>>() { @Override public TableCell<ICFBamId64GenObj, String> call(TableColumn<ICFBamId64GenObj, String> arg) { return new CFStringTableCell<ICFBamId64GenObj>(); } }); dataTable.getColumns().add(tableColumnLabel); tableColumnShortDescription = new TableColumn<ICFBamId64GenObj, String>("Short Description"); tableColumnShortDescription.setCellValueFactory( new Callback<CellDataFeatures<ICFBamId64GenObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamId64GenObj, 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<ICFBamId64GenObj, String>, TableCell<ICFBamId64GenObj, String>>() { @Override public TableCell<ICFBamId64GenObj, String> call(TableColumn<ICFBamId64GenObj, String> arg) { return new CFStringTableCell<ICFBamId64GenObj>(); } }); dataTable.getColumns().add(tableColumnShortDescription); tableColumnDescription = new TableColumn<ICFBamId64GenObj, String>("Description"); tableColumnDescription.setCellValueFactory( new Callback<CellDataFeatures<ICFBamId64GenObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamId64GenObj, 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<ICFBamId64GenObj, String>, TableCell<ICFBamId64GenObj, String>>() { @Override public TableCell<ICFBamId64GenObj, String> call(TableColumn<ICFBamId64GenObj, String> arg) { return new CFStringTableCell<ICFBamId64GenObj>(); } }); dataTable.getColumns().add(tableColumnDescription); tableColumnIsNullable = new TableColumn<ICFBamId64GenObj, Boolean>("Is Nullable"); tableColumnIsNullable.setCellValueFactory( new Callback<CellDataFeatures<ICFBamId64GenObj, Boolean>, ObservableValue<Boolean>>() { public ObservableValue<Boolean> call(CellDataFeatures<ICFBamId64GenObj, 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<ICFBamId64GenObj, Boolean>, TableCell<ICFBamId64GenObj, Boolean>>() { @Override public TableCell<ICFBamId64GenObj, Boolean> call(TableColumn<ICFBamId64GenObj, Boolean> arg) { return new CFBoolTableCell<ICFBamId64GenObj>(); } }); dataTable.getColumns().add(tableColumnIsNullable); tableColumnGenerateId = new TableColumn<ICFBamId64GenObj, Boolean>("Generate Id"); tableColumnGenerateId.setCellValueFactory( new Callback<CellDataFeatures<ICFBamId64GenObj, Boolean>, ObservableValue<Boolean>>() { public ObservableValue<Boolean> call(CellDataFeatures<ICFBamId64GenObj, 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<ICFBamId64GenObj, Boolean>, TableCell<ICFBamId64GenObj, Boolean>>() { @Override public TableCell<ICFBamId64GenObj, Boolean> call(TableColumn<ICFBamId64GenObj, Boolean> arg) { return new CFBoolTableCell<ICFBamId64GenObj>(); } }); dataTable.getColumns().add(tableColumnGenerateId); tableColumnDefaultVisibility = new TableColumn<ICFBamId64GenObj, Boolean>("Default Visibility"); tableColumnDefaultVisibility.setCellValueFactory( new Callback<CellDataFeatures<ICFBamId64GenObj, Boolean>, ObservableValue<Boolean>>() { public ObservableValue<Boolean> call(CellDataFeatures<ICFBamId64GenObj, 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<ICFBamId64GenObj, Boolean>, TableCell<ICFBamId64GenObj, Boolean>>() { @Override public TableCell<ICFBamId64GenObj, Boolean> call(TableColumn<ICFBamId64GenObj, Boolean> arg) { return new CFBoolTableCell<ICFBamId64GenObj>(); } }); dataTable.getColumns().add(tableColumnDefaultVisibility); tableColumnDbName = new TableColumn<ICFBamId64GenObj, String>("Db Name"); tableColumnDbName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamId64GenObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamId64GenObj, String> p) { ICFBamAtomObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getOptionalDbName(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnDbName.setCellFactory( new Callback<TableColumn<ICFBamId64GenObj, String>, TableCell<ICFBamId64GenObj, String>>() { @Override public TableCell<ICFBamId64GenObj, String> call(TableColumn<ICFBamId64GenObj, String> arg) { return new CFStringTableCell<ICFBamId64GenObj>(); } }); dataTable.getColumns().add(tableColumnDbName); tableColumnInitValue = new TableColumn<ICFBamId64GenObj, Long>("Init. Value"); tableColumnInitValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamId64GenObj, Long>, ObservableValue<Long>>() { public ObservableValue<Long> call(CellDataFeatures<ICFBamId64GenObj, Long> p) { ICFBamInt64DefObj obj = p.getValue(); if (obj == null) { return (null); } else { Long value = obj.getOptionalInitValue(); ReadOnlyObjectWrapper<Long> observable = new ReadOnlyObjectWrapper<Long>(); observable.setValue(value); return (observable); } } }); tableColumnInitValue.setCellFactory( new Callback<TableColumn<ICFBamId64GenObj, Long>, TableCell<ICFBamId64GenObj, Long>>() { @Override public TableCell<ICFBamId64GenObj, Long> call(TableColumn<ICFBamId64GenObj, Long> arg) { return new CFInt64TableCell<ICFBamId64GenObj>(); } }); dataTable.getColumns().add(tableColumnInitValue); tableColumnDefaultValue = new TableColumn<ICFBamId64GenObj, Long>("Default Value"); tableColumnDefaultValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamId64GenObj, Long>, ObservableValue<Long>>() { public ObservableValue<Long> call(CellDataFeatures<ICFBamId64GenObj, Long> p) { ICFBamInt64DefObj obj = p.getValue(); if (obj == null) { return (null); } else { Long value = obj.getOptionalDefaultValue(); ReadOnlyObjectWrapper<Long> observable = new ReadOnlyObjectWrapper<Long>(); observable.setValue(value); return (observable); } } }); tableColumnDefaultValue.setCellFactory( new Callback<TableColumn<ICFBamId64GenObj, Long>, TableCell<ICFBamId64GenObj, Long>>() { @Override public TableCell<ICFBamId64GenObj, Long> call(TableColumn<ICFBamId64GenObj, Long> arg) { return new CFInt64TableCell<ICFBamId64GenObj>(); } }); dataTable.getColumns().add(tableColumnDefaultValue); tableColumnMinValue = new TableColumn<ICFBamId64GenObj, Long>("Min. Value"); tableColumnMinValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamId64GenObj, Long>, ObservableValue<Long>>() { public ObservableValue<Long> call(CellDataFeatures<ICFBamId64GenObj, Long> p) { ICFBamInt64DefObj obj = p.getValue(); if (obj == null) { return (null); } else { Long value = obj.getOptionalMinValue(); ReadOnlyObjectWrapper<Long> observable = new ReadOnlyObjectWrapper<Long>(); observable.setValue(value); return (observable); } } }); tableColumnMinValue.setCellFactory( new Callback<TableColumn<ICFBamId64GenObj, Long>, TableCell<ICFBamId64GenObj, Long>>() { @Override public TableCell<ICFBamId64GenObj, Long> call(TableColumn<ICFBamId64GenObj, Long> arg) { return new CFInt64TableCell<ICFBamId64GenObj>(); } }); dataTable.getColumns().add(tableColumnMinValue); tableColumnMaxValue = new TableColumn<ICFBamId64GenObj, Long>("Max. Value"); tableColumnMaxValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamId64GenObj, Long>, ObservableValue<Long>>() { public ObservableValue<Long> call(CellDataFeatures<ICFBamId64GenObj, Long> p) { ICFBamInt64DefObj obj = p.getValue(); if (obj == null) { return (null); } else { Long value = obj.getOptionalMaxValue(); ReadOnlyObjectWrapper<Long> observable = new ReadOnlyObjectWrapper<Long>(); observable.setValue(value); return (observable); } } }); tableColumnMaxValue.setCellFactory( new Callback<TableColumn<ICFBamId64GenObj, Long>, TableCell<ICFBamId64GenObj, Long>>() { @Override public TableCell<ICFBamId64GenObj, Long> call(TableColumn<ICFBamId64GenObj, Long> arg) { return new CFInt64TableCell<ICFBamId64GenObj>(); } }); dataTable.getColumns().add(tableColumnMaxValue); tableColumnNullValue = new TableColumn<ICFBamId64GenObj, Long>("Null Value"); tableColumnNullValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamId64GenObj, Long>, ObservableValue<Long>>() { public ObservableValue<Long> call(CellDataFeatures<ICFBamId64GenObj, Long> p) { ICFBamInt64DefObj obj = p.getValue(); if (obj == null) { return (null); } else { Long value = obj.getOptionalNullValue(); ReadOnlyObjectWrapper<Long> observable = new ReadOnlyObjectWrapper<Long>(); observable.setValue(value); return (observable); } } }); tableColumnNullValue.setCellFactory( new Callback<TableColumn<ICFBamId64GenObj, Long>, TableCell<ICFBamId64GenObj, Long>>() { @Override public TableCell<ICFBamId64GenObj, Long> call(TableColumn<ICFBamId64GenObj, Long> arg) { return new CFInt64TableCell<ICFBamId64GenObj>(); } }); dataTable.getColumns().add(tableColumnNullValue); tableColumnUnknownValue = new TableColumn<ICFBamId64GenObj, Long>("Unknown Value"); tableColumnUnknownValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamId64GenObj, Long>, ObservableValue<Long>>() { public ObservableValue<Long> call(CellDataFeatures<ICFBamId64GenObj, Long> p) { ICFBamInt64DefObj obj = p.getValue(); if (obj == null) { return (null); } else { Long value = obj.getOptionalUnknownValue(); ReadOnlyObjectWrapper<Long> observable = new ReadOnlyObjectWrapper<Long>(); observable.setValue(value); return (observable); } } }); tableColumnUnknownValue.setCellFactory( new Callback<TableColumn<ICFBamId64GenObj, Long>, TableCell<ICFBamId64GenObj, Long>>() { @Override public TableCell<ICFBamId64GenObj, Long> call(TableColumn<ICFBamId64GenObj, Long> arg) { return new CFInt64TableCell<ICFBamId64GenObj>(); } }); dataTable.getColumns().add(tableColumnUnknownValue); tableColumnSlice = new TableColumn<ICFBamId64GenObj, Short>("Slice"); tableColumnSlice.setCellValueFactory( new Callback<CellDataFeatures<ICFBamId64GenObj, Short>, ObservableValue<Short>>() { public ObservableValue<Short> call(CellDataFeatures<ICFBamId64GenObj, Short> p) { ICFBamId64GenObj obj = p.getValue(); if (obj == null) { return (null); } else { short value = obj.getRequiredSlice(); Short wrapped = new Short(value); ReadOnlyObjectWrapper<Short> observable = new ReadOnlyObjectWrapper<Short>(); observable.setValue(wrapped); return (observable); } } }); tableColumnSlice.setCellFactory( new Callback<TableColumn<ICFBamId64GenObj, Short>, TableCell<ICFBamId64GenObj, Short>>() { @Override public TableCell<ICFBamId64GenObj, Short> call(TableColumn<ICFBamId64GenObj, Short> arg) { return new CFInt16TableCell<ICFBamId64GenObj>(); } }); dataTable.getColumns().add(tableColumnSlice); tableColumnBlockSize = new TableColumn<ICFBamId64GenObj, Long>("BlockSize"); tableColumnBlockSize.setCellValueFactory( new Callback<CellDataFeatures<ICFBamId64GenObj, Long>, ObservableValue<Long>>() { public ObservableValue<Long> call(CellDataFeatures<ICFBamId64GenObj, Long> p) { ICFBamId64GenObj obj = p.getValue(); if (obj == null) { return (null); } else { long value = obj.getRequiredBlockSize(); Long wrapped = new Long(value); ReadOnlyObjectWrapper<Long> observable = new ReadOnlyObjectWrapper<Long>(); observable.setValue(wrapped); return (observable); } } }); tableColumnBlockSize.setCellFactory( new Callback<TableColumn<ICFBamId64GenObj, Long>, TableCell<ICFBamId64GenObj, Long>>() { @Override public TableCell<ICFBamId64GenObj, Long> call(TableColumn<ICFBamId64GenObj, Long> arg) { return new CFInt64TableCell<ICFBamId64GenObj>(); } }); dataTable.getColumns().add(tableColumnBlockSize); tableColumnLookupDefSchema = new TableColumn<ICFBamId64GenObj, ICFBamSchemaDefObj>( "Defining Schema Definition"); tableColumnLookupDefSchema.setCellValueFactory( new Callback<CellDataFeatures<ICFBamId64GenObj, ICFBamSchemaDefObj>, ObservableValue<ICFBamSchemaDefObj>>() { public ObservableValue<ICFBamSchemaDefObj> call( CellDataFeatures<ICFBamId64GenObj, ICFBamSchemaDefObj> p) { ICFBamId64GenObj 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<ICFBamId64GenObj, ICFBamSchemaDefObj>, TableCell<ICFBamId64GenObj, ICFBamSchemaDefObj>>() { @Override public TableCell<ICFBamId64GenObj, ICFBamSchemaDefObj> call( TableColumn<ICFBamId64GenObj, ICFBamSchemaDefObj> arg) { return new CFReferenceTableCell<ICFBamId64GenObj, ICFBamSchemaDefObj>(); } }); dataTable.getColumns().add(tableColumnLookupDefSchema); tableColumnLookupDispenser = new TableColumn<ICFBamId64GenObj, ICFBamTableObj>("Dispensing Table"); tableColumnLookupDispenser.setCellValueFactory( new Callback<CellDataFeatures<ICFBamId64GenObj, ICFBamTableObj>, ObservableValue<ICFBamTableObj>>() { public ObservableValue<ICFBamTableObj> call( CellDataFeatures<ICFBamId64GenObj, ICFBamTableObj> p) { ICFBamId64GenObj obj = p.getValue(); if (obj == null) { return (null); } else { ICFBamTableObj ref = obj.getOptionalLookupDispenser(); ReadOnlyObjectWrapper<ICFBamTableObj> observable = new ReadOnlyObjectWrapper<ICFBamTableObj>(); observable.setValue(ref); return (observable); } } }); tableColumnLookupDispenser.setCellFactory( new Callback<TableColumn<ICFBamId64GenObj, ICFBamTableObj>, TableCell<ICFBamId64GenObj, ICFBamTableObj>>() { @Override public TableCell<ICFBamId64GenObj, ICFBamTableObj> call( TableColumn<ICFBamId64GenObj, ICFBamTableObj> arg) { return new CFReferenceTableCell<ICFBamId64GenObj, ICFBamTableObj>(); } }); dataTable.getColumns().add(tableColumnLookupDispenser); dataTable.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<ICFBamId64GenObj>() { @Override public void changed(ObservableValue<? extends ICFBamId64GenObj> observable, ICFBamId64GenObj oldValue, ICFBamId64GenObj 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 (observableListOfId64Gen != null) { dataTable.setItems(observableListOfId64Gen); } adjustListButtons(); }
From source file:net.sourceforge.msscodefactory.cfbam.v2_7.CFBamJavaFX.CFBamJavaFXId16GenListPane.java
public CFBamJavaFXId16GenListPane(ICFFormManager formManager, ICFBamJavaFXSchema argSchema, ICFBamSchemaDefObj argContainer, ICFBamId16GenObj argFocus, Collection<ICFBamId16GenObj> argDataCollection, ICFRefreshCallback refreshCallback, boolean sortByChain) { super();//w ww . 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<ICFBamId16GenObj>(); tableColumnId = new TableColumn<ICFBamId16GenObj, Long>("Id"); tableColumnId.setCellValueFactory( new Callback<CellDataFeatures<ICFBamId16GenObj, Long>, ObservableValue<Long>>() { public ObservableValue<Long> call(CellDataFeatures<ICFBamId16GenObj, 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<ICFBamId16GenObj, Long>, TableCell<ICFBamId16GenObj, Long>>() { @Override public TableCell<ICFBamId16GenObj, Long> call(TableColumn<ICFBamId16GenObj, Long> arg) { return new CFInt64TableCell<ICFBamId16GenObj>(); } }); dataTable.getColumns().add(tableColumnId); tableColumnName = new TableColumn<ICFBamId16GenObj, String>("Name"); tableColumnName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamId16GenObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamId16GenObj, 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<ICFBamId16GenObj, String>, TableCell<ICFBamId16GenObj, String>>() { @Override public TableCell<ICFBamId16GenObj, String> call(TableColumn<ICFBamId16GenObj, String> arg) { return new CFStringTableCell<ICFBamId16GenObj>(); } }); dataTable.getColumns().add(tableColumnName); tableColumnShortName = new TableColumn<ICFBamId16GenObj, String>("Short Name"); tableColumnShortName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamId16GenObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamId16GenObj, 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<ICFBamId16GenObj, String>, TableCell<ICFBamId16GenObj, String>>() { @Override public TableCell<ICFBamId16GenObj, String> call(TableColumn<ICFBamId16GenObj, String> arg) { return new CFStringTableCell<ICFBamId16GenObj>(); } }); dataTable.getColumns().add(tableColumnShortName); tableColumnLabel = new TableColumn<ICFBamId16GenObj, String>("Label"); tableColumnLabel.setCellValueFactory( new Callback<CellDataFeatures<ICFBamId16GenObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamId16GenObj, 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<ICFBamId16GenObj, String>, TableCell<ICFBamId16GenObj, String>>() { @Override public TableCell<ICFBamId16GenObj, String> call(TableColumn<ICFBamId16GenObj, String> arg) { return new CFStringTableCell<ICFBamId16GenObj>(); } }); dataTable.getColumns().add(tableColumnLabel); tableColumnShortDescription = new TableColumn<ICFBamId16GenObj, String>("Short Description"); tableColumnShortDescription.setCellValueFactory( new Callback<CellDataFeatures<ICFBamId16GenObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamId16GenObj, 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<ICFBamId16GenObj, String>, TableCell<ICFBamId16GenObj, String>>() { @Override public TableCell<ICFBamId16GenObj, String> call(TableColumn<ICFBamId16GenObj, String> arg) { return new CFStringTableCell<ICFBamId16GenObj>(); } }); dataTable.getColumns().add(tableColumnShortDescription); tableColumnDescription = new TableColumn<ICFBamId16GenObj, String>("Description"); tableColumnDescription.setCellValueFactory( new Callback<CellDataFeatures<ICFBamId16GenObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamId16GenObj, 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<ICFBamId16GenObj, String>, TableCell<ICFBamId16GenObj, String>>() { @Override public TableCell<ICFBamId16GenObj, String> call(TableColumn<ICFBamId16GenObj, String> arg) { return new CFStringTableCell<ICFBamId16GenObj>(); } }); dataTable.getColumns().add(tableColumnDescription); tableColumnIsNullable = new TableColumn<ICFBamId16GenObj, Boolean>("Is Nullable"); tableColumnIsNullable.setCellValueFactory( new Callback<CellDataFeatures<ICFBamId16GenObj, Boolean>, ObservableValue<Boolean>>() { public ObservableValue<Boolean> call(CellDataFeatures<ICFBamId16GenObj, 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<ICFBamId16GenObj, Boolean>, TableCell<ICFBamId16GenObj, Boolean>>() { @Override public TableCell<ICFBamId16GenObj, Boolean> call(TableColumn<ICFBamId16GenObj, Boolean> arg) { return new CFBoolTableCell<ICFBamId16GenObj>(); } }); dataTable.getColumns().add(tableColumnIsNullable); tableColumnGenerateId = new TableColumn<ICFBamId16GenObj, Boolean>("Generate Id"); tableColumnGenerateId.setCellValueFactory( new Callback<CellDataFeatures<ICFBamId16GenObj, Boolean>, ObservableValue<Boolean>>() { public ObservableValue<Boolean> call(CellDataFeatures<ICFBamId16GenObj, 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<ICFBamId16GenObj, Boolean>, TableCell<ICFBamId16GenObj, Boolean>>() { @Override public TableCell<ICFBamId16GenObj, Boolean> call(TableColumn<ICFBamId16GenObj, Boolean> arg) { return new CFBoolTableCell<ICFBamId16GenObj>(); } }); dataTable.getColumns().add(tableColumnGenerateId); tableColumnDefaultVisibility = new TableColumn<ICFBamId16GenObj, Boolean>("Default Visibility"); tableColumnDefaultVisibility.setCellValueFactory( new Callback<CellDataFeatures<ICFBamId16GenObj, Boolean>, ObservableValue<Boolean>>() { public ObservableValue<Boolean> call(CellDataFeatures<ICFBamId16GenObj, 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<ICFBamId16GenObj, Boolean>, TableCell<ICFBamId16GenObj, Boolean>>() { @Override public TableCell<ICFBamId16GenObj, Boolean> call(TableColumn<ICFBamId16GenObj, Boolean> arg) { return new CFBoolTableCell<ICFBamId16GenObj>(); } }); dataTable.getColumns().add(tableColumnDefaultVisibility); tableColumnDbName = new TableColumn<ICFBamId16GenObj, String>("Db Name"); tableColumnDbName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamId16GenObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamId16GenObj, String> p) { ICFBamAtomObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getOptionalDbName(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnDbName.setCellFactory( new Callback<TableColumn<ICFBamId16GenObj, String>, TableCell<ICFBamId16GenObj, String>>() { @Override public TableCell<ICFBamId16GenObj, String> call(TableColumn<ICFBamId16GenObj, String> arg) { return new CFStringTableCell<ICFBamId16GenObj>(); } }); dataTable.getColumns().add(tableColumnDbName); tableColumnInitValue = new TableColumn<ICFBamId16GenObj, Short>("Init. Value"); tableColumnInitValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamId16GenObj, Short>, ObservableValue<Short>>() { public ObservableValue<Short> call(CellDataFeatures<ICFBamId16GenObj, Short> p) { ICFBamInt16DefObj obj = p.getValue(); if (obj == null) { return (null); } else { Short value = obj.getOptionalInitValue(); ReadOnlyObjectWrapper<Short> observable = new ReadOnlyObjectWrapper<Short>(); observable.setValue(value); return (observable); } } }); tableColumnInitValue.setCellFactory( new Callback<TableColumn<ICFBamId16GenObj, Short>, TableCell<ICFBamId16GenObj, Short>>() { @Override public TableCell<ICFBamId16GenObj, Short> call(TableColumn<ICFBamId16GenObj, Short> arg) { return new CFInt16TableCell<ICFBamId16GenObj>(); } }); dataTable.getColumns().add(tableColumnInitValue); tableColumnDefaultValue = new TableColumn<ICFBamId16GenObj, Short>("Default Value"); tableColumnDefaultValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamId16GenObj, Short>, ObservableValue<Short>>() { public ObservableValue<Short> call(CellDataFeatures<ICFBamId16GenObj, Short> p) { ICFBamInt16DefObj obj = p.getValue(); if (obj == null) { return (null); } else { Short value = obj.getOptionalDefaultValue(); ReadOnlyObjectWrapper<Short> observable = new ReadOnlyObjectWrapper<Short>(); observable.setValue(value); return (observable); } } }); tableColumnDefaultValue.setCellFactory( new Callback<TableColumn<ICFBamId16GenObj, Short>, TableCell<ICFBamId16GenObj, Short>>() { @Override public TableCell<ICFBamId16GenObj, Short> call(TableColumn<ICFBamId16GenObj, Short> arg) { return new CFInt16TableCell<ICFBamId16GenObj>(); } }); dataTable.getColumns().add(tableColumnDefaultValue); tableColumnMinValue = new TableColumn<ICFBamId16GenObj, Short>("Min. Value"); tableColumnMinValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamId16GenObj, Short>, ObservableValue<Short>>() { public ObservableValue<Short> call(CellDataFeatures<ICFBamId16GenObj, Short> p) { ICFBamInt16DefObj obj = p.getValue(); if (obj == null) { return (null); } else { Short value = obj.getOptionalMinValue(); ReadOnlyObjectWrapper<Short> observable = new ReadOnlyObjectWrapper<Short>(); observable.setValue(value); return (observable); } } }); tableColumnMinValue.setCellFactory( new Callback<TableColumn<ICFBamId16GenObj, Short>, TableCell<ICFBamId16GenObj, Short>>() { @Override public TableCell<ICFBamId16GenObj, Short> call(TableColumn<ICFBamId16GenObj, Short> arg) { return new CFInt16TableCell<ICFBamId16GenObj>(); } }); dataTable.getColumns().add(tableColumnMinValue); tableColumnMaxValue = new TableColumn<ICFBamId16GenObj, Short>("Max. Value"); tableColumnMaxValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamId16GenObj, Short>, ObservableValue<Short>>() { public ObservableValue<Short> call(CellDataFeatures<ICFBamId16GenObj, Short> p) { ICFBamInt16DefObj obj = p.getValue(); if (obj == null) { return (null); } else { Short value = obj.getOptionalMaxValue(); ReadOnlyObjectWrapper<Short> observable = new ReadOnlyObjectWrapper<Short>(); observable.setValue(value); return (observable); } } }); tableColumnMaxValue.setCellFactory( new Callback<TableColumn<ICFBamId16GenObj, Short>, TableCell<ICFBamId16GenObj, Short>>() { @Override public TableCell<ICFBamId16GenObj, Short> call(TableColumn<ICFBamId16GenObj, Short> arg) { return new CFInt16TableCell<ICFBamId16GenObj>(); } }); dataTable.getColumns().add(tableColumnMaxValue); tableColumnNullValue = new TableColumn<ICFBamId16GenObj, Short>("Null Value"); tableColumnNullValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamId16GenObj, Short>, ObservableValue<Short>>() { public ObservableValue<Short> call(CellDataFeatures<ICFBamId16GenObj, Short> p) { ICFBamInt16DefObj obj = p.getValue(); if (obj == null) { return (null); } else { Short value = obj.getOptionalNullValue(); ReadOnlyObjectWrapper<Short> observable = new ReadOnlyObjectWrapper<Short>(); observable.setValue(value); return (observable); } } }); tableColumnNullValue.setCellFactory( new Callback<TableColumn<ICFBamId16GenObj, Short>, TableCell<ICFBamId16GenObj, Short>>() { @Override public TableCell<ICFBamId16GenObj, Short> call(TableColumn<ICFBamId16GenObj, Short> arg) { return new CFInt16TableCell<ICFBamId16GenObj>(); } }); dataTable.getColumns().add(tableColumnNullValue); tableColumnUnknownValue = new TableColumn<ICFBamId16GenObj, Short>("Unknown Value"); tableColumnUnknownValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamId16GenObj, Short>, ObservableValue<Short>>() { public ObservableValue<Short> call(CellDataFeatures<ICFBamId16GenObj, Short> p) { ICFBamInt16DefObj obj = p.getValue(); if (obj == null) { return (null); } else { Short value = obj.getOptionalUnknownValue(); ReadOnlyObjectWrapper<Short> observable = new ReadOnlyObjectWrapper<Short>(); observable.setValue(value); return (observable); } } }); tableColumnUnknownValue.setCellFactory( new Callback<TableColumn<ICFBamId16GenObj, Short>, TableCell<ICFBamId16GenObj, Short>>() { @Override public TableCell<ICFBamId16GenObj, Short> call(TableColumn<ICFBamId16GenObj, Short> arg) { return new CFInt16TableCell<ICFBamId16GenObj>(); } }); dataTable.getColumns().add(tableColumnUnknownValue); tableColumnSlice = new TableColumn<ICFBamId16GenObj, Short>("Slice"); tableColumnSlice.setCellValueFactory( new Callback<CellDataFeatures<ICFBamId16GenObj, Short>, ObservableValue<Short>>() { public ObservableValue<Short> call(CellDataFeatures<ICFBamId16GenObj, Short> p) { ICFBamId16GenObj obj = p.getValue(); if (obj == null) { return (null); } else { short value = obj.getRequiredSlice(); Short wrapped = new Short(value); ReadOnlyObjectWrapper<Short> observable = new ReadOnlyObjectWrapper<Short>(); observable.setValue(wrapped); return (observable); } } }); tableColumnSlice.setCellFactory( new Callback<TableColumn<ICFBamId16GenObj, Short>, TableCell<ICFBamId16GenObj, Short>>() { @Override public TableCell<ICFBamId16GenObj, Short> call(TableColumn<ICFBamId16GenObj, Short> arg) { return new CFInt16TableCell<ICFBamId16GenObj>(); } }); dataTable.getColumns().add(tableColumnSlice); tableColumnBlockSize = new TableColumn<ICFBamId16GenObj, Short>("BlockSize"); tableColumnBlockSize.setCellValueFactory( new Callback<CellDataFeatures<ICFBamId16GenObj, Short>, ObservableValue<Short>>() { public ObservableValue<Short> call(CellDataFeatures<ICFBamId16GenObj, Short> p) { ICFBamId16GenObj obj = p.getValue(); if (obj == null) { return (null); } else { short value = obj.getRequiredBlockSize(); Short wrapped = new Short(value); ReadOnlyObjectWrapper<Short> observable = new ReadOnlyObjectWrapper<Short>(); observable.setValue(wrapped); return (observable); } } }); tableColumnBlockSize.setCellFactory( new Callback<TableColumn<ICFBamId16GenObj, Short>, TableCell<ICFBamId16GenObj, Short>>() { @Override public TableCell<ICFBamId16GenObj, Short> call(TableColumn<ICFBamId16GenObj, Short> arg) { return new CFInt16TableCell<ICFBamId16GenObj>(); } }); dataTable.getColumns().add(tableColumnBlockSize); tableColumnLookupDefSchema = new TableColumn<ICFBamId16GenObj, ICFBamSchemaDefObj>( "Defining Schema Definition"); tableColumnLookupDefSchema.setCellValueFactory( new Callback<CellDataFeatures<ICFBamId16GenObj, ICFBamSchemaDefObj>, ObservableValue<ICFBamSchemaDefObj>>() { public ObservableValue<ICFBamSchemaDefObj> call( CellDataFeatures<ICFBamId16GenObj, ICFBamSchemaDefObj> p) { ICFBamId16GenObj 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<ICFBamId16GenObj, ICFBamSchemaDefObj>, TableCell<ICFBamId16GenObj, ICFBamSchemaDefObj>>() { @Override public TableCell<ICFBamId16GenObj, ICFBamSchemaDefObj> call( TableColumn<ICFBamId16GenObj, ICFBamSchemaDefObj> arg) { return new CFReferenceTableCell<ICFBamId16GenObj, ICFBamSchemaDefObj>(); } }); dataTable.getColumns().add(tableColumnLookupDefSchema); tableColumnLookupDispenser = new TableColumn<ICFBamId16GenObj, ICFBamTableObj>("Dispensing Table"); tableColumnLookupDispenser.setCellValueFactory( new Callback<CellDataFeatures<ICFBamId16GenObj, ICFBamTableObj>, ObservableValue<ICFBamTableObj>>() { public ObservableValue<ICFBamTableObj> call( CellDataFeatures<ICFBamId16GenObj, ICFBamTableObj> p) { ICFBamId16GenObj obj = p.getValue(); if (obj == null) { return (null); } else { ICFBamTableObj ref = obj.getOptionalLookupDispenser(); ReadOnlyObjectWrapper<ICFBamTableObj> observable = new ReadOnlyObjectWrapper<ICFBamTableObj>(); observable.setValue(ref); return (observable); } } }); tableColumnLookupDispenser.setCellFactory( new Callback<TableColumn<ICFBamId16GenObj, ICFBamTableObj>, TableCell<ICFBamId16GenObj, ICFBamTableObj>>() { @Override public TableCell<ICFBamId16GenObj, ICFBamTableObj> call( TableColumn<ICFBamId16GenObj, ICFBamTableObj> arg) { return new CFReferenceTableCell<ICFBamId16GenObj, ICFBamTableObj>(); } }); dataTable.getColumns().add(tableColumnLookupDispenser); dataTable.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<ICFBamId16GenObj>() { @Override public void changed(ObservableValue<? extends ICFBamId16GenObj> observable, ICFBamId16GenObj oldValue, ICFBamId16GenObj 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 (observableListOfId16Gen != null) { dataTable.setItems(observableListOfId16Gen); } adjustListButtons(); }
From source file:net.sourceforge.msscodefactory.cfbam.v2_7.CFBamJavaFX.CFBamJavaFXId32GenListPane.java
public CFBamJavaFXId32GenListPane(ICFFormManager formManager, ICFBamJavaFXSchema argSchema, ICFBamSchemaDefObj argContainer, ICFBamId32GenObj argFocus, Collection<ICFBamId32GenObj> argDataCollection, ICFRefreshCallback refreshCallback, boolean sortByChain) { super();/*from w w w.j av a2 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<ICFBamId32GenObj>(); tableColumnId = new TableColumn<ICFBamId32GenObj, Long>("Id"); tableColumnId.setCellValueFactory( new Callback<CellDataFeatures<ICFBamId32GenObj, Long>, ObservableValue<Long>>() { public ObservableValue<Long> call(CellDataFeatures<ICFBamId32GenObj, 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<ICFBamId32GenObj, Long>, TableCell<ICFBamId32GenObj, Long>>() { @Override public TableCell<ICFBamId32GenObj, Long> call(TableColumn<ICFBamId32GenObj, Long> arg) { return new CFInt64TableCell<ICFBamId32GenObj>(); } }); dataTable.getColumns().add(tableColumnId); tableColumnName = new TableColumn<ICFBamId32GenObj, String>("Name"); tableColumnName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamId32GenObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamId32GenObj, 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<ICFBamId32GenObj, String>, TableCell<ICFBamId32GenObj, String>>() { @Override public TableCell<ICFBamId32GenObj, String> call(TableColumn<ICFBamId32GenObj, String> arg) { return new CFStringTableCell<ICFBamId32GenObj>(); } }); dataTable.getColumns().add(tableColumnName); tableColumnShortName = new TableColumn<ICFBamId32GenObj, String>("Short Name"); tableColumnShortName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamId32GenObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamId32GenObj, 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<ICFBamId32GenObj, String>, TableCell<ICFBamId32GenObj, String>>() { @Override public TableCell<ICFBamId32GenObj, String> call(TableColumn<ICFBamId32GenObj, String> arg) { return new CFStringTableCell<ICFBamId32GenObj>(); } }); dataTable.getColumns().add(tableColumnShortName); tableColumnLabel = new TableColumn<ICFBamId32GenObj, String>("Label"); tableColumnLabel.setCellValueFactory( new Callback<CellDataFeatures<ICFBamId32GenObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamId32GenObj, 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<ICFBamId32GenObj, String>, TableCell<ICFBamId32GenObj, String>>() { @Override public TableCell<ICFBamId32GenObj, String> call(TableColumn<ICFBamId32GenObj, String> arg) { return new CFStringTableCell<ICFBamId32GenObj>(); } }); dataTable.getColumns().add(tableColumnLabel); tableColumnShortDescription = new TableColumn<ICFBamId32GenObj, String>("Short Description"); tableColumnShortDescription.setCellValueFactory( new Callback<CellDataFeatures<ICFBamId32GenObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamId32GenObj, 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<ICFBamId32GenObj, String>, TableCell<ICFBamId32GenObj, String>>() { @Override public TableCell<ICFBamId32GenObj, String> call(TableColumn<ICFBamId32GenObj, String> arg) { return new CFStringTableCell<ICFBamId32GenObj>(); } }); dataTable.getColumns().add(tableColumnShortDescription); tableColumnDescription = new TableColumn<ICFBamId32GenObj, String>("Description"); tableColumnDescription.setCellValueFactory( new Callback<CellDataFeatures<ICFBamId32GenObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamId32GenObj, 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<ICFBamId32GenObj, String>, TableCell<ICFBamId32GenObj, String>>() { @Override public TableCell<ICFBamId32GenObj, String> call(TableColumn<ICFBamId32GenObj, String> arg) { return new CFStringTableCell<ICFBamId32GenObj>(); } }); dataTable.getColumns().add(tableColumnDescription); tableColumnIsNullable = new TableColumn<ICFBamId32GenObj, Boolean>("Is Nullable"); tableColumnIsNullable.setCellValueFactory( new Callback<CellDataFeatures<ICFBamId32GenObj, Boolean>, ObservableValue<Boolean>>() { public ObservableValue<Boolean> call(CellDataFeatures<ICFBamId32GenObj, 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<ICFBamId32GenObj, Boolean>, TableCell<ICFBamId32GenObj, Boolean>>() { @Override public TableCell<ICFBamId32GenObj, Boolean> call(TableColumn<ICFBamId32GenObj, Boolean> arg) { return new CFBoolTableCell<ICFBamId32GenObj>(); } }); dataTable.getColumns().add(tableColumnIsNullable); tableColumnGenerateId = new TableColumn<ICFBamId32GenObj, Boolean>("Generate Id"); tableColumnGenerateId.setCellValueFactory( new Callback<CellDataFeatures<ICFBamId32GenObj, Boolean>, ObservableValue<Boolean>>() { public ObservableValue<Boolean> call(CellDataFeatures<ICFBamId32GenObj, 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<ICFBamId32GenObj, Boolean>, TableCell<ICFBamId32GenObj, Boolean>>() { @Override public TableCell<ICFBamId32GenObj, Boolean> call(TableColumn<ICFBamId32GenObj, Boolean> arg) { return new CFBoolTableCell<ICFBamId32GenObj>(); } }); dataTable.getColumns().add(tableColumnGenerateId); tableColumnDefaultVisibility = new TableColumn<ICFBamId32GenObj, Boolean>("Default Visibility"); tableColumnDefaultVisibility.setCellValueFactory( new Callback<CellDataFeatures<ICFBamId32GenObj, Boolean>, ObservableValue<Boolean>>() { public ObservableValue<Boolean> call(CellDataFeatures<ICFBamId32GenObj, 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<ICFBamId32GenObj, Boolean>, TableCell<ICFBamId32GenObj, Boolean>>() { @Override public TableCell<ICFBamId32GenObj, Boolean> call(TableColumn<ICFBamId32GenObj, Boolean> arg) { return new CFBoolTableCell<ICFBamId32GenObj>(); } }); dataTable.getColumns().add(tableColumnDefaultVisibility); tableColumnDbName = new TableColumn<ICFBamId32GenObj, String>("Db Name"); tableColumnDbName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamId32GenObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamId32GenObj, String> p) { ICFBamAtomObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getOptionalDbName(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnDbName.setCellFactory( new Callback<TableColumn<ICFBamId32GenObj, String>, TableCell<ICFBamId32GenObj, String>>() { @Override public TableCell<ICFBamId32GenObj, String> call(TableColumn<ICFBamId32GenObj, String> arg) { return new CFStringTableCell<ICFBamId32GenObj>(); } }); dataTable.getColumns().add(tableColumnDbName); tableColumnInitValue = new TableColumn<ICFBamId32GenObj, Integer>("Init. Value"); tableColumnInitValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamId32GenObj, Integer>, ObservableValue<Integer>>() { public ObservableValue<Integer> call(CellDataFeatures<ICFBamId32GenObj, Integer> p) { ICFBamInt32DefObj obj = p.getValue(); if (obj == null) { return (null); } else { Integer value = obj.getOptionalInitValue(); ReadOnlyObjectWrapper<Integer> observable = new ReadOnlyObjectWrapper<Integer>(); observable.setValue(value); return (observable); } } }); tableColumnInitValue.setCellFactory( new Callback<TableColumn<ICFBamId32GenObj, Integer>, TableCell<ICFBamId32GenObj, Integer>>() { @Override public TableCell<ICFBamId32GenObj, Integer> call(TableColumn<ICFBamId32GenObj, Integer> arg) { return new CFInt32TableCell<ICFBamId32GenObj>(); } }); dataTable.getColumns().add(tableColumnInitValue); tableColumnDefaultValue = new TableColumn<ICFBamId32GenObj, Integer>("Default Value"); tableColumnDefaultValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamId32GenObj, Integer>, ObservableValue<Integer>>() { public ObservableValue<Integer> call(CellDataFeatures<ICFBamId32GenObj, Integer> p) { ICFBamInt32DefObj obj = p.getValue(); if (obj == null) { return (null); } else { Integer value = obj.getOptionalDefaultValue(); ReadOnlyObjectWrapper<Integer> observable = new ReadOnlyObjectWrapper<Integer>(); observable.setValue(value); return (observable); } } }); tableColumnDefaultValue.setCellFactory( new Callback<TableColumn<ICFBamId32GenObj, Integer>, TableCell<ICFBamId32GenObj, Integer>>() { @Override public TableCell<ICFBamId32GenObj, Integer> call(TableColumn<ICFBamId32GenObj, Integer> arg) { return new CFInt32TableCell<ICFBamId32GenObj>(); } }); dataTable.getColumns().add(tableColumnDefaultValue); tableColumnMinValue = new TableColumn<ICFBamId32GenObj, Integer>("Min. Value"); tableColumnMinValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamId32GenObj, Integer>, ObservableValue<Integer>>() { public ObservableValue<Integer> call(CellDataFeatures<ICFBamId32GenObj, Integer> p) { ICFBamInt32DefObj obj = p.getValue(); if (obj == null) { return (null); } else { Integer value = obj.getOptionalMinValue(); ReadOnlyObjectWrapper<Integer> observable = new ReadOnlyObjectWrapper<Integer>(); observable.setValue(value); return (observable); } } }); tableColumnMinValue.setCellFactory( new Callback<TableColumn<ICFBamId32GenObj, Integer>, TableCell<ICFBamId32GenObj, Integer>>() { @Override public TableCell<ICFBamId32GenObj, Integer> call(TableColumn<ICFBamId32GenObj, Integer> arg) { return new CFInt32TableCell<ICFBamId32GenObj>(); } }); dataTable.getColumns().add(tableColumnMinValue); tableColumnMaxValue = new TableColumn<ICFBamId32GenObj, Integer>("Max. Value"); tableColumnMaxValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamId32GenObj, Integer>, ObservableValue<Integer>>() { public ObservableValue<Integer> call(CellDataFeatures<ICFBamId32GenObj, Integer> p) { ICFBamInt32DefObj obj = p.getValue(); if (obj == null) { return (null); } else { Integer value = obj.getOptionalMaxValue(); ReadOnlyObjectWrapper<Integer> observable = new ReadOnlyObjectWrapper<Integer>(); observable.setValue(value); return (observable); } } }); tableColumnMaxValue.setCellFactory( new Callback<TableColumn<ICFBamId32GenObj, Integer>, TableCell<ICFBamId32GenObj, Integer>>() { @Override public TableCell<ICFBamId32GenObj, Integer> call(TableColumn<ICFBamId32GenObj, Integer> arg) { return new CFInt32TableCell<ICFBamId32GenObj>(); } }); dataTable.getColumns().add(tableColumnMaxValue); tableColumnNullValue = new TableColumn<ICFBamId32GenObj, Integer>("Null Value"); tableColumnNullValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamId32GenObj, Integer>, ObservableValue<Integer>>() { public ObservableValue<Integer> call(CellDataFeatures<ICFBamId32GenObj, Integer> p) { ICFBamInt32DefObj obj = p.getValue(); if (obj == null) { return (null); } else { Integer value = obj.getOptionalNullValue(); ReadOnlyObjectWrapper<Integer> observable = new ReadOnlyObjectWrapper<Integer>(); observable.setValue(value); return (observable); } } }); tableColumnNullValue.setCellFactory( new Callback<TableColumn<ICFBamId32GenObj, Integer>, TableCell<ICFBamId32GenObj, Integer>>() { @Override public TableCell<ICFBamId32GenObj, Integer> call(TableColumn<ICFBamId32GenObj, Integer> arg) { return new CFInt32TableCell<ICFBamId32GenObj>(); } }); dataTable.getColumns().add(tableColumnNullValue); tableColumnUnknownValue = new TableColumn<ICFBamId32GenObj, Integer>("Unknown Value"); tableColumnUnknownValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamId32GenObj, Integer>, ObservableValue<Integer>>() { public ObservableValue<Integer> call(CellDataFeatures<ICFBamId32GenObj, Integer> p) { ICFBamInt32DefObj obj = p.getValue(); if (obj == null) { return (null); } else { Integer value = obj.getOptionalUnknownValue(); ReadOnlyObjectWrapper<Integer> observable = new ReadOnlyObjectWrapper<Integer>(); observable.setValue(value); return (observable); } } }); tableColumnUnknownValue.setCellFactory( new Callback<TableColumn<ICFBamId32GenObj, Integer>, TableCell<ICFBamId32GenObj, Integer>>() { @Override public TableCell<ICFBamId32GenObj, Integer> call(TableColumn<ICFBamId32GenObj, Integer> arg) { return new CFInt32TableCell<ICFBamId32GenObj>(); } }); dataTable.getColumns().add(tableColumnUnknownValue); tableColumnSlice = new TableColumn<ICFBamId32GenObj, Short>("Slice"); tableColumnSlice.setCellValueFactory( new Callback<CellDataFeatures<ICFBamId32GenObj, Short>, ObservableValue<Short>>() { public ObservableValue<Short> call(CellDataFeatures<ICFBamId32GenObj, Short> p) { ICFBamId32GenObj obj = p.getValue(); if (obj == null) { return (null); } else { short value = obj.getRequiredSlice(); Short wrapped = new Short(value); ReadOnlyObjectWrapper<Short> observable = new ReadOnlyObjectWrapper<Short>(); observable.setValue(wrapped); return (observable); } } }); tableColumnSlice.setCellFactory( new Callback<TableColumn<ICFBamId32GenObj, Short>, TableCell<ICFBamId32GenObj, Short>>() { @Override public TableCell<ICFBamId32GenObj, Short> call(TableColumn<ICFBamId32GenObj, Short> arg) { return new CFInt16TableCell<ICFBamId32GenObj>(); } }); dataTable.getColumns().add(tableColumnSlice); tableColumnBlockSize = new TableColumn<ICFBamId32GenObj, Integer>("BlockSize"); tableColumnBlockSize.setCellValueFactory( new Callback<CellDataFeatures<ICFBamId32GenObj, Integer>, ObservableValue<Integer>>() { public ObservableValue<Integer> call(CellDataFeatures<ICFBamId32GenObj, Integer> p) { ICFBamId32GenObj obj = p.getValue(); if (obj == null) { return (null); } else { int value = obj.getRequiredBlockSize(); Integer wrapped = new Integer(value); ReadOnlyObjectWrapper<Integer> observable = new ReadOnlyObjectWrapper<Integer>(); observable.setValue(wrapped); return (observable); } } }); tableColumnBlockSize.setCellFactory( new Callback<TableColumn<ICFBamId32GenObj, Integer>, TableCell<ICFBamId32GenObj, Integer>>() { @Override public TableCell<ICFBamId32GenObj, Integer> call(TableColumn<ICFBamId32GenObj, Integer> arg) { return new CFInt32TableCell<ICFBamId32GenObj>(); } }); dataTable.getColumns().add(tableColumnBlockSize); tableColumnLookupDefSchema = new TableColumn<ICFBamId32GenObj, ICFBamSchemaDefObj>( "Defining Schema Definition"); tableColumnLookupDefSchema.setCellValueFactory( new Callback<CellDataFeatures<ICFBamId32GenObj, ICFBamSchemaDefObj>, ObservableValue<ICFBamSchemaDefObj>>() { public ObservableValue<ICFBamSchemaDefObj> call( CellDataFeatures<ICFBamId32GenObj, ICFBamSchemaDefObj> p) { ICFBamId32GenObj 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<ICFBamId32GenObj, ICFBamSchemaDefObj>, TableCell<ICFBamId32GenObj, ICFBamSchemaDefObj>>() { @Override public TableCell<ICFBamId32GenObj, ICFBamSchemaDefObj> call( TableColumn<ICFBamId32GenObj, ICFBamSchemaDefObj> arg) { return new CFReferenceTableCell<ICFBamId32GenObj, ICFBamSchemaDefObj>(); } }); dataTable.getColumns().add(tableColumnLookupDefSchema); tableColumnLookupDispenser = new TableColumn<ICFBamId32GenObj, ICFBamTableObj>("Dispensing Table"); tableColumnLookupDispenser.setCellValueFactory( new Callback<CellDataFeatures<ICFBamId32GenObj, ICFBamTableObj>, ObservableValue<ICFBamTableObj>>() { public ObservableValue<ICFBamTableObj> call( CellDataFeatures<ICFBamId32GenObj, ICFBamTableObj> p) { ICFBamId32GenObj obj = p.getValue(); if (obj == null) { return (null); } else { ICFBamTableObj ref = obj.getOptionalLookupDispenser(); ReadOnlyObjectWrapper<ICFBamTableObj> observable = new ReadOnlyObjectWrapper<ICFBamTableObj>(); observable.setValue(ref); return (observable); } } }); tableColumnLookupDispenser.setCellFactory( new Callback<TableColumn<ICFBamId32GenObj, ICFBamTableObj>, TableCell<ICFBamId32GenObj, ICFBamTableObj>>() { @Override public TableCell<ICFBamId32GenObj, ICFBamTableObj> call( TableColumn<ICFBamId32GenObj, ICFBamTableObj> arg) { return new CFReferenceTableCell<ICFBamId32GenObj, ICFBamTableObj>(); } }); dataTable.getColumns().add(tableColumnLookupDispenser); dataTable.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<ICFBamId32GenObj>() { @Override public void changed(ObservableValue<? extends ICFBamId32GenObj> observable, ICFBamId32GenObj oldValue, ICFBamId32GenObj 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 (observableListOfId32Gen != null) { dataTable.setItems(observableListOfId32Gen); } adjustListButtons(); }
From source file:net.sourceforge.msscodefactory.cfbam.v2_7.CFBamJavaFX.CFBamJavaFXNumberDefListPane.java
public CFBamJavaFXNumberDefListPane(ICFFormManager formManager, ICFBamJavaFXSchema argSchema, ICFBamScopeObj argContainer, ICFBamNumberDefObj argFocus, Collection<ICFBamNumberDefObj> argDataCollection, ICFRefreshCallback refreshCallback, boolean sortByChain) { super();//from w ww. jav 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<ICFBamNumberDefObj>(); tableColumnObjKind = new TableColumn<ICFBamNumberDefObj, String>("Class Code"); tableColumnObjKind.setCellValueFactory( new Callback<CellDataFeatures<ICFBamNumberDefObj, String>, ObservableValue<String>>() { @Override public ObservableValue<String> call(CellDataFeatures<ICFBamNumberDefObj, String> p) { ICFBamNumberDefObj 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<ICFBamNumberDefObj, String>, TableCell<ICFBamNumberDefObj, String>>() { @Override public TableCell<ICFBamNumberDefObj, String> call(TableColumn<ICFBamNumberDefObj, String> arg) { return new CFStringTableCell<ICFBamNumberDefObj>(); } }); dataTable.getColumns().add(tableColumnObjKind); tableColumnId = new TableColumn<ICFBamNumberDefObj, Long>("Id"); tableColumnId.setCellValueFactory( new Callback<CellDataFeatures<ICFBamNumberDefObj, Long>, ObservableValue<Long>>() { public ObservableValue<Long> call(CellDataFeatures<ICFBamNumberDefObj, 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<ICFBamNumberDefObj, Long>, TableCell<ICFBamNumberDefObj, Long>>() { @Override public TableCell<ICFBamNumberDefObj, Long> call(TableColumn<ICFBamNumberDefObj, Long> arg) { return new CFInt64TableCell<ICFBamNumberDefObj>(); } }); dataTable.getColumns().add(tableColumnId); tableColumnName = new TableColumn<ICFBamNumberDefObj, String>("Name"); tableColumnName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamNumberDefObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamNumberDefObj, 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<ICFBamNumberDefObj, String>, TableCell<ICFBamNumberDefObj, String>>() { @Override public TableCell<ICFBamNumberDefObj, String> call(TableColumn<ICFBamNumberDefObj, String> arg) { return new CFStringTableCell<ICFBamNumberDefObj>(); } }); dataTable.getColumns().add(tableColumnName); tableColumnShortName = new TableColumn<ICFBamNumberDefObj, String>("Short Name"); tableColumnShortName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamNumberDefObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamNumberDefObj, 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<ICFBamNumberDefObj, String>, TableCell<ICFBamNumberDefObj, String>>() { @Override public TableCell<ICFBamNumberDefObj, String> call(TableColumn<ICFBamNumberDefObj, String> arg) { return new CFStringTableCell<ICFBamNumberDefObj>(); } }); dataTable.getColumns().add(tableColumnShortName); tableColumnLabel = new TableColumn<ICFBamNumberDefObj, String>("Label"); tableColumnLabel.setCellValueFactory( new Callback<CellDataFeatures<ICFBamNumberDefObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamNumberDefObj, 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<ICFBamNumberDefObj, String>, TableCell<ICFBamNumberDefObj, String>>() { @Override public TableCell<ICFBamNumberDefObj, String> call(TableColumn<ICFBamNumberDefObj, String> arg) { return new CFStringTableCell<ICFBamNumberDefObj>(); } }); dataTable.getColumns().add(tableColumnLabel); tableColumnShortDescription = new TableColumn<ICFBamNumberDefObj, String>("Short Description"); tableColumnShortDescription.setCellValueFactory( new Callback<CellDataFeatures<ICFBamNumberDefObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamNumberDefObj, 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<ICFBamNumberDefObj, String>, TableCell<ICFBamNumberDefObj, String>>() { @Override public TableCell<ICFBamNumberDefObj, String> call(TableColumn<ICFBamNumberDefObj, String> arg) { return new CFStringTableCell<ICFBamNumberDefObj>(); } }); dataTable.getColumns().add(tableColumnShortDescription); tableColumnDescription = new TableColumn<ICFBamNumberDefObj, String>("Description"); tableColumnDescription.setCellValueFactory( new Callback<CellDataFeatures<ICFBamNumberDefObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamNumberDefObj, 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<ICFBamNumberDefObj, String>, TableCell<ICFBamNumberDefObj, String>>() { @Override public TableCell<ICFBamNumberDefObj, String> call(TableColumn<ICFBamNumberDefObj, String> arg) { return new CFStringTableCell<ICFBamNumberDefObj>(); } }); dataTable.getColumns().add(tableColumnDescription); tableColumnIsNullable = new TableColumn<ICFBamNumberDefObj, Boolean>("Is Nullable"); tableColumnIsNullable.setCellValueFactory( new Callback<CellDataFeatures<ICFBamNumberDefObj, Boolean>, ObservableValue<Boolean>>() { public ObservableValue<Boolean> call(CellDataFeatures<ICFBamNumberDefObj, 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<ICFBamNumberDefObj, Boolean>, TableCell<ICFBamNumberDefObj, Boolean>>() { @Override public TableCell<ICFBamNumberDefObj, Boolean> call( TableColumn<ICFBamNumberDefObj, Boolean> arg) { return new CFBoolTableCell<ICFBamNumberDefObj>(); } }); dataTable.getColumns().add(tableColumnIsNullable); tableColumnGenerateId = new TableColumn<ICFBamNumberDefObj, Boolean>("Generate Id"); tableColumnGenerateId.setCellValueFactory( new Callback<CellDataFeatures<ICFBamNumberDefObj, Boolean>, ObservableValue<Boolean>>() { public ObservableValue<Boolean> call(CellDataFeatures<ICFBamNumberDefObj, 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<ICFBamNumberDefObj, Boolean>, TableCell<ICFBamNumberDefObj, Boolean>>() { @Override public TableCell<ICFBamNumberDefObj, Boolean> call( TableColumn<ICFBamNumberDefObj, Boolean> arg) { return new CFBoolTableCell<ICFBamNumberDefObj>(); } }); dataTable.getColumns().add(tableColumnGenerateId); tableColumnDefaultVisibility = new TableColumn<ICFBamNumberDefObj, Boolean>("Default Visibility"); tableColumnDefaultVisibility.setCellValueFactory( new Callback<CellDataFeatures<ICFBamNumberDefObj, Boolean>, ObservableValue<Boolean>>() { public ObservableValue<Boolean> call(CellDataFeatures<ICFBamNumberDefObj, 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<ICFBamNumberDefObj, Boolean>, TableCell<ICFBamNumberDefObj, Boolean>>() { @Override public TableCell<ICFBamNumberDefObj, Boolean> call( TableColumn<ICFBamNumberDefObj, Boolean> arg) { return new CFBoolTableCell<ICFBamNumberDefObj>(); } }); dataTable.getColumns().add(tableColumnDefaultVisibility); tableColumnDbName = new TableColumn<ICFBamNumberDefObj, String>("Db Name"); tableColumnDbName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamNumberDefObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamNumberDefObj, String> p) { ICFBamAtomObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getOptionalDbName(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnDbName.setCellFactory( new Callback<TableColumn<ICFBamNumberDefObj, String>, TableCell<ICFBamNumberDefObj, String>>() { @Override public TableCell<ICFBamNumberDefObj, String> call(TableColumn<ICFBamNumberDefObj, String> arg) { return new CFStringTableCell<ICFBamNumberDefObj>(); } }); dataTable.getColumns().add(tableColumnDbName); tableColumnDigits = new TableColumn<ICFBamNumberDefObj, Short>("Digits"); tableColumnDigits.setCellValueFactory( new Callback<CellDataFeatures<ICFBamNumberDefObj, Short>, ObservableValue<Short>>() { public ObservableValue<Short> call(CellDataFeatures<ICFBamNumberDefObj, Short> p) { ICFBamNumberDefObj obj = p.getValue(); if (obj == null) { return (null); } else { short value = obj.getRequiredDigits(); Short wrapped = new Short(value); ReadOnlyObjectWrapper<Short> observable = new ReadOnlyObjectWrapper<Short>(); observable.setValue(wrapped); return (observable); } } }); tableColumnDigits.setCellFactory( new Callback<TableColumn<ICFBamNumberDefObj, Short>, TableCell<ICFBamNumberDefObj, Short>>() { @Override public TableCell<ICFBamNumberDefObj, Short> call(TableColumn<ICFBamNumberDefObj, Short> arg) { return new CFInt16TableCell<ICFBamNumberDefObj>(); } }); dataTable.getColumns().add(tableColumnDigits); tableColumnPrecis = new TableColumn<ICFBamNumberDefObj, Short>("Precision"); tableColumnPrecis.setCellValueFactory( new Callback<CellDataFeatures<ICFBamNumberDefObj, Short>, ObservableValue<Short>>() { public ObservableValue<Short> call(CellDataFeatures<ICFBamNumberDefObj, Short> p) { ICFBamNumberDefObj obj = p.getValue(); if (obj == null) { return (null); } else { short value = obj.getRequiredPrecis(); Short wrapped = new Short(value); ReadOnlyObjectWrapper<Short> observable = new ReadOnlyObjectWrapper<Short>(); observable.setValue(wrapped); return (observable); } } }); tableColumnPrecis.setCellFactory( new Callback<TableColumn<ICFBamNumberDefObj, Short>, TableCell<ICFBamNumberDefObj, Short>>() { @Override public TableCell<ICFBamNumberDefObj, Short> call(TableColumn<ICFBamNumberDefObj, Short> arg) { return new CFInt16TableCell<ICFBamNumberDefObj>(); } }); dataTable.getColumns().add(tableColumnPrecis); tableColumnInitValue = new TableColumn<ICFBamNumberDefObj, BigDecimal>("Init. Value"); tableColumnInitValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamNumberDefObj, BigDecimal>, ObservableValue<BigDecimal>>() { public ObservableValue<BigDecimal> call(CellDataFeatures<ICFBamNumberDefObj, BigDecimal> p) { ICFBamNumberDefObj obj = p.getValue(); if (obj == null) { return (null); } else { BigDecimal value = obj.getOptionalInitValue(); ReadOnlyObjectWrapper<BigDecimal> observable = new ReadOnlyObjectWrapper<BigDecimal>(); observable.setValue(value); return (observable); } } }); tableColumnInitValue.setCellFactory( new Callback<TableColumn<ICFBamNumberDefObj, BigDecimal>, TableCell<ICFBamNumberDefObj, BigDecimal>>() { @Override public TableCell<ICFBamNumberDefObj, BigDecimal> call( TableColumn<ICFBamNumberDefObj, BigDecimal> arg) { return new CFNumberTableCell<ICFBamNumberDefObj>(31, 5); } }); dataTable.getColumns().add(tableColumnInitValue); tableColumnDefaultValue = new TableColumn<ICFBamNumberDefObj, BigDecimal>("Default Value"); tableColumnDefaultValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamNumberDefObj, BigDecimal>, ObservableValue<BigDecimal>>() { public ObservableValue<BigDecimal> call(CellDataFeatures<ICFBamNumberDefObj, BigDecimal> p) { ICFBamNumberDefObj obj = p.getValue(); if (obj == null) { return (null); } else { BigDecimal value = obj.getOptionalDefaultValue(); ReadOnlyObjectWrapper<BigDecimal> observable = new ReadOnlyObjectWrapper<BigDecimal>(); observable.setValue(value); return (observable); } } }); tableColumnDefaultValue.setCellFactory( new Callback<TableColumn<ICFBamNumberDefObj, BigDecimal>, TableCell<ICFBamNumberDefObj, BigDecimal>>() { @Override public TableCell<ICFBamNumberDefObj, BigDecimal> call( TableColumn<ICFBamNumberDefObj, BigDecimal> arg) { return new CFNumberTableCell<ICFBamNumberDefObj>(31, 5); } }); dataTable.getColumns().add(tableColumnDefaultValue); tableColumnMinValue = new TableColumn<ICFBamNumberDefObj, BigDecimal>("Min. Value"); tableColumnMinValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamNumberDefObj, BigDecimal>, ObservableValue<BigDecimal>>() { public ObservableValue<BigDecimal> call(CellDataFeatures<ICFBamNumberDefObj, BigDecimal> p) { ICFBamNumberDefObj obj = p.getValue(); if (obj == null) { return (null); } else { BigDecimal value = obj.getOptionalMinValue(); ReadOnlyObjectWrapper<BigDecimal> observable = new ReadOnlyObjectWrapper<BigDecimal>(); observable.setValue(value); return (observable); } } }); tableColumnMinValue.setCellFactory( new Callback<TableColumn<ICFBamNumberDefObj, BigDecimal>, TableCell<ICFBamNumberDefObj, BigDecimal>>() { @Override public TableCell<ICFBamNumberDefObj, BigDecimal> call( TableColumn<ICFBamNumberDefObj, BigDecimal> arg) { return new CFNumberTableCell<ICFBamNumberDefObj>(31, 5); } }); dataTable.getColumns().add(tableColumnMinValue); tableColumnMaxValue = new TableColumn<ICFBamNumberDefObj, BigDecimal>("Max. Value"); tableColumnMaxValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamNumberDefObj, BigDecimal>, ObservableValue<BigDecimal>>() { public ObservableValue<BigDecimal> call(CellDataFeatures<ICFBamNumberDefObj, BigDecimal> p) { ICFBamNumberDefObj obj = p.getValue(); if (obj == null) { return (null); } else { BigDecimal value = obj.getOptionalMaxValue(); ReadOnlyObjectWrapper<BigDecimal> observable = new ReadOnlyObjectWrapper<BigDecimal>(); observable.setValue(value); return (observable); } } }); tableColumnMaxValue.setCellFactory( new Callback<TableColumn<ICFBamNumberDefObj, BigDecimal>, TableCell<ICFBamNumberDefObj, BigDecimal>>() { @Override public TableCell<ICFBamNumberDefObj, BigDecimal> call( TableColumn<ICFBamNumberDefObj, BigDecimal> arg) { return new CFNumberTableCell<ICFBamNumberDefObj>(31, 5); } }); dataTable.getColumns().add(tableColumnMaxValue); tableColumnNullValue = new TableColumn<ICFBamNumberDefObj, BigDecimal>("Null Value"); tableColumnNullValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamNumberDefObj, BigDecimal>, ObservableValue<BigDecimal>>() { public ObservableValue<BigDecimal> call(CellDataFeatures<ICFBamNumberDefObj, BigDecimal> p) { ICFBamNumberDefObj obj = p.getValue(); if (obj == null) { return (null); } else { BigDecimal value = obj.getOptionalNullValue(); ReadOnlyObjectWrapper<BigDecimal> observable = new ReadOnlyObjectWrapper<BigDecimal>(); observable.setValue(value); return (observable); } } }); tableColumnNullValue.setCellFactory( new Callback<TableColumn<ICFBamNumberDefObj, BigDecimal>, TableCell<ICFBamNumberDefObj, BigDecimal>>() { @Override public TableCell<ICFBamNumberDefObj, BigDecimal> call( TableColumn<ICFBamNumberDefObj, BigDecimal> arg) { return new CFNumberTableCell<ICFBamNumberDefObj>(31, 5); } }); dataTable.getColumns().add(tableColumnNullValue); tableColumnUnknownValue = new TableColumn<ICFBamNumberDefObj, BigDecimal>("Unknown Value"); tableColumnUnknownValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamNumberDefObj, BigDecimal>, ObservableValue<BigDecimal>>() { public ObservableValue<BigDecimal> call(CellDataFeatures<ICFBamNumberDefObj, BigDecimal> p) { ICFBamNumberDefObj obj = p.getValue(); if (obj == null) { return (null); } else { BigDecimal value = obj.getOptionalUnknownValue(); ReadOnlyObjectWrapper<BigDecimal> observable = new ReadOnlyObjectWrapper<BigDecimal>(); observable.setValue(value); return (observable); } } }); tableColumnUnknownValue.setCellFactory( new Callback<TableColumn<ICFBamNumberDefObj, BigDecimal>, TableCell<ICFBamNumberDefObj, BigDecimal>>() { @Override public TableCell<ICFBamNumberDefObj, BigDecimal> call( TableColumn<ICFBamNumberDefObj, BigDecimal> arg) { return new CFNumberTableCell<ICFBamNumberDefObj>(31, 5); } }); dataTable.getColumns().add(tableColumnUnknownValue); tableColumnLookupDefSchema = new TableColumn<ICFBamNumberDefObj, ICFBamSchemaDefObj>( "Defining Schema Definition"); tableColumnLookupDefSchema.setCellValueFactory( new Callback<CellDataFeatures<ICFBamNumberDefObj, ICFBamSchemaDefObj>, ObservableValue<ICFBamSchemaDefObj>>() { public ObservableValue<ICFBamSchemaDefObj> call( CellDataFeatures<ICFBamNumberDefObj, ICFBamSchemaDefObj> p) { ICFBamNumberDefObj 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<ICFBamNumberDefObj, ICFBamSchemaDefObj>, TableCell<ICFBamNumberDefObj, ICFBamSchemaDefObj>>() { @Override public TableCell<ICFBamNumberDefObj, ICFBamSchemaDefObj> call( TableColumn<ICFBamNumberDefObj, ICFBamSchemaDefObj> arg) { return new CFReferenceTableCell<ICFBamNumberDefObj, ICFBamSchemaDefObj>(); } }); dataTable.getColumns().add(tableColumnLookupDefSchema); dataTable.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<ICFBamNumberDefObj>() { @Override public void changed(ObservableValue<? extends ICFBamNumberDefObj> observable, ICFBamNumberDefObj oldValue, ICFBamNumberDefObj 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 (observableListOfNumberDef != null) { dataTable.setItems(observableListOfNumberDef); } adjustListButtons(); }
From source file:fr.amap.lidar.amapvox.gui.MainFrameController.java
private void initValidationSupport() { //voxelization fields validation voxSpaceValidationSupport = new ValidationSupport(); alsVoxValidationSupport = new ValidationSupport(); tlsVoxValidationSupport = new ValidationSupport(); voxSpaceValidationSupport.registerValidator(voxelSpacePanelVoxelizationController.getTextFieldEnterXMin(), false, Validators.fieldDoubleValidator); voxSpaceValidationSupport.registerValidator(voxelSpacePanelVoxelizationController.getTextFieldEnterYMin(), false, Validators.fieldDoubleValidator); voxSpaceValidationSupport.registerValidator(voxelSpacePanelVoxelizationController.getTextFieldEnterZMin(), false, Validators.fieldDoubleValidator); voxSpaceValidationSupport.registerValidator(voxelSpacePanelVoxelizationController.getTextFieldEnterXMax(), false, Validators.fieldDoubleValidator); voxSpaceValidationSupport.registerValidator(voxelSpacePanelVoxelizationController.getTextFieldEnterYMax(), false, Validators.fieldDoubleValidator); voxSpaceValidationSupport.registerValidator(voxelSpacePanelVoxelizationController.getTextFieldEnterZMax(), false, Validators.fieldDoubleValidator); voxSpaceValidationSupport.registerValidator(textFieldResolution, false, Validators.fieldDoubleValidator); if (checkboxUseDTMFilter.isSelected()) { voxSpaceValidationSupport.registerValidator(textfieldDTMPath, false, Validators.fileExistValidator); }/*from w w w . j av a 2s . co m*/ checkboxUseDTMFilter.selectedProperty().addListener(new ChangeListener<Boolean>() { @Override public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) { if (newValue) { voxSpaceValidationSupport.registerValidator(textfieldDTMPath, false, Validators.fileExistValidator); } else { voxSpaceValidationSupport.registerValidator(textfieldDTMPath, false, Validators.unregisterValidator); } } }); alsVoxValidationSupport.registerValidator(textFieldInputFileALS, false, Validators.fileExistValidator); alsVoxValidationSupport.registerValidator(textFieldTrajectoryFileALS, false, Validators.fileExistValidator); alsVoxValidationSupport.registerValidator(textFieldOutputFileALS, false, Validators.fileValidityValidator); tlsVoxValidationSupport.registerValidator(textFieldInputFileTLS, false, Validators.fileExistValidator); tlsVoxValidationSupport.registerValidator(textFieldOutputPathTLS, false, Validators.directoryValidator); comboboxModeTLS.getSelectionModel().selectedIndexProperty().addListener(new ChangeListener<Number>() { @Override public void changed(ObservableValue<? extends Number> observable, Number oldValue, Number newValue) { if (newValue.intValue() == 0) { tlsVoxValidationSupport.registerValidator(textFieldOutputPathTLS, false, Validators.fileValidityValidator); } else { tlsVoxValidationSupport.registerValidator(textFieldOutputPathTLS, false, Validators.directoryValidator); } } }); //transmittance light map fields validation transLightMapValidationSupport = new ValidationSupport(); transLightMapValidationSupport.registerValidator(textfieldVoxelFilePathTransmittance, true, Validators.fileExistValidator); transLightMapValidationSupport.registerValidator(textfieldOutputBitmapFilePath, true, Validators.directoryValidator); transLightMapValidationSupport.registerValidator(textfieldDirectionRotationTransmittanceMap, true, Validators.fieldDoubleValidator); checkboxGenerateBitmapFile.selectedProperty().addListener(new ChangeListener<Boolean>() { @Override public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) { if (newValue) { transLightMapValidationSupport.registerValidator(textfieldOutputBitmapFilePath, true, Validators.directoryValidator); } else { //unregister the validator transLightMapValidationSupport.registerValidator(textfieldOutputBitmapFilePath, false, Validators.unregisterValidator); } } }); checkboxGenerateTextFile.selectedProperty().addListener(new ChangeListener<Boolean>() { @Override public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) { if (newValue) { transLightMapValidationSupport.registerValidator(textfieldOutputTextFilePath, true, Validators.fileValidityValidator); } else { //unregister the validator transLightMapValidationSupport.registerValidator(textfieldOutputTextFilePath, false, Validators.unregisterValidator); } } }); ObservableList<Point3d> content = FXCollections.observableArrayList(); listViewTransmittanceMapSensorPositions.setItems(content); transLightMapValidationSupport.registerValidator(textfieldLatitudeRadians, true, Validators.fieldDoubleValidator); //transLightMapValidationSupport.registerValidator(listViewTransmittanceMapSensorPositions, true, emptyListValidator); //transLightMapValidationSupport.registerValidator(tableViewSimulationPeriods, true, emptyTableValidator); //transLightMapValidationSupport. transLightMapValidationSupport.invalidProperty().addListener(new ChangeListener<Boolean>() { @Override public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) { buttonGroupExecutionTransLightMap.setDisable(newValue); } }); //lai2200 simulations validation support lai2xxxSimValidationSupport = new ValidationSupport(); lai2xxxSimValidationSupport.registerValidator(textfieldVoxelFilePathCanopyAnalyzer, true, Validators.fileExistValidator); lai2xxxSimValidationSupport.registerValidator(textfieldOutputCanopyAnalyzerTextFile, true, Validators.fileValidityValidator); lai2xxxSimValidationSupport.invalidProperty().addListener(new ChangeListener<Boolean>() { @Override public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) { buttongroupExecutionLai2xxxSim.setDisable(newValue); } }); //hemi photo simulation hemiPhotoSimValidationSupport = new ValidationSupport(); hemiPhotoSimValidationSupport.registerValidator(textfieldPixelNumber, true, Validators.fieldIntegerValidator); hemiPhotoSimValidationSupport.registerValidator(textfieldAzimutsNumber, true, Validators.fieldIntegerValidator); hemiPhotoSimValidationSupport.registerValidator(textfieldZenithsNumber, true, Validators.fieldIntegerValidator); /*hemiPhotoSimValidationSupport.registerValidator(textfieldHemiPhotoOutputBitmapFile, true, Validators.fileValidityValidator); checkboxHemiPhotoGenerateBitmapFile.selectedProperty().addListener(new ChangeListener<Boolean>() { @Override public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) { if(newValue){ hemiPhotoSimValidationSupport.registerValidator(textfieldHemiPhotoOutputBitmapFile, true, Validators.fileValidityValidator); }else{ //unregister the validator hemiPhotoSimValidationSupport.registerValidator(textfieldHemiPhotoOutputBitmapFile, false, Validators.unregisterValidator); } } });*/ tabHemiFromScans.selectedProperty().addListener(new ChangeListener<Boolean>() { @Override public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) { if (newValue) { //unregister the validators hemiPhotoSimValidationSupport.registerValidator(textfieldVoxelFilePathHemiPhoto, false, Validators.unregisterValidator); } } }); tabHemiFromPAD.selectedProperty().addListener(new ChangeListener<Boolean>() { @Override public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) { if (newValue) { hemiPhotoSimValidationSupport.registerValidator(textfieldVoxelFilePathHemiPhoto, true, Validators.fileExistValidator); } } }); hemiPhotoSimValidationSupport.invalidProperty().addListener(new ChangeListener<Boolean>() { @Override public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) { buttonGroupExecutionHemiPhotoSim.setDisable(newValue); } }); }
From source file:ui.main.MainViewController.java
private void addConversationListener() { conversations.getSelectionModel().selectedItemProperty().addListener(new ChangeListener() { @Override/*from ww w . j a va2 s.c o m*/ public void changed(ObservableValue observable, Object oldValue, Object newValue) { if (newValue == null) { chatterName.setText(""); return; } contacts.getSelectionModel().clearSelection(); chatList.getChildren().clear(); chatterName.setText(((HostedRoom) newValue).getName()); chatterPresence.setText("Group Chat"); chatterAvatar.setImage(new Image("resources/guest.png", 100, 100, true, true)); Iterator<GroupChatManager> i = loggedMucs.iterator(); while (i.hasNext()) { GroupChatManager gcm = i.next(); if (gcm.getRoom().equals(((HostedRoom) newValue).getJid())) { currentmuc = gcm.getMuc(); //getConversationHistory(); reloadConversationMessages(gcm.getMsgList()); return; } } try { currentmuc = chatManager.joinRoom(((HostedRoom) newValue).getJid()); loggedMucs.add(new GroupChatManager(currentmuc, getConversationHistory())); } catch (NonAuthorizedException e) { TextInputDialog dialog = new TextInputDialog(); dialog.setTitle("Closed Conference Login"); dialog.setHeaderText("Password Required!"); dialog.setContentText("Password :"); Optional<String> result = dialog.showAndWait(); if (result.isPresent()) { try { currentmuc = chatManager.joinPrivateRoom(((HostedRoom) newValue).getJid(), result.get()); loggedMucs.add(new GroupChatManager(currentmuc, getConversationHistory())); } catch (NonAuthorizedException ex) { Alert alert = new Alert(Alert.AlertType.INFORMATION); alert.setTitle("Invalid Password!"); alert.setHeaderText("Conversation cannot be displayed!"); alert.setContentText( "The password for the conversation is incorrect. Please try again!"); alert.showAndWait(); return; } } } ChatsManager.setSelectedConversation(newValue.toString()); isSingleChat = false; hideExtraComButtons(); addConversationMessageListener(); } }); }
From source file:statos2_0.MainA.java
@Override public void start(Stage primaryStage) throws Exception { primaryStage.setTitle(nameseller + "[" + storename + "]"); primaryStage.show();/*ww w .ja v a 2s . c o m*/ primaryStage.setOnCloseRequest(new EventHandler<WindowEvent>() { public void handle(WindowEvent we) { updsel(m, 1); } }); GridPane grid = new GridPane(); grid.setHgap(14); grid.setVgap(14); grid.setPadding(new Insets(5, 5, 5, 5)); //System.out.println("****"+m); txg3.setVisible(false); // , 1 sp1.setValueFactory(spfd); spb1.setValueFactory(sfi); sp2.setValueFactory(sfi2); sp3.setValueFactory(sfi3); p1.setId("firstlab"); p2.setId("firstlab"); p3.setId("firstlab"); kasnbn.setId("secondlab"); kasvnbn.setId("secondlab"); sumnbn.setId("secondlab"); vyr.setId("vyr"); sumvnbn.setId("secondlab"); JSONParser jP5 = new JSONParser(); JSONObject jsons5 = new JSONObject(); List<NameValuePair> para5 = new ArrayList<NameValuePair>(); para5.add(new BasicNameValuePair("idm", String.valueOf(m))); jsons5 = jP5.makeHttpRequest(url_cashgetm, "POST", para5); int success = jsons5.getInt("success"); if (!jsons5.isNull("success")) { //res=true; // System.out.println("TRUE"); double all = jsons5.getDouble("all"); double dayall = Double.parseDouble(jsons5.get("dayall").toString()); double daybn = Double.parseDouble(jsons5.get("daybn").toString()); days = dayall + daybn; if (days <= 7999 & days > 0) { smvyr += (days / 100) * 3; } else if (days > 7999) { smvyr += (days / 100) * 4; } vyr.setText(":" + smvyr); sumnbn.setText(all + " ."); sumvnbn.setText(dayall + " / " + daybn); } litg.setText(":"); {// sp1.setVisible(false); spb1.setVisible(false); lb1.setVisible(false); t1.setVisible(false); bt1.setVisible(false); lbb1.setVisible(false); cbx4.setVisible(false); } {// , sp2.setVisible(false); lb2.setVisible(false); t2.setVisible(false); bt2.setVisible(false); } {// sp3.setVisible(false); lb3.setVisible(false); t3.setVisible(false); bt3.setVisible(false); } res.editableProperty().setValue(Boolean.FALSE); t1.editableProperty().setValue(Boolean.FALSE); t2.editableProperty().setValue(Boolean.FALSE); t3.editableProperty().setValue(Boolean.FALSE); titg.editableProperty().setValue(Boolean.FALSE); //cbx1.setItems(GetByTag(TAG_NAME, "1")); //cbx2.setItems(GetByTag(TAG_NAME, "2")); //cbx3.setItems(GetByTag(TAG_NAME, "3")); //cbx4.setItems(GetByTag(TAG_NAME, "4")); //cbx1.valueProperty().addListener(new ); cbx1.setId("comboprod"); cbx2.setId("comboprod"); cbx3.setId("comboprod"); txg3.setPrefSize(70, 80); sp1.setPrefSize(75, 80); sp2.setPrefSize(75, 80); sp3.setPrefSize(75, 80); spb1.setPrefSize(75, 80); lb1.setId("labl"); lb2.setId("labl"); lb3.setId("labl"); lbb1.setId("labl"); t1.setId("textost"); t2.setId("textost"); t3.setId("textost"); bt1.setId("btitg"); bt2.setId("btitg"); bt3.setId("btitg"); cbx4.setId("combbot"); //lb1.setPrefSize(25, 40); //lb2.setPrefSize(25, 40); //lb3.setPrefSize(25, 40); //t1.setPrefSize(150, 40); //t2.setPrefSize(150, 40); //t3.setPrefSize(150, 40); //cbx4.setPrefSize(160,40); //bt2.setPrefSize(40, 40); //bt3.setPrefSize(40, 40); //spb1.setPrefSize(80, 40); //lbb1.setPrefSize(40,40); //bt1.setPrefSize(40, 40); titg.setPrefSize(120, 80); litg.setId("itgl"); res.setPrefSize(300, 300); lb1.setText(""); lb2.setText(""); lb3.setText(""); bt1.setText("+"); bt2.setText("+"); bt3.setText("+"); lbb1.setText(""); bres.setText(""); bitg.setText(""); bdlg.setText(""); bbn.setText("/"); //sp1.setValueFactory(); grid.add(p1, 0, 0); grid.add(p2, 0, 1); grid.add(p3, 0, 2); grid.add(cbx1, 1, 0); grid.add(cbx2, 1, 1); grid.add(cbx3, 1, 2); grid.add(sp1, 2, 0); grid.add(sp2, 2, 1); grid.add(sp3, 2, 2); grid.add(txg3, 2, 2); grid.add(lb1, 3, 0); grid.add(lb2, 3, 1); grid.add(lb3, 3, 2); grid.add(t1, 4, 0); grid.add(t2, 4, 1); grid.add(t3, 4, 2); grid.add(cbx4, 5, 0); grid.add(bt2, 5, 1); grid.add(bt3, 5, 2); grid.add(spb1, 6, 0); grid.add(lbb1, 7, 0); grid.add(bt1, 8, 0); //grid.add(res, 1, 4, 3, 3); grid.add(res, 0, 3, 2, 3); litg.setAlignment(Pos.BASELINE_RIGHT); grid.add(litg, 2, 3); grid.add(titg, 3, 3, 2, 1); grid.add(bitg, 2, 4); grid.add(btcl, 4, 4); grid.add(kasnbn, 10, 0); grid.add(sumnbn, 10, 1); grid.add(kasvnbn, 10, 2); grid.add(sumvnbn, 10, 3); grid.add(vyr, 10, 4); grid.add(close, 10, 8); close.setOnAction(event -> { /** Dialog<Void> dialog = new Dialog<>(); dialog.initModality(Modality.WINDOW_MODAL); dialog.initOwner(primaryStage);//stage here is the stage of your webview //dialog.initStyle(StageStyle.TRANSPARENT); Label loader = new Label("LOADING"); //loader.setContentDisplay(ContentDisplay.DOWN); loader.setGraphic(new ProgressIndicator()); dialog.getDialogPane().setGraphic(loader); DropShadow ds = new DropShadow(); ds.setOffsetX(1.3); ds.setOffsetY(1.3); ds.setColor(Color.DARKGRAY); dialog.getDialogPane().setEffect(ds); //ButtonType btn = new ButtonType("OK",ButtonData.CANCEL_CLOSE); //dialog.getDialogPane().getButtonTypes().add(btn); dialog.show(); runJsons(); dialog.hide(); dialog.close(); **/ Alert alert = new Alert(AlertType.CONFIRMATION); alert.setTitle(""); alert.setHeaderText(" "); alert.setContentText(" ?"); ButtonType buttonTypeOne = new ButtonType(""); ButtonType buttonTypeCancel = new ButtonType("", ButtonData.CANCEL_CLOSE); alert.getButtonTypes().setAll(buttonTypeOne, buttonTypeCancel); Optional<ButtonType> result2 = alert.showAndWait(); if (result2.get() == buttonTypeOne) { updsel(m, 1); cashday(m); System.exit(0); } }); btcl.setOnAction(event -> { jsares.clear(); res.setText(""); titg.setText(""); itog = 0; chcount = 1; cbx1.getSelectionModel().clearSelection(); cbx2.getSelectionModel().clearSelection(); cbx3.getSelectionModel().clearSelection(); cbx4.getSelectionModel().clearSelection(); cbx4.setVisible(false); sp1.getValueFactory().setValue(0.0); sp2.getValueFactory().setValue(0); sp3.getValueFactory().setValue(0); spb1.getValueFactory().setValue(0); sp1.setVisible(false); sp2.setVisible(false); sp3.setVisible(false); spb1.setVisible(false); lb1.setVisible(false); lb2.setVisible(false); lb3.setVisible(false); lbb1.setVisible(false); t1.setVisible(false); t2.setVisible(false); t3.setVisible(false); bt1.setVisible(false); bt2.setVisible(false); bt3.setVisible(false); }); bitg.setOnAction(event -> { Alert alert = new Alert(AlertType.CONFIRMATION); alert.setTitle(""); alert.setHeaderText(" "); alert.setContentText(" ?"); ButtonType buttonOK = new ButtonType(""); ButtonType buttonCancel = new ButtonType("", ButtonData.CANCEL_CLOSE); alert.getButtonTypes().setAll(buttonOK, buttonCancel); Optional<ButtonType> result = alert.showAndWait(); if (result.get() == buttonOK) { alert = new Alert(AlertType.CONFIRMATION); alert.setTitle(""); alert.setHeaderText(" "); alert.setContentText(" "); ButtonType buttonTypeOne = new ButtonType(""); ButtonType buttonTypeTwo = new ButtonType(""); //ButtonType buttonTypeThree = new ButtonType("Three"); ButtonType buttonTypeCancel = new ButtonType("", ButtonData.CANCEL_CLOSE); alert.getButtonTypes().setAll(buttonTypeOne, buttonTypeTwo, /*buttonTypeThree,*/ buttonTypeCancel); Optional<ButtonType> result2 = alert.showAndWait(); if (result2.get() == buttonTypeOne) { // ... user chose "One" typepay = ""; finishnal(titg.getText(), res.getText(), 1); } else if (result2.get() == buttonTypeTwo) { // ... user chose "Two" typepay = ""; finishnal(titg.getText(), res.getText(), 2); } /* else if (result2.get() == buttonTypeThree) { // ... user chose "Three" }*/ else { // ... user chose CANCEL or closed the dialog } } else { // ... user chose CANCEL or closed the dialog } }); txg3.setOnMouseClicked(event -> { Dialog dialog = new Dialog(); GridPane gr = new GridPane(); gr.setHgap(3); gr.setVgap(5); gr.setPadding(new Insets(10, 10, 10, 10)); Button b1 = new Button("1"); b1.setPrefSize(50, 50); Button b2 = new Button("2"); b2.setPrefSize(50, 50); Button b3 = new Button("3"); b3.setPrefSize(50, 50); Button b4 = new Button("4"); b4.setPrefSize(50, 50); Button b5 = new Button("5"); b5.setPrefSize(50, 50); Button b6 = new Button("6"); b6.setPrefSize(50, 50); Button b7 = new Button("7"); b7.setPrefSize(50, 50); Button b8 = new Button("8"); b8.setPrefSize(50, 50); Button b9 = new Button("9"); b9.setPrefSize(50, 50); Button b0 = new Button("0"); b0.setPrefSize(50, 50); Button bd = new Button("."); bd.setPrefSize(50, 50); Button bc = new Button("C"); bc.setPrefSize(50, 50); Button bok = new Button(""); bc.setPrefSize(50, 50); Button bno = new Button(""); bc.setPrefSize(50, 50); gr.add(b1, 0, 0); gr.add(b2, 1, 0); gr.add(b3, 2, 0); gr.add(b4, 0, 1); gr.add(b5, 1, 1); gr.add(b6, 2, 1); gr.add(b7, 0, 2); gr.add(b8, 1, 2); gr.add(b9, 2, 2); gr.add(bd, 0, 3); gr.add(b0, 1, 3); gr.add(bc, 2, 3); //gr.add(bok, 0, 4); //gr.add(bno, 3, 4); b1.setOnAction(even -> { txg3.setText(txg3.getText() + "1"); }); b2.setOnAction(even -> { txg3.setText(txg3.getText() + "2"); }); b3.setOnAction(even -> { txg3.setText(txg3.getText() + "3"); }); b4.setOnAction(even -> { txg3.setText(txg3.getText() + "4"); }); b5.setOnAction(even -> { txg3.setText(txg3.getText() + "5"); }); b6.setOnAction(even -> { txg3.setText(txg3.getText() + "6"); }); b7.setOnAction(even -> { txg3.setText(txg3.getText() + "7"); }); b8.setOnAction(even -> { txg3.setText(txg3.getText() + "8"); }); b9.setOnAction(even -> { txg3.setText(txg3.getText() + "9"); }); bc.setOnAction(even -> { txg3.setText(""); }); bd.setOnAction(even -> { txg3.setText(txg3.getText() + "."); }); b0.setOnAction(even -> { txg3.setText(txg3.getText() + "0"); }); ButtonType okk = new ButtonType("OK", ButtonData.OK_DONE); ButtonType no = new ButtonType("", ButtonData.CANCEL_CLOSE); //gr.add(okk, 0, 4); dialog.getDialogPane().setContent(gr); dialog.getDialogPane().getButtonTypes().addAll(no, okk); dialog.setX(350); dialog.setY(260); Optional res = dialog.showAndWait(); runJsons(); // dialog.setResult(ButtonData.CANCEL_CLOSE); //dialog.showAndWait(); }); txg3.lengthProperty().addListener(new ChangeListener<Number>() { @Override public void changed(ObservableValue<? extends Number> observable, Number oldValue, Number newValue) { if (newValue.intValue() > oldValue.intValue()) { char ch = txg3.getText().charAt(oldValue.intValue()); // Check if the new character is the number or other's if ((!(ch >= '0' && ch <= '9'))) { // if it's not number then just setText to previous one if (ch == '.') { } else { txg3.setText(txg3.getText().substring(0, txg3.getText().length() - 1)); } } double res; if (cbx3.getSelectionModel().getSelectedIndex() >= 0) { res = Double.parseDouble(txg3.getText()); res = res / 1000; //System.out.println("RES-"+res+"balanc"+balancech(cbx3.getSelectionModel().getSelectedItem().toString())+"BASE"+Double.parseDouble(getTwotag(cbx3.getSelectionModel().getSelectedItem().toString(),MT))); if ((res + balancech(cbx3.getSelectionModel().getSelectedItem().toString(), 3)) > Double .parseDouble( getTwotag(cbx3.getSelectionModel().getSelectedItem().toString(), 3, MT))) { txg3.setText(""); Alert alert = new Alert(Alert.AlertType.ERROR); alert.setTitle("!"); alert.setHeaderText("!"); alert.setContentText(" \n !"); alert.showAndWait(); } } } } }); cbx1.setOnMouseClicked(new EventHandler() { @Override public void handle(Event event) { spb1.getValueFactory().setValue(0); sp1.getValueFactory().setValue(0.0); runJsons(); cbx1.setItems(GetByTag(TAG_NAME, "1")); //cbx1.getSelectionModel().clearSelection(); int[] remove = new int[cbx1.getItems().size()]; for (int i = 0; i < cbx1.getItems().size(); i++) { //System.out.println("****"+m); if (!isHave(cbx1.getItems().get(i).toString(), 1)) { // } else { } } cbx1.show(); } }); sp1.setOnMouseClicked(event -> { if (cbx1.getSelectionModel().getSelectedItem() != null) { double spres = Double.parseDouble(sp1.getEditor().getText().toString().replace(",", ".")); double salesres = balancech(cbx1.getSelectionModel().getSelectedItem().toString(), 1); double balancestore = Double .parseDouble(getTwotag(cbx1.getSelectionModel().getSelectedItem().toString(), 1, MT)); // System.out.println(balancestore+" "+spres+" "+salesres); if ((balancestore - (spres + salesres)) >= 0) { } else { Alert alert = new Alert(Alert.AlertType.ERROR); alert.setTitle("!"); alert.setHeaderText("!"); alert.setContentText(" \n !"); alert.showAndWait(); sp1.getValueFactory().setValue(0.0); } } }); sp2.setOnMouseClicked(event -> { if (cbx2.getSelectionModel().getSelectedIndex() >= 0) { double spres = Double.parseDouble(sp2.getEditor().getText().toString()); double salesres = balancech(cbx2.getSelectionModel().getSelectedItem().toString(), 2); double balancestore = Double .parseDouble(getTwotag(cbx2.getSelectionModel().getSelectedItem().toString(), 2, MT)); if ((balancestore - (spres + salesres)) >= 0) { } else { Alert alert = new Alert(Alert.AlertType.ERROR); alert.setTitle("!"); alert.setHeaderText("!"); alert.setContentText(" \n !"); alert.showAndWait(); sp2.getValueFactory().setValue(0); } } }); spb1.setOnMouseClicked(event -> { if (cbx4.getSelectionModel().getSelectedIndex() >= 0) { double spres = Double.parseDouble(spb1.getEditor().getText().toString()); double salesres = balancech(cbx4.getSelectionModel().getSelectedItem().toString(), 4); double balancestore = Double .parseDouble(getTwotag(cbx4.getSelectionModel().getSelectedItem().toString(), 4, MT)); if ((balancestore - (spres + salesres)) >= 0) { } else { Alert alert = new Alert(Alert.AlertType.ERROR); alert.setTitle("!"); alert.setHeaderText("!"); alert.setContentText(" \n !"); alert.showAndWait(); spb1.getValueFactory().setValue(0); } } }); sp3.setOnMouseClicked(event -> { if (cbx3.getSelectionModel().getSelectedIndex() >= 0) { double spres = Double.parseDouble(sp3.getEditor().getText().toString()); double salesres = balancech(cbx3.getSelectionModel().getSelectedItem().toString(), 3); double balancestore = Double .parseDouble(getTwotag(cbx3.getSelectionModel().getSelectedItem().toString(), 3, MT)); if ((balancestore - (spres + salesres)) >= 0) { } else { Alert alert = new Alert(Alert.AlertType.ERROR); alert.setTitle("!"); alert.setHeaderText("!"); alert.setContentText(" \n !"); alert.showAndWait(); sp3.getValueFactory().setValue(0); } } }); cbx4.getSelectionModel().selectedItemProperty().addListener(new ChangeListener() { @Override public void changed(ObservableValue observable, Object oldValue, Object newValue) { if (observable.getValue() == null) { } else { if (!isHave(cbx4.getSelectionModel().getSelectedItem().toString(), 4)) { Alert alert = new Alert(Alert.AlertType.ERROR); alert.setTitle("!"); alert.setHeaderText("!"); alert.setContentText( cbx4.getSelectionModel().getSelectedItem().toString() + " !"); Optional<ButtonType> result = alert.showAndWait(); if (result.get() == ButtonType.OK) { cbx4.getSelectionModel().clearSelection(); } else { cbx4.getSelectionModel().clearSelection(); } } else { } } } }); cbx1.getSelectionModel().selectedItemProperty().addListener(new ChangeListener() { @Override public void changed(ObservableValue observable, Object oldValue, Object newValue) { if (observable.getValue() == null) { } else { if (!isHave(cbx1.getSelectionModel().getSelectedItem().toString(), 1)) { Alert alert = new Alert(Alert.AlertType.ERROR); alert.setTitle("!"); alert.setHeaderText("!"); alert.setContentText( cbx1.getSelectionModel().getSelectedItem().toString() + " !"); Optional<ButtonType> result = alert.showAndWait(); if (result.get() == ButtonType.OK) { sp1.setVisible(false); sp1.getValueFactory().setValue(0.0); lb1.setVisible(false); t1.setVisible(false); cbx4.setVisible(false); spb1.setVisible(false); spb1.getValueFactory().setValue(0); lbb1.setVisible(false); bt1.setVisible(false); cbx1.getSelectionModel().clearSelection(); } else { sp1.setVisible(false); sp1.getValueFactory().setValue(0.0); lb1.setVisible(false); t1.setVisible(false); cbx4.setVisible(false); spb1.setVisible(false); spb1.getValueFactory().setValue(0); lbb1.setVisible(false); bt1.setVisible(false); cbx1.getSelectionModel().clearSelection(); } } else { sp2.setVisible(false); lb2.setVisible(false); t2.setVisible(false); bt2.setVisible(false); sp2.getValueFactory().setValue(0); cbx2.getSelectionModel().clearSelection(); txg3.setVisible(false); sp3.setVisible(false); lb3.setVisible(false); t3.setVisible(false); bt3.setVisible(false); sp3.getValueFactory().setValue(0); cbx3.getSelectionModel().clearSelection(); double curbal = Double.parseDouble( getTwotag(cbx1.getSelectionModel().getSelectedItem().toString(), 1, MT)) - balancech(cbx1.getSelectionModel().getSelectedItem().toString(), 1); t1.setText(ost + " " + curbal + " ."); cbx4.setItems(GetByTag(TAG_NAME, "4")); sp1.setVisible(true); lb1.setVisible(true); t1.setVisible(true); cbx4.setVisible(true); spb1.setVisible(true); lbb1.setVisible(true); bt1.setVisible(true); if (cbx1.getSelectionModel().getSelectedItem().toString().matches("")) { sp1.setVisible(false); t1.setVisible(false); lb1.setVisible(false); } } } } }); bt1.setOnAction(event -> { if (cbx1.getSelectionModel().getSelectedItem().toString().matches("")) { if (spb1.getValueFactory().getValue() < 1) { Alert alert = new Alert(Alert.AlertType.ERROR); alert.setTitle("!"); alert.setHeaderText("!"); alert.setContentText(" !"); alert.showAndWait(); } else { double bottlprice = Double.parseDouble( getTwotag(cbx4.getSelectionModel().getSelectedItem().toString(), 4, "price")); int bottlc = spb1.getValueFactory().getValue(); double bottleitg = bottlc * bottlprice; res.setText(res.getText() + printCh2(cbx4.getSelectionModel().getSelectedItem().toString(), "", bottlc, bottlprice) + "\n"); itog = itog + bottleitg; titg.setText(String.valueOf(itog)); jsores = new JSONObject(); jsores.put(TIP, getTwotag(cbx4.getSelectionModel().getSelectedItem().toString(), 4, "id")); jsores.put(TCOUNT, bottlc); jsores.put(TRES, bottleitg); jsores.put(TM, m); jsores.put(TSELLER, selid);// ID SimpleDateFormat fff = new SimpleDateFormat("dd.MM.yyyy HH.mm"); jsores.put(TDATE, fff.format(System.currentTimeMillis())); jsores.put(TAG_CHECK, checkcheck()); jsares.add(jsores); sp1.setVisible(!true); lb1.setVisible(!true); t1.setVisible(!true); cbx4.setVisible(!true); spb1.setVisible(!true); lbb1.setVisible(!true); bt1.setVisible(!true); spb1.getValueFactory().setValue(0); sp1.getValueFactory().setValue(0.0); cbx1.getSelectionModel().clearSelection(); cbx4.getSelectionModel().clearSelection(); } } else { if (sp1.getValueFactory().getValue() < 0.5) { Alert alert = new Alert(Alert.AlertType.ERROR); alert.setTitle("!"); alert.setHeaderText("!"); alert.setContentText(" !"); alert.showAndWait(); } else if (cbx4.getSelectionModel().getSelectedItem() == null) { Alert alert = new Alert(Alert.AlertType.ERROR); alert.setTitle("!"); alert.setHeaderText("!"); alert.setContentText(" !"); alert.showAndWait(); } else if (spb1.getValueFactory().getValue() < 1) { Alert alert = new Alert(Alert.AlertType.ERROR); alert.setTitle("!"); alert.setHeaderText("!"); alert.setContentText(" !"); alert.showAndWait(); } /*else if(cbx4.getSelectionModel().getSelectedItem().toString().matches("")){ Alert alert = new Alert(Alert.AlertType.ERROR); alert.setTitle("!"); alert.setHeaderText("!"); alert.setContentText(" !"); alert.showAndWait(); }*/else { double liters = sp1.getValueFactory().getValue(); double bottlc = spb1.getValueFactory().getValue(); String sb = cbx4.getSelectionModel().getSelectedItem().toString(); double bottlsz = 0; if (sb.contains("0.5") | sb.contains("0,5")) { bottlsz = 0.5; } else if (sb.contains("1.0") | sb.contains("1,0")) { bottlsz = 1.0; } else if (sb.contains("1.5") | sb.contains("1,5")) { bottlsz = 1.5; } else if (sb.contains("2,0") | sb.contains("2.0") | sb.contains("2")) { bottlsz = 2.0; } else if (sb.contains("3,0") | sb.contains("3.0") | sb.contains("3")) { bottlsz = 3.0; } else if (sb.contains("")) { bottlsz = 0.5; } if ((bottlsz * bottlc) == liters) { double price = Double.parseDouble( getTwotag(cbx1.getSelectionModel().getSelectedItem().toString(), 1, TAG_PRICE)); String prodn = cbx1.getSelectionModel().getSelectedItem().toString(); double itg = 0; if (getTwotag(prodn, 1, "sales").matches("1")) { if (liters % 3 == 0) { price = ((liters * price) - ((liters / 3) * price)) / liters; itg = liters * price; } else { itg = liters * price; } } else { itg = liters * price; } double bottlprice = 0; if (sp1.isVisible() & !cbx4.getSelectionModel().getSelectedItem().toString().contains("")) { bottlprice = Double.parseDouble( getTwotag(cbx4.getSelectionModel().getSelectedItem().toString(), 4, "price")); } else if (sp1.isVisible() & cbx4.getSelectionModel().getSelectedItem().toString().contains("")) { bottlprice = 0; } else if (!sp1.isVisible() & cbx4.getSelectionModel().getSelectedItem().toString().contains("")) { bottlprice = 0; } res.setText(res.getText() + printCh2(cbx1.getSelectionModel().getSelectedItem().toString(), "", liters, price) + "\n"); res.setText(res.getText() + printCh2(cbx4.getSelectionModel().getSelectedItem().toString(), "", bottlc, bottlprice) + "\n"); itog += itg; jsores = new JSONObject(); jsores.put(TIP, getTwotag(cbx1.getSelectionModel().getSelectedItem().toString(), 1, "id")); jsores.put(TCOUNT, String.valueOf(liters)); jsores.put(TRES, itg); jsores.put(TM, m); jsores.put(TSELLER, selid);// ID //jsores.put("balance", (balance1.get(cbx1.getSelectionModel().getSelectedIndex()) - coun)); SimpleDateFormat ff = new SimpleDateFormat("dd.MM.yyyy HH.mm"); jsores.put(TDATE, ff.format(System.currentTimeMillis())); //jsores.put("seltype","1"); //jsores.put("dolgid","1"); jsores.put(TAG_CHECK, checkcheck()); jsares.add(jsores); double bottleitg = bottlprice * bottlc; itog = itog + bottleitg; titg.setText(String.valueOf(itog)); jsores = new JSONObject(); jsores.put(TIP, getTwotag(cbx4.getSelectionModel().getSelectedItem().toString(), 4, "id")); jsores.put(TCOUNT, bottlc); jsores.put(TRES, bottleitg); jsores.put(TM, m); jsores.put(TSELLER, selid);// ID //jsores.put("balance", (balanceb.get(cbx4.getSelectionModel().getSelectedIndex()) - counb)); SimpleDateFormat fff = new SimpleDateFormat("dd.MM.yyyy HH.mm"); jsores.put(TDATE, fff.format(System.currentTimeMillis())); //jsores.put("seltype",1); ! //jsores.put("dolgid",1); jsores.put(TAG_CHECK, checkcheck()); jsares.add(jsores); //System.out.println(jsares); sp1.setVisible(!true); lb1.setVisible(!true); t1.setVisible(!true); cbx4.setVisible(!true); spb1.setVisible(!true); lbb1.setVisible(!true); bt1.setVisible(!true); spb1.getValueFactory().setValue(0); sp1.getValueFactory().setValue(0.0); cbx1.getSelectionModel().clearSelection(); cbx4.getSelectionModel().clearSelection(); } else { Alert alert = new Alert(Alert.AlertType.ERROR); alert.setTitle("!"); alert.setHeaderText("!"); alert.setContentText(" !"); alert.showAndWait(); } } } }); cbx2.setOnMouseClicked(new EventHandler() { @Override public void handle(Event event) { runJsons(); cbx2.setItems(GetByTag(TAG_NAME, "2")); cbx2.show(); } }); cbx2.getSelectionModel().selectedItemProperty().addListener(new ChangeListener() { @Override public void changed(ObservableValue observable, Object oldValue, Object newValue) { if (observable.getValue() == null) { } else { if (!isHave(cbx2.getSelectionModel().getSelectedItem().toString(), 2)) { Alert alert = new Alert(Alert.AlertType.ERROR); alert.setTitle("!"); alert.setHeaderText("!"); alert.setContentText( cbx2.getSelectionModel().getSelectedItem().toString() + " !"); Optional<ButtonType> result = alert.showAndWait(); if (result.get() == ButtonType.OK) { sp2.setVisible(false); sp2.getValueFactory().setValue(0); lb2.setVisible(false); t2.setVisible(false); bt2.setVisible(false); cbx2.getSelectionModel().clearSelection(); } else { sp2.setVisible(false); sp2.getValueFactory().setValue(0); lb2.setVisible(false); t2.setVisible(false); bt2.setVisible(false); cbx2.getSelectionModel().clearSelection(); } } else { txg3.setVisible(false); sp3.setVisible(!true); lb3.setVisible(!true); t3.setVisible(!true); bt3.setVisible(!true); sp3.getValueFactory().setValue(0); cbx3.getSelectionModel().clearSelection(); cbx4.setVisible(!true); sp1.setVisible(!true); lb1.setVisible(!true); t1.setVisible(!true); spb1.setVisible(!true); lbb1.setVisible(!true); bt1.setVisible(!true); sp1.getValueFactory().setValue(0.0); spb1.getValueFactory().setValue(0); cbx1.getSelectionModel().clearSelection(); sp2.setVisible(true); lb2.setVisible(true); t2.setVisible(true); bt2.setVisible(true); sp2.getValueFactory().setValue(0); //System.out.println("////////"+newValue+"/////"); double curbal = Double.parseDouble( getTwotag(cbx2.getSelectionModel().getSelectedItem().toString(), 2, MT)) - balancech(cbx2.getSelectionModel().getSelectedItem().toString(), 2); t2.setText(ost + " " + curbal + " ."); } } } }); bt2.setOnAction(event -> { if (sp2.getValueFactory().getValue() < 1) { Alert alert = new Alert(Alert.AlertType.ERROR); alert.setTitle("!"); alert.setHeaderText("!"); alert.setContentText(" !"); alert.showAndWait(); } else { int coun = Integer.parseInt(sp2.getEditor().getText()); double price = Double.parseDouble( getTwotag(cbx2.getSelectionModel().getSelectedItem().toString(), 2, TAG_PRICE)); double itg = coun * price; res.setText(res.getText() + printCh2(cbx2.getSelectionModel().getSelectedItem().toString(), "", coun, price) + "\n"); itog = itog + itg; titg.setText(String.valueOf(itog)); jsores = new JSONObject(); jsores.put(TIP, getTwotag(cbx2.getSelectionModel().getSelectedItem().toString(), 2, TAG_ID)); jsores.put(TCOUNT, String.valueOf(coun)); jsores.put(TRES, itg); jsores.put(TM, m); jsores.put(TSELLER, selid);// ID //jsores.put("balance", (balance2.get(cbx2.getSelectionModel().getSelectedIndex()) - coun)); SimpleDateFormat ff = new SimpleDateFormat("dd.MM.yyyy HH.mm"); jsores.put(TDATE, ff.format(System.currentTimeMillis())); //jsores.put("seltype","1"); !!!!!! //jsores.put("dolgid","1"); jsores.put(TAG_CHECK, checkcheck()); jsares.add(jsores); sp2.setVisible(!true); lb2.setVisible(!true); t2.setVisible(!true); bt2.setVisible(!true); sp2.getValueFactory().setValue(0); cbx2.getSelectionModel().clearSelection(); } }); cbx3.setOnMouseClicked(new EventHandler() { @Override public void handle(Event event) { sp3.getValueFactory().setValue(0); runJsons(); cbx3.setItems(GetByTag(TAG_NAME, "3")); cbx3.show(); } }); cbx3.getSelectionModel().selectedItemProperty().addListener(new ChangeListener() { @Override public void changed(ObservableValue observable, Object oldValue, Object newValue) { if (observable.getValue() == null) { } else { if (!isHave(cbx3.getSelectionModel().getSelectedItem().toString(), 3)) { Alert alert = new Alert(Alert.AlertType.ERROR); alert.setTitle("!"); alert.setHeaderText("!"); alert.setContentText( cbx3.getSelectionModel().getSelectedItem().toString() + " !"); Optional<ButtonType> result = alert.showAndWait(); if (result.get() == ButtonType.OK) { sp3.setVisible(false); sp3.getValueFactory().setValue(0); lb3.setVisible(false); t3.setVisible(false); bt3.setVisible(false); cbx3.getSelectionModel().clearSelection(); } else { sp3.setVisible(false); sp3.getValueFactory().setValue(0); lb3.setVisible(false); t3.setVisible(false); bt3.setVisible(false); cbx3.getSelectionModel().clearSelection(); } } else { sp1.setVisible(!true); lb1.setVisible(!true); t1.setVisible(!true); cbx4.setVisible(!true); spb1.setVisible(!true); lbb1.setVisible(!true); bt1.setVisible(!true); //spb1.getEditor().setText("0"); //sp1.getEditor().setText("0"); cbx1.getSelectionModel().clearSelection(); sp2.setVisible(!true); lb2.setVisible(!true); t2.setVisible(!true); bt2.setVisible(!true); sp2.getValueFactory().setValue(0); cbx2.getSelectionModel().clearSelection(); sp3.setVisible(true); lb3.setVisible(true); t3.setVisible(true); bt3.setVisible(true); sp3.getValueFactory().setValue(0); if (getTwotag(cbx3.getSelectionModel().getSelectedItem().toString(), 3, TAG_ZT) .equals("2")) { double curbal = Double.parseDouble( getTwotag(cbx3.getSelectionModel().getSelectedItem().toString(), 3, MT)) - (balancech(cbx3.getSelectionModel().getSelectedItem().toString(), 3)); String pattern = "##0.00"; DecimalFormat decimalFormat = new DecimalFormat(pattern); String format = decimalFormat.format(curbal); t3.setText(ost + " " + format + " ."); lb3.setText(""); sp3.setVisible(false); txg3.setVisible(true); txg3.setText(""); } else { double curbal = Double.parseDouble( getTwotag(cbx3.getSelectionModel().getSelectedItem().toString(), 3, MT)) - balancech(cbx3.getSelectionModel().getSelectedItem().toString(), 3); t3.setText(ost + " " + curbal + " ."); lb3.setText(""); txg3.setVisible(false); sp3.setVisible(true); } } } } }); bt3.setOnAction(event -> { int typez = Integer.parseInt(getTwotag(cbx3.getSelectionModel().getSelectedItem().toString(), 3, "zt")); if (sp3.isVisible() & sp3.getValueFactory().getValue() < 1) { Alert alert = new Alert(Alert.AlertType.ERROR); alert.setTitle("!"); alert.setHeaderText("!"); alert.setContentText(" !"); alert.showAndWait(); } else if (txg3.isVisible() & txg3.getText().equals("")) { Alert alert = new Alert(Alert.AlertType.ERROR); alert.setTitle("!"); alert.setHeaderText("!!"); alert.setContentText(" !"); alert.showAndWait(); } else { double coun = 0; double price = Double.parseDouble( getTwotag(cbx3.getSelectionModel().getSelectedItem().toString(), 3, TAG_PRICE)); double itg = 0; double itgcoun = 0; if (lb3.getText().equals("")) { //System.out.println(lb3.getText()); coun = sp3.getValueFactory().getValue(); itg = coun * price; itgcoun = coun; // System.out.println("SPINNER" + coun); res.setText(res.getText() + printCh2(cbx3.getSelectionModel().getSelectedItem().toString(), "", coun, price) + "\n"); } else if (lb3.getText().equals("")) { // System.out.println(lb3.getText()); coun = Double.parseDouble(txg3.getText()); itg = ((price * coun) / 100); // System.out.println("!!!???!!!"+coun+" "+price); res.setText(res.getText() + printCh3(cbx3.getSelectionModel().getSelectedItem().toString(), "", coun, price) + "\n"); itgcoun = (double) coun / 1000; //System.out.println("TEXT" + coun+" "+itgcoun); } String pattern = "##0.0"; DecimalFormat decimalFormat = new DecimalFormat(pattern); String format = decimalFormat.format(itg); itog = itog + itg; titg.setText(String.valueOf(itog)); jsores = new JSONObject(); jsores.put(TIP, getTwotag(cbx3.getSelectionModel().getSelectedItem().toString(), 3, TAG_ID)); jsores.put(TCOUNT, Double.parseDouble(String.valueOf(itgcoun))); jsores.put(TRES, itg); jsores.put(TM, m); jsores.put(TSELLER, selid);// ID //jsores.put("balance", (balance3.get(cbx3.getSelectionModel().getSelectedIndex()) - coun)); SimpleDateFormat ff = new SimpleDateFormat("dd.MM.yyyy HH.mm"); jsores.put(TDATE, ff.format(System.currentTimeMillis())); //jsores.put("seltype","1"); !!!!! //jsores.put("dolgid","1"); jsores.put(TAG_CHECK, checkcheck()); //System.out.println(jsores); jsares.add(jsores); sp3.setVisible(!true); lb3.setVisible(!true); t3.setVisible(!true); bt3.setVisible(!true); sp3.getValueFactory().setValue(0); cbx3.getSelectionModel().clearSelection(); txg3.setVisible(false); // } } }); Dimension sSize = Toolkit.getDefaultToolkit().getScreenSize(); Scene scene = new Scene(grid, sSize.width, sSize.height); primaryStage.setScene(scene); scene.getStylesheets().add(MainA.class.getResource("main.css").toExternalForm()); primaryStage.show(); }
From source file:fr.amap.lidar.amapvox.gui.MainFrameController.java
/** * Initializes the controller class./* w w w .j av a 2 s .com*/ */ @Override public void initialize(URL url, ResourceBundle rb) { this.resourceBundle = rb; viewer3DPanelController.setResourceBundle(rb); initStrings(rb); colorPickerSeries.valueProperty().addListener(new ChangeListener<javafx.scene.paint.Color>() { @Override public void changed(ObservableValue<? extends javafx.scene.paint.Color> observable, javafx.scene.paint.Color oldValue, javafx.scene.paint.Color newValue) { if (listViewVoxelsFilesChart.getSelectionModel().getSelectedItems().size() == 1) { listViewVoxelsFilesChart.getSelectionModel().getSelectedItem().getSeriesParameters() .setColor(new Color((float) newValue.getRed(), (float) newValue.getGreen(), (float) newValue.getBlue(), 1.0f)); } } }); comboboxScript.getItems().setAll("Daniel script"); vboxWeighting.disableProperty().bind(checkboxEnableWeighting.selectedProperty().not()); checkboxEnableWeighting.selectedProperty().addListener(new ChangeListener<Boolean>() { @Override public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) { if (newValue && textAreaWeighting.getText().isEmpty()) { int selectedVoxTab = tabPaneVoxelisation.getSelectionModel().getSelectedIndex(); if (selectedVoxTab == 0) { //ALS fillWeightingData(EchoesWeightParams.DEFAULT_ALS_WEIGHTING); } else if (selectedVoxTab == 1) { //TLS fillWeightingData(EchoesWeightParams.DEFAULT_TLS_WEIGHTING); } } } }); /*comboboxTransMode.getItems().setAll(1, 2, 3); comboboxTransMode.getSelectionModel().selectFirst(); comboboxPathLengthMode.getItems().setAll("A", "B"); comboboxPathLengthMode.getSelectionModel().selectFirst();*/ helpButtonNaNsCorrection.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { helpButtonNaNsCorrectionController.showHelpDialog(resourceBundle.getString("help_NaNs_correction")); } }); helpButtonAutoBBox.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { helpButtonAutoBBoxController.showHelpDialog(resourceBundle.getString("help_bbox")); } }); helpButtonHemiPhoto.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { helpButtonHemiPhotoController.showHelpDialog(resourceBundle.getString("help_hemiphoto")); } }); buttonHelpEmptyShotsFilter.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { buttonHelpEmptyShotsFilterController .showHelpDialog(resourceBundle.getString("help_empty_shots_filter")); } }); /*work around, the divider positions values are defined in the fxml, but when the window is initialized the values are lost*/ Platform.runLater(new Runnable() { @Override public void run() { splitPaneMain.setDividerPositions(0.75f); splitPaneVoxelization.setDividerPositions(0.45f); } }); initValidationSupport(); initPostProcessTab(); listViewTransmittanceMapSensorPositions.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE); listViewTaskList.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE); MenuItem menuItemPadValue1m = new MenuItem("1m voxel size"); addMenuItemPadValue(menuItemPadValue1m, 3.536958f); MenuItem menuItemPadValue2m = new MenuItem("2m voxel size"); addMenuItemPadValue(menuItemPadValue2m, 2.262798f); MenuItem menuItemPadValue3m = new MenuItem("3m voxel size"); addMenuItemPadValue(menuItemPadValue3m, 1.749859f); MenuItem menuItemPadValue4m = new MenuItem("4m voxel size"); addMenuItemPadValue(menuItemPadValue4m, 1.3882959f); MenuItem menuItemPadValue5m = new MenuItem("5m voxel size"); addMenuItemPadValue(menuItemPadValue5m, 1.0848f); menuButtonAdvisablePADMaxValues.getItems().addAll(menuItemPadValue1m, menuItemPadValue2m, menuItemPadValue3m, menuItemPadValue4m, menuItemPadValue5m); fileChooserSaveCanopyAnalyserOutputFile = new FileChooserContext(); fileChooserSaveCanopyAnalyserCfgFile = new FileChooserContext(); fileChooserSaveTransmittanceSimCfgFile = new FileChooserContext(); fileChooserOpenCanopyAnalyserInputFile = new FileChooserContext(); listViewCanopyAnalyzerSensorPositions.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE); ContextMenu contextMenuProductsList = new ContextMenu(); MenuItem openImageItem = new MenuItem(RS_STR_OPEN_IMAGE); openImageItem.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { File selectedFile = listViewProductsFiles.getSelectionModel().getSelectedItem(); showImage(selectedFile); } }); Menu menuEdit = new Menu(RS_STR_EDIT); MenuItem menuItemEditVoxels = new MenuItem("Remove voxels (delete key)"); MenuItem menuItemFitToContent = new MenuItem("Fit to content"); MenuItem menuItemCrop = new MenuItem("Crop"); menuEdit.getItems().setAll(menuItemEditVoxels, menuItemFitToContent, menuItemCrop); menuItemFitToContent.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { File selectedItem = listViewProductsFiles.getSelectionModel().getSelectedItem(); if (selectedItem != null) { fitVoxelSpaceToContent(selectedItem); } } }); menuItemEditVoxels.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { File selectedItem = listViewProductsFiles.getSelectionModel().getSelectedItem(); if (selectedItem != null) { editVoxelSpace(selectedItem); } } }); menuItemCrop.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { File selectedItem = listViewProductsFiles.getSelectionModel().getSelectedItem(); if (selectedItem != null) { try { voxelSpaceCroppingFrameController.setVoxelFile(selectedItem); voxelSpaceCroppingFrame.show(); } catch (Exception ex) { showErrorDialog(ex); } } } }); Menu menuExport = new Menu(RS_STR_EXPORT); MenuItem menuItemExportDartMaket = new MenuItem("Dart (maket.txt)"); MenuItem menuItemExportDartPlots = new MenuItem("Dart (plots.xml)"); MenuItem menuItemExportMeshObj = new MenuItem("Mesh (*.obj)"); menuItemExportDartMaket.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { File selectedItem = listViewProductsFiles.getSelectionModel().getSelectedItem(); if (selectedItem != null) { exportDartMaket(selectedItem); } } }); menuItemExportDartPlots.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { File selectedItem = listViewProductsFiles.getSelectionModel().getSelectedItem(); if (selectedItem != null) { exportDartPlots(selectedItem); } } }); menuItemExportMeshObj.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { File selectedItem = listViewProductsFiles.getSelectionModel().getSelectedItem(); if (selectedItem != null) { exportMeshObj(selectedItem); } } }); menuExport.getItems().setAll(menuItemExportDartMaket, menuItemExportDartPlots, menuItemExportMeshObj); MenuItem menuItemInfo = new MenuItem(RS_STR_INFO); menuItemInfo.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { Alert alert = new Alert(AlertType.INFORMATION); File selectedItem = listViewProductsFiles.getSelectionModel().getSelectedItem(); if (selectedItem != null) { VoxelFileReader reader; try { reader = new VoxelFileReader(selectedItem); VoxelSpaceInfos voxelSpaceInfos = reader.getVoxelSpaceInfos(); alert.setTitle("Information"); alert.setHeaderText("Voxel space informations"); alert.setContentText(voxelSpaceInfos.toString()); alert.show(); } catch (Exception ex) { showErrorDialog(ex); } } } }); final MenuItem menuItemOpenContainingFolder = new MenuItem(RS_STR_OPEN_CONTAINING_FOLDER); menuItemOpenContainingFolder.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { final File selectedItem = listViewProductsFiles.getSelectionModel().getSelectedItem(); if (selectedItem != null) { if (Desktop.isDesktopSupported()) { new Thread(() -> { try { Desktop.getDesktop().open(selectedItem.getParentFile()); } catch (IOException ex) { logger.error("Cannot open directory " + selectedItem); } }).start(); } } } }); listViewProductsFiles.setOnContextMenuRequested(new EventHandler<ContextMenuEvent>() { @Override public void handle(ContextMenuEvent event) { if (listViewProductsFiles.getSelectionModel().getSelectedIndices().size() == 1) { File selectedFile = listViewProductsFiles.getSelectionModel().getSelectedItem(); String extension = FileManager.getExtension(selectedFile); switch (extension) { case ".png": case ".bmp": case ".jpg": contextMenuProductsList.getItems().setAll(openImageItem, menuItemOpenContainingFolder); contextMenuProductsList.show(listViewProductsFiles, event.getScreenX(), event.getScreenY()); break; case ".vox": default: if (VoxelFileReader.isFileAVoxelFile(selectedFile)) { contextMenuProductsList.getItems().setAll(menuItemInfo, menuItemOpenContainingFolder, menuEdit, menuExport); contextMenuProductsList.show(listViewProductsFiles, event.getScreenX(), event.getScreenY()); } } } } }); ContextMenu contextMenuLidarScanEdit = new ContextMenu(); MenuItem editItem = new MenuItem("Edit"); editItem.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { filterFrameController.setFilters("Reflectance", "Deviation", "Amplitude"); filterFrame.show(); filterFrame.setOnHidden(new EventHandler<WindowEvent>() { @Override public void handle(WindowEvent event) { if (filterFrameController.getFilter() != null) { ObservableList<LidarScan> items = listViewHemiPhotoScans.getSelectionModel() .getSelectedItems(); for (LidarScan scan : items) { scan.filters.add(filterFrameController.getFilter()); } } } }); } }); contextMenuLidarScanEdit.getItems().add(editItem); listViewHemiPhotoScans.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE); listViewHemiPhotoScans.setOnContextMenuRequested(new EventHandler<ContextMenuEvent>() { @Override public void handle(ContextMenuEvent event) { contextMenuLidarScanEdit.show(listViewHemiPhotoScans, event.getScreenX(), event.getScreenY()); } }); /**LAD tab initialization**/ comboboxLADChoice.getItems().addAll(LeafAngleDistribution.Type.UNIFORM, LeafAngleDistribution.Type.SPHERIC, LeafAngleDistribution.Type.ERECTOPHILE, LeafAngleDistribution.Type.PLANOPHILE, LeafAngleDistribution.Type.EXTREMOPHILE, LeafAngleDistribution.Type.PLAGIOPHILE, LeafAngleDistribution.Type.HORIZONTAL, LeafAngleDistribution.Type.VERTICAL, LeafAngleDistribution.Type.ELLIPSOIDAL, LeafAngleDistribution.Type.ELLIPTICAL, LeafAngleDistribution.Type.TWO_PARAMETER_BETA); comboboxLADChoice.getSelectionModel().select(LeafAngleDistribution.Type.SPHERIC); comboboxLADChoice.getSelectionModel().selectedItemProperty() .addListener(new ChangeListener<LeafAngleDistribution.Type>() { @Override public void changed(ObservableValue<? extends LeafAngleDistribution.Type> observable, LeafAngleDistribution.Type oldValue, LeafAngleDistribution.Type newValue) { if (newValue == LeafAngleDistribution.Type.TWO_PARAMETER_BETA || newValue == LeafAngleDistribution.Type.ELLIPSOIDAL) { hboxTwoBetaParameters.setVisible(true); if (newValue == LeafAngleDistribution.Type.ELLIPSOIDAL) { labelLADBeta.setVisible(false); } else { labelLADBeta.setVisible(true); } } else { hboxTwoBetaParameters.setVisible(false); } } }); ToggleGroup ladTypeGroup = new ToggleGroup(); radiobuttonLADHomogeneous.setToggleGroup(ladTypeGroup); radiobuttonLADLocalEstimation.setToggleGroup(ladTypeGroup); /**CHART panel initialization**/ ToggleGroup profileChartType = new ToggleGroup(); radiobuttonPreDefinedProfile.setToggleGroup(profileChartType); radiobuttonFromVariableProfile.setToggleGroup(profileChartType); ToggleGroup profileChartRelativeHeightType = new ToggleGroup(); radiobuttonHeightFromAboveGround.setToggleGroup(profileChartRelativeHeightType); radiobuttonHeightFromBelowCanopy.setToggleGroup(profileChartRelativeHeightType); comboboxFromVariableProfile.disableProperty().bind(radiobuttonPreDefinedProfile.selectedProperty()); comboboxPreDefinedProfile.disableProperty().bind(radiobuttonFromVariableProfile.selectedProperty()); hboxMaxPADVegetationProfile.visibleProperty().bind(radiobuttonPreDefinedProfile.selectedProperty()); listViewVoxelsFilesChart.getSelectionModel().selectedIndexProperty() .addListener(new ChangeListener<Number>() { @Override public void changed(ObservableValue<? extends Number> observable, Number oldValue, Number newValue) { if (listViewVoxelsFilesChart.getSelectionModel().getSelectedItems().size() > 1) { colorPickerSeries.setDisable(true); } else if (listViewVoxelsFilesChart.getSelectionModel().getSelectedItems().size() == 1) { VoxelFileChart selectedItem = listViewVoxelsFilesChart.getSelectionModel() .getSelectedItem(); Color selectedItemColor = selectedItem.getSeriesParameters().getColor(); colorPickerSeries.setDisable(false); colorPickerSeries.setValue(new javafx.scene.paint.Color( selectedItemColor.getRed() / 255.0, selectedItemColor.getGreen() / 255.0, selectedItemColor.getBlue() / 255.0, 1.0)); if (newValue.intValue() >= 0) { textfieldLabelVoxelFileChart.setText( listViewVoxelsFilesChart.getItems().get(newValue.intValue()).label); } } } }); textfieldLabelVoxelFileChart.textProperty().addListener(new ChangeListener<String>() { @Override public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) { if (listViewVoxelsFilesChart.getSelectionModel().getSelectedIndex() >= 0) { listViewVoxelsFilesChart.getSelectionModel().getSelectedItem().label = newValue; } } }); listViewVoxelsFilesChart.getItems().addListener(new ListChangeListener<VoxelFileChart>() { @Override public void onChanged(ListChangeListener.Change<? extends VoxelFileChart> c) { while (c.next()) { } if (c.wasAdded() && c.getAddedSize() == c.getList().size()) { try { VoxelFileReader reader = new VoxelFileReader(c.getList().get(0).file); String[] columnNames = reader.getVoxelSpaceInfos().getColumnNames(); comboboxFromVariableProfile.getItems().clear(); comboboxFromVariableProfile.getItems().addAll(columnNames); comboboxFromVariableProfile.getSelectionModel().selectFirst(); } catch (Exception ex) { logger.error("Cannot read voxel file", ex); } } } }); anchorpaneQuadrats.disableProperty().bind(checkboxMakeQuadrats.selectedProperty().not()); comboboxSelectAxisForQuadrats.getItems().addAll("X", "Y", "Z"); comboboxSelectAxisForQuadrats.getSelectionModel().select(1); comboboxPreDefinedProfile.getItems().addAll("Vegetation (PAD)"); comboboxPreDefinedProfile.getSelectionModel().selectFirst(); radiobuttonSplitCountForQuadrats.selectedProperty().addListener(new ChangeListener<Boolean>() { @Override public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) { textFieldSplitCountForQuadrats.setDisable(!newValue); textFieldLengthForQuadrats.setDisable(newValue); } }); ToggleGroup chartMakeQuadratsSplitType = new ToggleGroup(); radiobuttonLengthForQuadrats.setToggleGroup(chartMakeQuadratsSplitType); radiobuttonSplitCountForQuadrats.setToggleGroup(chartMakeQuadratsSplitType); /**Virtual measures panel initialization**/ comboboxHemiPhotoBitmapOutputMode.getItems().addAll("Pixel", "Color"); comboboxHemiPhotoBitmapOutputMode.getSelectionModel().selectFirst(); ToggleGroup virtualMeasuresChoiceGroup = new ToggleGroup(); toggleButtonLAI2000Choice.setToggleGroup(virtualMeasuresChoiceGroup); toggleButtonLAI2200Choice.setToggleGroup(virtualMeasuresChoiceGroup); comboboxChooseCanopyAnalyzerSampling.getItems().setAll(500, 4000, 10000); comboboxChooseCanopyAnalyzerSampling.getSelectionModel().selectFirst(); initEchoFiltering(); data = FXCollections.observableArrayList(); tableViewSimulationPeriods.setItems(data); tableViewSimulationPeriods.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE); comboboxChooseDirectionsNumber.getItems().addAll(1, 6, 16, 46, 136, 406); comboboxChooseDirectionsNumber.getSelectionModel().select(4); ToggleGroup scannerPositionsMode = new ToggleGroup(); /*radiobuttonScannerPosSquaredArea.setToggleGroup(scannerPositionsMode); radiobuttonScannerPosFile.setToggleGroup(scannerPositionsMode);*/ tableColumnPeriod.setCellValueFactory( new Callback<TableColumn.CellDataFeatures<SimulationPeriod, String>, ObservableValue<String>>() { @Override public ObservableValue<String> call( TableColumn.CellDataFeatures<SimulationPeriod, String> param) { return new SimpleStringProperty(param.getValue().getPeriod().toString()); } }); tableColumnClearness.setCellValueFactory( new Callback<TableColumn.CellDataFeatures<SimulationPeriod, String>, ObservableValue<String>>() { @Override public ObservableValue<String> call( TableColumn.CellDataFeatures<SimulationPeriod, String> param) { return new SimpleStringProperty(String.valueOf(param.getValue().getClearnessCoefficient())); } }); checkboxMultiFiles.selectedProperty().addListener(new ChangeListener<Boolean>() { @Override public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) { anchorpaneBoundingBoxParameters.setDisable(newValue); } }); hboxGenerateBitmapFiles.disableProperty().bind(checkboxGenerateBitmapFile.selectedProperty().not()); hboxGenerateTextFile.disableProperty().bind(checkboxGenerateTextFile.selectedProperty().not()); fileChooserOpenConfiguration = new FileChooser(); fileChooserOpenConfiguration.setTitle("Choose configuration file"); fileChooserSaveConfiguration = new FileChooserContext("cfg.xml"); fileChooserSaveConfiguration.fc.setTitle("Choose output file"); fileChooserOpenInputFileALS = new FileChooser(); fileChooserOpenInputFileALS.setTitle("Open input file"); fileChooserOpenInputFileALS.getExtensionFilters().addAll(new ExtensionFilter("All Files", "*"), new ExtensionFilter("Shot files", "*.sht"), new ExtensionFilter("Text Files", "*.txt"), new ExtensionFilter("Las Files", "*.las", "*.laz")); fileChooserOpenTrajectoryFileALS = new FileChooser(); fileChooserOpenTrajectoryFileALS.setTitle("Open trajectory file"); fileChooserOpenTrajectoryFileALS.getExtensionFilters().addAll(new ExtensionFilter("All Files", "*"), new ExtensionFilter("Text Files", "*.txt")); fileChooserOpenOutputFileALS = new FileChooser(); fileChooserOpenOutputFileALS.setTitle("Choose output file"); fileChooserOpenInputFileTLS = new FileChooserContext(); fileChooserOpenInputFileTLS.fc.setTitle("Open input file"); fileChooserOpenInputFileTLS.fc.getExtensionFilters().addAll(new ExtensionFilter("All Files", "*"), new ExtensionFilter("Text Files", "*.txt"), new ExtensionFilter("Rxp Files", "*.rxp"), new ExtensionFilter("Project Rsp Files", "*.rsp")); directoryChooserOpenOutputPathTLS = new DirectoryChooser(); directoryChooserOpenOutputPathTLS.setTitle("Choose output path"); directoryChooserOpenOutputPathALS = new DirectoryChooser(); directoryChooserOpenOutputPathALS.setTitle("Choose output path"); fileChooserSaveOutputFileTLS = new FileChooser(); fileChooserSaveOutputFileTLS.setTitle("Save voxel file"); fileChooserSaveTransmittanceTextFile = new FileChooser(); fileChooserSaveTransmittanceTextFile.setTitle("Save text file"); directoryChooserSaveTransmittanceBitmapFile = new DirectoryChooser(); directoryChooserSaveTransmittanceBitmapFile.setTitle("Choose output directory"); fileChooserSaveHemiPhotoOutputBitmapFile = new FileChooserContext("*.png"); fileChooserSaveHemiPhotoOutputBitmapFile.fc.setTitle("Save bitmap file"); directoryChooserSaveHemiPhotoOutputBitmapFile = new DirectoryChooser(); directoryChooserSaveHemiPhotoOutputBitmapFile.setTitle("Choose bitmap files output directory"); directoryChooserSaveHemiPhotoOutputTextFile = new DirectoryChooser(); directoryChooserSaveHemiPhotoOutputTextFile.setTitle("Choose text files output directory"); fileChooserSaveHemiPhotoOutputTextFile = new FileChooser(); fileChooserSaveHemiPhotoOutputTextFile.setTitle("Save text file"); fileChooserOpenVoxelFile = new FileChooser(); fileChooserOpenVoxelFile.setTitle("Open voxel file"); fileChooserOpenVoxelFile.getExtensionFilters().addAll(new ExtensionFilter("All Files", "*"), new ExtensionFilter("Voxel Files", "*.vox")); fileChooserOpenPopMatrixFile = new FileChooser(); fileChooserOpenPopMatrixFile.setTitle("Choose matrix file"); fileChooserOpenPopMatrixFile.getExtensionFilters().addAll(new ExtensionFilter("All Files", "*"), new ExtensionFilter("Text Files", "*.txt")); fileChooserOpenSopMatrixFile = new FileChooser(); fileChooserOpenSopMatrixFile.setTitle("Choose matrix file"); fileChooserOpenSopMatrixFile.getExtensionFilters().addAll(new ExtensionFilter("All Files", "*"), new ExtensionFilter("Text Files", "*.txt")); fileChooserOpenVopMatrixFile = new FileChooser(); fileChooserOpenVopMatrixFile.setTitle("Choose matrix file"); fileChooserOpenVopMatrixFile.getExtensionFilters().addAll(new ExtensionFilter("All Files", "*"), new ExtensionFilter("Text Files", "*.txt")); fileChooserOpenPonderationFile = new FileChooser(); fileChooserOpenPonderationFile.setTitle("Choose ponderation file"); fileChooserOpenPonderationFile.getExtensionFilters().addAll(new ExtensionFilter("All Files", "*"), new ExtensionFilter("Text Files", "*.txt")); fileChooserOpenDTMFile = new FileChooser(); fileChooserOpenDTMFile.setTitle("Choose DTM file"); fileChooserOpenDTMFile.getExtensionFilters().addAll(new ExtensionFilter("All Files", "*"), new ExtensionFilter("DTM Files", "*.asc")); fileChooserOpenPointCloudFile = new FileChooser(); fileChooserOpenPointCloudFile.setTitle("Choose point cloud file"); fileChooserOpenPointCloudFile.getExtensionFilters().addAll(new ExtensionFilter("All Files", "*"), new ExtensionFilter("TXT Files", "*.txt")); fileChooserOpenMultiResVoxelFile = new FileChooser(); fileChooserOpenMultiResVoxelFile.setTitle("Choose voxel file"); fileChooserOpenMultiResVoxelFile.getExtensionFilters().addAll(new ExtensionFilter("All Files", "*"), new ExtensionFilter("Voxel Files", "*.vox")); fileChooserOpenOutputFileMultiRes = new FileChooser(); fileChooserOpenOutputFileMultiRes.setTitle("Save voxel file"); fileChooserAddTask = new FileChooser(); fileChooserAddTask.setTitle("Choose parameter file"); fileChooserAddTask.getExtensionFilters().addAll(new ExtensionFilter("All Files", "*"), new ExtensionFilter("XML Files", "*.xml")); fileChooserSaveDartFile = new FileChooser(); fileChooserSaveDartFile.setTitle("Save dart file (.maket)"); fileChooserSaveDartFile.getExtensionFilters().addAll(new ExtensionFilter("All Files", "*"), new ExtensionFilter("Maket File", "*.maket")); fileChooserOpenOutputFileMerging = new FileChooser(); fileChooserOpenOutputFileMerging.setTitle("Choose voxel file"); fileChooserOpenOutputFileMerging.getExtensionFilters().addAll(new ExtensionFilter("All Files", "*"), new ExtensionFilter("Voxel Files", "*.vox")); fileChooserOpenScriptFile = new FileChooser(); fileChooserOpenScriptFile.setTitle("Choose script file"); fileChooserSaveGroundEnergyOutputFile = new FileChooser(); fileChooserSaveGroundEnergyOutputFile.setTitle("Save ground energy file"); fileChooserOpenPointsPositionFile = new FileChooser(); fileChooserOpenPointsPositionFile.setTitle("Choose points file"); fileChooserOpenPointsPositionFile.getExtensionFilters().addAll(new ExtensionFilter("All Files", "*"), new ExtensionFilter("TXT Files", "*.txt")); try { viewCapsSetupFrame = new Stage(); FXMLLoader loader = new FXMLLoader(getClass().getResource("/fxml/ViewCapsSetupFrame.fxml")); Parent root = loader.load(); viewCapsSetupFrameController = loader.getController(); viewCapsSetupFrame.setScene(new Scene(root)); } catch (IOException ex) { logger.error("Cannot load fxml file", ex); } try { FXMLLoader loader = new FXMLLoader(getClass().getResource("/fxml/FilteringPaneComponent.fxml")); anchorPaneEchoFilteringRxp = loader.load(); filteringPaneController = loader.getController(); filteringPaneController.setFiltersNames("Reflectance", "Amplitude", "Deviation"); } catch (IOException ex) { logger.error("Cannot load fxml file", ex); } try { positionImporterFrame = new Stage(); FXMLLoader loader = new FXMLLoader(getClass().getResource("/fxml/PositionImporterFrame.fxml")); Parent root = loader.load(); positionImporterFrameController = loader.getController(); positionImporterFrame.setScene(new Scene(root)); positionImporterFrameController.setStage(positionImporterFrame); } catch (IOException ex) { logger.error("Cannot load fxml file", ex); } try { voxelSpaceCroppingFrame = new Stage(); FXMLLoader loader = new FXMLLoader(getClass().getResource("/fxml/VoxelSpaceCroppingFrame.fxml")); Parent root = loader.load(); voxelSpaceCroppingFrameController = loader.getController(); voxelSpaceCroppingFrame.setScene(new Scene(root)); } catch (IOException ex) { logger.error("Cannot load fxml file", ex); } try { attributsImporterFrame = new Stage(); FXMLLoader loader = new FXMLLoader(getClass().getResource("/fxml/AttributsImporterFrame.fxml")); Parent root = loader.load(); attributsImporterFrameController = loader.getController(); attributsImporterFrame.setScene(new Scene(root)); attributsImporterFrameController.setStage(attributsImporterFrame); } catch (IOException ex) { logger.error("Cannot load fxml file", ex); } try { textFileParserFrameController = TextFileParserFrameController.getInstance(); } catch (Exception ex) { logger.error("Cannot load fxml file", ex); } try { transformationFrameController = TransformationFrameController.getInstance(); transformationFrame = transformationFrameController.getStage(); } catch (Exception ex) { logger.error("Cannot load fxml file", ex); } updaterFrame = new Stage(); try { FXMLLoader loader = new FXMLLoader(getClass().getResource("/fxml/update/UpdaterFrame.fxml")); Parent root = loader.load(); updaterFrameController = loader.getController(); updaterFrame.setScene(new Scene(root)); } catch (IOException ex) { logger.error("Cannot load fxml file", ex); } riscanProjectExtractor = new RiscanProjectExtractor(); ptxProjectExtractor = new PTXProjectExtractor(); ptgProjectExtractor = new PTGProjectExtractor(); dateChooserFrame = new Stage(); try { FXMLLoader loader = new FXMLLoader(getClass().getResource("/fxml/DateChooserFrame.fxml")); Parent root = loader.load(); dateChooserFrameController = loader.getController(); dateChooserFrame.setScene(new Scene(root)); dateChooserFrameController.setStage(dateChooserFrame); } catch (IOException ex) { logger.error("Cannot load fxml file", ex); } comboboxModeALS.getItems().addAll(RS_STR_INPUT_TYPE_LAS, RS_STR_INPUT_TYPE_LAZ, /*RS_STR_INPUT_TYPE_XYZ, */RS_STR_INPUT_TYPE_SHOTS); comboboxModeALS.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<String>() { @Override public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) { if (newValue.equals(RS_STR_INPUT_TYPE_SHOTS)) { alsVoxValidationSupport.registerValidator(textFieldTrajectoryFileALS, false, Validators.unregisterValidator); } else { alsVoxValidationSupport.registerValidator(textFieldTrajectoryFileALS, false, Validators.fileExistValidator); } } }); comboboxModeTLS.getItems().setAll("Rxp scan", "Rsp project", "PTX", "PTG"/*, RS_STR_INPUT_TYPE_XYZ, RS_STR_INPUT_TYPE_SHOTS*/); comboboxGroundEnergyOutputFormat.getItems().setAll("txt", "png"); comboboxLaserSpecification.getItems().addAll(LaserSpecification.getPresets()); comboboxLaserSpecification.getSelectionModel().selectedItemProperty() .addListener(new ChangeListener<LaserSpecification>() { @Override public void changed(ObservableValue<? extends LaserSpecification> observable, LaserSpecification oldValue, LaserSpecification newValue) { DecimalFormatSymbols symb = new DecimalFormatSymbols(); symb.setDecimalSeparator('.'); DecimalFormat formatter = new DecimalFormat("#####.######", symb); textFieldBeamDiameterAtExit.setText(formatter.format(newValue.getBeamDiameterAtExit())); textFieldBeamDivergence.setText(formatter.format(newValue.getBeamDivergence())); } }); comboboxLaserSpecification.getSelectionModel().select(LaserSpecification.LMS_Q560); comboboxLaserSpecification.disableProperty().bind(checkboxCustomLaserSpecification.selectedProperty()); textFieldBeamDiameterAtExit.disableProperty() .bind(checkboxCustomLaserSpecification.selectedProperty().not()); textFieldBeamDivergence.disableProperty().bind(checkboxCustomLaserSpecification.selectedProperty().not()); listViewProductsFiles.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE); listViewProductsFiles.getSelectionModel().selectedIndexProperty().addListener(new ChangeListener<Number>() { @Override public void changed(ObservableValue<? extends Number> observable, Number oldValue, Number newValue) { int size = listViewProductsFiles.getSelectionModel().getSelectedIndices().size(); if (size == 1) { viewer3DPanelController .updateCurrentVoxelFile(listViewProductsFiles.getSelectionModel().getSelectedItem()); } } }); listViewTaskList.getSelectionModel().selectedIndexProperty().addListener(new ChangeListener<Number>() { @Override public void changed(ObservableValue<? extends Number> observable, Number oldValue, Number newValue) { int size = listViewTaskList.getSelectionModel().getSelectedIndices().size(); if (size == 1) { buttonLoadSelectedTask.setDisable(false); } else { buttonLoadSelectedTask.setDisable(true); } buttonExecute.setDisable(size == 0); } }); resetMatrices(); calculateMatrixFrame = new Stage(); try { FXMLLoader loader = new FXMLLoader(getClass().getResource("/fxml/CalculateMatrixFrame.fxml")); Parent root = loader.load(); calculateMatrixFrameController = loader.getController(); calculateMatrixFrameController.setStage(calculateMatrixFrame); Scene scene = new Scene(root); calculateMatrixFrame.setScene(scene); } catch (IOException ex) { logger.error("Cannot load fxml file", ex); } filterFrame = new Stage(); try { FXMLLoader loader = new FXMLLoader(getClass().getResource("/fxml/FilterFrame.fxml")); Parent root = loader.load(); filterFrameController = loader.getController(); filterFrameController.setStage(filterFrame); filterFrameController.setFilters("Angle"); filterFrame.setScene(new Scene(root)); } catch (IOException ex) { logger.error("Cannot load fxml file", ex); } try { FXMLLoader loader = new FXMLLoader(getClass().getResource("/fxml/export/ObjExporterDialog.fxml")); Parent root = loader.load(); objExporterController = loader.getController(); Stage s = new Stage(); objExporterController.setStage(s); s.setScene(new Scene(root)); } catch (IOException ex) { logger.error("Cannot load fxml file", ex); } textFieldResolution.textProperty().addListener(new ChangeListener<String>() { @Override public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) { voxelSpacePanelVoxelizationController.setResolution(Float.valueOf(newValue)); } }); textFieldResolution.textProperty().addListener(voxelSpacePanelVoxelizationController.getChangeListener()); checkboxUseDTMFilter.selectedProperty().addListener(new ChangeListener<Boolean>() { @Override public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) { if (checkboxUseDTMFilter.isSelected()) { buttonOpenDTMFile.setDisable(false); textfieldDTMPath.setDisable(false); textfieldDTMValue.setDisable(false); checkboxApplyVOPMatrix.setDisable(false); labelDTMValue.setDisable(false); labelDTMPath.setDisable(false); } else { buttonOpenDTMFile.setDisable(true); textfieldDTMPath.setDisable(true); textfieldDTMValue.setDisable(true); checkboxApplyVOPMatrix.setDisable(true); labelDTMValue.setDisable(true); labelDTMPath.setDisable(true); } } }); checkboxUseVopMatrix.selectedProperty().addListener(new ChangeListener<Boolean>() { @Override public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) { buttonSetVOPMatrix.setDisable(!newValue); } }); checkboxUsePopMatrix.selectedProperty().addListener(new ChangeListener<Boolean>() { @Override public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) { if (newValue) { checkBoxUseDefaultPopMatrix.setDisable(false); buttonOpenPopMatrixFile.setDisable(false); } else { checkBoxUseDefaultPopMatrix.setDisable(true); buttonOpenPopMatrixFile.setDisable(true); } } }); checkboxUseSopMatrix.selectedProperty().addListener(new ChangeListener<Boolean>() { @Override public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) { if (newValue) { checkBoxUseDefaultSopMatrix.setDisable(false); buttonOpenSopMatrixFile.setDisable(false); } else { checkBoxUseDefaultSopMatrix.setDisable(true); buttonOpenSopMatrixFile.setDisable(true); } } }); checkboxCalculateGroundEnergy.selectedProperty().addListener(new ChangeListener<Boolean>() { @Override public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) { if (newValue) { anchorPaneGroundEnergyParameters.setDisable(false); } else { anchorPaneGroundEnergyParameters.setDisable(true); } } }); listviewRxpScans.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<LidarScan>() { @Override public void changed(ObservableValue<? extends LidarScan> observable, LidarScan oldValue, LidarScan newValue) { if (newValue != null) { sopMatrix = newValue.matrix; updateResultMatrix(); } } }); comboboxModeTLS.getSelectionModel().selectedIndexProperty().addListener(new ChangeListener<Number>() { @Override public void changed(ObservableValue<? extends Number> observable, Number oldValue, Number newValue) { switch (newValue.intValue()) { case 1: case 2: case 3: listviewRxpScans.setDisable(false); checkboxMergeAfter.setDisable(false); textFieldMergedFileName.setDisable(false); disableSopMatrixChoice(false); labelTLSOutputPath.setText("Output path"); break; default: listviewRxpScans.setDisable(true); checkboxMergeAfter.setDisable(true); textFieldMergedFileName.setDisable(true); //disableSopMatrixChoice(true); labelTLSOutputPath.setText("Output file"); } if (newValue.intValue() == 0 || newValue.intValue() == 1) { checkboxEmptyShotsFilter.setDisable(false); } else { checkboxEmptyShotsFilter.setDisable(true); } } }); tabPaneVoxelisation.getSelectionModel().selectedIndexProperty().addListener(new ChangeListener<Number>() { @Override public void changed(ObservableValue<? extends Number> observable, Number oldValue, Number newValue) { switch (newValue.intValue()) { case 1: disableSopMatrixChoice(false); disablePopMatrixChoice(false); checkboxEmptyShotsFilter.setDisable(false); break; default: disableSopMatrixChoice(true); disablePopMatrixChoice(true); checkboxEmptyShotsFilter.setDisable(true); } switch (newValue.intValue()) { case 0: checkboxCalculateGroundEnergy.setDisable(false); if (checkboxCalculateGroundEnergy.isSelected()) { anchorPaneGroundEnergyParameters.setDisable(true); checkboxCalculateGroundEnergy.setDisable(false); } anchorPaneEchoFiltering.getChildren().set(0, anchorPaneEchoFilteringClassifications); //anchorPaneEchoFilteringClassifications.setVisible(true); anchorpaneBoundingBoxParameters.setDisable(checkboxMultiFiles.isSelected()); hboxAutomaticBBox.setDisable(false); break; default: anchorPaneGroundEnergyParameters.setDisable(true); checkboxCalculateGroundEnergy.setDisable(true); anchorPaneEchoFiltering.getChildren().set(0, anchorPaneEchoFilteringRxp); //anchorPaneEchoFilteringClassifications.setVisible(false); anchorpaneBoundingBoxParameters.setDisable(false); hboxAutomaticBBox.setDisable(true); } } }); int availableCores = Runtime.getRuntime().availableProcessors(); sliderRSPCoresToUse.setMin(1); sliderRSPCoresToUse.setMax(availableCores); sliderRSPCoresToUse.setValue(availableCores); textFieldInputFileALS.setOnDragOver(DragAndDropHelper.dragOverEvent); textFieldTrajectoryFileALS.setOnDragOver(DragAndDropHelper.dragOverEvent); textFieldOutputFileALS.setOnDragOver(DragAndDropHelper.dragOverEvent); textFieldInputFileTLS.setOnDragOver(DragAndDropHelper.dragOverEvent); textFieldOutputFileMerging.setOnDragOver(DragAndDropHelper.dragOverEvent); textfieldDTMPath.setOnDragOver(DragAndDropHelper.dragOverEvent); textFieldOutputFileGroundEnergy.setOnDragOver(DragAndDropHelper.dragOverEvent); listViewTaskList.setOnDragOver(DragAndDropHelper.dragOverEvent); listViewProductsFiles.setOnDragOver(DragAndDropHelper.dragOverEvent); textfieldVoxelFilePathTransmittance.setOnDragOver(DragAndDropHelper.dragOverEvent); textfieldOutputTextFilePath.setOnDragOver(DragAndDropHelper.dragOverEvent); textfieldOutputBitmapFilePath.setOnDragOver(DragAndDropHelper.dragOverEvent); textFieldInputFileALS.setOnDragDropped(new EventHandler<DragEvent>() { @Override public void handle(DragEvent event) { Dragboard db = event.getDragboard(); boolean success = false; if (db.hasFiles() && db.getFiles().size() == 1) { success = true; for (File file : db.getFiles()) { if (file != null) { textFieldInputFileALS.setText(file.getAbsolutePath()); selectALSInputMode(file); } } } event.setDropCompleted(success); event.consume(); } }); textFieldTrajectoryFileALS.setOnDragDropped(new EventHandler<DragEvent>() { @Override public void handle(DragEvent event) { Dragboard db = event.getDragboard(); boolean success = false; if (db.hasFiles() && db.getFiles().size() == 1) { success = true; for (File file : db.getFiles()) { if (file != null) { onTrajectoryFileChoosed(file); } } } event.setDropCompleted(success); event.consume(); } }); textFieldInputFileTLS.setOnDragDropped(new EventHandler<DragEvent>() { @Override public void handle(DragEvent event) { Dragboard db = event.getDragboard(); boolean success = false; if (db.hasFiles() && db.getFiles().size() == 1) { success = true; for (File file : db.getFiles()) { if (file != null) { onInputFileTLSChoosed(file); } } } event.setDropCompleted(success); event.consume(); } }); setDragDroppedSingleFileEvent(textFieldOutputFileALS); setDragDroppedSingleFileEvent(textFieldOutputFileMerging); setDragDroppedSingleFileEvent(textfieldDTMPath); setDragDroppedSingleFileEvent(textFieldOutputFileGroundEnergy); setDragDroppedSingleFileEvent(textfieldVoxelFilePathTransmittance); setDragDroppedSingleFileEvent(textfieldOutputTextFilePath); setDragDroppedSingleFileEvent(textfieldOutputBitmapFilePath); listViewTaskList.setOnDragDropped(new EventHandler<DragEvent>() { @Override public void handle(DragEvent event) { Dragboard db = event.getDragboard(); boolean success = false; if (db.hasFiles()) { success = true; for (File file : db.getFiles()) { addFileToTaskList(file); } } event.setDropCompleted(success); event.consume(); } }); listViewProductsFiles.setOnDragDropped(new EventHandler<DragEvent>() { @Override public void handle(DragEvent event) { Dragboard db = event.getDragboard(); boolean success = false; if (db.hasFiles()) { success = true; for (File file : db.getFiles()) { addFileToProductsList(file); } } event.setDropCompleted(success); event.consume(); } }); listViewProductsFiles.setOnDragDetected(new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent event) { Dragboard db = listViewProductsFiles.startDragAndDrop(TransferMode.COPY); ClipboardContent content = new ClipboardContent(); content.putFiles(listViewProductsFiles.getSelectionModel().getSelectedItems()); db.setContent(content); event.consume(); } }); addPointcloudFilterComponent(); checkboxUsePointcloudFilter.selectedProperty().addListener(new ChangeListener<Boolean>() { @Override public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) { hBoxPointCloudFiltering.setDisable(!newValue); ObservableList<Node> list = vBoxPointCloudFiltering.getChildren(); for (Node n : list) { if (n instanceof PointCloudFilterPaneComponent) { PointCloudFilterPaneComponent panel = (PointCloudFilterPaneComponent) n; panel.disableContent(!newValue); } } buttonAddPointcloudFilter.setDisable(!newValue); } }); //displayGThetaAllDistributions(); }