Example usage for javafx.beans.value ChangeListener ChangeListener

List of usage examples for javafx.beans.value ChangeListener ChangeListener

Introduction

In this page you can find the example usage for javafx.beans.value ChangeListener ChangeListener.

Prototype

ChangeListener

Source Link

Usage

From source file:net.sourceforge.msscodefactory.cfbam.v2_7.CFBamJavaFX.CFBamJavaFXChainPickerPane.java

public CFBamJavaFXChainPickerPane(ICFFormManager formManager, ICFBamJavaFXSchema argSchema,
        ICFBamChainObj argFocus, ICFBamTableObj argContainer, Collection<ICFBamChainObj> argDataCollection,
        ICFBamJavaFXChainChosen whenChosen) {
    super();/*from  ww  w  .j a v  a  2  s  .c  om*/
    final String S_ProcName = "construct-schema-focus";
    if (formManager == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 1,
                "formManager");
    }
    cfFormManager = formManager;
    if (argSchema == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 2,
                "argSchema");
    }
    if (whenChosen == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 6,
                "whenChosen");
    }
    invokeWhenChosen = whenChosen;
    // argFocus is optional; focus may be set later during execution as
    // conditions of the runtime change.
    javafxSchema = argSchema;
    javaFXFocus = argFocus;
    javafxContainer = argContainer;
    setJavaFXDataCollection(argDataCollection);
    dataTable = new TableView<ICFBamChainObj>();
    tableColumnId = new TableColumn<ICFBamChainObj, Long>("Id");
    tableColumnId
            .setCellValueFactory(new Callback<CellDataFeatures<ICFBamChainObj, Long>, ObservableValue<Long>>() {
                public ObservableValue<Long> call(CellDataFeatures<ICFBamChainObj, Long> p) {
                    ICFBamChainObj 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<ICFBamChainObj, Long>, TableCell<ICFBamChainObj, Long>>() {
                @Override
                public TableCell<ICFBamChainObj, Long> call(TableColumn<ICFBamChainObj, Long> arg) {
                    return new CFInt64TableCell<ICFBamChainObj>();
                }
            });
    dataTable.getColumns().add(tableColumnId);
    tableColumnName = new TableColumn<ICFBamChainObj, String>("Name");
    tableColumnName.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamChainObj, String>, ObservableValue<String>>() {
                public ObservableValue<String> call(CellDataFeatures<ICFBamChainObj, String> p) {
                    ICFBamChainObj 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<ICFBamChainObj, String>, TableCell<ICFBamChainObj, String>>() {
                @Override
                public TableCell<ICFBamChainObj, String> call(TableColumn<ICFBamChainObj, String> arg) {
                    return new CFStringTableCell<ICFBamChainObj>();
                }
            });
    dataTable.getColumns().add(tableColumnName);
    tableColumnShortName = new TableColumn<ICFBamChainObj, String>("Short Name");
    tableColumnShortName.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamChainObj, String>, ObservableValue<String>>() {
                public ObservableValue<String> call(CellDataFeatures<ICFBamChainObj, String> p) {
                    ICFBamChainObj 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<ICFBamChainObj, String>, TableCell<ICFBamChainObj, String>>() {
                @Override
                public TableCell<ICFBamChainObj, String> call(TableColumn<ICFBamChainObj, String> arg) {
                    return new CFStringTableCell<ICFBamChainObj>();
                }
            });
    dataTable.getColumns().add(tableColumnShortName);
    tableColumnLabel = new TableColumn<ICFBamChainObj, String>("Label");
    tableColumnLabel.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamChainObj, String>, ObservableValue<String>>() {
                public ObservableValue<String> call(CellDataFeatures<ICFBamChainObj, String> p) {
                    ICFBamChainObj 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<ICFBamChainObj, String>, TableCell<ICFBamChainObj, String>>() {
                @Override
                public TableCell<ICFBamChainObj, String> call(TableColumn<ICFBamChainObj, String> arg) {
                    return new CFStringTableCell<ICFBamChainObj>();
                }
            });
    dataTable.getColumns().add(tableColumnLabel);
    tableColumnShortDescription = new TableColumn<ICFBamChainObj, String>("Short Description");
    tableColumnShortDescription.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamChainObj, String>, ObservableValue<String>>() {
                public ObservableValue<String> call(CellDataFeatures<ICFBamChainObj, String> p) {
                    ICFBamChainObj 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<ICFBamChainObj, String>, TableCell<ICFBamChainObj, String>>() {
                @Override
                public TableCell<ICFBamChainObj, String> call(TableColumn<ICFBamChainObj, String> arg) {
                    return new CFStringTableCell<ICFBamChainObj>();
                }
            });
    dataTable.getColumns().add(tableColumnShortDescription);
    tableColumnDescription = new TableColumn<ICFBamChainObj, String>("Description");
    tableColumnDescription.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamChainObj, String>, ObservableValue<String>>() {
                public ObservableValue<String> call(CellDataFeatures<ICFBamChainObj, String> p) {
                    ICFBamChainObj 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<ICFBamChainObj, String>, TableCell<ICFBamChainObj, String>>() {
                @Override
                public TableCell<ICFBamChainObj, String> call(TableColumn<ICFBamChainObj, String> arg) {
                    return new CFStringTableCell<ICFBamChainObj>();
                }
            });
    dataTable.getColumns().add(tableColumnDescription);
    tableColumnSuffix = new TableColumn<ICFBamChainObj, String>("Suffix");
    tableColumnSuffix.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamChainObj, String>, ObservableValue<String>>() {
                public ObservableValue<String> call(CellDataFeatures<ICFBamChainObj, String> p) {
                    ICFBamChainObj obj = p.getValue();
                    if (obj == null) {
                        return (null);
                    } else {
                        String value = obj.getOptionalSuffix();
                        ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>();
                        observable.setValue(value);
                        return (observable);
                    }
                }
            });
    tableColumnSuffix.setCellFactory(
            new Callback<TableColumn<ICFBamChainObj, String>, TableCell<ICFBamChainObj, String>>() {
                @Override
                public TableCell<ICFBamChainObj, String> call(TableColumn<ICFBamChainObj, String> arg) {
                    return new CFStringTableCell<ICFBamChainObj>();
                }
            });
    dataTable.getColumns().add(tableColumnSuffix);
    tableColumnDefaultVisibility = new TableColumn<ICFBamChainObj, Boolean>("Default Visibility");
    tableColumnDefaultVisibility.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamChainObj, Boolean>, ObservableValue<Boolean>>() {
                public ObservableValue<Boolean> call(CellDataFeatures<ICFBamChainObj, Boolean> p) {
                    ICFBamChainObj 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<ICFBamChainObj, Boolean>, TableCell<ICFBamChainObj, Boolean>>() {
                @Override
                public TableCell<ICFBamChainObj, Boolean> call(TableColumn<ICFBamChainObj, Boolean> arg) {
                    return new CFBoolTableCell<ICFBamChainObj>();
                }
            });
    dataTable.getColumns().add(tableColumnDefaultVisibility);
    tableColumnLookupDefSchema = new TableColumn<ICFBamChainObj, ICFBamSchemaDefObj>(
            "Defining Schema Definition");
    tableColumnLookupDefSchema.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamChainObj, ICFBamSchemaDefObj>, ObservableValue<ICFBamSchemaDefObj>>() {
                public ObservableValue<ICFBamSchemaDefObj> call(
                        CellDataFeatures<ICFBamChainObj, ICFBamSchemaDefObj> p) {
                    ICFBamChainObj 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<ICFBamChainObj, ICFBamSchemaDefObj>, TableCell<ICFBamChainObj, ICFBamSchemaDefObj>>() {
                @Override
                public TableCell<ICFBamChainObj, ICFBamSchemaDefObj> call(
                        TableColumn<ICFBamChainObj, ICFBamSchemaDefObj> arg) {
                    return new CFReferenceTableCell<ICFBamChainObj, ICFBamSchemaDefObj>();
                }
            });
    dataTable.getColumns().add(tableColumnLookupDefSchema);
    tableColumnLookupPrevRel = new TableColumn<ICFBamChainObj, ICFBamRelationObj>("Previous Relation");
    tableColumnLookupPrevRel.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamChainObj, ICFBamRelationObj>, ObservableValue<ICFBamRelationObj>>() {
                public ObservableValue<ICFBamRelationObj> call(
                        CellDataFeatures<ICFBamChainObj, ICFBamRelationObj> p) {
                    ICFBamChainObj obj = p.getValue();
                    if (obj == null) {
                        return (null);
                    } else {
                        ICFBamRelationObj ref = obj.getRequiredLookupPrevRel();
                        ReadOnlyObjectWrapper<ICFBamRelationObj> observable = new ReadOnlyObjectWrapper<ICFBamRelationObj>();
                        observable.setValue(ref);
                        return (observable);
                    }
                }
            });
    tableColumnLookupPrevRel.setCellFactory(
            new Callback<TableColumn<ICFBamChainObj, ICFBamRelationObj>, TableCell<ICFBamChainObj, ICFBamRelationObj>>() {
                @Override
                public TableCell<ICFBamChainObj, ICFBamRelationObj> call(
                        TableColumn<ICFBamChainObj, ICFBamRelationObj> arg) {
                    return new CFReferenceTableCell<ICFBamChainObj, ICFBamRelationObj>();
                }
            });
    dataTable.getColumns().add(tableColumnLookupPrevRel);
    tableColumnLookupNextRel = new TableColumn<ICFBamChainObj, ICFBamRelationObj>("Next Relation");
    tableColumnLookupNextRel.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamChainObj, ICFBamRelationObj>, ObservableValue<ICFBamRelationObj>>() {
                public ObservableValue<ICFBamRelationObj> call(
                        CellDataFeatures<ICFBamChainObj, ICFBamRelationObj> p) {
                    ICFBamChainObj obj = p.getValue();
                    if (obj == null) {
                        return (null);
                    } else {
                        ICFBamRelationObj ref = obj.getRequiredLookupNextRel();
                        ReadOnlyObjectWrapper<ICFBamRelationObj> observable = new ReadOnlyObjectWrapper<ICFBamRelationObj>();
                        observable.setValue(ref);
                        return (observable);
                    }
                }
            });
    tableColumnLookupNextRel.setCellFactory(
            new Callback<TableColumn<ICFBamChainObj, ICFBamRelationObj>, TableCell<ICFBamChainObj, ICFBamRelationObj>>() {
                @Override
                public TableCell<ICFBamChainObj, ICFBamRelationObj> call(
                        TableColumn<ICFBamChainObj, ICFBamRelationObj> arg) {
                    return new CFReferenceTableCell<ICFBamChainObj, ICFBamRelationObj>();
                }
            });
    dataTable.getColumns().add(tableColumnLookupNextRel);
    dataTable.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<ICFBamChainObj>() {
        @Override
        public void changed(ObservableValue<? extends ICFBamChainObj> observable, ICFBamChainObj oldValue,
                ICFBamChainObj 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.choseChain(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");
                }
                ICFBamChainObj selectedInstance = getJavaFXFocusAsChain();
                invokeWhenChosen.choseChain(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.CFBamJavaFXIndexColListPane.java

public CFBamJavaFXIndexColListPane(ICFFormManager formManager, ICFBamJavaFXSchema argSchema,
        ICFBamIndexObj argContainer, ICFBamIndexColObj argFocus,
        Collection<ICFBamIndexColObj> argDataCollection, ICFRefreshCallback refreshCallback,
        boolean sortByChain) {
    super();//from ww w .  ja  v a  2s.  c  o  m
    final String S_ProcName = "construct-schema-focus";
    if (formManager == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 1,
                "formManager");
    }
    cfFormManager = formManager;
    if (argSchema == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 2,
                "argSchema");
    }
    // argFocus is optional; focus may be set later during execution as
    // conditions of the runtime change.
    javafxSchema = argSchema;
    javaFXFocus = argFocus;
    javafxContainer = argContainer;
    javafxRefreshCallback = refreshCallback;
    javafxSortByChain = sortByChain;
    setJavaFXDataCollection(argDataCollection);
    dataTable = new TableView<ICFBamIndexColObj>();
    tableColumnId = new TableColumn<ICFBamIndexColObj, Long>("Id");
    tableColumnId.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamIndexColObj, Long>, ObservableValue<Long>>() {
                public ObservableValue<Long> call(CellDataFeatures<ICFBamIndexColObj, Long> p) {
                    ICFBamIndexColObj 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<ICFBamIndexColObj, Long>, TableCell<ICFBamIndexColObj, Long>>() {
                @Override
                public TableCell<ICFBamIndexColObj, Long> call(TableColumn<ICFBamIndexColObj, Long> arg) {
                    return new CFInt64TableCell<ICFBamIndexColObj>();
                }
            });
    dataTable.getColumns().add(tableColumnId);
    tableColumnName = new TableColumn<ICFBamIndexColObj, String>("Name");
    tableColumnName.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamIndexColObj, String>, ObservableValue<String>>() {
                public ObservableValue<String> call(CellDataFeatures<ICFBamIndexColObj, String> p) {
                    ICFBamIndexColObj 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<ICFBamIndexColObj, String>, TableCell<ICFBamIndexColObj, String>>() {
                @Override
                public TableCell<ICFBamIndexColObj, String> call(TableColumn<ICFBamIndexColObj, String> arg) {
                    return new CFStringTableCell<ICFBamIndexColObj>();
                }
            });
    dataTable.getColumns().add(tableColumnName);
    tableColumnShortName = new TableColumn<ICFBamIndexColObj, String>("Short Name");
    tableColumnShortName.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamIndexColObj, String>, ObservableValue<String>>() {
                public ObservableValue<String> call(CellDataFeatures<ICFBamIndexColObj, String> p) {
                    ICFBamIndexColObj 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<ICFBamIndexColObj, String>, TableCell<ICFBamIndexColObj, String>>() {
                @Override
                public TableCell<ICFBamIndexColObj, String> call(TableColumn<ICFBamIndexColObj, String> arg) {
                    return new CFStringTableCell<ICFBamIndexColObj>();
                }
            });
    dataTable.getColumns().add(tableColumnShortName);
    tableColumnLabel = new TableColumn<ICFBamIndexColObj, String>("Label");
    tableColumnLabel.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamIndexColObj, String>, ObservableValue<String>>() {
                public ObservableValue<String> call(CellDataFeatures<ICFBamIndexColObj, String> p) {
                    ICFBamIndexColObj 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<ICFBamIndexColObj, String>, TableCell<ICFBamIndexColObj, String>>() {
                @Override
                public TableCell<ICFBamIndexColObj, String> call(TableColumn<ICFBamIndexColObj, String> arg) {
                    return new CFStringTableCell<ICFBamIndexColObj>();
                }
            });
    dataTable.getColumns().add(tableColumnLabel);
    tableColumnShortDescription = new TableColumn<ICFBamIndexColObj, String>("Short Description");
    tableColumnShortDescription.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamIndexColObj, String>, ObservableValue<String>>() {
                public ObservableValue<String> call(CellDataFeatures<ICFBamIndexColObj, String> p) {
                    ICFBamIndexColObj 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<ICFBamIndexColObj, String>, TableCell<ICFBamIndexColObj, String>>() {
                @Override
                public TableCell<ICFBamIndexColObj, String> call(TableColumn<ICFBamIndexColObj, String> arg) {
                    return new CFStringTableCell<ICFBamIndexColObj>();
                }
            });
    dataTable.getColumns().add(tableColumnShortDescription);
    tableColumnDescription = new TableColumn<ICFBamIndexColObj, String>("Description");
    tableColumnDescription.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamIndexColObj, String>, ObservableValue<String>>() {
                public ObservableValue<String> call(CellDataFeatures<ICFBamIndexColObj, String> p) {
                    ICFBamIndexColObj 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<ICFBamIndexColObj, String>, TableCell<ICFBamIndexColObj, String>>() {
                @Override
                public TableCell<ICFBamIndexColObj, String> call(TableColumn<ICFBamIndexColObj, String> arg) {
                    return new CFStringTableCell<ICFBamIndexColObj>();
                }
            });
    dataTable.getColumns().add(tableColumnDescription);
    tableColumnIsAscending = new TableColumn<ICFBamIndexColObj, Boolean>("IsAscending");
    tableColumnIsAscending.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamIndexColObj, Boolean>, ObservableValue<Boolean>>() {
                public ObservableValue<Boolean> call(CellDataFeatures<ICFBamIndexColObj, Boolean> p) {
                    ICFBamIndexColObj obj = p.getValue();
                    if (obj == null) {
                        return (null);
                    } else {
                        boolean value = obj.getRequiredIsAscending();
                        Boolean wrapped = new Boolean(value);
                        ReadOnlyObjectWrapper<Boolean> observable = new ReadOnlyObjectWrapper<Boolean>();
                        observable.setValue(wrapped);
                        return (observable);
                    }
                }
            });
    tableColumnIsAscending.setCellFactory(
            new Callback<TableColumn<ICFBamIndexColObj, Boolean>, TableCell<ICFBamIndexColObj, Boolean>>() {
                @Override
                public TableCell<ICFBamIndexColObj, Boolean> call(TableColumn<ICFBamIndexColObj, Boolean> arg) {
                    return new CFBoolTableCell<ICFBamIndexColObj>();
                }
            });
    dataTable.getColumns().add(tableColumnIsAscending);
    tableColumnDefaultVisibility = new TableColumn<ICFBamIndexColObj, Boolean>("Default Visibility");
    tableColumnDefaultVisibility.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamIndexColObj, Boolean>, ObservableValue<Boolean>>() {
                public ObservableValue<Boolean> call(CellDataFeatures<ICFBamIndexColObj, Boolean> p) {
                    ICFBamIndexColObj 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<ICFBamIndexColObj, Boolean>, TableCell<ICFBamIndexColObj, Boolean>>() {
                @Override
                public TableCell<ICFBamIndexColObj, Boolean> call(TableColumn<ICFBamIndexColObj, Boolean> arg) {
                    return new CFBoolTableCell<ICFBamIndexColObj>();
                }
            });
    dataTable.getColumns().add(tableColumnDefaultVisibility);
    tableColumnLookupDefSchema = new TableColumn<ICFBamIndexColObj, ICFBamSchemaDefObj>(
            "Defining Schema Definition");
    tableColumnLookupDefSchema.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamIndexColObj, ICFBamSchemaDefObj>, ObservableValue<ICFBamSchemaDefObj>>() {
                public ObservableValue<ICFBamSchemaDefObj> call(
                        CellDataFeatures<ICFBamIndexColObj, ICFBamSchemaDefObj> p) {
                    ICFBamIndexColObj 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<ICFBamIndexColObj, ICFBamSchemaDefObj>, TableCell<ICFBamIndexColObj, ICFBamSchemaDefObj>>() {
                @Override
                public TableCell<ICFBamIndexColObj, ICFBamSchemaDefObj> call(
                        TableColumn<ICFBamIndexColObj, ICFBamSchemaDefObj> arg) {
                    return new CFReferenceTableCell<ICFBamIndexColObj, ICFBamSchemaDefObj>();
                }
            });
    dataTable.getColumns().add(tableColumnLookupDefSchema);
    tableColumnLookupColumn = new TableColumn<ICFBamIndexColObj, ICFBamValueObj>("Column");
    tableColumnLookupColumn.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamIndexColObj, ICFBamValueObj>, ObservableValue<ICFBamValueObj>>() {
                public ObservableValue<ICFBamValueObj> call(
                        CellDataFeatures<ICFBamIndexColObj, ICFBamValueObj> p) {
                    ICFBamIndexColObj obj = p.getValue();
                    if (obj == null) {
                        return (null);
                    } else {
                        ICFBamValueObj ref = obj.getRequiredLookupColumn();
                        ReadOnlyObjectWrapper<ICFBamValueObj> observable = new ReadOnlyObjectWrapper<ICFBamValueObj>();
                        observable.setValue(ref);
                        return (observable);
                    }
                }
            });
    tableColumnLookupColumn.setCellFactory(
            new Callback<TableColumn<ICFBamIndexColObj, ICFBamValueObj>, TableCell<ICFBamIndexColObj, ICFBamValueObj>>() {
                @Override
                public TableCell<ICFBamIndexColObj, ICFBamValueObj> call(
                        TableColumn<ICFBamIndexColObj, ICFBamValueObj> arg) {
                    return new CFReferenceTableCell<ICFBamIndexColObj, ICFBamValueObj>();
                }
            });
    dataTable.getColumns().add(tableColumnLookupColumn);
    dataTable.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<ICFBamIndexColObj>() {
        @Override
        public void changed(ObservableValue<? extends ICFBamIndexColObj> observable, ICFBamIndexColObj oldValue,
                ICFBamIndexColObj newValue) {
            setJavaFXFocus(newValue);
        }
    });

    scrollMenu = new ScrollPane();
    scrollMenu.setVbarPolicy(ScrollBarPolicy.NEVER);
    scrollMenu.setHbarPolicy(ScrollBarPolicy.AS_NEEDED);
    scrollMenu.setFitToHeight(true);
    scrollMenu.setContent(getPanelHBoxMenu());

    setTop(scrollMenu);
    setCenter(dataTable);
    javafxIsInitializing = false;
    if (observableListOfIndexCol != null) {
        dataTable.setItems(observableListOfIndexCol);
    }
    adjustListButtons();
}

From source file:eu.ggnet.dwoss.report.entity.ReportLine.java

public DoubleProperty purchasePriceProperty() {
    if (purchasePriceProperty == null) {
        purchasePriceProperty = new SimpleDoubleProperty(purchasePrice);
        purchasePriceProperty.addListener(new ChangeListener<Number>() {

            @Override/*from  w  w w.  j a va  2  s  .  c o  m*/
            public void changed(ObservableValue<? extends Number> ov, Number oldValue, Number newValue) {
                purchasePrice = newValue.doubleValue();
            }
        });
    }
    return purchasePriceProperty;
}

From source file:net.sourceforge.msscodefactory.cfbam.v2_7.CFBamJavaFX.CFBamJavaFXAtomPickerPane.java

public CFBamJavaFXAtomPickerPane(ICFFormManager formManager, ICFBamJavaFXSchema argSchema,
        ICFBamAtomObj argFocus, ICFBamScopeObj argContainer, Collection<ICFBamAtomObj> argDataCollection,
        ICFBamJavaFXAtomChosen whenChosen) {
    super();// w  w w.  j av 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<ICFBamAtomObj>();
    tableColumnObjKind = new TableColumn<ICFBamAtomObj, String>("Class Code");
    tableColumnObjKind.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamAtomObj, String>, ObservableValue<String>>() {
                @Override
                public ObservableValue<String> call(CellDataFeatures<ICFBamAtomObj, String> p) {
                    ICFBamAtomObj obj = p.getValue();
                    if (obj == null) {
                        return (null);
                    } else {
                        String classCode = obj.getClassCode();
                        ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>();
                        observable.setValue(classCode);
                        return (observable);
                    }
                }
            });
    tableColumnObjKind.setCellFactory(
            new Callback<TableColumn<ICFBamAtomObj, String>, TableCell<ICFBamAtomObj, String>>() {
                @Override
                public TableCell<ICFBamAtomObj, String> call(TableColumn<ICFBamAtomObj, String> arg) {
                    return new CFStringTableCell<ICFBamAtomObj>();
                }
            });
    dataTable.getColumns().add(tableColumnObjKind);
    tableColumnId = new TableColumn<ICFBamAtomObj, Long>("Id");
    tableColumnId
            .setCellValueFactory(new Callback<CellDataFeatures<ICFBamAtomObj, Long>, ObservableValue<Long>>() {
                public ObservableValue<Long> call(CellDataFeatures<ICFBamAtomObj, 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<ICFBamAtomObj, Long>, TableCell<ICFBamAtomObj, Long>>() {
                @Override
                public TableCell<ICFBamAtomObj, Long> call(TableColumn<ICFBamAtomObj, Long> arg) {
                    return new CFInt64TableCell<ICFBamAtomObj>();
                }
            });
    dataTable.getColumns().add(tableColumnId);
    tableColumnName = new TableColumn<ICFBamAtomObj, String>("Name");
    tableColumnName.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamAtomObj, String>, ObservableValue<String>>() {
                public ObservableValue<String> call(CellDataFeatures<ICFBamAtomObj, 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<ICFBamAtomObj, String>, TableCell<ICFBamAtomObj, String>>() {
                @Override
                public TableCell<ICFBamAtomObj, String> call(TableColumn<ICFBamAtomObj, String> arg) {
                    return new CFStringTableCell<ICFBamAtomObj>();
                }
            });
    dataTable.getColumns().add(tableColumnName);
    tableColumnShortName = new TableColumn<ICFBamAtomObj, String>("Short Name");
    tableColumnShortName.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamAtomObj, String>, ObservableValue<String>>() {
                public ObservableValue<String> call(CellDataFeatures<ICFBamAtomObj, 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<ICFBamAtomObj, String>, TableCell<ICFBamAtomObj, String>>() {
                @Override
                public TableCell<ICFBamAtomObj, String> call(TableColumn<ICFBamAtomObj, String> arg) {
                    return new CFStringTableCell<ICFBamAtomObj>();
                }
            });
    dataTable.getColumns().add(tableColumnShortName);
    tableColumnLabel = new TableColumn<ICFBamAtomObj, String>("Label");
    tableColumnLabel.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamAtomObj, String>, ObservableValue<String>>() {
                public ObservableValue<String> call(CellDataFeatures<ICFBamAtomObj, 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<ICFBamAtomObj, String>, TableCell<ICFBamAtomObj, String>>() {
                @Override
                public TableCell<ICFBamAtomObj, String> call(TableColumn<ICFBamAtomObj, String> arg) {
                    return new CFStringTableCell<ICFBamAtomObj>();
                }
            });
    dataTable.getColumns().add(tableColumnLabel);
    tableColumnShortDescription = new TableColumn<ICFBamAtomObj, String>("Short Description");
    tableColumnShortDescription.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamAtomObj, String>, ObservableValue<String>>() {
                public ObservableValue<String> call(CellDataFeatures<ICFBamAtomObj, 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<ICFBamAtomObj, String>, TableCell<ICFBamAtomObj, String>>() {
                @Override
                public TableCell<ICFBamAtomObj, String> call(TableColumn<ICFBamAtomObj, String> arg) {
                    return new CFStringTableCell<ICFBamAtomObj>();
                }
            });
    dataTable.getColumns().add(tableColumnShortDescription);
    tableColumnDescription = new TableColumn<ICFBamAtomObj, String>("Description");
    tableColumnDescription.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamAtomObj, String>, ObservableValue<String>>() {
                public ObservableValue<String> call(CellDataFeatures<ICFBamAtomObj, 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<ICFBamAtomObj, String>, TableCell<ICFBamAtomObj, String>>() {
                @Override
                public TableCell<ICFBamAtomObj, String> call(TableColumn<ICFBamAtomObj, String> arg) {
                    return new CFStringTableCell<ICFBamAtomObj>();
                }
            });
    dataTable.getColumns().add(tableColumnDescription);
    tableColumnIsNullable = new TableColumn<ICFBamAtomObj, Boolean>("Is Nullable");
    tableColumnIsNullable.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamAtomObj, Boolean>, ObservableValue<Boolean>>() {
                public ObservableValue<Boolean> call(CellDataFeatures<ICFBamAtomObj, 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<ICFBamAtomObj, Boolean>, TableCell<ICFBamAtomObj, Boolean>>() {
                @Override
                public TableCell<ICFBamAtomObj, Boolean> call(TableColumn<ICFBamAtomObj, Boolean> arg) {
                    return new CFBoolTableCell<ICFBamAtomObj>();
                }
            });
    dataTable.getColumns().add(tableColumnIsNullable);
    tableColumnGenerateId = new TableColumn<ICFBamAtomObj, Boolean>("Generate Id");
    tableColumnGenerateId.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamAtomObj, Boolean>, ObservableValue<Boolean>>() {
                public ObservableValue<Boolean> call(CellDataFeatures<ICFBamAtomObj, 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<ICFBamAtomObj, Boolean>, TableCell<ICFBamAtomObj, Boolean>>() {
                @Override
                public TableCell<ICFBamAtomObj, Boolean> call(TableColumn<ICFBamAtomObj, Boolean> arg) {
                    return new CFBoolTableCell<ICFBamAtomObj>();
                }
            });
    dataTable.getColumns().add(tableColumnGenerateId);
    tableColumnDefaultVisibility = new TableColumn<ICFBamAtomObj, Boolean>("Default Visibility");
    tableColumnDefaultVisibility.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamAtomObj, Boolean>, ObservableValue<Boolean>>() {
                public ObservableValue<Boolean> call(CellDataFeatures<ICFBamAtomObj, 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<ICFBamAtomObj, Boolean>, TableCell<ICFBamAtomObj, Boolean>>() {
                @Override
                public TableCell<ICFBamAtomObj, Boolean> call(TableColumn<ICFBamAtomObj, Boolean> arg) {
                    return new CFBoolTableCell<ICFBamAtomObj>();
                }
            });
    dataTable.getColumns().add(tableColumnDefaultVisibility);
    tableColumnDbName = new TableColumn<ICFBamAtomObj, String>("Db Name");
    tableColumnDbName.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamAtomObj, String>, ObservableValue<String>>() {
                public ObservableValue<String> call(CellDataFeatures<ICFBamAtomObj, 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<ICFBamAtomObj, String>, TableCell<ICFBamAtomObj, String>>() {
                @Override
                public TableCell<ICFBamAtomObj, String> call(TableColumn<ICFBamAtomObj, String> arg) {
                    return new CFStringTableCell<ICFBamAtomObj>();
                }
            });
    dataTable.getColumns().add(tableColumnDbName);
    tableColumnLookupDefSchema = new TableColumn<ICFBamAtomObj, ICFBamSchemaDefObj>(
            "Defining Schema Definition");
    tableColumnLookupDefSchema.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamAtomObj, ICFBamSchemaDefObj>, ObservableValue<ICFBamSchemaDefObj>>() {
                public ObservableValue<ICFBamSchemaDefObj> call(
                        CellDataFeatures<ICFBamAtomObj, ICFBamSchemaDefObj> p) {
                    ICFBamAtomObj 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<ICFBamAtomObj, ICFBamSchemaDefObj>, TableCell<ICFBamAtomObj, ICFBamSchemaDefObj>>() {
                @Override
                public TableCell<ICFBamAtomObj, ICFBamSchemaDefObj> call(
                        TableColumn<ICFBamAtomObj, ICFBamSchemaDefObj> arg) {
                    return new CFReferenceTableCell<ICFBamAtomObj, ICFBamSchemaDefObj>();
                }
            });
    dataTable.getColumns().add(tableColumnLookupDefSchema);
    dataTable.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<ICFBamAtomObj>() {
        @Override
        public void changed(ObservableValue<? extends ICFBamAtomObj> observable, ICFBamAtomObj oldValue,
                ICFBamAtomObj 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.choseAtom(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");
                }
                ICFBamAtomObj selectedInstance = getJavaFXFocusAsAtom();
                invokeWhenChosen.choseAtom(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.CFBamJavaFXRelationColListPane.java

public CFBamJavaFXRelationColListPane(ICFFormManager formManager, ICFBamJavaFXSchema argSchema,
        ICFBamRelationObj argContainer, ICFBamRelationColObj argFocus,
        Collection<ICFBamRelationColObj> argDataCollection, ICFRefreshCallback refreshCallback,
        boolean sortByChain) {
    super();//from   w w w.  jav  a 2  s  .c o m
    final String S_ProcName = "construct-schema-focus";
    if (formManager == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 1,
                "formManager");
    }
    cfFormManager = formManager;
    if (argSchema == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 2,
                "argSchema");
    }
    // argFocus is optional; focus may be set later during execution as
    // conditions of the runtime change.
    javafxSchema = argSchema;
    javaFXFocus = argFocus;
    javafxContainer = argContainer;
    javafxRefreshCallback = refreshCallback;
    javafxSortByChain = sortByChain;
    setJavaFXDataCollection(argDataCollection);
    dataTable = new TableView<ICFBamRelationColObj>();
    tableColumnId = new TableColumn<ICFBamRelationColObj, Long>("Id");
    tableColumnId.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamRelationColObj, Long>, ObservableValue<Long>>() {
                public ObservableValue<Long> call(CellDataFeatures<ICFBamRelationColObj, Long> p) {
                    ICFBamRelationColObj 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<ICFBamRelationColObj, Long>, TableCell<ICFBamRelationColObj, Long>>() {
                @Override
                public TableCell<ICFBamRelationColObj, Long> call(TableColumn<ICFBamRelationColObj, Long> arg) {
                    return new CFInt64TableCell<ICFBamRelationColObj>();
                }
            });
    dataTable.getColumns().add(tableColumnId);
    tableColumnName = new TableColumn<ICFBamRelationColObj, String>("Name");
    tableColumnName.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamRelationColObj, String>, ObservableValue<String>>() {
                public ObservableValue<String> call(CellDataFeatures<ICFBamRelationColObj, String> p) {
                    ICFBamRelationColObj 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<ICFBamRelationColObj, String>, TableCell<ICFBamRelationColObj, String>>() {
                @Override
                public TableCell<ICFBamRelationColObj, String> call(
                        TableColumn<ICFBamRelationColObj, String> arg) {
                    return new CFStringTableCell<ICFBamRelationColObj>();
                }
            });
    dataTable.getColumns().add(tableColumnName);
    tableColumnShortName = new TableColumn<ICFBamRelationColObj, String>("Short Name");
    tableColumnShortName.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamRelationColObj, String>, ObservableValue<String>>() {
                public ObservableValue<String> call(CellDataFeatures<ICFBamRelationColObj, String> p) {
                    ICFBamRelationColObj 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<ICFBamRelationColObj, String>, TableCell<ICFBamRelationColObj, String>>() {
                @Override
                public TableCell<ICFBamRelationColObj, String> call(
                        TableColumn<ICFBamRelationColObj, String> arg) {
                    return new CFStringTableCell<ICFBamRelationColObj>();
                }
            });
    dataTable.getColumns().add(tableColumnShortName);
    tableColumnLabel = new TableColumn<ICFBamRelationColObj, String>("Label");
    tableColumnLabel.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamRelationColObj, String>, ObservableValue<String>>() {
                public ObservableValue<String> call(CellDataFeatures<ICFBamRelationColObj, String> p) {
                    ICFBamRelationColObj 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<ICFBamRelationColObj, String>, TableCell<ICFBamRelationColObj, String>>() {
                @Override
                public TableCell<ICFBamRelationColObj, String> call(
                        TableColumn<ICFBamRelationColObj, String> arg) {
                    return new CFStringTableCell<ICFBamRelationColObj>();
                }
            });
    dataTable.getColumns().add(tableColumnLabel);
    tableColumnShortDescription = new TableColumn<ICFBamRelationColObj, String>("Short Description");
    tableColumnShortDescription.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamRelationColObj, String>, ObservableValue<String>>() {
                public ObservableValue<String> call(CellDataFeatures<ICFBamRelationColObj, String> p) {
                    ICFBamRelationColObj 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<ICFBamRelationColObj, String>, TableCell<ICFBamRelationColObj, String>>() {
                @Override
                public TableCell<ICFBamRelationColObj, String> call(
                        TableColumn<ICFBamRelationColObj, String> arg) {
                    return new CFStringTableCell<ICFBamRelationColObj>();
                }
            });
    dataTable.getColumns().add(tableColumnShortDescription);
    tableColumnDescription = new TableColumn<ICFBamRelationColObj, String>("Description");
    tableColumnDescription.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamRelationColObj, String>, ObservableValue<String>>() {
                public ObservableValue<String> call(CellDataFeatures<ICFBamRelationColObj, String> p) {
                    ICFBamRelationColObj 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<ICFBamRelationColObj, String>, TableCell<ICFBamRelationColObj, String>>() {
                @Override
                public TableCell<ICFBamRelationColObj, String> call(
                        TableColumn<ICFBamRelationColObj, String> arg) {
                    return new CFStringTableCell<ICFBamRelationColObj>();
                }
            });
    dataTable.getColumns().add(tableColumnDescription);
    tableColumnDefaultVisibility = new TableColumn<ICFBamRelationColObj, Boolean>("Default Visibility");
    tableColumnDefaultVisibility.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamRelationColObj, Boolean>, ObservableValue<Boolean>>() {
                public ObservableValue<Boolean> call(CellDataFeatures<ICFBamRelationColObj, Boolean> p) {
                    ICFBamRelationColObj 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<ICFBamRelationColObj, Boolean>, TableCell<ICFBamRelationColObj, Boolean>>() {
                @Override
                public TableCell<ICFBamRelationColObj, Boolean> call(
                        TableColumn<ICFBamRelationColObj, Boolean> arg) {
                    return new CFBoolTableCell<ICFBamRelationColObj>();
                }
            });
    dataTable.getColumns().add(tableColumnDefaultVisibility);
    tableColumnLookupDefSchema = new TableColumn<ICFBamRelationColObj, ICFBamSchemaDefObj>(
            "Defining Schema Definition");
    tableColumnLookupDefSchema.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamRelationColObj, ICFBamSchemaDefObj>, ObservableValue<ICFBamSchemaDefObj>>() {
                public ObservableValue<ICFBamSchemaDefObj> call(
                        CellDataFeatures<ICFBamRelationColObj, ICFBamSchemaDefObj> p) {
                    ICFBamRelationColObj 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<ICFBamRelationColObj, ICFBamSchemaDefObj>, TableCell<ICFBamRelationColObj, ICFBamSchemaDefObj>>() {
                @Override
                public TableCell<ICFBamRelationColObj, ICFBamSchemaDefObj> call(
                        TableColumn<ICFBamRelationColObj, ICFBamSchemaDefObj> arg) {
                    return new CFReferenceTableCell<ICFBamRelationColObj, ICFBamSchemaDefObj>();
                }
            });
    dataTable.getColumns().add(tableColumnLookupDefSchema);
    tableColumnLookupFromCol = new TableColumn<ICFBamRelationColObj, ICFBamIndexColObj>("From Column");
    tableColumnLookupFromCol.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamRelationColObj, ICFBamIndexColObj>, ObservableValue<ICFBamIndexColObj>>() {
                public ObservableValue<ICFBamIndexColObj> call(
                        CellDataFeatures<ICFBamRelationColObj, ICFBamIndexColObj> p) {
                    ICFBamRelationColObj obj = p.getValue();
                    if (obj == null) {
                        return (null);
                    } else {
                        ICFBamIndexColObj ref = obj.getRequiredLookupFromCol();
                        ReadOnlyObjectWrapper<ICFBamIndexColObj> observable = new ReadOnlyObjectWrapper<ICFBamIndexColObj>();
                        observable.setValue(ref);
                        return (observable);
                    }
                }
            });
    tableColumnLookupFromCol.setCellFactory(
            new Callback<TableColumn<ICFBamRelationColObj, ICFBamIndexColObj>, TableCell<ICFBamRelationColObj, ICFBamIndexColObj>>() {
                @Override
                public TableCell<ICFBamRelationColObj, ICFBamIndexColObj> call(
                        TableColumn<ICFBamRelationColObj, ICFBamIndexColObj> arg) {
                    return new CFReferenceTableCell<ICFBamRelationColObj, ICFBamIndexColObj>();
                }
            });
    dataTable.getColumns().add(tableColumnLookupFromCol);
    tableColumnLookupToCol = new TableColumn<ICFBamRelationColObj, ICFBamIndexColObj>("To Column");
    tableColumnLookupToCol.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamRelationColObj, ICFBamIndexColObj>, ObservableValue<ICFBamIndexColObj>>() {
                public ObservableValue<ICFBamIndexColObj> call(
                        CellDataFeatures<ICFBamRelationColObj, ICFBamIndexColObj> p) {
                    ICFBamRelationColObj obj = p.getValue();
                    if (obj == null) {
                        return (null);
                    } else {
                        ICFBamIndexColObj ref = obj.getRequiredLookupToCol();
                        ReadOnlyObjectWrapper<ICFBamIndexColObj> observable = new ReadOnlyObjectWrapper<ICFBamIndexColObj>();
                        observable.setValue(ref);
                        return (observable);
                    }
                }
            });
    tableColumnLookupToCol.setCellFactory(
            new Callback<TableColumn<ICFBamRelationColObj, ICFBamIndexColObj>, TableCell<ICFBamRelationColObj, ICFBamIndexColObj>>() {
                @Override
                public TableCell<ICFBamRelationColObj, ICFBamIndexColObj> call(
                        TableColumn<ICFBamRelationColObj, ICFBamIndexColObj> arg) {
                    return new CFReferenceTableCell<ICFBamRelationColObj, ICFBamIndexColObj>();
                }
            });
    dataTable.getColumns().add(tableColumnLookupToCol);
    dataTable.getSelectionModel().selectedItemProperty()
            .addListener(new ChangeListener<ICFBamRelationColObj>() {
                @Override
                public void changed(ObservableValue<? extends ICFBamRelationColObj> observable,
                        ICFBamRelationColObj oldValue, ICFBamRelationColObj newValue) {
                    setJavaFXFocus(newValue);
                }
            });

    scrollMenu = new ScrollPane();
    scrollMenu.setVbarPolicy(ScrollBarPolicy.NEVER);
    scrollMenu.setHbarPolicy(ScrollBarPolicy.AS_NEEDED);
    scrollMenu.setFitToHeight(true);
    scrollMenu.setContent(getPanelHBoxMenu());

    setTop(scrollMenu);
    setCenter(dataTable);
    javafxIsInitializing = false;
    if (observableListOfRelationCol != null) {
        dataTable.setItems(observableListOfRelationCol);
    }
    adjustListButtons();
}

From source file:net.sourceforge.msscodefactory.cfbam.v2_7.CFBamJavaFX.CFBamJavaFXIndexPickerPane.java

public CFBamJavaFXIndexPickerPane(ICFFormManager formManager, ICFBamJavaFXSchema argSchema,
        ICFBamIndexObj argFocus, ICFBamTableObj argContainer, Collection<ICFBamIndexObj> argDataCollection,
        ICFBamJavaFXIndexChosen whenChosen) {
    super();/*w w  w .  j av a  2s .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<ICFBamIndexObj>();
    tableColumnId = new TableColumn<ICFBamIndexObj, Long>("Id");
    tableColumnId
            .setCellValueFactory(new Callback<CellDataFeatures<ICFBamIndexObj, Long>, ObservableValue<Long>>() {
                public ObservableValue<Long> call(CellDataFeatures<ICFBamIndexObj, Long> p) {
                    ICFBamScopeObj 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<ICFBamIndexObj, Long>, TableCell<ICFBamIndexObj, Long>>() {
                @Override
                public TableCell<ICFBamIndexObj, Long> call(TableColumn<ICFBamIndexObj, Long> arg) {
                    return new CFInt64TableCell<ICFBamIndexObj>();
                }
            });
    dataTable.getColumns().add(tableColumnId);
    tableColumnName = new TableColumn<ICFBamIndexObj, String>("Name");
    tableColumnName.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamIndexObj, String>, ObservableValue<String>>() {
                public ObservableValue<String> call(CellDataFeatures<ICFBamIndexObj, String> p) {
                    ICFBamIndexObj 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<ICFBamIndexObj, String>, TableCell<ICFBamIndexObj, String>>() {
                @Override
                public TableCell<ICFBamIndexObj, String> call(TableColumn<ICFBamIndexObj, String> arg) {
                    return new CFStringTableCell<ICFBamIndexObj>();
                }
            });
    dataTable.getColumns().add(tableColumnName);
    tableColumnShortName = new TableColumn<ICFBamIndexObj, String>("Short Name");
    tableColumnShortName.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamIndexObj, String>, ObservableValue<String>>() {
                public ObservableValue<String> call(CellDataFeatures<ICFBamIndexObj, String> p) {
                    ICFBamIndexObj 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<ICFBamIndexObj, String>, TableCell<ICFBamIndexObj, String>>() {
                @Override
                public TableCell<ICFBamIndexObj, String> call(TableColumn<ICFBamIndexObj, String> arg) {
                    return new CFStringTableCell<ICFBamIndexObj>();
                }
            });
    dataTable.getColumns().add(tableColumnShortName);
    tableColumnLabel = new TableColumn<ICFBamIndexObj, String>("Label");
    tableColumnLabel.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamIndexObj, String>, ObservableValue<String>>() {
                public ObservableValue<String> call(CellDataFeatures<ICFBamIndexObj, String> p) {
                    ICFBamIndexObj 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<ICFBamIndexObj, String>, TableCell<ICFBamIndexObj, String>>() {
                @Override
                public TableCell<ICFBamIndexObj, String> call(TableColumn<ICFBamIndexObj, String> arg) {
                    return new CFStringTableCell<ICFBamIndexObj>();
                }
            });
    dataTable.getColumns().add(tableColumnLabel);
    tableColumnShortDescription = new TableColumn<ICFBamIndexObj, String>("Short Description");
    tableColumnShortDescription.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamIndexObj, String>, ObservableValue<String>>() {
                public ObservableValue<String> call(CellDataFeatures<ICFBamIndexObj, String> p) {
                    ICFBamIndexObj 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<ICFBamIndexObj, String>, TableCell<ICFBamIndexObj, String>>() {
                @Override
                public TableCell<ICFBamIndexObj, String> call(TableColumn<ICFBamIndexObj, String> arg) {
                    return new CFStringTableCell<ICFBamIndexObj>();
                }
            });
    dataTable.getColumns().add(tableColumnShortDescription);
    tableColumnDescription = new TableColumn<ICFBamIndexObj, String>("Description");
    tableColumnDescription.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamIndexObj, String>, ObservableValue<String>>() {
                public ObservableValue<String> call(CellDataFeatures<ICFBamIndexObj, String> p) {
                    ICFBamIndexObj 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<ICFBamIndexObj, String>, TableCell<ICFBamIndexObj, String>>() {
                @Override
                public TableCell<ICFBamIndexObj, String> call(TableColumn<ICFBamIndexObj, String> arg) {
                    return new CFStringTableCell<ICFBamIndexObj>();
                }
            });
    dataTable.getColumns().add(tableColumnDescription);
    tableColumnDbName = new TableColumn<ICFBamIndexObj, String>("Db Name");
    tableColumnDbName.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamIndexObj, String>, ObservableValue<String>>() {
                public ObservableValue<String> call(CellDataFeatures<ICFBamIndexObj, String> p) {
                    ICFBamIndexObj 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<ICFBamIndexObj, String>, TableCell<ICFBamIndexObj, String>>() {
                @Override
                public TableCell<ICFBamIndexObj, String> call(TableColumn<ICFBamIndexObj, String> arg) {
                    return new CFStringTableCell<ICFBamIndexObj>();
                }
            });
    dataTable.getColumns().add(tableColumnDbName);
    tableColumnSuffix = new TableColumn<ICFBamIndexObj, String>("Suffix");
    tableColumnSuffix.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamIndexObj, String>, ObservableValue<String>>() {
                public ObservableValue<String> call(CellDataFeatures<ICFBamIndexObj, String> p) {
                    ICFBamIndexObj obj = p.getValue();
                    if (obj == null) {
                        return (null);
                    } else {
                        String value = obj.getOptionalSuffix();
                        ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>();
                        observable.setValue(value);
                        return (observable);
                    }
                }
            });
    tableColumnSuffix.setCellFactory(
            new Callback<TableColumn<ICFBamIndexObj, String>, TableCell<ICFBamIndexObj, String>>() {
                @Override
                public TableCell<ICFBamIndexObj, String> call(TableColumn<ICFBamIndexObj, String> arg) {
                    return new CFStringTableCell<ICFBamIndexObj>();
                }
            });
    dataTable.getColumns().add(tableColumnSuffix);
    tableColumnIsUnique = new TableColumn<ICFBamIndexObj, Boolean>("Is Unique");
    tableColumnIsUnique.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamIndexObj, Boolean>, ObservableValue<Boolean>>() {
                public ObservableValue<Boolean> call(CellDataFeatures<ICFBamIndexObj, Boolean> p) {
                    ICFBamIndexObj obj = p.getValue();
                    if (obj == null) {
                        return (null);
                    } else {
                        boolean value = obj.getRequiredIsUnique();
                        Boolean wrapped = new Boolean(value);
                        ReadOnlyObjectWrapper<Boolean> observable = new ReadOnlyObjectWrapper<Boolean>();
                        observable.setValue(wrapped);
                        return (observable);
                    }
                }
            });
    tableColumnIsUnique.setCellFactory(
            new Callback<TableColumn<ICFBamIndexObj, Boolean>, TableCell<ICFBamIndexObj, Boolean>>() {
                @Override
                public TableCell<ICFBamIndexObj, Boolean> call(TableColumn<ICFBamIndexObj, Boolean> arg) {
                    return new CFBoolTableCell<ICFBamIndexObj>();
                }
            });
    dataTable.getColumns().add(tableColumnIsUnique);
    tableColumnIsDbMapped = new TableColumn<ICFBamIndexObj, Boolean>("Is Db Mapped");
    tableColumnIsDbMapped.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamIndexObj, Boolean>, ObservableValue<Boolean>>() {
                public ObservableValue<Boolean> call(CellDataFeatures<ICFBamIndexObj, Boolean> p) {
                    ICFBamIndexObj obj = p.getValue();
                    if (obj == null) {
                        return (null);
                    } else {
                        boolean value = obj.getRequiredIsDbMapped();
                        Boolean wrapped = new Boolean(value);
                        ReadOnlyObjectWrapper<Boolean> observable = new ReadOnlyObjectWrapper<Boolean>();
                        observable.setValue(wrapped);
                        return (observable);
                    }
                }
            });
    tableColumnIsDbMapped.setCellFactory(
            new Callback<TableColumn<ICFBamIndexObj, Boolean>, TableCell<ICFBamIndexObj, Boolean>>() {
                @Override
                public TableCell<ICFBamIndexObj, Boolean> call(TableColumn<ICFBamIndexObj, Boolean> arg) {
                    return new CFBoolTableCell<ICFBamIndexObj>();
                }
            });
    dataTable.getColumns().add(tableColumnIsDbMapped);
    tableColumnDefaultVisibility = new TableColumn<ICFBamIndexObj, Boolean>("Default Visibility");
    tableColumnDefaultVisibility.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamIndexObj, Boolean>, ObservableValue<Boolean>>() {
                public ObservableValue<Boolean> call(CellDataFeatures<ICFBamIndexObj, Boolean> p) {
                    ICFBamIndexObj 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<ICFBamIndexObj, Boolean>, TableCell<ICFBamIndexObj, Boolean>>() {
                @Override
                public TableCell<ICFBamIndexObj, Boolean> call(TableColumn<ICFBamIndexObj, Boolean> arg) {
                    return new CFBoolTableCell<ICFBamIndexObj>();
                }
            });
    dataTable.getColumns().add(tableColumnDefaultVisibility);
    tableColumnLookupDefSchema = new TableColumn<ICFBamIndexObj, ICFBamSchemaDefObj>(
            "Defining Schema Definition");
    tableColumnLookupDefSchema.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamIndexObj, ICFBamSchemaDefObj>, ObservableValue<ICFBamSchemaDefObj>>() {
                public ObservableValue<ICFBamSchemaDefObj> call(
                        CellDataFeatures<ICFBamIndexObj, ICFBamSchemaDefObj> p) {
                    ICFBamIndexObj 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<ICFBamIndexObj, ICFBamSchemaDefObj>, TableCell<ICFBamIndexObj, ICFBamSchemaDefObj>>() {
                @Override
                public TableCell<ICFBamIndexObj, ICFBamSchemaDefObj> call(
                        TableColumn<ICFBamIndexObj, ICFBamSchemaDefObj> arg) {
                    return new CFReferenceTableCell<ICFBamIndexObj, ICFBamSchemaDefObj>();
                }
            });
    dataTable.getColumns().add(tableColumnLookupDefSchema);
    dataTable.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<ICFBamIndexObj>() {
        @Override
        public void changed(ObservableValue<? extends ICFBamIndexObj> observable, ICFBamIndexObj oldValue,
                ICFBamIndexObj 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.choseIndex(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");
                }
                ICFBamIndexObj selectedInstance = getJavaFXFocusAsIndex();
                invokeWhenChosen.choseIndex(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.cfbamcustom.v2_7.CFBamCustomEditor.CFBamCustomEditorRelationColListPane.java

public CFBamCustomEditorRelationColListPane(ICFFormManager formManager, ICFBamJavaFXSchema argSchema,
        ICFBamRelationObj argContainer, ICFBamRelationColObj argFocus,
        Collection<ICFBamRelationColObj> argDataCollection, ICFRefreshCallback refreshCallback,
        boolean sortByChain) {
    super();/*w  w  w  .j a  v a2  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");
    }
    // argFocus is optional; focus may be set later during execution as
    // conditions of the runtime change.
    javafxSchema = argSchema;
    javaFXFocus = argFocus;
    javafxContainer = argContainer;
    javafxRefreshCallback = refreshCallback;
    javafxSortByChain = sortByChain;
    setJavaFXDataCollection(argDataCollection);
    dataTable = new TableView<ICFBamRelationColObj>();
    tableColumnId = new TableColumn<ICFBamRelationColObj, Long>("Id");
    tableColumnId.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamRelationColObj, Long>, ObservableValue<Long>>() {
                public ObservableValue<Long> call(CellDataFeatures<ICFBamRelationColObj, Long> p) {
                    ICFBamRelationColObj 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<ICFBamRelationColObj, Long>, TableCell<ICFBamRelationColObj, Long>>() {
                @Override
                public TableCell<ICFBamRelationColObj, Long> call(TableColumn<ICFBamRelationColObj, Long> arg) {
                    return new CFInt64TableCell<ICFBamRelationColObj>();
                }
            });
    dataTable.getColumns().add(tableColumnId);
    tableColumnName = new TableColumn<ICFBamRelationColObj, String>("Name");
    tableColumnName.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamRelationColObj, String>, ObservableValue<String>>() {
                public ObservableValue<String> call(CellDataFeatures<ICFBamRelationColObj, String> p) {
                    ICFBamRelationColObj 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<ICFBamRelationColObj, String>, TableCell<ICFBamRelationColObj, String>>() {
                @Override
                public TableCell<ICFBamRelationColObj, String> call(
                        TableColumn<ICFBamRelationColObj, String> arg) {
                    return new CFStringTableCell<ICFBamRelationColObj>();
                }
            });
    dataTable.getColumns().add(tableColumnName);
    tableColumnLookupDefSchema = new TableColumn<ICFBamRelationColObj, ICFBamSchemaDefObj>("Defining Schema");
    tableColumnLookupDefSchema.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamRelationColObj, ICFBamSchemaDefObj>, ObservableValue<ICFBamSchemaDefObj>>() {
                public ObservableValue<ICFBamSchemaDefObj> call(
                        CellDataFeatures<ICFBamRelationColObj, ICFBamSchemaDefObj> p) {
                    ICFBamRelationColObj 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<ICFBamRelationColObj, ICFBamSchemaDefObj>, TableCell<ICFBamRelationColObj, ICFBamSchemaDefObj>>() {
                @Override
                public TableCell<ICFBamRelationColObj, ICFBamSchemaDefObj> call(
                        TableColumn<ICFBamRelationColObj, ICFBamSchemaDefObj> arg) {
                    return new CFReferenceTableCell<ICFBamRelationColObj, ICFBamSchemaDefObj>();
                }
            });
    dataTable.getColumns().add(tableColumnLookupDefSchema);
    tableColumnShortName = new TableColumn<ICFBamRelationColObj, String>("Short Name");
    tableColumnShortName.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamRelationColObj, String>, ObservableValue<String>>() {
                public ObservableValue<String> call(CellDataFeatures<ICFBamRelationColObj, String> p) {
                    ICFBamRelationColObj 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<ICFBamRelationColObj, String>, TableCell<ICFBamRelationColObj, String>>() {
                @Override
                public TableCell<ICFBamRelationColObj, String> call(
                        TableColumn<ICFBamRelationColObj, String> arg) {
                    return new CFStringTableCell<ICFBamRelationColObj>();
                }
            });
    dataTable.getColumns().add(tableColumnShortName);
    tableColumnDescription = new TableColumn<ICFBamRelationColObj, String>("Description");
    tableColumnDescription.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamRelationColObj, String>, ObservableValue<String>>() {
                public ObservableValue<String> call(CellDataFeatures<ICFBamRelationColObj, String> p) {
                    ICFBamRelationColObj 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<ICFBamRelationColObj, String>, TableCell<ICFBamRelationColObj, String>>() {
                @Override
                public TableCell<ICFBamRelationColObj, String> call(
                        TableColumn<ICFBamRelationColObj, String> arg) {
                    return new CFStringTableCell<ICFBamRelationColObj>();
                }
            });
    dataTable.getColumns().add(tableColumnDescription);
    tableColumnShortDescription = new TableColumn<ICFBamRelationColObj, String>("Short Description");
    tableColumnShortDescription.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamRelationColObj, String>, ObservableValue<String>>() {
                public ObservableValue<String> call(CellDataFeatures<ICFBamRelationColObj, String> p) {
                    ICFBamRelationColObj 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<ICFBamRelationColObj, String>, TableCell<ICFBamRelationColObj, String>>() {
                @Override
                public TableCell<ICFBamRelationColObj, String> call(
                        TableColumn<ICFBamRelationColObj, String> arg) {
                    return new CFStringTableCell<ICFBamRelationColObj>();
                }
            });
    dataTable.getColumns().add(tableColumnShortDescription);
    tableColumnLabel = new TableColumn<ICFBamRelationColObj, String>("Label");
    tableColumnLabel.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamRelationColObj, String>, ObservableValue<String>>() {
                public ObservableValue<String> call(CellDataFeatures<ICFBamRelationColObj, String> p) {
                    ICFBamRelationColObj 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<ICFBamRelationColObj, String>, TableCell<ICFBamRelationColObj, String>>() {
                @Override
                public TableCell<ICFBamRelationColObj, String> call(
                        TableColumn<ICFBamRelationColObj, String> arg) {
                    return new CFStringTableCell<ICFBamRelationColObj>();
                }
            });
    dataTable.getColumns().add(tableColumnLabel);
    tableColumnDefaultVisibility = new TableColumn<ICFBamRelationColObj, Boolean>("Default Visibility");
    tableColumnDefaultVisibility.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamRelationColObj, Boolean>, ObservableValue<Boolean>>() {
                public ObservableValue<Boolean> call(CellDataFeatures<ICFBamRelationColObj, Boolean> p) {
                    ICFBamRelationColObj 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<ICFBamRelationColObj, Boolean>, TableCell<ICFBamRelationColObj, Boolean>>() {
                @Override
                public TableCell<ICFBamRelationColObj, Boolean> call(
                        TableColumn<ICFBamRelationColObj, Boolean> arg) {
                    return new CFBoolTableCell<ICFBamRelationColObj>();
                }
            });
    dataTable.getColumns().add(tableColumnDefaultVisibility);
    tableColumnLookupFromCol = new TableColumn<ICFBamRelationColObj, ICFBamIndexColObj>("From Column");
    tableColumnLookupFromCol.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamRelationColObj, ICFBamIndexColObj>, ObservableValue<ICFBamIndexColObj>>() {
                public ObservableValue<ICFBamIndexColObj> call(
                        CellDataFeatures<ICFBamRelationColObj, ICFBamIndexColObj> p) {
                    ICFBamRelationColObj obj = p.getValue();
                    if (obj == null) {
                        return (null);
                    } else {
                        ICFBamIndexColObj ref = obj.getRequiredLookupFromCol();
                        ReadOnlyObjectWrapper<ICFBamIndexColObj> observable = new ReadOnlyObjectWrapper<ICFBamIndexColObj>();
                        observable.setValue(ref);
                        return (observable);
                    }
                }
            });
    tableColumnLookupFromCol.setCellFactory(
            new Callback<TableColumn<ICFBamRelationColObj, ICFBamIndexColObj>, TableCell<ICFBamRelationColObj, ICFBamIndexColObj>>() {
                @Override
                public TableCell<ICFBamRelationColObj, ICFBamIndexColObj> call(
                        TableColumn<ICFBamRelationColObj, ICFBamIndexColObj> arg) {
                    return new CFReferenceTableCell<ICFBamRelationColObj, ICFBamIndexColObj>();
                }
            });
    dataTable.getColumns().add(tableColumnLookupFromCol);
    tableColumnLookupToCol = new TableColumn<ICFBamRelationColObj, ICFBamIndexColObj>("To Column");
    tableColumnLookupToCol.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamRelationColObj, ICFBamIndexColObj>, ObservableValue<ICFBamIndexColObj>>() {
                public ObservableValue<ICFBamIndexColObj> call(
                        CellDataFeatures<ICFBamRelationColObj, ICFBamIndexColObj> p) {
                    ICFBamRelationColObj obj = p.getValue();
                    if (obj == null) {
                        return (null);
                    } else {
                        ICFBamIndexColObj ref = obj.getRequiredLookupToCol();
                        ReadOnlyObjectWrapper<ICFBamIndexColObj> observable = new ReadOnlyObjectWrapper<ICFBamIndexColObj>();
                        observable.setValue(ref);
                        return (observable);
                    }
                }
            });
    tableColumnLookupToCol.setCellFactory(
            new Callback<TableColumn<ICFBamRelationColObj, ICFBamIndexColObj>, TableCell<ICFBamRelationColObj, ICFBamIndexColObj>>() {
                @Override
                public TableCell<ICFBamRelationColObj, ICFBamIndexColObj> call(
                        TableColumn<ICFBamRelationColObj, ICFBamIndexColObj> arg) {
                    return new CFReferenceTableCell<ICFBamRelationColObj, ICFBamIndexColObj>();
                }
            });
    dataTable.getColumns().add(tableColumnLookupToCol);
    dataTable.getSelectionModel().selectedItemProperty()
            .addListener(new ChangeListener<ICFBamRelationColObj>() {
                @Override
                public void changed(ObservableValue<? extends ICFBamRelationColObj> observable,
                        ICFBamRelationColObj oldValue, ICFBamRelationColObj newValue) {
                    setJavaFXFocus(newValue);
                }
            });

    scrollMenu = new ScrollPane();
    scrollMenu.setVbarPolicy(ScrollBarPolicy.NEVER);
    scrollMenu.setHbarPolicy(ScrollBarPolicy.AS_NEEDED);
    scrollMenu.setFitToHeight(true);
    scrollMenu.setContent(getPanelHBoxMenu());

    setTop(scrollMenu);
    setCenter(dataTable);
    javafxIsInitializing = false;
    if (observableListOfRelationCol != null) {
        dataTable.setItems(observableListOfRelationCol);
    }
    adjustListButtons();
}

From source file:uk.bl.dpt.qa.gui.DissimilarGUIThread.java

/**
 * Hook the resize of the panel//from  w ww  . j  a v a 2 s  .c o  m
 */
private void internalHookResize() {
    gLogger.trace("Hooking maximise (this code does not work): "
            + mainPane.getScene().getWindow().getClass().getSimpleName());
    //urgh
    if (mainPane.getScene().getWindow() instanceof Stage) {
        Stage stage = ((Stage) mainPane.getScene().getWindow());
        stage.fullScreenProperty().addListener(new ChangeListener<Boolean>() {
            @Override
            public void changed(ObservableValue<? extends Boolean> pValue, final Boolean pOld,
                    final Boolean pNew) {
                Platform.runLater(new Runnable() {
                    //@Override
                    public void run() {
                        gLogger.trace("Maximised: " + pOld + " -> " + pNew);
                        internalImageZoomToFit();
                    }
                });
            }
        });

        gLogger.trace("Hooking resize (this code does not work)");
        ChangeListener<Number> listener = new ChangeListener<Number>() {
            @Override
            public void changed(ObservableValue<? extends Number> arg0, Number arg1, Number arg2) {
                internalImageZoomToFit();
                System.out.println(arg1.intValue() + " -> " + arg2.intValue());
            }
        };

        stage.widthProperty().addListener(listener);
        stage.heightProperty().addListener(listener);

        //mainPane.widthProperty().addListener(listener);
        //mainPane.heightProperty().addListener(listener);
    }

    gResizeCodeHooked = true;
}

From source file:de.dkfz.roddy.client.fxuiclient.RoddyUIController.java

/**
 * Called when the selected project is changed.
 *///  w w  w.j a  va2 s.c om
private void changeSelectedProject(final FXICCWrapper pWrapper) {
    projectDatasetAccordion.setExpandedPane(tpDatasets);

    RoddyUITask.runTask(new RoddyUITask<Void>(UIConstants.UITASK_CHANGE_PROJECT) {
        List<String> analysesList = null;

        @Override
        public Void _call() throws Exception {
            long t1 = ExecutionService.measureStart();
            currentProjectWrapper = pWrapper;
            currentProject = pWrapper.getID();
            long t2 = ExecutionService.measureStart();

            ExecutionService.measureStop(t2, UIConstants.UITASK_MP_LOADCONFIGURATION);

            analysesList = currentProjectWrapper.getICC().getListOfAnalyses();

            cleanRMIPool();

            ExecutionService.measureStop(t2, UIConstants.UITASK_MP_LOAD_ANALYSIS_LIST);
            return null;
        }

        @Override
        public void _succeeded() {

            vboxAvailableAnalyses.getChildren().clear();
            ToggleGroup tgAnalyses = new ToggleGroup();

            for (String analysis : analysesList) {
                List fullAnalysisID = ProjectFactory.dissectFullAnalysisID(analysis);
                String id = analysis.split("[:][:]")[0];
                String plugin = fullAnalysisID.size() > 0 ? "\n - " + fullAnalysisID.get(0).toString() : "";

                RadioButton rb = new RadioButton(id + plugin);
                rb.setUserData(analysis);
                rb.setToggleGroup(tgAnalyses);
                vboxAvailableAnalyses.getChildren().add(rb);
            }
            tgAnalyses.selectedToggleProperty().addListener(new ChangeListener<Toggle>() {
                @Override
                public void changed(ObservableValue<? extends Toggle> observableValue, Toggle toggle,
                        Toggle toggle2) {
                    changeSelectedAnalysis((String) toggle2.getUserData());
                }
            });

            if (analysesList.size() == 1) {
                tgAnalyses.getToggles().get(0).setSelected(true);
            }
        }
    });
}

From source file:net.sourceforge.msscodefactory.cfbam.v2_7.CFBamJavaFX.CFBamJavaFXBlobColPickerPane.java

public CFBamJavaFXBlobColPickerPane(ICFFormManager formManager, ICFBamJavaFXSchema argSchema,
        ICFBamBlobColObj argFocus, ICFBamTableObj argContainer, Collection<ICFBamBlobColObj> argDataCollection,
        ICFBamJavaFXBlobColChosen whenChosen) {
    super();//from www . j  a va  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<ICFBamBlobColObj>();
    tableColumnId = new TableColumn<ICFBamBlobColObj, Long>("Id");
    tableColumnId.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamBlobColObj, Long>, ObservableValue<Long>>() {
                public ObservableValue<Long> call(CellDataFeatures<ICFBamBlobColObj, 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<ICFBamBlobColObj, Long>, TableCell<ICFBamBlobColObj, Long>>() {
                @Override
                public TableCell<ICFBamBlobColObj, Long> call(TableColumn<ICFBamBlobColObj, Long> arg) {
                    return new CFInt64TableCell<ICFBamBlobColObj>();
                }
            });
    dataTable.getColumns().add(tableColumnId);
    tableColumnName = new TableColumn<ICFBamBlobColObj, String>("Name");
    tableColumnName.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamBlobColObj, String>, ObservableValue<String>>() {
                public ObservableValue<String> call(CellDataFeatures<ICFBamBlobColObj, 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<ICFBamBlobColObj, String>, TableCell<ICFBamBlobColObj, String>>() {
                @Override
                public TableCell<ICFBamBlobColObj, String> call(TableColumn<ICFBamBlobColObj, String> arg) {
                    return new CFStringTableCell<ICFBamBlobColObj>();
                }
            });
    dataTable.getColumns().add(tableColumnName);
    tableColumnShortName = new TableColumn<ICFBamBlobColObj, String>("Short Name");
    tableColumnShortName.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamBlobColObj, String>, ObservableValue<String>>() {
                public ObservableValue<String> call(CellDataFeatures<ICFBamBlobColObj, 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<ICFBamBlobColObj, String>, TableCell<ICFBamBlobColObj, String>>() {
                @Override
                public TableCell<ICFBamBlobColObj, String> call(TableColumn<ICFBamBlobColObj, String> arg) {
                    return new CFStringTableCell<ICFBamBlobColObj>();
                }
            });
    dataTable.getColumns().add(tableColumnShortName);
    tableColumnLabel = new TableColumn<ICFBamBlobColObj, String>("Label");
    tableColumnLabel.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamBlobColObj, String>, ObservableValue<String>>() {
                public ObservableValue<String> call(CellDataFeatures<ICFBamBlobColObj, 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<ICFBamBlobColObj, String>, TableCell<ICFBamBlobColObj, String>>() {
                @Override
                public TableCell<ICFBamBlobColObj, String> call(TableColumn<ICFBamBlobColObj, String> arg) {
                    return new CFStringTableCell<ICFBamBlobColObj>();
                }
            });
    dataTable.getColumns().add(tableColumnLabel);
    tableColumnShortDescription = new TableColumn<ICFBamBlobColObj, String>("Short Description");
    tableColumnShortDescription.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamBlobColObj, String>, ObservableValue<String>>() {
                public ObservableValue<String> call(CellDataFeatures<ICFBamBlobColObj, 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<ICFBamBlobColObj, String>, TableCell<ICFBamBlobColObj, String>>() {
                @Override
                public TableCell<ICFBamBlobColObj, String> call(TableColumn<ICFBamBlobColObj, String> arg) {
                    return new CFStringTableCell<ICFBamBlobColObj>();
                }
            });
    dataTable.getColumns().add(tableColumnShortDescription);
    tableColumnDescription = new TableColumn<ICFBamBlobColObj, String>("Description");
    tableColumnDescription.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamBlobColObj, String>, ObservableValue<String>>() {
                public ObservableValue<String> call(CellDataFeatures<ICFBamBlobColObj, 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<ICFBamBlobColObj, String>, TableCell<ICFBamBlobColObj, String>>() {
                @Override
                public TableCell<ICFBamBlobColObj, String> call(TableColumn<ICFBamBlobColObj, String> arg) {
                    return new CFStringTableCell<ICFBamBlobColObj>();
                }
            });
    dataTable.getColumns().add(tableColumnDescription);
    tableColumnIsNullable = new TableColumn<ICFBamBlobColObj, Boolean>("Is Nullable");
    tableColumnIsNullable.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamBlobColObj, Boolean>, ObservableValue<Boolean>>() {
                public ObservableValue<Boolean> call(CellDataFeatures<ICFBamBlobColObj, 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<ICFBamBlobColObj, Boolean>, TableCell<ICFBamBlobColObj, Boolean>>() {
                @Override
                public TableCell<ICFBamBlobColObj, Boolean> call(TableColumn<ICFBamBlobColObj, Boolean> arg) {
                    return new CFBoolTableCell<ICFBamBlobColObj>();
                }
            });
    dataTable.getColumns().add(tableColumnIsNullable);
    tableColumnGenerateId = new TableColumn<ICFBamBlobColObj, Boolean>("Generate Id");
    tableColumnGenerateId.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamBlobColObj, Boolean>, ObservableValue<Boolean>>() {
                public ObservableValue<Boolean> call(CellDataFeatures<ICFBamBlobColObj, 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<ICFBamBlobColObj, Boolean>, TableCell<ICFBamBlobColObj, Boolean>>() {
                @Override
                public TableCell<ICFBamBlobColObj, Boolean> call(TableColumn<ICFBamBlobColObj, Boolean> arg) {
                    return new CFBoolTableCell<ICFBamBlobColObj>();
                }
            });
    dataTable.getColumns().add(tableColumnGenerateId);
    tableColumnDefaultVisibility = new TableColumn<ICFBamBlobColObj, Boolean>("Default Visibility");
    tableColumnDefaultVisibility.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamBlobColObj, Boolean>, ObservableValue<Boolean>>() {
                public ObservableValue<Boolean> call(CellDataFeatures<ICFBamBlobColObj, 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<ICFBamBlobColObj, Boolean>, TableCell<ICFBamBlobColObj, Boolean>>() {
                @Override
                public TableCell<ICFBamBlobColObj, Boolean> call(TableColumn<ICFBamBlobColObj, Boolean> arg) {
                    return new CFBoolTableCell<ICFBamBlobColObj>();
                }
            });
    dataTable.getColumns().add(tableColumnDefaultVisibility);
    tableColumnDbName = new TableColumn<ICFBamBlobColObj, String>("Db Name");
    tableColumnDbName.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamBlobColObj, String>, ObservableValue<String>>() {
                public ObservableValue<String> call(CellDataFeatures<ICFBamBlobColObj, 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<ICFBamBlobColObj, String>, TableCell<ICFBamBlobColObj, String>>() {
                @Override
                public TableCell<ICFBamBlobColObj, String> call(TableColumn<ICFBamBlobColObj, String> arg) {
                    return new CFStringTableCell<ICFBamBlobColObj>();
                }
            });
    dataTable.getColumns().add(tableColumnDbName);
    tableColumnMaxLen = new TableColumn<ICFBamBlobColObj, Integer>("Max. Length");
    tableColumnMaxLen.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamBlobColObj, Integer>, ObservableValue<Integer>>() {
                public ObservableValue<Integer> call(CellDataFeatures<ICFBamBlobColObj, Integer> p) {
                    ICFBamBlobDefObj 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<ICFBamBlobColObj, Integer>, TableCell<ICFBamBlobColObj, Integer>>() {
                @Override
                public TableCell<ICFBamBlobColObj, Integer> call(TableColumn<ICFBamBlobColObj, Integer> arg) {
                    return new CFInt32TableCell<ICFBamBlobColObj>();
                }
            });
    dataTable.getColumns().add(tableColumnMaxLen);
    tableColumnLookupDefSchema = new TableColumn<ICFBamBlobColObj, ICFBamSchemaDefObj>(
            "Defining Schema Definition");
    tableColumnLookupDefSchema.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamBlobColObj, ICFBamSchemaDefObj>, ObservableValue<ICFBamSchemaDefObj>>() {
                public ObservableValue<ICFBamSchemaDefObj> call(
                        CellDataFeatures<ICFBamBlobColObj, ICFBamSchemaDefObj> p) {
                    ICFBamBlobColObj 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<ICFBamBlobColObj, ICFBamSchemaDefObj>, TableCell<ICFBamBlobColObj, ICFBamSchemaDefObj>>() {
                @Override
                public TableCell<ICFBamBlobColObj, ICFBamSchemaDefObj> call(
                        TableColumn<ICFBamBlobColObj, ICFBamSchemaDefObj> arg) {
                    return new CFReferenceTableCell<ICFBamBlobColObj, ICFBamSchemaDefObj>();
                }
            });
    dataTable.getColumns().add(tableColumnLookupDefSchema);
    dataTable.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<ICFBamBlobColObj>() {
        @Override
        public void changed(ObservableValue<? extends ICFBamBlobColObj> observable, ICFBamBlobColObj oldValue,
                ICFBamBlobColObj 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.choseBlobCol(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");
                }
                ICFBamBlobColObj selectedInstance = getJavaFXFocusAsBlobCol();
                invokeWhenChosen.choseBlobCol(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);
}