Java tutorial
// Description: Java 8 JavaFX Picker of Obj Pane implementation for UuidGen. /* * 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.*; /** * CFBamJavaFXUuidGenPickerPane JavaFX Pick Obj Pane implementation * for UuidGen. */ public class CFBamJavaFXUuidGenPickerPane extends CFBorderPane implements ICFBamJavaFXUuidGenPaneList { public static String S_FormName = "Choose UuidGen"; protected ICFBamJavaFXSchema javafxSchema = null; protected Collection<ICFBamUuidGenObj> javafxDataCollection = null; protected ObservableList<ICFBamUuidGenObj> observableListOfUuidGen = null; protected TableColumn<ICFBamUuidGenObj, Long> tableColumnId = null; protected TableColumn<ICFBamUuidGenObj, String> tableColumnName = null; protected TableColumn<ICFBamUuidGenObj, String> tableColumnShortName = null; protected TableColumn<ICFBamUuidGenObj, String> tableColumnLabel = null; protected TableColumn<ICFBamUuidGenObj, String> tableColumnShortDescription = null; protected TableColumn<ICFBamUuidGenObj, String> tableColumnDescription = null; protected TableColumn<ICFBamUuidGenObj, Boolean> tableColumnIsNullable = null; protected TableColumn<ICFBamUuidGenObj, Boolean> tableColumnGenerateId = null; protected TableColumn<ICFBamUuidGenObj, Boolean> tableColumnDefaultVisibility = null; protected TableColumn<ICFBamUuidGenObj, String> tableColumnDbName = null; protected TableColumn<ICFBamUuidGenObj, UUID> tableColumnInitValue = null; protected TableColumn<ICFBamUuidGenObj, UUID> tableColumnDefaultValue = null; protected TableColumn<ICFBamUuidGenObj, UUID> tableColumnNullValue = null; protected TableColumn<ICFBamUuidGenObj, UUID> tableColumnUnknownValue = null; protected TableColumn<ICFBamUuidGenObj, Short> tableColumnSlice = null; protected TableColumn<ICFBamUuidGenObj, Integer> tableColumnBlockSize = null; protected TableColumn<ICFBamUuidGenObj, ICFBamSchemaDefObj> tableColumnLookupDefSchema = null; protected TableView<ICFBamUuidGenObj> dataTable = null; protected CFHBox hboxMenu = null; public final String S_ColumnNames[] = { "Name" }; protected ICFFormManager cfFormManager = null; protected ICFBamJavaFXUuidGenChosen invokeWhenChosen = null; protected ICFBamSchemaDefObj javafxContainer = null; protected CFButton buttonCancel = null; protected CFButton buttonChooseNone = null; protected CFButton buttonChooseSelected = null; public CFBamJavaFXUuidGenPickerPane(ICFFormManager formManager, ICFBamJavaFXSchema argSchema, ICFBamUuidGenObj argFocus, ICFBamSchemaDefObj argContainer, Collection<ICFBamUuidGenObj> argDataCollection, ICFBamJavaFXUuidGenChosen 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<ICFBamUuidGenObj>(); tableColumnId = new TableColumn<ICFBamUuidGenObj, Long>("Id"); tableColumnId.setCellValueFactory( new Callback<CellDataFeatures<ICFBamUuidGenObj, Long>, ObservableValue<Long>>() { public ObservableValue<Long> call(CellDataFeatures<ICFBamUuidGenObj, 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<ICFBamUuidGenObj, Long>, TableCell<ICFBamUuidGenObj, Long>>() { @Override public TableCell<ICFBamUuidGenObj, Long> call(TableColumn<ICFBamUuidGenObj, Long> arg) { return new CFInt64TableCell<ICFBamUuidGenObj>(); } }); dataTable.getColumns().add(tableColumnId); tableColumnName = new TableColumn<ICFBamUuidGenObj, String>("Name"); tableColumnName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamUuidGenObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamUuidGenObj, 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<ICFBamUuidGenObj, String>, TableCell<ICFBamUuidGenObj, String>>() { @Override public TableCell<ICFBamUuidGenObj, String> call(TableColumn<ICFBamUuidGenObj, String> arg) { return new CFStringTableCell<ICFBamUuidGenObj>(); } }); dataTable.getColumns().add(tableColumnName); tableColumnShortName = new TableColumn<ICFBamUuidGenObj, String>("Short Name"); tableColumnShortName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamUuidGenObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamUuidGenObj, 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<ICFBamUuidGenObj, String>, TableCell<ICFBamUuidGenObj, String>>() { @Override public TableCell<ICFBamUuidGenObj, String> call(TableColumn<ICFBamUuidGenObj, String> arg) { return new CFStringTableCell<ICFBamUuidGenObj>(); } }); dataTable.getColumns().add(tableColumnShortName); tableColumnLabel = new TableColumn<ICFBamUuidGenObj, String>("Label"); tableColumnLabel.setCellValueFactory( new Callback<CellDataFeatures<ICFBamUuidGenObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamUuidGenObj, 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<ICFBamUuidGenObj, String>, TableCell<ICFBamUuidGenObj, String>>() { @Override public TableCell<ICFBamUuidGenObj, String> call(TableColumn<ICFBamUuidGenObj, String> arg) { return new CFStringTableCell<ICFBamUuidGenObj>(); } }); dataTable.getColumns().add(tableColumnLabel); tableColumnShortDescription = new TableColumn<ICFBamUuidGenObj, String>("Short Description"); tableColumnShortDescription.setCellValueFactory( new Callback<CellDataFeatures<ICFBamUuidGenObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamUuidGenObj, 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<ICFBamUuidGenObj, String>, TableCell<ICFBamUuidGenObj, String>>() { @Override public TableCell<ICFBamUuidGenObj, String> call(TableColumn<ICFBamUuidGenObj, String> arg) { return new CFStringTableCell<ICFBamUuidGenObj>(); } }); dataTable.getColumns().add(tableColumnShortDescription); tableColumnDescription = new TableColumn<ICFBamUuidGenObj, String>("Description"); tableColumnDescription.setCellValueFactory( new Callback<CellDataFeatures<ICFBamUuidGenObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamUuidGenObj, 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<ICFBamUuidGenObj, String>, TableCell<ICFBamUuidGenObj, String>>() { @Override public TableCell<ICFBamUuidGenObj, String> call(TableColumn<ICFBamUuidGenObj, String> arg) { return new CFStringTableCell<ICFBamUuidGenObj>(); } }); dataTable.getColumns().add(tableColumnDescription); tableColumnIsNullable = new TableColumn<ICFBamUuidGenObj, Boolean>("Is Nullable"); tableColumnIsNullable.setCellValueFactory( new Callback<CellDataFeatures<ICFBamUuidGenObj, Boolean>, ObservableValue<Boolean>>() { public ObservableValue<Boolean> call(CellDataFeatures<ICFBamUuidGenObj, 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<ICFBamUuidGenObj, Boolean>, TableCell<ICFBamUuidGenObj, Boolean>>() { @Override public TableCell<ICFBamUuidGenObj, Boolean> call(TableColumn<ICFBamUuidGenObj, Boolean> arg) { return new CFBoolTableCell<ICFBamUuidGenObj>(); } }); dataTable.getColumns().add(tableColumnIsNullable); tableColumnGenerateId = new TableColumn<ICFBamUuidGenObj, Boolean>("Generate Id"); tableColumnGenerateId.setCellValueFactory( new Callback<CellDataFeatures<ICFBamUuidGenObj, Boolean>, ObservableValue<Boolean>>() { public ObservableValue<Boolean> call(CellDataFeatures<ICFBamUuidGenObj, 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<ICFBamUuidGenObj, Boolean>, TableCell<ICFBamUuidGenObj, Boolean>>() { @Override public TableCell<ICFBamUuidGenObj, Boolean> call(TableColumn<ICFBamUuidGenObj, Boolean> arg) { return new CFBoolTableCell<ICFBamUuidGenObj>(); } }); dataTable.getColumns().add(tableColumnGenerateId); tableColumnDefaultVisibility = new TableColumn<ICFBamUuidGenObj, Boolean>("Default Visibility"); tableColumnDefaultVisibility.setCellValueFactory( new Callback<CellDataFeatures<ICFBamUuidGenObj, Boolean>, ObservableValue<Boolean>>() { public ObservableValue<Boolean> call(CellDataFeatures<ICFBamUuidGenObj, 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<ICFBamUuidGenObj, Boolean>, TableCell<ICFBamUuidGenObj, Boolean>>() { @Override public TableCell<ICFBamUuidGenObj, Boolean> call(TableColumn<ICFBamUuidGenObj, Boolean> arg) { return new CFBoolTableCell<ICFBamUuidGenObj>(); } }); dataTable.getColumns().add(tableColumnDefaultVisibility); tableColumnDbName = new TableColumn<ICFBamUuidGenObj, String>("Db Name"); tableColumnDbName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamUuidGenObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamUuidGenObj, 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<ICFBamUuidGenObj, String>, TableCell<ICFBamUuidGenObj, String>>() { @Override public TableCell<ICFBamUuidGenObj, String> call(TableColumn<ICFBamUuidGenObj, String> arg) { return new CFStringTableCell<ICFBamUuidGenObj>(); } }); dataTable.getColumns().add(tableColumnDbName); tableColumnInitValue = new TableColumn<ICFBamUuidGenObj, UUID>("Init. Value"); tableColumnInitValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamUuidGenObj, UUID>, ObservableValue<UUID>>() { public ObservableValue<UUID> call(CellDataFeatures<ICFBamUuidGenObj, UUID> p) { ICFBamUuidDefObj obj = p.getValue(); if (obj == null) { return (null); } else { UUID value = obj.getOptionalInitValue(); ReadOnlyObjectWrapper<UUID> observable = new ReadOnlyObjectWrapper<UUID>(); observable.setValue(value); return (observable); } } }); tableColumnInitValue.setCellFactory( new Callback<TableColumn<ICFBamUuidGenObj, UUID>, TableCell<ICFBamUuidGenObj, UUID>>() { @Override public TableCell<ICFBamUuidGenObj, UUID> call(TableColumn<ICFBamUuidGenObj, UUID> arg) { return new CFUuidTableCell<ICFBamUuidGenObj>(); } }); dataTable.getColumns().add(tableColumnInitValue); tableColumnDefaultValue = new TableColumn<ICFBamUuidGenObj, UUID>("Default Value"); tableColumnDefaultValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamUuidGenObj, UUID>, ObservableValue<UUID>>() { public ObservableValue<UUID> call(CellDataFeatures<ICFBamUuidGenObj, UUID> p) { ICFBamUuidDefObj obj = p.getValue(); if (obj == null) { return (null); } else { UUID value = obj.getOptionalDefaultValue(); ReadOnlyObjectWrapper<UUID> observable = new ReadOnlyObjectWrapper<UUID>(); observable.setValue(value); return (observable); } } }); tableColumnDefaultValue.setCellFactory( new Callback<TableColumn<ICFBamUuidGenObj, UUID>, TableCell<ICFBamUuidGenObj, UUID>>() { @Override public TableCell<ICFBamUuidGenObj, UUID> call(TableColumn<ICFBamUuidGenObj, UUID> arg) { return new CFUuidTableCell<ICFBamUuidGenObj>(); } }); dataTable.getColumns().add(tableColumnDefaultValue); tableColumnNullValue = new TableColumn<ICFBamUuidGenObj, UUID>("Null Value"); tableColumnNullValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamUuidGenObj, UUID>, ObservableValue<UUID>>() { public ObservableValue<UUID> call(CellDataFeatures<ICFBamUuidGenObj, UUID> p) { ICFBamUuidDefObj obj = p.getValue(); if (obj == null) { return (null); } else { UUID value = obj.getOptionalNullValue(); ReadOnlyObjectWrapper<UUID> observable = new ReadOnlyObjectWrapper<UUID>(); observable.setValue(value); return (observable); } } }); tableColumnNullValue.setCellFactory( new Callback<TableColumn<ICFBamUuidGenObj, UUID>, TableCell<ICFBamUuidGenObj, UUID>>() { @Override public TableCell<ICFBamUuidGenObj, UUID> call(TableColumn<ICFBamUuidGenObj, UUID> arg) { return new CFUuidTableCell<ICFBamUuidGenObj>(); } }); dataTable.getColumns().add(tableColumnNullValue); tableColumnUnknownValue = new TableColumn<ICFBamUuidGenObj, UUID>("Unknown Value"); tableColumnUnknownValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamUuidGenObj, UUID>, ObservableValue<UUID>>() { public ObservableValue<UUID> call(CellDataFeatures<ICFBamUuidGenObj, UUID> p) { ICFBamUuidDefObj obj = p.getValue(); if (obj == null) { return (null); } else { UUID value = obj.getOptionalUnknownValue(); ReadOnlyObjectWrapper<UUID> observable = new ReadOnlyObjectWrapper<UUID>(); observable.setValue(value); return (observable); } } }); tableColumnUnknownValue.setCellFactory( new Callback<TableColumn<ICFBamUuidGenObj, UUID>, TableCell<ICFBamUuidGenObj, UUID>>() { @Override public TableCell<ICFBamUuidGenObj, UUID> call(TableColumn<ICFBamUuidGenObj, UUID> arg) { return new CFUuidTableCell<ICFBamUuidGenObj>(); } }); dataTable.getColumns().add(tableColumnUnknownValue); tableColumnSlice = new TableColumn<ICFBamUuidGenObj, Short>("Slice"); tableColumnSlice.setCellValueFactory( new Callback<CellDataFeatures<ICFBamUuidGenObj, Short>, ObservableValue<Short>>() { public ObservableValue<Short> call(CellDataFeatures<ICFBamUuidGenObj, Short> p) { ICFBamUuidGenObj 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<ICFBamUuidGenObj, Short>, TableCell<ICFBamUuidGenObj, Short>>() { @Override public TableCell<ICFBamUuidGenObj, Short> call(TableColumn<ICFBamUuidGenObj, Short> arg) { return new CFInt16TableCell<ICFBamUuidGenObj>(); } }); dataTable.getColumns().add(tableColumnSlice); tableColumnBlockSize = new TableColumn<ICFBamUuidGenObj, Integer>("BlockSize"); tableColumnBlockSize.setCellValueFactory( new Callback<CellDataFeatures<ICFBamUuidGenObj, Integer>, ObservableValue<Integer>>() { public ObservableValue<Integer> call(CellDataFeatures<ICFBamUuidGenObj, Integer> p) { ICFBamUuidGenObj 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<ICFBamUuidGenObj, Integer>, TableCell<ICFBamUuidGenObj, Integer>>() { @Override public TableCell<ICFBamUuidGenObj, Integer> call(TableColumn<ICFBamUuidGenObj, Integer> arg) { return new CFInt32TableCell<ICFBamUuidGenObj>(); } }); dataTable.getColumns().add(tableColumnBlockSize); tableColumnLookupDefSchema = new TableColumn<ICFBamUuidGenObj, ICFBamSchemaDefObj>( "Defining Schema Definition"); tableColumnLookupDefSchema.setCellValueFactory( new Callback<CellDataFeatures<ICFBamUuidGenObj, ICFBamSchemaDefObj>, ObservableValue<ICFBamSchemaDefObj>>() { public ObservableValue<ICFBamSchemaDefObj> call( CellDataFeatures<ICFBamUuidGenObj, ICFBamSchemaDefObj> p) { ICFBamUuidGenObj 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<ICFBamUuidGenObj, ICFBamSchemaDefObj>, TableCell<ICFBamUuidGenObj, ICFBamSchemaDefObj>>() { @Override public TableCell<ICFBamUuidGenObj, ICFBamSchemaDefObj> call( TableColumn<ICFBamUuidGenObj, ICFBamSchemaDefObj> arg) { return new CFReferenceTableCell<ICFBamUuidGenObj, ICFBamSchemaDefObj>(); } }); dataTable.getColumns().add(tableColumnLookupDefSchema); dataTable.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<ICFBamUuidGenObj>() { @Override public void changed(ObservableValue<? extends ICFBamUuidGenObj> observable, ICFBamUuidGenObj oldValue, ICFBamUuidGenObj 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.choseUuidGen(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"); } ICFBamUuidGenObj selectedInstance = getJavaFXFocusAsUuidGen(); invokeWhenChosen.choseUuidGen(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 ICFBamUuidGenObj)) { super.setJavaFXFocus(value); } else { throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(), S_ProcName, "value", value, "ICFBamUuidGenObj"); } if (dataTable == null) { return; } } public ICFBamUuidGenObj getJavaFXFocusAsUuidGen() { return ((ICFBamUuidGenObj) getJavaFXFocus()); } public void setJavaFXFocusAsUuidGen(ICFBamUuidGenObj value) { setJavaFXFocus(value); } public class UuidGenByQualNameComparator implements Comparator<ICFBamUuidGenObj> { public UuidGenByQualNameComparator() { } public int compare(ICFBamUuidGenObj lhs, ICFBamUuidGenObj 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 UuidGenByQualNameComparator compareUuidGenByQualName = new UuidGenByQualNameComparator(); public Collection<ICFBamUuidGenObj> getJavaFXDataCollection() { return (javafxDataCollection); } public void setJavaFXDataCollection(Collection<ICFBamUuidGenObj> value) { final String S_ProcName = "setJavaFXDataCollection"; javafxDataCollection = value; observableListOfUuidGen = null; if (javafxDataCollection != null) { observableListOfUuidGen = FXCollections.observableArrayList(javafxDataCollection); observableListOfUuidGen.sort(compareUuidGenByQualName); } else { observableListOfUuidGen = FXCollections.observableArrayList(); } if (dataTable != null) { dataTable.setItems(observableListOfUuidGen); // Hack from stackoverflow to fix JavaFX TableView refresh issue ((TableColumn) dataTable.getColumns().get(0)).setVisible(false); ((TableColumn) dataTable.getColumns().get(0)).setVisible(true); } } public ICFBamSchemaDefObj getJavaFXContainer() { return (javafxContainer); } public void setJavaFXContainer(ICFBamSchemaDefObj value) { javafxContainer = value; } }