Example usage for javafx.beans.value ChangeListener ChangeListener

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

Introduction

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

Prototype

ChangeListener

Source Link

Usage

From source file:sopho.Ofeloumenoi.EditOfeloumenoiController.java

@Override
public void initialize(URL url, ResourceBundle rb) {

    tekna.addEventHandler(MouseEvent.MOUSE_CLICKED, new EventHandler<MouseEvent>() {

        @Override/*  w w w.  j a  va  2s  . com*/
        public void handle(MouseEvent event) {
            if (prefs.getPrefs("tableTipOfeloumenoi").equals("true")) {
                sopho.Messages.CustomMessageController cm = new sopho.Messages.CustomMessageController(null,
                        "?",
                        "  ?       '?  '  ?  . ? ?    enter   ?  .         .",
                        "notify");
                cm.showAndWait();
                prefs.setPrefs("tableTipOfeloumenoi", "false");
            }
        }
    });

    //initialize oikKatastasi combobox
    oikKatastasi.getItems().addAll("", "", "", "?");

    //initialize asfForeas comboBox
    asfForeas.getItems().addAll("", "", "", "", "",
            "", "", "", "  ", "");

    try {

        rs.first();//move the cursor to the first row
        if (selectedIndex > 0) {//only if we need to move from the first line
            rs.relative(selectedIndex);//move to the row that we selected at the previous scene
        }

        //keep the selected ofeloumenos id
        selID = rs.getInt("id");

        System.out.println("The selected rs row is " + rs.getRow());

        oldBarcode = rs.getString("barcode");

        //now we will set all the fields using the data from database
        barcode.setText(rs.getString("barcode"));
        eponimo.setText(rs.getString("eponimo"));
        onoma.setText(rs.getString("onoma"));
        patronimo.setText(rs.getString("patronimo"));
        mitronimo.setText(rs.getString("mitronimo"));

        if (rs.getDate("imGennisis") != null) {
            imGennisis.setValue(rs.getDate("imGennisis").toLocalDate());
        }

        dieuthinsi.setText(rs.getString("dieuthinsi"));
        dimos.setText(rs.getString("dimos"));
        tilefono.setText(rs.getString("tilefono"));
        anergos.setSelected((rs.getInt("anergos") != 0)); //if 0 set false, else set true
        epaggelma.setText(rs.getString("epaggelma"));
        eisodima.setText(rs.getString("eisodima"));
        eksartiseis.setText(rs.getString("eksartiseis"));

        PhotoID = rs.getString("PhotoID");
        if (PhotoID != null) {
            //we have a picture stored at the database.
            BufferedImage bf = bfImage(PhotoID);

            if (bf != null) {
                Image im = SwingFXUtils.toFXImage(bf, null);
                image.setImage(im);
            }

            //and we set the button bellow image to " ?"
            changePhotoButton.setText(" ?");
        }

        afm.setText(rs.getString("afm"));
        tautotita.setText(rs.getString("tautotita"));
        ethnikotita.setText(rs.getString("ethnikotita"));
        metanastis.setSelected(rs.getInt("metanastis") != 0);
        roma.setSelected(rs.getInt("roma") != 0);
        int oikKatIndex = rs.getInt("oikKatastasi");
        if (oikKatIndex >= 0) {
            oikKatastasi.getSelectionModel().select(oikKatIndex);
        }

        //we add data to tekna table using the tableManager class bellow

        politeknos.setSelected(rs.getInt("politeknos") != 0);
        monogoneiki.setSelected(rs.getInt("monogoneiki") != 0);
        mellousaMama.setSelected(rs.getInt("mellousaMama") != 0);
        amea.setSelected(rs.getInt("amea") != 0);
        int asfForeasIndex = rs.getInt("asfForeas");
        if (asfForeasIndex >= 0) {
            asfForeas.getSelectionModel().select(asfForeasIndex);
        }
        xronios.setSelected(rs.getInt("xronios") != 0);
        pathisi.setText(rs.getString("pathisi"));
        anoTon60.setSelected(rs.getInt("anoTon60") != 0);
        monaxiko.setSelected(rs.getInt("monaxikos") != 0);
        emfiliVia.setSelected(rs.getInt("emfiliVia") != 0);
        spoudastis.setSelected(rs.getInt("spoudastis") != 0);
        int anenergosFlag = rs.getInt("anenergos");
        if (anenergosFlag == 1) {
            barcode.setStyle("-fx-background-color: #cc334a; -fx-text-fill:white;");
        }
        anenergos.setSelected(anenergosFlag != 0);
        loipa.setText(rs.getString("loipa"));

    } catch (SQLException ex) {
        Logger.getLogger(EditOfeloumenoiController.class.getName()).log(Level.SEVERE, null, ex);
    }

    //adding a listener to anenergos checkbox to know if the user checks it
    anenergos.selectedProperty().addListener(new ChangeListener<Boolean>() {
        @Override
        public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) {
            if (newValue) {
                barcode.setStyle("-fx-background-color: #cc334a; -fx-text-fill:white;");
                if (showAnenergosTip.equals("true")) {
                    sopho.Messages.CustomMessageController cm = new sopho.Messages.CustomMessageController(null,
                            "?...",
                            "  ?   ?,    barcode      ?    ?   ? ?  ?? ?.        !",
                            "confirm");
                    cm.showAndWait();
                    prefs.setPrefs("showAnenergosTip", "false");
                }
            } else {
                barcode.setStyle("");
            }
        }
    });

    //we use a listener to know if the user adds a photo using the TakePhoto class
    PhotoListener.strProperty().addListener(new ChangeListener() {
        @Override
        public void changed(ObservableValue o, Object oldVal, Object newVal) {
            PhotoID = (String) newVal;
            BufferedImage bf = bfImage(PhotoID);

            if (bf != null) {
                Image im = SwingFXUtils.toFXImage(bf, null);
                image.setImage(im);
            }
        }
    });

    //initialzing tekna table
    data = getInitialTableData();

    tekna.setItems(data);
    tekna.setEditable(true);
    etosCol.setCellValueFactory(new PropertyValueFactory<tableManager, String>("etos"));

    //lets make the table cells editable
    etosCol.setCellFactory(TextFieldTableCell.forTableColumn());
    etosCol.setOnEditCommit(new EventHandler<CellEditEvent<tableManager, String>>() {

        @Override
        public void handle(CellEditEvent<tableManager, String> t) {
            if (!NumberUtils.isNumber(t.getNewValue())) {
                sopho.Messages.CustomMessageController cm = new sopho.Messages.CustomMessageController(null,
                        "?!",
                        "      ?  ?  ??. ?    ?  .",
                        "error");
                cm.showAndWait();
                ((tableManager) t.getTableView().getItems().get(t.getTablePosition().getRow()))
                        .setEtos("?  ");
            } else {
                ((tableManager) t.getTableView().getItems().get(t.getTablePosition().getRow()))
                        .setEtos(t.getNewValue());
            }
        }
    });

    tekna.getColumns().setAll(etosCol);
    //end of initialization of tekna table

}

From source file:caillou.company.clonemanager.gui.customComponent.results.ResultController.java

private void initializePhaseAutomaticResizing() {
    splittedPanelId.prefHeightProperty().bind(mainContainerPanelID.heightProperty());
    splittedPanelId.prefWidthProperty().bind(mainContainerPanelID.widthProperty());
    resultViewId.prefHeightProperty().bind(splittedPanelId.heightProperty().subtract(2));

    resultViewId.heightProperty().addListener(new ChangeListener<Number>() {
        @Override/*w ww  .  j a  v a2  s .  c  o m*/
        public void changed(ObservableValue<? extends Number> observable, Number oldValue, Number newValue) {
            Double columnHashPositionWidth = 45.0;
            Double columnFileWidth = (resultViewId.getWidth() * 0.4) - 1;
            Double columnSizeWidth = (resultViewId.getWidth() * 0.2) - 23 - 1;
            Double columnGroupWidth = resultViewId.getWidth() * 0.15 - 22;
            Double md5PrintIdWidth = (resultViewId.getWidth() * 0.25) - 1;

            columnFile.setPrefWidth(columnFileWidth);
            columnSize.setPrefWidth(columnSizeWidth);
            columnGroup.setPrefWidth(columnGroupWidth);
            md5PrintId.setPrefWidth(md5PrintIdWidth);
            columnHashPosition.setPrefWidth(columnHashPositionWidth);
        }
    });

    SplitPane.setResizableWithParent(accordionPaneId, Boolean.FALSE);
}

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

@Override
public void initialize(URL url, ResourceBundle resourceBundle) {
    instance = this;

    txtDataSetFilter.textProperty().addListener((observableValue, s, s2) -> refillListOfDataSets());

    comboBoxApplicationIniFiles.getSelectionModel().selectedItemProperty().addListener(
            (observableValue, old, newValue) -> selectedApplicationIniChanged(newValue.toString()));
    comboBoxApplicationIniFiles.getItems()
            .addAll(RoddyIOHelperMethods.readTextFile(getUiSettingsFileForIniFiles()));

    projectTree.setCellFactory(treeView -> new ProjectTreeItemCellImplementation(projectTree, instance));
    projectTree.getSelectionModel().selectedItemProperty()
            .addListener((observableValue, oldValue, newValue) -> {
                TreeItem<FXICCWrapper> pWrapper = (TreeItem<FXICCWrapper>) projectTree.getSelectionModel()
                        .getSelectedItem();
                if (pWrapper == null)
                    return;
                changeSelectedProject(pWrapper.getValue());
            });//from  w  w w . j  av  a2s .c  o  m

    listViewDataSets.setCellFactory(listView -> new GenericListViewItemCellImplementation());
    listViewDataSets.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
    listViewDataSets.getSelectionModel().selectedItemProperty()
            .addListener((observableValue, old, newValue) -> selectedDataSetsChanged());

    currentListOfDataSets.addListener((ListChangeListener<FXDataSetWrapper>) change -> refillListOfDataSets());

    String txtAnalysisIDFilter = Roddy.getApplicationProperty(RunMode.UI, APP_PROPERTY_FILTER_ANALYSISID,
            StringConstants.EMPTY);
    String txtIDFilter = Roddy.getApplicationProperty(RunMode.UI, APP_PROPERTY_FILTER_PROJECTID,
            StringConstants.EMPTY);
    Boolean filterHideUnprocessable = Boolean.parseBoolean(Roddy.getApplicationProperty(RunMode.UI,
            APP_PROPERTY_FILTER_HIDE_UNPROCESSABLE, Boolean.FALSE.toString()));

    txtProjectFilterByAnalysis.setText(txtAnalysisIDFilter);
    txtProjectFilterByID.setText(txtIDFilter);
    txtProjectFilterByAnalysis.textProperty()
            .addListener((observableValue, oldValue, newValue) -> refreshProjectView(null));
    txtProjectFilterByID.textProperty()
            .addListener((observableValue, oldValue, newValue) -> refreshProjectView(null));
    cbProjectFilterHideUnprocessable.setSelected(filterHideUnprocessable);

    txtProjectFilterByAnalysis.textProperty().addListener((observableValue, oldValue, newValue) -> Roddy
            .setApplicationProperty(RunMode.UI, APP_PROPERTY_FILTER_ANALYSISID, newValue));
    txtProjectFilterByID.textProperty().addListener((observableValue, oldValue, newValue) -> Roddy
            .setApplicationProperty(RunMode.UI, APP_PROPERTY_FILTER_ANALYSISID, newValue));
    cbProjectFilterHideUnprocessable.selectedProperty()
            .addListener((observableValue, aBoolean, newValue) -> Roddy.setApplicationProperty(RunMode.UI,
                    APP_PROPERTY_FILTER_HIDE_UNPROCESSABLE, newValue.toString()));

    setupTitlePaneExpansionProcessing(tpProjectFilterSettings, APP_PROPERTY_PROJECT_FILTER_SETTINGS_OPENED,
            Boolean.TRUE);
    setupTitlePaneExpansionProcessing(tpProjectSettings, APP_PROPERTY_PROJECT_SETTINGS_OPENED, Boolean.TRUE);
    setupTitlePaneExpansionProcessing(tpProjectDataSetFilter, APP_PROPERTY_PROJECT_DATASET_FILTER_OPENED,
            Boolean.TRUE);

    RoddyUITask.activeListOfTasksProperty().addListener(new ChangeListener() {
        @Override
        public void changed(ObservableValue observable, Object oldValue, Object newValue) {
            RoddyUITask.invokeASAP(new Runnable() {
                @Override
                public void run() {
                    listViewOfActiveUITasks.getItems().clear();
                    listViewOfActiveUITasks.getItems().addAll(RoddyUITask.activeListOfTasksProperty().values());
                }
            }, "donttrack::Update tasklist", false);
        }
    });

    startUIUpdateThread();
}

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

public CFBamJavaFXEnumTagPickerPane(ICFFormManager formManager, ICFBamJavaFXSchema argSchema,
        ICFBamEnumTagObj argFocus, ICFBamEnumDefObj argContainer,
        Collection<ICFBamEnumTagObj> argDataCollection, ICFBamJavaFXEnumTagChosen whenChosen) {
    super();/*w w  w  .  j ava2s .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<ICFBamEnumTagObj>();
    tableColumnId = new TableColumn<ICFBamEnumTagObj, Long>("Id");
    tableColumnId.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamEnumTagObj, Long>, ObservableValue<Long>>() {
                public ObservableValue<Long> call(CellDataFeatures<ICFBamEnumTagObj, Long> p) {
                    ICFBamEnumTagObj 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<ICFBamEnumTagObj, Long>, TableCell<ICFBamEnumTagObj, Long>>() {
                @Override
                public TableCell<ICFBamEnumTagObj, Long> call(TableColumn<ICFBamEnumTagObj, Long> arg) {
                    return new CFInt64TableCell<ICFBamEnumTagObj>();
                }
            });
    dataTable.getColumns().add(tableColumnId);
    tableColumnEnumCode = new TableColumn<ICFBamEnumTagObj, Short>("EnumCode");
    tableColumnEnumCode.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamEnumTagObj, Short>, ObservableValue<Short>>() {
                public ObservableValue<Short> call(CellDataFeatures<ICFBamEnumTagObj, Short> p) {
                    ICFBamEnumTagObj obj = p.getValue();
                    if (obj == null) {
                        return (null);
                    } else {
                        Short value = obj.getOptionalEnumCode();
                        ReadOnlyObjectWrapper<Short> observable = new ReadOnlyObjectWrapper<Short>();
                        observable.setValue(value);
                        return (observable);
                    }
                }
            });
    tableColumnEnumCode.setCellFactory(
            new Callback<TableColumn<ICFBamEnumTagObj, Short>, TableCell<ICFBamEnumTagObj, Short>>() {
                @Override
                public TableCell<ICFBamEnumTagObj, Short> call(TableColumn<ICFBamEnumTagObj, Short> arg) {
                    return new CFInt16TableCell<ICFBamEnumTagObj>();
                }
            });
    dataTable.getColumns().add(tableColumnEnumCode);
    tableColumnName = new TableColumn<ICFBamEnumTagObj, String>("Name");
    tableColumnName.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamEnumTagObj, String>, ObservableValue<String>>() {
                public ObservableValue<String> call(CellDataFeatures<ICFBamEnumTagObj, String> p) {
                    ICFBamEnumTagObj 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<ICFBamEnumTagObj, String>, TableCell<ICFBamEnumTagObj, String>>() {
                @Override
                public TableCell<ICFBamEnumTagObj, String> call(TableColumn<ICFBamEnumTagObj, String> arg) {
                    return new CFStringTableCell<ICFBamEnumTagObj>();
                }
            });
    dataTable.getColumns().add(tableColumnName);
    tableColumnLookupDefSchema = new TableColumn<ICFBamEnumTagObj, ICFBamSchemaDefObj>(
            "Defining Schema Definition");
    tableColumnLookupDefSchema.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamEnumTagObj, ICFBamSchemaDefObj>, ObservableValue<ICFBamSchemaDefObj>>() {
                public ObservableValue<ICFBamSchemaDefObj> call(
                        CellDataFeatures<ICFBamEnumTagObj, ICFBamSchemaDefObj> p) {
                    ICFBamEnumTagObj 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<ICFBamEnumTagObj, ICFBamSchemaDefObj>, TableCell<ICFBamEnumTagObj, ICFBamSchemaDefObj>>() {
                @Override
                public TableCell<ICFBamEnumTagObj, ICFBamSchemaDefObj> call(
                        TableColumn<ICFBamEnumTagObj, ICFBamSchemaDefObj> arg) {
                    return new CFReferenceTableCell<ICFBamEnumTagObj, ICFBamSchemaDefObj>();
                }
            });
    dataTable.getColumns().add(tableColumnLookupDefSchema);
    dataTable.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<ICFBamEnumTagObj>() {
        @Override
        public void changed(ObservableValue<? extends ICFBamEnumTagObj> observable, ICFBamEnumTagObj oldValue,
                ICFBamEnumTagObj 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.choseEnumTag(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");
                }
                ICFBamEnumTagObj selectedInstance = getJavaFXFocusAsEnumTag();
                invokeWhenChosen.choseEnumTag(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:retsys.client.controller.DeliveryChallanReturnController.java

/**
 * Initializes the controller class./*  w  w  w  . jav  a 2s .  c o m*/
 */
@Override
public void initialize(URL url, ResourceBundle rb) {
    dc_date.setValue(LocalDate.now());

    material_name.setCellValueFactory(new PropertyValueFactory<DCItem, String>("name"));
    brand_name.setCellValueFactory(new PropertyValueFactory<DCItem, String>("brand"));
    model_code.setCellValueFactory(new PropertyValueFactory<DCItem, String>("model"));
    units.setCellValueFactory(new PropertyValueFactory<DCItem, String>("model"));
    quantity.setCellValueFactory(new PropertyValueFactory<DCItem, Integer>("quantity"));
    amount.setCellValueFactory(new PropertyValueFactory<DCItem, Integer>("amount"));

    dcDetail.getColumns().setAll(material_name, brand_name, model_code, quantity, amount);
    // TODO

    AutoCompletionBinding<Item> bindForTxt_name = TextFields.bindAutoCompletion(txt_name,
            new Callback<AutoCompletionBinding.ISuggestionRequest, Collection<Item>>() {

                @Override
                public Collection<Item> call(AutoCompletionBinding.ISuggestionRequest param) {
                    List<Item> list = null;
                    try {
                        LovHandler lovHandler = new LovHandler("items", "name");
                        String response = lovHandler.getSuggestions(param.getUserText());
                        list = (List<Item>) new JsonHelper().convertJsonStringToObject(response,
                                new TypeReference<List<Item>>() {
                                });
                    } catch (IOException ex) {
                        Logger.getLogger(ProjectController.class.getName()).log(Level.SEVERE, null, ex);
                    }

                    return list;
                }
            }, new StringConverter<Item>() {

                @Override
                public String toString(Item object) {
                    System.out.println("here..." + object);
                    return object.getName() + " (ID:" + object.getId() + ")";
                }

                @Override
                public Item fromString(String string) {
                    throw new UnsupportedOperationException();
                }
            });
    //event handler for setting other item fields with values from selected Item object
    //fires after autocompletion
    bindForTxt_name.setOnAutoCompleted(new EventHandler<AutoCompletionBinding.AutoCompletionEvent<Item>>() {

        @Override
        public void handle(AutoCompletionBinding.AutoCompletionEvent<Item> event) {
            Item item = event.getCompletion();
            //fill other item related fields
            txt_name.setUserData(item.getId());
            txt_brand.setText(item.getBrand());
            txt_model.setText(null); // item doesn't have this field. add??
            txt_rate.setText(String.valueOf(item.getRate()));
        }
    });

    AutoCompletionBinding<DeliveryChallan> bindForProject = TextFields.bindAutoCompletion(project,
            new Callback<AutoCompletionBinding.ISuggestionRequest, Collection<DeliveryChallan>>() {

                @Override
                public Collection<DeliveryChallan> call(AutoCompletionBinding.ISuggestionRequest param) {
                    List<DeliveryChallan> list = null;
                    try {
                        LovHandler lovHandler = new LovHandler("deliverychallans", "name");
                        String response = lovHandler.getSuggestions(param.getUserText());
                        list = (List<DeliveryChallan>) new JsonHelper().convertJsonStringToObject(response,
                                new TypeReference<List<DeliveryChallan>>() {
                                });
                    } catch (IOException ex) {
                        Logger.getLogger(ProjectController.class.getName()).log(Level.SEVERE, null, ex);
                    }

                    return list;
                }
            }, new StringConverter<DeliveryChallan>() {

                @Override
                public String toString(DeliveryChallan object) {
                    System.out.println("here..." + object);

                    String strDate = DateTimeFormatter.ofLocalizedDate(FormatStyle.MEDIUM).format(LocalDateTime
                            .ofInstant(object.getChallanDate().toInstant(), ZoneId.systemDefault()));
                    return "Project:" + object.getProject().getName() + " DC Date:" + strDate + " DC No.:"
                            + object.getId();
                }

                @Override
                public DeliveryChallan fromString(String string) {
                    throw new UnsupportedOperationException();
                }
            });

    bindForProject
            .setOnAutoCompleted(new EventHandler<AutoCompletionBinding.AutoCompletionEvent<DeliveryChallan>>() {

                @Override
                public void handle(AutoCompletionBinding.AutoCompletionEvent<DeliveryChallan> event) {
                    DeliveryChallan dc = event.getCompletion();
                    dc_no.setText(dc.getId().toString());
                    dc_date.setValue(LocalDateTime
                            .ofInstant(dc.getChallanDate().toInstant(), ZoneId.systemDefault()).toLocalDate());
                    dc_no.setText(dc.getId().toString());
                    project.setText(dc.getProject().getName() + " (ID:" + dc.getProject().getId() + ")");
                    deliverymode.setText(dc.getDeliveryMode());
                    concernperson.setText(dc.getConcernPerson());

                    ObservableList<DCItem> items = FXCollections.observableArrayList();
                    Iterator detailsIt = dc.getDeliveryChallanDetail().iterator();
                    while (detailsIt.hasNext()) {
                        DeliveryChallanDetail detail = (DeliveryChallanDetail) detailsIt.next();
                        Item item = detail.getItem();
                        int id = item.getId();
                        String site = item.getSite();
                        String name = item.getName();
                        String brand = item.getBrand();
                        String model = null;
                        int rate = item.getRate().intValue();
                        int quantity = detail.getQuantity();
                        int amount = detail.getAmount();
                        String units = detail.getUnits();

                        items.add(new DCItem(id, name + " (ID:" + id + ")", brand, model, rate, quantity, units,
                                amount));
                    }
                    dcDetail.setItems(items);

                    populateAuditValues(dc);

                }
            });

    txt_qty.focusedProperty().addListener(new ChangeListener<Boolean>() {
        @Override
        public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) {
            if (!newValue) {
                calcAmount();
            }
        }
    });
}

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

public CFBamJavaFXDelDepPickerPane(ICFFormManager formManager, ICFBamJavaFXSchema argSchema,
        ICFBamDelDepObj argFocus, ICFLibAnyObj argContainer, Collection<ICFBamDelDepObj> argDataCollection,
        ICFBamJavaFXDelDepChosen whenChosen) {
    super();// www  . j a  va 2  s .c  om
    final String S_ProcName = "construct-schema-focus";
    if (formManager == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 1,
                "formManager");
    }
    cfFormManager = formManager;
    if (argSchema == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 2,
                "argSchema");
    }
    if (whenChosen == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 6,
                "whenChosen");
    }
    invokeWhenChosen = whenChosen;
    // argFocus is optional; focus may be set later during execution as
    // conditions of the runtime change.
    javafxSchema = argSchema;
    javaFXFocus = argFocus;
    javafxContainer = argContainer;
    setJavaFXDataCollection(argDataCollection);
    dataTable = new TableView<ICFBamDelDepObj>();
    tableColumnObjKind = new TableColumn<ICFBamDelDepObj, String>("Class Code");
    tableColumnObjKind.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamDelDepObj, String>, ObservableValue<String>>() {
                @Override
                public ObservableValue<String> call(CellDataFeatures<ICFBamDelDepObj, String> p) {
                    ICFBamDelDepObj obj = p.getValue();
                    if (obj == null) {
                        return (null);
                    } else {
                        String classCode = obj.getClassCode();
                        ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>();
                        observable.setValue(classCode);
                        return (observable);
                    }
                }
            });
    tableColumnObjKind.setCellFactory(
            new Callback<TableColumn<ICFBamDelDepObj, String>, TableCell<ICFBamDelDepObj, String>>() {
                @Override
                public TableCell<ICFBamDelDepObj, String> call(TableColumn<ICFBamDelDepObj, String> arg) {
                    return new CFStringTableCell<ICFBamDelDepObj>();
                }
            });
    dataTable.getColumns().add(tableColumnObjKind);
    tableColumnId = new TableColumn<ICFBamDelDepObj, Long>("Id");
    tableColumnId.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamDelDepObj, Long>, ObservableValue<Long>>() {
                public ObservableValue<Long> call(CellDataFeatures<ICFBamDelDepObj, Long> p) {
                    ICFBamScopeObj obj = p.getValue();
                    if (obj == null) {
                        return (null);
                    } else {
                        long value = obj.getRequiredId();
                        Long wrapped = new Long(value);
                        ReadOnlyObjectWrapper<Long> observable = new ReadOnlyObjectWrapper<Long>();
                        observable.setValue(wrapped);
                        return (observable);
                    }
                }
            });
    tableColumnId.setCellFactory(
            new Callback<TableColumn<ICFBamDelDepObj, Long>, TableCell<ICFBamDelDepObj, Long>>() {
                @Override
                public TableCell<ICFBamDelDepObj, Long> call(TableColumn<ICFBamDelDepObj, Long> arg) {
                    return new CFInt64TableCell<ICFBamDelDepObj>();
                }
            });
    dataTable.getColumns().add(tableColumnId);
    tableColumnLookupRelation = new TableColumn<ICFBamDelDepObj, ICFBamRelationObj>("Relation");
    tableColumnLookupRelation.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamDelDepObj, ICFBamRelationObj>, ObservableValue<ICFBamRelationObj>>() {
                public ObservableValue<ICFBamRelationObj> call(
                        CellDataFeatures<ICFBamDelDepObj, ICFBamRelationObj> p) {
                    ICFBamDelDepObj obj = p.getValue();
                    if (obj == null) {
                        return (null);
                    } else {
                        ICFBamRelationObj ref = obj.getRequiredLookupRelation();
                        ReadOnlyObjectWrapper<ICFBamRelationObj> observable = new ReadOnlyObjectWrapper<ICFBamRelationObj>();
                        observable.setValue(ref);
                        return (observable);
                    }
                }
            });
    tableColumnLookupRelation.setCellFactory(
            new Callback<TableColumn<ICFBamDelDepObj, ICFBamRelationObj>, TableCell<ICFBamDelDepObj, ICFBamRelationObj>>() {
                @Override
                public TableCell<ICFBamDelDepObj, ICFBamRelationObj> call(
                        TableColumn<ICFBamDelDepObj, ICFBamRelationObj> arg) {
                    return new CFReferenceTableCell<ICFBamDelDepObj, ICFBamRelationObj>();
                }
            });
    dataTable.getColumns().add(tableColumnLookupRelation);
    tableColumnLookupDefSchema = new TableColumn<ICFBamDelDepObj, ICFBamSchemaDefObj>(
            "Defining Schema Definition");
    tableColumnLookupDefSchema.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamDelDepObj, ICFBamSchemaDefObj>, ObservableValue<ICFBamSchemaDefObj>>() {
                public ObservableValue<ICFBamSchemaDefObj> call(
                        CellDataFeatures<ICFBamDelDepObj, ICFBamSchemaDefObj> p) {
                    ICFBamDelDepObj 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<ICFBamDelDepObj, ICFBamSchemaDefObj>, TableCell<ICFBamDelDepObj, ICFBamSchemaDefObj>>() {
                @Override
                public TableCell<ICFBamDelDepObj, ICFBamSchemaDefObj> call(
                        TableColumn<ICFBamDelDepObj, ICFBamSchemaDefObj> arg) {
                    return new CFReferenceTableCell<ICFBamDelDepObj, ICFBamSchemaDefObj>();
                }
            });
    dataTable.getColumns().add(tableColumnLookupDefSchema);
    dataTable.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<ICFBamDelDepObj>() {
        @Override
        public void changed(ObservableValue<? extends ICFBamDelDepObj> observable, ICFBamDelDepObj oldValue,
                ICFBamDelDepObj 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.choseDelDep(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");
                }
                ICFBamDelDepObj selectedInstance = getJavaFXFocusAsDelDep();
                invokeWhenChosen.choseDelDep(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.CFBamJavaFXPopDepPickerPane.java

public CFBamJavaFXPopDepPickerPane(ICFFormManager formManager, ICFBamJavaFXSchema argSchema,
        ICFBamPopDepObj argFocus, ICFLibAnyObj argContainer, Collection<ICFBamPopDepObj> argDataCollection,
        ICFBamJavaFXPopDepChosen whenChosen) {
    super();//ww  w  .j av  a 2s  . c o m
    final String S_ProcName = "construct-schema-focus";
    if (formManager == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 1,
                "formManager");
    }
    cfFormManager = formManager;
    if (argSchema == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 2,
                "argSchema");
    }
    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<ICFBamPopDepObj>();
    tableColumnObjKind = new TableColumn<ICFBamPopDepObj, String>("Class Code");
    tableColumnObjKind.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamPopDepObj, String>, ObservableValue<String>>() {
                @Override
                public ObservableValue<String> call(CellDataFeatures<ICFBamPopDepObj, String> p) {
                    ICFBamPopDepObj obj = p.getValue();
                    if (obj == null) {
                        return (null);
                    } else {
                        String classCode = obj.getClassCode();
                        ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>();
                        observable.setValue(classCode);
                        return (observable);
                    }
                }
            });
    tableColumnObjKind.setCellFactory(
            new Callback<TableColumn<ICFBamPopDepObj, String>, TableCell<ICFBamPopDepObj, String>>() {
                @Override
                public TableCell<ICFBamPopDepObj, String> call(TableColumn<ICFBamPopDepObj, String> arg) {
                    return new CFStringTableCell<ICFBamPopDepObj>();
                }
            });
    dataTable.getColumns().add(tableColumnObjKind);
    tableColumnId = new TableColumn<ICFBamPopDepObj, Long>("Id");
    tableColumnId.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamPopDepObj, Long>, ObservableValue<Long>>() {
                public ObservableValue<Long> call(CellDataFeatures<ICFBamPopDepObj, Long> p) {
                    ICFBamScopeObj obj = p.getValue();
                    if (obj == null) {
                        return (null);
                    } else {
                        long value = obj.getRequiredId();
                        Long wrapped = new Long(value);
                        ReadOnlyObjectWrapper<Long> observable = new ReadOnlyObjectWrapper<Long>();
                        observable.setValue(wrapped);
                        return (observable);
                    }
                }
            });
    tableColumnId.setCellFactory(
            new Callback<TableColumn<ICFBamPopDepObj, Long>, TableCell<ICFBamPopDepObj, Long>>() {
                @Override
                public TableCell<ICFBamPopDepObj, Long> call(TableColumn<ICFBamPopDepObj, Long> arg) {
                    return new CFInt64TableCell<ICFBamPopDepObj>();
                }
            });
    dataTable.getColumns().add(tableColumnId);
    tableColumnLookupRelation = new TableColumn<ICFBamPopDepObj, ICFBamRelationObj>("Relation");
    tableColumnLookupRelation.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamPopDepObj, ICFBamRelationObj>, ObservableValue<ICFBamRelationObj>>() {
                public ObservableValue<ICFBamRelationObj> call(
                        CellDataFeatures<ICFBamPopDepObj, ICFBamRelationObj> p) {
                    ICFBamPopDepObj obj = p.getValue();
                    if (obj == null) {
                        return (null);
                    } else {
                        ICFBamRelationObj ref = obj.getRequiredLookupRelation();
                        ReadOnlyObjectWrapper<ICFBamRelationObj> observable = new ReadOnlyObjectWrapper<ICFBamRelationObj>();
                        observable.setValue(ref);
                        return (observable);
                    }
                }
            });
    tableColumnLookupRelation.setCellFactory(
            new Callback<TableColumn<ICFBamPopDepObj, ICFBamRelationObj>, TableCell<ICFBamPopDepObj, ICFBamRelationObj>>() {
                @Override
                public TableCell<ICFBamPopDepObj, ICFBamRelationObj> call(
                        TableColumn<ICFBamPopDepObj, ICFBamRelationObj> arg) {
                    return new CFReferenceTableCell<ICFBamPopDepObj, ICFBamRelationObj>();
                }
            });
    dataTable.getColumns().add(tableColumnLookupRelation);
    tableColumnLookupDefSchema = new TableColumn<ICFBamPopDepObj, ICFBamSchemaDefObj>(
            "Defining Schema Definition");
    tableColumnLookupDefSchema.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamPopDepObj, ICFBamSchemaDefObj>, ObservableValue<ICFBamSchemaDefObj>>() {
                public ObservableValue<ICFBamSchemaDefObj> call(
                        CellDataFeatures<ICFBamPopDepObj, ICFBamSchemaDefObj> p) {
                    ICFBamPopDepObj 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<ICFBamPopDepObj, ICFBamSchemaDefObj>, TableCell<ICFBamPopDepObj, ICFBamSchemaDefObj>>() {
                @Override
                public TableCell<ICFBamPopDepObj, ICFBamSchemaDefObj> call(
                        TableColumn<ICFBamPopDepObj, ICFBamSchemaDefObj> arg) {
                    return new CFReferenceTableCell<ICFBamPopDepObj, ICFBamSchemaDefObj>();
                }
            });
    dataTable.getColumns().add(tableColumnLookupDefSchema);
    dataTable.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<ICFBamPopDepObj>() {
        @Override
        public void changed(ObservableValue<? extends ICFBamPopDepObj> observable, ICFBamPopDepObj oldValue,
                ICFBamPopDepObj 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.chosePopDep(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");
                }
                ICFBamPopDepObj selectedInstance = getJavaFXFocusAsPopDep();
                invokeWhenChosen.chosePopDep(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.CFBamJavaFXClearDepPickerPane.java

public CFBamJavaFXClearDepPickerPane(ICFFormManager formManager, ICFBamJavaFXSchema argSchema,
        ICFBamClearDepObj argFocus, ICFLibAnyObj argContainer, Collection<ICFBamClearDepObj> argDataCollection,
        ICFBamJavaFXClearDepChosen whenChosen) {
    super();// w ww .j  a  va2  s.  c  o  m
    final String S_ProcName = "construct-schema-focus";
    if (formManager == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 1,
                "formManager");
    }
    cfFormManager = formManager;
    if (argSchema == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 2,
                "argSchema");
    }
    if (whenChosen == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 6,
                "whenChosen");
    }
    invokeWhenChosen = whenChosen;
    // argFocus is optional; focus may be set later during execution as
    // conditions of the runtime change.
    javafxSchema = argSchema;
    javaFXFocus = argFocus;
    javafxContainer = argContainer;
    setJavaFXDataCollection(argDataCollection);
    dataTable = new TableView<ICFBamClearDepObj>();
    tableColumnObjKind = new TableColumn<ICFBamClearDepObj, String>("Class Code");
    tableColumnObjKind.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamClearDepObj, String>, ObservableValue<String>>() {
                @Override
                public ObservableValue<String> call(CellDataFeatures<ICFBamClearDepObj, String> p) {
                    ICFBamClearDepObj obj = p.getValue();
                    if (obj == null) {
                        return (null);
                    } else {
                        String classCode = obj.getClassCode();
                        ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>();
                        observable.setValue(classCode);
                        return (observable);
                    }
                }
            });
    tableColumnObjKind.setCellFactory(
            new Callback<TableColumn<ICFBamClearDepObj, String>, TableCell<ICFBamClearDepObj, String>>() {
                @Override
                public TableCell<ICFBamClearDepObj, String> call(TableColumn<ICFBamClearDepObj, String> arg) {
                    return new CFStringTableCell<ICFBamClearDepObj>();
                }
            });
    dataTable.getColumns().add(tableColumnObjKind);
    tableColumnId = new TableColumn<ICFBamClearDepObj, Long>("Id");
    tableColumnId.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamClearDepObj, Long>, ObservableValue<Long>>() {
                public ObservableValue<Long> call(CellDataFeatures<ICFBamClearDepObj, Long> p) {
                    ICFBamScopeObj obj = p.getValue();
                    if (obj == null) {
                        return (null);
                    } else {
                        long value = obj.getRequiredId();
                        Long wrapped = new Long(value);
                        ReadOnlyObjectWrapper<Long> observable = new ReadOnlyObjectWrapper<Long>();
                        observable.setValue(wrapped);
                        return (observable);
                    }
                }
            });
    tableColumnId.setCellFactory(
            new Callback<TableColumn<ICFBamClearDepObj, Long>, TableCell<ICFBamClearDepObj, Long>>() {
                @Override
                public TableCell<ICFBamClearDepObj, Long> call(TableColumn<ICFBamClearDepObj, Long> arg) {
                    return new CFInt64TableCell<ICFBamClearDepObj>();
                }
            });
    dataTable.getColumns().add(tableColumnId);
    tableColumnLookupRelation = new TableColumn<ICFBamClearDepObj, ICFBamRelationObj>("Relation");
    tableColumnLookupRelation.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamClearDepObj, ICFBamRelationObj>, ObservableValue<ICFBamRelationObj>>() {
                public ObservableValue<ICFBamRelationObj> call(
                        CellDataFeatures<ICFBamClearDepObj, ICFBamRelationObj> p) {
                    ICFBamClearDepObj obj = p.getValue();
                    if (obj == null) {
                        return (null);
                    } else {
                        ICFBamRelationObj ref = obj.getRequiredLookupRelation();
                        ReadOnlyObjectWrapper<ICFBamRelationObj> observable = new ReadOnlyObjectWrapper<ICFBamRelationObj>();
                        observable.setValue(ref);
                        return (observable);
                    }
                }
            });
    tableColumnLookupRelation.setCellFactory(
            new Callback<TableColumn<ICFBamClearDepObj, ICFBamRelationObj>, TableCell<ICFBamClearDepObj, ICFBamRelationObj>>() {
                @Override
                public TableCell<ICFBamClearDepObj, ICFBamRelationObj> call(
                        TableColumn<ICFBamClearDepObj, ICFBamRelationObj> arg) {
                    return new CFReferenceTableCell<ICFBamClearDepObj, ICFBamRelationObj>();
                }
            });
    dataTable.getColumns().add(tableColumnLookupRelation);
    tableColumnLookupDefSchema = new TableColumn<ICFBamClearDepObj, ICFBamSchemaDefObj>(
            "Defining Schema Definition");
    tableColumnLookupDefSchema.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamClearDepObj, ICFBamSchemaDefObj>, ObservableValue<ICFBamSchemaDefObj>>() {
                public ObservableValue<ICFBamSchemaDefObj> call(
                        CellDataFeatures<ICFBamClearDepObj, ICFBamSchemaDefObj> p) {
                    ICFBamClearDepObj 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<ICFBamClearDepObj, ICFBamSchemaDefObj>, TableCell<ICFBamClearDepObj, ICFBamSchemaDefObj>>() {
                @Override
                public TableCell<ICFBamClearDepObj, ICFBamSchemaDefObj> call(
                        TableColumn<ICFBamClearDepObj, ICFBamSchemaDefObj> arg) {
                    return new CFReferenceTableCell<ICFBamClearDepObj, ICFBamSchemaDefObj>();
                }
            });
    dataTable.getColumns().add(tableColumnLookupDefSchema);
    dataTable.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<ICFBamClearDepObj>() {
        @Override
        public void changed(ObservableValue<? extends ICFBamClearDepObj> observable, ICFBamClearDepObj oldValue,
                ICFBamClearDepObj 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.choseClearDep(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");
                }
                ICFBamClearDepObj selectedInstance = getJavaFXFocusAsClearDep();
                invokeWhenChosen.choseClearDep(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.CFBamJavaFXDelTopDepPickerPane.java

public CFBamJavaFXDelTopDepPickerPane(ICFFormManager formManager, ICFBamJavaFXSchema argSchema,
        ICFBamDelTopDepObj argFocus, ICFBamTableObj argContainer,
        Collection<ICFBamDelTopDepObj> argDataCollection, ICFBamJavaFXDelTopDepChosen whenChosen) {
    super();//from ww w .  ja  v  a  2 s .c  o  m
    final String S_ProcName = "construct-schema-focus";
    if (formManager == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 1,
                "formManager");
    }
    cfFormManager = formManager;
    if (argSchema == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 2,
                "argSchema");
    }
    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<ICFBamDelTopDepObj>();
    tableColumnId = new TableColumn<ICFBamDelTopDepObj, Long>("Id");
    tableColumnId.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamDelTopDepObj, Long>, ObservableValue<Long>>() {
                public ObservableValue<Long> call(CellDataFeatures<ICFBamDelTopDepObj, Long> p) {
                    ICFBamScopeObj obj = p.getValue();
                    if (obj == null) {
                        return (null);
                    } else {
                        long value = obj.getRequiredId();
                        Long wrapped = new Long(value);
                        ReadOnlyObjectWrapper<Long> observable = new ReadOnlyObjectWrapper<Long>();
                        observable.setValue(wrapped);
                        return (observable);
                    }
                }
            });
    tableColumnId.setCellFactory(
            new Callback<TableColumn<ICFBamDelTopDepObj, Long>, TableCell<ICFBamDelTopDepObj, Long>>() {
                @Override
                public TableCell<ICFBamDelTopDepObj, Long> call(TableColumn<ICFBamDelTopDepObj, Long> arg) {
                    return new CFInt64TableCell<ICFBamDelTopDepObj>();
                }
            });
    dataTable.getColumns().add(tableColumnId);
    tableColumnName = new TableColumn<ICFBamDelTopDepObj, String>("Name");
    tableColumnName.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamDelTopDepObj, String>, ObservableValue<String>>() {
                public ObservableValue<String> call(CellDataFeatures<ICFBamDelTopDepObj, String> p) {
                    ICFBamDelTopDepObj 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<ICFBamDelTopDepObj, String>, TableCell<ICFBamDelTopDepObj, String>>() {
                @Override
                public TableCell<ICFBamDelTopDepObj, String> call(TableColumn<ICFBamDelTopDepObj, String> arg) {
                    return new CFStringTableCell<ICFBamDelTopDepObj>();
                }
            });
    dataTable.getColumns().add(tableColumnName);
    tableColumnLookupRelation = new TableColumn<ICFBamDelTopDepObj, ICFBamRelationObj>("Relation");
    tableColumnLookupRelation.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamDelTopDepObj, ICFBamRelationObj>, ObservableValue<ICFBamRelationObj>>() {
                public ObservableValue<ICFBamRelationObj> call(
                        CellDataFeatures<ICFBamDelTopDepObj, ICFBamRelationObj> p) {
                    ICFBamDelTopDepObj obj = p.getValue();
                    if (obj == null) {
                        return (null);
                    } else {
                        ICFBamRelationObj ref = obj.getRequiredLookupRelation();
                        ReadOnlyObjectWrapper<ICFBamRelationObj> observable = new ReadOnlyObjectWrapper<ICFBamRelationObj>();
                        observable.setValue(ref);
                        return (observable);
                    }
                }
            });
    tableColumnLookupRelation.setCellFactory(
            new Callback<TableColumn<ICFBamDelTopDepObj, ICFBamRelationObj>, TableCell<ICFBamDelTopDepObj, ICFBamRelationObj>>() {
                @Override
                public TableCell<ICFBamDelTopDepObj, ICFBamRelationObj> call(
                        TableColumn<ICFBamDelTopDepObj, ICFBamRelationObj> arg) {
                    return new CFReferenceTableCell<ICFBamDelTopDepObj, ICFBamRelationObj>();
                }
            });
    dataTable.getColumns().add(tableColumnLookupRelation);
    tableColumnLookupDefSchema = new TableColumn<ICFBamDelTopDepObj, ICFBamSchemaDefObj>(
            "Defining Schema Definition");
    tableColumnLookupDefSchema.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamDelTopDepObj, ICFBamSchemaDefObj>, ObservableValue<ICFBamSchemaDefObj>>() {
                public ObservableValue<ICFBamSchemaDefObj> call(
                        CellDataFeatures<ICFBamDelTopDepObj, ICFBamSchemaDefObj> p) {
                    ICFBamDelTopDepObj 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<ICFBamDelTopDepObj, ICFBamSchemaDefObj>, TableCell<ICFBamDelTopDepObj, ICFBamSchemaDefObj>>() {
                @Override
                public TableCell<ICFBamDelTopDepObj, ICFBamSchemaDefObj> call(
                        TableColumn<ICFBamDelTopDepObj, ICFBamSchemaDefObj> arg) {
                    return new CFReferenceTableCell<ICFBamDelTopDepObj, ICFBamSchemaDefObj>();
                }
            });
    dataTable.getColumns().add(tableColumnLookupDefSchema);
    dataTable.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<ICFBamDelTopDepObj>() {
        @Override
        public void changed(ObservableValue<? extends ICFBamDelTopDepObj> observable,
                ICFBamDelTopDepObj oldValue, ICFBamDelTopDepObj 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.choseDelTopDep(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");
                }
                ICFBamDelTopDepObj selectedInstance = getJavaFXFocusAsDelTopDep();
                invokeWhenChosen.choseDelTopDep(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.CFBamJavaFXPopTopDepPickerPane.java

public CFBamJavaFXPopTopDepPickerPane(ICFFormManager formManager, ICFBamJavaFXSchema argSchema,
        ICFBamPopTopDepObj argFocus, ICFBamRelationObj argContainer,
        Collection<ICFBamPopTopDepObj> argDataCollection, ICFBamJavaFXPopTopDepChosen whenChosen) {
    super();//from  w ww . j  av 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<ICFBamPopTopDepObj>();
    tableColumnId = new TableColumn<ICFBamPopTopDepObj, Long>("Id");
    tableColumnId.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamPopTopDepObj, Long>, ObservableValue<Long>>() {
                public ObservableValue<Long> call(CellDataFeatures<ICFBamPopTopDepObj, Long> p) {
                    ICFBamScopeObj obj = p.getValue();
                    if (obj == null) {
                        return (null);
                    } else {
                        long value = obj.getRequiredId();
                        Long wrapped = new Long(value);
                        ReadOnlyObjectWrapper<Long> observable = new ReadOnlyObjectWrapper<Long>();
                        observable.setValue(wrapped);
                        return (observable);
                    }
                }
            });
    tableColumnId.setCellFactory(
            new Callback<TableColumn<ICFBamPopTopDepObj, Long>, TableCell<ICFBamPopTopDepObj, Long>>() {
                @Override
                public TableCell<ICFBamPopTopDepObj, Long> call(TableColumn<ICFBamPopTopDepObj, Long> arg) {
                    return new CFInt64TableCell<ICFBamPopTopDepObj>();
                }
            });
    dataTable.getColumns().add(tableColumnId);
    tableColumnName = new TableColumn<ICFBamPopTopDepObj, String>("Name");
    tableColumnName.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamPopTopDepObj, String>, ObservableValue<String>>() {
                public ObservableValue<String> call(CellDataFeatures<ICFBamPopTopDepObj, String> p) {
                    ICFBamPopTopDepObj 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<ICFBamPopTopDepObj, String>, TableCell<ICFBamPopTopDepObj, String>>() {
                @Override
                public TableCell<ICFBamPopTopDepObj, String> call(TableColumn<ICFBamPopTopDepObj, String> arg) {
                    return new CFStringTableCell<ICFBamPopTopDepObj>();
                }
            });
    dataTable.getColumns().add(tableColumnName);
    tableColumnLookupRelation = new TableColumn<ICFBamPopTopDepObj, ICFBamRelationObj>("Relation");
    tableColumnLookupRelation.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamPopTopDepObj, ICFBamRelationObj>, ObservableValue<ICFBamRelationObj>>() {
                public ObservableValue<ICFBamRelationObj> call(
                        CellDataFeatures<ICFBamPopTopDepObj, ICFBamRelationObj> p) {
                    ICFBamPopTopDepObj obj = p.getValue();
                    if (obj == null) {
                        return (null);
                    } else {
                        ICFBamRelationObj ref = obj.getRequiredLookupRelation();
                        ReadOnlyObjectWrapper<ICFBamRelationObj> observable = new ReadOnlyObjectWrapper<ICFBamRelationObj>();
                        observable.setValue(ref);
                        return (observable);
                    }
                }
            });
    tableColumnLookupRelation.setCellFactory(
            new Callback<TableColumn<ICFBamPopTopDepObj, ICFBamRelationObj>, TableCell<ICFBamPopTopDepObj, ICFBamRelationObj>>() {
                @Override
                public TableCell<ICFBamPopTopDepObj, ICFBamRelationObj> call(
                        TableColumn<ICFBamPopTopDepObj, ICFBamRelationObj> arg) {
                    return new CFReferenceTableCell<ICFBamPopTopDepObj, ICFBamRelationObj>();
                }
            });
    dataTable.getColumns().add(tableColumnLookupRelation);
    tableColumnLookupDefSchema = new TableColumn<ICFBamPopTopDepObj, ICFBamSchemaDefObj>(
            "Defining Schema Definition");
    tableColumnLookupDefSchema.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamPopTopDepObj, ICFBamSchemaDefObj>, ObservableValue<ICFBamSchemaDefObj>>() {
                public ObservableValue<ICFBamSchemaDefObj> call(
                        CellDataFeatures<ICFBamPopTopDepObj, ICFBamSchemaDefObj> p) {
                    ICFBamPopTopDepObj 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<ICFBamPopTopDepObj, ICFBamSchemaDefObj>, TableCell<ICFBamPopTopDepObj, ICFBamSchemaDefObj>>() {
                @Override
                public TableCell<ICFBamPopTopDepObj, ICFBamSchemaDefObj> call(
                        TableColumn<ICFBamPopTopDepObj, ICFBamSchemaDefObj> arg) {
                    return new CFReferenceTableCell<ICFBamPopTopDepObj, ICFBamSchemaDefObj>();
                }
            });
    dataTable.getColumns().add(tableColumnLookupDefSchema);
    dataTable.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<ICFBamPopTopDepObj>() {
        @Override
        public void changed(ObservableValue<? extends ICFBamPopTopDepObj> observable,
                ICFBamPopTopDepObj oldValue, ICFBamPopTopDepObj 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.chosePopTopDep(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");
                }
                ICFBamPopTopDepObj selectedInstance = getJavaFXFocusAsPopTopDep();
                invokeWhenChosen.chosePopTopDep(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);
}