Example usage for javafx.event EventHandler EventHandler

List of usage examples for javafx.event EventHandler EventHandler

Introduction

In this page you can find the example usage for javafx.event EventHandler EventHandler.

Prototype

EventHandler

Source Link

Usage

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

public CFBamJavaFXId64GenPickerPane(ICFFormManager formManager, ICFBamJavaFXSchema argSchema,
        ICFBamId64GenObj argFocus, ICFBamSchemaDefObj argContainer,
        Collection<ICFBamId64GenObj> argDataCollection, ICFBamJavaFXId64GenChosen whenChosen) {
    super();// w ww  . jav a2 s  .  c o m
    final String S_ProcName = "construct-schema-focus";
    if (formManager == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 1,
                "formManager");
    }
    cfFormManager = formManager;
    if (argSchema == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 2,
                "argSchema");
    }
    if (whenChosen == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 6,
                "whenChosen");
    }
    invokeWhenChosen = whenChosen;
    // argFocus is optional; focus may be set later during execution as
    // conditions of the runtime change.
    javafxSchema = argSchema;
    javaFXFocus = argFocus;
    javafxContainer = argContainer;
    setJavaFXDataCollection(argDataCollection);
    dataTable = new TableView<ICFBamId64GenObj>();
    tableColumnId = new TableColumn<ICFBamId64GenObj, Long>("Id");
    tableColumnId.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamId64GenObj, Long>, ObservableValue<Long>>() {
                public ObservableValue<Long> call(CellDataFeatures<ICFBamId64GenObj, 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<ICFBamId64GenObj, Long>, TableCell<ICFBamId64GenObj, Long>>() {
                @Override
                public TableCell<ICFBamId64GenObj, Long> call(TableColumn<ICFBamId64GenObj, Long> arg) {
                    return new CFInt64TableCell<ICFBamId64GenObj>();
                }
            });
    dataTable.getColumns().add(tableColumnId);
    tableColumnName = new TableColumn<ICFBamId64GenObj, String>("Name");
    tableColumnName.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamId64GenObj, String>, ObservableValue<String>>() {
                public ObservableValue<String> call(CellDataFeatures<ICFBamId64GenObj, 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<ICFBamId64GenObj, String>, TableCell<ICFBamId64GenObj, String>>() {
                @Override
                public TableCell<ICFBamId64GenObj, String> call(TableColumn<ICFBamId64GenObj, String> arg) {
                    return new CFStringTableCell<ICFBamId64GenObj>();
                }
            });
    dataTable.getColumns().add(tableColumnName);
    tableColumnShortName = new TableColumn<ICFBamId64GenObj, String>("Short Name");
    tableColumnShortName.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamId64GenObj, String>, ObservableValue<String>>() {
                public ObservableValue<String> call(CellDataFeatures<ICFBamId64GenObj, 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<ICFBamId64GenObj, String>, TableCell<ICFBamId64GenObj, String>>() {
                @Override
                public TableCell<ICFBamId64GenObj, String> call(TableColumn<ICFBamId64GenObj, String> arg) {
                    return new CFStringTableCell<ICFBamId64GenObj>();
                }
            });
    dataTable.getColumns().add(tableColumnShortName);
    tableColumnLabel = new TableColumn<ICFBamId64GenObj, String>("Label");
    tableColumnLabel.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamId64GenObj, String>, ObservableValue<String>>() {
                public ObservableValue<String> call(CellDataFeatures<ICFBamId64GenObj, 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<ICFBamId64GenObj, String>, TableCell<ICFBamId64GenObj, String>>() {
                @Override
                public TableCell<ICFBamId64GenObj, String> call(TableColumn<ICFBamId64GenObj, String> arg) {
                    return new CFStringTableCell<ICFBamId64GenObj>();
                }
            });
    dataTable.getColumns().add(tableColumnLabel);
    tableColumnShortDescription = new TableColumn<ICFBamId64GenObj, String>("Short Description");
    tableColumnShortDescription.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamId64GenObj, String>, ObservableValue<String>>() {
                public ObservableValue<String> call(CellDataFeatures<ICFBamId64GenObj, 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<ICFBamId64GenObj, String>, TableCell<ICFBamId64GenObj, String>>() {
                @Override
                public TableCell<ICFBamId64GenObj, String> call(TableColumn<ICFBamId64GenObj, String> arg) {
                    return new CFStringTableCell<ICFBamId64GenObj>();
                }
            });
    dataTable.getColumns().add(tableColumnShortDescription);
    tableColumnDescription = new TableColumn<ICFBamId64GenObj, String>("Description");
    tableColumnDescription.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamId64GenObj, String>, ObservableValue<String>>() {
                public ObservableValue<String> call(CellDataFeatures<ICFBamId64GenObj, 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<ICFBamId64GenObj, String>, TableCell<ICFBamId64GenObj, String>>() {
                @Override
                public TableCell<ICFBamId64GenObj, String> call(TableColumn<ICFBamId64GenObj, String> arg) {
                    return new CFStringTableCell<ICFBamId64GenObj>();
                }
            });
    dataTable.getColumns().add(tableColumnDescription);
    tableColumnIsNullable = new TableColumn<ICFBamId64GenObj, Boolean>("Is Nullable");
    tableColumnIsNullable.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamId64GenObj, Boolean>, ObservableValue<Boolean>>() {
                public ObservableValue<Boolean> call(CellDataFeatures<ICFBamId64GenObj, 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<ICFBamId64GenObj, Boolean>, TableCell<ICFBamId64GenObj, Boolean>>() {
                @Override
                public TableCell<ICFBamId64GenObj, Boolean> call(TableColumn<ICFBamId64GenObj, Boolean> arg) {
                    return new CFBoolTableCell<ICFBamId64GenObj>();
                }
            });
    dataTable.getColumns().add(tableColumnIsNullable);
    tableColumnGenerateId = new TableColumn<ICFBamId64GenObj, Boolean>("Generate Id");
    tableColumnGenerateId.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamId64GenObj, Boolean>, ObservableValue<Boolean>>() {
                public ObservableValue<Boolean> call(CellDataFeatures<ICFBamId64GenObj, 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<ICFBamId64GenObj, Boolean>, TableCell<ICFBamId64GenObj, Boolean>>() {
                @Override
                public TableCell<ICFBamId64GenObj, Boolean> call(TableColumn<ICFBamId64GenObj, Boolean> arg) {
                    return new CFBoolTableCell<ICFBamId64GenObj>();
                }
            });
    dataTable.getColumns().add(tableColumnGenerateId);
    tableColumnDefaultVisibility = new TableColumn<ICFBamId64GenObj, Boolean>("Default Visibility");
    tableColumnDefaultVisibility.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamId64GenObj, Boolean>, ObservableValue<Boolean>>() {
                public ObservableValue<Boolean> call(CellDataFeatures<ICFBamId64GenObj, 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<ICFBamId64GenObj, Boolean>, TableCell<ICFBamId64GenObj, Boolean>>() {
                @Override
                public TableCell<ICFBamId64GenObj, Boolean> call(TableColumn<ICFBamId64GenObj, Boolean> arg) {
                    return new CFBoolTableCell<ICFBamId64GenObj>();
                }
            });
    dataTable.getColumns().add(tableColumnDefaultVisibility);
    tableColumnDbName = new TableColumn<ICFBamId64GenObj, String>("Db Name");
    tableColumnDbName.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamId64GenObj, String>, ObservableValue<String>>() {
                public ObservableValue<String> call(CellDataFeatures<ICFBamId64GenObj, 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<ICFBamId64GenObj, String>, TableCell<ICFBamId64GenObj, String>>() {
                @Override
                public TableCell<ICFBamId64GenObj, String> call(TableColumn<ICFBamId64GenObj, String> arg) {
                    return new CFStringTableCell<ICFBamId64GenObj>();
                }
            });
    dataTable.getColumns().add(tableColumnDbName);
    tableColumnInitValue = new TableColumn<ICFBamId64GenObj, Long>("Init. Value");
    tableColumnInitValue.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamId64GenObj, Long>, ObservableValue<Long>>() {
                public ObservableValue<Long> call(CellDataFeatures<ICFBamId64GenObj, Long> p) {
                    ICFBamInt64DefObj obj = p.getValue();
                    if (obj == null) {
                        return (null);
                    } else {
                        Long value = obj.getOptionalInitValue();
                        ReadOnlyObjectWrapper<Long> observable = new ReadOnlyObjectWrapper<Long>();
                        observable.setValue(value);
                        return (observable);
                    }
                }
            });
    tableColumnInitValue.setCellFactory(
            new Callback<TableColumn<ICFBamId64GenObj, Long>, TableCell<ICFBamId64GenObj, Long>>() {
                @Override
                public TableCell<ICFBamId64GenObj, Long> call(TableColumn<ICFBamId64GenObj, Long> arg) {
                    return new CFInt64TableCell<ICFBamId64GenObj>();
                }
            });
    dataTable.getColumns().add(tableColumnInitValue);
    tableColumnDefaultValue = new TableColumn<ICFBamId64GenObj, Long>("Default Value");
    tableColumnDefaultValue.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamId64GenObj, Long>, ObservableValue<Long>>() {
                public ObservableValue<Long> call(CellDataFeatures<ICFBamId64GenObj, Long> p) {
                    ICFBamInt64DefObj obj = p.getValue();
                    if (obj == null) {
                        return (null);
                    } else {
                        Long value = obj.getOptionalDefaultValue();
                        ReadOnlyObjectWrapper<Long> observable = new ReadOnlyObjectWrapper<Long>();
                        observable.setValue(value);
                        return (observable);
                    }
                }
            });
    tableColumnDefaultValue.setCellFactory(
            new Callback<TableColumn<ICFBamId64GenObj, Long>, TableCell<ICFBamId64GenObj, Long>>() {
                @Override
                public TableCell<ICFBamId64GenObj, Long> call(TableColumn<ICFBamId64GenObj, Long> arg) {
                    return new CFInt64TableCell<ICFBamId64GenObj>();
                }
            });
    dataTable.getColumns().add(tableColumnDefaultValue);
    tableColumnMinValue = new TableColumn<ICFBamId64GenObj, Long>("Min. Value");
    tableColumnMinValue.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamId64GenObj, Long>, ObservableValue<Long>>() {
                public ObservableValue<Long> call(CellDataFeatures<ICFBamId64GenObj, Long> p) {
                    ICFBamInt64DefObj obj = p.getValue();
                    if (obj == null) {
                        return (null);
                    } else {
                        Long value = obj.getOptionalMinValue();
                        ReadOnlyObjectWrapper<Long> observable = new ReadOnlyObjectWrapper<Long>();
                        observable.setValue(value);
                        return (observable);
                    }
                }
            });
    tableColumnMinValue.setCellFactory(
            new Callback<TableColumn<ICFBamId64GenObj, Long>, TableCell<ICFBamId64GenObj, Long>>() {
                @Override
                public TableCell<ICFBamId64GenObj, Long> call(TableColumn<ICFBamId64GenObj, Long> arg) {
                    return new CFInt64TableCell<ICFBamId64GenObj>();
                }
            });
    dataTable.getColumns().add(tableColumnMinValue);
    tableColumnMaxValue = new TableColumn<ICFBamId64GenObj, Long>("Max. Value");
    tableColumnMaxValue.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamId64GenObj, Long>, ObservableValue<Long>>() {
                public ObservableValue<Long> call(CellDataFeatures<ICFBamId64GenObj, Long> p) {
                    ICFBamInt64DefObj obj = p.getValue();
                    if (obj == null) {
                        return (null);
                    } else {
                        Long value = obj.getOptionalMaxValue();
                        ReadOnlyObjectWrapper<Long> observable = new ReadOnlyObjectWrapper<Long>();
                        observable.setValue(value);
                        return (observable);
                    }
                }
            });
    tableColumnMaxValue.setCellFactory(
            new Callback<TableColumn<ICFBamId64GenObj, Long>, TableCell<ICFBamId64GenObj, Long>>() {
                @Override
                public TableCell<ICFBamId64GenObj, Long> call(TableColumn<ICFBamId64GenObj, Long> arg) {
                    return new CFInt64TableCell<ICFBamId64GenObj>();
                }
            });
    dataTable.getColumns().add(tableColumnMaxValue);
    tableColumnNullValue = new TableColumn<ICFBamId64GenObj, Long>("Null Value");
    tableColumnNullValue.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamId64GenObj, Long>, ObservableValue<Long>>() {
                public ObservableValue<Long> call(CellDataFeatures<ICFBamId64GenObj, Long> p) {
                    ICFBamInt64DefObj obj = p.getValue();
                    if (obj == null) {
                        return (null);
                    } else {
                        Long value = obj.getOptionalNullValue();
                        ReadOnlyObjectWrapper<Long> observable = new ReadOnlyObjectWrapper<Long>();
                        observable.setValue(value);
                        return (observable);
                    }
                }
            });
    tableColumnNullValue.setCellFactory(
            new Callback<TableColumn<ICFBamId64GenObj, Long>, TableCell<ICFBamId64GenObj, Long>>() {
                @Override
                public TableCell<ICFBamId64GenObj, Long> call(TableColumn<ICFBamId64GenObj, Long> arg) {
                    return new CFInt64TableCell<ICFBamId64GenObj>();
                }
            });
    dataTable.getColumns().add(tableColumnNullValue);
    tableColumnUnknownValue = new TableColumn<ICFBamId64GenObj, Long>("Unknown Value");
    tableColumnUnknownValue.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamId64GenObj, Long>, ObservableValue<Long>>() {
                public ObservableValue<Long> call(CellDataFeatures<ICFBamId64GenObj, Long> p) {
                    ICFBamInt64DefObj obj = p.getValue();
                    if (obj == null) {
                        return (null);
                    } else {
                        Long value = obj.getOptionalUnknownValue();
                        ReadOnlyObjectWrapper<Long> observable = new ReadOnlyObjectWrapper<Long>();
                        observable.setValue(value);
                        return (observable);
                    }
                }
            });
    tableColumnUnknownValue.setCellFactory(
            new Callback<TableColumn<ICFBamId64GenObj, Long>, TableCell<ICFBamId64GenObj, Long>>() {
                @Override
                public TableCell<ICFBamId64GenObj, Long> call(TableColumn<ICFBamId64GenObj, Long> arg) {
                    return new CFInt64TableCell<ICFBamId64GenObj>();
                }
            });
    dataTable.getColumns().add(tableColumnUnknownValue);
    tableColumnSlice = new TableColumn<ICFBamId64GenObj, Short>("Slice");
    tableColumnSlice.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamId64GenObj, Short>, ObservableValue<Short>>() {
                public ObservableValue<Short> call(CellDataFeatures<ICFBamId64GenObj, Short> p) {
                    ICFBamId64GenObj obj = p.getValue();
                    if (obj == null) {
                        return (null);
                    } else {
                        short value = obj.getRequiredSlice();
                        Short wrapped = new Short(value);
                        ReadOnlyObjectWrapper<Short> observable = new ReadOnlyObjectWrapper<Short>();
                        observable.setValue(wrapped);
                        return (observable);
                    }
                }
            });
    tableColumnSlice.setCellFactory(
            new Callback<TableColumn<ICFBamId64GenObj, Short>, TableCell<ICFBamId64GenObj, Short>>() {
                @Override
                public TableCell<ICFBamId64GenObj, Short> call(TableColumn<ICFBamId64GenObj, Short> arg) {
                    return new CFInt16TableCell<ICFBamId64GenObj>();
                }
            });
    dataTable.getColumns().add(tableColumnSlice);
    tableColumnBlockSize = new TableColumn<ICFBamId64GenObj, Long>("BlockSize");
    tableColumnBlockSize.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamId64GenObj, Long>, ObservableValue<Long>>() {
                public ObservableValue<Long> call(CellDataFeatures<ICFBamId64GenObj, Long> p) {
                    ICFBamId64GenObj obj = p.getValue();
                    if (obj == null) {
                        return (null);
                    } else {
                        long value = obj.getRequiredBlockSize();
                        Long wrapped = new Long(value);
                        ReadOnlyObjectWrapper<Long> observable = new ReadOnlyObjectWrapper<Long>();
                        observable.setValue(wrapped);
                        return (observable);
                    }
                }
            });
    tableColumnBlockSize.setCellFactory(
            new Callback<TableColumn<ICFBamId64GenObj, Long>, TableCell<ICFBamId64GenObj, Long>>() {
                @Override
                public TableCell<ICFBamId64GenObj, Long> call(TableColumn<ICFBamId64GenObj, Long> arg) {
                    return new CFInt64TableCell<ICFBamId64GenObj>();
                }
            });
    dataTable.getColumns().add(tableColumnBlockSize);
    tableColumnLookupDefSchema = new TableColumn<ICFBamId64GenObj, ICFBamSchemaDefObj>(
            "Defining Schema Definition");
    tableColumnLookupDefSchema.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamId64GenObj, ICFBamSchemaDefObj>, ObservableValue<ICFBamSchemaDefObj>>() {
                public ObservableValue<ICFBamSchemaDefObj> call(
                        CellDataFeatures<ICFBamId64GenObj, ICFBamSchemaDefObj> p) {
                    ICFBamId64GenObj 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<ICFBamId64GenObj, ICFBamSchemaDefObj>, TableCell<ICFBamId64GenObj, ICFBamSchemaDefObj>>() {
                @Override
                public TableCell<ICFBamId64GenObj, ICFBamSchemaDefObj> call(
                        TableColumn<ICFBamId64GenObj, ICFBamSchemaDefObj> arg) {
                    return new CFReferenceTableCell<ICFBamId64GenObj, ICFBamSchemaDefObj>();
                }
            });
    dataTable.getColumns().add(tableColumnLookupDefSchema);
    tableColumnLookupDispenser = new TableColumn<ICFBamId64GenObj, ICFBamTableObj>("Dispensing Table");
    tableColumnLookupDispenser.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamId64GenObj, ICFBamTableObj>, ObservableValue<ICFBamTableObj>>() {
                public ObservableValue<ICFBamTableObj> call(
                        CellDataFeatures<ICFBamId64GenObj, ICFBamTableObj> p) {
                    ICFBamId64GenObj obj = p.getValue();
                    if (obj == null) {
                        return (null);
                    } else {
                        ICFBamTableObj ref = obj.getOptionalLookupDispenser();
                        ReadOnlyObjectWrapper<ICFBamTableObj> observable = new ReadOnlyObjectWrapper<ICFBamTableObj>();
                        observable.setValue(ref);
                        return (observable);
                    }
                }
            });
    tableColumnLookupDispenser.setCellFactory(
            new Callback<TableColumn<ICFBamId64GenObj, ICFBamTableObj>, TableCell<ICFBamId64GenObj, ICFBamTableObj>>() {
                @Override
                public TableCell<ICFBamId64GenObj, ICFBamTableObj> call(
                        TableColumn<ICFBamId64GenObj, ICFBamTableObj> arg) {
                    return new CFReferenceTableCell<ICFBamId64GenObj, ICFBamTableObj>();
                }
            });
    dataTable.getColumns().add(tableColumnLookupDispenser);
    dataTable.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<ICFBamId64GenObj>() {
        @Override
        public void changed(ObservableValue<? extends ICFBamId64GenObj> observable, ICFBamId64GenObj oldValue,
                ICFBamId64GenObj 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.choseId64Gen(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");
                }
                ICFBamId64GenObj selectedInstance = getJavaFXFocusAsId64Gen();
                invokeWhenChosen.choseId64Gen(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.CFBamJavaFXId16GenPickerPane.java

public CFBamJavaFXId16GenPickerPane(ICFFormManager formManager, ICFBamJavaFXSchema argSchema,
        ICFBamId16GenObj argFocus, ICFBamSchemaDefObj argContainer,
        Collection<ICFBamId16GenObj> argDataCollection, ICFBamJavaFXId16GenChosen whenChosen) {
    super();//from w ww .  j  a v a 2 s . c  om
    final String S_ProcName = "construct-schema-focus";
    if (formManager == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 1,
                "formManager");
    }
    cfFormManager = formManager;
    if (argSchema == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 2,
                "argSchema");
    }
    if (whenChosen == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 6,
                "whenChosen");
    }
    invokeWhenChosen = whenChosen;
    // argFocus is optional; focus may be set later during execution as
    // conditions of the runtime change.
    javafxSchema = argSchema;
    javaFXFocus = argFocus;
    javafxContainer = argContainer;
    setJavaFXDataCollection(argDataCollection);
    dataTable = new TableView<ICFBamId16GenObj>();
    tableColumnId = new TableColumn<ICFBamId16GenObj, Long>("Id");
    tableColumnId.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamId16GenObj, Long>, ObservableValue<Long>>() {
                public ObservableValue<Long> call(CellDataFeatures<ICFBamId16GenObj, 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<ICFBamId16GenObj, Long>, TableCell<ICFBamId16GenObj, Long>>() {
                @Override
                public TableCell<ICFBamId16GenObj, Long> call(TableColumn<ICFBamId16GenObj, Long> arg) {
                    return new CFInt64TableCell<ICFBamId16GenObj>();
                }
            });
    dataTable.getColumns().add(tableColumnId);
    tableColumnName = new TableColumn<ICFBamId16GenObj, String>("Name");
    tableColumnName.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamId16GenObj, String>, ObservableValue<String>>() {
                public ObservableValue<String> call(CellDataFeatures<ICFBamId16GenObj, 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<ICFBamId16GenObj, String>, TableCell<ICFBamId16GenObj, String>>() {
                @Override
                public TableCell<ICFBamId16GenObj, String> call(TableColumn<ICFBamId16GenObj, String> arg) {
                    return new CFStringTableCell<ICFBamId16GenObj>();
                }
            });
    dataTable.getColumns().add(tableColumnName);
    tableColumnShortName = new TableColumn<ICFBamId16GenObj, String>("Short Name");
    tableColumnShortName.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamId16GenObj, String>, ObservableValue<String>>() {
                public ObservableValue<String> call(CellDataFeatures<ICFBamId16GenObj, 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<ICFBamId16GenObj, String>, TableCell<ICFBamId16GenObj, String>>() {
                @Override
                public TableCell<ICFBamId16GenObj, String> call(TableColumn<ICFBamId16GenObj, String> arg) {
                    return new CFStringTableCell<ICFBamId16GenObj>();
                }
            });
    dataTable.getColumns().add(tableColumnShortName);
    tableColumnLabel = new TableColumn<ICFBamId16GenObj, String>("Label");
    tableColumnLabel.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamId16GenObj, String>, ObservableValue<String>>() {
                public ObservableValue<String> call(CellDataFeatures<ICFBamId16GenObj, 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<ICFBamId16GenObj, String>, TableCell<ICFBamId16GenObj, String>>() {
                @Override
                public TableCell<ICFBamId16GenObj, String> call(TableColumn<ICFBamId16GenObj, String> arg) {
                    return new CFStringTableCell<ICFBamId16GenObj>();
                }
            });
    dataTable.getColumns().add(tableColumnLabel);
    tableColumnShortDescription = new TableColumn<ICFBamId16GenObj, String>("Short Description");
    tableColumnShortDescription.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamId16GenObj, String>, ObservableValue<String>>() {
                public ObservableValue<String> call(CellDataFeatures<ICFBamId16GenObj, 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<ICFBamId16GenObj, String>, TableCell<ICFBamId16GenObj, String>>() {
                @Override
                public TableCell<ICFBamId16GenObj, String> call(TableColumn<ICFBamId16GenObj, String> arg) {
                    return new CFStringTableCell<ICFBamId16GenObj>();
                }
            });
    dataTable.getColumns().add(tableColumnShortDescription);
    tableColumnDescription = new TableColumn<ICFBamId16GenObj, String>("Description");
    tableColumnDescription.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamId16GenObj, String>, ObservableValue<String>>() {
                public ObservableValue<String> call(CellDataFeatures<ICFBamId16GenObj, 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<ICFBamId16GenObj, String>, TableCell<ICFBamId16GenObj, String>>() {
                @Override
                public TableCell<ICFBamId16GenObj, String> call(TableColumn<ICFBamId16GenObj, String> arg) {
                    return new CFStringTableCell<ICFBamId16GenObj>();
                }
            });
    dataTable.getColumns().add(tableColumnDescription);
    tableColumnIsNullable = new TableColumn<ICFBamId16GenObj, Boolean>("Is Nullable");
    tableColumnIsNullable.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamId16GenObj, Boolean>, ObservableValue<Boolean>>() {
                public ObservableValue<Boolean> call(CellDataFeatures<ICFBamId16GenObj, 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<ICFBamId16GenObj, Boolean>, TableCell<ICFBamId16GenObj, Boolean>>() {
                @Override
                public TableCell<ICFBamId16GenObj, Boolean> call(TableColumn<ICFBamId16GenObj, Boolean> arg) {
                    return new CFBoolTableCell<ICFBamId16GenObj>();
                }
            });
    dataTable.getColumns().add(tableColumnIsNullable);
    tableColumnGenerateId = new TableColumn<ICFBamId16GenObj, Boolean>("Generate Id");
    tableColumnGenerateId.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamId16GenObj, Boolean>, ObservableValue<Boolean>>() {
                public ObservableValue<Boolean> call(CellDataFeatures<ICFBamId16GenObj, 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<ICFBamId16GenObj, Boolean>, TableCell<ICFBamId16GenObj, Boolean>>() {
                @Override
                public TableCell<ICFBamId16GenObj, Boolean> call(TableColumn<ICFBamId16GenObj, Boolean> arg) {
                    return new CFBoolTableCell<ICFBamId16GenObj>();
                }
            });
    dataTable.getColumns().add(tableColumnGenerateId);
    tableColumnDefaultVisibility = new TableColumn<ICFBamId16GenObj, Boolean>("Default Visibility");
    tableColumnDefaultVisibility.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamId16GenObj, Boolean>, ObservableValue<Boolean>>() {
                public ObservableValue<Boolean> call(CellDataFeatures<ICFBamId16GenObj, 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<ICFBamId16GenObj, Boolean>, TableCell<ICFBamId16GenObj, Boolean>>() {
                @Override
                public TableCell<ICFBamId16GenObj, Boolean> call(TableColumn<ICFBamId16GenObj, Boolean> arg) {
                    return new CFBoolTableCell<ICFBamId16GenObj>();
                }
            });
    dataTable.getColumns().add(tableColumnDefaultVisibility);
    tableColumnDbName = new TableColumn<ICFBamId16GenObj, String>("Db Name");
    tableColumnDbName.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamId16GenObj, String>, ObservableValue<String>>() {
                public ObservableValue<String> call(CellDataFeatures<ICFBamId16GenObj, 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<ICFBamId16GenObj, String>, TableCell<ICFBamId16GenObj, String>>() {
                @Override
                public TableCell<ICFBamId16GenObj, String> call(TableColumn<ICFBamId16GenObj, String> arg) {
                    return new CFStringTableCell<ICFBamId16GenObj>();
                }
            });
    dataTable.getColumns().add(tableColumnDbName);
    tableColumnInitValue = new TableColumn<ICFBamId16GenObj, Short>("Init. Value");
    tableColumnInitValue.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamId16GenObj, Short>, ObservableValue<Short>>() {
                public ObservableValue<Short> call(CellDataFeatures<ICFBamId16GenObj, Short> p) {
                    ICFBamInt16DefObj obj = p.getValue();
                    if (obj == null) {
                        return (null);
                    } else {
                        Short value = obj.getOptionalInitValue();
                        ReadOnlyObjectWrapper<Short> observable = new ReadOnlyObjectWrapper<Short>();
                        observable.setValue(value);
                        return (observable);
                    }
                }
            });
    tableColumnInitValue.setCellFactory(
            new Callback<TableColumn<ICFBamId16GenObj, Short>, TableCell<ICFBamId16GenObj, Short>>() {
                @Override
                public TableCell<ICFBamId16GenObj, Short> call(TableColumn<ICFBamId16GenObj, Short> arg) {
                    return new CFInt16TableCell<ICFBamId16GenObj>();
                }
            });
    dataTable.getColumns().add(tableColumnInitValue);
    tableColumnDefaultValue = new TableColumn<ICFBamId16GenObj, Short>("Default Value");
    tableColumnDefaultValue.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamId16GenObj, Short>, ObservableValue<Short>>() {
                public ObservableValue<Short> call(CellDataFeatures<ICFBamId16GenObj, Short> p) {
                    ICFBamInt16DefObj obj = p.getValue();
                    if (obj == null) {
                        return (null);
                    } else {
                        Short value = obj.getOptionalDefaultValue();
                        ReadOnlyObjectWrapper<Short> observable = new ReadOnlyObjectWrapper<Short>();
                        observable.setValue(value);
                        return (observable);
                    }
                }
            });
    tableColumnDefaultValue.setCellFactory(
            new Callback<TableColumn<ICFBamId16GenObj, Short>, TableCell<ICFBamId16GenObj, Short>>() {
                @Override
                public TableCell<ICFBamId16GenObj, Short> call(TableColumn<ICFBamId16GenObj, Short> arg) {
                    return new CFInt16TableCell<ICFBamId16GenObj>();
                }
            });
    dataTable.getColumns().add(tableColumnDefaultValue);
    tableColumnMinValue = new TableColumn<ICFBamId16GenObj, Short>("Min. Value");
    tableColumnMinValue.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamId16GenObj, Short>, ObservableValue<Short>>() {
                public ObservableValue<Short> call(CellDataFeatures<ICFBamId16GenObj, Short> p) {
                    ICFBamInt16DefObj obj = p.getValue();
                    if (obj == null) {
                        return (null);
                    } else {
                        Short value = obj.getOptionalMinValue();
                        ReadOnlyObjectWrapper<Short> observable = new ReadOnlyObjectWrapper<Short>();
                        observable.setValue(value);
                        return (observable);
                    }
                }
            });
    tableColumnMinValue.setCellFactory(
            new Callback<TableColumn<ICFBamId16GenObj, Short>, TableCell<ICFBamId16GenObj, Short>>() {
                @Override
                public TableCell<ICFBamId16GenObj, Short> call(TableColumn<ICFBamId16GenObj, Short> arg) {
                    return new CFInt16TableCell<ICFBamId16GenObj>();
                }
            });
    dataTable.getColumns().add(tableColumnMinValue);
    tableColumnMaxValue = new TableColumn<ICFBamId16GenObj, Short>("Max. Value");
    tableColumnMaxValue.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamId16GenObj, Short>, ObservableValue<Short>>() {
                public ObservableValue<Short> call(CellDataFeatures<ICFBamId16GenObj, Short> p) {
                    ICFBamInt16DefObj obj = p.getValue();
                    if (obj == null) {
                        return (null);
                    } else {
                        Short value = obj.getOptionalMaxValue();
                        ReadOnlyObjectWrapper<Short> observable = new ReadOnlyObjectWrapper<Short>();
                        observable.setValue(value);
                        return (observable);
                    }
                }
            });
    tableColumnMaxValue.setCellFactory(
            new Callback<TableColumn<ICFBamId16GenObj, Short>, TableCell<ICFBamId16GenObj, Short>>() {
                @Override
                public TableCell<ICFBamId16GenObj, Short> call(TableColumn<ICFBamId16GenObj, Short> arg) {
                    return new CFInt16TableCell<ICFBamId16GenObj>();
                }
            });
    dataTable.getColumns().add(tableColumnMaxValue);
    tableColumnNullValue = new TableColumn<ICFBamId16GenObj, Short>("Null Value");
    tableColumnNullValue.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamId16GenObj, Short>, ObservableValue<Short>>() {
                public ObservableValue<Short> call(CellDataFeatures<ICFBamId16GenObj, Short> p) {
                    ICFBamInt16DefObj obj = p.getValue();
                    if (obj == null) {
                        return (null);
                    } else {
                        Short value = obj.getOptionalNullValue();
                        ReadOnlyObjectWrapper<Short> observable = new ReadOnlyObjectWrapper<Short>();
                        observable.setValue(value);
                        return (observable);
                    }
                }
            });
    tableColumnNullValue.setCellFactory(
            new Callback<TableColumn<ICFBamId16GenObj, Short>, TableCell<ICFBamId16GenObj, Short>>() {
                @Override
                public TableCell<ICFBamId16GenObj, Short> call(TableColumn<ICFBamId16GenObj, Short> arg) {
                    return new CFInt16TableCell<ICFBamId16GenObj>();
                }
            });
    dataTable.getColumns().add(tableColumnNullValue);
    tableColumnUnknownValue = new TableColumn<ICFBamId16GenObj, Short>("Unknown Value");
    tableColumnUnknownValue.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamId16GenObj, Short>, ObservableValue<Short>>() {
                public ObservableValue<Short> call(CellDataFeatures<ICFBamId16GenObj, Short> p) {
                    ICFBamInt16DefObj obj = p.getValue();
                    if (obj == null) {
                        return (null);
                    } else {
                        Short value = obj.getOptionalUnknownValue();
                        ReadOnlyObjectWrapper<Short> observable = new ReadOnlyObjectWrapper<Short>();
                        observable.setValue(value);
                        return (observable);
                    }
                }
            });
    tableColumnUnknownValue.setCellFactory(
            new Callback<TableColumn<ICFBamId16GenObj, Short>, TableCell<ICFBamId16GenObj, Short>>() {
                @Override
                public TableCell<ICFBamId16GenObj, Short> call(TableColumn<ICFBamId16GenObj, Short> arg) {
                    return new CFInt16TableCell<ICFBamId16GenObj>();
                }
            });
    dataTable.getColumns().add(tableColumnUnknownValue);
    tableColumnSlice = new TableColumn<ICFBamId16GenObj, Short>("Slice");
    tableColumnSlice.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamId16GenObj, Short>, ObservableValue<Short>>() {
                public ObservableValue<Short> call(CellDataFeatures<ICFBamId16GenObj, Short> p) {
                    ICFBamId16GenObj obj = p.getValue();
                    if (obj == null) {
                        return (null);
                    } else {
                        short value = obj.getRequiredSlice();
                        Short wrapped = new Short(value);
                        ReadOnlyObjectWrapper<Short> observable = new ReadOnlyObjectWrapper<Short>();
                        observable.setValue(wrapped);
                        return (observable);
                    }
                }
            });
    tableColumnSlice.setCellFactory(
            new Callback<TableColumn<ICFBamId16GenObj, Short>, TableCell<ICFBamId16GenObj, Short>>() {
                @Override
                public TableCell<ICFBamId16GenObj, Short> call(TableColumn<ICFBamId16GenObj, Short> arg) {
                    return new CFInt16TableCell<ICFBamId16GenObj>();
                }
            });
    dataTable.getColumns().add(tableColumnSlice);
    tableColumnBlockSize = new TableColumn<ICFBamId16GenObj, Short>("BlockSize");
    tableColumnBlockSize.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamId16GenObj, Short>, ObservableValue<Short>>() {
                public ObservableValue<Short> call(CellDataFeatures<ICFBamId16GenObj, Short> p) {
                    ICFBamId16GenObj obj = p.getValue();
                    if (obj == null) {
                        return (null);
                    } else {
                        short value = obj.getRequiredBlockSize();
                        Short wrapped = new Short(value);
                        ReadOnlyObjectWrapper<Short> observable = new ReadOnlyObjectWrapper<Short>();
                        observable.setValue(wrapped);
                        return (observable);
                    }
                }
            });
    tableColumnBlockSize.setCellFactory(
            new Callback<TableColumn<ICFBamId16GenObj, Short>, TableCell<ICFBamId16GenObj, Short>>() {
                @Override
                public TableCell<ICFBamId16GenObj, Short> call(TableColumn<ICFBamId16GenObj, Short> arg) {
                    return new CFInt16TableCell<ICFBamId16GenObj>();
                }
            });
    dataTable.getColumns().add(tableColumnBlockSize);
    tableColumnLookupDefSchema = new TableColumn<ICFBamId16GenObj, ICFBamSchemaDefObj>(
            "Defining Schema Definition");
    tableColumnLookupDefSchema.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamId16GenObj, ICFBamSchemaDefObj>, ObservableValue<ICFBamSchemaDefObj>>() {
                public ObservableValue<ICFBamSchemaDefObj> call(
                        CellDataFeatures<ICFBamId16GenObj, ICFBamSchemaDefObj> p) {
                    ICFBamId16GenObj 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<ICFBamId16GenObj, ICFBamSchemaDefObj>, TableCell<ICFBamId16GenObj, ICFBamSchemaDefObj>>() {
                @Override
                public TableCell<ICFBamId16GenObj, ICFBamSchemaDefObj> call(
                        TableColumn<ICFBamId16GenObj, ICFBamSchemaDefObj> arg) {
                    return new CFReferenceTableCell<ICFBamId16GenObj, ICFBamSchemaDefObj>();
                }
            });
    dataTable.getColumns().add(tableColumnLookupDefSchema);
    tableColumnLookupDispenser = new TableColumn<ICFBamId16GenObj, ICFBamTableObj>("Dispensing Table");
    tableColumnLookupDispenser.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamId16GenObj, ICFBamTableObj>, ObservableValue<ICFBamTableObj>>() {
                public ObservableValue<ICFBamTableObj> call(
                        CellDataFeatures<ICFBamId16GenObj, ICFBamTableObj> p) {
                    ICFBamId16GenObj obj = p.getValue();
                    if (obj == null) {
                        return (null);
                    } else {
                        ICFBamTableObj ref = obj.getOptionalLookupDispenser();
                        ReadOnlyObjectWrapper<ICFBamTableObj> observable = new ReadOnlyObjectWrapper<ICFBamTableObj>();
                        observable.setValue(ref);
                        return (observable);
                    }
                }
            });
    tableColumnLookupDispenser.setCellFactory(
            new Callback<TableColumn<ICFBamId16GenObj, ICFBamTableObj>, TableCell<ICFBamId16GenObj, ICFBamTableObj>>() {
                @Override
                public TableCell<ICFBamId16GenObj, ICFBamTableObj> call(
                        TableColumn<ICFBamId16GenObj, ICFBamTableObj> arg) {
                    return new CFReferenceTableCell<ICFBamId16GenObj, ICFBamTableObj>();
                }
            });
    dataTable.getColumns().add(tableColumnLookupDispenser);
    dataTable.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<ICFBamId16GenObj>() {
        @Override
        public void changed(ObservableValue<? extends ICFBamId16GenObj> observable, ICFBamId16GenObj oldValue,
                ICFBamId16GenObj 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.choseId16Gen(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");
                }
                ICFBamId16GenObj selectedInstance = getJavaFXFocusAsId16Gen();
                invokeWhenChosen.choseId16Gen(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.CFBamJavaFXUuidDefListPane.java

public CFHBox getPanelHBoxMenu() {
    if (hboxMenu == null) {
        hboxMenu = new CFHBox(10);
        LinkedList<CFButton> list = new LinkedList<CFButton>();

        vboxMenuAdd = new CFVBox(10);
        buttonAddUuidType = new CFButton();
        buttonAddUuidType.setMinWidth(200);
        buttonAddUuidType.setText("Add UuidType");
        buttonAddUuidType.setOnAction(new EventHandler<ActionEvent>() {
            @Override//from w ww . j  a v  a  2s . c o  m
            public void handle(ActionEvent e) {
                final String S_ProcName = "handle";
                try {
                    ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema();
                    ICFBamUuidTypeObj obj = (ICFBamUuidTypeObj) schemaObj.getUuidTypeTableObj().newInstance();
                    CFBorderPane frame = javafxSchema.getUuidTypeFactory().newAddForm(cfFormManager, obj,
                            getViewEditClosedCallback(), true);
                    ICFBamUuidTypeEditObj edit = (ICFBamUuidTypeEditObj) (obj.beginEdit());
                    if (edit == null) {
                        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(),
                                S_ProcName, 0, "edit");
                    }
                    ICFSecurityTenantObj secTenant = schemaObj.getSecTenant();
                    edit.setRequiredOwnerTenant(secTenant);
                    ICFBamSchemaDefObj container = (ICFBamSchemaDefObj) (getJavaFXContainer());
                    if (container == null) {
                        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(),
                                S_ProcName, 0, "JavaFXContainer");
                    }
                    edit.setRequiredContainerSchemaDef(container);
                    ICFBamJavaFXUuidTypePaneCommon jpanelCommon = (ICFBamJavaFXUuidTypePaneCommon) frame;
                    jpanelCommon.setJavaFXFocus(obj);
                    jpanelCommon.setPaneMode(CFPane.PaneMode.Add);
                    cfFormManager.pushForm(frame);
                    setLeft(null);
                    adjustListButtons();
                } catch (Throwable t) {
                    CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t);
                }
            }
        });
        if (javafxContainer instanceof ICFBamSchemaDefObj) {
            list.add(buttonAddUuidType);
        }
        buttonAddUuidGen = new CFButton();
        buttonAddUuidGen.setMinWidth(200);
        buttonAddUuidGen.setText("Add UuidGen");
        buttonAddUuidGen.setOnAction(new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent e) {
                final String S_ProcName = "handle";
                try {
                    ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema();
                    ICFBamUuidGenObj obj = (ICFBamUuidGenObj) schemaObj.getUuidGenTableObj().newInstance();
                    CFBorderPane frame = javafxSchema.getUuidGenFactory().newAddForm(cfFormManager, obj,
                            getViewEditClosedCallback(), true);
                    ICFBamUuidGenEditObj edit = (ICFBamUuidGenEditObj) (obj.beginEdit());
                    if (edit == null) {
                        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(),
                                S_ProcName, 0, "edit");
                    }
                    ICFSecurityTenantObj secTenant = schemaObj.getSecTenant();
                    edit.setRequiredOwnerTenant(secTenant);
                    ICFBamSchemaDefObj container = (ICFBamSchemaDefObj) (getJavaFXContainer());
                    if (container == null) {
                        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(),
                                S_ProcName, 0, "JavaFXContainer");
                    }
                    edit.setRequiredContainerSchemaDef(container);
                    ICFBamJavaFXUuidGenPaneCommon jpanelCommon = (ICFBamJavaFXUuidGenPaneCommon) frame;
                    jpanelCommon.setJavaFXFocus(obj);
                    jpanelCommon.setPaneMode(CFPane.PaneMode.Add);
                    cfFormManager.pushForm(frame);
                    setLeft(null);
                    adjustListButtons();
                } catch (Throwable t) {
                    CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t);
                }
            }
        });
        if (javafxContainer instanceof ICFBamSchemaDefObj) {
            list.add(buttonAddUuidGen);
        }
        buttonAddUuidCol = new CFButton();
        buttonAddUuidCol.setMinWidth(200);
        buttonAddUuidCol.setText("Add UuidCol");
        buttonAddUuidCol.setOnAction(new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent e) {
                final String S_ProcName = "handle";
                try {
                    ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema();
                    ICFBamUuidColObj obj = (ICFBamUuidColObj) schemaObj.getUuidColTableObj().newInstance();
                    CFBorderPane frame = javafxSchema.getUuidColFactory().newAddForm(cfFormManager, obj,
                            getViewEditClosedCallback(), true);
                    ICFBamUuidColEditObj edit = (ICFBamUuidColEditObj) (obj.beginEdit());
                    if (edit == null) {
                        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(),
                                S_ProcName, 0, "edit");
                    }
                    ICFSecurityTenantObj secTenant = schemaObj.getSecTenant();
                    edit.setRequiredOwnerTenant(secTenant);
                    ICFBamTableObj container = (ICFBamTableObj) (getJavaFXContainer());
                    if (container == null) {
                        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(),
                                S_ProcName, 0, "JavaFXContainer");
                    }
                    edit.setRequiredContainerTable(container);
                    ICFBamJavaFXUuidColPaneCommon jpanelCommon = (ICFBamJavaFXUuidColPaneCommon) frame;
                    jpanelCommon.setJavaFXFocus(obj);
                    jpanelCommon.setPaneMode(CFPane.PaneMode.Add);
                    cfFormManager.pushForm(frame);
                    setLeft(null);
                    adjustListButtons();
                } catch (Throwable t) {
                    CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t);
                }
            }
        });
        if (javafxContainer instanceof ICFBamTableObj) {
            list.add(buttonAddUuidCol);
        }

        int len = list.size();
        CFButton arr[] = new CFButton[len];
        Iterator<CFButton> iter = list.iterator();
        int idx = 0;
        while (iter.hasNext()) {
            arr[idx++] = iter.next();
        }
        Arrays.sort(arr, new CompareCFButtonByText());
        for (idx = 0; idx < len; idx++) {
            vboxMenuAdd.getChildren().add(arr[idx]);
        }

        buttonCancelAdd = new CFButton();
        buttonCancelAdd.setMinWidth(200);
        buttonCancelAdd.setText("Cancel Add...");
        buttonCancelAdd.setOnAction(new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent e) {
                final String S_ProcName = "handle";
                try {
                    setLeft(null);
                    adjustListButtons();
                } catch (Throwable t) {
                    CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t);
                }
            }
        });
        vboxMenuAdd.getChildren().add(buttonCancelAdd);

        scrollMenuAdd = new ScrollPane();
        scrollMenuAdd.setMinWidth(240);
        scrollMenuAdd.setMaxWidth(240);
        scrollMenuAdd.setFitToWidth(true);
        scrollMenuAdd.setHbarPolicy(ScrollBarPolicy.NEVER);
        scrollMenuAdd.setVbarPolicy(ScrollBarPolicy.AS_NEEDED);
        scrollMenuAdd.setContent(vboxMenuAdd);

        buttonAdd = new CFButton();
        buttonAdd.setMinWidth(200);
        buttonAdd.setText("Add...");
        buttonAdd.setOnAction(new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent e) {
                final String S_ProcName = "handle";
                try {
                    setLeft(scrollMenuAdd);
                    adjustListButtons();
                } catch (Throwable t) {
                    CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t);
                }
            }
        });
        hboxMenu.getChildren().add(buttonAdd);

        buttonViewSelected = new CFButton();
        buttonViewSelected.setMinWidth(200);
        buttonViewSelected.setText("View Selected");
        buttonViewSelected.setOnAction(new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent e) {
                final String S_ProcName = "handle";
                try {
                    ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema();
                    if (schemaObj == null) {
                        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(),
                                S_ProcName, 0, "schemaObj");
                    }
                    ICFBamUuidDefObj selectedInstance = getJavaFXFocusAsUuidDef();
                    if (selectedInstance != null) {
                        String classCode = selectedInstance.getClassCode();
                        if ("UIDD".equals(classCode)) {
                            CFBorderPane frame = javafxSchema.getUuidDefFactory().newViewEditForm(cfFormManager,
                                    selectedInstance, getViewEditClosedCallback(), false);
                            ((ICFBamJavaFXUuidDefPaneCommon) frame).setPaneMode(CFPane.PaneMode.View);
                            cfFormManager.pushForm(frame);
                        } else if ("UIDT".equals(classCode)) {
                            ICFBamUuidTypeObj obj = (ICFBamUuidTypeObj) selectedInstance;
                            CFBorderPane frame = javafxSchema.getUuidTypeFactory()
                                    .newViewEditForm(cfFormManager, obj, getViewEditClosedCallback(), false);
                            ((ICFBamJavaFXUuidTypePaneCommon) frame).setPaneMode(CFPane.PaneMode.View);
                            cfFormManager.pushForm(frame);
                        } else if ("IGUU".equals(classCode)) {
                            ICFBamUuidGenObj obj = (ICFBamUuidGenObj) selectedInstance;
                            CFBorderPane frame = javafxSchema.getUuidGenFactory().newViewEditForm(cfFormManager,
                                    obj, getViewEditClosedCallback(), false);
                            ((ICFBamJavaFXUuidGenPaneCommon) frame).setPaneMode(CFPane.PaneMode.View);
                            cfFormManager.pushForm(frame);
                        } else if ("UIDC".equals(classCode)) {
                            ICFBamUuidColObj obj = (ICFBamUuidColObj) selectedInstance;
                            CFBorderPane frame = javafxSchema.getUuidColFactory().newViewEditForm(cfFormManager,
                                    obj, getViewEditClosedCallback(), false);
                            ((ICFBamJavaFXUuidColPaneCommon) frame).setPaneMode(CFPane.PaneMode.View);
                            cfFormManager.pushForm(frame);
                        } else {
                            throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(),
                                    S_ProcName, "selectedInstance", selectedInstance,
                                    "ICFBamUuidDefObj, ICFBamUuidTypeObj, ICFBamUuidGenObj, ICFBamUuidColObj");
                        }
                    }
                } catch (Throwable t) {
                    CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t);
                }
            }
        });
        hboxMenu.getChildren().add(buttonViewSelected);

        buttonEditSelected = new CFButton();
        buttonEditSelected.setMinWidth(200);
        buttonEditSelected.setText("Edit Selected");
        buttonEditSelected.setOnAction(new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent e) {
                final String S_ProcName = "handle";
                try {
                    ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema();
                    if (schemaObj == null) {
                        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(),
                                S_ProcName, 0, "schemaObj");
                    }
                    ICFBamUuidDefObj selectedInstance = getJavaFXFocusAsUuidDef();
                    if (selectedInstance != null) {
                        String classCode = selectedInstance.getClassCode();
                        if ("UIDD".equals(classCode)) {
                            CFBorderPane frame = javafxSchema.getUuidDefFactory().newViewEditForm(cfFormManager,
                                    selectedInstance, getViewEditClosedCallback(), false);
                            ((ICFBamJavaFXUuidDefPaneCommon) frame).setPaneMode(CFPane.PaneMode.Edit);
                            cfFormManager.pushForm(frame);
                        } else if ("UIDT".equals(classCode)) {
                            ICFBamUuidTypeObj obj = (ICFBamUuidTypeObj) selectedInstance;
                            CFBorderPane frame = javafxSchema.getUuidTypeFactory()
                                    .newViewEditForm(cfFormManager, obj, getViewEditClosedCallback(), false);
                            ((ICFBamJavaFXUuidTypePaneCommon) frame).setPaneMode(CFPane.PaneMode.Edit);
                            cfFormManager.pushForm(frame);
                        } else if ("IGUU".equals(classCode)) {
                            ICFBamUuidGenObj obj = (ICFBamUuidGenObj) selectedInstance;
                            CFBorderPane frame = javafxSchema.getUuidGenFactory().newViewEditForm(cfFormManager,
                                    obj, getViewEditClosedCallback(), false);
                            ((ICFBamJavaFXUuidGenPaneCommon) frame).setPaneMode(CFPane.PaneMode.View);
                            cfFormManager.pushForm(frame);
                        } else if ("UIDC".equals(classCode)) {
                            ICFBamUuidColObj obj = (ICFBamUuidColObj) selectedInstance;
                            CFBorderPane frame = javafxSchema.getUuidColFactory().newViewEditForm(cfFormManager,
                                    obj, getViewEditClosedCallback(), false);
                            ((ICFBamJavaFXUuidColPaneCommon) frame).setPaneMode(CFPane.PaneMode.Edit);
                            cfFormManager.pushForm(frame);
                        } else {
                            throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(),
                                    S_ProcName, "selectedInstance", selectedInstance,
                                    "ICFBamUuidDefObj, ICFBamUuidTypeObj, ICFBamUuidGenObj, ICFBamUuidColObj");
                        }
                    }
                } catch (Throwable t) {
                    CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t);
                }
            }
        });
        hboxMenu.getChildren().add(buttonEditSelected);

        buttonDeleteSelected = new CFButton();
        buttonDeleteSelected.setMinWidth(200);
        buttonDeleteSelected.setText("Delete Selected");
        buttonDeleteSelected.setOnAction(new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent e) {
                final String S_ProcName = "handle";
                try {
                    ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema();
                    if (schemaObj == null) {
                        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(),
                                S_ProcName, 0, "schemaObj");
                    }
                    ICFBamUuidDefObj selectedInstance = getJavaFXFocusAsUuidDef();
                    if (selectedInstance != null) {
                        String classCode = selectedInstance.getClassCode();
                        if ("UIDD".equals(classCode)) {
                            CFBorderPane frame = javafxSchema.getUuidDefFactory()
                                    .newAskDeleteForm(cfFormManager, selectedInstance, getDeleteCallback());
                            ((ICFBamJavaFXUuidDefPaneCommon) frame).setPaneMode(CFPane.PaneMode.View);
                            cfFormManager.pushForm(frame);
                        } else if ("UIDT".equals(classCode)) {
                            ICFBamUuidTypeObj obj = (ICFBamUuidTypeObj) selectedInstance;
                            CFBorderPane frame = javafxSchema.getUuidTypeFactory()
                                    .newAskDeleteForm(cfFormManager, obj, getDeleteCallback());
                            ((ICFBamJavaFXUuidTypePaneCommon) frame).setPaneMode(CFPane.PaneMode.View);
                            cfFormManager.pushForm(frame);
                        } else if ("IGUU".equals(classCode)) {
                            ICFBamUuidGenObj obj = (ICFBamUuidGenObj) selectedInstance;
                            CFBorderPane frame = javafxSchema.getUuidGenFactory()
                                    .newAskDeleteForm(cfFormManager, obj, getDeleteCallback());
                            ((ICFBamJavaFXUuidGenPaneCommon) frame).setPaneMode(CFPane.PaneMode.View);
                            cfFormManager.pushForm(frame);
                        } else if ("UIDC".equals(classCode)) {
                            ICFBamUuidColObj obj = (ICFBamUuidColObj) selectedInstance;
                            CFBorderPane frame = javafxSchema.getUuidColFactory()
                                    .newAskDeleteForm(cfFormManager, obj, getDeleteCallback());
                            ((ICFBamJavaFXUuidColPaneCommon) frame).setPaneMode(CFPane.PaneMode.View);
                            cfFormManager.pushForm(frame);
                        } else {
                            throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(),
                                    S_ProcName, "selectedInstance", selectedInstance,
                                    "ICFBamUuidDefObj, ICFBamUuidTypeObj, ICFBamUuidGenObj, ICFBamUuidColObj");
                        }
                    }
                } catch (Throwable t) {
                    CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t);
                }
            }
        });
        hboxMenu.getChildren().add(buttonDeleteSelected);

    }
    return (hboxMenu);
}

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

public CFHBox getPanelHBoxMenu() {
    if (hboxMenu == null) {
        hboxMenu = new CFHBox(10);
        LinkedList<CFButton> list = new LinkedList<CFButton>();

        vboxMenuAdd = new CFVBox(10);
        buttonAddUuidType = new CFButton();
        buttonAddUuidType.setMinWidth(200);
        buttonAddUuidType.setText("Add UuidType");
        buttonAddUuidType.setOnAction(new EventHandler<ActionEvent>() {
            @Override//from   w ww.jav  a  2 s  .c  o  m
            public void handle(ActionEvent e) {
                final String S_ProcName = "handle";
                try {
                    ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema();
                    ICFBamUuidTypeObj obj = (ICFBamUuidTypeObj) schemaObj.getUuidTypeTableObj().newInstance();
                    CFBorderPane frame = javafxSchema.getUuidTypeFactory().newAddForm(cfFormManager, obj,
                            getViewEditClosedCallback(), true);
                    ICFBamUuidTypeEditObj edit = (ICFBamUuidTypeEditObj) (obj.beginEdit());
                    if (edit == null) {
                        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(),
                                S_ProcName, 0, "edit");
                    }
                    ICFSecurityTenantObj secTenant = schemaObj.getSecTenant();
                    edit.setRequiredOwnerTenant(secTenant);
                    ICFBamSchemaDefObj container = (ICFBamSchemaDefObj) (getJavaFXContainer());
                    if (container == null) {
                        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(),
                                S_ProcName, 0, "JavaFXContainer");
                    }
                    edit.setRequiredContainerSchemaDef(container);
                    ICFBamJavaFXUuidTypePaneCommon jpanelCommon = (ICFBamJavaFXUuidTypePaneCommon) frame;
                    jpanelCommon.setJavaFXFocus(obj);
                    jpanelCommon.setPaneMode(CFPane.PaneMode.Add);
                    cfFormManager.pushForm(frame);
                    setLeft(null);
                    adjustListButtons();
                } catch (Throwable t) {
                    CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t);
                }
            }
        });
        if (javafxContainer instanceof ICFBamSchemaDefObj) {
            list.add(buttonAddUuidType);
        }
        buttonAddUuidGen = new CFButton();
        buttonAddUuidGen.setMinWidth(200);
        buttonAddUuidGen.setText("Add UuidGen");
        buttonAddUuidGen.setOnAction(new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent e) {
                final String S_ProcName = "handle";
                try {
                    ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema();
                    ICFBamUuidGenObj obj = (ICFBamUuidGenObj) schemaObj.getUuidGenTableObj().newInstance();
                    CFBorderPane frame = javafxSchema.getUuidGenFactory().newAddForm(cfFormManager, obj,
                            getViewEditClosedCallback(), true);
                    ICFBamUuidGenEditObj edit = (ICFBamUuidGenEditObj) (obj.beginEdit());
                    if (edit == null) {
                        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(),
                                S_ProcName, 0, "edit");
                    }
                    ICFSecurityTenantObj secTenant = schemaObj.getSecTenant();
                    edit.setRequiredOwnerTenant(secTenant);
                    ICFBamSchemaDefObj container = (ICFBamSchemaDefObj) (getJavaFXContainer());
                    if (container == null) {
                        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(),
                                S_ProcName, 0, "JavaFXContainer");
                    }
                    edit.setRequiredContainerSchemaDef(container);
                    ICFBamJavaFXUuidGenPaneCommon jpanelCommon = (ICFBamJavaFXUuidGenPaneCommon) frame;
                    jpanelCommon.setJavaFXFocus(obj);
                    jpanelCommon.setPaneMode(CFPane.PaneMode.Add);
                    cfFormManager.pushForm(frame);
                    setLeft(null);
                    adjustListButtons();
                } catch (Throwable t) {
                    CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t);
                }
            }
        });
        if (javafxContainer instanceof ICFBamSchemaDefObj) {
            list.add(buttonAddUuidGen);
        }

        int len = list.size();
        CFButton arr[] = new CFButton[len];
        Iterator<CFButton> iter = list.iterator();
        int idx = 0;
        while (iter.hasNext()) {
            arr[idx++] = iter.next();
        }
        Arrays.sort(arr, new CompareCFButtonByText());
        for (idx = 0; idx < len; idx++) {
            vboxMenuAdd.getChildren().add(arr[idx]);
        }

        buttonCancelAdd = new CFButton();
        buttonCancelAdd.setMinWidth(200);
        buttonCancelAdd.setText("Cancel Add...");
        buttonCancelAdd.setOnAction(new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent e) {
                final String S_ProcName = "handle";
                try {
                    setLeft(null);
                    adjustListButtons();
                } catch (Throwable t) {
                    CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t);
                }
            }
        });
        vboxMenuAdd.getChildren().add(buttonCancelAdd);

        scrollMenuAdd = new ScrollPane();
        scrollMenuAdd.setMinWidth(240);
        scrollMenuAdd.setMaxWidth(240);
        scrollMenuAdd.setFitToWidth(true);
        scrollMenuAdd.setHbarPolicy(ScrollBarPolicy.NEVER);
        scrollMenuAdd.setVbarPolicy(ScrollBarPolicy.AS_NEEDED);
        scrollMenuAdd.setContent(vboxMenuAdd);

        buttonAdd = new CFButton();
        buttonAdd.setMinWidth(200);
        buttonAdd.setText("Add...");
        buttonAdd.setOnAction(new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent e) {
                final String S_ProcName = "handle";
                try {
                    setLeft(scrollMenuAdd);
                    adjustListButtons();
                } catch (Throwable t) {
                    CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t);
                }
            }
        });
        hboxMenu.getChildren().add(buttonAdd);

        buttonViewSelected = new CFButton();
        buttonViewSelected.setMinWidth(200);
        buttonViewSelected.setText("View Selected");
        buttonViewSelected.setOnAction(new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent e) {
                final String S_ProcName = "handle";
                try {
                    ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema();
                    if (schemaObj == null) {
                        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(),
                                S_ProcName, 0, "schemaObj");
                    }
                    ICFBamUuidTypeObj selectedInstance = getJavaFXFocusAsUuidType();
                    if (selectedInstance != null) {
                        String classCode = selectedInstance.getClassCode();
                        if ("UIDT".equals(classCode)) {
                            CFBorderPane frame = javafxSchema.getUuidTypeFactory().newViewEditForm(
                                    cfFormManager, selectedInstance, getViewEditClosedCallback(), false);
                            ((ICFBamJavaFXUuidTypePaneCommon) frame).setPaneMode(CFPane.PaneMode.View);
                            cfFormManager.pushForm(frame);
                        } else if ("IGUU".equals(classCode)) {
                            ICFBamUuidGenObj obj = (ICFBamUuidGenObj) selectedInstance;
                            CFBorderPane frame = javafxSchema.getUuidGenFactory().newViewEditForm(cfFormManager,
                                    obj, getViewEditClosedCallback(), false);
                            ((ICFBamJavaFXUuidGenPaneCommon) frame).setPaneMode(CFPane.PaneMode.View);
                            cfFormManager.pushForm(frame);
                        } else {
                            throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(),
                                    S_ProcName, "selectedInstance", selectedInstance,
                                    "ICFBamUuidTypeObj, ICFBamUuidGenObj");
                        }
                    }
                } catch (Throwable t) {
                    CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t);
                }
            }
        });
        hboxMenu.getChildren().add(buttonViewSelected);

        buttonEditSelected = new CFButton();
        buttonEditSelected.setMinWidth(200);
        buttonEditSelected.setText("Edit Selected");
        buttonEditSelected.setOnAction(new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent e) {
                final String S_ProcName = "handle";
                try {
                    ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema();
                    if (schemaObj == null) {
                        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(),
                                S_ProcName, 0, "schemaObj");
                    }
                    ICFBamUuidTypeObj selectedInstance = getJavaFXFocusAsUuidType();
                    if (selectedInstance != null) {
                        String classCode = selectedInstance.getClassCode();
                        if ("UIDT".equals(classCode)) {
                            CFBorderPane frame = javafxSchema.getUuidTypeFactory().newViewEditForm(
                                    cfFormManager, selectedInstance, getViewEditClosedCallback(), false);
                            ((ICFBamJavaFXUuidTypePaneCommon) frame).setPaneMode(CFPane.PaneMode.Edit);
                            cfFormManager.pushForm(frame);
                        } else if ("IGUU".equals(classCode)) {
                            ICFBamUuidGenObj obj = (ICFBamUuidGenObj) selectedInstance;
                            CFBorderPane frame = javafxSchema.getUuidGenFactory().newViewEditForm(cfFormManager,
                                    obj, getViewEditClosedCallback(), false);
                            ((ICFBamJavaFXUuidGenPaneCommon) frame).setPaneMode(CFPane.PaneMode.Edit);
                            cfFormManager.pushForm(frame);
                        } else {
                            throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(),
                                    S_ProcName, "selectedInstance", selectedInstance,
                                    "ICFBamUuidTypeObj, ICFBamUuidGenObj");
                        }
                    }
                } catch (Throwable t) {
                    CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t);
                }
            }
        });
        hboxMenu.getChildren().add(buttonEditSelected);

        buttonDeleteSelected = new CFButton();
        buttonDeleteSelected.setMinWidth(200);
        buttonDeleteSelected.setText("Delete Selected");
        buttonDeleteSelected.setOnAction(new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent e) {
                final String S_ProcName = "handle";
                try {
                    ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema();
                    if (schemaObj == null) {
                        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(),
                                S_ProcName, 0, "schemaObj");
                    }
                    ICFBamUuidTypeObj selectedInstance = getJavaFXFocusAsUuidType();
                    if (selectedInstance != null) {
                        String classCode = selectedInstance.getClassCode();
                        if ("UIDT".equals(classCode)) {
                            CFBorderPane frame = javafxSchema.getUuidTypeFactory()
                                    .newAskDeleteForm(cfFormManager, selectedInstance, getDeleteCallback());
                            ((ICFBamJavaFXUuidTypePaneCommon) frame).setPaneMode(CFPane.PaneMode.View);
                            cfFormManager.pushForm(frame);
                        } else if ("IGUU".equals(classCode)) {
                            ICFBamUuidGenObj obj = (ICFBamUuidGenObj) selectedInstance;
                            CFBorderPane frame = javafxSchema.getUuidGenFactory()
                                    .newAskDeleteForm(cfFormManager, obj, getDeleteCallback());
                            ((ICFBamJavaFXUuidGenPaneCommon) frame).setPaneMode(CFPane.PaneMode.View);
                            cfFormManager.pushForm(frame);
                        } else {
                            throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(),
                                    S_ProcName, "selectedInstance", selectedInstance,
                                    "ICFBamUuidTypeObj, ICFBamUuidGenObj");
                        }
                    }
                } catch (Throwable t) {
                    CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t);
                }
            }
        });
        hboxMenu.getChildren().add(buttonDeleteSelected);

    }
    return (hboxMenu);
}

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

public CFHBox getPanelHBoxMenu() {
    if (hboxMenu == null) {
        hboxMenu = new CFHBox(10);
        LinkedList<CFButton> list = new LinkedList<CFButton>();

        vboxMenuAdd = new CFVBox(10);
        buttonAddTimeType = new CFButton();
        buttonAddTimeType.setMinWidth(200);
        buttonAddTimeType.setText("Add TimeType");
        buttonAddTimeType.setOnAction(new EventHandler<ActionEvent>() {
            @Override/*  ww w  .j ava2s .com*/
            public void handle(ActionEvent e) {
                final String S_ProcName = "handle";
                try {
                    ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema();
                    ICFBamTimeTypeObj obj = (ICFBamTimeTypeObj) schemaObj.getTimeTypeTableObj().newInstance();
                    CFBorderPane frame = javafxSchema.getTimeTypeFactory().newAddForm(cfFormManager, obj,
                            getViewEditClosedCallback(), true);
                    ICFBamTimeTypeEditObj edit = (ICFBamTimeTypeEditObj) (obj.beginEdit());
                    if (edit == null) {
                        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(),
                                S_ProcName, 0, "edit");
                    }
                    ICFSecurityTenantObj secTenant = schemaObj.getSecTenant();
                    edit.setRequiredOwnerTenant(secTenant);
                    ICFBamSchemaDefObj container = (ICFBamSchemaDefObj) (getJavaFXContainer());
                    if (container == null) {
                        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(),
                                S_ProcName, 0, "JavaFXContainer");
                    }
                    edit.setRequiredContainerSchemaDef(container);
                    ICFBamJavaFXTimeTypePaneCommon jpanelCommon = (ICFBamJavaFXTimeTypePaneCommon) frame;
                    jpanelCommon.setJavaFXFocus(obj);
                    jpanelCommon.setPaneMode(CFPane.PaneMode.Add);
                    cfFormManager.pushForm(frame);
                    setLeft(null);
                    adjustListButtons();
                } catch (Throwable t) {
                    CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t);
                }
            }
        });
        if (javafxContainer instanceof ICFBamSchemaDefObj) {
            list.add(buttonAddTimeType);
        }
        buttonAddTimeCol = new CFButton();
        buttonAddTimeCol.setMinWidth(200);
        buttonAddTimeCol.setText("Add TimeCol");
        buttonAddTimeCol.setOnAction(new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent e) {
                final String S_ProcName = "handle";
                try {
                    ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema();
                    ICFBamTimeColObj obj = (ICFBamTimeColObj) schemaObj.getTimeColTableObj().newInstance();
                    CFBorderPane frame = javafxSchema.getTimeColFactory().newAddForm(cfFormManager, obj,
                            getViewEditClosedCallback(), true);
                    ICFBamTimeColEditObj edit = (ICFBamTimeColEditObj) (obj.beginEdit());
                    if (edit == null) {
                        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(),
                                S_ProcName, 0, "edit");
                    }
                    ICFSecurityTenantObj secTenant = schemaObj.getSecTenant();
                    edit.setRequiredOwnerTenant(secTenant);
                    ICFBamTableObj container = (ICFBamTableObj) (getJavaFXContainer());
                    if (container == null) {
                        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(),
                                S_ProcName, 0, "JavaFXContainer");
                    }
                    edit.setRequiredContainerTable(container);
                    ICFBamJavaFXTimeColPaneCommon jpanelCommon = (ICFBamJavaFXTimeColPaneCommon) frame;
                    jpanelCommon.setJavaFXFocus(obj);
                    jpanelCommon.setPaneMode(CFPane.PaneMode.Add);
                    cfFormManager.pushForm(frame);
                    setLeft(null);
                    adjustListButtons();
                } catch (Throwable t) {
                    CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t);
                }
            }
        });
        if (javafxContainer instanceof ICFBamTableObj) {
            list.add(buttonAddTimeCol);
        }

        int len = list.size();
        CFButton arr[] = new CFButton[len];
        Iterator<CFButton> iter = list.iterator();
        int idx = 0;
        while (iter.hasNext()) {
            arr[idx++] = iter.next();
        }
        Arrays.sort(arr, new CompareCFButtonByText());
        for (idx = 0; idx < len; idx++) {
            vboxMenuAdd.getChildren().add(arr[idx]);
        }

        buttonCancelAdd = new CFButton();
        buttonCancelAdd.setMinWidth(200);
        buttonCancelAdd.setText("Cancel Add...");
        buttonCancelAdd.setOnAction(new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent e) {
                final String S_ProcName = "handle";
                try {
                    setLeft(null);
                    adjustListButtons();
                } catch (Throwable t) {
                    CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t);
                }
            }
        });
        vboxMenuAdd.getChildren().add(buttonCancelAdd);

        scrollMenuAdd = new ScrollPane();
        scrollMenuAdd.setMinWidth(240);
        scrollMenuAdd.setMaxWidth(240);
        scrollMenuAdd.setFitToWidth(true);
        scrollMenuAdd.setHbarPolicy(ScrollBarPolicy.NEVER);
        scrollMenuAdd.setVbarPolicy(ScrollBarPolicy.AS_NEEDED);
        scrollMenuAdd.setContent(vboxMenuAdd);

        buttonAdd = new CFButton();
        buttonAdd.setMinWidth(200);
        buttonAdd.setText("Add...");
        buttonAdd.setOnAction(new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent e) {
                final String S_ProcName = "handle";
                try {
                    setLeft(scrollMenuAdd);
                    adjustListButtons();
                } catch (Throwable t) {
                    CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t);
                }
            }
        });
        hboxMenu.getChildren().add(buttonAdd);

        buttonViewSelected = new CFButton();
        buttonViewSelected.setMinWidth(200);
        buttonViewSelected.setText("View Selected");
        buttonViewSelected.setOnAction(new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent e) {
                final String S_ProcName = "handle";
                try {
                    ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema();
                    if (schemaObj == null) {
                        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(),
                                S_ProcName, 0, "schemaObj");
                    }
                    ICFBamTimeDefObj selectedInstance = getJavaFXFocusAsTimeDef();
                    if (selectedInstance != null) {
                        String classCode = selectedInstance.getClassCode();
                        if ("TIMD".equals(classCode)) {
                            CFBorderPane frame = javafxSchema.getTimeDefFactory().newViewEditForm(cfFormManager,
                                    selectedInstance, getViewEditClosedCallback(), false);
                            ((ICFBamJavaFXTimeDefPaneCommon) frame).setPaneMode(CFPane.PaneMode.View);
                            cfFormManager.pushForm(frame);
                        } else if ("TIMT".equals(classCode)) {
                            ICFBamTimeTypeObj obj = (ICFBamTimeTypeObj) selectedInstance;
                            CFBorderPane frame = javafxSchema.getTimeTypeFactory()
                                    .newViewEditForm(cfFormManager, obj, getViewEditClosedCallback(), false);
                            ((ICFBamJavaFXTimeTypePaneCommon) frame).setPaneMode(CFPane.PaneMode.View);
                            cfFormManager.pushForm(frame);
                        } else if ("TIMC".equals(classCode)) {
                            ICFBamTimeColObj obj = (ICFBamTimeColObj) selectedInstance;
                            CFBorderPane frame = javafxSchema.getTimeColFactory().newViewEditForm(cfFormManager,
                                    obj, getViewEditClosedCallback(), false);
                            ((ICFBamJavaFXTimeColPaneCommon) frame).setPaneMode(CFPane.PaneMode.View);
                            cfFormManager.pushForm(frame);
                        } else {
                            throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(),
                                    S_ProcName, "selectedInstance", selectedInstance,
                                    "ICFBamTimeDefObj, ICFBamTimeTypeObj, ICFBamTimeColObj");
                        }
                    }
                } catch (Throwable t) {
                    CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t);
                }
            }
        });
        hboxMenu.getChildren().add(buttonViewSelected);

        buttonEditSelected = new CFButton();
        buttonEditSelected.setMinWidth(200);
        buttonEditSelected.setText("Edit Selected");
        buttonEditSelected.setOnAction(new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent e) {
                final String S_ProcName = "handle";
                try {
                    ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema();
                    if (schemaObj == null) {
                        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(),
                                S_ProcName, 0, "schemaObj");
                    }
                    ICFBamTimeDefObj selectedInstance = getJavaFXFocusAsTimeDef();
                    if (selectedInstance != null) {
                        String classCode = selectedInstance.getClassCode();
                        if ("TIMD".equals(classCode)) {
                            CFBorderPane frame = javafxSchema.getTimeDefFactory().newViewEditForm(cfFormManager,
                                    selectedInstance, getViewEditClosedCallback(), false);
                            ((ICFBamJavaFXTimeDefPaneCommon) frame).setPaneMode(CFPane.PaneMode.Edit);
                            cfFormManager.pushForm(frame);
                        } else if ("TIMT".equals(classCode)) {
                            ICFBamTimeTypeObj obj = (ICFBamTimeTypeObj) selectedInstance;
                            CFBorderPane frame = javafxSchema.getTimeTypeFactory()
                                    .newViewEditForm(cfFormManager, obj, getViewEditClosedCallback(), false);
                            ((ICFBamJavaFXTimeTypePaneCommon) frame).setPaneMode(CFPane.PaneMode.Edit);
                            cfFormManager.pushForm(frame);
                        } else if ("TIMC".equals(classCode)) {
                            ICFBamTimeColObj obj = (ICFBamTimeColObj) selectedInstance;
                            CFBorderPane frame = javafxSchema.getTimeColFactory().newViewEditForm(cfFormManager,
                                    obj, getViewEditClosedCallback(), false);
                            ((ICFBamJavaFXTimeColPaneCommon) frame).setPaneMode(CFPane.PaneMode.Edit);
                            cfFormManager.pushForm(frame);
                        } else {
                            throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(),
                                    S_ProcName, "selectedInstance", selectedInstance,
                                    "ICFBamTimeDefObj, ICFBamTimeTypeObj, ICFBamTimeColObj");
                        }
                    }
                } catch (Throwable t) {
                    CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t);
                }
            }
        });
        hboxMenu.getChildren().add(buttonEditSelected);

        buttonDeleteSelected = new CFButton();
        buttonDeleteSelected.setMinWidth(200);
        buttonDeleteSelected.setText("Delete Selected");
        buttonDeleteSelected.setOnAction(new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent e) {
                final String S_ProcName = "handle";
                try {
                    ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema();
                    if (schemaObj == null) {
                        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(),
                                S_ProcName, 0, "schemaObj");
                    }
                    ICFBamTimeDefObj selectedInstance = getJavaFXFocusAsTimeDef();
                    if (selectedInstance != null) {
                        String classCode = selectedInstance.getClassCode();
                        if ("TIMD".equals(classCode)) {
                            CFBorderPane frame = javafxSchema.getTimeDefFactory()
                                    .newAskDeleteForm(cfFormManager, selectedInstance, getDeleteCallback());
                            ((ICFBamJavaFXTimeDefPaneCommon) frame).setPaneMode(CFPane.PaneMode.View);
                            cfFormManager.pushForm(frame);
                        } else if ("TIMT".equals(classCode)) {
                            ICFBamTimeTypeObj obj = (ICFBamTimeTypeObj) selectedInstance;
                            CFBorderPane frame = javafxSchema.getTimeTypeFactory()
                                    .newAskDeleteForm(cfFormManager, obj, getDeleteCallback());
                            ((ICFBamJavaFXTimeTypePaneCommon) frame).setPaneMode(CFPane.PaneMode.View);
                            cfFormManager.pushForm(frame);
                        } else if ("TIMC".equals(classCode)) {
                            ICFBamTimeColObj obj = (ICFBamTimeColObj) selectedInstance;
                            CFBorderPane frame = javafxSchema.getTimeColFactory()
                                    .newAskDeleteForm(cfFormManager, obj, getDeleteCallback());
                            ((ICFBamJavaFXTimeColPaneCommon) frame).setPaneMode(CFPane.PaneMode.View);
                            cfFormManager.pushForm(frame);
                        } else {
                            throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(),
                                    S_ProcName, "selectedInstance", selectedInstance,
                                    "ICFBamTimeDefObj, ICFBamTimeTypeObj, ICFBamTimeColObj");
                        }
                    }
                } catch (Throwable t) {
                    CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t);
                }
            }
        });
        hboxMenu.getChildren().add(buttonDeleteSelected);

    }
    return (hboxMenu);
}

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

public CFBamJavaFXId32GenPickerPane(ICFFormManager formManager, ICFBamJavaFXSchema argSchema,
        ICFBamId32GenObj argFocus, ICFBamSchemaDefObj argContainer,
        Collection<ICFBamId32GenObj> argDataCollection, ICFBamJavaFXId32GenChosen whenChosen) {
    super();/*from   ww w . j  a  va2 s  . c o m*/
    final String S_ProcName = "construct-schema-focus";
    if (formManager == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 1,
                "formManager");
    }
    cfFormManager = formManager;
    if (argSchema == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 2,
                "argSchema");
    }
    if (whenChosen == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 6,
                "whenChosen");
    }
    invokeWhenChosen = whenChosen;
    // argFocus is optional; focus may be set later during execution as
    // conditions of the runtime change.
    javafxSchema = argSchema;
    javaFXFocus = argFocus;
    javafxContainer = argContainer;
    setJavaFXDataCollection(argDataCollection);
    dataTable = new TableView<ICFBamId32GenObj>();
    tableColumnId = new TableColumn<ICFBamId32GenObj, Long>("Id");
    tableColumnId.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamId32GenObj, Long>, ObservableValue<Long>>() {
                public ObservableValue<Long> call(CellDataFeatures<ICFBamId32GenObj, 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<ICFBamId32GenObj, Long>, TableCell<ICFBamId32GenObj, Long>>() {
                @Override
                public TableCell<ICFBamId32GenObj, Long> call(TableColumn<ICFBamId32GenObj, Long> arg) {
                    return new CFInt64TableCell<ICFBamId32GenObj>();
                }
            });
    dataTable.getColumns().add(tableColumnId);
    tableColumnName = new TableColumn<ICFBamId32GenObj, String>("Name");
    tableColumnName.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamId32GenObj, String>, ObservableValue<String>>() {
                public ObservableValue<String> call(CellDataFeatures<ICFBamId32GenObj, 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<ICFBamId32GenObj, String>, TableCell<ICFBamId32GenObj, String>>() {
                @Override
                public TableCell<ICFBamId32GenObj, String> call(TableColumn<ICFBamId32GenObj, String> arg) {
                    return new CFStringTableCell<ICFBamId32GenObj>();
                }
            });
    dataTable.getColumns().add(tableColumnName);
    tableColumnShortName = new TableColumn<ICFBamId32GenObj, String>("Short Name");
    tableColumnShortName.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamId32GenObj, String>, ObservableValue<String>>() {
                public ObservableValue<String> call(CellDataFeatures<ICFBamId32GenObj, 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<ICFBamId32GenObj, String>, TableCell<ICFBamId32GenObj, String>>() {
                @Override
                public TableCell<ICFBamId32GenObj, String> call(TableColumn<ICFBamId32GenObj, String> arg) {
                    return new CFStringTableCell<ICFBamId32GenObj>();
                }
            });
    dataTable.getColumns().add(tableColumnShortName);
    tableColumnLabel = new TableColumn<ICFBamId32GenObj, String>("Label");
    tableColumnLabel.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamId32GenObj, String>, ObservableValue<String>>() {
                public ObservableValue<String> call(CellDataFeatures<ICFBamId32GenObj, 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<ICFBamId32GenObj, String>, TableCell<ICFBamId32GenObj, String>>() {
                @Override
                public TableCell<ICFBamId32GenObj, String> call(TableColumn<ICFBamId32GenObj, String> arg) {
                    return new CFStringTableCell<ICFBamId32GenObj>();
                }
            });
    dataTable.getColumns().add(tableColumnLabel);
    tableColumnShortDescription = new TableColumn<ICFBamId32GenObj, String>("Short Description");
    tableColumnShortDescription.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamId32GenObj, String>, ObservableValue<String>>() {
                public ObservableValue<String> call(CellDataFeatures<ICFBamId32GenObj, 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<ICFBamId32GenObj, String>, TableCell<ICFBamId32GenObj, String>>() {
                @Override
                public TableCell<ICFBamId32GenObj, String> call(TableColumn<ICFBamId32GenObj, String> arg) {
                    return new CFStringTableCell<ICFBamId32GenObj>();
                }
            });
    dataTable.getColumns().add(tableColumnShortDescription);
    tableColumnDescription = new TableColumn<ICFBamId32GenObj, String>("Description");
    tableColumnDescription.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamId32GenObj, String>, ObservableValue<String>>() {
                public ObservableValue<String> call(CellDataFeatures<ICFBamId32GenObj, 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<ICFBamId32GenObj, String>, TableCell<ICFBamId32GenObj, String>>() {
                @Override
                public TableCell<ICFBamId32GenObj, String> call(TableColumn<ICFBamId32GenObj, String> arg) {
                    return new CFStringTableCell<ICFBamId32GenObj>();
                }
            });
    dataTable.getColumns().add(tableColumnDescription);
    tableColumnIsNullable = new TableColumn<ICFBamId32GenObj, Boolean>("Is Nullable");
    tableColumnIsNullable.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamId32GenObj, Boolean>, ObservableValue<Boolean>>() {
                public ObservableValue<Boolean> call(CellDataFeatures<ICFBamId32GenObj, 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<ICFBamId32GenObj, Boolean>, TableCell<ICFBamId32GenObj, Boolean>>() {
                @Override
                public TableCell<ICFBamId32GenObj, Boolean> call(TableColumn<ICFBamId32GenObj, Boolean> arg) {
                    return new CFBoolTableCell<ICFBamId32GenObj>();
                }
            });
    dataTable.getColumns().add(tableColumnIsNullable);
    tableColumnGenerateId = new TableColumn<ICFBamId32GenObj, Boolean>("Generate Id");
    tableColumnGenerateId.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamId32GenObj, Boolean>, ObservableValue<Boolean>>() {
                public ObservableValue<Boolean> call(CellDataFeatures<ICFBamId32GenObj, 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<ICFBamId32GenObj, Boolean>, TableCell<ICFBamId32GenObj, Boolean>>() {
                @Override
                public TableCell<ICFBamId32GenObj, Boolean> call(TableColumn<ICFBamId32GenObj, Boolean> arg) {
                    return new CFBoolTableCell<ICFBamId32GenObj>();
                }
            });
    dataTable.getColumns().add(tableColumnGenerateId);
    tableColumnDefaultVisibility = new TableColumn<ICFBamId32GenObj, Boolean>("Default Visibility");
    tableColumnDefaultVisibility.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamId32GenObj, Boolean>, ObservableValue<Boolean>>() {
                public ObservableValue<Boolean> call(CellDataFeatures<ICFBamId32GenObj, 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<ICFBamId32GenObj, Boolean>, TableCell<ICFBamId32GenObj, Boolean>>() {
                @Override
                public TableCell<ICFBamId32GenObj, Boolean> call(TableColumn<ICFBamId32GenObj, Boolean> arg) {
                    return new CFBoolTableCell<ICFBamId32GenObj>();
                }
            });
    dataTable.getColumns().add(tableColumnDefaultVisibility);
    tableColumnDbName = new TableColumn<ICFBamId32GenObj, String>("Db Name");
    tableColumnDbName.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamId32GenObj, String>, ObservableValue<String>>() {
                public ObservableValue<String> call(CellDataFeatures<ICFBamId32GenObj, 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<ICFBamId32GenObj, String>, TableCell<ICFBamId32GenObj, String>>() {
                @Override
                public TableCell<ICFBamId32GenObj, String> call(TableColumn<ICFBamId32GenObj, String> arg) {
                    return new CFStringTableCell<ICFBamId32GenObj>();
                }
            });
    dataTable.getColumns().add(tableColumnDbName);
    tableColumnInitValue = new TableColumn<ICFBamId32GenObj, Integer>("Init. Value");
    tableColumnInitValue.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamId32GenObj, Integer>, ObservableValue<Integer>>() {
                public ObservableValue<Integer> call(CellDataFeatures<ICFBamId32GenObj, Integer> p) {
                    ICFBamInt32DefObj obj = p.getValue();
                    if (obj == null) {
                        return (null);
                    } else {
                        Integer value = obj.getOptionalInitValue();
                        ReadOnlyObjectWrapper<Integer> observable = new ReadOnlyObjectWrapper<Integer>();
                        observable.setValue(value);
                        return (observable);
                    }
                }
            });
    tableColumnInitValue.setCellFactory(
            new Callback<TableColumn<ICFBamId32GenObj, Integer>, TableCell<ICFBamId32GenObj, Integer>>() {
                @Override
                public TableCell<ICFBamId32GenObj, Integer> call(TableColumn<ICFBamId32GenObj, Integer> arg) {
                    return new CFInt32TableCell<ICFBamId32GenObj>();
                }
            });
    dataTable.getColumns().add(tableColumnInitValue);
    tableColumnDefaultValue = new TableColumn<ICFBamId32GenObj, Integer>("Default Value");
    tableColumnDefaultValue.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamId32GenObj, Integer>, ObservableValue<Integer>>() {
                public ObservableValue<Integer> call(CellDataFeatures<ICFBamId32GenObj, Integer> p) {
                    ICFBamInt32DefObj obj = p.getValue();
                    if (obj == null) {
                        return (null);
                    } else {
                        Integer value = obj.getOptionalDefaultValue();
                        ReadOnlyObjectWrapper<Integer> observable = new ReadOnlyObjectWrapper<Integer>();
                        observable.setValue(value);
                        return (observable);
                    }
                }
            });
    tableColumnDefaultValue.setCellFactory(
            new Callback<TableColumn<ICFBamId32GenObj, Integer>, TableCell<ICFBamId32GenObj, Integer>>() {
                @Override
                public TableCell<ICFBamId32GenObj, Integer> call(TableColumn<ICFBamId32GenObj, Integer> arg) {
                    return new CFInt32TableCell<ICFBamId32GenObj>();
                }
            });
    dataTable.getColumns().add(tableColumnDefaultValue);
    tableColumnMinValue = new TableColumn<ICFBamId32GenObj, Integer>("Min. Value");
    tableColumnMinValue.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamId32GenObj, Integer>, ObservableValue<Integer>>() {
                public ObservableValue<Integer> call(CellDataFeatures<ICFBamId32GenObj, Integer> p) {
                    ICFBamInt32DefObj obj = p.getValue();
                    if (obj == null) {
                        return (null);
                    } else {
                        Integer value = obj.getOptionalMinValue();
                        ReadOnlyObjectWrapper<Integer> observable = new ReadOnlyObjectWrapper<Integer>();
                        observable.setValue(value);
                        return (observable);
                    }
                }
            });
    tableColumnMinValue.setCellFactory(
            new Callback<TableColumn<ICFBamId32GenObj, Integer>, TableCell<ICFBamId32GenObj, Integer>>() {
                @Override
                public TableCell<ICFBamId32GenObj, Integer> call(TableColumn<ICFBamId32GenObj, Integer> arg) {
                    return new CFInt32TableCell<ICFBamId32GenObj>();
                }
            });
    dataTable.getColumns().add(tableColumnMinValue);
    tableColumnMaxValue = new TableColumn<ICFBamId32GenObj, Integer>("Max. Value");
    tableColumnMaxValue.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamId32GenObj, Integer>, ObservableValue<Integer>>() {
                public ObservableValue<Integer> call(CellDataFeatures<ICFBamId32GenObj, Integer> p) {
                    ICFBamInt32DefObj obj = p.getValue();
                    if (obj == null) {
                        return (null);
                    } else {
                        Integer value = obj.getOptionalMaxValue();
                        ReadOnlyObjectWrapper<Integer> observable = new ReadOnlyObjectWrapper<Integer>();
                        observable.setValue(value);
                        return (observable);
                    }
                }
            });
    tableColumnMaxValue.setCellFactory(
            new Callback<TableColumn<ICFBamId32GenObj, Integer>, TableCell<ICFBamId32GenObj, Integer>>() {
                @Override
                public TableCell<ICFBamId32GenObj, Integer> call(TableColumn<ICFBamId32GenObj, Integer> arg) {
                    return new CFInt32TableCell<ICFBamId32GenObj>();
                }
            });
    dataTable.getColumns().add(tableColumnMaxValue);
    tableColumnNullValue = new TableColumn<ICFBamId32GenObj, Integer>("Null Value");
    tableColumnNullValue.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamId32GenObj, Integer>, ObservableValue<Integer>>() {
                public ObservableValue<Integer> call(CellDataFeatures<ICFBamId32GenObj, Integer> p) {
                    ICFBamInt32DefObj obj = p.getValue();
                    if (obj == null) {
                        return (null);
                    } else {
                        Integer value = obj.getOptionalNullValue();
                        ReadOnlyObjectWrapper<Integer> observable = new ReadOnlyObjectWrapper<Integer>();
                        observable.setValue(value);
                        return (observable);
                    }
                }
            });
    tableColumnNullValue.setCellFactory(
            new Callback<TableColumn<ICFBamId32GenObj, Integer>, TableCell<ICFBamId32GenObj, Integer>>() {
                @Override
                public TableCell<ICFBamId32GenObj, Integer> call(TableColumn<ICFBamId32GenObj, Integer> arg) {
                    return new CFInt32TableCell<ICFBamId32GenObj>();
                }
            });
    dataTable.getColumns().add(tableColumnNullValue);
    tableColumnUnknownValue = new TableColumn<ICFBamId32GenObj, Integer>("Unknown Value");
    tableColumnUnknownValue.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamId32GenObj, Integer>, ObservableValue<Integer>>() {
                public ObservableValue<Integer> call(CellDataFeatures<ICFBamId32GenObj, Integer> p) {
                    ICFBamInt32DefObj obj = p.getValue();
                    if (obj == null) {
                        return (null);
                    } else {
                        Integer value = obj.getOptionalUnknownValue();
                        ReadOnlyObjectWrapper<Integer> observable = new ReadOnlyObjectWrapper<Integer>();
                        observable.setValue(value);
                        return (observable);
                    }
                }
            });
    tableColumnUnknownValue.setCellFactory(
            new Callback<TableColumn<ICFBamId32GenObj, Integer>, TableCell<ICFBamId32GenObj, Integer>>() {
                @Override
                public TableCell<ICFBamId32GenObj, Integer> call(TableColumn<ICFBamId32GenObj, Integer> arg) {
                    return new CFInt32TableCell<ICFBamId32GenObj>();
                }
            });
    dataTable.getColumns().add(tableColumnUnknownValue);
    tableColumnSlice = new TableColumn<ICFBamId32GenObj, Short>("Slice");
    tableColumnSlice.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamId32GenObj, Short>, ObservableValue<Short>>() {
                public ObservableValue<Short> call(CellDataFeatures<ICFBamId32GenObj, Short> p) {
                    ICFBamId32GenObj obj = p.getValue();
                    if (obj == null) {
                        return (null);
                    } else {
                        short value = obj.getRequiredSlice();
                        Short wrapped = new Short(value);
                        ReadOnlyObjectWrapper<Short> observable = new ReadOnlyObjectWrapper<Short>();
                        observable.setValue(wrapped);
                        return (observable);
                    }
                }
            });
    tableColumnSlice.setCellFactory(
            new Callback<TableColumn<ICFBamId32GenObj, Short>, TableCell<ICFBamId32GenObj, Short>>() {
                @Override
                public TableCell<ICFBamId32GenObj, Short> call(TableColumn<ICFBamId32GenObj, Short> arg) {
                    return new CFInt16TableCell<ICFBamId32GenObj>();
                }
            });
    dataTable.getColumns().add(tableColumnSlice);
    tableColumnBlockSize = new TableColumn<ICFBamId32GenObj, Integer>("BlockSize");
    tableColumnBlockSize.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamId32GenObj, Integer>, ObservableValue<Integer>>() {
                public ObservableValue<Integer> call(CellDataFeatures<ICFBamId32GenObj, Integer> p) {
                    ICFBamId32GenObj obj = p.getValue();
                    if (obj == null) {
                        return (null);
                    } else {
                        int value = obj.getRequiredBlockSize();
                        Integer wrapped = new Integer(value);
                        ReadOnlyObjectWrapper<Integer> observable = new ReadOnlyObjectWrapper<Integer>();
                        observable.setValue(wrapped);
                        return (observable);
                    }
                }
            });
    tableColumnBlockSize.setCellFactory(
            new Callback<TableColumn<ICFBamId32GenObj, Integer>, TableCell<ICFBamId32GenObj, Integer>>() {
                @Override
                public TableCell<ICFBamId32GenObj, Integer> call(TableColumn<ICFBamId32GenObj, Integer> arg) {
                    return new CFInt32TableCell<ICFBamId32GenObj>();
                }
            });
    dataTable.getColumns().add(tableColumnBlockSize);
    tableColumnLookupDefSchema = new TableColumn<ICFBamId32GenObj, ICFBamSchemaDefObj>(
            "Defining Schema Definition");
    tableColumnLookupDefSchema.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamId32GenObj, ICFBamSchemaDefObj>, ObservableValue<ICFBamSchemaDefObj>>() {
                public ObservableValue<ICFBamSchemaDefObj> call(
                        CellDataFeatures<ICFBamId32GenObj, ICFBamSchemaDefObj> p) {
                    ICFBamId32GenObj 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<ICFBamId32GenObj, ICFBamSchemaDefObj>, TableCell<ICFBamId32GenObj, ICFBamSchemaDefObj>>() {
                @Override
                public TableCell<ICFBamId32GenObj, ICFBamSchemaDefObj> call(
                        TableColumn<ICFBamId32GenObj, ICFBamSchemaDefObj> arg) {
                    return new CFReferenceTableCell<ICFBamId32GenObj, ICFBamSchemaDefObj>();
                }
            });
    dataTable.getColumns().add(tableColumnLookupDefSchema);
    tableColumnLookupDispenser = new TableColumn<ICFBamId32GenObj, ICFBamTableObj>("Dispensing Table");
    tableColumnLookupDispenser.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamId32GenObj, ICFBamTableObj>, ObservableValue<ICFBamTableObj>>() {
                public ObservableValue<ICFBamTableObj> call(
                        CellDataFeatures<ICFBamId32GenObj, ICFBamTableObj> p) {
                    ICFBamId32GenObj obj = p.getValue();
                    if (obj == null) {
                        return (null);
                    } else {
                        ICFBamTableObj ref = obj.getOptionalLookupDispenser();
                        ReadOnlyObjectWrapper<ICFBamTableObj> observable = new ReadOnlyObjectWrapper<ICFBamTableObj>();
                        observable.setValue(ref);
                        return (observable);
                    }
                }
            });
    tableColumnLookupDispenser.setCellFactory(
            new Callback<TableColumn<ICFBamId32GenObj, ICFBamTableObj>, TableCell<ICFBamId32GenObj, ICFBamTableObj>>() {
                @Override
                public TableCell<ICFBamId32GenObj, ICFBamTableObj> call(
                        TableColumn<ICFBamId32GenObj, ICFBamTableObj> arg) {
                    return new CFReferenceTableCell<ICFBamId32GenObj, ICFBamTableObj>();
                }
            });
    dataTable.getColumns().add(tableColumnLookupDispenser);
    dataTable.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<ICFBamId32GenObj>() {
        @Override
        public void changed(ObservableValue<? extends ICFBamId32GenObj> observable, ICFBamId32GenObj oldValue,
                ICFBamId32GenObj 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.choseId32Gen(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");
                }
                ICFBamId32GenObj selectedInstance = getJavaFXFocusAsId32Gen();
                invokeWhenChosen.choseId32Gen(selectedInstance);
                cfFormManager.closeCurrentForm();
            } catch (Throwable t) {
                CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t);
            }
        }
    });
    hboxMenu.getChildren().add(buttonChooseSelected);
    if (argFocus != null) {
        dataTable.getSelectionModel().select(argFocus);
    }
    setTop(hboxMenu);
    setCenter(dataTable);
}

From source file:com.virus.removal.javafxapplication.FXMLDocumentController.java

/**
 * @return//from w  w  w  . j  av  a2s  . c  o m
 */
private Task<Void> createWorker() {
    return new Task<Void>() {

        /* (non-Javadoc)
         * @see javafx.concurrent.Task#call()
         */
        @Override
        protected Void call() throws Exception {

            /* Start the scanning of viruses. */
            //            virusDetectedMap = handler.startScanning(progressBar, 
            //                                           textArea,
            //                                           textForThreatsFound,
            //                                           virusScanning,
            //                                           workerThread);

            javafx.application.Platform.runLater(new Runnable() {

                /* (non-Javadoc)
                 * @see java.lang.Runnable#run()
                 */
                @Override
                public void run() {
                    /* Set the status to Scanning in Dashboard */
                    if (statusValInDash.getStyle() != null) {
                        statusValInDash.setStyle("");
                    }
                    statusValInDash.setText(POTENTIALLY_UNPROTECTED);
                }
            });

            /* Start Scanning */
            int index = 1;
            boolean isNextVirus = false;
            isPageProtected = false;

            final Calendar c = Calendar.getInstance();
            timestamp = simpleDateFormat.format(c.getTime());

            if (isScanCancelled) {
                isScanCancelled = false;
            }

            final Map<String, String> virusDetectedMap = new HashMap<String, String>();
            final List<String> detectedViruses = new ArrayList<String>();

            /* Cancel the Scan */
            q.setOnMouseClicked(new EventHandler<Event>() {

                /**
                 * @param me
                 */
                @Override
                public void handle(Event me) {
                    isScanCancelled = true;
                }
            });

            if (isScanCancelled) {
                handler.setVirusScanStatus(VirusScanStatus.VIRUS_SCAN_STOPPED);
                setVirusScanHistoryIfScanIsStopped(handler);
                return null;
            }

            javafx.application.Platform.runLater(new Runnable() {

                /* (non-Javadoc)
                 * @see java.lang.Runnable#run()
                 */
                @Override
                public void run() {

                    if (textArea != null) {
                        textArea.setFont(Font.font("Verdana", FontWeight.BOLD, 10));
                        if (textArea.getText() != null && !textArea.getText().isEmpty()) {
                            textArea.clear();
                        }
                    }

                    if (StringUtils.equals(drop.getText(), "English")) {
                        virusScanning.setText("Scanning...");
                        timerTextForThreats.setText("Virus Timer: 15 seconds");
                    } else if (StringUtils.equals(drop.getText(), "Spanish")) {
                        virusScanning.setText("Exploracin...");
                        timerTextForThreats.setText("Timer Virus: 15 segundos");
                    } else if (drop.getText().equals("French")) {
                        virusScanning.setText("Balayage...");
                        timerTextForThreats.setText("Virus Timer: 15 secondes");
                    } else if (drop.getText().equals("Portuguese")) {
                        virusScanning.setText("Digitalizao...");
                        timerTextForThreats.setText("Temporizador Vrus: 15 segundos");
                    }

                    progressBar.setTooltip(new Tooltip("Virus scan in progress"));

                    if (textForThreatsFound != null && textForThreatsFound.getText() != null
                            && !textForThreatsFound.getText().isEmpty()) {
                        textForThreatsFound.setText("");
                    }
                    if (textForThreatsRemoved != null && textForThreatsRemoved.getText() != null
                            && !textForThreatsRemoved.getText().isEmpty()) {
                        textForThreatsRemoved.setText("");
                    }

                    if (isScanCancelled) {
                        isScanCancelled = false;
                    }
                }
            });

            System.out.println("Scan in progress..!!");
            System.out.println();

            /* Cancel the Scan */
            q.setOnMouseClicked(new EventHandler<Event>() {

                /**
                 * @param me
                 */
                @Override
                public void handle(Event me) {
                    isScanCancelled = true;
                }
            });

            if (isScanCancelled) {
                handler.setVirusScanStatus(VirusScanStatus.VIRUS_SCAN_STOPPED);
                setVirusScanHistoryIfScanIsStopped(handler);
                return null;
            }

            if (virusRegistry != null) {
                virusSearchList.clear();
                virusSearchList = virusRegistry.getVirusSearchList();
            }
            if (virusCache != null) {
                viruses = virusCache.getAllViruses();
            }
            if (rkm == null) {
                rkm = RegistryKeyManager.getInstance();
            }

            /* Wait for sometime */
            try {
                Thread.sleep(5000);
            } catch (Exception e) {
                System.out.println(e.getMessage());
            }

            javafx.application.Platform.runLater(new Runnable() {

                /* (non-Javadoc)
                 * @see java.lang.Runnable#run()
                 */
                @Override
                public void run() {
                    textArea.appendText("Currently Scanning:");
                    textArea.appendText("\n");
                    textArea.appendText("----------------------");
                    textArea.appendText("\n");

                    /* Cancel the Scan */
                    q.setOnMouseClicked(new EventHandler<Event>() {

                        /**
                         * @param me
                         */
                        @Override
                        public void handle(Event me) {
                            isScanCancelled = true;
                        }
                    });
                }
            });

            if (isScanCancelled) {
                handler.setVirusScanStatus(VirusScanStatus.VIRUS_SCAN_STOPPED);
                setVirusScanHistoryIfScanIsStopped(handler);
                return null;
            }

            for (final String virus : viruses) {

                /* Cancel the Scan */
                q.setOnMouseClicked(new EventHandler<Event>() {

                    /**
                     * @param me
                     */
                    @Override
                    public void handle(Event me) {
                        isScanCancelled = true;
                    }
                });

                if (isScanCancelled) {
                    handler.setVirusScanStatus(VirusScanStatus.VIRUS_SCAN_STOPPED);
                    setVirusScanHistoryIfScanIsStopped(handler);
                    return null;
                }

                if (rkm == null) {
                    System.out.println("Scan is stopped due to: " + REGISTRY_KEY_MANEGER_EMPTY);
                    handler.setVirusScanStatus(VirusScanStatus.VIRUS_SCAN_STOPPED);
                    return null;
                }

                if (isNextVirus) {
                    javafx.application.Platform.runLater(new Runnable() {

                        /* (non-Javadoc)
                         * @see java.lang.Runnable#run()
                         */
                        @Override
                        public void run() {
                            textArea.appendText("\n\n");
                        }
                    });
                }

                javafx.application.Platform.runLater(new Runnable() {

                    /* (non-Javadoc)
                     * @see java.lang.Runnable#run()
                     */
                    @Override
                    public void run() {
                        textArea.appendText(virus);
                        textArea.appendText("\n");
                    }
                });

                for (final String virusSearchUsingReg : virusSearchList) {

                    /* Cancel the Scan */
                    q.setOnMouseClicked(new EventHandler<Event>() {

                        /**
                         * @param me
                         */
                        @Override
                        public void handle(Event me) {
                            isScanCancelled = true;
                        }
                    });

                    if (isScanCancelled) {
                        handler.setVirusScanStatus(VirusScanStatus.VIRUS_SCAN_STOPPED);
                        setVirusScanHistoryIfScanIsStopped(handler);
                        return null;
                    }

                    javafx.application.Platform.runLater(new Runnable() {

                        /* (non-Javadoc)
                         * @see java.lang.Runnable#run()
                         */
                        @Override
                        public void run() {
                            textArea.appendText("\n");
                            textArea.appendText(virusSearchUsingReg);
                        }
                    });

                    try {
                        if (virus != null && !virus.isEmpty() && virusSearchUsingReg != null
                                && !virusSearchUsingReg.isEmpty()) {
                            if (rkm != null) {
                                rkm.query(virusSearchUsingReg, virus);
                                if (rkm.getKey() != null && !rkm.getKey().isEmpty()) {

                                    javafx.application.Platform.runLater(new Runnable() {

                                        /* (non-Javadoc)
                                         * @see java.lang.Runnable#run()
                                         */
                                        @Override
                                        public void run() {
                                            textArea.appendText("\n");
                                        }
                                    });

                                    detectedViruses.add(virusSearchUsingReg + "\\" + virus);
                                    System.out
                                            .println("Found the virus: " + virusSearchUsingReg + "\\" + virus);
                                    virusDetectedMap.put(String.valueOf(index++) + virusSearchUsingReg, virus);
                                }
                            } else {
                                System.out.println("Scan is stopped due to: " + REGISTRY_KEY_MANEGER_EMPTY);
                                handler.setVirusScanStatus(VirusScanStatus.VIRUS_SCAN_STOPPED);
                                return null;
                            }
                        }
                    } catch (final Exception e) {
                        System.out.println("Failed to scan due to: " + e.getMessage());
                        handler.setVirusScanStatus(VirusScanStatus.VIRUS_SCAN_STOPPED);
                        return null;
                    }
                    isNextVirus = true;
                }

            }

            System.out.println("Virus scanning is completed");
            handler.setVirusScanStatus(VirusScanStatus.VIRUS_SCAN_COMPLETED);

            javafx.application.Platform.runLater(new Runnable() {

                /* (non-Javadoc)
                 * @see java.lang.Runnable#run()
                 */
                @Override
                public void run() {
                    virusScanning.setText("");
                    timerTextForThreats.setText("");
                }
            });

            /* Cancel the Scan */
            q.setOnMouseClicked(new EventHandler<Event>() {

                /**
                 * @param me
                 */
                @Override
                public void handle(final Event me) {
                    isScanCancelled = true;
                }
            });

            if (isScanCancelled) {
                handler.setVirusScanStatus(VirusScanStatus.VIRUS_SCAN_STOPPED);
                setVirusScanHistoryIfScanIsStopped(handler);
                return null;
            }

            noOfThreats = virusDetectedMap.size();

            if (handler.getVirusScanStatus() == VirusScanStatus.VIRUS_SCAN_COMPLETED && virusDetectedMap != null
                    && virusDetectedMap.size() > 0) {

                javafx.application.Platform.runLater(new Runnable() {

                    /* (non-Javadoc)
                     * @see java.lang.Runnable#run()
                     */
                    @Override
                    public void run() {
                        if (StringUtils.equals(drop.getText(), "English")) {
                            textForThreatsFound.setText("Found Threats: " + noOfThreats);
                        } else if (StringUtils.equals(drop.getText(), "Spanish")) {
                            textForThreatsFound.setText("Las amenazas que se encuentran: " + noOfThreats);
                        } else if (drop.getText().equals("French")) {
                            textForThreatsFound.setText("Menaces trouvs: " + noOfThreats);
                        } else if (drop.getText().equals("Portuguese")) {
                            textForThreatsFound.setText("Ameaas encontradas: " + noOfThreats);
                        }
                        textArea.appendText("\n\n");
                        textArea.appendText("Found one or more viruses:");
                        textArea.appendText("\n");
                        textArea.appendText("--------------------------------");
                        textArea.appendText("\n");
                        for (final String detectedVirus : detectedViruses) {
                            textArea.appendText(detectedVirus);
                            textArea.appendText("\n");
                        }
                    }
                });

                /* Wait for sometime */
                try {
                    Thread.sleep(1000);
                } catch (Exception e) {
                    System.out.println(e.getMessage());
                }
            } else {

                javafx.application.Platform.runLater(new Runnable() {

                    /* (non-Javadoc)
                     * @see java.lang.Runnable#run()
                     */
                    @Override
                    public void run() {
                        if (StringUtils.equals(drop.getText(), "English")) {
                            textForThreatsFound.setText("Found Threats: " + noOfThreats);
                        } else if (StringUtils.equals(drop.getText(), "Spanish")) {
                            textForThreatsFound.setText("Las amenazas que se encuentran: " + noOfThreats);
                        } else if (drop.getText().equals("French")) {
                            textForThreatsFound.setText("Menaces trouvs: " + noOfThreats);
                        } else if (drop.getText().equals("Portuguese")) {
                            textForThreatsFound.setText("Ameaas encontradas: " + noOfThreats);
                        }
                        textArea.appendText("\n\n");
                        textArea.appendText("No viruses are found");
                    }
                });

                /* Update the progress */
                updateProgress(1, 1);

                VirusScanHistory virusScanHistory = new VirusScanHistory();
                virusScanHistory.setScanDate(timestamp);
                virusScanHistory.setScanStatus("SUCCESSFUL");
                virusScanHistory.setPcName(System.getenv("COMPUTERNAME"));
                virusScanHistory.setThreatsFound(0);

                virusScanHistoryList.add(virusScanHistory);

                /* Wait for sometime */
                try {
                    Thread.sleep(1000);
                } catch (Exception e) {
                    System.out.println(e.getMessage());
                }

            }

            if (handler.getVirusScanStatus() == VirusScanStatus.VIRUS_SCAN_COMPLETED && noOfThreats > 0) {

                /* Delete the viruses found in scanning. */
                //               final boolean virusesDeleted = handler.deleteViruses(progressBar, 
                //                                                       textArea,
                //                                                       textForThreatsFound,
                //                                                       virusScanning);

                /* Start killing viruses */

                javafx.application.Platform.runLater(new Runnable() {

                    /* (non-Javadoc)
                     * @see java.lang.Runnable#run()
                     */
                    @Override
                    public void run() {
                        textArea.appendText("\n\n");
                        textArea.appendText("Killing:");
                        textArea.appendText("\n");
                        textArea.appendText("--------");
                        textArea.appendText("\n");
                    }
                });

                /* Cancel the Scan */
                q.setOnMouseClicked(new EventHandler<Event>() {

                    /**
                     * @param me
                     */
                    @Override
                    public void handle(Event me) {
                        isScanCancelled = true;
                    }
                });

                if (isScanCancelled) {
                    handler.setVirusScanStatus(VirusScanStatus.VIRUS_SCAN_STOPPED);
                    setVirusScanHistoryIfScanIsStopped(handler);
                    return null;
                }

                System.out.println("\n");

                removedThreats = 0;
                final Map<String, String> tempVirusDetectedMap = new HashMap<String, String>(virusDetectedMap);
                for (final Map.Entry<String, String> virusEntry : tempVirusDetectedMap.entrySet()) {
                    try {
                        if (rkm != null) {
                            rkm.deleteKey(virusEntry.getKey().substring(1), virusEntry.getValue());
                            javafx.application.Platform.runLater(new Runnable() {

                                /* (non-Javadoc)
                                 * @see java.lang.Runnable#run()
                                 */
                                @Override
                                public void run() {
                                    textArea.appendText("Removed the virus: " + virusEntry.getKey().substring(1)
                                            + "\\" + virusEntry.getValue());
                                    virusScanning.setText("");
                                    timerTextForThreats.setText("");
                                }
                            });
                            removedThreats++;
                            System.out.println("Removed the virus: " + virusEntry.getKey().substring(1) + "\\"
                                    + virusEntry.getValue());
                            virusDetectedMap.remove(virusEntry.getKey());
                        } else {
                            System.out.println("Scan is stopped due to: " + REGISTRY_KEY_MANEGER_EMPTY);
                            handler.setVirusScanStatus(VirusScanStatus.VIRUS_SCAN_STOPPED);
                            return null;
                        }
                    } catch (Exception e) {
                        System.out.println(e.getLocalizedMessage());
                    }

                    if (progressCount == tempVirusDetectedMap.size()) {
                        updateProgress(1, 1);
                    }

                    progressCount++;
                }

                if (StringUtils.equals(drop.getText(), "English")) {
                    textForThreatsRemoved.setText("Removed Threats: " + removedThreats);
                } else if (StringUtils.equals(drop.getText(), "Spanish")) {
                    textForThreatsFound.setText("Amenazas eliminados: " + noOfThreats);
                } else if (drop.getText().equals("French")) {
                    textForThreatsFound.setText("Menaces supprimes: " + noOfThreats);
                } else if (drop.getText().equals("Portuguese")) {
                    textForThreatsFound.setText("Ameaas removidos: " + noOfThreats);
                }

                /* Update the progress */
                updateProgress(1, 1);

                /* Wait for sometime */
                try {
                    Thread.sleep(1000);
                } catch (Exception e) {
                    System.out.println(e.getMessage());
                }

                System.out.println();
                System.out.println("Virus removal is completed");

                if (tempVirusDetectedMap != null) {
                    tempVirusDetectedMap.clear();
                }

                javafx.application.Platform.runLater(new Runnable() {

                    /* (non-Javadoc)
                     * @see java.lang.Runnable#run()
                     */
                    @Override
                    public void run() {
                        if (textForScanInProgress.getText() != null) {
                            textForScanInProgress.clear();
                        }
                        textForScanInProgress.appendText("Virus scanning is completed");
                    }
                });

                if (virusDetectedMap.size() == 0) {

                    /* Display the protected screen. */
                    showTheProtectedPage();
                    isPageProtected = true;

                    javafx.application.Platform.runLater(new Runnable() {

                        /* (non-Javadoc)
                         * @see java.lang.Runnable#run()
                         */
                        @Override
                        public void run() {
                            /* Set the status */
                            statusValInDash.setStyle("-fx-text-fill: green;");

                            if (drop.getText().equals("English")) {
                                statusValInDash.setText("Potentially Protected");
                            } else if (drop.getText().equals("Spanish")
                                    || drop.getText().equals("Portuguese")) {
                                statusValInDash.setText("Potencialmente Protegido");
                            } else if (drop.getText().equals("French")) {
                                statusValInDash.setText("Potentiellement Protg");
                            }

                            VirusScanHistory virusScanHistory = new VirusScanHistory();
                            virusScanHistory.setScanDate(timestamp);
                            virusScanHistory.setScanStatus("SUCCESSFUL");
                            virusScanHistory.setPcName(System.getenv("COMPUTERNAME"));
                            virusScanHistory.setThreatsFound(noOfThreats);

                            virusScanHistoryList.add(virusScanHistory);
                        }
                    });
                } else {
                    c2.setStyle("-fx-background-color:#DF4444");
                    b1.setStyle("-fx-background-color:#373E48");
                    c1.setStyle("-fx-background-color:transparent");
                    b2.setStyle("-fx-background-color:transparent");
                    c3.setStyle("-fx-background-color:transparent");
                    b3.setStyle("-fx-background-color:transparent");
                    c4.setStyle("-fx-background-color:transparent");
                    b4.setStyle("-fx-background-color:transparent");
                    b5.setStyle("-fx-background-color:transparent");
                    b6.setStyle("-fx-background-color:transparent");

                    unprotected.setVisible(true);
                    unprotected.setManaged(true);

                    isProtected.setVisible(false);
                    isProtected.setManaged(false);

                    general.setVisible(false);
                    general.setManaged(false);

                    scann.setVisible(false);
                    scann.setManaged(false);

                    dash.setVisible(false);
                    dash.setManaged(false);

                    his.setVisible(false);
                    his.setManaged(false);

                    about.setVisible(false);
                    about.setManaged(false);

                    update.setVisible(false);
                    update.setManaged(false);

                    javafx.application.Platform.runLater(new Runnable() {

                        /* (non-Javadoc)
                         * @see java.lang.Runnable#run()
                         */
                        @Override
                        public void run() {
                            /* Set the text */
                            statusValInDash.setStyle("-fx-text-fill: red;");

                            if (drop.getText().equals("English")) {
                                statusValInDash.setText(POTENTIALLY_UNPROTECTED);
                            } else if (drop.getText().equals("Spanish")
                                    || drop.getText().equals("Portuguese")) {
                                statusValInDash.setText("Potencialmente Desprotegido");
                            } else if (drop.getText().equals("French")) {
                                statusValInDash.setText("Potentiellement non protg");
                            }

                            VirusScanHistory virusScanHistory = new VirusScanHistory();
                            virusScanHistory.setScanDate(timestamp);
                            virusScanHistory.setScanStatus("FAILED");
                            virusScanHistory.setPcName(System.getenv("COMPUTERNAME"));
                            virusScanHistory.setThreatsFound(noOfThreats);

                            virusScanHistoryList.add(virusScanHistory);
                        }
                    });
                }
                if (virusDetectedMap != null) {
                    virusDetectedMap.clear();
                }
            } else if (handler.getVirusScanStatus() == VirusScanStatus.VIRUS_SCAN_COMPLETED) {

                javafx.application.Platform.runLater(new Runnable() {

                    /* (non-Javadoc)
                     * @see java.lang.Runnable#run()
                     */
                    @Override
                    public void run() {
                        if (textForScanInProgress.getText() != null) {
                            textForScanInProgress.clear();
                        }
                        textForScanInProgress.appendText("Virus scanning is completed");
                        statusValInDash.setStyle("-fx-text-fill: green;");
                        if (drop.getText().equals("English")) {
                            statusValInDash.setText("Potentially Protected");
                        } else if (drop.getText().equals("Spanish") || drop.getText().equals("Portuguese")) {
                            statusValInDash.setText("Potencialmente Protegido");
                        } else if (drop.getText().equals("French")) {
                            statusValInDash.setText("Potentiellement Protg");
                        }
                    }
                });

                showTheProtectedPage();
                isPageProtected = true;

                System.out.println("No viruses are found in scanning");
            }

            handler.setVirusScanStatus(VirusScanStatus.VIRUS_JOB_COMPLETED);

            javafx.application.Platform.runLater(new Runnable() {

                /* (non-Javadoc)
                 * @see java.lang.Runnable#run()
                 */
                @Override
                public void run() {

                    /* Set the values like last-scan, build in Dashboard based on the virus scan results. */
                    if (handler.getVirusScanStatus() == VirusScanStatus.VIRUS_JOB_COMPLETED) {

                        lastScanValInDash.setText(timestamp);
                        if (StringUtils.equals(drop.getText(), "English")) {
                            textForLastScanInHistory.setText("Last Scan: " + timestamp);
                        } else if (StringUtils.equals(drop.getText(), "Spanish")) {
                            textForLastScanInHistory.setText("ltimo escaneo: " + timestamp);
                        } else if (StringUtils.equals(drop.getText(), "French")) {
                            textForLastScanInHistory.setText("Dernier scan: " + timestamp);
                        } else if (StringUtils.equals(drop.getText(), "Portuguese")) {
                            textForLastScanInHistory.setText("ltima anlise: " + timestamp);
                        }

                    } else if (handler.getVirusScanStatus() == VirusScanStatus.VIRUS_SCAN_STOPPED) {

                        statusValInDash.setStyle("-fx-text-fill: red;");

                        if (drop.getText().equals("English")) {
                            statusValInDash.setText(POTENTIALLY_UNPROTECTED);
                        } else if (drop.getText().equals("Spanish") || drop.getText().equals("Portuguese")) {
                            statusValInDash.setText("Potencialmente Desprotegido");
                        } else if (drop.getText().equals("French")) {
                            statusValInDash.setText("Potentiellement non protg");
                        }

                        lastScanValInDash.setText(timestamp);

                    }
                }

            });

            /* Add the scan results to history. */
            processHistoryData();

            return null;
        }
    };
}

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

public CFHBox getPanelHBoxMenu() {
    if (hboxMenu == null) {
        hboxMenu = new CFHBox(10);
        LinkedList<CFButton> list = new LinkedList<CFButton>();

        vboxMenuAdd = new CFVBox(10);
        buttonAddTZTimeType = new CFButton();
        buttonAddTZTimeType.setMinWidth(200);
        buttonAddTZTimeType.setText("Add TZTimeType");
        buttonAddTZTimeType.setOnAction(new EventHandler<ActionEvent>() {
            @Override/*from  www  .  j  a v  a  2s.  c om*/
            public void handle(ActionEvent e) {
                final String S_ProcName = "handle";
                try {
                    ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema();
                    ICFBamTZTimeTypeObj obj = (ICFBamTZTimeTypeObj) schemaObj.getTZTimeTypeTableObj()
                            .newInstance();
                    CFBorderPane frame = javafxSchema.getTZTimeTypeFactory().newAddForm(cfFormManager, obj,
                            getViewEditClosedCallback(), true);
                    ICFBamTZTimeTypeEditObj edit = (ICFBamTZTimeTypeEditObj) (obj.beginEdit());
                    if (edit == null) {
                        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(),
                                S_ProcName, 0, "edit");
                    }
                    ICFSecurityTenantObj secTenant = schemaObj.getSecTenant();
                    edit.setRequiredOwnerTenant(secTenant);
                    ICFBamSchemaDefObj container = (ICFBamSchemaDefObj) (getJavaFXContainer());
                    if (container == null) {
                        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(),
                                S_ProcName, 0, "JavaFXContainer");
                    }
                    edit.setRequiredContainerSchemaDef(container);
                    ICFBamJavaFXTZTimeTypePaneCommon jpanelCommon = (ICFBamJavaFXTZTimeTypePaneCommon) frame;
                    jpanelCommon.setJavaFXFocus(obj);
                    jpanelCommon.setPaneMode(CFPane.PaneMode.Add);
                    cfFormManager.pushForm(frame);
                    setLeft(null);
                    adjustListButtons();
                } catch (Throwable t) {
                    CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t);
                }
            }
        });
        if (javafxContainer instanceof ICFBamSchemaDefObj) {
            list.add(buttonAddTZTimeType);
        }
        buttonAddTZTimeCol = new CFButton();
        buttonAddTZTimeCol.setMinWidth(200);
        buttonAddTZTimeCol.setText("Add TZTimeCol");
        buttonAddTZTimeCol.setOnAction(new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent e) {
                final String S_ProcName = "handle";
                try {
                    ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema();
                    ICFBamTZTimeColObj obj = (ICFBamTZTimeColObj) schemaObj.getTZTimeColTableObj()
                            .newInstance();
                    CFBorderPane frame = javafxSchema.getTZTimeColFactory().newAddForm(cfFormManager, obj,
                            getViewEditClosedCallback(), true);
                    ICFBamTZTimeColEditObj edit = (ICFBamTZTimeColEditObj) (obj.beginEdit());
                    if (edit == null) {
                        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(),
                                S_ProcName, 0, "edit");
                    }
                    ICFSecurityTenantObj secTenant = schemaObj.getSecTenant();
                    edit.setRequiredOwnerTenant(secTenant);
                    ICFBamTableObj container = (ICFBamTableObj) (getJavaFXContainer());
                    if (container == null) {
                        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(),
                                S_ProcName, 0, "JavaFXContainer");
                    }
                    edit.setRequiredContainerTable(container);
                    ICFBamJavaFXTZTimeColPaneCommon jpanelCommon = (ICFBamJavaFXTZTimeColPaneCommon) frame;
                    jpanelCommon.setJavaFXFocus(obj);
                    jpanelCommon.setPaneMode(CFPane.PaneMode.Add);
                    cfFormManager.pushForm(frame);
                    setLeft(null);
                    adjustListButtons();
                } catch (Throwable t) {
                    CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t);
                }
            }
        });
        if (javafxContainer instanceof ICFBamTableObj) {
            list.add(buttonAddTZTimeCol);
        }

        int len = list.size();
        CFButton arr[] = new CFButton[len];
        Iterator<CFButton> iter = list.iterator();
        int idx = 0;
        while (iter.hasNext()) {
            arr[idx++] = iter.next();
        }
        Arrays.sort(arr, new CompareCFButtonByText());
        for (idx = 0; idx < len; idx++) {
            vboxMenuAdd.getChildren().add(arr[idx]);
        }

        buttonCancelAdd = new CFButton();
        buttonCancelAdd.setMinWidth(200);
        buttonCancelAdd.setText("Cancel Add...");
        buttonCancelAdd.setOnAction(new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent e) {
                final String S_ProcName = "handle";
                try {
                    setLeft(null);
                    adjustListButtons();
                } catch (Throwable t) {
                    CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t);
                }
            }
        });
        vboxMenuAdd.getChildren().add(buttonCancelAdd);

        scrollMenuAdd = new ScrollPane();
        scrollMenuAdd.setMinWidth(240);
        scrollMenuAdd.setMaxWidth(240);
        scrollMenuAdd.setFitToWidth(true);
        scrollMenuAdd.setHbarPolicy(ScrollBarPolicy.NEVER);
        scrollMenuAdd.setVbarPolicy(ScrollBarPolicy.AS_NEEDED);
        scrollMenuAdd.setContent(vboxMenuAdd);

        buttonAdd = new CFButton();
        buttonAdd.setMinWidth(200);
        buttonAdd.setText("Add...");
        buttonAdd.setOnAction(new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent e) {
                final String S_ProcName = "handle";
                try {
                    setLeft(scrollMenuAdd);
                    adjustListButtons();
                } catch (Throwable t) {
                    CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t);
                }
            }
        });
        hboxMenu.getChildren().add(buttonAdd);

        buttonViewSelected = new CFButton();
        buttonViewSelected.setMinWidth(200);
        buttonViewSelected.setText("View Selected");
        buttonViewSelected.setOnAction(new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent e) {
                final String S_ProcName = "handle";
                try {
                    ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema();
                    if (schemaObj == null) {
                        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(),
                                S_ProcName, 0, "schemaObj");
                    }
                    ICFBamTZTimeDefObj selectedInstance = getJavaFXFocusAsTZTimeDef();
                    if (selectedInstance != null) {
                        String classCode = selectedInstance.getClassCode();
                        if ("TMZD".equals(classCode)) {
                            CFBorderPane frame = javafxSchema.getTZTimeDefFactory().newViewEditForm(
                                    cfFormManager, selectedInstance, getViewEditClosedCallback(), false);
                            ((ICFBamJavaFXTZTimeDefPaneCommon) frame).setPaneMode(CFPane.PaneMode.View);
                            cfFormManager.pushForm(frame);
                        } else if ("TMZT".equals(classCode)) {
                            ICFBamTZTimeTypeObj obj = (ICFBamTZTimeTypeObj) selectedInstance;
                            CFBorderPane frame = javafxSchema.getTZTimeTypeFactory()
                                    .newViewEditForm(cfFormManager, obj, getViewEditClosedCallback(), false);
                            ((ICFBamJavaFXTZTimeTypePaneCommon) frame).setPaneMode(CFPane.PaneMode.View);
                            cfFormManager.pushForm(frame);
                        } else if ("TMZC".equals(classCode)) {
                            ICFBamTZTimeColObj obj = (ICFBamTZTimeColObj) selectedInstance;
                            CFBorderPane frame = javafxSchema.getTZTimeColFactory()
                                    .newViewEditForm(cfFormManager, obj, getViewEditClosedCallback(), false);
                            ((ICFBamJavaFXTZTimeColPaneCommon) frame).setPaneMode(CFPane.PaneMode.View);
                            cfFormManager.pushForm(frame);
                        } else {
                            throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(),
                                    S_ProcName, "selectedInstance", selectedInstance,
                                    "ICFBamTZTimeDefObj, ICFBamTZTimeTypeObj, ICFBamTZTimeColObj");
                        }
                    }
                } catch (Throwable t) {
                    CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t);
                }
            }
        });
        hboxMenu.getChildren().add(buttonViewSelected);

        buttonEditSelected = new CFButton();
        buttonEditSelected.setMinWidth(200);
        buttonEditSelected.setText("Edit Selected");
        buttonEditSelected.setOnAction(new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent e) {
                final String S_ProcName = "handle";
                try {
                    ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema();
                    if (schemaObj == null) {
                        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(),
                                S_ProcName, 0, "schemaObj");
                    }
                    ICFBamTZTimeDefObj selectedInstance = getJavaFXFocusAsTZTimeDef();
                    if (selectedInstance != null) {
                        String classCode = selectedInstance.getClassCode();
                        if ("TMZD".equals(classCode)) {
                            CFBorderPane frame = javafxSchema.getTZTimeDefFactory().newViewEditForm(
                                    cfFormManager, selectedInstance, getViewEditClosedCallback(), false);
                            ((ICFBamJavaFXTZTimeDefPaneCommon) frame).setPaneMode(CFPane.PaneMode.Edit);
                            cfFormManager.pushForm(frame);
                        } else if ("TMZT".equals(classCode)) {
                            ICFBamTZTimeTypeObj obj = (ICFBamTZTimeTypeObj) selectedInstance;
                            CFBorderPane frame = javafxSchema.getTZTimeTypeFactory()
                                    .newViewEditForm(cfFormManager, obj, getViewEditClosedCallback(), false);
                            ((ICFBamJavaFXTZTimeTypePaneCommon) frame).setPaneMode(CFPane.PaneMode.Edit);
                            cfFormManager.pushForm(frame);
                        } else if ("TMZC".equals(classCode)) {
                            ICFBamTZTimeColObj obj = (ICFBamTZTimeColObj) selectedInstance;
                            CFBorderPane frame = javafxSchema.getTZTimeColFactory()
                                    .newViewEditForm(cfFormManager, obj, getViewEditClosedCallback(), false);
                            ((ICFBamJavaFXTZTimeColPaneCommon) frame).setPaneMode(CFPane.PaneMode.Edit);
                            cfFormManager.pushForm(frame);
                        } else {
                            throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(),
                                    S_ProcName, "selectedInstance", selectedInstance,
                                    "ICFBamTZTimeDefObj, ICFBamTZTimeTypeObj, ICFBamTZTimeColObj");
                        }
                    }
                } catch (Throwable t) {
                    CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t);
                }
            }
        });
        hboxMenu.getChildren().add(buttonEditSelected);

        buttonDeleteSelected = new CFButton();
        buttonDeleteSelected.setMinWidth(200);
        buttonDeleteSelected.setText("Delete Selected");
        buttonDeleteSelected.setOnAction(new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent e) {
                final String S_ProcName = "handle";
                try {
                    ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema();
                    if (schemaObj == null) {
                        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(),
                                S_ProcName, 0, "schemaObj");
                    }
                    ICFBamTZTimeDefObj selectedInstance = getJavaFXFocusAsTZTimeDef();
                    if (selectedInstance != null) {
                        String classCode = selectedInstance.getClassCode();
                        if ("TMZD".equals(classCode)) {
                            CFBorderPane frame = javafxSchema.getTZTimeDefFactory()
                                    .newAskDeleteForm(cfFormManager, selectedInstance, getDeleteCallback());
                            ((ICFBamJavaFXTZTimeDefPaneCommon) frame).setPaneMode(CFPane.PaneMode.View);
                            cfFormManager.pushForm(frame);
                        } else if ("TMZT".equals(classCode)) {
                            ICFBamTZTimeTypeObj obj = (ICFBamTZTimeTypeObj) selectedInstance;
                            CFBorderPane frame = javafxSchema.getTZTimeTypeFactory()
                                    .newAskDeleteForm(cfFormManager, obj, getDeleteCallback());
                            ((ICFBamJavaFXTZTimeTypePaneCommon) frame).setPaneMode(CFPane.PaneMode.View);
                            cfFormManager.pushForm(frame);
                        } else if ("TMZC".equals(classCode)) {
                            ICFBamTZTimeColObj obj = (ICFBamTZTimeColObj) selectedInstance;
                            CFBorderPane frame = javafxSchema.getTZTimeColFactory()
                                    .newAskDeleteForm(cfFormManager, obj, getDeleteCallback());
                            ((ICFBamJavaFXTZTimeColPaneCommon) frame).setPaneMode(CFPane.PaneMode.View);
                            cfFormManager.pushForm(frame);
                        } else {
                            throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(),
                                    S_ProcName, "selectedInstance", selectedInstance,
                                    "ICFBamTZTimeDefObj, ICFBamTZTimeTypeObj, ICFBamTZTimeColObj");
                        }
                    }
                } catch (Throwable t) {
                    CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t);
                }
            }
        });
        hboxMenu.getChildren().add(buttonDeleteSelected);

    }
    return (hboxMenu);
}

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

public CFHBox getPanelHBoxMenu() {
    if (hboxMenu == null) {
        hboxMenu = new CFHBox(10);
        buttonAddUuidGen = new CFButton();
        buttonAddUuidGen.setMinWidth(200);
        buttonAddUuidGen.setText("Add UuidGen");
        buttonAddUuidGen.setOnAction(new EventHandler<ActionEvent>() {
            @Override// w  ww .ja  va2 s  . c  o m
            public void handle(ActionEvent e) {
                final String S_ProcName = "handle";
                try {
                    ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema();
                    ICFBamUuidGenObj obj = (ICFBamUuidGenObj) schemaObj.getUuidGenTableObj().newInstance();
                    ICFBamUuidGenEditObj edit = (ICFBamUuidGenEditObj) (obj.beginEdit());
                    if (edit == null) {
                        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(),
                                S_ProcName, 0, "edit");
                    }
                    ICFSecurityTenantObj secTenant = schemaObj.getSecTenant();
                    edit.setRequiredOwnerTenant(secTenant);
                    ICFBamSchemaDefObj container = (ICFBamSchemaDefObj) (getJavaFXContainer());
                    if (container == null) {
                        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(),
                                S_ProcName, 0, "JavaFXContainer");
                    }
                    edit.setRequiredContainerSchemaDef(container);
                    CFBorderPane frame = javafxSchema.getUuidGenFactory().newAddForm(cfFormManager, obj,
                            getViewEditClosedCallback(), true);
                    ICFBamJavaFXUuidGenPaneCommon jpanelCommon = (ICFBamJavaFXUuidGenPaneCommon) frame;
                    jpanelCommon.setJavaFXFocus(obj);
                    jpanelCommon.setPaneMode(CFPane.PaneMode.Add);
                    cfFormManager.pushForm(frame);
                } catch (Throwable t) {
                    CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t);
                }
            }
        });
        hboxMenu.getChildren().add(buttonAddUuidGen);
        buttonViewSelected = new CFButton();
        buttonViewSelected.setMinWidth(200);
        buttonViewSelected.setText("View Selected");
        buttonViewSelected.setOnAction(new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent e) {
                final String S_ProcName = "handle";
                try {
                    ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema();
                    if (schemaObj == null) {
                        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(),
                                S_ProcName, 0, "schemaObj");
                    }
                    ICFBamUuidGenObj selectedInstance = getJavaFXFocusAsUuidGen();
                    if (selectedInstance != null) {
                        String classCode = selectedInstance.getClassCode();
                        if ("IGUU".equals(classCode)) {
                            CFBorderPane frame = javafxSchema.getUuidGenFactory().newViewEditForm(cfFormManager,
                                    selectedInstance, getViewEditClosedCallback(), false);
                            ((ICFBamJavaFXUuidGenPaneCommon) frame).setPaneMode(CFPane.PaneMode.View);
                            cfFormManager.pushForm(frame);
                        } else {
                            throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(),
                                    S_ProcName, "selectedInstance", selectedInstance, "ICFBamUuidGenObj");
                        }
                    }
                } catch (Throwable t) {
                    CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t);
                }
            }
        });
        hboxMenu.getChildren().add(buttonViewSelected);

        buttonEditSelected = new CFButton();
        buttonEditSelected.setMinWidth(200);
        buttonEditSelected.setText("Edit Selected");
        buttonEditSelected.setOnAction(new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent e) {
                final String S_ProcName = "handle";
                try {
                    ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema();
                    if (schemaObj == null) {
                        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(),
                                S_ProcName, 0, "schemaObj");
                    }
                    ICFBamUuidGenObj selectedInstance = getJavaFXFocusAsUuidGen();
                    if (selectedInstance != null) {
                        String classCode = selectedInstance.getClassCode();
                        if ("IGUU".equals(classCode)) {
                            CFBorderPane frame = javafxSchema.getUuidGenFactory().newViewEditForm(cfFormManager,
                                    selectedInstance, getViewEditClosedCallback(), false);
                            ((ICFBamJavaFXUuidGenPaneCommon) frame).setPaneMode(CFPane.PaneMode.Edit);
                            cfFormManager.pushForm(frame);
                        } else {
                            throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(),
                                    S_ProcName, "selectedInstance", selectedInstance, "ICFBamUuidGenObj");
                        }
                    }
                } catch (Throwable t) {
                    CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t);
                }
            }
        });
        hboxMenu.getChildren().add(buttonEditSelected);

        buttonDeleteSelected = new CFButton();
        buttonDeleteSelected.setMinWidth(200);
        buttonDeleteSelected.setText("Delete Selected");
        buttonDeleteSelected.setOnAction(new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent e) {
                final String S_ProcName = "handle";
                try {
                    ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema();
                    if (schemaObj == null) {
                        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(),
                                S_ProcName, 0, "schemaObj");
                    }
                    ICFBamUuidGenObj selectedInstance = getJavaFXFocusAsUuidGen();
                    if (selectedInstance != null) {
                        String classCode = selectedInstance.getClassCode();
                        if ("IGUU".equals(classCode)) {
                            CFBorderPane frame = javafxSchema.getUuidGenFactory()
                                    .newAskDeleteForm(cfFormManager, selectedInstance, getDeleteCallback());
                            ((ICFBamJavaFXUuidGenPaneCommon) frame).setPaneMode(CFPane.PaneMode.View);
                            cfFormManager.pushForm(frame);
                        } else {
                            throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(),
                                    S_ProcName, "selectedInstance", selectedInstance, "ICFBamUuidGenObj");
                        }
                    }
                } catch (Throwable t) {
                    CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t);
                }
            }
        });
        hboxMenu.getChildren().add(buttonDeleteSelected);

    }
    return (hboxMenu);
}

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

public CFHBox getPanelHBoxMenu() {
    if (hboxMenu == null) {
        hboxMenu = new CFHBox(10);
        buttonAddInt64Col = new CFButton();
        buttonAddInt64Col.setMinWidth(200);
        buttonAddInt64Col.setText("Add Int64Col");
        buttonAddInt64Col.setOnAction(new EventHandler<ActionEvent>() {
            @Override/*from  w  ww.  ja va  2 s  . c o  m*/
            public void handle(ActionEvent e) {
                final String S_ProcName = "handle";
                try {
                    ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema();
                    ICFBamInt64ColObj obj = (ICFBamInt64ColObj) schemaObj.getInt64ColTableObj().newInstance();
                    ICFBamInt64ColEditObj edit = (ICFBamInt64ColEditObj) (obj.beginEdit());
                    if (edit == null) {
                        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(),
                                S_ProcName, 0, "edit");
                    }
                    ICFSecurityTenantObj secTenant = schemaObj.getSecTenant();
                    edit.setRequiredOwnerTenant(secTenant);
                    ICFBamTableObj container = (ICFBamTableObj) (getJavaFXContainer());
                    if (container == null) {
                        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(),
                                S_ProcName, 0, "JavaFXContainer");
                    }
                    edit.setRequiredContainerTable(container);
                    CFBorderPane frame = javafxSchema.getInt64ColFactory().newAddForm(cfFormManager, obj,
                            getViewEditClosedCallback(), true);
                    ICFBamJavaFXInt64ColPaneCommon jpanelCommon = (ICFBamJavaFXInt64ColPaneCommon) frame;
                    jpanelCommon.setJavaFXFocus(obj);
                    jpanelCommon.setPaneMode(CFPane.PaneMode.Add);
                    cfFormManager.pushForm(frame);
                } catch (Throwable t) {
                    CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t);
                }
            }
        });
        hboxMenu.getChildren().add(buttonAddInt64Col);
        buttonViewSelected = new CFButton();
        buttonViewSelected.setMinWidth(200);
        buttonViewSelected.setText("View Selected");
        buttonViewSelected.setOnAction(new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent e) {
                final String S_ProcName = "handle";
                try {
                    ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema();
                    if (schemaObj == null) {
                        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(),
                                S_ProcName, 0, "schemaObj");
                    }
                    ICFBamInt64ColObj selectedInstance = getJavaFXFocusAsInt64Col();
                    if (selectedInstance != null) {
                        String classCode = selectedInstance.getClassCode();
                        if ("I64C".equals(classCode)) {
                            CFBorderPane frame = javafxSchema.getInt64ColFactory().newViewEditForm(
                                    cfFormManager, selectedInstance, getViewEditClosedCallback(), false);
                            ((ICFBamJavaFXInt64ColPaneCommon) frame).setPaneMode(CFPane.PaneMode.View);
                            cfFormManager.pushForm(frame);
                        } else {
                            throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(),
                                    S_ProcName, "selectedInstance", selectedInstance, "ICFBamInt64ColObj");
                        }
                    }
                } catch (Throwable t) {
                    CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t);
                }
            }
        });
        hboxMenu.getChildren().add(buttonViewSelected);

        buttonEditSelected = new CFButton();
        buttonEditSelected.setMinWidth(200);
        buttonEditSelected.setText("Edit Selected");
        buttonEditSelected.setOnAction(new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent e) {
                final String S_ProcName = "handle";
                try {
                    ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema();
                    if (schemaObj == null) {
                        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(),
                                S_ProcName, 0, "schemaObj");
                    }
                    ICFBamInt64ColObj selectedInstance = getJavaFXFocusAsInt64Col();
                    if (selectedInstance != null) {
                        String classCode = selectedInstance.getClassCode();
                        if ("I64C".equals(classCode)) {
                            CFBorderPane frame = javafxSchema.getInt64ColFactory().newViewEditForm(
                                    cfFormManager, selectedInstance, getViewEditClosedCallback(), false);
                            ((ICFBamJavaFXInt64ColPaneCommon) frame).setPaneMode(CFPane.PaneMode.Edit);
                            cfFormManager.pushForm(frame);
                        } else {
                            throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(),
                                    S_ProcName, "selectedInstance", selectedInstance, "ICFBamInt64ColObj");
                        }
                    }
                } catch (Throwable t) {
                    CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t);
                }
            }
        });
        hboxMenu.getChildren().add(buttonEditSelected);

        buttonDeleteSelected = new CFButton();
        buttonDeleteSelected.setMinWidth(200);
        buttonDeleteSelected.setText("Delete Selected");
        buttonDeleteSelected.setOnAction(new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent e) {
                final String S_ProcName = "handle";
                try {
                    ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema();
                    if (schemaObj == null) {
                        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(),
                                S_ProcName, 0, "schemaObj");
                    }
                    ICFBamInt64ColObj selectedInstance = getJavaFXFocusAsInt64Col();
                    if (selectedInstance != null) {
                        String classCode = selectedInstance.getClassCode();
                        if ("I64C".equals(classCode)) {
                            CFBorderPane frame = javafxSchema.getInt64ColFactory()
                                    .newAskDeleteForm(cfFormManager, selectedInstance, getDeleteCallback());
                            ((ICFBamJavaFXInt64ColPaneCommon) frame).setPaneMode(CFPane.PaneMode.View);
                            cfFormManager.pushForm(frame);
                        } else {
                            throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(),
                                    S_ProcName, "selectedInstance", selectedInstance, "ICFBamInt64ColObj");
                        }
                    }
                } catch (Throwable t) {
                    CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t);
                }
            }
        });
        hboxMenu.getChildren().add(buttonDeleteSelected);

    }
    return (hboxMenu);
}