Java tutorial
// Description: Java 8 JavaFX Picker of Obj Pane implementation for UInt16Col. /* * CFBam * * Copyright (c) 2014-2016 Mark Sobkow * * This program is available as free software under the GNU GPL v3, or * under a commercial license from Mark Sobkow. For commercial licensing * details, please contact msobkow@sasktel.net. * * Under the terms of the GPL: * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * */ package net.sourceforge.msscodefactory.cfbam.v2_7.CFBamJavaFX; import java.math.*; import java.sql.*; import java.text.*; import java.util.*; import java.util.List; import javafx.beans.property.ReadOnlyObjectWrapper; import javafx.beans.value.ChangeListener; import javafx.beans.value.ObservableValue; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.event.ActionEvent; import javafx.event.EventHandler; import javafx.scene.Parent; import javafx.scene.control.ScrollPane; import javafx.scene.control.ScrollPane.ScrollBarPolicy; import javafx.scene.control.TableCell; import javafx.scene.control.TableColumn; import javafx.scene.control.TableColumn.CellDataFeatures; import javafx.scene.control.TableView; import javafx.util.Callback; import net.sourceforge.msscodefactory.cflib.v2_7.CFLib.*; import net.sourceforge.msscodefactory.cflib.v2_7.CFLib.JavaFX.*; import org.apache.commons.codec.binary.Base64; import net.sourceforge.msscodefactory.cfsecurity.v2_7.CFSecurity.*; import net.sourceforge.msscodefactory.cfinternet.v2_7.CFInternet.*; import net.sourceforge.msscodefactory.cfbam.v2_7.CFBam.*; import net.sourceforge.msscodefactory.cfsecurity.v2_7.CFSecurityObj.*; import net.sourceforge.msscodefactory.cfinternet.v2_7.CFInternetObj.*; import net.sourceforge.msscodefactory.cfbam.v2_7.CFBamObj.*; import net.sourceforge.msscodefactory.cfsecurity.v2_7.CFSecurityJavaFX.*; import net.sourceforge.msscodefactory.cfinternet.v2_7.CFInternetJavaFX.*; /** * CFBamJavaFXUInt16ColPickerPane JavaFX Pick Obj Pane implementation * for UInt16Col. */ public class CFBamJavaFXUInt16ColPickerPane extends CFBorderPane implements ICFBamJavaFXUInt16ColPaneList { public static String S_FormName = "Choose UInt16Col"; protected ICFBamJavaFXSchema javafxSchema = null; protected Collection<ICFBamUInt16ColObj> javafxDataCollection = null; protected ObservableList<ICFBamUInt16ColObj> observableListOfUInt16Col = null; protected TableColumn<ICFBamUInt16ColObj, Long> tableColumnId = null; protected TableColumn<ICFBamUInt16ColObj, String> tableColumnName = null; protected TableColumn<ICFBamUInt16ColObj, String> tableColumnShortName = null; protected TableColumn<ICFBamUInt16ColObj, String> tableColumnLabel = null; protected TableColumn<ICFBamUInt16ColObj, String> tableColumnShortDescription = null; protected TableColumn<ICFBamUInt16ColObj, String> tableColumnDescription = null; protected TableColumn<ICFBamUInt16ColObj, Boolean> tableColumnIsNullable = null; protected TableColumn<ICFBamUInt16ColObj, Boolean> tableColumnGenerateId = null; protected TableColumn<ICFBamUInt16ColObj, Boolean> tableColumnDefaultVisibility = null; protected TableColumn<ICFBamUInt16ColObj, String> tableColumnDbName = null; protected TableColumn<ICFBamUInt16ColObj, Integer> tableColumnInitValue = null; protected TableColumn<ICFBamUInt16ColObj, Integer> tableColumnDefaultValue = null; protected TableColumn<ICFBamUInt16ColObj, Integer> tableColumnMinValue = null; protected TableColumn<ICFBamUInt16ColObj, Integer> tableColumnMaxValue = null; protected TableColumn<ICFBamUInt16ColObj, Integer> tableColumnNullValue = null; protected TableColumn<ICFBamUInt16ColObj, Integer> tableColumnUnknownValue = null; protected TableColumn<ICFBamUInt16ColObj, ICFBamSchemaDefObj> tableColumnLookupDefSchema = null; protected TableView<ICFBamUInt16ColObj> dataTable = null; protected CFHBox hboxMenu = null; public final String S_ColumnNames[] = { "Name" }; protected ICFFormManager cfFormManager = null; protected ICFBamJavaFXUInt16ColChosen invokeWhenChosen = null; protected ICFBamTableObj javafxContainer = null; protected CFButton buttonCancel = null; protected CFButton buttonChooseNone = null; protected CFButton buttonChooseSelected = null; public CFBamJavaFXUInt16ColPickerPane(ICFFormManager formManager, ICFBamJavaFXSchema argSchema, ICFBamUInt16ColObj argFocus, ICFBamTableObj argContainer, Collection<ICFBamUInt16ColObj> argDataCollection, ICFBamJavaFXUInt16ColChosen whenChosen) { super(); 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<ICFBamUInt16ColObj>(); tableColumnId = new TableColumn<ICFBamUInt16ColObj, Long>("Id"); tableColumnId.setCellValueFactory( new Callback<CellDataFeatures<ICFBamUInt16ColObj, Long>, ObservableValue<Long>>() { public ObservableValue<Long> call(CellDataFeatures<ICFBamUInt16ColObj, 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<ICFBamUInt16ColObj, Long>, TableCell<ICFBamUInt16ColObj, Long>>() { @Override public TableCell<ICFBamUInt16ColObj, Long> call(TableColumn<ICFBamUInt16ColObj, Long> arg) { return new CFInt64TableCell<ICFBamUInt16ColObj>(); } }); dataTable.getColumns().add(tableColumnId); tableColumnName = new TableColumn<ICFBamUInt16ColObj, String>("Name"); tableColumnName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamUInt16ColObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamUInt16ColObj, 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<ICFBamUInt16ColObj, String>, TableCell<ICFBamUInt16ColObj, String>>() { @Override public TableCell<ICFBamUInt16ColObj, String> call(TableColumn<ICFBamUInt16ColObj, String> arg) { return new CFStringTableCell<ICFBamUInt16ColObj>(); } }); dataTable.getColumns().add(tableColumnName); tableColumnShortName = new TableColumn<ICFBamUInt16ColObj, String>("Short Name"); tableColumnShortName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamUInt16ColObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamUInt16ColObj, 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<ICFBamUInt16ColObj, String>, TableCell<ICFBamUInt16ColObj, String>>() { @Override public TableCell<ICFBamUInt16ColObj, String> call(TableColumn<ICFBamUInt16ColObj, String> arg) { return new CFStringTableCell<ICFBamUInt16ColObj>(); } }); dataTable.getColumns().add(tableColumnShortName); tableColumnLabel = new TableColumn<ICFBamUInt16ColObj, String>("Label"); tableColumnLabel.setCellValueFactory( new Callback<CellDataFeatures<ICFBamUInt16ColObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamUInt16ColObj, 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<ICFBamUInt16ColObj, String>, TableCell<ICFBamUInt16ColObj, String>>() { @Override public TableCell<ICFBamUInt16ColObj, String> call(TableColumn<ICFBamUInt16ColObj, String> arg) { return new CFStringTableCell<ICFBamUInt16ColObj>(); } }); dataTable.getColumns().add(tableColumnLabel); tableColumnShortDescription = new TableColumn<ICFBamUInt16ColObj, String>("Short Description"); tableColumnShortDescription.setCellValueFactory( new Callback<CellDataFeatures<ICFBamUInt16ColObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamUInt16ColObj, 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<ICFBamUInt16ColObj, String>, TableCell<ICFBamUInt16ColObj, String>>() { @Override public TableCell<ICFBamUInt16ColObj, String> call(TableColumn<ICFBamUInt16ColObj, String> arg) { return new CFStringTableCell<ICFBamUInt16ColObj>(); } }); dataTable.getColumns().add(tableColumnShortDescription); tableColumnDescription = new TableColumn<ICFBamUInt16ColObj, String>("Description"); tableColumnDescription.setCellValueFactory( new Callback<CellDataFeatures<ICFBamUInt16ColObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamUInt16ColObj, 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<ICFBamUInt16ColObj, String>, TableCell<ICFBamUInt16ColObj, String>>() { @Override public TableCell<ICFBamUInt16ColObj, String> call(TableColumn<ICFBamUInt16ColObj, String> arg) { return new CFStringTableCell<ICFBamUInt16ColObj>(); } }); dataTable.getColumns().add(tableColumnDescription); tableColumnIsNullable = new TableColumn<ICFBamUInt16ColObj, Boolean>("Is Nullable"); tableColumnIsNullable.setCellValueFactory( new Callback<CellDataFeatures<ICFBamUInt16ColObj, Boolean>, ObservableValue<Boolean>>() { public ObservableValue<Boolean> call(CellDataFeatures<ICFBamUInt16ColObj, 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<ICFBamUInt16ColObj, Boolean>, TableCell<ICFBamUInt16ColObj, Boolean>>() { @Override public TableCell<ICFBamUInt16ColObj, Boolean> call( TableColumn<ICFBamUInt16ColObj, Boolean> arg) { return new CFBoolTableCell<ICFBamUInt16ColObj>(); } }); dataTable.getColumns().add(tableColumnIsNullable); tableColumnGenerateId = new TableColumn<ICFBamUInt16ColObj, Boolean>("Generate Id"); tableColumnGenerateId.setCellValueFactory( new Callback<CellDataFeatures<ICFBamUInt16ColObj, Boolean>, ObservableValue<Boolean>>() { public ObservableValue<Boolean> call(CellDataFeatures<ICFBamUInt16ColObj, 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<ICFBamUInt16ColObj, Boolean>, TableCell<ICFBamUInt16ColObj, Boolean>>() { @Override public TableCell<ICFBamUInt16ColObj, Boolean> call( TableColumn<ICFBamUInt16ColObj, Boolean> arg) { return new CFBoolTableCell<ICFBamUInt16ColObj>(); } }); dataTable.getColumns().add(tableColumnGenerateId); tableColumnDefaultVisibility = new TableColumn<ICFBamUInt16ColObj, Boolean>("Default Visibility"); tableColumnDefaultVisibility.setCellValueFactory( new Callback<CellDataFeatures<ICFBamUInt16ColObj, Boolean>, ObservableValue<Boolean>>() { public ObservableValue<Boolean> call(CellDataFeatures<ICFBamUInt16ColObj, 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<ICFBamUInt16ColObj, Boolean>, TableCell<ICFBamUInt16ColObj, Boolean>>() { @Override public TableCell<ICFBamUInt16ColObj, Boolean> call( TableColumn<ICFBamUInt16ColObj, Boolean> arg) { return new CFBoolTableCell<ICFBamUInt16ColObj>(); } }); dataTable.getColumns().add(tableColumnDefaultVisibility); tableColumnDbName = new TableColumn<ICFBamUInt16ColObj, String>("Db Name"); tableColumnDbName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamUInt16ColObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamUInt16ColObj, 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<ICFBamUInt16ColObj, String>, TableCell<ICFBamUInt16ColObj, String>>() { @Override public TableCell<ICFBamUInt16ColObj, String> call(TableColumn<ICFBamUInt16ColObj, String> arg) { return new CFStringTableCell<ICFBamUInt16ColObj>(); } }); dataTable.getColumns().add(tableColumnDbName); tableColumnInitValue = new TableColumn<ICFBamUInt16ColObj, Integer>("Init. Value"); tableColumnInitValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamUInt16ColObj, Integer>, ObservableValue<Integer>>() { public ObservableValue<Integer> call(CellDataFeatures<ICFBamUInt16ColObj, Integer> p) { ICFBamUInt16DefObj 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<ICFBamUInt16ColObj, Integer>, TableCell<ICFBamUInt16ColObj, Integer>>() { @Override public TableCell<ICFBamUInt16ColObj, Integer> call( TableColumn<ICFBamUInt16ColObj, Integer> arg) { return new CFUInt16TableCell<ICFBamUInt16ColObj>(); } }); dataTable.getColumns().add(tableColumnInitValue); tableColumnDefaultValue = new TableColumn<ICFBamUInt16ColObj, Integer>("Default Value"); tableColumnDefaultValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamUInt16ColObj, Integer>, ObservableValue<Integer>>() { public ObservableValue<Integer> call(CellDataFeatures<ICFBamUInt16ColObj, Integer> p) { ICFBamUInt16DefObj 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<ICFBamUInt16ColObj, Integer>, TableCell<ICFBamUInt16ColObj, Integer>>() { @Override public TableCell<ICFBamUInt16ColObj, Integer> call( TableColumn<ICFBamUInt16ColObj, Integer> arg) { return new CFUInt16TableCell<ICFBamUInt16ColObj>(); } }); dataTable.getColumns().add(tableColumnDefaultValue); tableColumnMinValue = new TableColumn<ICFBamUInt16ColObj, Integer>("Min. Value"); tableColumnMinValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamUInt16ColObj, Integer>, ObservableValue<Integer>>() { public ObservableValue<Integer> call(CellDataFeatures<ICFBamUInt16ColObj, Integer> p) { ICFBamUInt16DefObj 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<ICFBamUInt16ColObj, Integer>, TableCell<ICFBamUInt16ColObj, Integer>>() { @Override public TableCell<ICFBamUInt16ColObj, Integer> call( TableColumn<ICFBamUInt16ColObj, Integer> arg) { return new CFUInt16TableCell<ICFBamUInt16ColObj>(); } }); dataTable.getColumns().add(tableColumnMinValue); tableColumnMaxValue = new TableColumn<ICFBamUInt16ColObj, Integer>("Max. Value"); tableColumnMaxValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamUInt16ColObj, Integer>, ObservableValue<Integer>>() { public ObservableValue<Integer> call(CellDataFeatures<ICFBamUInt16ColObj, Integer> p) { ICFBamUInt16DefObj 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<ICFBamUInt16ColObj, Integer>, TableCell<ICFBamUInt16ColObj, Integer>>() { @Override public TableCell<ICFBamUInt16ColObj, Integer> call( TableColumn<ICFBamUInt16ColObj, Integer> arg) { return new CFUInt16TableCell<ICFBamUInt16ColObj>(); } }); dataTable.getColumns().add(tableColumnMaxValue); tableColumnNullValue = new TableColumn<ICFBamUInt16ColObj, Integer>("Null Value"); tableColumnNullValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamUInt16ColObj, Integer>, ObservableValue<Integer>>() { public ObservableValue<Integer> call(CellDataFeatures<ICFBamUInt16ColObj, Integer> p) { ICFBamUInt16DefObj 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<ICFBamUInt16ColObj, Integer>, TableCell<ICFBamUInt16ColObj, Integer>>() { @Override public TableCell<ICFBamUInt16ColObj, Integer> call( TableColumn<ICFBamUInt16ColObj, Integer> arg) { return new CFUInt16TableCell<ICFBamUInt16ColObj>(); } }); dataTable.getColumns().add(tableColumnNullValue); tableColumnUnknownValue = new TableColumn<ICFBamUInt16ColObj, Integer>("Unknown Value"); tableColumnUnknownValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamUInt16ColObj, Integer>, ObservableValue<Integer>>() { public ObservableValue<Integer> call(CellDataFeatures<ICFBamUInt16ColObj, Integer> p) { ICFBamUInt16DefObj 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<ICFBamUInt16ColObj, Integer>, TableCell<ICFBamUInt16ColObj, Integer>>() { @Override public TableCell<ICFBamUInt16ColObj, Integer> call( TableColumn<ICFBamUInt16ColObj, Integer> arg) { return new CFUInt16TableCell<ICFBamUInt16ColObj>(); } }); dataTable.getColumns().add(tableColumnUnknownValue); tableColumnLookupDefSchema = new TableColumn<ICFBamUInt16ColObj, ICFBamSchemaDefObj>( "Defining Schema Definition"); tableColumnLookupDefSchema.setCellValueFactory( new Callback<CellDataFeatures<ICFBamUInt16ColObj, ICFBamSchemaDefObj>, ObservableValue<ICFBamSchemaDefObj>>() { public ObservableValue<ICFBamSchemaDefObj> call( CellDataFeatures<ICFBamUInt16ColObj, ICFBamSchemaDefObj> p) { ICFBamUInt16ColObj 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<ICFBamUInt16ColObj, ICFBamSchemaDefObj>, TableCell<ICFBamUInt16ColObj, ICFBamSchemaDefObj>>() { @Override public TableCell<ICFBamUInt16ColObj, ICFBamSchemaDefObj> call( TableColumn<ICFBamUInt16ColObj, ICFBamSchemaDefObj> arg) { return new CFReferenceTableCell<ICFBamUInt16ColObj, ICFBamSchemaDefObj>(); } }); dataTable.getColumns().add(tableColumnLookupDefSchema); dataTable.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<ICFBamUInt16ColObj>() { @Override public void changed(ObservableValue<? extends ICFBamUInt16ColObj> observable, ICFBamUInt16ColObj oldValue, ICFBamUInt16ColObj 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.choseUInt16Col(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"); } ICFBamUInt16ColObj selectedInstance = getJavaFXFocusAsUInt16Col(); invokeWhenChosen.choseUInt16Col(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); } public ICFFormManager getCFFormManager() { return (cfFormManager); } public void setCFFormManager(ICFFormManager value) { final String S_ProcName = "setCFFormManager"; if (value == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 1, "value"); } cfFormManager = value; } public ICFBamJavaFXSchema getJavaFXSchema() { return (javafxSchema); } public void setJavaFXFocus(ICFLibAnyObj value) { final String S_ProcName = "setJavaFXFocus"; if ((value == null) || (value instanceof ICFBamUInt16ColObj)) { super.setJavaFXFocus(value); } else { throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(), S_ProcName, "value", value, "ICFBamUInt16ColObj"); } if (dataTable == null) { return; } } public ICFBamUInt16ColObj getJavaFXFocusAsUInt16Col() { return ((ICFBamUInt16ColObj) getJavaFXFocus()); } public void setJavaFXFocusAsUInt16Col(ICFBamUInt16ColObj value) { setJavaFXFocus(value); } public class UInt16ColByQualNameComparator implements Comparator<ICFBamUInt16ColObj> { public UInt16ColByQualNameComparator() { } public int compare(ICFBamUInt16ColObj lhs, ICFBamUInt16ColObj rhs) { if (lhs == null) { if (rhs == null) { return (0); } else { return (-1); } } else if (rhs == null) { return (1); } else { String lhsValue = lhs.getObjQualifiedName(); String rhsValue = rhs.getObjQualifiedName(); if (lhsValue == null) { if (rhsValue == null) { return (0); } else { return (-1); } } else if (rhsValue == null) { return (1); } else { return (lhsValue.compareTo(rhsValue)); } } } } protected UInt16ColByQualNameComparator compareUInt16ColByQualName = new UInt16ColByQualNameComparator(); public Collection<ICFBamUInt16ColObj> getJavaFXDataCollection() { return (javafxDataCollection); } public void setJavaFXDataCollection(Collection<ICFBamUInt16ColObj> value) { final String S_ProcName = "setJavaFXDataCollection"; javafxDataCollection = value; observableListOfUInt16Col = null; if (javafxDataCollection != null) { observableListOfUInt16Col = FXCollections.observableArrayList(javafxDataCollection); observableListOfUInt16Col.sort(compareUInt16ColByQualName); } else { observableListOfUInt16Col = FXCollections.observableArrayList(); } if (dataTable != null) { dataTable.setItems(observableListOfUInt16Col); // Hack from stackoverflow to fix JavaFX TableView refresh issue ((TableColumn) dataTable.getColumns().get(0)).setVisible(false); ((TableColumn) dataTable.getColumns().get(0)).setVisible(true); } } public ICFBamTableObj getJavaFXContainer() { return (javafxContainer); } public void setJavaFXContainer(ICFBamTableObj value) { javafxContainer = value; } }