List of usage examples for javafx.event EventHandler EventHandler
EventHandler
From source file:net.sourceforge.msscodefactory.cfbam.v2_7.CFBamJavaFX.CFBamJavaFXTextTypePickerPane.java
public CFBamJavaFXTextTypePickerPane(ICFFormManager formManager, ICFBamJavaFXSchema argSchema, ICFBamTextTypeObj argFocus, ICFBamSchemaDefObj argContainer, Collection<ICFBamTextTypeObj> argDataCollection, ICFBamJavaFXTextTypeChosen whenChosen) { super();/*from w ww . jav a 2 s . com*/ 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<ICFBamTextTypeObj>(); tableColumnId = new TableColumn<ICFBamTextTypeObj, Long>("Id"); tableColumnId.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTextTypeObj, Long>, ObservableValue<Long>>() { public ObservableValue<Long> call(CellDataFeatures<ICFBamTextTypeObj, 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<ICFBamTextTypeObj, Long>, TableCell<ICFBamTextTypeObj, Long>>() { @Override public TableCell<ICFBamTextTypeObj, Long> call(TableColumn<ICFBamTextTypeObj, Long> arg) { return new CFInt64TableCell<ICFBamTextTypeObj>(); } }); dataTable.getColumns().add(tableColumnId); tableColumnName = new TableColumn<ICFBamTextTypeObj, String>("Name"); tableColumnName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTextTypeObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamTextTypeObj, 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<ICFBamTextTypeObj, String>, TableCell<ICFBamTextTypeObj, String>>() { @Override public TableCell<ICFBamTextTypeObj, String> call(TableColumn<ICFBamTextTypeObj, String> arg) { return new CFStringTableCell<ICFBamTextTypeObj>(); } }); dataTable.getColumns().add(tableColumnName); tableColumnShortName = new TableColumn<ICFBamTextTypeObj, String>("Short Name"); tableColumnShortName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTextTypeObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamTextTypeObj, 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<ICFBamTextTypeObj, String>, TableCell<ICFBamTextTypeObj, String>>() { @Override public TableCell<ICFBamTextTypeObj, String> call(TableColumn<ICFBamTextTypeObj, String> arg) { return new CFStringTableCell<ICFBamTextTypeObj>(); } }); dataTable.getColumns().add(tableColumnShortName); tableColumnLabel = new TableColumn<ICFBamTextTypeObj, String>("Label"); tableColumnLabel.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTextTypeObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamTextTypeObj, 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<ICFBamTextTypeObj, String>, TableCell<ICFBamTextTypeObj, String>>() { @Override public TableCell<ICFBamTextTypeObj, String> call(TableColumn<ICFBamTextTypeObj, String> arg) { return new CFStringTableCell<ICFBamTextTypeObj>(); } }); dataTable.getColumns().add(tableColumnLabel); tableColumnShortDescription = new TableColumn<ICFBamTextTypeObj, String>("Short Description"); tableColumnShortDescription.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTextTypeObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamTextTypeObj, 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<ICFBamTextTypeObj, String>, TableCell<ICFBamTextTypeObj, String>>() { @Override public TableCell<ICFBamTextTypeObj, String> call(TableColumn<ICFBamTextTypeObj, String> arg) { return new CFStringTableCell<ICFBamTextTypeObj>(); } }); dataTable.getColumns().add(tableColumnShortDescription); tableColumnDescription = new TableColumn<ICFBamTextTypeObj, String>("Description"); tableColumnDescription.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTextTypeObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamTextTypeObj, 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<ICFBamTextTypeObj, String>, TableCell<ICFBamTextTypeObj, String>>() { @Override public TableCell<ICFBamTextTypeObj, String> call(TableColumn<ICFBamTextTypeObj, String> arg) { return new CFStringTableCell<ICFBamTextTypeObj>(); } }); dataTable.getColumns().add(tableColumnDescription); tableColumnIsNullable = new TableColumn<ICFBamTextTypeObj, Boolean>("Is Nullable"); tableColumnIsNullable.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTextTypeObj, Boolean>, ObservableValue<Boolean>>() { public ObservableValue<Boolean> call(CellDataFeatures<ICFBamTextTypeObj, 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<ICFBamTextTypeObj, Boolean>, TableCell<ICFBamTextTypeObj, Boolean>>() { @Override public TableCell<ICFBamTextTypeObj, Boolean> call(TableColumn<ICFBamTextTypeObj, Boolean> arg) { return new CFBoolTableCell<ICFBamTextTypeObj>(); } }); dataTable.getColumns().add(tableColumnIsNullable); tableColumnGenerateId = new TableColumn<ICFBamTextTypeObj, Boolean>("Generate Id"); tableColumnGenerateId.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTextTypeObj, Boolean>, ObservableValue<Boolean>>() { public ObservableValue<Boolean> call(CellDataFeatures<ICFBamTextTypeObj, 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<ICFBamTextTypeObj, Boolean>, TableCell<ICFBamTextTypeObj, Boolean>>() { @Override public TableCell<ICFBamTextTypeObj, Boolean> call(TableColumn<ICFBamTextTypeObj, Boolean> arg) { return new CFBoolTableCell<ICFBamTextTypeObj>(); } }); dataTable.getColumns().add(tableColumnGenerateId); tableColumnDefaultVisibility = new TableColumn<ICFBamTextTypeObj, Boolean>("Default Visibility"); tableColumnDefaultVisibility.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTextTypeObj, Boolean>, ObservableValue<Boolean>>() { public ObservableValue<Boolean> call(CellDataFeatures<ICFBamTextTypeObj, 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<ICFBamTextTypeObj, Boolean>, TableCell<ICFBamTextTypeObj, Boolean>>() { @Override public TableCell<ICFBamTextTypeObj, Boolean> call(TableColumn<ICFBamTextTypeObj, Boolean> arg) { return new CFBoolTableCell<ICFBamTextTypeObj>(); } }); dataTable.getColumns().add(tableColumnDefaultVisibility); tableColumnDbName = new TableColumn<ICFBamTextTypeObj, String>("Db Name"); tableColumnDbName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTextTypeObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamTextTypeObj, 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<ICFBamTextTypeObj, String>, TableCell<ICFBamTextTypeObj, String>>() { @Override public TableCell<ICFBamTextTypeObj, String> call(TableColumn<ICFBamTextTypeObj, String> arg) { return new CFStringTableCell<ICFBamTextTypeObj>(); } }); dataTable.getColumns().add(tableColumnDbName); tableColumnMaxLen = new TableColumn<ICFBamTextTypeObj, Integer>("Max. Length"); tableColumnMaxLen.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTextTypeObj, Integer>, ObservableValue<Integer>>() { public ObservableValue<Integer> call(CellDataFeatures<ICFBamTextTypeObj, Integer> p) { ICFBamTextDefObj obj = p.getValue(); if (obj == null) { return (null); } else { int value = obj.getRequiredMaxLen(); Integer wrapped = new Integer(value); ReadOnlyObjectWrapper<Integer> observable = new ReadOnlyObjectWrapper<Integer>(); observable.setValue(wrapped); return (observable); } } }); tableColumnMaxLen.setCellFactory( new Callback<TableColumn<ICFBamTextTypeObj, Integer>, TableCell<ICFBamTextTypeObj, Integer>>() { @Override public TableCell<ICFBamTextTypeObj, Integer> call(TableColumn<ICFBamTextTypeObj, Integer> arg) { return new CFInt32TableCell<ICFBamTextTypeObj>(); } }); dataTable.getColumns().add(tableColumnMaxLen); tableColumnShowLines = new TableColumn<ICFBamTextTypeObj, Short>("Show Lines"); tableColumnShowLines.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTextTypeObj, Short>, ObservableValue<Short>>() { public ObservableValue<Short> call(CellDataFeatures<ICFBamTextTypeObj, Short> p) { ICFBamTextDefObj obj = p.getValue(); if (obj == null) { return (null); } else { short value = obj.getRequiredShowLines(); Short wrapped = new Short(value); ReadOnlyObjectWrapper<Short> observable = new ReadOnlyObjectWrapper<Short>(); observable.setValue(wrapped); return (observable); } } }); tableColumnShowLines.setCellFactory( new Callback<TableColumn<ICFBamTextTypeObj, Short>, TableCell<ICFBamTextTypeObj, Short>>() { @Override public TableCell<ICFBamTextTypeObj, Short> call(TableColumn<ICFBamTextTypeObj, Short> arg) { return new CFInt16TableCell<ICFBamTextTypeObj>(); } }); dataTable.getColumns().add(tableColumnShowLines); tableColumnInitValue = new TableColumn<ICFBamTextTypeObj, String>("Init. Value"); tableColumnInitValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTextTypeObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamTextTypeObj, String> p) { ICFBamTextDefObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getOptionalInitValue(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnInitValue.setCellFactory( new Callback<TableColumn<ICFBamTextTypeObj, String>, TableCell<ICFBamTextTypeObj, String>>() { @Override public TableCell<ICFBamTextTypeObj, String> call(TableColumn<ICFBamTextTypeObj, String> arg) { return new CFTextTableCell<ICFBamTextTypeObj>(); } }); dataTable.getColumns().add(tableColumnInitValue); tableColumnDefaultValue = new TableColumn<ICFBamTextTypeObj, String>("Default Value"); tableColumnDefaultValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTextTypeObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamTextTypeObj, String> p) { ICFBamTextDefObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getOptionalDefaultValue(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnDefaultValue.setCellFactory( new Callback<TableColumn<ICFBamTextTypeObj, String>, TableCell<ICFBamTextTypeObj, String>>() { @Override public TableCell<ICFBamTextTypeObj, String> call(TableColumn<ICFBamTextTypeObj, String> arg) { return new CFTextTableCell<ICFBamTextTypeObj>(); } }); dataTable.getColumns().add(tableColumnDefaultValue); tableColumnNullValue = new TableColumn<ICFBamTextTypeObj, String>("Null Value"); tableColumnNullValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTextTypeObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamTextTypeObj, String> p) { ICFBamTextDefObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getOptionalNullValue(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnNullValue.setCellFactory( new Callback<TableColumn<ICFBamTextTypeObj, String>, TableCell<ICFBamTextTypeObj, String>>() { @Override public TableCell<ICFBamTextTypeObj, String> call(TableColumn<ICFBamTextTypeObj, String> arg) { return new CFTextTableCell<ICFBamTextTypeObj>(); } }); dataTable.getColumns().add(tableColumnNullValue); tableColumnUnknownValue = new TableColumn<ICFBamTextTypeObj, String>("Unknown Value"); tableColumnUnknownValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTextTypeObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamTextTypeObj, String> p) { ICFBamTextDefObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getOptionalUnknownValue(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnUnknownValue.setCellFactory( new Callback<TableColumn<ICFBamTextTypeObj, String>, TableCell<ICFBamTextTypeObj, String>>() { @Override public TableCell<ICFBamTextTypeObj, String> call(TableColumn<ICFBamTextTypeObj, String> arg) { return new CFTextTableCell<ICFBamTextTypeObj>(); } }); dataTable.getColumns().add(tableColumnUnknownValue); tableColumnLookupDefSchema = new TableColumn<ICFBamTextTypeObj, ICFBamSchemaDefObj>( "Defining Schema Definition"); tableColumnLookupDefSchema.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTextTypeObj, ICFBamSchemaDefObj>, ObservableValue<ICFBamSchemaDefObj>>() { public ObservableValue<ICFBamSchemaDefObj> call( CellDataFeatures<ICFBamTextTypeObj, ICFBamSchemaDefObj> p) { ICFBamTextTypeObj 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<ICFBamTextTypeObj, ICFBamSchemaDefObj>, TableCell<ICFBamTextTypeObj, ICFBamSchemaDefObj>>() { @Override public TableCell<ICFBamTextTypeObj, ICFBamSchemaDefObj> call( TableColumn<ICFBamTextTypeObj, ICFBamSchemaDefObj> arg) { return new CFReferenceTableCell<ICFBamTextTypeObj, ICFBamSchemaDefObj>(); } }); dataTable.getColumns().add(tableColumnLookupDefSchema); dataTable.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<ICFBamTextTypeObj>() { @Override public void changed(ObservableValue<? extends ICFBamTextTypeObj> observable, ICFBamTextTypeObj oldValue, ICFBamTextTypeObj 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.choseTextType(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"); } ICFBamTextTypeObj selectedInstance = getJavaFXFocusAsTextType(); invokeWhenChosen.choseTextType(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.CFBamJavaFXTokenColPickerPane.java
public CFBamJavaFXTokenColPickerPane(ICFFormManager formManager, ICFBamJavaFXSchema argSchema, ICFBamTokenColObj argFocus, ICFBamTableObj argContainer, Collection<ICFBamTokenColObj> argDataCollection, ICFBamJavaFXTokenColChosen whenChosen) { super();//from w ww . j a va2 s .c o m final String S_ProcName = "construct-schema-focus"; if (formManager == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 1, "formManager"); } cfFormManager = formManager; if (argSchema == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 2, "argSchema"); } if (whenChosen == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 6, "whenChosen"); } invokeWhenChosen = whenChosen; // argFocus is optional; focus may be set later during execution as // conditions of the runtime change. javafxSchema = argSchema; javaFXFocus = argFocus; javafxContainer = argContainer; setJavaFXDataCollection(argDataCollection); dataTable = new TableView<ICFBamTokenColObj>(); tableColumnId = new TableColumn<ICFBamTokenColObj, Long>("Id"); tableColumnId.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTokenColObj, Long>, ObservableValue<Long>>() { public ObservableValue<Long> call(CellDataFeatures<ICFBamTokenColObj, 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<ICFBamTokenColObj, Long>, TableCell<ICFBamTokenColObj, Long>>() { @Override public TableCell<ICFBamTokenColObj, Long> call(TableColumn<ICFBamTokenColObj, Long> arg) { return new CFInt64TableCell<ICFBamTokenColObj>(); } }); dataTable.getColumns().add(tableColumnId); tableColumnName = new TableColumn<ICFBamTokenColObj, String>("Name"); tableColumnName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTokenColObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamTokenColObj, 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<ICFBamTokenColObj, String>, TableCell<ICFBamTokenColObj, String>>() { @Override public TableCell<ICFBamTokenColObj, String> call(TableColumn<ICFBamTokenColObj, String> arg) { return new CFStringTableCell<ICFBamTokenColObj>(); } }); dataTable.getColumns().add(tableColumnName); tableColumnShortName = new TableColumn<ICFBamTokenColObj, String>("Short Name"); tableColumnShortName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTokenColObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamTokenColObj, 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<ICFBamTokenColObj, String>, TableCell<ICFBamTokenColObj, String>>() { @Override public TableCell<ICFBamTokenColObj, String> call(TableColumn<ICFBamTokenColObj, String> arg) { return new CFStringTableCell<ICFBamTokenColObj>(); } }); dataTable.getColumns().add(tableColumnShortName); tableColumnLabel = new TableColumn<ICFBamTokenColObj, String>("Label"); tableColumnLabel.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTokenColObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamTokenColObj, 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<ICFBamTokenColObj, String>, TableCell<ICFBamTokenColObj, String>>() { @Override public TableCell<ICFBamTokenColObj, String> call(TableColumn<ICFBamTokenColObj, String> arg) { return new CFStringTableCell<ICFBamTokenColObj>(); } }); dataTable.getColumns().add(tableColumnLabel); tableColumnShortDescription = new TableColumn<ICFBamTokenColObj, String>("Short Description"); tableColumnShortDescription.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTokenColObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamTokenColObj, 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<ICFBamTokenColObj, String>, TableCell<ICFBamTokenColObj, String>>() { @Override public TableCell<ICFBamTokenColObj, String> call(TableColumn<ICFBamTokenColObj, String> arg) { return new CFStringTableCell<ICFBamTokenColObj>(); } }); dataTable.getColumns().add(tableColumnShortDescription); tableColumnDescription = new TableColumn<ICFBamTokenColObj, String>("Description"); tableColumnDescription.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTokenColObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamTokenColObj, 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<ICFBamTokenColObj, String>, TableCell<ICFBamTokenColObj, String>>() { @Override public TableCell<ICFBamTokenColObj, String> call(TableColumn<ICFBamTokenColObj, String> arg) { return new CFStringTableCell<ICFBamTokenColObj>(); } }); dataTable.getColumns().add(tableColumnDescription); tableColumnIsNullable = new TableColumn<ICFBamTokenColObj, Boolean>("Is Nullable"); tableColumnIsNullable.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTokenColObj, Boolean>, ObservableValue<Boolean>>() { public ObservableValue<Boolean> call(CellDataFeatures<ICFBamTokenColObj, 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<ICFBamTokenColObj, Boolean>, TableCell<ICFBamTokenColObj, Boolean>>() { @Override public TableCell<ICFBamTokenColObj, Boolean> call(TableColumn<ICFBamTokenColObj, Boolean> arg) { return new CFBoolTableCell<ICFBamTokenColObj>(); } }); dataTable.getColumns().add(tableColumnIsNullable); tableColumnGenerateId = new TableColumn<ICFBamTokenColObj, Boolean>("Generate Id"); tableColumnGenerateId.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTokenColObj, Boolean>, ObservableValue<Boolean>>() { public ObservableValue<Boolean> call(CellDataFeatures<ICFBamTokenColObj, 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<ICFBamTokenColObj, Boolean>, TableCell<ICFBamTokenColObj, Boolean>>() { @Override public TableCell<ICFBamTokenColObj, Boolean> call(TableColumn<ICFBamTokenColObj, Boolean> arg) { return new CFBoolTableCell<ICFBamTokenColObj>(); } }); dataTable.getColumns().add(tableColumnGenerateId); tableColumnDefaultVisibility = new TableColumn<ICFBamTokenColObj, Boolean>("Default Visibility"); tableColumnDefaultVisibility.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTokenColObj, Boolean>, ObservableValue<Boolean>>() { public ObservableValue<Boolean> call(CellDataFeatures<ICFBamTokenColObj, 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<ICFBamTokenColObj, Boolean>, TableCell<ICFBamTokenColObj, Boolean>>() { @Override public TableCell<ICFBamTokenColObj, Boolean> call(TableColumn<ICFBamTokenColObj, Boolean> arg) { return new CFBoolTableCell<ICFBamTokenColObj>(); } }); dataTable.getColumns().add(tableColumnDefaultVisibility); tableColumnDbName = new TableColumn<ICFBamTokenColObj, String>("Db Name"); tableColumnDbName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTokenColObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamTokenColObj, 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<ICFBamTokenColObj, String>, TableCell<ICFBamTokenColObj, String>>() { @Override public TableCell<ICFBamTokenColObj, String> call(TableColumn<ICFBamTokenColObj, String> arg) { return new CFStringTableCell<ICFBamTokenColObj>(); } }); dataTable.getColumns().add(tableColumnDbName); tableColumnMaxLen = new TableColumn<ICFBamTokenColObj, Integer>("Max. Length"); tableColumnMaxLen.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTokenColObj, Integer>, ObservableValue<Integer>>() { public ObservableValue<Integer> call(CellDataFeatures<ICFBamTokenColObj, Integer> p) { ICFBamTokenDefObj obj = p.getValue(); if (obj == null) { return (null); } else { int value = obj.getRequiredMaxLen(); Integer wrapped = new Integer(value); ReadOnlyObjectWrapper<Integer> observable = new ReadOnlyObjectWrapper<Integer>(); observable.setValue(wrapped); return (observable); } } }); tableColumnMaxLen.setCellFactory( new Callback<TableColumn<ICFBamTokenColObj, Integer>, TableCell<ICFBamTokenColObj, Integer>>() { @Override public TableCell<ICFBamTokenColObj, Integer> call(TableColumn<ICFBamTokenColObj, Integer> arg) { return new CFInt32TableCell<ICFBamTokenColObj>(); } }); dataTable.getColumns().add(tableColumnMaxLen); tableColumnInitValue = new TableColumn<ICFBamTokenColObj, String>("Init. Value"); tableColumnInitValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTokenColObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamTokenColObj, String> p) { ICFBamTokenDefObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getOptionalInitValue(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnInitValue.setCellFactory( new Callback<TableColumn<ICFBamTokenColObj, String>, TableCell<ICFBamTokenColObj, String>>() { @Override public TableCell<ICFBamTokenColObj, String> call(TableColumn<ICFBamTokenColObj, String> arg) { return new CFTokenTableCell<ICFBamTokenColObj>(); } }); dataTable.getColumns().add(tableColumnInitValue); tableColumnDefaultValue = new TableColumn<ICFBamTokenColObj, String>("Default Value"); tableColumnDefaultValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTokenColObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamTokenColObj, String> p) { ICFBamTokenDefObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getOptionalDefaultValue(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnDefaultValue.setCellFactory( new Callback<TableColumn<ICFBamTokenColObj, String>, TableCell<ICFBamTokenColObj, String>>() { @Override public TableCell<ICFBamTokenColObj, String> call(TableColumn<ICFBamTokenColObj, String> arg) { return new CFTokenTableCell<ICFBamTokenColObj>(); } }); dataTable.getColumns().add(tableColumnDefaultValue); tableColumnNullValue = new TableColumn<ICFBamTokenColObj, String>("Null Value"); tableColumnNullValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTokenColObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamTokenColObj, String> p) { ICFBamTokenDefObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getOptionalNullValue(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnNullValue.setCellFactory( new Callback<TableColumn<ICFBamTokenColObj, String>, TableCell<ICFBamTokenColObj, String>>() { @Override public TableCell<ICFBamTokenColObj, String> call(TableColumn<ICFBamTokenColObj, String> arg) { return new CFTokenTableCell<ICFBamTokenColObj>(); } }); dataTable.getColumns().add(tableColumnNullValue); tableColumnUnknownValue = new TableColumn<ICFBamTokenColObj, String>("Unknown Value"); tableColumnUnknownValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTokenColObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamTokenColObj, String> p) { ICFBamTokenDefObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getOptionalUnknownValue(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnUnknownValue.setCellFactory( new Callback<TableColumn<ICFBamTokenColObj, String>, TableCell<ICFBamTokenColObj, String>>() { @Override public TableCell<ICFBamTokenColObj, String> call(TableColumn<ICFBamTokenColObj, String> arg) { return new CFTokenTableCell<ICFBamTokenColObj>(); } }); dataTable.getColumns().add(tableColumnUnknownValue); tableColumnShowLines = new TableColumn<ICFBamTokenColObj, Short>("Show Lines"); tableColumnShowLines.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTokenColObj, Short>, ObservableValue<Short>>() { public ObservableValue<Short> call(CellDataFeatures<ICFBamTokenColObj, Short> p) { ICFBamTokenDefObj obj = p.getValue(); if (obj == null) { return (null); } else { short value = obj.getRequiredShowLines(); Short wrapped = new Short(value); ReadOnlyObjectWrapper<Short> observable = new ReadOnlyObjectWrapper<Short>(); observable.setValue(wrapped); return (observable); } } }); tableColumnShowLines.setCellFactory( new Callback<TableColumn<ICFBamTokenColObj, Short>, TableCell<ICFBamTokenColObj, Short>>() { @Override public TableCell<ICFBamTokenColObj, Short> call(TableColumn<ICFBamTokenColObj, Short> arg) { return new CFInt16TableCell<ICFBamTokenColObj>(); } }); dataTable.getColumns().add(tableColumnShowLines); tableColumnLookupDefSchema = new TableColumn<ICFBamTokenColObj, ICFBamSchemaDefObj>( "Defining Schema Definition"); tableColumnLookupDefSchema.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTokenColObj, ICFBamSchemaDefObj>, ObservableValue<ICFBamSchemaDefObj>>() { public ObservableValue<ICFBamSchemaDefObj> call( CellDataFeatures<ICFBamTokenColObj, ICFBamSchemaDefObj> p) { ICFBamTokenColObj 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<ICFBamTokenColObj, ICFBamSchemaDefObj>, TableCell<ICFBamTokenColObj, ICFBamSchemaDefObj>>() { @Override public TableCell<ICFBamTokenColObj, ICFBamSchemaDefObj> call( TableColumn<ICFBamTokenColObj, ICFBamSchemaDefObj> arg) { return new CFReferenceTableCell<ICFBamTokenColObj, ICFBamSchemaDefObj>(); } }); dataTable.getColumns().add(tableColumnLookupDefSchema); dataTable.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<ICFBamTokenColObj>() { @Override public void changed(ObservableValue<? extends ICFBamTokenColObj> observable, ICFBamTokenColObj oldValue, ICFBamTokenColObj 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.choseTokenCol(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"); } ICFBamTokenColObj selectedInstance = getJavaFXFocusAsTokenCol(); invokeWhenChosen.choseTokenCol(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.CFBamJavaFXFloatTypePickerPane.java
public CFBamJavaFXFloatTypePickerPane(ICFFormManager formManager, ICFBamJavaFXSchema argSchema, ICFBamFloatTypeObj argFocus, ICFBamSchemaDefObj argContainer, Collection<ICFBamFloatTypeObj> argDataCollection, ICFBamJavaFXFloatTypeChosen whenChosen) { super();//from w w w .jav 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"); } 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<ICFBamFloatTypeObj>(); tableColumnId = new TableColumn<ICFBamFloatTypeObj, Long>("Id"); tableColumnId.setCellValueFactory( new Callback<CellDataFeatures<ICFBamFloatTypeObj, Long>, ObservableValue<Long>>() { public ObservableValue<Long> call(CellDataFeatures<ICFBamFloatTypeObj, 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<ICFBamFloatTypeObj, Long>, TableCell<ICFBamFloatTypeObj, Long>>() { @Override public TableCell<ICFBamFloatTypeObj, Long> call(TableColumn<ICFBamFloatTypeObj, Long> arg) { return new CFInt64TableCell<ICFBamFloatTypeObj>(); } }); dataTable.getColumns().add(tableColumnId); tableColumnName = new TableColumn<ICFBamFloatTypeObj, String>("Name"); tableColumnName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamFloatTypeObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamFloatTypeObj, 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<ICFBamFloatTypeObj, String>, TableCell<ICFBamFloatTypeObj, String>>() { @Override public TableCell<ICFBamFloatTypeObj, String> call(TableColumn<ICFBamFloatTypeObj, String> arg) { return new CFStringTableCell<ICFBamFloatTypeObj>(); } }); dataTable.getColumns().add(tableColumnName); tableColumnShortName = new TableColumn<ICFBamFloatTypeObj, String>("Short Name"); tableColumnShortName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamFloatTypeObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamFloatTypeObj, 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<ICFBamFloatTypeObj, String>, TableCell<ICFBamFloatTypeObj, String>>() { @Override public TableCell<ICFBamFloatTypeObj, String> call(TableColumn<ICFBamFloatTypeObj, String> arg) { return new CFStringTableCell<ICFBamFloatTypeObj>(); } }); dataTable.getColumns().add(tableColumnShortName); tableColumnLabel = new TableColumn<ICFBamFloatTypeObj, String>("Label"); tableColumnLabel.setCellValueFactory( new Callback<CellDataFeatures<ICFBamFloatTypeObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamFloatTypeObj, 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<ICFBamFloatTypeObj, String>, TableCell<ICFBamFloatTypeObj, String>>() { @Override public TableCell<ICFBamFloatTypeObj, String> call(TableColumn<ICFBamFloatTypeObj, String> arg) { return new CFStringTableCell<ICFBamFloatTypeObj>(); } }); dataTable.getColumns().add(tableColumnLabel); tableColumnShortDescription = new TableColumn<ICFBamFloatTypeObj, String>("Short Description"); tableColumnShortDescription.setCellValueFactory( new Callback<CellDataFeatures<ICFBamFloatTypeObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamFloatTypeObj, 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<ICFBamFloatTypeObj, String>, TableCell<ICFBamFloatTypeObj, String>>() { @Override public TableCell<ICFBamFloatTypeObj, String> call(TableColumn<ICFBamFloatTypeObj, String> arg) { return new CFStringTableCell<ICFBamFloatTypeObj>(); } }); dataTable.getColumns().add(tableColumnShortDescription); tableColumnDescription = new TableColumn<ICFBamFloatTypeObj, String>("Description"); tableColumnDescription.setCellValueFactory( new Callback<CellDataFeatures<ICFBamFloatTypeObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamFloatTypeObj, 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<ICFBamFloatTypeObj, String>, TableCell<ICFBamFloatTypeObj, String>>() { @Override public TableCell<ICFBamFloatTypeObj, String> call(TableColumn<ICFBamFloatTypeObj, String> arg) { return new CFStringTableCell<ICFBamFloatTypeObj>(); } }); dataTable.getColumns().add(tableColumnDescription); tableColumnIsNullable = new TableColumn<ICFBamFloatTypeObj, Boolean>("Is Nullable"); tableColumnIsNullable.setCellValueFactory( new Callback<CellDataFeatures<ICFBamFloatTypeObj, Boolean>, ObservableValue<Boolean>>() { public ObservableValue<Boolean> call(CellDataFeatures<ICFBamFloatTypeObj, 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<ICFBamFloatTypeObj, Boolean>, TableCell<ICFBamFloatTypeObj, Boolean>>() { @Override public TableCell<ICFBamFloatTypeObj, Boolean> call( TableColumn<ICFBamFloatTypeObj, Boolean> arg) { return new CFBoolTableCell<ICFBamFloatTypeObj>(); } }); dataTable.getColumns().add(tableColumnIsNullable); tableColumnGenerateId = new TableColumn<ICFBamFloatTypeObj, Boolean>("Generate Id"); tableColumnGenerateId.setCellValueFactory( new Callback<CellDataFeatures<ICFBamFloatTypeObj, Boolean>, ObservableValue<Boolean>>() { public ObservableValue<Boolean> call(CellDataFeatures<ICFBamFloatTypeObj, 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<ICFBamFloatTypeObj, Boolean>, TableCell<ICFBamFloatTypeObj, Boolean>>() { @Override public TableCell<ICFBamFloatTypeObj, Boolean> call( TableColumn<ICFBamFloatTypeObj, Boolean> arg) { return new CFBoolTableCell<ICFBamFloatTypeObj>(); } }); dataTable.getColumns().add(tableColumnGenerateId); tableColumnDefaultVisibility = new TableColumn<ICFBamFloatTypeObj, Boolean>("Default Visibility"); tableColumnDefaultVisibility.setCellValueFactory( new Callback<CellDataFeatures<ICFBamFloatTypeObj, Boolean>, ObservableValue<Boolean>>() { public ObservableValue<Boolean> call(CellDataFeatures<ICFBamFloatTypeObj, 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<ICFBamFloatTypeObj, Boolean>, TableCell<ICFBamFloatTypeObj, Boolean>>() { @Override public TableCell<ICFBamFloatTypeObj, Boolean> call( TableColumn<ICFBamFloatTypeObj, Boolean> arg) { return new CFBoolTableCell<ICFBamFloatTypeObj>(); } }); dataTable.getColumns().add(tableColumnDefaultVisibility); tableColumnDbName = new TableColumn<ICFBamFloatTypeObj, String>("Db Name"); tableColumnDbName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamFloatTypeObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamFloatTypeObj, 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<ICFBamFloatTypeObj, String>, TableCell<ICFBamFloatTypeObj, String>>() { @Override public TableCell<ICFBamFloatTypeObj, String> call(TableColumn<ICFBamFloatTypeObj, String> arg) { return new CFStringTableCell<ICFBamFloatTypeObj>(); } }); dataTable.getColumns().add(tableColumnDbName); tableColumnInitValue = new TableColumn<ICFBamFloatTypeObj, Float>("Init. Value"); tableColumnInitValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamFloatTypeObj, Float>, ObservableValue<Float>>() { public ObservableValue<Float> call(CellDataFeatures<ICFBamFloatTypeObj, Float> p) { ICFBamFloatDefObj obj = p.getValue(); if (obj == null) { return (null); } else { Float value = obj.getOptionalInitValue(); ReadOnlyObjectWrapper<Float> observable = new ReadOnlyObjectWrapper<Float>(); observable.setValue(value); return (observable); } } }); tableColumnInitValue.setCellFactory( new Callback<TableColumn<ICFBamFloatTypeObj, Float>, TableCell<ICFBamFloatTypeObj, Float>>() { @Override public TableCell<ICFBamFloatTypeObj, Float> call(TableColumn<ICFBamFloatTypeObj, Float> arg) { return new CFFloatTableCell<ICFBamFloatTypeObj>(); } }); dataTable.getColumns().add(tableColumnInitValue); tableColumnDefaultValue = new TableColumn<ICFBamFloatTypeObj, Float>("Default Value"); tableColumnDefaultValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamFloatTypeObj, Float>, ObservableValue<Float>>() { public ObservableValue<Float> call(CellDataFeatures<ICFBamFloatTypeObj, Float> p) { ICFBamFloatDefObj obj = p.getValue(); if (obj == null) { return (null); } else { Float value = obj.getOptionalDefaultValue(); ReadOnlyObjectWrapper<Float> observable = new ReadOnlyObjectWrapper<Float>(); observable.setValue(value); return (observable); } } }); tableColumnDefaultValue.setCellFactory( new Callback<TableColumn<ICFBamFloatTypeObj, Float>, TableCell<ICFBamFloatTypeObj, Float>>() { @Override public TableCell<ICFBamFloatTypeObj, Float> call(TableColumn<ICFBamFloatTypeObj, Float> arg) { return new CFFloatTableCell<ICFBamFloatTypeObj>(); } }); dataTable.getColumns().add(tableColumnDefaultValue); tableColumnMinValue = new TableColumn<ICFBamFloatTypeObj, Float>("Min. Value"); tableColumnMinValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamFloatTypeObj, Float>, ObservableValue<Float>>() { public ObservableValue<Float> call(CellDataFeatures<ICFBamFloatTypeObj, Float> p) { ICFBamFloatDefObj obj = p.getValue(); if (obj == null) { return (null); } else { Float value = obj.getOptionalMinValue(); ReadOnlyObjectWrapper<Float> observable = new ReadOnlyObjectWrapper<Float>(); observable.setValue(value); return (observable); } } }); tableColumnMinValue.setCellFactory( new Callback<TableColumn<ICFBamFloatTypeObj, Float>, TableCell<ICFBamFloatTypeObj, Float>>() { @Override public TableCell<ICFBamFloatTypeObj, Float> call(TableColumn<ICFBamFloatTypeObj, Float> arg) { return new CFFloatTableCell<ICFBamFloatTypeObj>(); } }); dataTable.getColumns().add(tableColumnMinValue); tableColumnMaxValue = new TableColumn<ICFBamFloatTypeObj, Float>("Max. Value"); tableColumnMaxValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamFloatTypeObj, Float>, ObservableValue<Float>>() { public ObservableValue<Float> call(CellDataFeatures<ICFBamFloatTypeObj, Float> p) { ICFBamFloatDefObj obj = p.getValue(); if (obj == null) { return (null); } else { Float value = obj.getOptionalMaxValue(); ReadOnlyObjectWrapper<Float> observable = new ReadOnlyObjectWrapper<Float>(); observable.setValue(value); return (observable); } } }); tableColumnMaxValue.setCellFactory( new Callback<TableColumn<ICFBamFloatTypeObj, Float>, TableCell<ICFBamFloatTypeObj, Float>>() { @Override public TableCell<ICFBamFloatTypeObj, Float> call(TableColumn<ICFBamFloatTypeObj, Float> arg) { return new CFFloatTableCell<ICFBamFloatTypeObj>(); } }); dataTable.getColumns().add(tableColumnMaxValue); tableColumnNullValue = new TableColumn<ICFBamFloatTypeObj, Float>("Null Value"); tableColumnNullValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamFloatTypeObj, Float>, ObservableValue<Float>>() { public ObservableValue<Float> call(CellDataFeatures<ICFBamFloatTypeObj, Float> p) { ICFBamFloatDefObj obj = p.getValue(); if (obj == null) { return (null); } else { Float value = obj.getOptionalNullValue(); ReadOnlyObjectWrapper<Float> observable = new ReadOnlyObjectWrapper<Float>(); observable.setValue(value); return (observable); } } }); tableColumnNullValue.setCellFactory( new Callback<TableColumn<ICFBamFloatTypeObj, Float>, TableCell<ICFBamFloatTypeObj, Float>>() { @Override public TableCell<ICFBamFloatTypeObj, Float> call(TableColumn<ICFBamFloatTypeObj, Float> arg) { return new CFFloatTableCell<ICFBamFloatTypeObj>(); } }); dataTable.getColumns().add(tableColumnNullValue); tableColumnUnknownValue = new TableColumn<ICFBamFloatTypeObj, Float>("Unknown Value"); tableColumnUnknownValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamFloatTypeObj, Float>, ObservableValue<Float>>() { public ObservableValue<Float> call(CellDataFeatures<ICFBamFloatTypeObj, Float> p) { ICFBamFloatDefObj obj = p.getValue(); if (obj == null) { return (null); } else { Float value = obj.getOptionalUnknownValue(); ReadOnlyObjectWrapper<Float> observable = new ReadOnlyObjectWrapper<Float>(); observable.setValue(value); return (observable); } } }); tableColumnUnknownValue.setCellFactory( new Callback<TableColumn<ICFBamFloatTypeObj, Float>, TableCell<ICFBamFloatTypeObj, Float>>() { @Override public TableCell<ICFBamFloatTypeObj, Float> call(TableColumn<ICFBamFloatTypeObj, Float> arg) { return new CFFloatTableCell<ICFBamFloatTypeObj>(); } }); dataTable.getColumns().add(tableColumnUnknownValue); tableColumnLookupDefSchema = new TableColumn<ICFBamFloatTypeObj, ICFBamSchemaDefObj>( "Defining Schema Definition"); tableColumnLookupDefSchema.setCellValueFactory( new Callback<CellDataFeatures<ICFBamFloatTypeObj, ICFBamSchemaDefObj>, ObservableValue<ICFBamSchemaDefObj>>() { public ObservableValue<ICFBamSchemaDefObj> call( CellDataFeatures<ICFBamFloatTypeObj, ICFBamSchemaDefObj> p) { ICFBamFloatTypeObj 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<ICFBamFloatTypeObj, ICFBamSchemaDefObj>, TableCell<ICFBamFloatTypeObj, ICFBamSchemaDefObj>>() { @Override public TableCell<ICFBamFloatTypeObj, ICFBamSchemaDefObj> call( TableColumn<ICFBamFloatTypeObj, ICFBamSchemaDefObj> arg) { return new CFReferenceTableCell<ICFBamFloatTypeObj, ICFBamSchemaDefObj>(); } }); dataTable.getColumns().add(tableColumnLookupDefSchema); dataTable.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<ICFBamFloatTypeObj>() { @Override public void changed(ObservableValue<? extends ICFBamFloatTypeObj> observable, ICFBamFloatTypeObj oldValue, ICFBamFloatTypeObj 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.choseFloatType(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"); } ICFBamFloatTypeObj selectedInstance = getJavaFXFocusAsFloatType(); invokeWhenChosen.choseFloatType(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.CFBamJavaFXServerMethodListPane.java
public CFHBox getPanelHBoxMenu() { if (hboxMenu == null) { hboxMenu = new CFHBox(10); LinkedList<CFButton> list = new LinkedList<CFButton>(); vboxMenuAdd = new CFVBox(10); buttonAddServerMethod = new CFButton(); buttonAddServerMethod.setMinWidth(200); buttonAddServerMethod.setText("Add ServerMethod"); buttonAddServerMethod.setOnAction(new EventHandler<ActionEvent>() { @Override//from ww w.ja va 2s.c o m public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema(); ICFBamServerMethodObj obj = (ICFBamServerMethodObj) schemaObj.getServerMethodTableObj() .newInstance(); CFBorderPane frame = javafxSchema.getServerMethodFactory().newAddForm(cfFormManager, obj, getViewEditClosedCallback(), true); ICFBamServerMethodEditObj edit = (ICFBamServerMethodEditObj) (obj.beginEdit()); if (edit == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "edit"); } ICFSecurityTenantObj secTenant = schemaObj.getSecTenant(); edit.setRequiredOwnerTenant(secTenant); ICFBamTableObj container = (ICFBamTableObj) (getJavaFXContainer()); if (container == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "JavaFXContainer"); } edit.setRequiredContainerForTable(container); ICFBamJavaFXServerMethodPaneCommon jpanelCommon = (ICFBamJavaFXServerMethodPaneCommon) frame; jpanelCommon.setJavaFXFocus(obj); jpanelCommon.setPaneMode(CFPane.PaneMode.Add); cfFormManager.pushForm(frame); setLeft(null); adjustListButtons(); } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); if (javafxContainer instanceof ICFBamTableObj) { list.add(buttonAddServerMethod); } buttonAddServerObjFunc = new CFButton(); buttonAddServerObjFunc.setMinWidth(200); buttonAddServerObjFunc.setText("Add ServerObjFunc"); buttonAddServerObjFunc.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema(); ICFBamServerObjFuncObj obj = (ICFBamServerObjFuncObj) schemaObj.getServerObjFuncTableObj() .newInstance(); CFBorderPane frame = javafxSchema.getServerObjFuncFactory().newAddForm(cfFormManager, obj, getViewEditClosedCallback(), true); ICFBamServerObjFuncEditObj edit = (ICFBamServerObjFuncEditObj) (obj.beginEdit()); if (edit == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "edit"); } ICFSecurityTenantObj secTenant = schemaObj.getSecTenant(); edit.setRequiredOwnerTenant(secTenant); ICFBamTableObj container = (ICFBamTableObj) (getJavaFXContainer()); if (container == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "JavaFXContainer"); } edit.setRequiredContainerForTable(container); ICFBamJavaFXServerObjFuncPaneCommon jpanelCommon = (ICFBamJavaFXServerObjFuncPaneCommon) frame; jpanelCommon.setJavaFXFocus(obj); jpanelCommon.setPaneMode(CFPane.PaneMode.Add); cfFormManager.pushForm(frame); setLeft(null); adjustListButtons(); } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); if (javafxContainer instanceof ICFBamTableObj) { list.add(buttonAddServerObjFunc); } buttonAddServerProc = new CFButton(); buttonAddServerProc.setMinWidth(200); buttonAddServerProc.setText("Add ServerProc"); buttonAddServerProc.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema(); ICFBamServerProcObj obj = (ICFBamServerProcObj) schemaObj.getServerProcTableObj() .newInstance(); CFBorderPane frame = javafxSchema.getServerProcFactory().newAddForm(cfFormManager, obj, getViewEditClosedCallback(), true); ICFBamServerProcEditObj edit = (ICFBamServerProcEditObj) (obj.beginEdit()); if (edit == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "edit"); } ICFSecurityTenantObj secTenant = schemaObj.getSecTenant(); edit.setRequiredOwnerTenant(secTenant); ICFBamTableObj container = (ICFBamTableObj) (getJavaFXContainer()); if (container == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "JavaFXContainer"); } edit.setRequiredContainerForTable(container); ICFBamJavaFXServerProcPaneCommon jpanelCommon = (ICFBamJavaFXServerProcPaneCommon) frame; jpanelCommon.setJavaFXFocus(obj); jpanelCommon.setPaneMode(CFPane.PaneMode.Add); cfFormManager.pushForm(frame); setLeft(null); adjustListButtons(); } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); if (javafxContainer instanceof ICFBamTableObj) { list.add(buttonAddServerProc); } buttonAddServerListFunc = new CFButton(); buttonAddServerListFunc.setMinWidth(200); buttonAddServerListFunc.setText("Add ServerListFunc"); buttonAddServerListFunc.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema(); ICFBamServerListFuncObj obj = (ICFBamServerListFuncObj) schemaObj .getServerListFuncTableObj().newInstance(); CFBorderPane frame = javafxSchema.getServerListFuncFactory().newAddForm(cfFormManager, obj, getViewEditClosedCallback(), true); ICFBamServerListFuncEditObj edit = (ICFBamServerListFuncEditObj) (obj.beginEdit()); if (edit == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "edit"); } ICFSecurityTenantObj secTenant = schemaObj.getSecTenant(); edit.setRequiredOwnerTenant(secTenant); ICFBamTableObj container = (ICFBamTableObj) (getJavaFXContainer()); if (container == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "JavaFXContainer"); } edit.setRequiredContainerForTable(container); ICFBamJavaFXServerListFuncPaneCommon jpanelCommon = (ICFBamJavaFXServerListFuncPaneCommon) frame; jpanelCommon.setJavaFXFocus(obj); jpanelCommon.setPaneMode(CFPane.PaneMode.Add); cfFormManager.pushForm(frame); setLeft(null); adjustListButtons(); } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); if (javafxContainer instanceof ICFBamTableObj) { list.add(buttonAddServerListFunc); } int len = list.size(); CFButton arr[] = new CFButton[len]; Iterator<CFButton> iter = list.iterator(); int idx = 0; while (iter.hasNext()) { arr[idx++] = iter.next(); } Arrays.sort(arr, new CompareCFButtonByText()); for (idx = 0; idx < len; idx++) { vboxMenuAdd.getChildren().add(arr[idx]); } buttonCancelAdd = new CFButton(); buttonCancelAdd.setMinWidth(200); buttonCancelAdd.setText("Cancel Add..."); buttonCancelAdd.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { setLeft(null); adjustListButtons(); } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); vboxMenuAdd.getChildren().add(buttonCancelAdd); scrollMenuAdd = new ScrollPane(); scrollMenuAdd.setMinWidth(240); scrollMenuAdd.setMaxWidth(240); scrollMenuAdd.setFitToWidth(true); scrollMenuAdd.setHbarPolicy(ScrollBarPolicy.NEVER); scrollMenuAdd.setVbarPolicy(ScrollBarPolicy.AS_NEEDED); scrollMenuAdd.setContent(vboxMenuAdd); buttonAdd = new CFButton(); buttonAdd.setMinWidth(200); buttonAdd.setText("Add..."); buttonAdd.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { setLeft(scrollMenuAdd); adjustListButtons(); } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); hboxMenu.getChildren().add(buttonAdd); buttonViewSelected = new CFButton(); buttonViewSelected.setMinWidth(200); buttonViewSelected.setText("View Selected"); buttonViewSelected.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"); } ICFBamServerMethodObj selectedInstance = getJavaFXFocusAsServerMethod(); if (selectedInstance != null) { String classCode = selectedInstance.getClassCode(); if ("SRVM".equals(classCode)) { CFBorderPane frame = javafxSchema.getServerMethodFactory().newViewEditForm( cfFormManager, selectedInstance, getViewEditClosedCallback(), false); ((ICFBamJavaFXServerMethodPaneCommon) frame).setPaneMode(CFPane.PaneMode.View); cfFormManager.pushForm(frame); } else if ("SRVO".equals(classCode)) { ICFBamServerObjFuncObj obj = (ICFBamServerObjFuncObj) selectedInstance; CFBorderPane frame = javafxSchema.getServerObjFuncFactory() .newViewEditForm(cfFormManager, obj, getViewEditClosedCallback(), false); ((ICFBamJavaFXServerObjFuncPaneCommon) frame).setPaneMode(CFPane.PaneMode.View); cfFormManager.pushForm(frame); } else if ("SRVP".equals(classCode)) { ICFBamServerProcObj obj = (ICFBamServerProcObj) selectedInstance; CFBorderPane frame = javafxSchema.getServerProcFactory() .newViewEditForm(cfFormManager, obj, getViewEditClosedCallback(), false); ((ICFBamJavaFXServerProcPaneCommon) frame).setPaneMode(CFPane.PaneMode.View); cfFormManager.pushForm(frame); } else if ("SRVL".equals(classCode)) { ICFBamServerListFuncObj obj = (ICFBamServerListFuncObj) selectedInstance; CFBorderPane frame = javafxSchema.getServerListFuncFactory() .newViewEditForm(cfFormManager, obj, getViewEditClosedCallback(), false); ((ICFBamJavaFXServerListFuncPaneCommon) frame).setPaneMode(CFPane.PaneMode.View); cfFormManager.pushForm(frame); } else { throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(), S_ProcName, "selectedInstance", selectedInstance, "ICFBamServerMethodObj, ICFBamServerObjFuncObj, ICFBamServerProcObj, ICFBamServerListFuncObj"); } } } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); hboxMenu.getChildren().add(buttonViewSelected); buttonEditSelected = new CFButton(); buttonEditSelected.setMinWidth(200); buttonEditSelected.setText("Edit Selected"); buttonEditSelected.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"); } ICFBamServerMethodObj selectedInstance = getJavaFXFocusAsServerMethod(); if (selectedInstance != null) { String classCode = selectedInstance.getClassCode(); if ("SRVM".equals(classCode)) { CFBorderPane frame = javafxSchema.getServerMethodFactory().newViewEditForm( cfFormManager, selectedInstance, getViewEditClosedCallback(), false); ((ICFBamJavaFXServerMethodPaneCommon) frame).setPaneMode(CFPane.PaneMode.Edit); cfFormManager.pushForm(frame); } else if ("SRVO".equals(classCode)) { ICFBamServerObjFuncObj obj = (ICFBamServerObjFuncObj) selectedInstance; CFBorderPane frame = javafxSchema.getServerObjFuncFactory() .newViewEditForm(cfFormManager, obj, getViewEditClosedCallback(), false); ((ICFBamJavaFXServerObjFuncPaneCommon) frame).setPaneMode(CFPane.PaneMode.Edit); cfFormManager.pushForm(frame); } else if ("SRVP".equals(classCode)) { ICFBamServerProcObj obj = (ICFBamServerProcObj) selectedInstance; CFBorderPane frame = javafxSchema.getServerProcFactory() .newViewEditForm(cfFormManager, obj, getViewEditClosedCallback(), false); ((ICFBamJavaFXServerProcPaneCommon) frame).setPaneMode(CFPane.PaneMode.Edit); cfFormManager.pushForm(frame); } else if ("SRVL".equals(classCode)) { ICFBamServerListFuncObj obj = (ICFBamServerListFuncObj) selectedInstance; CFBorderPane frame = javafxSchema.getServerListFuncFactory() .newViewEditForm(cfFormManager, obj, getViewEditClosedCallback(), false); ((ICFBamJavaFXServerListFuncPaneCommon) frame).setPaneMode(CFPane.PaneMode.Edit); cfFormManager.pushForm(frame); } else { throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(), S_ProcName, "selectedInstance", selectedInstance, "ICFBamServerMethodObj, ICFBamServerObjFuncObj, ICFBamServerProcObj, ICFBamServerListFuncObj"); } } } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); hboxMenu.getChildren().add(buttonEditSelected); buttonDeleteSelected = new CFButton(); buttonDeleteSelected.setMinWidth(200); buttonDeleteSelected.setText("Delete Selected"); buttonDeleteSelected.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"); } ICFBamServerMethodObj selectedInstance = getJavaFXFocusAsServerMethod(); if (selectedInstance != null) { String classCode = selectedInstance.getClassCode(); if ("SRVM".equals(classCode)) { CFBorderPane frame = javafxSchema.getServerMethodFactory() .newAskDeleteForm(cfFormManager, selectedInstance, getDeleteCallback()); ((ICFBamJavaFXServerMethodPaneCommon) frame).setPaneMode(CFPane.PaneMode.View); cfFormManager.pushForm(frame); } else if ("SRVO".equals(classCode)) { ICFBamServerObjFuncObj obj = (ICFBamServerObjFuncObj) selectedInstance; CFBorderPane frame = javafxSchema.getServerObjFuncFactory() .newAskDeleteForm(cfFormManager, obj, getDeleteCallback()); ((ICFBamJavaFXServerObjFuncPaneCommon) frame).setPaneMode(CFPane.PaneMode.View); cfFormManager.pushForm(frame); } else if ("SRVP".equals(classCode)) { ICFBamServerProcObj obj = (ICFBamServerProcObj) selectedInstance; CFBorderPane frame = javafxSchema.getServerProcFactory() .newAskDeleteForm(cfFormManager, obj, getDeleteCallback()); ((ICFBamJavaFXServerProcPaneCommon) frame).setPaneMode(CFPane.PaneMode.View); cfFormManager.pushForm(frame); } else if ("SRVL".equals(classCode)) { ICFBamServerListFuncObj obj = (ICFBamServerListFuncObj) selectedInstance; CFBorderPane frame = javafxSchema.getServerListFuncFactory() .newAskDeleteForm(cfFormManager, obj, getDeleteCallback()); ((ICFBamJavaFXServerListFuncPaneCommon) frame).setPaneMode(CFPane.PaneMode.View); cfFormManager.pushForm(frame); } else { throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(), S_ProcName, "selectedInstance", selectedInstance, "ICFBamServerMethodObj, ICFBamServerObjFuncObj, ICFBamServerProcObj, ICFBamServerListFuncObj"); } } } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); hboxMenu.getChildren().add(buttonDeleteSelected); } return (hboxMenu); }
From source file:net.sourceforge.msscodefactory.cfbam.v2_7.CFBamJavaFX.CFBamJavaFXDoubleColPickerPane.java
public CFBamJavaFXDoubleColPickerPane(ICFFormManager formManager, ICFBamJavaFXSchema argSchema, ICFBamDoubleColObj argFocus, ICFBamTableObj argContainer, Collection<ICFBamDoubleColObj> argDataCollection, ICFBamJavaFXDoubleColChosen whenChosen) { super();//from w w w. ja v a 2s. com 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<ICFBamDoubleColObj>(); tableColumnId = new TableColumn<ICFBamDoubleColObj, Long>("Id"); tableColumnId.setCellValueFactory( new Callback<CellDataFeatures<ICFBamDoubleColObj, Long>, ObservableValue<Long>>() { public ObservableValue<Long> call(CellDataFeatures<ICFBamDoubleColObj, 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<ICFBamDoubleColObj, Long>, TableCell<ICFBamDoubleColObj, Long>>() { @Override public TableCell<ICFBamDoubleColObj, Long> call(TableColumn<ICFBamDoubleColObj, Long> arg) { return new CFInt64TableCell<ICFBamDoubleColObj>(); } }); dataTable.getColumns().add(tableColumnId); tableColumnName = new TableColumn<ICFBamDoubleColObj, String>("Name"); tableColumnName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamDoubleColObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamDoubleColObj, 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<ICFBamDoubleColObj, String>, TableCell<ICFBamDoubleColObj, String>>() { @Override public TableCell<ICFBamDoubleColObj, String> call(TableColumn<ICFBamDoubleColObj, String> arg) { return new CFStringTableCell<ICFBamDoubleColObj>(); } }); dataTable.getColumns().add(tableColumnName); tableColumnShortName = new TableColumn<ICFBamDoubleColObj, String>("Short Name"); tableColumnShortName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamDoubleColObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamDoubleColObj, 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<ICFBamDoubleColObj, String>, TableCell<ICFBamDoubleColObj, String>>() { @Override public TableCell<ICFBamDoubleColObj, String> call(TableColumn<ICFBamDoubleColObj, String> arg) { return new CFStringTableCell<ICFBamDoubleColObj>(); } }); dataTable.getColumns().add(tableColumnShortName); tableColumnLabel = new TableColumn<ICFBamDoubleColObj, String>("Label"); tableColumnLabel.setCellValueFactory( new Callback<CellDataFeatures<ICFBamDoubleColObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamDoubleColObj, 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<ICFBamDoubleColObj, String>, TableCell<ICFBamDoubleColObj, String>>() { @Override public TableCell<ICFBamDoubleColObj, String> call(TableColumn<ICFBamDoubleColObj, String> arg) { return new CFStringTableCell<ICFBamDoubleColObj>(); } }); dataTable.getColumns().add(tableColumnLabel); tableColumnShortDescription = new TableColumn<ICFBamDoubleColObj, String>("Short Description"); tableColumnShortDescription.setCellValueFactory( new Callback<CellDataFeatures<ICFBamDoubleColObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamDoubleColObj, 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<ICFBamDoubleColObj, String>, TableCell<ICFBamDoubleColObj, String>>() { @Override public TableCell<ICFBamDoubleColObj, String> call(TableColumn<ICFBamDoubleColObj, String> arg) { return new CFStringTableCell<ICFBamDoubleColObj>(); } }); dataTable.getColumns().add(tableColumnShortDescription); tableColumnDescription = new TableColumn<ICFBamDoubleColObj, String>("Description"); tableColumnDescription.setCellValueFactory( new Callback<CellDataFeatures<ICFBamDoubleColObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamDoubleColObj, 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<ICFBamDoubleColObj, String>, TableCell<ICFBamDoubleColObj, String>>() { @Override public TableCell<ICFBamDoubleColObj, String> call(TableColumn<ICFBamDoubleColObj, String> arg) { return new CFStringTableCell<ICFBamDoubleColObj>(); } }); dataTable.getColumns().add(tableColumnDescription); tableColumnIsNullable = new TableColumn<ICFBamDoubleColObj, Boolean>("Is Nullable"); tableColumnIsNullable.setCellValueFactory( new Callback<CellDataFeatures<ICFBamDoubleColObj, Boolean>, ObservableValue<Boolean>>() { public ObservableValue<Boolean> call(CellDataFeatures<ICFBamDoubleColObj, 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<ICFBamDoubleColObj, Boolean>, TableCell<ICFBamDoubleColObj, Boolean>>() { @Override public TableCell<ICFBamDoubleColObj, Boolean> call( TableColumn<ICFBamDoubleColObj, Boolean> arg) { return new CFBoolTableCell<ICFBamDoubleColObj>(); } }); dataTable.getColumns().add(tableColumnIsNullable); tableColumnGenerateId = new TableColumn<ICFBamDoubleColObj, Boolean>("Generate Id"); tableColumnGenerateId.setCellValueFactory( new Callback<CellDataFeatures<ICFBamDoubleColObj, Boolean>, ObservableValue<Boolean>>() { public ObservableValue<Boolean> call(CellDataFeatures<ICFBamDoubleColObj, 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<ICFBamDoubleColObj, Boolean>, TableCell<ICFBamDoubleColObj, Boolean>>() { @Override public TableCell<ICFBamDoubleColObj, Boolean> call( TableColumn<ICFBamDoubleColObj, Boolean> arg) { return new CFBoolTableCell<ICFBamDoubleColObj>(); } }); dataTable.getColumns().add(tableColumnGenerateId); tableColumnDefaultVisibility = new TableColumn<ICFBamDoubleColObj, Boolean>("Default Visibility"); tableColumnDefaultVisibility.setCellValueFactory( new Callback<CellDataFeatures<ICFBamDoubleColObj, Boolean>, ObservableValue<Boolean>>() { public ObservableValue<Boolean> call(CellDataFeatures<ICFBamDoubleColObj, 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<ICFBamDoubleColObj, Boolean>, TableCell<ICFBamDoubleColObj, Boolean>>() { @Override public TableCell<ICFBamDoubleColObj, Boolean> call( TableColumn<ICFBamDoubleColObj, Boolean> arg) { return new CFBoolTableCell<ICFBamDoubleColObj>(); } }); dataTable.getColumns().add(tableColumnDefaultVisibility); tableColumnDbName = new TableColumn<ICFBamDoubleColObj, String>("Db Name"); tableColumnDbName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamDoubleColObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamDoubleColObj, 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<ICFBamDoubleColObj, String>, TableCell<ICFBamDoubleColObj, String>>() { @Override public TableCell<ICFBamDoubleColObj, String> call(TableColumn<ICFBamDoubleColObj, String> arg) { return new CFStringTableCell<ICFBamDoubleColObj>(); } }); dataTable.getColumns().add(tableColumnDbName); tableColumnInitValue = new TableColumn<ICFBamDoubleColObj, Double>("Init. Value"); tableColumnInitValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamDoubleColObj, Double>, ObservableValue<Double>>() { public ObservableValue<Double> call(CellDataFeatures<ICFBamDoubleColObj, Double> p) { ICFBamDoubleDefObj obj = p.getValue(); if (obj == null) { return (null); } else { Double value = obj.getOptionalInitValue(); ReadOnlyObjectWrapper<Double> observable = new ReadOnlyObjectWrapper<Double>(); observable.setValue(value); return (observable); } } }); tableColumnInitValue.setCellFactory( new Callback<TableColumn<ICFBamDoubleColObj, Double>, TableCell<ICFBamDoubleColObj, Double>>() { @Override public TableCell<ICFBamDoubleColObj, Double> call(TableColumn<ICFBamDoubleColObj, Double> arg) { return new CFDoubleTableCell<ICFBamDoubleColObj>(); } }); dataTable.getColumns().add(tableColumnInitValue); tableColumnDefaultValue = new TableColumn<ICFBamDoubleColObj, Double>("Default Value"); tableColumnDefaultValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamDoubleColObj, Double>, ObservableValue<Double>>() { public ObservableValue<Double> call(CellDataFeatures<ICFBamDoubleColObj, Double> p) { ICFBamDoubleDefObj obj = p.getValue(); if (obj == null) { return (null); } else { Double value = obj.getOptionalDefaultValue(); ReadOnlyObjectWrapper<Double> observable = new ReadOnlyObjectWrapper<Double>(); observable.setValue(value); return (observable); } } }); tableColumnDefaultValue.setCellFactory( new Callback<TableColumn<ICFBamDoubleColObj, Double>, TableCell<ICFBamDoubleColObj, Double>>() { @Override public TableCell<ICFBamDoubleColObj, Double> call(TableColumn<ICFBamDoubleColObj, Double> arg) { return new CFDoubleTableCell<ICFBamDoubleColObj>(); } }); dataTable.getColumns().add(tableColumnDefaultValue); tableColumnMinValue = new TableColumn<ICFBamDoubleColObj, Double>("Min. Value"); tableColumnMinValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamDoubleColObj, Double>, ObservableValue<Double>>() { public ObservableValue<Double> call(CellDataFeatures<ICFBamDoubleColObj, Double> p) { ICFBamDoubleDefObj obj = p.getValue(); if (obj == null) { return (null); } else { Double value = obj.getOptionalMinValue(); ReadOnlyObjectWrapper<Double> observable = new ReadOnlyObjectWrapper<Double>(); observable.setValue(value); return (observable); } } }); tableColumnMinValue.setCellFactory( new Callback<TableColumn<ICFBamDoubleColObj, Double>, TableCell<ICFBamDoubleColObj, Double>>() { @Override public TableCell<ICFBamDoubleColObj, Double> call(TableColumn<ICFBamDoubleColObj, Double> arg) { return new CFDoubleTableCell<ICFBamDoubleColObj>(); } }); dataTable.getColumns().add(tableColumnMinValue); tableColumnMaxValue = new TableColumn<ICFBamDoubleColObj, Double>("Max. Value"); tableColumnMaxValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamDoubleColObj, Double>, ObservableValue<Double>>() { public ObservableValue<Double> call(CellDataFeatures<ICFBamDoubleColObj, Double> p) { ICFBamDoubleDefObj obj = p.getValue(); if (obj == null) { return (null); } else { Double value = obj.getOptionalMaxValue(); ReadOnlyObjectWrapper<Double> observable = new ReadOnlyObjectWrapper<Double>(); observable.setValue(value); return (observable); } } }); tableColumnMaxValue.setCellFactory( new Callback<TableColumn<ICFBamDoubleColObj, Double>, TableCell<ICFBamDoubleColObj, Double>>() { @Override public TableCell<ICFBamDoubleColObj, Double> call(TableColumn<ICFBamDoubleColObj, Double> arg) { return new CFDoubleTableCell<ICFBamDoubleColObj>(); } }); dataTable.getColumns().add(tableColumnMaxValue); tableColumnNullValue = new TableColumn<ICFBamDoubleColObj, Double>("Null Value"); tableColumnNullValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamDoubleColObj, Double>, ObservableValue<Double>>() { public ObservableValue<Double> call(CellDataFeatures<ICFBamDoubleColObj, Double> p) { ICFBamDoubleDefObj obj = p.getValue(); if (obj == null) { return (null); } else { Double value = obj.getOptionalNullValue(); ReadOnlyObjectWrapper<Double> observable = new ReadOnlyObjectWrapper<Double>(); observable.setValue(value); return (observable); } } }); tableColumnNullValue.setCellFactory( new Callback<TableColumn<ICFBamDoubleColObj, Double>, TableCell<ICFBamDoubleColObj, Double>>() { @Override public TableCell<ICFBamDoubleColObj, Double> call(TableColumn<ICFBamDoubleColObj, Double> arg) { return new CFDoubleTableCell<ICFBamDoubleColObj>(); } }); dataTable.getColumns().add(tableColumnNullValue); tableColumnUnknownValue = new TableColumn<ICFBamDoubleColObj, Double>("Unknown Value"); tableColumnUnknownValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamDoubleColObj, Double>, ObservableValue<Double>>() { public ObservableValue<Double> call(CellDataFeatures<ICFBamDoubleColObj, Double> p) { ICFBamDoubleDefObj obj = p.getValue(); if (obj == null) { return (null); } else { Double value = obj.getOptionalUnknownValue(); ReadOnlyObjectWrapper<Double> observable = new ReadOnlyObjectWrapper<Double>(); observable.setValue(value); return (observable); } } }); tableColumnUnknownValue.setCellFactory( new Callback<TableColumn<ICFBamDoubleColObj, Double>, TableCell<ICFBamDoubleColObj, Double>>() { @Override public TableCell<ICFBamDoubleColObj, Double> call(TableColumn<ICFBamDoubleColObj, Double> arg) { return new CFDoubleTableCell<ICFBamDoubleColObj>(); } }); dataTable.getColumns().add(tableColumnUnknownValue); tableColumnLookupDefSchema = new TableColumn<ICFBamDoubleColObj, ICFBamSchemaDefObj>( "Defining Schema Definition"); tableColumnLookupDefSchema.setCellValueFactory( new Callback<CellDataFeatures<ICFBamDoubleColObj, ICFBamSchemaDefObj>, ObservableValue<ICFBamSchemaDefObj>>() { public ObservableValue<ICFBamSchemaDefObj> call( CellDataFeatures<ICFBamDoubleColObj, ICFBamSchemaDefObj> p) { ICFBamDoubleColObj 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<ICFBamDoubleColObj, ICFBamSchemaDefObj>, TableCell<ICFBamDoubleColObj, ICFBamSchemaDefObj>>() { @Override public TableCell<ICFBamDoubleColObj, ICFBamSchemaDefObj> call( TableColumn<ICFBamDoubleColObj, ICFBamSchemaDefObj> arg) { return new CFReferenceTableCell<ICFBamDoubleColObj, ICFBamSchemaDefObj>(); } }); dataTable.getColumns().add(tableColumnLookupDefSchema); dataTable.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<ICFBamDoubleColObj>() { @Override public void changed(ObservableValue<? extends ICFBamDoubleColObj> observable, ICFBamDoubleColObj oldValue, ICFBamDoubleColObj 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.choseDoubleCol(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"); } ICFBamDoubleColObj selectedInstance = getJavaFXFocusAsDoubleCol(); invokeWhenChosen.choseDoubleCol(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.CFBamJavaFXDateTypePickerPane.java
public CFBamJavaFXDateTypePickerPane(ICFFormManager formManager, ICFBamJavaFXSchema argSchema, ICFBamDateTypeObj argFocus, ICFBamSchemaDefObj argContainer, Collection<ICFBamDateTypeObj> argDataCollection, ICFBamJavaFXDateTypeChosen whenChosen) { super();/* w ww . ja v a2s . 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<ICFBamDateTypeObj>(); tableColumnId = new TableColumn<ICFBamDateTypeObj, Long>("Id"); tableColumnId.setCellValueFactory( new Callback<CellDataFeatures<ICFBamDateTypeObj, Long>, ObservableValue<Long>>() { public ObservableValue<Long> call(CellDataFeatures<ICFBamDateTypeObj, 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<ICFBamDateTypeObj, Long>, TableCell<ICFBamDateTypeObj, Long>>() { @Override public TableCell<ICFBamDateTypeObj, Long> call(TableColumn<ICFBamDateTypeObj, Long> arg) { return new CFInt64TableCell<ICFBamDateTypeObj>(); } }); dataTable.getColumns().add(tableColumnId); tableColumnName = new TableColumn<ICFBamDateTypeObj, String>("Name"); tableColumnName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamDateTypeObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamDateTypeObj, 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<ICFBamDateTypeObj, String>, TableCell<ICFBamDateTypeObj, String>>() { @Override public TableCell<ICFBamDateTypeObj, String> call(TableColumn<ICFBamDateTypeObj, String> arg) { return new CFStringTableCell<ICFBamDateTypeObj>(); } }); dataTable.getColumns().add(tableColumnName); tableColumnShortName = new TableColumn<ICFBamDateTypeObj, String>("Short Name"); tableColumnShortName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamDateTypeObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamDateTypeObj, 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<ICFBamDateTypeObj, String>, TableCell<ICFBamDateTypeObj, String>>() { @Override public TableCell<ICFBamDateTypeObj, String> call(TableColumn<ICFBamDateTypeObj, String> arg) { return new CFStringTableCell<ICFBamDateTypeObj>(); } }); dataTable.getColumns().add(tableColumnShortName); tableColumnLabel = new TableColumn<ICFBamDateTypeObj, String>("Label"); tableColumnLabel.setCellValueFactory( new Callback<CellDataFeatures<ICFBamDateTypeObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamDateTypeObj, 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<ICFBamDateTypeObj, String>, TableCell<ICFBamDateTypeObj, String>>() { @Override public TableCell<ICFBamDateTypeObj, String> call(TableColumn<ICFBamDateTypeObj, String> arg) { return new CFStringTableCell<ICFBamDateTypeObj>(); } }); dataTable.getColumns().add(tableColumnLabel); tableColumnShortDescription = new TableColumn<ICFBamDateTypeObj, String>("Short Description"); tableColumnShortDescription.setCellValueFactory( new Callback<CellDataFeatures<ICFBamDateTypeObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamDateTypeObj, 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<ICFBamDateTypeObj, String>, TableCell<ICFBamDateTypeObj, String>>() { @Override public TableCell<ICFBamDateTypeObj, String> call(TableColumn<ICFBamDateTypeObj, String> arg) { return new CFStringTableCell<ICFBamDateTypeObj>(); } }); dataTable.getColumns().add(tableColumnShortDescription); tableColumnDescription = new TableColumn<ICFBamDateTypeObj, String>("Description"); tableColumnDescription.setCellValueFactory( new Callback<CellDataFeatures<ICFBamDateTypeObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamDateTypeObj, 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<ICFBamDateTypeObj, String>, TableCell<ICFBamDateTypeObj, String>>() { @Override public TableCell<ICFBamDateTypeObj, String> call(TableColumn<ICFBamDateTypeObj, String> arg) { return new CFStringTableCell<ICFBamDateTypeObj>(); } }); dataTable.getColumns().add(tableColumnDescription); tableColumnIsNullable = new TableColumn<ICFBamDateTypeObj, Boolean>("Is Nullable"); tableColumnIsNullable.setCellValueFactory( new Callback<CellDataFeatures<ICFBamDateTypeObj, Boolean>, ObservableValue<Boolean>>() { public ObservableValue<Boolean> call(CellDataFeatures<ICFBamDateTypeObj, 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<ICFBamDateTypeObj, Boolean>, TableCell<ICFBamDateTypeObj, Boolean>>() { @Override public TableCell<ICFBamDateTypeObj, Boolean> call(TableColumn<ICFBamDateTypeObj, Boolean> arg) { return new CFBoolTableCell<ICFBamDateTypeObj>(); } }); dataTable.getColumns().add(tableColumnIsNullable); tableColumnGenerateId = new TableColumn<ICFBamDateTypeObj, Boolean>("Generate Id"); tableColumnGenerateId.setCellValueFactory( new Callback<CellDataFeatures<ICFBamDateTypeObj, Boolean>, ObservableValue<Boolean>>() { public ObservableValue<Boolean> call(CellDataFeatures<ICFBamDateTypeObj, 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<ICFBamDateTypeObj, Boolean>, TableCell<ICFBamDateTypeObj, Boolean>>() { @Override public TableCell<ICFBamDateTypeObj, Boolean> call(TableColumn<ICFBamDateTypeObj, Boolean> arg) { return new CFBoolTableCell<ICFBamDateTypeObj>(); } }); dataTable.getColumns().add(tableColumnGenerateId); tableColumnDefaultVisibility = new TableColumn<ICFBamDateTypeObj, Boolean>("Default Visibility"); tableColumnDefaultVisibility.setCellValueFactory( new Callback<CellDataFeatures<ICFBamDateTypeObj, Boolean>, ObservableValue<Boolean>>() { public ObservableValue<Boolean> call(CellDataFeatures<ICFBamDateTypeObj, 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<ICFBamDateTypeObj, Boolean>, TableCell<ICFBamDateTypeObj, Boolean>>() { @Override public TableCell<ICFBamDateTypeObj, Boolean> call(TableColumn<ICFBamDateTypeObj, Boolean> arg) { return new CFBoolTableCell<ICFBamDateTypeObj>(); } }); dataTable.getColumns().add(tableColumnDefaultVisibility); tableColumnDbName = new TableColumn<ICFBamDateTypeObj, String>("Db Name"); tableColumnDbName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamDateTypeObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamDateTypeObj, 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<ICFBamDateTypeObj, String>, TableCell<ICFBamDateTypeObj, String>>() { @Override public TableCell<ICFBamDateTypeObj, String> call(TableColumn<ICFBamDateTypeObj, String> arg) { return new CFStringTableCell<ICFBamDateTypeObj>(); } }); dataTable.getColumns().add(tableColumnDbName); tableColumnInitValue = new TableColumn<ICFBamDateTypeObj, Calendar>("Init. Value"); tableColumnInitValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamDateTypeObj, Calendar>, ObservableValue<Calendar>>() { public ObservableValue<Calendar> call(CellDataFeatures<ICFBamDateTypeObj, Calendar> p) { ICFBamDateDefObj obj = p.getValue(); if (obj == null) { return (null); } else { Calendar value = obj.getOptionalInitValue(); ReadOnlyObjectWrapper<Calendar> observable = new ReadOnlyObjectWrapper<Calendar>(); observable.setValue(value); return (observable); } } }); tableColumnInitValue.setCellFactory( new Callback<TableColumn<ICFBamDateTypeObj, Calendar>, TableCell<ICFBamDateTypeObj, Calendar>>() { @Override public TableCell<ICFBamDateTypeObj, Calendar> call( TableColumn<ICFBamDateTypeObj, Calendar> arg) { return new CFDateTableCell<ICFBamDateTypeObj>(); } }); dataTable.getColumns().add(tableColumnInitValue); tableColumnDefaultValue = new TableColumn<ICFBamDateTypeObj, Calendar>("Default Value"); tableColumnDefaultValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamDateTypeObj, Calendar>, ObservableValue<Calendar>>() { public ObservableValue<Calendar> call(CellDataFeatures<ICFBamDateTypeObj, Calendar> p) { ICFBamDateDefObj obj = p.getValue(); if (obj == null) { return (null); } else { Calendar value = obj.getOptionalDefaultValue(); ReadOnlyObjectWrapper<Calendar> observable = new ReadOnlyObjectWrapper<Calendar>(); observable.setValue(value); return (observable); } } }); tableColumnDefaultValue.setCellFactory( new Callback<TableColumn<ICFBamDateTypeObj, Calendar>, TableCell<ICFBamDateTypeObj, Calendar>>() { @Override public TableCell<ICFBamDateTypeObj, Calendar> call( TableColumn<ICFBamDateTypeObj, Calendar> arg) { return new CFDateTableCell<ICFBamDateTypeObj>(); } }); dataTable.getColumns().add(tableColumnDefaultValue); tableColumnMinValue = new TableColumn<ICFBamDateTypeObj, Calendar>("Min. Value"); tableColumnMinValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamDateTypeObj, Calendar>, ObservableValue<Calendar>>() { public ObservableValue<Calendar> call(CellDataFeatures<ICFBamDateTypeObj, Calendar> p) { ICFBamDateDefObj obj = p.getValue(); if (obj == null) { return (null); } else { Calendar value = obj.getOptionalMinValue(); ReadOnlyObjectWrapper<Calendar> observable = new ReadOnlyObjectWrapper<Calendar>(); observable.setValue(value); return (observable); } } }); tableColumnMinValue.setCellFactory( new Callback<TableColumn<ICFBamDateTypeObj, Calendar>, TableCell<ICFBamDateTypeObj, Calendar>>() { @Override public TableCell<ICFBamDateTypeObj, Calendar> call( TableColumn<ICFBamDateTypeObj, Calendar> arg) { return new CFDateTableCell<ICFBamDateTypeObj>(); } }); dataTable.getColumns().add(tableColumnMinValue); tableColumnMaxValue = new TableColumn<ICFBamDateTypeObj, Calendar>("Max. Value"); tableColumnMaxValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamDateTypeObj, Calendar>, ObservableValue<Calendar>>() { public ObservableValue<Calendar> call(CellDataFeatures<ICFBamDateTypeObj, Calendar> p) { ICFBamDateDefObj obj = p.getValue(); if (obj == null) { return (null); } else { Calendar value = obj.getOptionalMaxValue(); ReadOnlyObjectWrapper<Calendar> observable = new ReadOnlyObjectWrapper<Calendar>(); observable.setValue(value); return (observable); } } }); tableColumnMaxValue.setCellFactory( new Callback<TableColumn<ICFBamDateTypeObj, Calendar>, TableCell<ICFBamDateTypeObj, Calendar>>() { @Override public TableCell<ICFBamDateTypeObj, Calendar> call( TableColumn<ICFBamDateTypeObj, Calendar> arg) { return new CFDateTableCell<ICFBamDateTypeObj>(); } }); dataTable.getColumns().add(tableColumnMaxValue); tableColumnNullValue = new TableColumn<ICFBamDateTypeObj, Calendar>("Null Value"); tableColumnNullValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamDateTypeObj, Calendar>, ObservableValue<Calendar>>() { public ObservableValue<Calendar> call(CellDataFeatures<ICFBamDateTypeObj, Calendar> p) { ICFBamDateDefObj obj = p.getValue(); if (obj == null) { return (null); } else { Calendar value = obj.getOptionalNullValue(); ReadOnlyObjectWrapper<Calendar> observable = new ReadOnlyObjectWrapper<Calendar>(); observable.setValue(value); return (observable); } } }); tableColumnNullValue.setCellFactory( new Callback<TableColumn<ICFBamDateTypeObj, Calendar>, TableCell<ICFBamDateTypeObj, Calendar>>() { @Override public TableCell<ICFBamDateTypeObj, Calendar> call( TableColumn<ICFBamDateTypeObj, Calendar> arg) { return new CFDateTableCell<ICFBamDateTypeObj>(); } }); dataTable.getColumns().add(tableColumnNullValue); tableColumnUnknownValue = new TableColumn<ICFBamDateTypeObj, Calendar>("Unknown Value"); tableColumnUnknownValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamDateTypeObj, Calendar>, ObservableValue<Calendar>>() { public ObservableValue<Calendar> call(CellDataFeatures<ICFBamDateTypeObj, Calendar> p) { ICFBamDateDefObj obj = p.getValue(); if (obj == null) { return (null); } else { Calendar value = obj.getOptionalUnknownValue(); ReadOnlyObjectWrapper<Calendar> observable = new ReadOnlyObjectWrapper<Calendar>(); observable.setValue(value); return (observable); } } }); tableColumnUnknownValue.setCellFactory( new Callback<TableColumn<ICFBamDateTypeObj, Calendar>, TableCell<ICFBamDateTypeObj, Calendar>>() { @Override public TableCell<ICFBamDateTypeObj, Calendar> call( TableColumn<ICFBamDateTypeObj, Calendar> arg) { return new CFDateTableCell<ICFBamDateTypeObj>(); } }); dataTable.getColumns().add(tableColumnUnknownValue); tableColumnLookupDefSchema = new TableColumn<ICFBamDateTypeObj, ICFBamSchemaDefObj>( "Defining Schema Definition"); tableColumnLookupDefSchema.setCellValueFactory( new Callback<CellDataFeatures<ICFBamDateTypeObj, ICFBamSchemaDefObj>, ObservableValue<ICFBamSchemaDefObj>>() { public ObservableValue<ICFBamSchemaDefObj> call( CellDataFeatures<ICFBamDateTypeObj, ICFBamSchemaDefObj> p) { ICFBamDateTypeObj 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<ICFBamDateTypeObj, ICFBamSchemaDefObj>, TableCell<ICFBamDateTypeObj, ICFBamSchemaDefObj>>() { @Override public TableCell<ICFBamDateTypeObj, ICFBamSchemaDefObj> call( TableColumn<ICFBamDateTypeObj, ICFBamSchemaDefObj> arg) { return new CFReferenceTableCell<ICFBamDateTypeObj, ICFBamSchemaDefObj>(); } }); dataTable.getColumns().add(tableColumnLookupDefSchema); dataTable.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<ICFBamDateTypeObj>() { @Override public void changed(ObservableValue<? extends ICFBamDateTypeObj> observable, ICFBamDateTypeObj oldValue, ICFBamDateTypeObj 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.choseDateType(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"); } ICFBamDateTypeObj selectedInstance = getJavaFXFocusAsDateType(); invokeWhenChosen.choseDateType(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.CFBamJavaFXTokenTypePickerPane.java
public CFBamJavaFXTokenTypePickerPane(ICFFormManager formManager, ICFBamJavaFXSchema argSchema, ICFBamTokenTypeObj argFocus, ICFBamSchemaDefObj argContainer, Collection<ICFBamTokenTypeObj> argDataCollection, ICFBamJavaFXTokenTypeChosen whenChosen) { super();/*from www . j ava2 s. co m*/ final String S_ProcName = "construct-schema-focus"; if (formManager == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 1, "formManager"); } cfFormManager = formManager; if (argSchema == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 2, "argSchema"); } if (whenChosen == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 6, "whenChosen"); } invokeWhenChosen = whenChosen; // argFocus is optional; focus may be set later during execution as // conditions of the runtime change. javafxSchema = argSchema; javaFXFocus = argFocus; javafxContainer = argContainer; setJavaFXDataCollection(argDataCollection); dataTable = new TableView<ICFBamTokenTypeObj>(); tableColumnId = new TableColumn<ICFBamTokenTypeObj, Long>("Id"); tableColumnId.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTokenTypeObj, Long>, ObservableValue<Long>>() { public ObservableValue<Long> call(CellDataFeatures<ICFBamTokenTypeObj, 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<ICFBamTokenTypeObj, Long>, TableCell<ICFBamTokenTypeObj, Long>>() { @Override public TableCell<ICFBamTokenTypeObj, Long> call(TableColumn<ICFBamTokenTypeObj, Long> arg) { return new CFInt64TableCell<ICFBamTokenTypeObj>(); } }); dataTable.getColumns().add(tableColumnId); tableColumnName = new TableColumn<ICFBamTokenTypeObj, String>("Name"); tableColumnName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTokenTypeObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamTokenTypeObj, 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<ICFBamTokenTypeObj, String>, TableCell<ICFBamTokenTypeObj, String>>() { @Override public TableCell<ICFBamTokenTypeObj, String> call(TableColumn<ICFBamTokenTypeObj, String> arg) { return new CFStringTableCell<ICFBamTokenTypeObj>(); } }); dataTable.getColumns().add(tableColumnName); tableColumnShortName = new TableColumn<ICFBamTokenTypeObj, String>("Short Name"); tableColumnShortName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTokenTypeObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamTokenTypeObj, 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<ICFBamTokenTypeObj, String>, TableCell<ICFBamTokenTypeObj, String>>() { @Override public TableCell<ICFBamTokenTypeObj, String> call(TableColumn<ICFBamTokenTypeObj, String> arg) { return new CFStringTableCell<ICFBamTokenTypeObj>(); } }); dataTable.getColumns().add(tableColumnShortName); tableColumnLabel = new TableColumn<ICFBamTokenTypeObj, String>("Label"); tableColumnLabel.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTokenTypeObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamTokenTypeObj, 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<ICFBamTokenTypeObj, String>, TableCell<ICFBamTokenTypeObj, String>>() { @Override public TableCell<ICFBamTokenTypeObj, String> call(TableColumn<ICFBamTokenTypeObj, String> arg) { return new CFStringTableCell<ICFBamTokenTypeObj>(); } }); dataTable.getColumns().add(tableColumnLabel); tableColumnShortDescription = new TableColumn<ICFBamTokenTypeObj, String>("Short Description"); tableColumnShortDescription.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTokenTypeObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamTokenTypeObj, 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<ICFBamTokenTypeObj, String>, TableCell<ICFBamTokenTypeObj, String>>() { @Override public TableCell<ICFBamTokenTypeObj, String> call(TableColumn<ICFBamTokenTypeObj, String> arg) { return new CFStringTableCell<ICFBamTokenTypeObj>(); } }); dataTable.getColumns().add(tableColumnShortDescription); tableColumnDescription = new TableColumn<ICFBamTokenTypeObj, String>("Description"); tableColumnDescription.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTokenTypeObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamTokenTypeObj, 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<ICFBamTokenTypeObj, String>, TableCell<ICFBamTokenTypeObj, String>>() { @Override public TableCell<ICFBamTokenTypeObj, String> call(TableColumn<ICFBamTokenTypeObj, String> arg) { return new CFStringTableCell<ICFBamTokenTypeObj>(); } }); dataTable.getColumns().add(tableColumnDescription); tableColumnIsNullable = new TableColumn<ICFBamTokenTypeObj, Boolean>("Is Nullable"); tableColumnIsNullable.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTokenTypeObj, Boolean>, ObservableValue<Boolean>>() { public ObservableValue<Boolean> call(CellDataFeatures<ICFBamTokenTypeObj, 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<ICFBamTokenTypeObj, Boolean>, TableCell<ICFBamTokenTypeObj, Boolean>>() { @Override public TableCell<ICFBamTokenTypeObj, Boolean> call( TableColumn<ICFBamTokenTypeObj, Boolean> arg) { return new CFBoolTableCell<ICFBamTokenTypeObj>(); } }); dataTable.getColumns().add(tableColumnIsNullable); tableColumnGenerateId = new TableColumn<ICFBamTokenTypeObj, Boolean>("Generate Id"); tableColumnGenerateId.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTokenTypeObj, Boolean>, ObservableValue<Boolean>>() { public ObservableValue<Boolean> call(CellDataFeatures<ICFBamTokenTypeObj, 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<ICFBamTokenTypeObj, Boolean>, TableCell<ICFBamTokenTypeObj, Boolean>>() { @Override public TableCell<ICFBamTokenTypeObj, Boolean> call( TableColumn<ICFBamTokenTypeObj, Boolean> arg) { return new CFBoolTableCell<ICFBamTokenTypeObj>(); } }); dataTable.getColumns().add(tableColumnGenerateId); tableColumnDefaultVisibility = new TableColumn<ICFBamTokenTypeObj, Boolean>("Default Visibility"); tableColumnDefaultVisibility.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTokenTypeObj, Boolean>, ObservableValue<Boolean>>() { public ObservableValue<Boolean> call(CellDataFeatures<ICFBamTokenTypeObj, 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<ICFBamTokenTypeObj, Boolean>, TableCell<ICFBamTokenTypeObj, Boolean>>() { @Override public TableCell<ICFBamTokenTypeObj, Boolean> call( TableColumn<ICFBamTokenTypeObj, Boolean> arg) { return new CFBoolTableCell<ICFBamTokenTypeObj>(); } }); dataTable.getColumns().add(tableColumnDefaultVisibility); tableColumnDbName = new TableColumn<ICFBamTokenTypeObj, String>("Db Name"); tableColumnDbName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTokenTypeObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamTokenTypeObj, 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<ICFBamTokenTypeObj, String>, TableCell<ICFBamTokenTypeObj, String>>() { @Override public TableCell<ICFBamTokenTypeObj, String> call(TableColumn<ICFBamTokenTypeObj, String> arg) { return new CFStringTableCell<ICFBamTokenTypeObj>(); } }); dataTable.getColumns().add(tableColumnDbName); tableColumnMaxLen = new TableColumn<ICFBamTokenTypeObj, Integer>("Max. Length"); tableColumnMaxLen.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTokenTypeObj, Integer>, ObservableValue<Integer>>() { public ObservableValue<Integer> call(CellDataFeatures<ICFBamTokenTypeObj, Integer> p) { ICFBamTokenDefObj obj = p.getValue(); if (obj == null) { return (null); } else { int value = obj.getRequiredMaxLen(); Integer wrapped = new Integer(value); ReadOnlyObjectWrapper<Integer> observable = new ReadOnlyObjectWrapper<Integer>(); observable.setValue(wrapped); return (observable); } } }); tableColumnMaxLen.setCellFactory( new Callback<TableColumn<ICFBamTokenTypeObj, Integer>, TableCell<ICFBamTokenTypeObj, Integer>>() { @Override public TableCell<ICFBamTokenTypeObj, Integer> call( TableColumn<ICFBamTokenTypeObj, Integer> arg) { return new CFInt32TableCell<ICFBamTokenTypeObj>(); } }); dataTable.getColumns().add(tableColumnMaxLen); tableColumnInitValue = new TableColumn<ICFBamTokenTypeObj, String>("Init. Value"); tableColumnInitValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTokenTypeObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamTokenTypeObj, String> p) { ICFBamTokenDefObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getOptionalInitValue(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnInitValue.setCellFactory( new Callback<TableColumn<ICFBamTokenTypeObj, String>, TableCell<ICFBamTokenTypeObj, String>>() { @Override public TableCell<ICFBamTokenTypeObj, String> call(TableColumn<ICFBamTokenTypeObj, String> arg) { return new CFTokenTableCell<ICFBamTokenTypeObj>(); } }); dataTable.getColumns().add(tableColumnInitValue); tableColumnDefaultValue = new TableColumn<ICFBamTokenTypeObj, String>("Default Value"); tableColumnDefaultValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTokenTypeObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamTokenTypeObj, String> p) { ICFBamTokenDefObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getOptionalDefaultValue(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnDefaultValue.setCellFactory( new Callback<TableColumn<ICFBamTokenTypeObj, String>, TableCell<ICFBamTokenTypeObj, String>>() { @Override public TableCell<ICFBamTokenTypeObj, String> call(TableColumn<ICFBamTokenTypeObj, String> arg) { return new CFTokenTableCell<ICFBamTokenTypeObj>(); } }); dataTable.getColumns().add(tableColumnDefaultValue); tableColumnNullValue = new TableColumn<ICFBamTokenTypeObj, String>("Null Value"); tableColumnNullValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTokenTypeObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamTokenTypeObj, String> p) { ICFBamTokenDefObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getOptionalNullValue(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnNullValue.setCellFactory( new Callback<TableColumn<ICFBamTokenTypeObj, String>, TableCell<ICFBamTokenTypeObj, String>>() { @Override public TableCell<ICFBamTokenTypeObj, String> call(TableColumn<ICFBamTokenTypeObj, String> arg) { return new CFTokenTableCell<ICFBamTokenTypeObj>(); } }); dataTable.getColumns().add(tableColumnNullValue); tableColumnUnknownValue = new TableColumn<ICFBamTokenTypeObj, String>("Unknown Value"); tableColumnUnknownValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTokenTypeObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamTokenTypeObj, String> p) { ICFBamTokenDefObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getOptionalUnknownValue(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnUnknownValue.setCellFactory( new Callback<TableColumn<ICFBamTokenTypeObj, String>, TableCell<ICFBamTokenTypeObj, String>>() { @Override public TableCell<ICFBamTokenTypeObj, String> call(TableColumn<ICFBamTokenTypeObj, String> arg) { return new CFTokenTableCell<ICFBamTokenTypeObj>(); } }); dataTable.getColumns().add(tableColumnUnknownValue); tableColumnShowLines = new TableColumn<ICFBamTokenTypeObj, Short>("Show Lines"); tableColumnShowLines.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTokenTypeObj, Short>, ObservableValue<Short>>() { public ObservableValue<Short> call(CellDataFeatures<ICFBamTokenTypeObj, Short> p) { ICFBamTokenDefObj obj = p.getValue(); if (obj == null) { return (null); } else { short value = obj.getRequiredShowLines(); Short wrapped = new Short(value); ReadOnlyObjectWrapper<Short> observable = new ReadOnlyObjectWrapper<Short>(); observable.setValue(wrapped); return (observable); } } }); tableColumnShowLines.setCellFactory( new Callback<TableColumn<ICFBamTokenTypeObj, Short>, TableCell<ICFBamTokenTypeObj, Short>>() { @Override public TableCell<ICFBamTokenTypeObj, Short> call(TableColumn<ICFBamTokenTypeObj, Short> arg) { return new CFInt16TableCell<ICFBamTokenTypeObj>(); } }); dataTable.getColumns().add(tableColumnShowLines); tableColumnLookupDefSchema = new TableColumn<ICFBamTokenTypeObj, ICFBamSchemaDefObj>( "Defining Schema Definition"); tableColumnLookupDefSchema.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTokenTypeObj, ICFBamSchemaDefObj>, ObservableValue<ICFBamSchemaDefObj>>() { public ObservableValue<ICFBamSchemaDefObj> call( CellDataFeatures<ICFBamTokenTypeObj, ICFBamSchemaDefObj> p) { ICFBamTokenTypeObj 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<ICFBamTokenTypeObj, ICFBamSchemaDefObj>, TableCell<ICFBamTokenTypeObj, ICFBamSchemaDefObj>>() { @Override public TableCell<ICFBamTokenTypeObj, ICFBamSchemaDefObj> call( TableColumn<ICFBamTokenTypeObj, ICFBamSchemaDefObj> arg) { return new CFReferenceTableCell<ICFBamTokenTypeObj, ICFBamSchemaDefObj>(); } }); dataTable.getColumns().add(tableColumnLookupDefSchema); dataTable.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<ICFBamTokenTypeObj>() { @Override public void changed(ObservableValue<? extends ICFBamTokenTypeObj> observable, ICFBamTokenTypeObj oldValue, ICFBamTokenTypeObj 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.choseTokenType(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"); } ICFBamTokenTypeObj selectedInstance = getJavaFXFocusAsTokenType(); invokeWhenChosen.choseTokenType(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.CFBamJavaFXStringColPickerPane.java
public CFBamJavaFXStringColPickerPane(ICFFormManager formManager, ICFBamJavaFXSchema argSchema, ICFBamStringColObj argFocus, ICFBamTableObj argContainer, Collection<ICFBamStringColObj> argDataCollection, ICFBamJavaFXStringColChosen whenChosen) { super();/*from w ww. jav a 2 s . com*/ 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<ICFBamStringColObj>(); tableColumnId = new TableColumn<ICFBamStringColObj, Long>("Id"); tableColumnId.setCellValueFactory( new Callback<CellDataFeatures<ICFBamStringColObj, Long>, ObservableValue<Long>>() { public ObservableValue<Long> call(CellDataFeatures<ICFBamStringColObj, 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<ICFBamStringColObj, Long>, TableCell<ICFBamStringColObj, Long>>() { @Override public TableCell<ICFBamStringColObj, Long> call(TableColumn<ICFBamStringColObj, Long> arg) { return new CFInt64TableCell<ICFBamStringColObj>(); } }); dataTable.getColumns().add(tableColumnId); tableColumnName = new TableColumn<ICFBamStringColObj, String>("Name"); tableColumnName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamStringColObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamStringColObj, 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<ICFBamStringColObj, String>, TableCell<ICFBamStringColObj, String>>() { @Override public TableCell<ICFBamStringColObj, String> call(TableColumn<ICFBamStringColObj, String> arg) { return new CFStringTableCell<ICFBamStringColObj>(); } }); dataTable.getColumns().add(tableColumnName); tableColumnShortName = new TableColumn<ICFBamStringColObj, String>("Short Name"); tableColumnShortName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamStringColObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamStringColObj, 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<ICFBamStringColObj, String>, TableCell<ICFBamStringColObj, String>>() { @Override public TableCell<ICFBamStringColObj, String> call(TableColumn<ICFBamStringColObj, String> arg) { return new CFStringTableCell<ICFBamStringColObj>(); } }); dataTable.getColumns().add(tableColumnShortName); tableColumnLabel = new TableColumn<ICFBamStringColObj, String>("Label"); tableColumnLabel.setCellValueFactory( new Callback<CellDataFeatures<ICFBamStringColObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamStringColObj, 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<ICFBamStringColObj, String>, TableCell<ICFBamStringColObj, String>>() { @Override public TableCell<ICFBamStringColObj, String> call(TableColumn<ICFBamStringColObj, String> arg) { return new CFStringTableCell<ICFBamStringColObj>(); } }); dataTable.getColumns().add(tableColumnLabel); tableColumnShortDescription = new TableColumn<ICFBamStringColObj, String>("Short Description"); tableColumnShortDescription.setCellValueFactory( new Callback<CellDataFeatures<ICFBamStringColObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamStringColObj, 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<ICFBamStringColObj, String>, TableCell<ICFBamStringColObj, String>>() { @Override public TableCell<ICFBamStringColObj, String> call(TableColumn<ICFBamStringColObj, String> arg) { return new CFStringTableCell<ICFBamStringColObj>(); } }); dataTable.getColumns().add(tableColumnShortDescription); tableColumnDescription = new TableColumn<ICFBamStringColObj, String>("Description"); tableColumnDescription.setCellValueFactory( new Callback<CellDataFeatures<ICFBamStringColObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamStringColObj, 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<ICFBamStringColObj, String>, TableCell<ICFBamStringColObj, String>>() { @Override public TableCell<ICFBamStringColObj, String> call(TableColumn<ICFBamStringColObj, String> arg) { return new CFStringTableCell<ICFBamStringColObj>(); } }); dataTable.getColumns().add(tableColumnDescription); tableColumnIsNullable = new TableColumn<ICFBamStringColObj, Boolean>("Is Nullable"); tableColumnIsNullable.setCellValueFactory( new Callback<CellDataFeatures<ICFBamStringColObj, Boolean>, ObservableValue<Boolean>>() { public ObservableValue<Boolean> call(CellDataFeatures<ICFBamStringColObj, 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<ICFBamStringColObj, Boolean>, TableCell<ICFBamStringColObj, Boolean>>() { @Override public TableCell<ICFBamStringColObj, Boolean> call( TableColumn<ICFBamStringColObj, Boolean> arg) { return new CFBoolTableCell<ICFBamStringColObj>(); } }); dataTable.getColumns().add(tableColumnIsNullable); tableColumnGenerateId = new TableColumn<ICFBamStringColObj, Boolean>("Generate Id"); tableColumnGenerateId.setCellValueFactory( new Callback<CellDataFeatures<ICFBamStringColObj, Boolean>, ObservableValue<Boolean>>() { public ObservableValue<Boolean> call(CellDataFeatures<ICFBamStringColObj, 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<ICFBamStringColObj, Boolean>, TableCell<ICFBamStringColObj, Boolean>>() { @Override public TableCell<ICFBamStringColObj, Boolean> call( TableColumn<ICFBamStringColObj, Boolean> arg) { return new CFBoolTableCell<ICFBamStringColObj>(); } }); dataTable.getColumns().add(tableColumnGenerateId); tableColumnDefaultVisibility = new TableColumn<ICFBamStringColObj, Boolean>("Default Visibility"); tableColumnDefaultVisibility.setCellValueFactory( new Callback<CellDataFeatures<ICFBamStringColObj, Boolean>, ObservableValue<Boolean>>() { public ObservableValue<Boolean> call(CellDataFeatures<ICFBamStringColObj, 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<ICFBamStringColObj, Boolean>, TableCell<ICFBamStringColObj, Boolean>>() { @Override public TableCell<ICFBamStringColObj, Boolean> call( TableColumn<ICFBamStringColObj, Boolean> arg) { return new CFBoolTableCell<ICFBamStringColObj>(); } }); dataTable.getColumns().add(tableColumnDefaultVisibility); tableColumnDbName = new TableColumn<ICFBamStringColObj, String>("Db Name"); tableColumnDbName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamStringColObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamStringColObj, 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<ICFBamStringColObj, String>, TableCell<ICFBamStringColObj, String>>() { @Override public TableCell<ICFBamStringColObj, String> call(TableColumn<ICFBamStringColObj, String> arg) { return new CFStringTableCell<ICFBamStringColObj>(); } }); dataTable.getColumns().add(tableColumnDbName); tableColumnMaxLen = new TableColumn<ICFBamStringColObj, Integer>("Max. Length"); tableColumnMaxLen.setCellValueFactory( new Callback<CellDataFeatures<ICFBamStringColObj, Integer>, ObservableValue<Integer>>() { public ObservableValue<Integer> call(CellDataFeatures<ICFBamStringColObj, Integer> p) { ICFBamStringDefObj obj = p.getValue(); if (obj == null) { return (null); } else { int value = obj.getRequiredMaxLen(); Integer wrapped = new Integer(value); ReadOnlyObjectWrapper<Integer> observable = new ReadOnlyObjectWrapper<Integer>(); observable.setValue(wrapped); return (observable); } } }); tableColumnMaxLen.setCellFactory( new Callback<TableColumn<ICFBamStringColObj, Integer>, TableCell<ICFBamStringColObj, Integer>>() { @Override public TableCell<ICFBamStringColObj, Integer> call( TableColumn<ICFBamStringColObj, Integer> arg) { return new CFInt32TableCell<ICFBamStringColObj>(); } }); dataTable.getColumns().add(tableColumnMaxLen); tableColumnShowLines = new TableColumn<ICFBamStringColObj, Short>("Show Lines"); tableColumnShowLines.setCellValueFactory( new Callback<CellDataFeatures<ICFBamStringColObj, Short>, ObservableValue<Short>>() { public ObservableValue<Short> call(CellDataFeatures<ICFBamStringColObj, Short> p) { ICFBamStringDefObj obj = p.getValue(); if (obj == null) { return (null); } else { short value = obj.getRequiredShowLines(); Short wrapped = new Short(value); ReadOnlyObjectWrapper<Short> observable = new ReadOnlyObjectWrapper<Short>(); observable.setValue(wrapped); return (observable); } } }); tableColumnShowLines.setCellFactory( new Callback<TableColumn<ICFBamStringColObj, Short>, TableCell<ICFBamStringColObj, Short>>() { @Override public TableCell<ICFBamStringColObj, Short> call(TableColumn<ICFBamStringColObj, Short> arg) { return new CFInt16TableCell<ICFBamStringColObj>(); } }); dataTable.getColumns().add(tableColumnShowLines); tableColumnInitValue = new TableColumn<ICFBamStringColObj, String>("Init. Value"); tableColumnInitValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamStringColObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamStringColObj, String> p) { ICFBamStringDefObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getOptionalInitValue(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnInitValue.setCellFactory( new Callback<TableColumn<ICFBamStringColObj, String>, TableCell<ICFBamStringColObj, String>>() { @Override public TableCell<ICFBamStringColObj, String> call(TableColumn<ICFBamStringColObj, String> arg) { return new CFStringTableCell<ICFBamStringColObj>(); } }); dataTable.getColumns().add(tableColumnInitValue); tableColumnDefaultValue = new TableColumn<ICFBamStringColObj, String>("Default Value"); tableColumnDefaultValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamStringColObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamStringColObj, String> p) { ICFBamStringDefObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getOptionalDefaultValue(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnDefaultValue.setCellFactory( new Callback<TableColumn<ICFBamStringColObj, String>, TableCell<ICFBamStringColObj, String>>() { @Override public TableCell<ICFBamStringColObj, String> call(TableColumn<ICFBamStringColObj, String> arg) { return new CFStringTableCell<ICFBamStringColObj>(); } }); dataTable.getColumns().add(tableColumnDefaultValue); tableColumnNullValue = new TableColumn<ICFBamStringColObj, String>("Null Value"); tableColumnNullValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamStringColObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamStringColObj, String> p) { ICFBamStringDefObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getOptionalNullValue(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnNullValue.setCellFactory( new Callback<TableColumn<ICFBamStringColObj, String>, TableCell<ICFBamStringColObj, String>>() { @Override public TableCell<ICFBamStringColObj, String> call(TableColumn<ICFBamStringColObj, String> arg) { return new CFStringTableCell<ICFBamStringColObj>(); } }); dataTable.getColumns().add(tableColumnNullValue); tableColumnUnknownValue = new TableColumn<ICFBamStringColObj, String>("Unknown Value"); tableColumnUnknownValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamStringColObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamStringColObj, String> p) { ICFBamStringDefObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getOptionalUnknownValue(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnUnknownValue.setCellFactory( new Callback<TableColumn<ICFBamStringColObj, String>, TableCell<ICFBamStringColObj, String>>() { @Override public TableCell<ICFBamStringColObj, String> call(TableColumn<ICFBamStringColObj, String> arg) { return new CFStringTableCell<ICFBamStringColObj>(); } }); dataTable.getColumns().add(tableColumnUnknownValue); tableColumnLookupDefSchema = new TableColumn<ICFBamStringColObj, ICFBamSchemaDefObj>( "Defining Schema Definition"); tableColumnLookupDefSchema.setCellValueFactory( new Callback<CellDataFeatures<ICFBamStringColObj, ICFBamSchemaDefObj>, ObservableValue<ICFBamSchemaDefObj>>() { public ObservableValue<ICFBamSchemaDefObj> call( CellDataFeatures<ICFBamStringColObj, ICFBamSchemaDefObj> p) { ICFBamStringColObj 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<ICFBamStringColObj, ICFBamSchemaDefObj>, TableCell<ICFBamStringColObj, ICFBamSchemaDefObj>>() { @Override public TableCell<ICFBamStringColObj, ICFBamSchemaDefObj> call( TableColumn<ICFBamStringColObj, ICFBamSchemaDefObj> arg) { return new CFReferenceTableCell<ICFBamStringColObj, ICFBamSchemaDefObj>(); } }); dataTable.getColumns().add(tableColumnLookupDefSchema); dataTable.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<ICFBamStringColObj>() { @Override public void changed(ObservableValue<? extends ICFBamStringColObj> observable, ICFBamStringColObj oldValue, ICFBamStringColObj 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.choseStringCol(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"); } ICFBamStringColObj selectedInstance = getJavaFXFocusAsStringCol(); invokeWhenChosen.choseStringCol(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.CFBamJavaFXUInt32TypePickerPane.java
public CFBamJavaFXUInt32TypePickerPane(ICFFormManager formManager, ICFBamJavaFXSchema argSchema, ICFBamUInt32TypeObj argFocus, ICFBamSchemaDefObj argContainer, Collection<ICFBamUInt32TypeObj> argDataCollection, ICFBamJavaFXUInt32TypeChosen whenChosen) { super();/*from w ww . j a 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"); } 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<ICFBamUInt32TypeObj>(); tableColumnId = new TableColumn<ICFBamUInt32TypeObj, Long>("Id"); tableColumnId.setCellValueFactory( new Callback<CellDataFeatures<ICFBamUInt32TypeObj, Long>, ObservableValue<Long>>() { public ObservableValue<Long> call(CellDataFeatures<ICFBamUInt32TypeObj, 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<ICFBamUInt32TypeObj, Long>, TableCell<ICFBamUInt32TypeObj, Long>>() { @Override public TableCell<ICFBamUInt32TypeObj, Long> call(TableColumn<ICFBamUInt32TypeObj, Long> arg) { return new CFInt64TableCell<ICFBamUInt32TypeObj>(); } }); dataTable.getColumns().add(tableColumnId); tableColumnName = new TableColumn<ICFBamUInt32TypeObj, String>("Name"); tableColumnName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamUInt32TypeObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamUInt32TypeObj, 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<ICFBamUInt32TypeObj, String>, TableCell<ICFBamUInt32TypeObj, String>>() { @Override public TableCell<ICFBamUInt32TypeObj, String> call( TableColumn<ICFBamUInt32TypeObj, String> arg) { return new CFStringTableCell<ICFBamUInt32TypeObj>(); } }); dataTable.getColumns().add(tableColumnName); tableColumnShortName = new TableColumn<ICFBamUInt32TypeObj, String>("Short Name"); tableColumnShortName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamUInt32TypeObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamUInt32TypeObj, 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<ICFBamUInt32TypeObj, String>, TableCell<ICFBamUInt32TypeObj, String>>() { @Override public TableCell<ICFBamUInt32TypeObj, String> call( TableColumn<ICFBamUInt32TypeObj, String> arg) { return new CFStringTableCell<ICFBamUInt32TypeObj>(); } }); dataTable.getColumns().add(tableColumnShortName); tableColumnLabel = new TableColumn<ICFBamUInt32TypeObj, String>("Label"); tableColumnLabel.setCellValueFactory( new Callback<CellDataFeatures<ICFBamUInt32TypeObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamUInt32TypeObj, 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<ICFBamUInt32TypeObj, String>, TableCell<ICFBamUInt32TypeObj, String>>() { @Override public TableCell<ICFBamUInt32TypeObj, String> call( TableColumn<ICFBamUInt32TypeObj, String> arg) { return new CFStringTableCell<ICFBamUInt32TypeObj>(); } }); dataTable.getColumns().add(tableColumnLabel); tableColumnShortDescription = new TableColumn<ICFBamUInt32TypeObj, String>("Short Description"); tableColumnShortDescription.setCellValueFactory( new Callback<CellDataFeatures<ICFBamUInt32TypeObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamUInt32TypeObj, 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<ICFBamUInt32TypeObj, String>, TableCell<ICFBamUInt32TypeObj, String>>() { @Override public TableCell<ICFBamUInt32TypeObj, String> call( TableColumn<ICFBamUInt32TypeObj, String> arg) { return new CFStringTableCell<ICFBamUInt32TypeObj>(); } }); dataTable.getColumns().add(tableColumnShortDescription); tableColumnDescription = new TableColumn<ICFBamUInt32TypeObj, String>("Description"); tableColumnDescription.setCellValueFactory( new Callback<CellDataFeatures<ICFBamUInt32TypeObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamUInt32TypeObj, 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<ICFBamUInt32TypeObj, String>, TableCell<ICFBamUInt32TypeObj, String>>() { @Override public TableCell<ICFBamUInt32TypeObj, String> call( TableColumn<ICFBamUInt32TypeObj, String> arg) { return new CFStringTableCell<ICFBamUInt32TypeObj>(); } }); dataTable.getColumns().add(tableColumnDescription); tableColumnIsNullable = new TableColumn<ICFBamUInt32TypeObj, Boolean>("Is Nullable"); tableColumnIsNullable.setCellValueFactory( new Callback<CellDataFeatures<ICFBamUInt32TypeObj, Boolean>, ObservableValue<Boolean>>() { public ObservableValue<Boolean> call(CellDataFeatures<ICFBamUInt32TypeObj, 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<ICFBamUInt32TypeObj, Boolean>, TableCell<ICFBamUInt32TypeObj, Boolean>>() { @Override public TableCell<ICFBamUInt32TypeObj, Boolean> call( TableColumn<ICFBamUInt32TypeObj, Boolean> arg) { return new CFBoolTableCell<ICFBamUInt32TypeObj>(); } }); dataTable.getColumns().add(tableColumnIsNullable); tableColumnGenerateId = new TableColumn<ICFBamUInt32TypeObj, Boolean>("Generate Id"); tableColumnGenerateId.setCellValueFactory( new Callback<CellDataFeatures<ICFBamUInt32TypeObj, Boolean>, ObservableValue<Boolean>>() { public ObservableValue<Boolean> call(CellDataFeatures<ICFBamUInt32TypeObj, 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<ICFBamUInt32TypeObj, Boolean>, TableCell<ICFBamUInt32TypeObj, Boolean>>() { @Override public TableCell<ICFBamUInt32TypeObj, Boolean> call( TableColumn<ICFBamUInt32TypeObj, Boolean> arg) { return new CFBoolTableCell<ICFBamUInt32TypeObj>(); } }); dataTable.getColumns().add(tableColumnGenerateId); tableColumnDefaultVisibility = new TableColumn<ICFBamUInt32TypeObj, Boolean>("Default Visibility"); tableColumnDefaultVisibility.setCellValueFactory( new Callback<CellDataFeatures<ICFBamUInt32TypeObj, Boolean>, ObservableValue<Boolean>>() { public ObservableValue<Boolean> call(CellDataFeatures<ICFBamUInt32TypeObj, 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<ICFBamUInt32TypeObj, Boolean>, TableCell<ICFBamUInt32TypeObj, Boolean>>() { @Override public TableCell<ICFBamUInt32TypeObj, Boolean> call( TableColumn<ICFBamUInt32TypeObj, Boolean> arg) { return new CFBoolTableCell<ICFBamUInt32TypeObj>(); } }); dataTable.getColumns().add(tableColumnDefaultVisibility); tableColumnDbName = new TableColumn<ICFBamUInt32TypeObj, String>("Db Name"); tableColumnDbName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamUInt32TypeObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamUInt32TypeObj, 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<ICFBamUInt32TypeObj, String>, TableCell<ICFBamUInt32TypeObj, String>>() { @Override public TableCell<ICFBamUInt32TypeObj, String> call( TableColumn<ICFBamUInt32TypeObj, String> arg) { return new CFStringTableCell<ICFBamUInt32TypeObj>(); } }); dataTable.getColumns().add(tableColumnDbName); tableColumnInitValue = new TableColumn<ICFBamUInt32TypeObj, Long>("Init. Value"); tableColumnInitValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamUInt32TypeObj, Long>, ObservableValue<Long>>() { public ObservableValue<Long> call(CellDataFeatures<ICFBamUInt32TypeObj, Long> p) { ICFBamUInt32DefObj 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<ICFBamUInt32TypeObj, Long>, TableCell<ICFBamUInt32TypeObj, Long>>() { @Override public TableCell<ICFBamUInt32TypeObj, Long> call(TableColumn<ICFBamUInt32TypeObj, Long> arg) { return new CFUInt32TableCell<ICFBamUInt32TypeObj>(); } }); dataTable.getColumns().add(tableColumnInitValue); tableColumnDefaultValue = new TableColumn<ICFBamUInt32TypeObj, Long>("Default Value"); tableColumnDefaultValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamUInt32TypeObj, Long>, ObservableValue<Long>>() { public ObservableValue<Long> call(CellDataFeatures<ICFBamUInt32TypeObj, Long> p) { ICFBamUInt32DefObj 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<ICFBamUInt32TypeObj, Long>, TableCell<ICFBamUInt32TypeObj, Long>>() { @Override public TableCell<ICFBamUInt32TypeObj, Long> call(TableColumn<ICFBamUInt32TypeObj, Long> arg) { return new CFUInt32TableCell<ICFBamUInt32TypeObj>(); } }); dataTable.getColumns().add(tableColumnDefaultValue); tableColumnMinValue = new TableColumn<ICFBamUInt32TypeObj, Long>("Min. Value"); tableColumnMinValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamUInt32TypeObj, Long>, ObservableValue<Long>>() { public ObservableValue<Long> call(CellDataFeatures<ICFBamUInt32TypeObj, Long> p) { ICFBamUInt32DefObj 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<ICFBamUInt32TypeObj, Long>, TableCell<ICFBamUInt32TypeObj, Long>>() { @Override public TableCell<ICFBamUInt32TypeObj, Long> call(TableColumn<ICFBamUInt32TypeObj, Long> arg) { return new CFUInt32TableCell<ICFBamUInt32TypeObj>(); } }); dataTable.getColumns().add(tableColumnMinValue); tableColumnMaxValue = new TableColumn<ICFBamUInt32TypeObj, Long>("Max. Value"); tableColumnMaxValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamUInt32TypeObj, Long>, ObservableValue<Long>>() { public ObservableValue<Long> call(CellDataFeatures<ICFBamUInt32TypeObj, Long> p) { ICFBamUInt32DefObj 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<ICFBamUInt32TypeObj, Long>, TableCell<ICFBamUInt32TypeObj, Long>>() { @Override public TableCell<ICFBamUInt32TypeObj, Long> call(TableColumn<ICFBamUInt32TypeObj, Long> arg) { return new CFUInt32TableCell<ICFBamUInt32TypeObj>(); } }); dataTable.getColumns().add(tableColumnMaxValue); tableColumnNullValue = new TableColumn<ICFBamUInt32TypeObj, Long>("Null Value"); tableColumnNullValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamUInt32TypeObj, Long>, ObservableValue<Long>>() { public ObservableValue<Long> call(CellDataFeatures<ICFBamUInt32TypeObj, Long> p) { ICFBamUInt32DefObj 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<ICFBamUInt32TypeObj, Long>, TableCell<ICFBamUInt32TypeObj, Long>>() { @Override public TableCell<ICFBamUInt32TypeObj, Long> call(TableColumn<ICFBamUInt32TypeObj, Long> arg) { return new CFUInt32TableCell<ICFBamUInt32TypeObj>(); } }); dataTable.getColumns().add(tableColumnNullValue); tableColumnUnknownValue = new TableColumn<ICFBamUInt32TypeObj, Long>("Unknown Value"); tableColumnUnknownValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamUInt32TypeObj, Long>, ObservableValue<Long>>() { public ObservableValue<Long> call(CellDataFeatures<ICFBamUInt32TypeObj, Long> p) { ICFBamUInt32DefObj 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<ICFBamUInt32TypeObj, Long>, TableCell<ICFBamUInt32TypeObj, Long>>() { @Override public TableCell<ICFBamUInt32TypeObj, Long> call(TableColumn<ICFBamUInt32TypeObj, Long> arg) { return new CFUInt32TableCell<ICFBamUInt32TypeObj>(); } }); dataTable.getColumns().add(tableColumnUnknownValue); tableColumnLookupDefSchema = new TableColumn<ICFBamUInt32TypeObj, ICFBamSchemaDefObj>( "Defining Schema Definition"); tableColumnLookupDefSchema.setCellValueFactory( new Callback<CellDataFeatures<ICFBamUInt32TypeObj, ICFBamSchemaDefObj>, ObservableValue<ICFBamSchemaDefObj>>() { public ObservableValue<ICFBamSchemaDefObj> call( CellDataFeatures<ICFBamUInt32TypeObj, ICFBamSchemaDefObj> p) { ICFBamUInt32TypeObj 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<ICFBamUInt32TypeObj, ICFBamSchemaDefObj>, TableCell<ICFBamUInt32TypeObj, ICFBamSchemaDefObj>>() { @Override public TableCell<ICFBamUInt32TypeObj, ICFBamSchemaDefObj> call( TableColumn<ICFBamUInt32TypeObj, ICFBamSchemaDefObj> arg) { return new CFReferenceTableCell<ICFBamUInt32TypeObj, ICFBamSchemaDefObj>(); } }); dataTable.getColumns().add(tableColumnLookupDefSchema); dataTable.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<ICFBamUInt32TypeObj>() { @Override public void changed(ObservableValue<? extends ICFBamUInt32TypeObj> observable, ICFBamUInt32TypeObj oldValue, ICFBamUInt32TypeObj 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.choseUInt32Type(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"); } ICFBamUInt32TypeObj selectedInstance = getJavaFXFocusAsUInt32Type(); invokeWhenChosen.choseUInt32Type(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.CFBamJavaFXUInt16ColPickerPane.java
public CFBamJavaFXUInt16ColPickerPane(ICFFormManager formManager, ICFBamJavaFXSchema argSchema, ICFBamUInt16ColObj argFocus, ICFBamTableObj argContainer, Collection<ICFBamUInt16ColObj> argDataCollection, ICFBamJavaFXUInt16ColChosen whenChosen) { super();/*from w w w . 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"); } 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); }