List of usage examples for java.lang Short Short
@Deprecated(since = "9") public Short(String s) throws NumberFormatException
From source file:com.jaspersoft.jasperserver.ws.axis2.scheduling.ReportJobBeanTraslator.java
private Object convertToParameter(Class paramType, Object value) { Object parameterValue = null; try {//w ww .j ava2 s. c o m if (String.class.equals(paramType)) { parameterValue = value.toString(); } else if (Boolean.class.equals(paramType)) { if (value instanceof String) { parameterValue = Boolean.valueOf((String) value); } else if (value instanceof Number) { //0 = false parameterValue = Boolean.valueOf(((Number) value).intValue() != 0); } } else if (Date.class.equals(paramType)) { if (value instanceof Calendar) { parameterValue = ((Calendar) value).getTime(); } else if (value instanceof Number) { // the number is interpreted as milliseconds parameterValue = new Date(((Number) value).longValue()); } else if (value instanceof String) { // the string is interpreted as milliseconds parameterValue = new Date(Long.parseLong((String) value)); } else if (value instanceof XMLGregorianCalendar) { parameterValue = ((XMLGregorianCalendar) value).toGregorianCalendar().getTime(); } } else if (java.sql.Date.class.equals(paramType)) { if (value instanceof Calendar) { parameterValue = ((Calendar) value).getTime(); } else if (value instanceof Number) { // the number is interpreted as milliseconds parameterValue = new java.sql.Date(((Number) value).longValue()); } else if (value instanceof String) { // the string is interpreted as milliseconds parameterValue = new java.sql.Date(Long.parseLong((String) value)); } else if (value instanceof XMLGregorianCalendar) { parameterValue = new java.sql.Date( ((XMLGregorianCalendar) value).toGregorianCalendar().getTimeInMillis()); } } else if (Timestamp.class.equals(paramType)) { if (value instanceof Date) { parameterValue = new Timestamp(((Date) value).getTime()); } else if (value instanceof Calendar) { parameterValue = new Timestamp(((Calendar) value).getTimeInMillis()); } else if (value instanceof Number) { // the number is interpreted as milliseconds parameterValue = new Timestamp(((Number) value).longValue()); } else if (value instanceof String) { // the string is interpreted as milliseconds parameterValue = new Timestamp(Long.parseLong((String) value)); } else if (value instanceof XMLGregorianCalendar) { parameterValue = new Timestamp( ((XMLGregorianCalendar) value).toGregorianCalendar().getTimeInMillis()); } } else if (Byte.class.equals(paramType)) { if (value instanceof Number) { parameterValue = new Byte(((Number) value).byteValue()); } else if (value instanceof String) { parameterValue = new Byte((String) value); } } else if (Short.class.equals(paramType)) { if (value instanceof Number) { parameterValue = new Short(((Number) value).shortValue()); } else if (value instanceof String) { parameterValue = new Short((String) value); } } else if (Integer.class.equals(paramType)) { if (value instanceof Number) { parameterValue = new Integer(((Number) value).intValue()); } else if (value instanceof String) { parameterValue = new Integer((String) value); } } else if (Long.class.equals(paramType)) { if (value instanceof Number) { parameterValue = new Long(((Number) value).longValue()); } else if (value instanceof String) { parameterValue = new Long((String) value); } } else if (Float.class.equals(paramType)) { if (value instanceof Number) { parameterValue = new Float(((Number) value).floatValue()); } else if (value instanceof String) { parameterValue = new Float((String) value); } } else if (Double.class.equals(paramType)) { if (value instanceof Number) { parameterValue = new Double(((Number) value).doubleValue()); } else if (value instanceof String) { parameterValue = new Double((String) value); } } else if (BigInteger.class.equals(paramType)) { if (value instanceof BigDecimal) { parameterValue = ((BigDecimal) value).toBigInteger(); } else if (value instanceof Number) { parameterValue = BigDecimal.valueOf(((Number) value).longValue()); } else if (value instanceof String) { parameterValue = new BigDecimal((String) value); } } else if (BigDecimal.class.equals(paramType)) { if (value instanceof BigInteger) { parameterValue = new BigDecimal((BigInteger) value); } else if (value instanceof Number) { parameterValue = new BigDecimal(Double.toString(((Number) value).doubleValue())); } else if (value instanceof String) { parameterValue = new BigDecimal((String) value); } } } catch (NumberFormatException e) { // ignore, exception will be thrown bellow } if (parameterValue == null) { throw new JSException("report.scheduling.ws.value.conversion.not.supported", new Object[] { value, value.getClass().getName(), paramType.getName() }); } return parameterValue; }
From source file:ca.sqlpower.matchmaker.MatchMakerTestCase.java
/** * Returns a new value that is not equal to oldVal. The returned object * will always be a NEW instance compatible with oldVal. This differs from * {@link #modifyObject(MatchMakerObject, PropertyDescriptor, Object)} in that * this does not take mutability into account. * //from w w w.ja v a2 s. com * @param mmo The object to which the property belongs. You might need this * if you have a special case for certain types of objects. * @param property The property that should be modified. It belongs to mmo. * @param oldVal The existing value of the property. */ private Object getNewDifferentValue(MatchMakerObject mmo, PropertyDescriptor property, Object oldVal) throws IOException { Object newVal; // don't init here so compiler can warn if the // following code doesn't always give it a value if (property.getPropertyType() == Integer.TYPE || property.getPropertyType() == Integer.class) { if (oldVal == null) newVal = new Integer(0); else { newVal = ((Integer) oldVal) + 1; } } else if (property.getPropertyType() == Short.TYPE || property.getPropertyType() == Short.class) { if (oldVal == null) newVal = new Short("0"); else { Integer temp = (Short) oldVal + 1; newVal = Short.valueOf(temp.toString()); } } else if (property.getPropertyType() == String.class) { // make sure it's unique newVal = "new " + oldVal; } else if (property.getPropertyType() == Boolean.class || property.getPropertyType() == Boolean.TYPE) { if (oldVal == null) { newVal = new Boolean(false); } else { newVal = new Boolean(!((Boolean) oldVal).booleanValue()); } } else if (property.getPropertyType() == Long.class) { if (oldVal == null) { newVal = new Long(0L); } else { newVal = new Long(((Long) oldVal).longValue() + 1L); } } else if (property.getPropertyType() == BigDecimal.class) { if (oldVal == null) { newVal = new BigDecimal(0); } else { newVal = new BigDecimal(((BigDecimal) oldVal).longValue() + 1L); } } else if (property.getPropertyType() == MungeSettings.class) { newVal = new MungeSettings(); Integer processCount = ((MatchMakerSettings) newVal).getProcessCount(); if (processCount == null) { processCount = new Integer(0); } else { processCount = new Integer(processCount + 1); } ((MatchMakerSettings) newVal).setProcessCount(processCount); } else if (property.getPropertyType() == MergeSettings.class) { newVal = new MergeSettings(); Integer processCount = ((MatchMakerSettings) newVal).getProcessCount(); if (processCount == null) { processCount = new Integer(0); } else { processCount = new Integer(processCount + 1); } ((MatchMakerSettings) newVal).setProcessCount(processCount); } else if (property.getPropertyType() == SQLTable.class) { newVal = new SQLTable(); } else if (property.getPropertyType() == ViewSpec.class) { newVal = new ViewSpec("*", "test_table", "true"); } else if (property.getPropertyType() == File.class) { newVal = File.createTempFile("mmTest", ".tmp"); ((File) newVal).deleteOnExit(); } else if (property.getPropertyType() == PlFolder.class) { newVal = new PlFolder(); } else if (property.getPropertyType() == ProjectMode.class) { if (oldVal == ProjectMode.BUILD_XREF) { newVal = ProjectMode.FIND_DUPES; } else { newVal = ProjectMode.BUILD_XREF; } } else if (property.getPropertyType() == MergeActionType.class) { if (oldVal == MergeActionType.AUGMENT) { newVal = MergeActionType.SUM; } else { newVal = MergeActionType.AUGMENT; } } else if (property.getPropertyType() == MatchMakerTranslateGroup.class) { newVal = new MatchMakerTranslateGroup(); } else if (property.getPropertyType() == MatchMakerObject.class) { newVal = new TestingAbstractMatchMakerObject(); } else if (property.getPropertyType() == SQLColumn.class) { newVal = new SQLColumn(); } else if (property.getPropertyType() == Date.class) { newVal = new Date(); } else if (property.getPropertyType() == List.class) { newVal = new ArrayList(); } else if (property.getPropertyType() == Project.class) { newVal = new Project(); ((Project) newVal).setName("Fake_Project_" + System.currentTimeMillis()); } else if (property.getPropertyType() == SQLIndex.class) { return new SQLIndex("new index", false, "", "HASHED", ""); } else if (property.getPropertyType() == Color.class) { if (oldVal == null) { newVal = new Color(0xFAC157); } else { Color oldColor = (Color) oldVal; newVal = new Color((oldColor.getRGB() + 0xF00) % 0x1000000); } } else if (property.getPropertyType() == ChildMergeActionType.class) { if (oldVal != null && oldVal.equals(ChildMergeActionType.DELETE_ALL_DUP_CHILD)) { newVal = ChildMergeActionType.UPDATE_DELETE_ON_CONFLICT; } else { newVal = ChildMergeActionType.DELETE_ALL_DUP_CHILD; } } else if (property.getPropertyType() == MungeResultStep.class || property.getPropertyType() == DeDupeResultStep.class) { newVal = new DeDupeResultStep(); } else if (property.getPropertyType() == TableMergeRules.class) { if (oldVal == null) { newVal = mmo; } else { newVal = null; } } else if (property.getPropertyType() == PoolFilterSetting.class) { if (oldVal != PoolFilterSetting.EVERYTHING) { newVal = PoolFilterSetting.EVERYTHING; } else { newVal = PoolFilterSetting.INVALID_ONLY; } } else if (property.getPropertyType() == AutoValidateSetting.class) { if (oldVal != AutoValidateSetting.NOTHING) { newVal = AutoValidateSetting.NOTHING; } else { newVal = AutoValidateSetting.SERP_CORRECTABLE; } } else if (property.getPropertyType() == Point.class) { if (oldVal == null) { newVal = new Point(0, 0); } else { newVal = new Point(((Point) oldVal).x + 1, ((Point) oldVal).y + 1); } } else { throw new RuntimeException("This test case lacks a value for " + property.getName() + " (type " + property.getPropertyType().getName() + ") from " + mmo.getClass()); } if (newVal instanceof MatchMakerObject) { ((MatchMakerObject) newVal).setSession(session); } return newVal; }
From source file:io.stallion.reflection.PropertyUtils.java
/** * Try to transform the passed in value into the destinationClass, via a applying a boatload of * heuristics./*from w w w . ja va2s . c o m*/ * * @param value * @param destinationClass * @return */ public static Object transform(Object value, Class destinationClass) { if (value == null) { return null; } if (value.getClass() == destinationClass) return value; if (destinationClass.isInstance(value)) { return value; } // If target type is Date and json was a long, convert the long to a date if (destinationClass == Date.class && (value.getClass() == long.class || value.getClass() == Long.class)) { return new Date((long) value); } // Convert integers to longs, if target type is long if ((destinationClass == Long.class || destinationClass == long.class) && (value.getClass() == int.class || value.getClass() == Integer.class)) { return new Long((int) value); } // Convert ints and longs to ZonedDateTime, if ZonedDateTime was a long if (destinationClass == ZonedDateTime.class && (value.getClass() == long.class || value.getClass() == Long.class || value.getClass() == int.class || value.getClass() == Integer.class)) { if (value.getClass() == Integer.class || value.getClass() == int.class) { return ZonedDateTime.ofInstant(Instant.ofEpochMilli(((int) value) * 1000), GeneralUtils.UTC); } else { return ZonedDateTime.ofInstant(Instant.ofEpochMilli((long) value), GeneralUtils.UTC); } } if (destinationClass == ZonedDateTime.class && value instanceof Timestamp) { return ZonedDateTime.ofInstant(((Timestamp) value).toInstant(), UTC); } if (destinationClass == Long.class && value instanceof BigInteger) { return ((BigInteger) value).longValue(); } if (destinationClass == ZonedDateTime.class && (value.getClass() == double.class || value.getClass() == Double.class)) { return ZonedDateTime.ofInstant(Instant.ofEpochMilli(Math.round((Double) value)), GeneralUtils.UTC); } // Convert Strings to Enums, if target type was an enum if (destinationClass.isEnum()) { return Enum.valueOf(destinationClass, value.toString()); } if ((destinationClass == boolean.class || destinationClass == Boolean.class)) { if (value instanceof String) { return Boolean.valueOf((String) value); } else if (value instanceof Integer) { return (Integer) value > 0; } else if (value instanceof Long) { return (Long) value > 0; } } if ((destinationClass == byte.class || destinationClass == Byte.class) && value.getClass() == String.class) { return new Byte((String) value); } if ((destinationClass == short.class || destinationClass == Short.class) && value.getClass() == String.class) { return new Short((String) value); } if ((destinationClass == int.class || destinationClass == Integer.class) && value.getClass() == String.class) { return new Integer((String) value); } if ((destinationClass == long.class || destinationClass == Long.class) && value.getClass() == String.class) { return new Long((String) value); } if ((destinationClass == long.class || destinationClass == Long.class) && value instanceof Integer) { return new Long((Integer) value); } if ((destinationClass == float.class || destinationClass == Float.class) && value.getClass() == String.class) { return new Float((String) value); } if ((destinationClass == float.class || destinationClass == Float.class) && value.getClass() == Integer.class) { return ((Integer) value).floatValue(); } if ((destinationClass == float.class || destinationClass == Float.class) && value.getClass() == Long.class) { return ((Long) value).floatValue(); } if ((destinationClass == float.class || destinationClass == Float.class) && value.getClass() == Double.class) { return ((Double) value).floatValue(); } if ((destinationClass == double.class || destinationClass == Double.class) && value.getClass() == Long.class) { return ((Long) value).floatValue(); } if ((destinationClass == float.class || destinationClass == Float.class) && value.getClass() == String.class) { return new Float((String) value); } if ((destinationClass == double.class || destinationClass == Double.class) && value.getClass() == String.class) { return new Double((String) value); } // If the type mis-match is due to boxing, just return the value if (value.getClass() == boolean.class || value.getClass() == Boolean.class || value.getClass() == byte.class || value.getClass() == Byte.class || value.getClass() == short.class || value.getClass() == Short.class || value.getClass() == int.class || value.getClass() == Integer.class || value.getClass() == long.class || value.getClass() == Long.class || value.getClass() == float.class || value.getClass() == Float.class || value.getClass() == double.class || value.getClass() == Double.class) return value; throw new PropertyException("cannot convert values of type '" + value.getClass().getName() + "' into type '" + destinationClass + "'"); }
From source file:net.sourceforge.msscodefactory.cfbam.v2_7.CFBamJavaFX.CFBamJavaFXNumberColPickerPane.java
public CFBamJavaFXNumberColPickerPane(ICFFormManager formManager, ICFBamJavaFXSchema argSchema, ICFBamNumberColObj argFocus, ICFBamTableObj argContainer, Collection<ICFBamNumberColObj> argDataCollection, ICFBamJavaFXNumberColChosen whenChosen) { super();/* www.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<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); 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.choseNumberCol(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"); } ICFBamNumberColObj selectedInstance = getJavaFXFocusAsNumberCol(); invokeWhenChosen.choseNumberCol(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.CFBamJavaFXNumberTypePickerPane.java
public CFBamJavaFXNumberTypePickerPane(ICFFormManager formManager, ICFBamJavaFXSchema argSchema, ICFBamNumberTypeObj argFocus, ICFBamSchemaDefObj argContainer, Collection<ICFBamNumberTypeObj> argDataCollection, ICFBamJavaFXNumberTypeChosen whenChosen) { super();//from ww w .j av 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<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); 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.choseNumberType(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"); } ICFBamNumberTypeObj selectedInstance = getJavaFXFocusAsNumberType(); invokeWhenChosen.choseNumberType(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:ips1ap101.lib.base.util.StrUtils.java
public static Object getObjeto(String string, Class<?> clazz) { if (string == null || clazz == null) { return null; }/* ww w .ja v a 2 s . c om*/ try { String value = StringUtils.trimToNull(string); if (value == null) { return null; } else if (Character.class.isAssignableFrom(clazz)) { return new Character(value.charAt(0)); } else if (String.class.isAssignableFrom(clazz)) { // ALFANUMERICO return string; } else if (Boolean.class.isAssignableFrom(clazz)) { return BitUtils.valueOf(value); } else if (Byte.class.isAssignableFrom(clazz)) { return new Byte(new BigDecimal(value).byteValue()); } else if (Short.class.isAssignableFrom(clazz)) { return new Short(new BigDecimal(value).shortValue()); } else if (Integer.class.isAssignableFrom(clazz)) { // ENTERO return new Integer(new BigDecimal(value).intValue()); } else if (Long.class.isAssignableFrom(clazz)) { return new Long(new BigDecimal(value).longValue()); } else if (Float.class.isAssignableFrom(clazz)) { return new Float(new BigDecimal(value).floatValue()); } else if (Double.class.isAssignableFrom(clazz)) { return new Double(new BigDecimal(value).doubleValue()); } else if (BigInteger.class.isAssignableFrom(clazz)) { // ENTERO_GRANDE return new Long(new BigDecimal(value).longValue()); } else if (BigDecimal.class.isAssignableFrom(clazz)) { // NUMERICO return new BigDecimal(value); } else if (java.util.Date.class.isAssignableFrom(clazz)) { // FECHA_HORA java.util.Date dateTime = TimeUtils.parse(value); if (Timestamp.class.isAssignableFrom(clazz)) { return new Timestamp(dateTime.getTime()); } else if (Time.class.isAssignableFrom(clazz)) { return new Time(dateTime.getTime()); } else if (Date.class.isAssignableFrom(clazz)) { return new Date(dateTime.getTime()); } else { return dateTime; } } // } catch (NumberFormatException e) { // return null; } catch (RuntimeException e) { return null; } return null; }
From source file:TypeConversionHelper.java
/** * Convert a byte[] into an instance of our value class. * @param buf byte array to be converted * @return converted Short array as object *///w w w . j a va 2 s. c o m public static Object getShortObjectArrayFromByteArray(byte[] buf) { short[] d = (short[]) getShortArrayFromByteArray(buf); Short[] a = new Short[d.length]; for (int i = 0; i < a.length; i++) { a[i] = new Short(d[i]); } return a; }
From source file:net.sourceforge.msscodefactory.cfbam.v2_7.CFBamJavaFX.CFBamJavaFXTextColPickerPane.java
public CFBamJavaFXTextColPickerPane(ICFFormManager formManager, ICFBamJavaFXSchema argSchema, ICFBamTextColObj argFocus, ICFBamTableObj argContainer, Collection<ICFBamTextColObj> argDataCollection, ICFBamJavaFXTextColChosen whenChosen) { super();//ww w . j a va 2 s. c om final String S_ProcName = "construct-schema-focus"; if (formManager == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 1, "formManager"); } cfFormManager = formManager; if (argSchema == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 2, "argSchema"); } if (whenChosen == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 6, "whenChosen"); } invokeWhenChosen = whenChosen; // argFocus is optional; focus may be set later during execution as // conditions of the runtime change. javafxSchema = argSchema; javaFXFocus = argFocus; javafxContainer = argContainer; setJavaFXDataCollection(argDataCollection); dataTable = new TableView<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); 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.choseTextCol(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"); } ICFBamTextColObj selectedInstance = getJavaFXFocusAsTextCol(); invokeWhenChosen.choseTextCol(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.CFBamJavaFXTextTypePickerPane.java
public CFBamJavaFXTextTypePickerPane(ICFFormManager formManager, ICFBamJavaFXSchema argSchema, ICFBamTextTypeObj argFocus, ICFBamSchemaDefObj argContainer, Collection<ICFBamTextTypeObj> argDataCollection, ICFBamJavaFXTextTypeChosen whenChosen) { super();/* w w 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"); } if (whenChosen == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 6, "whenChosen"); } invokeWhenChosen = whenChosen; // argFocus is optional; focus may be set later during execution as // conditions of the runtime change. javafxSchema = argSchema; javaFXFocus = argFocus; javafxContainer = argContainer; setJavaFXDataCollection(argDataCollection); dataTable = new TableView<ICFBamTextTypeObj>(); tableColumnId = new TableColumn<ICFBamTextTypeObj, Long>("Id"); tableColumnId.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTextTypeObj, Long>, ObservableValue<Long>>() { public ObservableValue<Long> call(CellDataFeatures<ICFBamTextTypeObj, Long> p) { ICFBamValueObj obj = p.getValue(); if (obj == null) { return (null); } else { long value = obj.getRequiredId(); Long wrapped = new Long(value); ReadOnlyObjectWrapper<Long> observable = new ReadOnlyObjectWrapper<Long>(); observable.setValue(wrapped); return (observable); } } }); tableColumnId.setCellFactory( new Callback<TableColumn<ICFBamTextTypeObj, Long>, TableCell<ICFBamTextTypeObj, Long>>() { @Override public TableCell<ICFBamTextTypeObj, Long> call(TableColumn<ICFBamTextTypeObj, Long> arg) { return new CFInt64TableCell<ICFBamTextTypeObj>(); } }); dataTable.getColumns().add(tableColumnId); tableColumnName = new TableColumn<ICFBamTextTypeObj, String>("Name"); tableColumnName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTextTypeObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamTextTypeObj, String> p) { ICFBamValueObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getRequiredName(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnName.setCellFactory( new Callback<TableColumn<ICFBamTextTypeObj, String>, TableCell<ICFBamTextTypeObj, String>>() { @Override public TableCell<ICFBamTextTypeObj, String> call(TableColumn<ICFBamTextTypeObj, String> arg) { return new CFStringTableCell<ICFBamTextTypeObj>(); } }); dataTable.getColumns().add(tableColumnName); tableColumnShortName = new TableColumn<ICFBamTextTypeObj, String>("Short Name"); tableColumnShortName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTextTypeObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamTextTypeObj, String> p) { ICFBamValueObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getOptionalShortName(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnShortName.setCellFactory( new Callback<TableColumn<ICFBamTextTypeObj, String>, TableCell<ICFBamTextTypeObj, String>>() { @Override public TableCell<ICFBamTextTypeObj, String> call(TableColumn<ICFBamTextTypeObj, String> arg) { return new CFStringTableCell<ICFBamTextTypeObj>(); } }); dataTable.getColumns().add(tableColumnShortName); tableColumnLabel = new TableColumn<ICFBamTextTypeObj, String>("Label"); tableColumnLabel.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTextTypeObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamTextTypeObj, String> p) { ICFBamValueObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getOptionalLabel(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnLabel.setCellFactory( new Callback<TableColumn<ICFBamTextTypeObj, String>, TableCell<ICFBamTextTypeObj, String>>() { @Override public TableCell<ICFBamTextTypeObj, String> call(TableColumn<ICFBamTextTypeObj, String> arg) { return new CFStringTableCell<ICFBamTextTypeObj>(); } }); dataTable.getColumns().add(tableColumnLabel); tableColumnShortDescription = new TableColumn<ICFBamTextTypeObj, String>("Short Description"); tableColumnShortDescription.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTextTypeObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamTextTypeObj, String> p) { ICFBamValueObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getOptionalShortDescription(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnShortDescription.setCellFactory( new Callback<TableColumn<ICFBamTextTypeObj, String>, TableCell<ICFBamTextTypeObj, String>>() { @Override public TableCell<ICFBamTextTypeObj, String> call(TableColumn<ICFBamTextTypeObj, String> arg) { return new CFStringTableCell<ICFBamTextTypeObj>(); } }); dataTable.getColumns().add(tableColumnShortDescription); tableColumnDescription = new TableColumn<ICFBamTextTypeObj, String>("Description"); tableColumnDescription.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTextTypeObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamTextTypeObj, String> p) { ICFBamValueObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getOptionalDescription(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnDescription.setCellFactory( new Callback<TableColumn<ICFBamTextTypeObj, String>, TableCell<ICFBamTextTypeObj, String>>() { @Override public TableCell<ICFBamTextTypeObj, String> call(TableColumn<ICFBamTextTypeObj, String> arg) { return new CFStringTableCell<ICFBamTextTypeObj>(); } }); dataTable.getColumns().add(tableColumnDescription); tableColumnIsNullable = new TableColumn<ICFBamTextTypeObj, Boolean>("Is Nullable"); tableColumnIsNullable.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTextTypeObj, Boolean>, ObservableValue<Boolean>>() { public ObservableValue<Boolean> call(CellDataFeatures<ICFBamTextTypeObj, Boolean> p) { ICFBamValueObj obj = p.getValue(); if (obj == null) { return (null); } else { boolean value = obj.getRequiredIsNullable(); Boolean wrapped = new Boolean(value); ReadOnlyObjectWrapper<Boolean> observable = new ReadOnlyObjectWrapper<Boolean>(); observable.setValue(wrapped); return (observable); } } }); tableColumnIsNullable.setCellFactory( new Callback<TableColumn<ICFBamTextTypeObj, Boolean>, TableCell<ICFBamTextTypeObj, Boolean>>() { @Override public TableCell<ICFBamTextTypeObj, Boolean> call(TableColumn<ICFBamTextTypeObj, Boolean> arg) { return new CFBoolTableCell<ICFBamTextTypeObj>(); } }); dataTable.getColumns().add(tableColumnIsNullable); tableColumnGenerateId = new TableColumn<ICFBamTextTypeObj, Boolean>("Generate Id"); tableColumnGenerateId.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTextTypeObj, Boolean>, ObservableValue<Boolean>>() { public ObservableValue<Boolean> call(CellDataFeatures<ICFBamTextTypeObj, Boolean> p) { ICFBamValueObj obj = p.getValue(); if (obj == null) { return (null); } else { Boolean value = obj.getOptionalGenerateId(); ReadOnlyObjectWrapper<Boolean> observable = new ReadOnlyObjectWrapper<Boolean>(); observable.setValue(value); return (observable); } } }); tableColumnGenerateId.setCellFactory( new Callback<TableColumn<ICFBamTextTypeObj, Boolean>, TableCell<ICFBamTextTypeObj, Boolean>>() { @Override public TableCell<ICFBamTextTypeObj, Boolean> call(TableColumn<ICFBamTextTypeObj, Boolean> arg) { return new CFBoolTableCell<ICFBamTextTypeObj>(); } }); dataTable.getColumns().add(tableColumnGenerateId); tableColumnDefaultVisibility = new TableColumn<ICFBamTextTypeObj, Boolean>("Default Visibility"); tableColumnDefaultVisibility.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTextTypeObj, Boolean>, ObservableValue<Boolean>>() { public ObservableValue<Boolean> call(CellDataFeatures<ICFBamTextTypeObj, Boolean> p) { ICFBamValueObj obj = p.getValue(); if (obj == null) { return (null); } else { boolean value = obj.getRequiredDefaultVisibility(); Boolean wrapped = new Boolean(value); ReadOnlyObjectWrapper<Boolean> observable = new ReadOnlyObjectWrapper<Boolean>(); observable.setValue(wrapped); return (observable); } } }); tableColumnDefaultVisibility.setCellFactory( new Callback<TableColumn<ICFBamTextTypeObj, Boolean>, TableCell<ICFBamTextTypeObj, Boolean>>() { @Override public TableCell<ICFBamTextTypeObj, Boolean> call(TableColumn<ICFBamTextTypeObj, Boolean> arg) { return new CFBoolTableCell<ICFBamTextTypeObj>(); } }); dataTable.getColumns().add(tableColumnDefaultVisibility); tableColumnDbName = new TableColumn<ICFBamTextTypeObj, String>("Db Name"); tableColumnDbName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTextTypeObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamTextTypeObj, String> p) { ICFBamAtomObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getOptionalDbName(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnDbName.setCellFactory( new Callback<TableColumn<ICFBamTextTypeObj, String>, TableCell<ICFBamTextTypeObj, String>>() { @Override public TableCell<ICFBamTextTypeObj, String> call(TableColumn<ICFBamTextTypeObj, String> arg) { return new CFStringTableCell<ICFBamTextTypeObj>(); } }); dataTable.getColumns().add(tableColumnDbName); tableColumnMaxLen = new TableColumn<ICFBamTextTypeObj, Integer>("Max. Length"); tableColumnMaxLen.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTextTypeObj, Integer>, ObservableValue<Integer>>() { public ObservableValue<Integer> call(CellDataFeatures<ICFBamTextTypeObj, Integer> p) { ICFBamTextDefObj obj = p.getValue(); if (obj == null) { return (null); } else { int value = obj.getRequiredMaxLen(); Integer wrapped = new Integer(value); ReadOnlyObjectWrapper<Integer> observable = new ReadOnlyObjectWrapper<Integer>(); observable.setValue(wrapped); return (observable); } } }); tableColumnMaxLen.setCellFactory( new Callback<TableColumn<ICFBamTextTypeObj, Integer>, TableCell<ICFBamTextTypeObj, Integer>>() { @Override public TableCell<ICFBamTextTypeObj, Integer> call(TableColumn<ICFBamTextTypeObj, Integer> arg) { return new CFInt32TableCell<ICFBamTextTypeObj>(); } }); dataTable.getColumns().add(tableColumnMaxLen); tableColumnShowLines = new TableColumn<ICFBamTextTypeObj, Short>("Show Lines"); tableColumnShowLines.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTextTypeObj, Short>, ObservableValue<Short>>() { public ObservableValue<Short> call(CellDataFeatures<ICFBamTextTypeObj, Short> p) { ICFBamTextDefObj obj = p.getValue(); if (obj == null) { return (null); } else { short value = obj.getRequiredShowLines(); Short wrapped = new Short(value); ReadOnlyObjectWrapper<Short> observable = new ReadOnlyObjectWrapper<Short>(); observable.setValue(wrapped); return (observable); } } }); tableColumnShowLines.setCellFactory( new Callback<TableColumn<ICFBamTextTypeObj, Short>, TableCell<ICFBamTextTypeObj, Short>>() { @Override public TableCell<ICFBamTextTypeObj, Short> call(TableColumn<ICFBamTextTypeObj, Short> arg) { return new CFInt16TableCell<ICFBamTextTypeObj>(); } }); dataTable.getColumns().add(tableColumnShowLines); tableColumnInitValue = new TableColumn<ICFBamTextTypeObj, String>("Init. Value"); tableColumnInitValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTextTypeObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamTextTypeObj, String> p) { ICFBamTextDefObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getOptionalInitValue(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnInitValue.setCellFactory( new Callback<TableColumn<ICFBamTextTypeObj, String>, TableCell<ICFBamTextTypeObj, String>>() { @Override public TableCell<ICFBamTextTypeObj, String> call(TableColumn<ICFBamTextTypeObj, String> arg) { return new CFTextTableCell<ICFBamTextTypeObj>(); } }); dataTable.getColumns().add(tableColumnInitValue); tableColumnDefaultValue = new TableColumn<ICFBamTextTypeObj, String>("Default Value"); tableColumnDefaultValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTextTypeObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamTextTypeObj, String> p) { ICFBamTextDefObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getOptionalDefaultValue(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnDefaultValue.setCellFactory( new Callback<TableColumn<ICFBamTextTypeObj, String>, TableCell<ICFBamTextTypeObj, String>>() { @Override public TableCell<ICFBamTextTypeObj, String> call(TableColumn<ICFBamTextTypeObj, String> arg) { return new CFTextTableCell<ICFBamTextTypeObj>(); } }); dataTable.getColumns().add(tableColumnDefaultValue); tableColumnNullValue = new TableColumn<ICFBamTextTypeObj, String>("Null Value"); tableColumnNullValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTextTypeObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamTextTypeObj, String> p) { ICFBamTextDefObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getOptionalNullValue(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnNullValue.setCellFactory( new Callback<TableColumn<ICFBamTextTypeObj, String>, TableCell<ICFBamTextTypeObj, String>>() { @Override public TableCell<ICFBamTextTypeObj, String> call(TableColumn<ICFBamTextTypeObj, String> arg) { return new CFTextTableCell<ICFBamTextTypeObj>(); } }); dataTable.getColumns().add(tableColumnNullValue); tableColumnUnknownValue = new TableColumn<ICFBamTextTypeObj, String>("Unknown Value"); tableColumnUnknownValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTextTypeObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamTextTypeObj, String> p) { ICFBamTextDefObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getOptionalUnknownValue(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnUnknownValue.setCellFactory( new Callback<TableColumn<ICFBamTextTypeObj, String>, TableCell<ICFBamTextTypeObj, String>>() { @Override public TableCell<ICFBamTextTypeObj, String> call(TableColumn<ICFBamTextTypeObj, String> arg) { return new CFTextTableCell<ICFBamTextTypeObj>(); } }); dataTable.getColumns().add(tableColumnUnknownValue); tableColumnLookupDefSchema = new TableColumn<ICFBamTextTypeObj, ICFBamSchemaDefObj>( "Defining Schema Definition"); tableColumnLookupDefSchema.setCellValueFactory( new Callback<CellDataFeatures<ICFBamTextTypeObj, ICFBamSchemaDefObj>, ObservableValue<ICFBamSchemaDefObj>>() { public ObservableValue<ICFBamSchemaDefObj> call( CellDataFeatures<ICFBamTextTypeObj, ICFBamSchemaDefObj> p) { ICFBamTextTypeObj obj = p.getValue(); if (obj == null) { return (null); } else { ICFBamSchemaDefObj ref = obj.getOptionalLookupDefSchema(); ReadOnlyObjectWrapper<ICFBamSchemaDefObj> observable = new ReadOnlyObjectWrapper<ICFBamSchemaDefObj>(); observable.setValue(ref); return (observable); } } }); tableColumnLookupDefSchema.setCellFactory( new Callback<TableColumn<ICFBamTextTypeObj, ICFBamSchemaDefObj>, TableCell<ICFBamTextTypeObj, ICFBamSchemaDefObj>>() { @Override public TableCell<ICFBamTextTypeObj, ICFBamSchemaDefObj> call( TableColumn<ICFBamTextTypeObj, ICFBamSchemaDefObj> arg) { return new CFReferenceTableCell<ICFBamTextTypeObj, ICFBamSchemaDefObj>(); } }); dataTable.getColumns().add(tableColumnLookupDefSchema); dataTable.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<ICFBamTextTypeObj>() { @Override public void changed(ObservableValue<? extends ICFBamTextTypeObj> observable, ICFBamTextTypeObj oldValue, ICFBamTextTypeObj newValue) { setJavaFXFocus(newValue); if (buttonChooseSelected != null) { if (newValue != null) { buttonChooseSelected.setDisable(false); } else { buttonChooseSelected.setDisable(true); } } } }); hboxMenu = new CFHBox(10); buttonCancel = new CFButton(); buttonCancel.setMinWidth(200); buttonCancel.setText("Cancel"); buttonCancel.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { cfFormManager.closeCurrentForm(); } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); hboxMenu.getChildren().add(buttonCancel); buttonChooseNone = new CFButton(); buttonChooseNone.setMinWidth(200); buttonChooseNone.setText("ChooseNone"); buttonChooseNone.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "schemaObj"); } invokeWhenChosen.choseTextType(null); cfFormManager.closeCurrentForm(); } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); hboxMenu.getChildren().add(buttonChooseNone); buttonChooseSelected = new CFButton(); buttonChooseSelected.setMinWidth(200); buttonChooseSelected.setText("ChooseSelected"); buttonChooseSelected.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "schemaObj"); } ICFBamTextTypeObj selectedInstance = getJavaFXFocusAsTextType(); invokeWhenChosen.choseTextType(selectedInstance); cfFormManager.closeCurrentForm(); } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); hboxMenu.getChildren().add(buttonChooseSelected); if (argFocus != null) { dataTable.getSelectionModel().select(argFocus); } setTop(hboxMenu); setCenter(dataTable); }
From source file:net.sourceforge.msscodefactory.cfbam.v2_7.CFBamJavaFX.CFBamJavaFXStringColPickerPane.java
public CFBamJavaFXStringColPickerPane(ICFFormManager formManager, ICFBamJavaFXSchema argSchema, ICFBamStringColObj argFocus, ICFBamTableObj argContainer, Collection<ICFBamStringColObj> argDataCollection, ICFBamJavaFXStringColChosen whenChosen) { super();/*from w w w . j a v a 2 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<ICFBamStringColObj>(); tableColumnId = new TableColumn<ICFBamStringColObj, Long>("Id"); tableColumnId.setCellValueFactory( new Callback<CellDataFeatures<ICFBamStringColObj, Long>, ObservableValue<Long>>() { public ObservableValue<Long> call(CellDataFeatures<ICFBamStringColObj, Long> p) { ICFBamValueObj obj = p.getValue(); if (obj == null) { return (null); } else { long value = obj.getRequiredId(); Long wrapped = new Long(value); ReadOnlyObjectWrapper<Long> observable = new ReadOnlyObjectWrapper<Long>(); observable.setValue(wrapped); return (observable); } } }); tableColumnId.setCellFactory( new Callback<TableColumn<ICFBamStringColObj, Long>, TableCell<ICFBamStringColObj, Long>>() { @Override public TableCell<ICFBamStringColObj, Long> call(TableColumn<ICFBamStringColObj, Long> arg) { return new CFInt64TableCell<ICFBamStringColObj>(); } }); dataTable.getColumns().add(tableColumnId); tableColumnName = new TableColumn<ICFBamStringColObj, String>("Name"); tableColumnName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamStringColObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamStringColObj, String> p) { ICFBamValueObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getRequiredName(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnName.setCellFactory( new Callback<TableColumn<ICFBamStringColObj, String>, TableCell<ICFBamStringColObj, String>>() { @Override public TableCell<ICFBamStringColObj, String> call(TableColumn<ICFBamStringColObj, String> arg) { return new CFStringTableCell<ICFBamStringColObj>(); } }); dataTable.getColumns().add(tableColumnName); tableColumnShortName = new TableColumn<ICFBamStringColObj, String>("Short Name"); tableColumnShortName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamStringColObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamStringColObj, String> p) { ICFBamValueObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getOptionalShortName(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnShortName.setCellFactory( new Callback<TableColumn<ICFBamStringColObj, String>, TableCell<ICFBamStringColObj, String>>() { @Override public TableCell<ICFBamStringColObj, String> call(TableColumn<ICFBamStringColObj, String> arg) { return new CFStringTableCell<ICFBamStringColObj>(); } }); dataTable.getColumns().add(tableColumnShortName); tableColumnLabel = new TableColumn<ICFBamStringColObj, String>("Label"); tableColumnLabel.setCellValueFactory( new Callback<CellDataFeatures<ICFBamStringColObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamStringColObj, String> p) { ICFBamValueObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getOptionalLabel(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnLabel.setCellFactory( new Callback<TableColumn<ICFBamStringColObj, String>, TableCell<ICFBamStringColObj, String>>() { @Override public TableCell<ICFBamStringColObj, String> call(TableColumn<ICFBamStringColObj, String> arg) { return new CFStringTableCell<ICFBamStringColObj>(); } }); dataTable.getColumns().add(tableColumnLabel); tableColumnShortDescription = new TableColumn<ICFBamStringColObj, String>("Short Description"); tableColumnShortDescription.setCellValueFactory( new Callback<CellDataFeatures<ICFBamStringColObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamStringColObj, String> p) { ICFBamValueObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getOptionalShortDescription(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnShortDescription.setCellFactory( new Callback<TableColumn<ICFBamStringColObj, String>, TableCell<ICFBamStringColObj, String>>() { @Override public TableCell<ICFBamStringColObj, String> call(TableColumn<ICFBamStringColObj, String> arg) { return new CFStringTableCell<ICFBamStringColObj>(); } }); dataTable.getColumns().add(tableColumnShortDescription); tableColumnDescription = new TableColumn<ICFBamStringColObj, String>("Description"); tableColumnDescription.setCellValueFactory( new Callback<CellDataFeatures<ICFBamStringColObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamStringColObj, String> p) { ICFBamValueObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getOptionalDescription(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnDescription.setCellFactory( new Callback<TableColumn<ICFBamStringColObj, String>, TableCell<ICFBamStringColObj, String>>() { @Override public TableCell<ICFBamStringColObj, String> call(TableColumn<ICFBamStringColObj, String> arg) { return new CFStringTableCell<ICFBamStringColObj>(); } }); dataTable.getColumns().add(tableColumnDescription); tableColumnIsNullable = new TableColumn<ICFBamStringColObj, Boolean>("Is Nullable"); tableColumnIsNullable.setCellValueFactory( new Callback<CellDataFeatures<ICFBamStringColObj, Boolean>, ObservableValue<Boolean>>() { public ObservableValue<Boolean> call(CellDataFeatures<ICFBamStringColObj, Boolean> p) { ICFBamValueObj obj = p.getValue(); if (obj == null) { return (null); } else { boolean value = obj.getRequiredIsNullable(); Boolean wrapped = new Boolean(value); ReadOnlyObjectWrapper<Boolean> observable = new ReadOnlyObjectWrapper<Boolean>(); observable.setValue(wrapped); return (observable); } } }); tableColumnIsNullable.setCellFactory( new Callback<TableColumn<ICFBamStringColObj, Boolean>, TableCell<ICFBamStringColObj, Boolean>>() { @Override public TableCell<ICFBamStringColObj, Boolean> call( TableColumn<ICFBamStringColObj, Boolean> arg) { return new CFBoolTableCell<ICFBamStringColObj>(); } }); dataTable.getColumns().add(tableColumnIsNullable); tableColumnGenerateId = new TableColumn<ICFBamStringColObj, Boolean>("Generate Id"); tableColumnGenerateId.setCellValueFactory( new Callback<CellDataFeatures<ICFBamStringColObj, Boolean>, ObservableValue<Boolean>>() { public ObservableValue<Boolean> call(CellDataFeatures<ICFBamStringColObj, Boolean> p) { ICFBamValueObj obj = p.getValue(); if (obj == null) { return (null); } else { Boolean value = obj.getOptionalGenerateId(); ReadOnlyObjectWrapper<Boolean> observable = new ReadOnlyObjectWrapper<Boolean>(); observable.setValue(value); return (observable); } } }); tableColumnGenerateId.setCellFactory( new Callback<TableColumn<ICFBamStringColObj, Boolean>, TableCell<ICFBamStringColObj, Boolean>>() { @Override public TableCell<ICFBamStringColObj, Boolean> call( TableColumn<ICFBamStringColObj, Boolean> arg) { return new CFBoolTableCell<ICFBamStringColObj>(); } }); dataTable.getColumns().add(tableColumnGenerateId); tableColumnDefaultVisibility = new TableColumn<ICFBamStringColObj, Boolean>("Default Visibility"); tableColumnDefaultVisibility.setCellValueFactory( new Callback<CellDataFeatures<ICFBamStringColObj, Boolean>, ObservableValue<Boolean>>() { public ObservableValue<Boolean> call(CellDataFeatures<ICFBamStringColObj, Boolean> p) { ICFBamValueObj obj = p.getValue(); if (obj == null) { return (null); } else { boolean value = obj.getRequiredDefaultVisibility(); Boolean wrapped = new Boolean(value); ReadOnlyObjectWrapper<Boolean> observable = new ReadOnlyObjectWrapper<Boolean>(); observable.setValue(wrapped); return (observable); } } }); tableColumnDefaultVisibility.setCellFactory( new Callback<TableColumn<ICFBamStringColObj, Boolean>, TableCell<ICFBamStringColObj, Boolean>>() { @Override public TableCell<ICFBamStringColObj, Boolean> call( TableColumn<ICFBamStringColObj, Boolean> arg) { return new CFBoolTableCell<ICFBamStringColObj>(); } }); dataTable.getColumns().add(tableColumnDefaultVisibility); tableColumnDbName = new TableColumn<ICFBamStringColObj, String>("Db Name"); tableColumnDbName.setCellValueFactory( new Callback<CellDataFeatures<ICFBamStringColObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamStringColObj, String> p) { ICFBamAtomObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getOptionalDbName(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnDbName.setCellFactory( new Callback<TableColumn<ICFBamStringColObj, String>, TableCell<ICFBamStringColObj, String>>() { @Override public TableCell<ICFBamStringColObj, String> call(TableColumn<ICFBamStringColObj, String> arg) { return new CFStringTableCell<ICFBamStringColObj>(); } }); dataTable.getColumns().add(tableColumnDbName); tableColumnMaxLen = new TableColumn<ICFBamStringColObj, Integer>("Max. Length"); tableColumnMaxLen.setCellValueFactory( new Callback<CellDataFeatures<ICFBamStringColObj, Integer>, ObservableValue<Integer>>() { public ObservableValue<Integer> call(CellDataFeatures<ICFBamStringColObj, Integer> p) { ICFBamStringDefObj obj = p.getValue(); if (obj == null) { return (null); } else { int value = obj.getRequiredMaxLen(); Integer wrapped = new Integer(value); ReadOnlyObjectWrapper<Integer> observable = new ReadOnlyObjectWrapper<Integer>(); observable.setValue(wrapped); return (observable); } } }); tableColumnMaxLen.setCellFactory( new Callback<TableColumn<ICFBamStringColObj, Integer>, TableCell<ICFBamStringColObj, Integer>>() { @Override public TableCell<ICFBamStringColObj, Integer> call( TableColumn<ICFBamStringColObj, Integer> arg) { return new CFInt32TableCell<ICFBamStringColObj>(); } }); dataTable.getColumns().add(tableColumnMaxLen); tableColumnShowLines = new TableColumn<ICFBamStringColObj, Short>("Show Lines"); tableColumnShowLines.setCellValueFactory( new Callback<CellDataFeatures<ICFBamStringColObj, Short>, ObservableValue<Short>>() { public ObservableValue<Short> call(CellDataFeatures<ICFBamStringColObj, Short> p) { ICFBamStringDefObj obj = p.getValue(); if (obj == null) { return (null); } else { short value = obj.getRequiredShowLines(); Short wrapped = new Short(value); ReadOnlyObjectWrapper<Short> observable = new ReadOnlyObjectWrapper<Short>(); observable.setValue(wrapped); return (observable); } } }); tableColumnShowLines.setCellFactory( new Callback<TableColumn<ICFBamStringColObj, Short>, TableCell<ICFBamStringColObj, Short>>() { @Override public TableCell<ICFBamStringColObj, Short> call(TableColumn<ICFBamStringColObj, Short> arg) { return new CFInt16TableCell<ICFBamStringColObj>(); } }); dataTable.getColumns().add(tableColumnShowLines); tableColumnInitValue = new TableColumn<ICFBamStringColObj, String>("Init. Value"); tableColumnInitValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamStringColObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamStringColObj, String> p) { ICFBamStringDefObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getOptionalInitValue(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnInitValue.setCellFactory( new Callback<TableColumn<ICFBamStringColObj, String>, TableCell<ICFBamStringColObj, String>>() { @Override public TableCell<ICFBamStringColObj, String> call(TableColumn<ICFBamStringColObj, String> arg) { return new CFStringTableCell<ICFBamStringColObj>(); } }); dataTable.getColumns().add(tableColumnInitValue); tableColumnDefaultValue = new TableColumn<ICFBamStringColObj, String>("Default Value"); tableColumnDefaultValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamStringColObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamStringColObj, String> p) { ICFBamStringDefObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getOptionalDefaultValue(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnDefaultValue.setCellFactory( new Callback<TableColumn<ICFBamStringColObj, String>, TableCell<ICFBamStringColObj, String>>() { @Override public TableCell<ICFBamStringColObj, String> call(TableColumn<ICFBamStringColObj, String> arg) { return new CFStringTableCell<ICFBamStringColObj>(); } }); dataTable.getColumns().add(tableColumnDefaultValue); tableColumnNullValue = new TableColumn<ICFBamStringColObj, String>("Null Value"); tableColumnNullValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamStringColObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamStringColObj, String> p) { ICFBamStringDefObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getOptionalNullValue(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnNullValue.setCellFactory( new Callback<TableColumn<ICFBamStringColObj, String>, TableCell<ICFBamStringColObj, String>>() { @Override public TableCell<ICFBamStringColObj, String> call(TableColumn<ICFBamStringColObj, String> arg) { return new CFStringTableCell<ICFBamStringColObj>(); } }); dataTable.getColumns().add(tableColumnNullValue); tableColumnUnknownValue = new TableColumn<ICFBamStringColObj, String>("Unknown Value"); tableColumnUnknownValue.setCellValueFactory( new Callback<CellDataFeatures<ICFBamStringColObj, String>, ObservableValue<String>>() { public ObservableValue<String> call(CellDataFeatures<ICFBamStringColObj, String> p) { ICFBamStringDefObj obj = p.getValue(); if (obj == null) { return (null); } else { String value = obj.getOptionalUnknownValue(); ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>(); observable.setValue(value); return (observable); } } }); tableColumnUnknownValue.setCellFactory( new Callback<TableColumn<ICFBamStringColObj, String>, TableCell<ICFBamStringColObj, String>>() { @Override public TableCell<ICFBamStringColObj, String> call(TableColumn<ICFBamStringColObj, String> arg) { return new CFStringTableCell<ICFBamStringColObj>(); } }); dataTable.getColumns().add(tableColumnUnknownValue); tableColumnLookupDefSchema = new TableColumn<ICFBamStringColObj, ICFBamSchemaDefObj>( "Defining Schema Definition"); tableColumnLookupDefSchema.setCellValueFactory( new Callback<CellDataFeatures<ICFBamStringColObj, ICFBamSchemaDefObj>, ObservableValue<ICFBamSchemaDefObj>>() { public ObservableValue<ICFBamSchemaDefObj> call( CellDataFeatures<ICFBamStringColObj, ICFBamSchemaDefObj> p) { ICFBamStringColObj obj = p.getValue(); if (obj == null) { return (null); } else { ICFBamSchemaDefObj ref = obj.getOptionalLookupDefSchema(); ReadOnlyObjectWrapper<ICFBamSchemaDefObj> observable = new ReadOnlyObjectWrapper<ICFBamSchemaDefObj>(); observable.setValue(ref); return (observable); } } }); tableColumnLookupDefSchema.setCellFactory( new Callback<TableColumn<ICFBamStringColObj, ICFBamSchemaDefObj>, TableCell<ICFBamStringColObj, ICFBamSchemaDefObj>>() { @Override public TableCell<ICFBamStringColObj, ICFBamSchemaDefObj> call( TableColumn<ICFBamStringColObj, ICFBamSchemaDefObj> arg) { return new CFReferenceTableCell<ICFBamStringColObj, ICFBamSchemaDefObj>(); } }); dataTable.getColumns().add(tableColumnLookupDefSchema); dataTable.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<ICFBamStringColObj>() { @Override public void changed(ObservableValue<? extends ICFBamStringColObj> observable, ICFBamStringColObj oldValue, ICFBamStringColObj newValue) { setJavaFXFocus(newValue); if (buttonChooseSelected != null) { if (newValue != null) { buttonChooseSelected.setDisable(false); } else { buttonChooseSelected.setDisable(true); } } } }); hboxMenu = new CFHBox(10); buttonCancel = new CFButton(); buttonCancel.setMinWidth(200); buttonCancel.setText("Cancel"); buttonCancel.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { cfFormManager.closeCurrentForm(); } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); hboxMenu.getChildren().add(buttonCancel); buttonChooseNone = new CFButton(); buttonChooseNone.setMinWidth(200); buttonChooseNone.setText("ChooseNone"); buttonChooseNone.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "schemaObj"); } invokeWhenChosen.choseStringCol(null); cfFormManager.closeCurrentForm(); } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); hboxMenu.getChildren().add(buttonChooseNone); buttonChooseSelected = new CFButton(); buttonChooseSelected.setMinWidth(200); buttonChooseSelected.setText("ChooseSelected"); buttonChooseSelected.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { final String S_ProcName = "handle"; try { ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "schemaObj"); } ICFBamStringColObj selectedInstance = getJavaFXFocusAsStringCol(); invokeWhenChosen.choseStringCol(selectedInstance); cfFormManager.closeCurrentForm(); } catch (Throwable t) { CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t); } } }); hboxMenu.getChildren().add(buttonChooseSelected); if (argFocus != null) { dataTable.getSelectionModel().select(argFocus); } setTop(hboxMenu); setCenter(dataTable); }