Example usage for javafx.scene.control TableColumn TableColumn

List of usage examples for javafx.scene.control TableColumn TableColumn

Introduction

In this page you can find the example usage for javafx.scene.control TableColumn TableColumn.

Prototype

public TableColumn(String text) 

Source Link

Document

Creates a TableColumn with the text set to the provided string, with default cell factory, comparator, and onEditCommit implementation.

Usage

From source file:com.ggvaidya.scinames.summary.NameStabilityView.java

private TableColumn<Dataset, String> createTableColumn(String colName, Function<Dataset, String> func) {
    TableColumn<Dataset, String> tableColumn = new TableColumn<>(colName);
    tableColumn.setCellValueFactory(features -> new ReadOnlyStringWrapper(func.apply(features.getValue())));

    tableColumn.setPrefWidth(100.0);/*from   w  w  w . jav  a2  s . c om*/

    return tableColumn;
}

From source file:com.bdb.weather.display.windrose.WindRosePane.java

/**
 * Initialize the component.//from www  . j a  v a2s .c o  m
 * 
 * @param bins The speed bins
 */
private void init(List<SpeedBin> bins) {
    if (initialized)
        return;

    initialized = true;

    int binNumber = 0;
    for (SpeedBin bin : bins) {
        TableColumn<WindSlice, String> column = new TableColumn<>(bin.speedString());
        column.setUserData(binNumber++);
        column.setCellValueFactory((rec) -> new ReadOnlyStringWrapper(String.format("%.1f",
                rec.getValue().speedBinPercentage((int) rec.getTableColumn().getUserData()))));
        dataTable.getColumns().add(column);
    }
}

From source file:com.bdb.weather.display.day.DayXYPlotPane.java

protected final void createElements() {
    createChartElements();/*ww  w  .  j  a va 2  s .c om*/

    //
    // Build the table for the data tab
    //
    dataTable = new TableView<>();

    this.setTabContents(chartViewer, dataTable);

    TableColumn<HistoricalRecord, String> col = new TableColumn<>(TIME_HEADING);
    col.setCellValueFactory((rec) -> new ReadOnlyStringWrapper(
            DisplayConstants.formatTime(rec.getValue().getTime().toLocalTime())));
    dataTable.getColumns().add(col);

    doConfigure(displayMenu);
    this.layout();
}

From source file:de.pixida.logtest.designer.logreader.LogReaderEditor.java

public LogReaderEditor(final IMainWindow mainWindow) {
    super(Editor.Type.LOG_READER_CONFIG, mainWindow);

    this.parsedLogEntries = new TableView<>(this.parsedLogEntryItems);
    this.parsedLogEntries.setPlaceholder(new Text("No log entries to display."));
    final TableColumn<LogEntryTableRow, String> lineNoCol = new TableColumn<LogEntryTableRow, String>("LineNo");
    lineNoCol.setCellValueFactory(new PropertyValueFactory<>("lineNumber"));
    lineNoCol.setSortable(false);/*from ww w.  ja v a 2 s  .c o m*/
    lineNoCol.setGraphic(Icons.getIconGraphics("key"));
    final TableColumn<LogEntryTableRow, String> timeCol = new TableColumn<LogEntryTableRow, String>("Time");
    timeCol.setCellValueFactory(new PropertyValueFactory<>("time"));
    timeCol.setSortable(false);
    timeCol.setGraphic(Icons.getIconGraphics("clock"));
    final TableColumn<LogEntryTableRow, String> channelCol = new TableColumn<LogEntryTableRow, String>(
            "Channel");
    channelCol.setCellValueFactory(new PropertyValueFactory<>("channel"));
    channelCol.setSortable(false);
    channelCol.setGraphic(Icons.getIconGraphics("connect"));
    final TableColumn<LogEntryTableRow, String> payloadCol = new TableColumn<LogEntryTableRow, String>(
            "Payload");
    payloadCol.setCellValueFactory(new PropertyValueFactory<>("payload"));
    payloadCol.setSortable(false);
    payloadCol.setGraphic(Icons.getIconGraphics("page_white_text_width"));
    this.parsedLogEntries.getColumns().add(lineNoCol);
    this.parsedLogEntries.getColumns().add(timeCol);
    this.parsedLogEntries.getColumns().add(channelCol);
    this.parsedLogEntries.getColumns().add(payloadCol);
}

From source file:com.bdb.weather.display.summary.WindSummary.java

/**
 * Create the table./*from   w w w.  j av  a 2s  . c  o m*/
 * 
 * @return The JavaFX Node
 */
private Node createTable() {
    dataTable = new TableView();

    TableColumn<SummaryRecord, String> col = new TableColumn<>("Date");
    col.setCellValueFactory(
            (rec) -> new ReadOnlyStringWrapper(DisplayConstants.formatDate(rec.getValue().getDate())));
    dataTable.getColumns().add(col);

    TableColumn<SummaryRecord, Speed> avgWindColumn = new TableColumn<>("Avg Wind");
    avgWindColumn.setCellValueFactory((rec) -> new ReadOnlyObjectWrapper(rec.getValue().getAvgWindSpeed()));
    dataTable.getColumns().add(avgWindColumn);

    TableColumn<SummaryRecord, Depth> maxWindColumn = new TableColumn<>("Max Wind");
    maxWindColumn.setCellValueFactory((rec) -> new ReadOnlyObjectWrapper(rec.getValue().getMaxWindSpeed()));
    dataTable.getColumns().add(maxWindColumn);

    TableColumn<SummaryRecord, Depth> maxGustColumn = new TableColumn<>("Max Wind");
    maxGustColumn.setCellValueFactory((rec) -> new ReadOnlyObjectWrapper(rec.getValue().getMaxWindGust()));
    dataTable.getColumns().add(maxGustColumn);

    return dataTable;
}

From source file:com.bdb.weather.display.day.ItemRenderer.java

public WindDirPane() {
    setPrefSize(300, 300);//ww w .jav  a2 s  .  c o m
    JFreeChart chart = ChartFactory.createPolarChart(null, null, false, true, false);

    ChartFactory.getChartTheme().apply(chart);

    plot = (PolarPlot) chart.getPlot();

    ItemRenderer renderer = new ItemRenderer();
    XYToolTipGenerator ttg = (XYDataset dataset, int series, int item) -> {
        double time = dataset.getXValue(series, item);
        long millis = Math.round(time);
        return "" + millis;
    };
    renderer.setBaseToolTipGenerator(ttg);
    plot.setRenderer(renderer);

    ((NumberAxis) plot.getAxis()).setRange(-240.0, 60.0 * 24);
    ((NumberAxis) plot.getAxis()).setAutoRange(false);
    ((NumberAxis) plot.getAxis()).setTickUnit(new NumberTickUnit(240.0, new DecimalFormat("00")) {
        @Override
        public String valueToString(double number) {
            if (number < 0.0 || (int) number % 240 != 0)
                return "";
            else
                return super.valueToString(number / 60.0);
        }
    });

    ChartViewer chartViewer = new ChartViewer(chart);
    this.setTabContents(chartViewer, table);

    plot.setDataset(new XYSeriesCollection(windDirSeries));

    TableColumn<HistoricalRecord, String> column = new TableColumn<>("Time");
    column.setCellValueFactory((rec) -> new ReadOnlyStringWrapper(
            DisplayConstants.formatTime(rec.getValue().getTime().toLocalTime())));
    table.getColumns().add(column);

    column = new TableColumn<>("Direction");
    column.setCellValueFactory(
            (rec) -> new ReadOnlyStringWrapper(rec.getValue().getAvgWind().getDirection().getCompassLabel()));
    table.getColumns().add(column);
}

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

public CFBamJavaFXScopePickerPane(ICFFormManager formManager, ICFBamJavaFXSchema argSchema,
        ICFBamScopeObj argFocus, ICFLibAnyObj argContainer, Collection<ICFBamScopeObj> argDataCollection,
        ICFBamJavaFXScopeChosen whenChosen) {
    super();/*from w  w w .  j  a  v  a 2 s  .c  o m*/
    final String S_ProcName = "construct-schema-focus";
    if (formManager == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 1,
                "formManager");
    }
    cfFormManager = formManager;
    if (argSchema == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 2,
                "argSchema");
    }
    if (whenChosen == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 6,
                "whenChosen");
    }
    invokeWhenChosen = whenChosen;
    // argFocus is optional; focus may be set later during execution as
    // conditions of the runtime change.
    javafxSchema = argSchema;
    javaFXFocus = argFocus;
    javafxContainer = argContainer;
    setJavaFXDataCollection(argDataCollection);
    dataTable = new TableView<ICFBamScopeObj>();
    tableColumnObjKind = new TableColumn<ICFBamScopeObj, String>("Class Code");
    tableColumnObjKind.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamScopeObj, String>, ObservableValue<String>>() {
                @Override
                public ObservableValue<String> call(CellDataFeatures<ICFBamScopeObj, String> p) {
                    ICFBamScopeObj 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<ICFBamScopeObj, String>, TableCell<ICFBamScopeObj, String>>() {
                @Override
                public TableCell<ICFBamScopeObj, String> call(TableColumn<ICFBamScopeObj, String> arg) {
                    return new CFStringTableCell<ICFBamScopeObj>();
                }
            });
    dataTable.getColumns().add(tableColumnObjKind);
    tableColumnId = new TableColumn<ICFBamScopeObj, Long>("Id");
    tableColumnId
            .setCellValueFactory(new Callback<CellDataFeatures<ICFBamScopeObj, Long>, ObservableValue<Long>>() {
                public ObservableValue<Long> call(CellDataFeatures<ICFBamScopeObj, 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<ICFBamScopeObj, Long>, TableCell<ICFBamScopeObj, Long>>() {
                @Override
                public TableCell<ICFBamScopeObj, Long> call(TableColumn<ICFBamScopeObj, Long> arg) {
                    return new CFInt64TableCell<ICFBamScopeObj>();
                }
            });
    dataTable.getColumns().add(tableColumnId);
    dataTable.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<ICFBamScopeObj>() {
        @Override
        public void changed(ObservableValue<? extends ICFBamScopeObj> observable, ICFBamScopeObj oldValue,
                ICFBamScopeObj 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.choseScope(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");
                }
                ICFBamScopeObj selectedInstance = getJavaFXFocusAsScope();
                invokeWhenChosen.choseScope(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:org.opendolphin.mvndemo.clientlazy.DemoController.java

private void createTableLazy(List<Map> data) {
    //Tabellen Spalten wieder sortieren.
    SortedMap<Integer, String> ms = new TreeMap<>(data.get(0));
    colNames = ms.values().toArray(colNames);
    // Model Listener
    initLazyModle(colNames);//  w ww .  j  av a 2 s . com
    DemoApp.clientDolphin.addModelStoreListener(TYPE_LAZY, new ModelStoreListener() {

        @Override
        public void modelStoreChanged(ModelStoreEvent event) {
            PresentationModel pm = event.getPresentationModel();
            used.setValue(used.get() + 1);
            unused.setValue(lazyRows.size() - used.get());
            //
            int i = 0;
            for (Map<String, SimpleStringProperty> m : lazyModel) {
                String v = null;
                Attribute atr = pm.getAt(colNames[i]);
                if (atr != null) {
                    v = (String) atr.getValue();
                }
                m.get(pm.getId()).setValue(v);
                i++;
            }
        }
    });
    //Create table columns
    TableColumn<Integer, String> tableColID = new TableColumn<>("rowID");
    tableColID.setSortable(true);
    tableColID.setCellValueFactory(
            new Callback<TableColumn.CellDataFeatures<Integer, String>, ObservableValue<String>>() {

                @Override
                public ObservableValue<String> call(
                        TableColumn.CellDataFeatures<Integer, String> cellDataFeature) {
                    return new SimpleStringProperty(cellDataFeature.getValue().toString());
                }
            });
    tableLazy.getColumns().add(tableColID);

    for (int i = 0; i < colNames.length; i++) {
        TableColumn<Integer, String> tableCol = new TableColumn<>(colNames[i]);
        tableCol.setSortable(false);
        tableLazy.getColumns().add(tableCol);
        final int index = i;
        tableCol.setCellValueFactory(
                new Callback<TableColumn.CellDataFeatures<Integer, String>, ObservableValue<String>>() {

                    @Override
                    public ObservableValue<String> call(
                            TableColumn.CellDataFeatures<Integer, String> cellDataFeature) {
                        String lazyId = cellDataFeature.getValue().toString();
                        SimpleStringProperty placeholder = lazyModel.get(index).get(lazyId);
                        if ("...".equals(placeholder.getValue())) {
                            DemoApp.clientDolphin.getClientModelStore().withPresentationModel(lazyId, (pm) -> {
                                /*NOP*/
                            });
                            // Wrong Way
                            //                  GetPresentationModelCommand pmc = new GetPresentationModelCommand();
                            //                  pmc.setPmId(lazyId);
                            //                  MonitorApp.clientDolphin.getClientConnector().send(pmc);
                        }
                        return placeholder;
                    }
                });
    }
    //
    tableLazy.setItems(lazyRows);
}

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 .ja  va2  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<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: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();//from   www  .  ja va2 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);
}