List of usage examples for java.lang Short Short
@Deprecated(since = "9") public Short(String s) throws NumberFormatException
From source file:TypeConversionHelper.java
/** * Convert the value to a instance of the given type. The value converted only * if the type can't be assigned from the current type of the value instance. * @param value the value to be converted * @param type the type of the expected object returned from the coversion * @return the converted object, or null if the object can't be converted *//*from w w w.j a va 2s .c o m*/ public static Object convertTo(Object value, Class type) { //check if the id can be assigned for the field type, otherwise convert the id to the appropriate type if (!type.isAssignableFrom(value.getClass())) { if (type == short.class || type == Short.class) { return new Short(value.toString()); } else if (type == char.class || type == Character.class) { return new Character(value.toString().charAt(0)); } else if (type == int.class || type == Integer.class) { return new Integer(value.toString()); } else if (type == long.class || type == Long.class) { return new Long(value.toString()); } else if (type == boolean.class || type == Boolean.class) { return new Boolean(value.toString()); } else if (type == byte.class || type == Byte.class) { return new Byte(value.toString()); } else if (type == float.class || type == Float.class) { return new Float(value.toString()); } else if (type == double.class || type == Double.class) { return new Double(value.toString()); } else if (type == BigDecimal.class) { return new BigDecimal(value.toString()); } else if (type == BigInteger.class) { return new BigInteger(value.toString()); } else if (type == String.class) { return value.toString(); } else { return null; } } return value; }
From source file:net.sourceforge.msscodefactory.cfbam.v2_7.CFBamJavaFX.CFBamJavaFXNumberColListPane.java
public CFBamJavaFXNumberColListPane(ICFFormManager formManager, ICFBamJavaFXSchema argSchema, ICFBamTableObj argContainer, ICFBamNumberColObj argFocus, Collection<ICFBamNumberColObj> argDataCollection, ICFRefreshCallback refreshCallback, boolean sortByChain) { super();//from www. ja v a 2 s . c o m final String S_ProcName = "construct-schema-focus"; if (formManager == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 1, "formManager"); } cfFormManager = formManager; if (argSchema == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 2, "argSchema"); } // argFocus is optional; focus may be set later during execution as // conditions of the runtime change. javafxSchema = argSchema; javaFXFocus = argFocus; javafxContainer = argContainer; javafxRefreshCallback = refreshCallback; javafxSortByChain = sortByChain; setJavaFXDataCollection(argDataCollection); dataTable = new TableView<ICFBamNumberColObj>(); tableColumnId = new TableColumn<ICFBamNumberColObj, Long>("Id"); tableColumnId.setCellValueFactory( new Callback<CellDataFeatures<ICFBamNumberColObj, Long>, ObservableValue<Long>>() { public ObservableValue<Long> call(CellDataFeatures<ICFBamNumberColObj, 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<ICFBamNumberColObj, Long>, TableCell<ICFBamNumberColObj, Long>>() { @Override public TableCell<ICFBamNumberColObj, Long> call(TableColumn<ICFBamNumberColObj, Long> arg) { return new CFInt64TableCell<ICFBamNumberColObj>(); } }); dataTable.getColumns().add(tableColumnId); tableColumnName = new TableColumn<ICFBamNumberColObj, String>("Name"); tableColumnName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamNumberColObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamNumberColObj, 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<ICFBamNumberColObj, String>, TableCell<ICFBamNumberColObj, String>>() { @Override public TableCell<ICFBamNumberColObj, String> call(TableColumn<ICFBamNumberColObj, String> arg) { return new CFStringTableCell<ICFBamNumberColObj>(); } }); dataTable.getColumns().add(tableColumnName); tableColumnShortName = new TableColumn<ICFBamNumberColObj, String>("Short Name"); tableColumnShortName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamNumberColObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamNumberColObj, 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<ICFBamNumberColObj, String>, TableCell<ICFBamNumberColObj, String>>() { @Override public TableCell<ICFBamNumberColObj, String> call(TableColumn<ICFBamNumberColObj, String> arg) { return new CFStringTableCell<ICFBamNumberColObj>(); } }); dataTable.getColumns().add(tableColumnShortName); tableColumnLabel = new TableColumn<ICFBamNumberColObj, String>("Label"); tableColumnLabel.setCellValueFactory( new Callback<CellDataFeatures<ICFBamNumberColObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamNumberColObj, 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<ICFBamNumberColObj, String>, TableCell<ICFBamNumberColObj, String>>() { @Override public TableCell<ICFBamNumberColObj, String> call(TableColumn<ICFBamNumberColObj, String> arg) { return new CFStringTableCell<ICFBamNumberColObj>(); } }); dataTable.getColumns().add(tableColumnLabel); tableColumnShortDescription = new TableColumn<ICFBamNumberColObj, String>("Short Description"); tableColumnShortDescription.setCellValueFactory( new Callback<CellDataFeatures<ICFBamNumberColObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamNumberColObj, 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<ICFBamNumberColObj, String>, TableCell<ICFBamNumberColObj, String>>() { @Override public TableCell<ICFBamNumberColObj, String> call(TableColumn<ICFBamNumberColObj, String> arg) { return new CFStringTableCell<ICFBamNumberColObj>(); } }); dataTable.getColumns().add(tableColumnShortDescription); tableColumnDescription = new TableColumn<ICFBamNumberColObj, String>("Description"); tableColumnDescription.setCellValueFactory( new Callback<CellDataFeatures<ICFBamNumberColObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamNumberColObj, 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<ICFBamNumberColObj, String>, TableCell<ICFBamNumberColObj, String>>() { @Override public TableCell<ICFBamNumberColObj, String> call(TableColumn<ICFBamNumberColObj, String> arg) { return new CFStringTableCell<ICFBamNumberColObj>(); } }); dataTable.getColumns().add(tableColumnDescription); tableColumnIsNullable = new TableColumn<ICFBamNumberColObj, Boolean>("Is Nullable"); tableColumnIsNullable.setCellValueFactory( new Callback<CellDataFeatures<ICFBamNumberColObj, Boolean>, ObservableValue<Boolean>>() { public ObservableValue<Boolean> call(CellDataFeatures<ICFBamNumberColObj, 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<ICFBamNumberColObj, Boolean>, TableCell<ICFBamNumberColObj, Boolean>>() { @Override public TableCell<ICFBamNumberColObj, Boolean> call( TableColumn<ICFBamNumberColObj, Boolean> arg) { return new CFBoolTableCell<ICFBamNumberColObj>(); } }); dataTable.getColumns().add(tableColumnIsNullable); tableColumnGenerateId = new TableColumn<ICFBamNumberColObj, Boolean>("Generate Id"); tableColumnGenerateId.setCellValueFactory( new Callback<CellDataFeatures<ICFBamNumberColObj, Boolean>, ObservableValue<Boolean>>() { public ObservableValue<Boolean> call(CellDataFeatures<ICFBamNumberColObj, 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<ICFBamNumberColObj, Boolean>, TableCell<ICFBamNumberColObj, Boolean>>() { @Override public TableCell<ICFBamNumberColObj, Boolean> call( TableColumn<ICFBamNumberColObj, Boolean> arg) { return new CFBoolTableCell<ICFBamNumberColObj>(); } }); dataTable.getColumns().add(tableColumnGenerateId); tableColumnDefaultVisibility = new TableColumn<ICFBamNumberColObj, Boolean>("Default Visibility"); tableColumnDefaultVisibility.setCellValueFactory( new Callback<CellDataFeatures<ICFBamNumberColObj, Boolean>, ObservableValue<Boolean>>() { public ObservableValue<Boolean> call(CellDataFeatures<ICFBamNumberColObj, 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<ICFBamNumberColObj, Boolean>, TableCell<ICFBamNumberColObj, Boolean>>() { @Override public TableCell<ICFBamNumberColObj, Boolean> call( TableColumn<ICFBamNumberColObj, Boolean> arg) { return new CFBoolTableCell<ICFBamNumberColObj>(); } }); dataTable.getColumns().add(tableColumnDefaultVisibility); tableColumnDbName = new TableColumn<ICFBamNumberColObj, String>("Db Name"); tableColumnDbName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamNumberColObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamNumberColObj, 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<ICFBamNumberColObj, String>, TableCell<ICFBamNumberColObj, String>>() { @Override public TableCell<ICFBamNumberColObj, String> call(TableColumn<ICFBamNumberColObj, String> arg) { return new CFStringTableCell<ICFBamNumberColObj>(); } }); dataTable.getColumns().add(tableColumnDbName); tableColumnDigits = new TableColumn<ICFBamNumberColObj, Short>("Digits"); tableColumnDigits.setCellValueFactory( new Callback<CellDataFeatures<ICFBamNumberColObj, Short>, ObservableValue<Short>>() { public ObservableValue<Short> call(CellDataFeatures<ICFBamNumberColObj, Short> p) { ICFBamNumberDefObj obj = p.getValue(); if (obj == null) { return (null); } else { short value = obj.getRequiredDigits(); Short wrapped = new Short(value); ReadOnlyObjectWrapper<Short> observable = new ReadOnlyObjectWrapper<Short>(); observable.setValue(wrapped); return (observable); } } }); tableColumnDigits.setCellFactory( new Callback<TableColumn<ICFBamNumberColObj, Short>, TableCell<ICFBamNumberColObj, Short>>() { @Override public TableCell<ICFBamNumberColObj, Short> call(TableColumn<ICFBamNumberColObj, Short> arg) { return new CFInt16TableCell<ICFBamNumberColObj>(); } }); dataTable.getColumns().add(tableColumnDigits); tableColumnPrecis = new TableColumn<ICFBamNumberColObj, Short>("Precision"); tableColumnPrecis.setCellValueFactory( new Callback<CellDataFeatures<ICFBamNumberColObj, Short>, ObservableValue<Short>>() { public ObservableValue<Short> call(CellDataFeatures<ICFBamNumberColObj, Short> p) { ICFBamNumberDefObj obj = p.getValue(); if (obj == null) { return (null); } else { short value = obj.getRequiredPrecis(); Short wrapped = new Short(value); ReadOnlyObjectWrapper<Short> observable = new ReadOnlyObjectWrapper<Short>(); observable.setValue(wrapped); return (observable); } } }); tableColumnPrecis.setCellFactory( new Callback<TableColumn<ICFBamNumberColObj, Short>, TableCell<ICFBamNumberColObj, Short>>() { @Override public TableCell<ICFBamNumberColObj, Short> call(TableColumn<ICFBamNumberColObj, Short> arg) { return new CFInt16TableCell<ICFBamNumberColObj>(); } }); dataTable.getColumns().add(tableColumnPrecis); tableColumnInitValue = new TableColumn<ICFBamNumberColObj, BigDecimal>("Init. Value"); tableColumnInitValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamNumberColObj, BigDecimal>, ObservableValue<BigDecimal>>() { public ObservableValue<BigDecimal> call(CellDataFeatures<ICFBamNumberColObj, BigDecimal> p) { ICFBamNumberDefObj obj = p.getValue(); if (obj == null) { return (null); } else { BigDecimal value = obj.getOptionalInitValue(); ReadOnlyObjectWrapper<BigDecimal> observable = new ReadOnlyObjectWrapper<BigDecimal>(); observable.setValue(value); return (observable); } } }); tableColumnInitValue.setCellFactory( new Callback<TableColumn<ICFBamNumberColObj, BigDecimal>, TableCell<ICFBamNumberColObj, BigDecimal>>() { @Override public TableCell<ICFBamNumberColObj, BigDecimal> call( TableColumn<ICFBamNumberColObj, BigDecimal> arg) { return new CFNumberTableCell<ICFBamNumberColObj>(31, 5); } }); dataTable.getColumns().add(tableColumnInitValue); tableColumnDefaultValue = new TableColumn<ICFBamNumberColObj, BigDecimal>("Default Value"); tableColumnDefaultValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamNumberColObj, BigDecimal>, ObservableValue<BigDecimal>>() { public ObservableValue<BigDecimal> call(CellDataFeatures<ICFBamNumberColObj, BigDecimal> p) { ICFBamNumberDefObj obj = p.getValue(); if (obj == null) { return (null); } else { BigDecimal value = obj.getOptionalDefaultValue(); ReadOnlyObjectWrapper<BigDecimal> observable = new ReadOnlyObjectWrapper<BigDecimal>(); observable.setValue(value); return (observable); } } }); tableColumnDefaultValue.setCellFactory( new Callback<TableColumn<ICFBamNumberColObj, BigDecimal>, TableCell<ICFBamNumberColObj, BigDecimal>>() { @Override public TableCell<ICFBamNumberColObj, BigDecimal> call( TableColumn<ICFBamNumberColObj, BigDecimal> arg) { return new CFNumberTableCell<ICFBamNumberColObj>(31, 5); } }); dataTable.getColumns().add(tableColumnDefaultValue); tableColumnMinValue = new TableColumn<ICFBamNumberColObj, BigDecimal>("Min. Value"); tableColumnMinValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamNumberColObj, BigDecimal>, ObservableValue<BigDecimal>>() { public ObservableValue<BigDecimal> call(CellDataFeatures<ICFBamNumberColObj, BigDecimal> p) { ICFBamNumberDefObj obj = p.getValue(); if (obj == null) { return (null); } else { BigDecimal value = obj.getOptionalMinValue(); ReadOnlyObjectWrapper<BigDecimal> observable = new ReadOnlyObjectWrapper<BigDecimal>(); observable.setValue(value); return (observable); } } }); tableColumnMinValue.setCellFactory( new Callback<TableColumn<ICFBamNumberColObj, BigDecimal>, TableCell<ICFBamNumberColObj, BigDecimal>>() { @Override public TableCell<ICFBamNumberColObj, BigDecimal> call( TableColumn<ICFBamNumberColObj, BigDecimal> arg) { return new CFNumberTableCell<ICFBamNumberColObj>(31, 5); } }); dataTable.getColumns().add(tableColumnMinValue); tableColumnMaxValue = new TableColumn<ICFBamNumberColObj, BigDecimal>("Max. Value"); tableColumnMaxValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamNumberColObj, BigDecimal>, ObservableValue<BigDecimal>>() { public ObservableValue<BigDecimal> call(CellDataFeatures<ICFBamNumberColObj, BigDecimal> p) { ICFBamNumberDefObj obj = p.getValue(); if (obj == null) { return (null); } else { BigDecimal value = obj.getOptionalMaxValue(); ReadOnlyObjectWrapper<BigDecimal> observable = new ReadOnlyObjectWrapper<BigDecimal>(); observable.setValue(value); return (observable); } } }); tableColumnMaxValue.setCellFactory( new Callback<TableColumn<ICFBamNumberColObj, BigDecimal>, TableCell<ICFBamNumberColObj, BigDecimal>>() { @Override public TableCell<ICFBamNumberColObj, BigDecimal> call( TableColumn<ICFBamNumberColObj, BigDecimal> arg) { return new CFNumberTableCell<ICFBamNumberColObj>(31, 5); } }); dataTable.getColumns().add(tableColumnMaxValue); tableColumnNullValue = new TableColumn<ICFBamNumberColObj, BigDecimal>("Null Value"); tableColumnNullValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamNumberColObj, BigDecimal>, ObservableValue<BigDecimal>>() { public ObservableValue<BigDecimal> call(CellDataFeatures<ICFBamNumberColObj, BigDecimal> p) { ICFBamNumberDefObj obj = p.getValue(); if (obj == null) { return (null); } else { BigDecimal value = obj.getOptionalNullValue(); ReadOnlyObjectWrapper<BigDecimal> observable = new ReadOnlyObjectWrapper<BigDecimal>(); observable.setValue(value); return (observable); } } }); tableColumnNullValue.setCellFactory( new Callback<TableColumn<ICFBamNumberColObj, BigDecimal>, TableCell<ICFBamNumberColObj, BigDecimal>>() { @Override public TableCell<ICFBamNumberColObj, BigDecimal> call( TableColumn<ICFBamNumberColObj, BigDecimal> arg) { return new CFNumberTableCell<ICFBamNumberColObj>(31, 5); } }); dataTable.getColumns().add(tableColumnNullValue); tableColumnUnknownValue = new TableColumn<ICFBamNumberColObj, BigDecimal>("Unknown Value"); tableColumnUnknownValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamNumberColObj, BigDecimal>, ObservableValue<BigDecimal>>() { public ObservableValue<BigDecimal> call(CellDataFeatures<ICFBamNumberColObj, BigDecimal> p) { ICFBamNumberDefObj obj = p.getValue(); if (obj == null) { return (null); } else { BigDecimal value = obj.getOptionalUnknownValue(); ReadOnlyObjectWrapper<BigDecimal> observable = new ReadOnlyObjectWrapper<BigDecimal>(); observable.setValue(value); return (observable); } } }); tableColumnUnknownValue.setCellFactory( new Callback<TableColumn<ICFBamNumberColObj, BigDecimal>, TableCell<ICFBamNumberColObj, BigDecimal>>() { @Override public TableCell<ICFBamNumberColObj, BigDecimal> call( TableColumn<ICFBamNumberColObj, BigDecimal> arg) { return new CFNumberTableCell<ICFBamNumberColObj>(31, 5); } }); dataTable.getColumns().add(tableColumnUnknownValue); tableColumnLookupDefSchema = new TableColumn<ICFBamNumberColObj, ICFBamSchemaDefObj>( "Defining Schema Definition"); tableColumnLookupDefSchema.setCellValueFactory( new Callback<CellDataFeatures<ICFBamNumberColObj, ICFBamSchemaDefObj>, ObservableValue<ICFBamSchemaDefObj>>() { public ObservableValue<ICFBamSchemaDefObj> call( CellDataFeatures<ICFBamNumberColObj, ICFBamSchemaDefObj> p) { ICFBamNumberColObj 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<ICFBamNumberColObj, ICFBamSchemaDefObj>, TableCell<ICFBamNumberColObj, ICFBamSchemaDefObj>>() { @Override public TableCell<ICFBamNumberColObj, ICFBamSchemaDefObj> call( TableColumn<ICFBamNumberColObj, ICFBamSchemaDefObj> arg) { return new CFReferenceTableCell<ICFBamNumberColObj, ICFBamSchemaDefObj>(); } }); dataTable.getColumns().add(tableColumnLookupDefSchema); dataTable.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<ICFBamNumberColObj>() { @Override public void changed(ObservableValue<? extends ICFBamNumberColObj> observable, ICFBamNumberColObj oldValue, ICFBamNumberColObj newValue) { setJavaFXFocus(newValue); } }); scrollMenu = new ScrollPane(); scrollMenu.setVbarPolicy(ScrollBarPolicy.NEVER); scrollMenu.setHbarPolicy(ScrollBarPolicy.AS_NEEDED); scrollMenu.setFitToHeight(true); scrollMenu.setContent(getPanelHBoxMenu()); setTop(scrollMenu); setCenter(dataTable); javafxIsInitializing = false; if (observableListOfNumberCol != null) { dataTable.setItems(observableListOfNumberCol); } adjustListButtons(); }
From source file:net.sourceforge.msscodefactory.cfbam.v2_7.CFBamJavaFX.CFBamJavaFXStringTypePickerPane.java
public CFBamJavaFXStringTypePickerPane(ICFFormManager formManager, ICFBamJavaFXSchema argSchema, ICFBamStringTypeObj argFocus, ICFBamSchemaDefObj argContainer, Collection<ICFBamStringTypeObj> argDataCollection, ICFBamJavaFXStringTypeChosen whenChosen) { super();//from w w w . j a va2 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<ICFBamStringTypeObj>(); tableColumnId = new TableColumn<ICFBamStringTypeObj, Long>("Id"); tableColumnId.setCellValueFactory( new Callback<CellDataFeatures<ICFBamStringTypeObj, Long>, ObservableValue<Long>>() { public ObservableValue<Long> call(CellDataFeatures<ICFBamStringTypeObj, 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<ICFBamStringTypeObj, Long>, TableCell<ICFBamStringTypeObj, Long>>() { @Override public TableCell<ICFBamStringTypeObj, Long> call(TableColumn<ICFBamStringTypeObj, Long> arg) { return new CFInt64TableCell<ICFBamStringTypeObj>(); } }); dataTable.getColumns().add(tableColumnId); tableColumnName = new TableColumn<ICFBamStringTypeObj, String>("Name"); tableColumnName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamStringTypeObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamStringTypeObj, 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<ICFBamStringTypeObj, String>, TableCell<ICFBamStringTypeObj, String>>() { @Override public TableCell<ICFBamStringTypeObj, String> call( TableColumn<ICFBamStringTypeObj, String> arg) { return new CFStringTableCell<ICFBamStringTypeObj>(); } }); dataTable.getColumns().add(tableColumnName); tableColumnShortName = new TableColumn<ICFBamStringTypeObj, String>("Short Name"); tableColumnShortName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamStringTypeObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamStringTypeObj, 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<ICFBamStringTypeObj, String>, TableCell<ICFBamStringTypeObj, String>>() { @Override public TableCell<ICFBamStringTypeObj, String> call( TableColumn<ICFBamStringTypeObj, String> arg) { return new CFStringTableCell<ICFBamStringTypeObj>(); } }); dataTable.getColumns().add(tableColumnShortName); tableColumnLabel = new TableColumn<ICFBamStringTypeObj, String>("Label"); tableColumnLabel.setCellValueFactory( new Callback<CellDataFeatures<ICFBamStringTypeObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamStringTypeObj, 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<ICFBamStringTypeObj, String>, TableCell<ICFBamStringTypeObj, String>>() { @Override public TableCell<ICFBamStringTypeObj, String> call( TableColumn<ICFBamStringTypeObj, String> arg) { return new CFStringTableCell<ICFBamStringTypeObj>(); } }); dataTable.getColumns().add(tableColumnLabel); tableColumnShortDescription = new TableColumn<ICFBamStringTypeObj, String>("Short Description"); tableColumnShortDescription.setCellValueFactory( new Callback<CellDataFeatures<ICFBamStringTypeObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamStringTypeObj, 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<ICFBamStringTypeObj, String>, TableCell<ICFBamStringTypeObj, String>>() { @Override public TableCell<ICFBamStringTypeObj, String> call( TableColumn<ICFBamStringTypeObj, String> arg) { return new CFStringTableCell<ICFBamStringTypeObj>(); } }); dataTable.getColumns().add(tableColumnShortDescription); tableColumnDescription = new TableColumn<ICFBamStringTypeObj, String>("Description"); tableColumnDescription.setCellValueFactory( new Callback<CellDataFeatures<ICFBamStringTypeObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamStringTypeObj, 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<ICFBamStringTypeObj, String>, TableCell<ICFBamStringTypeObj, String>>() { @Override public TableCell<ICFBamStringTypeObj, String> call( TableColumn<ICFBamStringTypeObj, String> arg) { return new CFStringTableCell<ICFBamStringTypeObj>(); } }); dataTable.getColumns().add(tableColumnDescription); tableColumnIsNullable = new TableColumn<ICFBamStringTypeObj, Boolean>("Is Nullable"); tableColumnIsNullable.setCellValueFactory( new Callback<CellDataFeatures<ICFBamStringTypeObj, Boolean>, ObservableValue<Boolean>>() { public ObservableValue<Boolean> call(CellDataFeatures<ICFBamStringTypeObj, 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<ICFBamStringTypeObj, Boolean>, TableCell<ICFBamStringTypeObj, Boolean>>() { @Override public TableCell<ICFBamStringTypeObj, Boolean> call( TableColumn<ICFBamStringTypeObj, Boolean> arg) { return new CFBoolTableCell<ICFBamStringTypeObj>(); } }); dataTable.getColumns().add(tableColumnIsNullable); tableColumnGenerateId = new TableColumn<ICFBamStringTypeObj, Boolean>("Generate Id"); tableColumnGenerateId.setCellValueFactory( new Callback<CellDataFeatures<ICFBamStringTypeObj, Boolean>, ObservableValue<Boolean>>() { public ObservableValue<Boolean> call(CellDataFeatures<ICFBamStringTypeObj, 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<ICFBamStringTypeObj, Boolean>, TableCell<ICFBamStringTypeObj, Boolean>>() { @Override public TableCell<ICFBamStringTypeObj, Boolean> call( TableColumn<ICFBamStringTypeObj, Boolean> arg) { return new CFBoolTableCell<ICFBamStringTypeObj>(); } }); dataTable.getColumns().add(tableColumnGenerateId); tableColumnDefaultVisibility = new TableColumn<ICFBamStringTypeObj, Boolean>("Default Visibility"); tableColumnDefaultVisibility.setCellValueFactory( new Callback<CellDataFeatures<ICFBamStringTypeObj, Boolean>, ObservableValue<Boolean>>() { public ObservableValue<Boolean> call(CellDataFeatures<ICFBamStringTypeObj, 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<ICFBamStringTypeObj, Boolean>, TableCell<ICFBamStringTypeObj, Boolean>>() { @Override public TableCell<ICFBamStringTypeObj, Boolean> call( TableColumn<ICFBamStringTypeObj, Boolean> arg) { return new CFBoolTableCell<ICFBamStringTypeObj>(); } }); dataTable.getColumns().add(tableColumnDefaultVisibility); tableColumnDbName = new TableColumn<ICFBamStringTypeObj, String>("Db Name"); tableColumnDbName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamStringTypeObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamStringTypeObj, 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<ICFBamStringTypeObj, String>, TableCell<ICFBamStringTypeObj, String>>() { @Override public TableCell<ICFBamStringTypeObj, String> call( TableColumn<ICFBamStringTypeObj, String> arg) { return new CFStringTableCell<ICFBamStringTypeObj>(); } }); dataTable.getColumns().add(tableColumnDbName); tableColumnMaxLen = new TableColumn<ICFBamStringTypeObj, Integer>("Max. Length"); tableColumnMaxLen.setCellValueFactory( new Callback<CellDataFeatures<ICFBamStringTypeObj, Integer>, ObservableValue<Integer>>() { public ObservableValue<Integer> call(CellDataFeatures<ICFBamStringTypeObj, 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<ICFBamStringTypeObj, Integer>, TableCell<ICFBamStringTypeObj, Integer>>() { @Override public TableCell<ICFBamStringTypeObj, Integer> call( TableColumn<ICFBamStringTypeObj, Integer> arg) { return new CFInt32TableCell<ICFBamStringTypeObj>(); } }); dataTable.getColumns().add(tableColumnMaxLen); tableColumnShowLines = new TableColumn<ICFBamStringTypeObj, Short>("Show Lines"); tableColumnShowLines.setCellValueFactory( new Callback<CellDataFeatures<ICFBamStringTypeObj, Short>, ObservableValue<Short>>() { public ObservableValue<Short> call(CellDataFeatures<ICFBamStringTypeObj, 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<ICFBamStringTypeObj, Short>, TableCell<ICFBamStringTypeObj, Short>>() { @Override public TableCell<ICFBamStringTypeObj, Short> call(TableColumn<ICFBamStringTypeObj, Short> arg) { return new CFInt16TableCell<ICFBamStringTypeObj>(); } }); dataTable.getColumns().add(tableColumnShowLines); tableColumnInitValue = new TableColumn<ICFBamStringTypeObj, String>("Init. Value"); tableColumnInitValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamStringTypeObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamStringTypeObj, 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<ICFBamStringTypeObj, String>, TableCell<ICFBamStringTypeObj, String>>() { @Override public TableCell<ICFBamStringTypeObj, String> call( TableColumn<ICFBamStringTypeObj, String> arg) { return new CFStringTableCell<ICFBamStringTypeObj>(); } }); dataTable.getColumns().add(tableColumnInitValue); tableColumnDefaultValue = new TableColumn<ICFBamStringTypeObj, String>("Default Value"); tableColumnDefaultValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamStringTypeObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamStringTypeObj, 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<ICFBamStringTypeObj, String>, TableCell<ICFBamStringTypeObj, String>>() { @Override public TableCell<ICFBamStringTypeObj, String> call( TableColumn<ICFBamStringTypeObj, String> arg) { return new CFStringTableCell<ICFBamStringTypeObj>(); } }); dataTable.getColumns().add(tableColumnDefaultValue); tableColumnNullValue = new TableColumn<ICFBamStringTypeObj, String>("Null Value"); tableColumnNullValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamStringTypeObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamStringTypeObj, 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<ICFBamStringTypeObj, String>, TableCell<ICFBamStringTypeObj, String>>() { @Override public TableCell<ICFBamStringTypeObj, String> call( TableColumn<ICFBamStringTypeObj, String> arg) { return new CFStringTableCell<ICFBamStringTypeObj>(); } }); dataTable.getColumns().add(tableColumnNullValue); tableColumnUnknownValue = new TableColumn<ICFBamStringTypeObj, String>("Unknown Value"); tableColumnUnknownValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamStringTypeObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamStringTypeObj, 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<ICFBamStringTypeObj, String>, TableCell<ICFBamStringTypeObj, String>>() { @Override public TableCell<ICFBamStringTypeObj, String> call( TableColumn<ICFBamStringTypeObj, String> arg) { return new CFStringTableCell<ICFBamStringTypeObj>(); } }); dataTable.getColumns().add(tableColumnUnknownValue); tableColumnLookupDefSchema = new TableColumn<ICFBamStringTypeObj, ICFBamSchemaDefObj>( "Defining Schema Definition"); tableColumnLookupDefSchema.setCellValueFactory( new Callback<CellDataFeatures<ICFBamStringTypeObj, ICFBamSchemaDefObj>, ObservableValue<ICFBamSchemaDefObj>>() { public ObservableValue<ICFBamSchemaDefObj> call( CellDataFeatures<ICFBamStringTypeObj, ICFBamSchemaDefObj> p) { ICFBamStringTypeObj 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<ICFBamStringTypeObj, ICFBamSchemaDefObj>, TableCell<ICFBamStringTypeObj, ICFBamSchemaDefObj>>() { @Override public TableCell<ICFBamStringTypeObj, ICFBamSchemaDefObj> call( TableColumn<ICFBamStringTypeObj, ICFBamSchemaDefObj> arg) { return new CFReferenceTableCell<ICFBamStringTypeObj, ICFBamSchemaDefObj>(); } }); dataTable.getColumns().add(tableColumnLookupDefSchema); dataTable.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<ICFBamStringTypeObj>() { @Override public void changed(ObservableValue<? extends ICFBamStringTypeObj> observable, ICFBamStringTypeObj oldValue, ICFBamStringTypeObj 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.choseStringType(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"); } ICFBamStringTypeObj selectedInstance = getJavaFXFocusAsStringType(); invokeWhenChosen.choseStringType(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.CFBamJavaFXNumberDefPickerPane.java
public CFBamJavaFXNumberDefPickerPane(ICFFormManager formManager, ICFBamJavaFXSchema argSchema, ICFBamNumberDefObj argFocus, ICFBamScopeObj argContainer, Collection<ICFBamNumberDefObj> argDataCollection, ICFBamJavaFXNumberDefChosen whenChosen) { super();/*from w w w.j a v 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<ICFBamNumberDefObj>(); tableColumnObjKind = new TableColumn<ICFBamNumberDefObj, String>("Class Code"); tableColumnObjKind.setCellValueFactory( new Callback<CellDataFeatures<ICFBamNumberDefObj, String>, ObservableValue<String>>() { @Override public ObservableValue<String> call(CellDataFeatures<ICFBamNumberDefObj, String> p) { ICFBamNumberDefObj obj = p.getValue(); if (obj == null) { return (null); } else { String classCode = obj.getClassCode(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(classCode); return (observable); } } }); tableColumnObjKind.setCellFactory( new Callback<TableColumn<ICFBamNumberDefObj, String>, TableCell<ICFBamNumberDefObj, String>>() { @Override public TableCell<ICFBamNumberDefObj, String> call(TableColumn<ICFBamNumberDefObj, String> arg) { return new CFStringTableCell<ICFBamNumberDefObj>(); } }); dataTable.getColumns().add(tableColumnObjKind); tableColumnId = new TableColumn<ICFBamNumberDefObj, Long>("Id"); tableColumnId.setCellValueFactory( new Callback<CellDataFeatures<ICFBamNumberDefObj, Long>, ObservableValue<Long>>() { public ObservableValue<Long> call(CellDataFeatures<ICFBamNumberDefObj, Long> p) { ICFBamValueObj obj = p.getValue(); if (obj == null) { return (null); } else { long value = obj.getRequiredId(); Long wrapped = new Long(value); ReadOnlyObjectWrapper<Long> observable = new ReadOnlyObjectWrapper<Long>(); observable.setValue(wrapped); return (observable); } } }); tableColumnId.setCellFactory( new Callback<TableColumn<ICFBamNumberDefObj, Long>, TableCell<ICFBamNumberDefObj, Long>>() { @Override public TableCell<ICFBamNumberDefObj, Long> call(TableColumn<ICFBamNumberDefObj, Long> arg) { return new CFInt64TableCell<ICFBamNumberDefObj>(); } }); dataTable.getColumns().add(tableColumnId); tableColumnName = new TableColumn<ICFBamNumberDefObj, String>("Name"); tableColumnName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamNumberDefObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamNumberDefObj, String> p) { ICFBamValueObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getRequiredName(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnName.setCellFactory( new Callback<TableColumn<ICFBamNumberDefObj, String>, TableCell<ICFBamNumberDefObj, String>>() { @Override public TableCell<ICFBamNumberDefObj, String> call(TableColumn<ICFBamNumberDefObj, String> arg) { return new CFStringTableCell<ICFBamNumberDefObj>(); } }); dataTable.getColumns().add(tableColumnName); tableColumnShortName = new TableColumn<ICFBamNumberDefObj, String>("Short Name"); tableColumnShortName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamNumberDefObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamNumberDefObj, String> p) { ICFBamValueObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getOptionalShortName(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnShortName.setCellFactory( new Callback<TableColumn<ICFBamNumberDefObj, String>, TableCell<ICFBamNumberDefObj, String>>() { @Override public TableCell<ICFBamNumberDefObj, String> call(TableColumn<ICFBamNumberDefObj, String> arg) { return new CFStringTableCell<ICFBamNumberDefObj>(); } }); dataTable.getColumns().add(tableColumnShortName); tableColumnLabel = new TableColumn<ICFBamNumberDefObj, String>("Label"); tableColumnLabel.setCellValueFactory( new Callback<CellDataFeatures<ICFBamNumberDefObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamNumberDefObj, String> p) { ICFBamValueObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getOptionalLabel(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnLabel.setCellFactory( new Callback<TableColumn<ICFBamNumberDefObj, String>, TableCell<ICFBamNumberDefObj, String>>() { @Override public TableCell<ICFBamNumberDefObj, String> call(TableColumn<ICFBamNumberDefObj, String> arg) { return new CFStringTableCell<ICFBamNumberDefObj>(); } }); dataTable.getColumns().add(tableColumnLabel); tableColumnShortDescription = new TableColumn<ICFBamNumberDefObj, String>("Short Description"); tableColumnShortDescription.setCellValueFactory( new Callback<CellDataFeatures<ICFBamNumberDefObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamNumberDefObj, String> p) { ICFBamValueObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getOptionalShortDescription(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnShortDescription.setCellFactory( new Callback<TableColumn<ICFBamNumberDefObj, String>, TableCell<ICFBamNumberDefObj, String>>() { @Override public TableCell<ICFBamNumberDefObj, String> call(TableColumn<ICFBamNumberDefObj, String> arg) { return new CFStringTableCell<ICFBamNumberDefObj>(); } }); dataTable.getColumns().add(tableColumnShortDescription); tableColumnDescription = new TableColumn<ICFBamNumberDefObj, String>("Description"); tableColumnDescription.setCellValueFactory( new Callback<CellDataFeatures<ICFBamNumberDefObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamNumberDefObj, String> p) { ICFBamValueObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getOptionalDescription(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnDescription.setCellFactory( new Callback<TableColumn<ICFBamNumberDefObj, String>, TableCell<ICFBamNumberDefObj, String>>() { @Override public TableCell<ICFBamNumberDefObj, String> call(TableColumn<ICFBamNumberDefObj, String> arg) { return new CFStringTableCell<ICFBamNumberDefObj>(); } }); dataTable.getColumns().add(tableColumnDescription); tableColumnIsNullable = new TableColumn<ICFBamNumberDefObj, Boolean>("Is Nullable"); tableColumnIsNullable.setCellValueFactory( new Callback<CellDataFeatures<ICFBamNumberDefObj, Boolean>, ObservableValue<Boolean>>() { public ObservableValue<Boolean> call(CellDataFeatures<ICFBamNumberDefObj, Boolean> p) { ICFBamValueObj obj = p.getValue(); if (obj == null) { return (null); } else { boolean value = obj.getRequiredIsNullable(); Boolean wrapped = new Boolean(value); ReadOnlyObjectWrapper<Boolean> observable = new ReadOnlyObjectWrapper<Boolean>(); observable.setValue(wrapped); return (observable); } } }); tableColumnIsNullable.setCellFactory( new Callback<TableColumn<ICFBamNumberDefObj, Boolean>, TableCell<ICFBamNumberDefObj, Boolean>>() { @Override public TableCell<ICFBamNumberDefObj, Boolean> call( TableColumn<ICFBamNumberDefObj, Boolean> arg) { return new CFBoolTableCell<ICFBamNumberDefObj>(); } }); dataTable.getColumns().add(tableColumnIsNullable); tableColumnGenerateId = new TableColumn<ICFBamNumberDefObj, Boolean>("Generate Id"); tableColumnGenerateId.setCellValueFactory( new Callback<CellDataFeatures<ICFBamNumberDefObj, Boolean>, ObservableValue<Boolean>>() { public ObservableValue<Boolean> call(CellDataFeatures<ICFBamNumberDefObj, Boolean> p) { ICFBamValueObj obj = p.getValue(); if (obj == null) { return (null); } else { Boolean value = obj.getOptionalGenerateId(); ReadOnlyObjectWrapper<Boolean> observable = new ReadOnlyObjectWrapper<Boolean>(); observable.setValue(value); return (observable); } } }); tableColumnGenerateId.setCellFactory( new Callback<TableColumn<ICFBamNumberDefObj, Boolean>, TableCell<ICFBamNumberDefObj, Boolean>>() { @Override public TableCell<ICFBamNumberDefObj, Boolean> call( TableColumn<ICFBamNumberDefObj, Boolean> arg) { return new CFBoolTableCell<ICFBamNumberDefObj>(); } }); dataTable.getColumns().add(tableColumnGenerateId); tableColumnDefaultVisibility = new TableColumn<ICFBamNumberDefObj, Boolean>("Default Visibility"); tableColumnDefaultVisibility.setCellValueFactory( new Callback<CellDataFeatures<ICFBamNumberDefObj, Boolean>, ObservableValue<Boolean>>() { public ObservableValue<Boolean> call(CellDataFeatures<ICFBamNumberDefObj, Boolean> p) { ICFBamValueObj obj = p.getValue(); if (obj == null) { return (null); } else { boolean value = obj.getRequiredDefaultVisibility(); Boolean wrapped = new Boolean(value); ReadOnlyObjectWrapper<Boolean> observable = new ReadOnlyObjectWrapper<Boolean>(); observable.setValue(wrapped); return (observable); } } }); tableColumnDefaultVisibility.setCellFactory( new Callback<TableColumn<ICFBamNumberDefObj, Boolean>, TableCell<ICFBamNumberDefObj, Boolean>>() { @Override public TableCell<ICFBamNumberDefObj, Boolean> call( TableColumn<ICFBamNumberDefObj, Boolean> arg) { return new CFBoolTableCell<ICFBamNumberDefObj>(); } }); dataTable.getColumns().add(tableColumnDefaultVisibility); tableColumnDbName = new TableColumn<ICFBamNumberDefObj, String>("Db Name"); tableColumnDbName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamNumberDefObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamNumberDefObj, String> p) { ICFBamAtomObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getOptionalDbName(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnDbName.setCellFactory( new Callback<TableColumn<ICFBamNumberDefObj, String>, TableCell<ICFBamNumberDefObj, String>>() { @Override public TableCell<ICFBamNumberDefObj, String> call(TableColumn<ICFBamNumberDefObj, String> arg) { return new CFStringTableCell<ICFBamNumberDefObj>(); } }); dataTable.getColumns().add(tableColumnDbName); tableColumnDigits = new TableColumn<ICFBamNumberDefObj, Short>("Digits"); tableColumnDigits.setCellValueFactory( new Callback<CellDataFeatures<ICFBamNumberDefObj, Short>, ObservableValue<Short>>() { public ObservableValue<Short> call(CellDataFeatures<ICFBamNumberDefObj, Short> p) { ICFBamNumberDefObj obj = p.getValue(); if (obj == null) { return (null); } else { short value = obj.getRequiredDigits(); Short wrapped = new Short(value); ReadOnlyObjectWrapper<Short> observable = new ReadOnlyObjectWrapper<Short>(); observable.setValue(wrapped); return (observable); } } }); tableColumnDigits.setCellFactory( new Callback<TableColumn<ICFBamNumberDefObj, Short>, TableCell<ICFBamNumberDefObj, Short>>() { @Override public TableCell<ICFBamNumberDefObj, Short> call(TableColumn<ICFBamNumberDefObj, Short> arg) { return new CFInt16TableCell<ICFBamNumberDefObj>(); } }); dataTable.getColumns().add(tableColumnDigits); tableColumnPrecis = new TableColumn<ICFBamNumberDefObj, Short>("Precision"); tableColumnPrecis.setCellValueFactory( new Callback<CellDataFeatures<ICFBamNumberDefObj, Short>, ObservableValue<Short>>() { public ObservableValue<Short> call(CellDataFeatures<ICFBamNumberDefObj, Short> p) { ICFBamNumberDefObj obj = p.getValue(); if (obj == null) { return (null); } else { short value = obj.getRequiredPrecis(); Short wrapped = new Short(value); ReadOnlyObjectWrapper<Short> observable = new ReadOnlyObjectWrapper<Short>(); observable.setValue(wrapped); return (observable); } } }); tableColumnPrecis.setCellFactory( new Callback<TableColumn<ICFBamNumberDefObj, Short>, TableCell<ICFBamNumberDefObj, Short>>() { @Override public TableCell<ICFBamNumberDefObj, Short> call(TableColumn<ICFBamNumberDefObj, Short> arg) { return new CFInt16TableCell<ICFBamNumberDefObj>(); } }); dataTable.getColumns().add(tableColumnPrecis); tableColumnInitValue = new TableColumn<ICFBamNumberDefObj, BigDecimal>("Init. Value"); tableColumnInitValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamNumberDefObj, BigDecimal>, ObservableValue<BigDecimal>>() { public ObservableValue<BigDecimal> call(CellDataFeatures<ICFBamNumberDefObj, BigDecimal> p) { ICFBamNumberDefObj obj = p.getValue(); if (obj == null) { return (null); } else { BigDecimal value = obj.getOptionalInitValue(); ReadOnlyObjectWrapper<BigDecimal> observable = new ReadOnlyObjectWrapper<BigDecimal>(); observable.setValue(value); return (observable); } } }); tableColumnInitValue.setCellFactory( new Callback<TableColumn<ICFBamNumberDefObj, BigDecimal>, TableCell<ICFBamNumberDefObj, BigDecimal>>() { @Override public TableCell<ICFBamNumberDefObj, BigDecimal> call( TableColumn<ICFBamNumberDefObj, BigDecimal> arg) { return new CFNumberTableCell<ICFBamNumberDefObj>(31, 5); } }); dataTable.getColumns().add(tableColumnInitValue); tableColumnDefaultValue = new TableColumn<ICFBamNumberDefObj, BigDecimal>("Default Value"); tableColumnDefaultValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamNumberDefObj, BigDecimal>, ObservableValue<BigDecimal>>() { public ObservableValue<BigDecimal> call(CellDataFeatures<ICFBamNumberDefObj, BigDecimal> p) { ICFBamNumberDefObj obj = p.getValue(); if (obj == null) { return (null); } else { BigDecimal value = obj.getOptionalDefaultValue(); ReadOnlyObjectWrapper<BigDecimal> observable = new ReadOnlyObjectWrapper<BigDecimal>(); observable.setValue(value); return (observable); } } }); tableColumnDefaultValue.setCellFactory( new Callback<TableColumn<ICFBamNumberDefObj, BigDecimal>, TableCell<ICFBamNumberDefObj, BigDecimal>>() { @Override public TableCell<ICFBamNumberDefObj, BigDecimal> call( TableColumn<ICFBamNumberDefObj, BigDecimal> arg) { return new CFNumberTableCell<ICFBamNumberDefObj>(31, 5); } }); dataTable.getColumns().add(tableColumnDefaultValue); tableColumnMinValue = new TableColumn<ICFBamNumberDefObj, BigDecimal>("Min. Value"); tableColumnMinValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamNumberDefObj, BigDecimal>, ObservableValue<BigDecimal>>() { public ObservableValue<BigDecimal> call(CellDataFeatures<ICFBamNumberDefObj, BigDecimal> p) { ICFBamNumberDefObj obj = p.getValue(); if (obj == null) { return (null); } else { BigDecimal value = obj.getOptionalMinValue(); ReadOnlyObjectWrapper<BigDecimal> observable = new ReadOnlyObjectWrapper<BigDecimal>(); observable.setValue(value); return (observable); } } }); tableColumnMinValue.setCellFactory( new Callback<TableColumn<ICFBamNumberDefObj, BigDecimal>, TableCell<ICFBamNumberDefObj, BigDecimal>>() { @Override public TableCell<ICFBamNumberDefObj, BigDecimal> call( TableColumn<ICFBamNumberDefObj, BigDecimal> arg) { return new CFNumberTableCell<ICFBamNumberDefObj>(31, 5); } }); dataTable.getColumns().add(tableColumnMinValue); tableColumnMaxValue = new TableColumn<ICFBamNumberDefObj, BigDecimal>("Max. Value"); tableColumnMaxValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamNumberDefObj, BigDecimal>, ObservableValue<BigDecimal>>() { public ObservableValue<BigDecimal> call(CellDataFeatures<ICFBamNumberDefObj, BigDecimal> p) { ICFBamNumberDefObj obj = p.getValue(); if (obj == null) { return (null); } else { BigDecimal value = obj.getOptionalMaxValue(); ReadOnlyObjectWrapper<BigDecimal> observable = new ReadOnlyObjectWrapper<BigDecimal>(); observable.setValue(value); return (observable); } } }); tableColumnMaxValue.setCellFactory( new Callback<TableColumn<ICFBamNumberDefObj, BigDecimal>, TableCell<ICFBamNumberDefObj, BigDecimal>>() { @Override public TableCell<ICFBamNumberDefObj, BigDecimal> call( TableColumn<ICFBamNumberDefObj, BigDecimal> arg) { return new CFNumberTableCell<ICFBamNumberDefObj>(31, 5); } }); dataTable.getColumns().add(tableColumnMaxValue); tableColumnNullValue = new TableColumn<ICFBamNumberDefObj, BigDecimal>("Null Value"); tableColumnNullValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamNumberDefObj, BigDecimal>, ObservableValue<BigDecimal>>() { public ObservableValue<BigDecimal> call(CellDataFeatures<ICFBamNumberDefObj, BigDecimal> p) { ICFBamNumberDefObj obj = p.getValue(); if (obj == null) { return (null); } else { BigDecimal value = obj.getOptionalNullValue(); ReadOnlyObjectWrapper<BigDecimal> observable = new ReadOnlyObjectWrapper<BigDecimal>(); observable.setValue(value); return (observable); } } }); tableColumnNullValue.setCellFactory( new Callback<TableColumn<ICFBamNumberDefObj, BigDecimal>, TableCell<ICFBamNumberDefObj, BigDecimal>>() { @Override public TableCell<ICFBamNumberDefObj, BigDecimal> call( TableColumn<ICFBamNumberDefObj, BigDecimal> arg) { return new CFNumberTableCell<ICFBamNumberDefObj>(31, 5); } }); dataTable.getColumns().add(tableColumnNullValue); tableColumnUnknownValue = new TableColumn<ICFBamNumberDefObj, BigDecimal>("Unknown Value"); tableColumnUnknownValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamNumberDefObj, BigDecimal>, ObservableValue<BigDecimal>>() { public ObservableValue<BigDecimal> call(CellDataFeatures<ICFBamNumberDefObj, BigDecimal> p) { ICFBamNumberDefObj obj = p.getValue(); if (obj == null) { return (null); } else { BigDecimal value = obj.getOptionalUnknownValue(); ReadOnlyObjectWrapper<BigDecimal> observable = new ReadOnlyObjectWrapper<BigDecimal>(); observable.setValue(value); return (observable); } } }); tableColumnUnknownValue.setCellFactory( new Callback<TableColumn<ICFBamNumberDefObj, BigDecimal>, TableCell<ICFBamNumberDefObj, BigDecimal>>() { @Override public TableCell<ICFBamNumberDefObj, BigDecimal> call( TableColumn<ICFBamNumberDefObj, BigDecimal> arg) { return new CFNumberTableCell<ICFBamNumberDefObj>(31, 5); } }); dataTable.getColumns().add(tableColumnUnknownValue); tableColumnLookupDefSchema = new TableColumn<ICFBamNumberDefObj, ICFBamSchemaDefObj>( "Defining Schema Definition"); tableColumnLookupDefSchema.setCellValueFactory( new Callback<CellDataFeatures<ICFBamNumberDefObj, ICFBamSchemaDefObj>, ObservableValue<ICFBamSchemaDefObj>>() { public ObservableValue<ICFBamSchemaDefObj> call( CellDataFeatures<ICFBamNumberDefObj, ICFBamSchemaDefObj> p) { ICFBamNumberDefObj obj = p.getValue(); if (obj == null) { return (null); } else { ICFBamSchemaDefObj ref = obj.getOptionalLookupDefSchema(); ReadOnlyObjectWrapper<ICFBamSchemaDefObj> observable = new ReadOnlyObjectWrapper<ICFBamSchemaDefObj>(); observable.setValue(ref); return (observable); } } }); tableColumnLookupDefSchema.setCellFactory( new Callback<TableColumn<ICFBamNumberDefObj, ICFBamSchemaDefObj>, TableCell<ICFBamNumberDefObj, ICFBamSchemaDefObj>>() { @Override public TableCell<ICFBamNumberDefObj, ICFBamSchemaDefObj> call( TableColumn<ICFBamNumberDefObj, ICFBamSchemaDefObj> arg) { return new CFReferenceTableCell<ICFBamNumberDefObj, ICFBamSchemaDefObj>(); } }); dataTable.getColumns().add(tableColumnLookupDefSchema); dataTable.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<ICFBamNumberDefObj>() { @Override public void changed(ObservableValue<? extends ICFBamNumberDefObj> observable, ICFBamNumberDefObj oldValue, ICFBamNumberDefObj newValue) { setJavaFXFocus(newValue); if (buttonChooseSelected != null) { if (newValue != null) { buttonChooseSelected.setDisable(false); } else { buttonChooseSelected.setDisable(true); } } } }); hboxMenu = new CFHBox(10); buttonCancel = new CFButton(); buttonCancel.setMinWidth(200); buttonCancel.setText("Cancel"); buttonCancel.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { cfFormManager.closeCurrentForm(); } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); hboxMenu.getChildren().add(buttonCancel); buttonChooseNone = new CFButton(); buttonChooseNone.setMinWidth(200); buttonChooseNone.setText("ChooseNone"); buttonChooseNone.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "schemaObj"); } invokeWhenChosen.choseNumberDef(null); cfFormManager.closeCurrentForm(); } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); hboxMenu.getChildren().add(buttonChooseNone); buttonChooseSelected = new CFButton(); buttonChooseSelected.setMinWidth(200); buttonChooseSelected.setText("ChooseSelected"); buttonChooseSelected.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "schemaObj"); } ICFBamNumberDefObj selectedInstance = getJavaFXFocusAsNumberDef(); invokeWhenChosen.choseNumberDef(selectedInstance); cfFormManager.closeCurrentForm(); } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); hboxMenu.getChildren().add(buttonChooseSelected); if (argFocus != null) { dataTable.getSelectionModel().select(argFocus); } setTop(hboxMenu); setCenter(dataTable); }
From source file:com.draagon.meta.manager.ObjectManager.java
protected static boolean compareValue(Object val, Object val2, int condition) { // If it's a collection, then iterate the whole array if (val2 instanceof Collection) { // Has to be EQUAL or NOT EQUAL if (condition != Expression.EQUAL && condition != Expression.NOT_EQUAL) { throw new IllegalArgumentException( "Can only compare with EQUAL or NOT EQUAL against a collection!"); }/*from ww w . jav a2s . co m*/ // Iterate each value in the collection for (Object v : ((Collection<?>) val2)) { // Get the resulting condition boolean ret = compareValue(val, v, condition); // return true if there are any matches if (condition == Expression.EQUAL && ret) return true; // if looking for not equal, return false when finding the first one else if (condition == Expression.NOT_EQUAL && !ret) return false; } // Return true or false based on the condition if (condition == Expression.EQUAL) return false; else if (condition == Expression.NOT_EQUAL) return true; else throw new IllegalStateException("This has to be EQUAL or NOT EQUAL"); } int result = 0; if (val == null || val2 == null) { if (val == null && val2 == null) result = 0; else if (val == null) result = -1; else result = 1; } else if (val instanceof Boolean) { if (((Boolean) val).equals(val2)) result = 0; else result = 1; } else if (val instanceof Byte) { Byte v = (val2 instanceof Byte) ? (Byte) val2 : new Byte(val2.toString()); result = ((Byte) val).compareTo(v); } else if (val instanceof Short) { Short v = (val2 instanceof Short) ? (Short) val2 : new Short(val2.toString()); result = ((Short) val).compareTo(v); } else if (val instanceof Integer) { Integer v = (val2 instanceof Integer) ? (Integer) val2 : new Integer(val2.toString()); result = ((Integer) val).compareTo(v); } else if (val instanceof Long) { Long v = (val2 instanceof Long) ? (Long) val2 : new Long(val2.toString()); result = ((Long) val).compareTo(v); } else if (val instanceof Float) { Float v = (val2 instanceof Float) ? (Float) val2 : new Float(val2.toString()); result = ((Float) val).compareTo(v); } else if (val instanceof Double) { Double v = (val2 instanceof Double) ? (Double) val2 : new Double(val2.toString()); result = ((Double) val).compareTo(v); } else if (val instanceof Date) { Date v = (val2 instanceof Date) ? (Date) val2 : new Date(Long.parseLong(val2.toString())); result = ((Date) val).compareTo(v); } else { result = val.toString().toLowerCase().compareTo(val2.toString().toLowerCase()); } switch (condition) { case Expression.EQUAL: if (result == 0) return true; else return false; case Expression.GREATER: if (result > 0) return true; else return false; case Expression.LESSER: if (result < 0) return true; else return false; case Expression.EQUAL_GREATER: if (result >= 0) return true; else return false; case Expression.EQUAL_LESSER: if (result <= 0) return true; else return false; case Expression.NOT_EQUAL: if (result != 0) return true; else return false; default: throw new IllegalArgumentException( "Invalid expression condition [" + Expression.condStr(condition) + "]"); } }
From source file:net.sourceforge.msscodefactory.cfbam.v2_7.CFBamJavaFX.CFBamJavaFXNumberTypeListPane.java
public CFBamJavaFXNumberTypeListPane(ICFFormManager formManager, ICFBamJavaFXSchema argSchema, ICFBamSchemaDefObj argContainer, ICFBamNumberTypeObj argFocus, Collection<ICFBamNumberTypeObj> argDataCollection, ICFRefreshCallback refreshCallback, boolean sortByChain) { super();/*w w w . ja v a2 s.c om*/ final String S_ProcName = "construct-schema-focus"; if (formManager == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 1, "formManager"); } cfFormManager = formManager; if (argSchema == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 2, "argSchema"); } // argFocus is optional; focus may be set later during execution as // conditions of the runtime change. javafxSchema = argSchema; javaFXFocus = argFocus; javafxContainer = argContainer; javafxRefreshCallback = refreshCallback; javafxSortByChain = sortByChain; setJavaFXDataCollection(argDataCollection); dataTable = new TableView<ICFBamNumberTypeObj>(); tableColumnId = new TableColumn<ICFBamNumberTypeObj, Long>("Id"); tableColumnId.setCellValueFactory( new Callback<CellDataFeatures<ICFBamNumberTypeObj, Long>, ObservableValue<Long>>() { public ObservableValue<Long> call(CellDataFeatures<ICFBamNumberTypeObj, Long> p) { ICFBamValueObj obj = p.getValue(); if (obj == null) { return (null); } else { long value = obj.getRequiredId(); Long wrapped = new Long(value); ReadOnlyObjectWrapper<Long> observable = new ReadOnlyObjectWrapper<Long>(); observable.setValue(wrapped); return (observable); } } }); tableColumnId.setCellFactory( new Callback<TableColumn<ICFBamNumberTypeObj, Long>, TableCell<ICFBamNumberTypeObj, Long>>() { @Override public TableCell<ICFBamNumberTypeObj, Long> call(TableColumn<ICFBamNumberTypeObj, Long> arg) { return new CFInt64TableCell<ICFBamNumberTypeObj>(); } }); dataTable.getColumns().add(tableColumnId); tableColumnName = new TableColumn<ICFBamNumberTypeObj, String>("Name"); tableColumnName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamNumberTypeObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamNumberTypeObj, String> p) { ICFBamValueObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getRequiredName(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnName.setCellFactory( new Callback<TableColumn<ICFBamNumberTypeObj, String>, TableCell<ICFBamNumberTypeObj, String>>() { @Override public TableCell<ICFBamNumberTypeObj, String> call( TableColumn<ICFBamNumberTypeObj, String> arg) { return new CFStringTableCell<ICFBamNumberTypeObj>(); } }); dataTable.getColumns().add(tableColumnName); tableColumnShortName = new TableColumn<ICFBamNumberTypeObj, String>("Short Name"); tableColumnShortName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamNumberTypeObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamNumberTypeObj, String> p) { ICFBamValueObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getOptionalShortName(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnShortName.setCellFactory( new Callback<TableColumn<ICFBamNumberTypeObj, String>, TableCell<ICFBamNumberTypeObj, String>>() { @Override public TableCell<ICFBamNumberTypeObj, String> call( TableColumn<ICFBamNumberTypeObj, String> arg) { return new CFStringTableCell<ICFBamNumberTypeObj>(); } }); dataTable.getColumns().add(tableColumnShortName); tableColumnLabel = new TableColumn<ICFBamNumberTypeObj, String>("Label"); tableColumnLabel.setCellValueFactory( new Callback<CellDataFeatures<ICFBamNumberTypeObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamNumberTypeObj, String> p) { ICFBamValueObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getOptionalLabel(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnLabel.setCellFactory( new Callback<TableColumn<ICFBamNumberTypeObj, String>, TableCell<ICFBamNumberTypeObj, String>>() { @Override public TableCell<ICFBamNumberTypeObj, String> call( TableColumn<ICFBamNumberTypeObj, String> arg) { return new CFStringTableCell<ICFBamNumberTypeObj>(); } }); dataTable.getColumns().add(tableColumnLabel); tableColumnShortDescription = new TableColumn<ICFBamNumberTypeObj, String>("Short Description"); tableColumnShortDescription.setCellValueFactory( new Callback<CellDataFeatures<ICFBamNumberTypeObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamNumberTypeObj, String> p) { ICFBamValueObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getOptionalShortDescription(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnShortDescription.setCellFactory( new Callback<TableColumn<ICFBamNumberTypeObj, String>, TableCell<ICFBamNumberTypeObj, String>>() { @Override public TableCell<ICFBamNumberTypeObj, String> call( TableColumn<ICFBamNumberTypeObj, String> arg) { return new CFStringTableCell<ICFBamNumberTypeObj>(); } }); dataTable.getColumns().add(tableColumnShortDescription); tableColumnDescription = new TableColumn<ICFBamNumberTypeObj, String>("Description"); tableColumnDescription.setCellValueFactory( new Callback<CellDataFeatures<ICFBamNumberTypeObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamNumberTypeObj, String> p) { ICFBamValueObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getOptionalDescription(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnDescription.setCellFactory( new Callback<TableColumn<ICFBamNumberTypeObj, String>, TableCell<ICFBamNumberTypeObj, String>>() { @Override public TableCell<ICFBamNumberTypeObj, String> call( TableColumn<ICFBamNumberTypeObj, String> arg) { return new CFStringTableCell<ICFBamNumberTypeObj>(); } }); dataTable.getColumns().add(tableColumnDescription); tableColumnIsNullable = new TableColumn<ICFBamNumberTypeObj, Boolean>("Is Nullable"); tableColumnIsNullable.setCellValueFactory( new Callback<CellDataFeatures<ICFBamNumberTypeObj, Boolean>, ObservableValue<Boolean>>() { public ObservableValue<Boolean> call(CellDataFeatures<ICFBamNumberTypeObj, Boolean> p) { ICFBamValueObj obj = p.getValue(); if (obj == null) { return (null); } else { boolean value = obj.getRequiredIsNullable(); Boolean wrapped = new Boolean(value); ReadOnlyObjectWrapper<Boolean> observable = new ReadOnlyObjectWrapper<Boolean>(); observable.setValue(wrapped); return (observable); } } }); tableColumnIsNullable.setCellFactory( new Callback<TableColumn<ICFBamNumberTypeObj, Boolean>, TableCell<ICFBamNumberTypeObj, Boolean>>() { @Override public TableCell<ICFBamNumberTypeObj, Boolean> call( TableColumn<ICFBamNumberTypeObj, Boolean> arg) { return new CFBoolTableCell<ICFBamNumberTypeObj>(); } }); dataTable.getColumns().add(tableColumnIsNullable); tableColumnGenerateId = new TableColumn<ICFBamNumberTypeObj, Boolean>("Generate Id"); tableColumnGenerateId.setCellValueFactory( new Callback<CellDataFeatures<ICFBamNumberTypeObj, Boolean>, ObservableValue<Boolean>>() { public ObservableValue<Boolean> call(CellDataFeatures<ICFBamNumberTypeObj, Boolean> p) { ICFBamValueObj obj = p.getValue(); if (obj == null) { return (null); } else { Boolean value = obj.getOptionalGenerateId(); ReadOnlyObjectWrapper<Boolean> observable = new ReadOnlyObjectWrapper<Boolean>(); observable.setValue(value); return (observable); } } }); tableColumnGenerateId.setCellFactory( new Callback<TableColumn<ICFBamNumberTypeObj, Boolean>, TableCell<ICFBamNumberTypeObj, Boolean>>() { @Override public TableCell<ICFBamNumberTypeObj, Boolean> call( TableColumn<ICFBamNumberTypeObj, Boolean> arg) { return new CFBoolTableCell<ICFBamNumberTypeObj>(); } }); dataTable.getColumns().add(tableColumnGenerateId); tableColumnDefaultVisibility = new TableColumn<ICFBamNumberTypeObj, Boolean>("Default Visibility"); tableColumnDefaultVisibility.setCellValueFactory( new Callback<CellDataFeatures<ICFBamNumberTypeObj, Boolean>, ObservableValue<Boolean>>() { public ObservableValue<Boolean> call(CellDataFeatures<ICFBamNumberTypeObj, Boolean> p) { ICFBamValueObj obj = p.getValue(); if (obj == null) { return (null); } else { boolean value = obj.getRequiredDefaultVisibility(); Boolean wrapped = new Boolean(value); ReadOnlyObjectWrapper<Boolean> observable = new ReadOnlyObjectWrapper<Boolean>(); observable.setValue(wrapped); return (observable); } } }); tableColumnDefaultVisibility.setCellFactory( new Callback<TableColumn<ICFBamNumberTypeObj, Boolean>, TableCell<ICFBamNumberTypeObj, Boolean>>() { @Override public TableCell<ICFBamNumberTypeObj, Boolean> call( TableColumn<ICFBamNumberTypeObj, Boolean> arg) { return new CFBoolTableCell<ICFBamNumberTypeObj>(); } }); dataTable.getColumns().add(tableColumnDefaultVisibility); tableColumnDbName = new TableColumn<ICFBamNumberTypeObj, String>("Db Name"); tableColumnDbName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamNumberTypeObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamNumberTypeObj, String> p) { ICFBamAtomObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getOptionalDbName(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnDbName.setCellFactory( new Callback<TableColumn<ICFBamNumberTypeObj, String>, TableCell<ICFBamNumberTypeObj, String>>() { @Override public TableCell<ICFBamNumberTypeObj, String> call( TableColumn<ICFBamNumberTypeObj, String> arg) { return new CFStringTableCell<ICFBamNumberTypeObj>(); } }); dataTable.getColumns().add(tableColumnDbName); tableColumnDigits = new TableColumn<ICFBamNumberTypeObj, Short>("Digits"); tableColumnDigits.setCellValueFactory( new Callback<CellDataFeatures<ICFBamNumberTypeObj, Short>, ObservableValue<Short>>() { public ObservableValue<Short> call(CellDataFeatures<ICFBamNumberTypeObj, Short> p) { ICFBamNumberDefObj obj = p.getValue(); if (obj == null) { return (null); } else { short value = obj.getRequiredDigits(); Short wrapped = new Short(value); ReadOnlyObjectWrapper<Short> observable = new ReadOnlyObjectWrapper<Short>(); observable.setValue(wrapped); return (observable); } } }); tableColumnDigits.setCellFactory( new Callback<TableColumn<ICFBamNumberTypeObj, Short>, TableCell<ICFBamNumberTypeObj, Short>>() { @Override public TableCell<ICFBamNumberTypeObj, Short> call(TableColumn<ICFBamNumberTypeObj, Short> arg) { return new CFInt16TableCell<ICFBamNumberTypeObj>(); } }); dataTable.getColumns().add(tableColumnDigits); tableColumnPrecis = new TableColumn<ICFBamNumberTypeObj, Short>("Precision"); tableColumnPrecis.setCellValueFactory( new Callback<CellDataFeatures<ICFBamNumberTypeObj, Short>, ObservableValue<Short>>() { public ObservableValue<Short> call(CellDataFeatures<ICFBamNumberTypeObj, Short> p) { ICFBamNumberDefObj obj = p.getValue(); if (obj == null) { return (null); } else { short value = obj.getRequiredPrecis(); Short wrapped = new Short(value); ReadOnlyObjectWrapper<Short> observable = new ReadOnlyObjectWrapper<Short>(); observable.setValue(wrapped); return (observable); } } }); tableColumnPrecis.setCellFactory( new Callback<TableColumn<ICFBamNumberTypeObj, Short>, TableCell<ICFBamNumberTypeObj, Short>>() { @Override public TableCell<ICFBamNumberTypeObj, Short> call(TableColumn<ICFBamNumberTypeObj, Short> arg) { return new CFInt16TableCell<ICFBamNumberTypeObj>(); } }); dataTable.getColumns().add(tableColumnPrecis); tableColumnInitValue = new TableColumn<ICFBamNumberTypeObj, BigDecimal>("Init. Value"); tableColumnInitValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamNumberTypeObj, BigDecimal>, ObservableValue<BigDecimal>>() { public ObservableValue<BigDecimal> call(CellDataFeatures<ICFBamNumberTypeObj, BigDecimal> p) { ICFBamNumberDefObj obj = p.getValue(); if (obj == null) { return (null); } else { BigDecimal value = obj.getOptionalInitValue(); ReadOnlyObjectWrapper<BigDecimal> observable = new ReadOnlyObjectWrapper<BigDecimal>(); observable.setValue(value); return (observable); } } }); tableColumnInitValue.setCellFactory( new Callback<TableColumn<ICFBamNumberTypeObj, BigDecimal>, TableCell<ICFBamNumberTypeObj, BigDecimal>>() { @Override public TableCell<ICFBamNumberTypeObj, BigDecimal> call( TableColumn<ICFBamNumberTypeObj, BigDecimal> arg) { return new CFNumberTableCell<ICFBamNumberTypeObj>(31, 5); } }); dataTable.getColumns().add(tableColumnInitValue); tableColumnDefaultValue = new TableColumn<ICFBamNumberTypeObj, BigDecimal>("Default Value"); tableColumnDefaultValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamNumberTypeObj, BigDecimal>, ObservableValue<BigDecimal>>() { public ObservableValue<BigDecimal> call(CellDataFeatures<ICFBamNumberTypeObj, BigDecimal> p) { ICFBamNumberDefObj obj = p.getValue(); if (obj == null) { return (null); } else { BigDecimal value = obj.getOptionalDefaultValue(); ReadOnlyObjectWrapper<BigDecimal> observable = new ReadOnlyObjectWrapper<BigDecimal>(); observable.setValue(value); return (observable); } } }); tableColumnDefaultValue.setCellFactory( new Callback<TableColumn<ICFBamNumberTypeObj, BigDecimal>, TableCell<ICFBamNumberTypeObj, BigDecimal>>() { @Override public TableCell<ICFBamNumberTypeObj, BigDecimal> call( TableColumn<ICFBamNumberTypeObj, BigDecimal> arg) { return new CFNumberTableCell<ICFBamNumberTypeObj>(31, 5); } }); dataTable.getColumns().add(tableColumnDefaultValue); tableColumnMinValue = new TableColumn<ICFBamNumberTypeObj, BigDecimal>("Min. Value"); tableColumnMinValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamNumberTypeObj, BigDecimal>, ObservableValue<BigDecimal>>() { public ObservableValue<BigDecimal> call(CellDataFeatures<ICFBamNumberTypeObj, BigDecimal> p) { ICFBamNumberDefObj obj = p.getValue(); if (obj == null) { return (null); } else { BigDecimal value = obj.getOptionalMinValue(); ReadOnlyObjectWrapper<BigDecimal> observable = new ReadOnlyObjectWrapper<BigDecimal>(); observable.setValue(value); return (observable); } } }); tableColumnMinValue.setCellFactory( new Callback<TableColumn<ICFBamNumberTypeObj, BigDecimal>, TableCell<ICFBamNumberTypeObj, BigDecimal>>() { @Override public TableCell<ICFBamNumberTypeObj, BigDecimal> call( TableColumn<ICFBamNumberTypeObj, BigDecimal> arg) { return new CFNumberTableCell<ICFBamNumberTypeObj>(31, 5); } }); dataTable.getColumns().add(tableColumnMinValue); tableColumnMaxValue = new TableColumn<ICFBamNumberTypeObj, BigDecimal>("Max. Value"); tableColumnMaxValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamNumberTypeObj, BigDecimal>, ObservableValue<BigDecimal>>() { public ObservableValue<BigDecimal> call(CellDataFeatures<ICFBamNumberTypeObj, BigDecimal> p) { ICFBamNumberDefObj obj = p.getValue(); if (obj == null) { return (null); } else { BigDecimal value = obj.getOptionalMaxValue(); ReadOnlyObjectWrapper<BigDecimal> observable = new ReadOnlyObjectWrapper<BigDecimal>(); observable.setValue(value); return (observable); } } }); tableColumnMaxValue.setCellFactory( new Callback<TableColumn<ICFBamNumberTypeObj, BigDecimal>, TableCell<ICFBamNumberTypeObj, BigDecimal>>() { @Override public TableCell<ICFBamNumberTypeObj, BigDecimal> call( TableColumn<ICFBamNumberTypeObj, BigDecimal> arg) { return new CFNumberTableCell<ICFBamNumberTypeObj>(31, 5); } }); dataTable.getColumns().add(tableColumnMaxValue); tableColumnNullValue = new TableColumn<ICFBamNumberTypeObj, BigDecimal>("Null Value"); tableColumnNullValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamNumberTypeObj, BigDecimal>, ObservableValue<BigDecimal>>() { public ObservableValue<BigDecimal> call(CellDataFeatures<ICFBamNumberTypeObj, BigDecimal> p) { ICFBamNumberDefObj obj = p.getValue(); if (obj == null) { return (null); } else { BigDecimal value = obj.getOptionalNullValue(); ReadOnlyObjectWrapper<BigDecimal> observable = new ReadOnlyObjectWrapper<BigDecimal>(); observable.setValue(value); return (observable); } } }); tableColumnNullValue.setCellFactory( new Callback<TableColumn<ICFBamNumberTypeObj, BigDecimal>, TableCell<ICFBamNumberTypeObj, BigDecimal>>() { @Override public TableCell<ICFBamNumberTypeObj, BigDecimal> call( TableColumn<ICFBamNumberTypeObj, BigDecimal> arg) { return new CFNumberTableCell<ICFBamNumberTypeObj>(31, 5); } }); dataTable.getColumns().add(tableColumnNullValue); tableColumnUnknownValue = new TableColumn<ICFBamNumberTypeObj, BigDecimal>("Unknown Value"); tableColumnUnknownValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamNumberTypeObj, BigDecimal>, ObservableValue<BigDecimal>>() { public ObservableValue<BigDecimal> call(CellDataFeatures<ICFBamNumberTypeObj, BigDecimal> p) { ICFBamNumberDefObj obj = p.getValue(); if (obj == null) { return (null); } else { BigDecimal value = obj.getOptionalUnknownValue(); ReadOnlyObjectWrapper<BigDecimal> observable = new ReadOnlyObjectWrapper<BigDecimal>(); observable.setValue(value); return (observable); } } }); tableColumnUnknownValue.setCellFactory( new Callback<TableColumn<ICFBamNumberTypeObj, BigDecimal>, TableCell<ICFBamNumberTypeObj, BigDecimal>>() { @Override public TableCell<ICFBamNumberTypeObj, BigDecimal> call( TableColumn<ICFBamNumberTypeObj, BigDecimal> arg) { return new CFNumberTableCell<ICFBamNumberTypeObj>(31, 5); } }); dataTable.getColumns().add(tableColumnUnknownValue); tableColumnLookupDefSchema = new TableColumn<ICFBamNumberTypeObj, ICFBamSchemaDefObj>( "Defining Schema Definition"); tableColumnLookupDefSchema.setCellValueFactory( new Callback<CellDataFeatures<ICFBamNumberTypeObj, ICFBamSchemaDefObj>, ObservableValue<ICFBamSchemaDefObj>>() { public ObservableValue<ICFBamSchemaDefObj> call( CellDataFeatures<ICFBamNumberTypeObj, ICFBamSchemaDefObj> p) { ICFBamNumberTypeObj obj = p.getValue(); if (obj == null) { return (null); } else { ICFBamSchemaDefObj ref = obj.getOptionalLookupDefSchema(); ReadOnlyObjectWrapper<ICFBamSchemaDefObj> observable = new ReadOnlyObjectWrapper<ICFBamSchemaDefObj>(); observable.setValue(ref); return (observable); } } }); tableColumnLookupDefSchema.setCellFactory( new Callback<TableColumn<ICFBamNumberTypeObj, ICFBamSchemaDefObj>, TableCell<ICFBamNumberTypeObj, ICFBamSchemaDefObj>>() { @Override public TableCell<ICFBamNumberTypeObj, ICFBamSchemaDefObj> call( TableColumn<ICFBamNumberTypeObj, ICFBamSchemaDefObj> arg) { return new CFReferenceTableCell<ICFBamNumberTypeObj, ICFBamSchemaDefObj>(); } }); dataTable.getColumns().add(tableColumnLookupDefSchema); dataTable.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<ICFBamNumberTypeObj>() { @Override public void changed(ObservableValue<? extends ICFBamNumberTypeObj> observable, ICFBamNumberTypeObj oldValue, ICFBamNumberTypeObj newValue) { setJavaFXFocus(newValue); } }); scrollMenu = new ScrollPane(); scrollMenu.setVbarPolicy(ScrollBarPolicy.NEVER); scrollMenu.setHbarPolicy(ScrollBarPolicy.AS_NEEDED); scrollMenu.setFitToHeight(true); scrollMenu.setContent(getPanelHBoxMenu()); setTop(scrollMenu); setCenter(dataTable); javafxIsInitializing = false; if (observableListOfNumberType != null) { dataTable.setItems(observableListOfNumberType); } adjustListButtons(); }
From source file:net.sourceforge.msscodefactory.cfbam.v2_7.CFBamJavaFX.CFBamJavaFXTextColListPane.java
public CFBamJavaFXTextColListPane(ICFFormManager formManager, ICFBamJavaFXSchema argSchema, ICFBamTableObj argContainer, ICFBamTextColObj argFocus, Collection<ICFBamTextColObj> argDataCollection, ICFRefreshCallback refreshCallback, boolean sortByChain) { super();/*from ww w .j a v a2 s .c om*/ final String S_ProcName = "construct-schema-focus"; if (formManager == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 1, "formManager"); } cfFormManager = formManager; if (argSchema == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 2, "argSchema"); } // argFocus is optional; focus may be set later during execution as // conditions of the runtime change. javafxSchema = argSchema; javaFXFocus = argFocus; javafxContainer = argContainer; javafxRefreshCallback = refreshCallback; javafxSortByChain = sortByChain; setJavaFXDataCollection(argDataCollection); dataTable = new TableView<ICFBamTextColObj>(); tableColumnId = new TableColumn<ICFBamTextColObj, Long>("Id"); tableColumnId.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTextColObj, Long>, ObservableValue<Long>>() { public ObservableValue<Long> call(CellDataFeatures<ICFBamTextColObj, 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<ICFBamTextColObj, Long>, TableCell<ICFBamTextColObj, Long>>() { @Override public TableCell<ICFBamTextColObj, Long> call(TableColumn<ICFBamTextColObj, Long> arg) { return new CFInt64TableCell<ICFBamTextColObj>(); } }); dataTable.getColumns().add(tableColumnId); tableColumnName = new TableColumn<ICFBamTextColObj, String>("Name"); tableColumnName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTextColObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamTextColObj, 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<ICFBamTextColObj, String>, TableCell<ICFBamTextColObj, String>>() { @Override public TableCell<ICFBamTextColObj, String> call(TableColumn<ICFBamTextColObj, String> arg) { return new CFStringTableCell<ICFBamTextColObj>(); } }); dataTable.getColumns().add(tableColumnName); tableColumnShortName = new TableColumn<ICFBamTextColObj, String>("Short Name"); tableColumnShortName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTextColObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamTextColObj, 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<ICFBamTextColObj, String>, TableCell<ICFBamTextColObj, String>>() { @Override public TableCell<ICFBamTextColObj, String> call(TableColumn<ICFBamTextColObj, String> arg) { return new CFStringTableCell<ICFBamTextColObj>(); } }); dataTable.getColumns().add(tableColumnShortName); tableColumnLabel = new TableColumn<ICFBamTextColObj, String>("Label"); tableColumnLabel.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTextColObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamTextColObj, 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<ICFBamTextColObj, String>, TableCell<ICFBamTextColObj, String>>() { @Override public TableCell<ICFBamTextColObj, String> call(TableColumn<ICFBamTextColObj, String> arg) { return new CFStringTableCell<ICFBamTextColObj>(); } }); dataTable.getColumns().add(tableColumnLabel); tableColumnShortDescription = new TableColumn<ICFBamTextColObj, String>("Short Description"); tableColumnShortDescription.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTextColObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamTextColObj, 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<ICFBamTextColObj, String>, TableCell<ICFBamTextColObj, String>>() { @Override public TableCell<ICFBamTextColObj, String> call(TableColumn<ICFBamTextColObj, String> arg) { return new CFStringTableCell<ICFBamTextColObj>(); } }); dataTable.getColumns().add(tableColumnShortDescription); tableColumnDescription = new TableColumn<ICFBamTextColObj, String>("Description"); tableColumnDescription.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTextColObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamTextColObj, 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<ICFBamTextColObj, String>, TableCell<ICFBamTextColObj, String>>() { @Override public TableCell<ICFBamTextColObj, String> call(TableColumn<ICFBamTextColObj, String> arg) { return new CFStringTableCell<ICFBamTextColObj>(); } }); dataTable.getColumns().add(tableColumnDescription); tableColumnIsNullable = new TableColumn<ICFBamTextColObj, Boolean>("Is Nullable"); tableColumnIsNullable.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTextColObj, Boolean>, ObservableValue<Boolean>>() { public ObservableValue<Boolean> call(CellDataFeatures<ICFBamTextColObj, 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<ICFBamTextColObj, Boolean>, TableCell<ICFBamTextColObj, Boolean>>() { @Override public TableCell<ICFBamTextColObj, Boolean> call(TableColumn<ICFBamTextColObj, Boolean> arg) { return new CFBoolTableCell<ICFBamTextColObj>(); } }); dataTable.getColumns().add(tableColumnIsNullable); tableColumnGenerateId = new TableColumn<ICFBamTextColObj, Boolean>("Generate Id"); tableColumnGenerateId.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTextColObj, Boolean>, ObservableValue<Boolean>>() { public ObservableValue<Boolean> call(CellDataFeatures<ICFBamTextColObj, 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<ICFBamTextColObj, Boolean>, TableCell<ICFBamTextColObj, Boolean>>() { @Override public TableCell<ICFBamTextColObj, Boolean> call(TableColumn<ICFBamTextColObj, Boolean> arg) { return new CFBoolTableCell<ICFBamTextColObj>(); } }); dataTable.getColumns().add(tableColumnGenerateId); tableColumnDefaultVisibility = new TableColumn<ICFBamTextColObj, Boolean>("Default Visibility"); tableColumnDefaultVisibility.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTextColObj, Boolean>, ObservableValue<Boolean>>() { public ObservableValue<Boolean> call(CellDataFeatures<ICFBamTextColObj, 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<ICFBamTextColObj, Boolean>, TableCell<ICFBamTextColObj, Boolean>>() { @Override public TableCell<ICFBamTextColObj, Boolean> call(TableColumn<ICFBamTextColObj, Boolean> arg) { return new CFBoolTableCell<ICFBamTextColObj>(); } }); dataTable.getColumns().add(tableColumnDefaultVisibility); tableColumnDbName = new TableColumn<ICFBamTextColObj, String>("Db Name"); tableColumnDbName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTextColObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamTextColObj, 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<ICFBamTextColObj, String>, TableCell<ICFBamTextColObj, String>>() { @Override public TableCell<ICFBamTextColObj, String> call(TableColumn<ICFBamTextColObj, String> arg) { return new CFStringTableCell<ICFBamTextColObj>(); } }); dataTable.getColumns().add(tableColumnDbName); tableColumnMaxLen = new TableColumn<ICFBamTextColObj, Integer>("Max. Length"); tableColumnMaxLen.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTextColObj, Integer>, ObservableValue<Integer>>() { public ObservableValue<Integer> call(CellDataFeatures<ICFBamTextColObj, 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<ICFBamTextColObj, Integer>, TableCell<ICFBamTextColObj, Integer>>() { @Override public TableCell<ICFBamTextColObj, Integer> call(TableColumn<ICFBamTextColObj, Integer> arg) { return new CFInt32TableCell<ICFBamTextColObj>(); } }); dataTable.getColumns().add(tableColumnMaxLen); tableColumnShowLines = new TableColumn<ICFBamTextColObj, Short>("Show Lines"); tableColumnShowLines.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTextColObj, Short>, ObservableValue<Short>>() { public ObservableValue<Short> call(CellDataFeatures<ICFBamTextColObj, 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<ICFBamTextColObj, Short>, TableCell<ICFBamTextColObj, Short>>() { @Override public TableCell<ICFBamTextColObj, Short> call(TableColumn<ICFBamTextColObj, Short> arg) { return new CFInt16TableCell<ICFBamTextColObj>(); } }); dataTable.getColumns().add(tableColumnShowLines); tableColumnInitValue = new TableColumn<ICFBamTextColObj, String>("Init. Value"); tableColumnInitValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTextColObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamTextColObj, 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<ICFBamTextColObj, String>, TableCell<ICFBamTextColObj, String>>() { @Override public TableCell<ICFBamTextColObj, String> call(TableColumn<ICFBamTextColObj, String> arg) { return new CFTextTableCell<ICFBamTextColObj>(); } }); dataTable.getColumns().add(tableColumnInitValue); tableColumnDefaultValue = new TableColumn<ICFBamTextColObj, String>("Default Value"); tableColumnDefaultValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTextColObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamTextColObj, 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<ICFBamTextColObj, String>, TableCell<ICFBamTextColObj, String>>() { @Override public TableCell<ICFBamTextColObj, String> call(TableColumn<ICFBamTextColObj, String> arg) { return new CFTextTableCell<ICFBamTextColObj>(); } }); dataTable.getColumns().add(tableColumnDefaultValue); tableColumnNullValue = new TableColumn<ICFBamTextColObj, String>("Null Value"); tableColumnNullValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTextColObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamTextColObj, 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<ICFBamTextColObj, String>, TableCell<ICFBamTextColObj, String>>() { @Override public TableCell<ICFBamTextColObj, String> call(TableColumn<ICFBamTextColObj, String> arg) { return new CFTextTableCell<ICFBamTextColObj>(); } }); dataTable.getColumns().add(tableColumnNullValue); tableColumnUnknownValue = new TableColumn<ICFBamTextColObj, String>("Unknown Value"); tableColumnUnknownValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTextColObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamTextColObj, 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<ICFBamTextColObj, String>, TableCell<ICFBamTextColObj, String>>() { @Override public TableCell<ICFBamTextColObj, String> call(TableColumn<ICFBamTextColObj, String> arg) { return new CFTextTableCell<ICFBamTextColObj>(); } }); dataTable.getColumns().add(tableColumnUnknownValue); tableColumnLookupDefSchema = new TableColumn<ICFBamTextColObj, ICFBamSchemaDefObj>( "Defining Schema Definition"); tableColumnLookupDefSchema.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTextColObj, ICFBamSchemaDefObj>, ObservableValue<ICFBamSchemaDefObj>>() { public ObservableValue<ICFBamSchemaDefObj> call( CellDataFeatures<ICFBamTextColObj, ICFBamSchemaDefObj> p) { ICFBamTextColObj 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<ICFBamTextColObj, ICFBamSchemaDefObj>, TableCell<ICFBamTextColObj, ICFBamSchemaDefObj>>() { @Override public TableCell<ICFBamTextColObj, ICFBamSchemaDefObj> call( TableColumn<ICFBamTextColObj, ICFBamSchemaDefObj> arg) { return new CFReferenceTableCell<ICFBamTextColObj, ICFBamSchemaDefObj>(); } }); dataTable.getColumns().add(tableColumnLookupDefSchema); dataTable.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<ICFBamTextColObj>() { @Override public void changed(ObservableValue<? extends ICFBamTextColObj> observable, ICFBamTextColObj oldValue, ICFBamTextColObj newValue) { setJavaFXFocus(newValue); } }); scrollMenu = new ScrollPane(); scrollMenu.setVbarPolicy(ScrollBarPolicy.NEVER); scrollMenu.setHbarPolicy(ScrollBarPolicy.AS_NEEDED); scrollMenu.setFitToHeight(true); scrollMenu.setContent(getPanelHBoxMenu()); setTop(scrollMenu); setCenter(dataTable); javafxIsInitializing = false; if (observableListOfTextCol != null) { dataTable.setItems(observableListOfTextCol); } adjustListButtons(); }
From source file:net.sourceforge.msscodefactory.cfbam.v2_7.CFBamJavaFX.CFBamJavaFXTextDefPickerPane.java
public CFBamJavaFXTextDefPickerPane(ICFFormManager formManager, ICFBamJavaFXSchema argSchema, ICFBamTextDefObj argFocus, ICFBamScopeObj argContainer, Collection<ICFBamTextDefObj> argDataCollection, ICFBamJavaFXTextDefChosen whenChosen) { super();/* ww 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<ICFBamTextDefObj>(); tableColumnObjKind = new TableColumn<ICFBamTextDefObj, String>("Class Code"); tableColumnObjKind.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTextDefObj, String>, ObservableValue<String>>() { @Override public ObservableValue<String> call(CellDataFeatures<ICFBamTextDefObj, String> p) { ICFBamTextDefObj obj = p.getValue(); if (obj == null) { return (null); } else { String classCode = obj.getClassCode(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(classCode); return (observable); } } }); tableColumnObjKind.setCellFactory( new Callback<TableColumn<ICFBamTextDefObj, String>, TableCell<ICFBamTextDefObj, String>>() { @Override public TableCell<ICFBamTextDefObj, String> call(TableColumn<ICFBamTextDefObj, String> arg) { return new CFStringTableCell<ICFBamTextDefObj>(); } }); dataTable.getColumns().add(tableColumnObjKind); tableColumnId = new TableColumn<ICFBamTextDefObj, Long>("Id"); tableColumnId.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTextDefObj, Long>, ObservableValue<Long>>() { public ObservableValue<Long> call(CellDataFeatures<ICFBamTextDefObj, 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<ICFBamTextDefObj, Long>, TableCell<ICFBamTextDefObj, Long>>() { @Override public TableCell<ICFBamTextDefObj, Long> call(TableColumn<ICFBamTextDefObj, Long> arg) { return new CFInt64TableCell<ICFBamTextDefObj>(); } }); dataTable.getColumns().add(tableColumnId); tableColumnName = new TableColumn<ICFBamTextDefObj, String>("Name"); tableColumnName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTextDefObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamTextDefObj, 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<ICFBamTextDefObj, String>, TableCell<ICFBamTextDefObj, String>>() { @Override public TableCell<ICFBamTextDefObj, String> call(TableColumn<ICFBamTextDefObj, String> arg) { return new CFStringTableCell<ICFBamTextDefObj>(); } }); dataTable.getColumns().add(tableColumnName); tableColumnShortName = new TableColumn<ICFBamTextDefObj, String>("Short Name"); tableColumnShortName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTextDefObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamTextDefObj, 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<ICFBamTextDefObj, String>, TableCell<ICFBamTextDefObj, String>>() { @Override public TableCell<ICFBamTextDefObj, String> call(TableColumn<ICFBamTextDefObj, String> arg) { return new CFStringTableCell<ICFBamTextDefObj>(); } }); dataTable.getColumns().add(tableColumnShortName); tableColumnLabel = new TableColumn<ICFBamTextDefObj, String>("Label"); tableColumnLabel.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTextDefObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamTextDefObj, 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<ICFBamTextDefObj, String>, TableCell<ICFBamTextDefObj, String>>() { @Override public TableCell<ICFBamTextDefObj, String> call(TableColumn<ICFBamTextDefObj, String> arg) { return new CFStringTableCell<ICFBamTextDefObj>(); } }); dataTable.getColumns().add(tableColumnLabel); tableColumnShortDescription = new TableColumn<ICFBamTextDefObj, String>("Short Description"); tableColumnShortDescription.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTextDefObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamTextDefObj, 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<ICFBamTextDefObj, String>, TableCell<ICFBamTextDefObj, String>>() { @Override public TableCell<ICFBamTextDefObj, String> call(TableColumn<ICFBamTextDefObj, String> arg) { return new CFStringTableCell<ICFBamTextDefObj>(); } }); dataTable.getColumns().add(tableColumnShortDescription); tableColumnDescription = new TableColumn<ICFBamTextDefObj, String>("Description"); tableColumnDescription.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTextDefObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamTextDefObj, 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<ICFBamTextDefObj, String>, TableCell<ICFBamTextDefObj, String>>() { @Override public TableCell<ICFBamTextDefObj, String> call(TableColumn<ICFBamTextDefObj, String> arg) { return new CFStringTableCell<ICFBamTextDefObj>(); } }); dataTable.getColumns().add(tableColumnDescription); tableColumnIsNullable = new TableColumn<ICFBamTextDefObj, Boolean>("Is Nullable"); tableColumnIsNullable.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTextDefObj, Boolean>, ObservableValue<Boolean>>() { public ObservableValue<Boolean> call(CellDataFeatures<ICFBamTextDefObj, 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<ICFBamTextDefObj, Boolean>, TableCell<ICFBamTextDefObj, Boolean>>() { @Override public TableCell<ICFBamTextDefObj, Boolean> call(TableColumn<ICFBamTextDefObj, Boolean> arg) { return new CFBoolTableCell<ICFBamTextDefObj>(); } }); dataTable.getColumns().add(tableColumnIsNullable); tableColumnGenerateId = new TableColumn<ICFBamTextDefObj, Boolean>("Generate Id"); tableColumnGenerateId.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTextDefObj, Boolean>, ObservableValue<Boolean>>() { public ObservableValue<Boolean> call(CellDataFeatures<ICFBamTextDefObj, 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<ICFBamTextDefObj, Boolean>, TableCell<ICFBamTextDefObj, Boolean>>() { @Override public TableCell<ICFBamTextDefObj, Boolean> call(TableColumn<ICFBamTextDefObj, Boolean> arg) { return new CFBoolTableCell<ICFBamTextDefObj>(); } }); dataTable.getColumns().add(tableColumnGenerateId); tableColumnDefaultVisibility = new TableColumn<ICFBamTextDefObj, Boolean>("Default Visibility"); tableColumnDefaultVisibility.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTextDefObj, Boolean>, ObservableValue<Boolean>>() { public ObservableValue<Boolean> call(CellDataFeatures<ICFBamTextDefObj, 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<ICFBamTextDefObj, Boolean>, TableCell<ICFBamTextDefObj, Boolean>>() { @Override public TableCell<ICFBamTextDefObj, Boolean> call(TableColumn<ICFBamTextDefObj, Boolean> arg) { return new CFBoolTableCell<ICFBamTextDefObj>(); } }); dataTable.getColumns().add(tableColumnDefaultVisibility); tableColumnDbName = new TableColumn<ICFBamTextDefObj, String>("Db Name"); tableColumnDbName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTextDefObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamTextDefObj, 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<ICFBamTextDefObj, String>, TableCell<ICFBamTextDefObj, String>>() { @Override public TableCell<ICFBamTextDefObj, String> call(TableColumn<ICFBamTextDefObj, String> arg) { return new CFStringTableCell<ICFBamTextDefObj>(); } }); dataTable.getColumns().add(tableColumnDbName); tableColumnMaxLen = new TableColumn<ICFBamTextDefObj, Integer>("Max. Length"); tableColumnMaxLen.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTextDefObj, Integer>, ObservableValue<Integer>>() { public ObservableValue<Integer> call(CellDataFeatures<ICFBamTextDefObj, 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<ICFBamTextDefObj, Integer>, TableCell<ICFBamTextDefObj, Integer>>() { @Override public TableCell<ICFBamTextDefObj, Integer> call(TableColumn<ICFBamTextDefObj, Integer> arg) { return new CFInt32TableCell<ICFBamTextDefObj>(); } }); dataTable.getColumns().add(tableColumnMaxLen); tableColumnShowLines = new TableColumn<ICFBamTextDefObj, Short>("Show Lines"); tableColumnShowLines.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTextDefObj, Short>, ObservableValue<Short>>() { public ObservableValue<Short> call(CellDataFeatures<ICFBamTextDefObj, 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<ICFBamTextDefObj, Short>, TableCell<ICFBamTextDefObj, Short>>() { @Override public TableCell<ICFBamTextDefObj, Short> call(TableColumn<ICFBamTextDefObj, Short> arg) { return new CFInt16TableCell<ICFBamTextDefObj>(); } }); dataTable.getColumns().add(tableColumnShowLines); tableColumnInitValue = new TableColumn<ICFBamTextDefObj, String>("Init. Value"); tableColumnInitValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTextDefObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamTextDefObj, 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<ICFBamTextDefObj, String>, TableCell<ICFBamTextDefObj, String>>() { @Override public TableCell<ICFBamTextDefObj, String> call(TableColumn<ICFBamTextDefObj, String> arg) { return new CFTextTableCell<ICFBamTextDefObj>(); } }); dataTable.getColumns().add(tableColumnInitValue); tableColumnDefaultValue = new TableColumn<ICFBamTextDefObj, String>("Default Value"); tableColumnDefaultValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTextDefObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamTextDefObj, 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<ICFBamTextDefObj, String>, TableCell<ICFBamTextDefObj, String>>() { @Override public TableCell<ICFBamTextDefObj, String> call(TableColumn<ICFBamTextDefObj, String> arg) { return new CFTextTableCell<ICFBamTextDefObj>(); } }); dataTable.getColumns().add(tableColumnDefaultValue); tableColumnNullValue = new TableColumn<ICFBamTextDefObj, String>("Null Value"); tableColumnNullValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTextDefObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamTextDefObj, 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<ICFBamTextDefObj, String>, TableCell<ICFBamTextDefObj, String>>() { @Override public TableCell<ICFBamTextDefObj, String> call(TableColumn<ICFBamTextDefObj, String> arg) { return new CFTextTableCell<ICFBamTextDefObj>(); } }); dataTable.getColumns().add(tableColumnNullValue); tableColumnUnknownValue = new TableColumn<ICFBamTextDefObj, String>("Unknown Value"); tableColumnUnknownValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTextDefObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamTextDefObj, 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<ICFBamTextDefObj, String>, TableCell<ICFBamTextDefObj, String>>() { @Override public TableCell<ICFBamTextDefObj, String> call(TableColumn<ICFBamTextDefObj, String> arg) { return new CFTextTableCell<ICFBamTextDefObj>(); } }); dataTable.getColumns().add(tableColumnUnknownValue); tableColumnLookupDefSchema = new TableColumn<ICFBamTextDefObj, ICFBamSchemaDefObj>( "Defining Schema Definition"); tableColumnLookupDefSchema.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTextDefObj, ICFBamSchemaDefObj>, ObservableValue<ICFBamSchemaDefObj>>() { public ObservableValue<ICFBamSchemaDefObj> call( CellDataFeatures<ICFBamTextDefObj, ICFBamSchemaDefObj> p) { ICFBamTextDefObj 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<ICFBamTextDefObj, ICFBamSchemaDefObj>, TableCell<ICFBamTextDefObj, ICFBamSchemaDefObj>>() { @Override public TableCell<ICFBamTextDefObj, ICFBamSchemaDefObj> call( TableColumn<ICFBamTextDefObj, ICFBamSchemaDefObj> arg) { return new CFReferenceTableCell<ICFBamTextDefObj, ICFBamSchemaDefObj>(); } }); dataTable.getColumns().add(tableColumnLookupDefSchema); dataTable.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<ICFBamTextDefObj>() { @Override public void changed(ObservableValue<? extends ICFBamTextDefObj> observable, ICFBamTextDefObj oldValue, ICFBamTextDefObj 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.choseTextDef(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"); } ICFBamTextDefObj selectedInstance = getJavaFXFocusAsTextDef(); invokeWhenChosen.choseTextDef(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.CFBamJavaFXTextTypeListPane.java
public CFBamJavaFXTextTypeListPane(ICFFormManager formManager, ICFBamJavaFXSchema argSchema, ICFBamSchemaDefObj argContainer, ICFBamTextTypeObj argFocus, Collection<ICFBamTextTypeObj> argDataCollection, ICFRefreshCallback refreshCallback, boolean sortByChain) { super();// w w w . j a v a 2 s . c o m final String S_ProcName = "construct-schema-focus"; if (formManager == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 1, "formManager"); } cfFormManager = formManager; if (argSchema == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 2, "argSchema"); } // argFocus is optional; focus may be set later during execution as // conditions of the runtime change. javafxSchema = argSchema; javaFXFocus = argFocus; javafxContainer = argContainer; javafxRefreshCallback = refreshCallback; javafxSortByChain = sortByChain; setJavaFXDataCollection(argDataCollection); dataTable = new TableView<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); } }); scrollMenu = new ScrollPane(); scrollMenu.setVbarPolicy(ScrollBarPolicy.NEVER); scrollMenu.setHbarPolicy(ScrollBarPolicy.AS_NEEDED); scrollMenu.setFitToHeight(true); scrollMenu.setContent(getPanelHBoxMenu()); setTop(scrollMenu); setCenter(dataTable); javafxIsInitializing = false; if (observableListOfTextType != null) { dataTable.setItems(observableListOfTextType); } adjustListButtons(); }
From source file:com.heliumv.api.production.ProductionApi.java
private LosistmaterialDto createLosistmaterialDto(Integer stockId, BigDecimal amount) { LosistmaterialDto losistmaterialDto = new LosistmaterialDto(); losistmaterialDto.setLagerIId(stockId); losistmaterialDto.setBAbgang(new Short((short) (amount.signum() > 0 ? 1 : 0))); losistmaterialDto.setNMenge(amount); return losistmaterialDto; }