Example usage for javafx.event EventHandler EventHandler

List of usage examples for javafx.event EventHandler EventHandler

Introduction

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

Prototype

EventHandler

Source Link

Usage

From source file:FeeBooster.java

private GridPane cpfpGrid(Transaction tx) {
    // Setup Grid
    GridPane grid = new GridPane();
    grid.setAlignment(Pos.CENTER);//from w w w  .j a va 2s. c o m
    grid.setHgap(10);
    grid.setVgap(10);
    grid.setPadding(new Insets(25, 25, 25, 25));
    int gridheight = 0;

    // Add outputs to table
    Label outputHdrLbl = new Label("Outputs");
    grid.add(outputHdrLbl, 1, gridheight);
    gridheight++;
    ToggleGroup outputGroup = new ToggleGroup();
    for (int i = 0; i < tx.getOutputs().size(); i++) {
        // Add output to table
        TxOutput out = tx.getOutputs().get(i);
        Text outputTxt = new Text("Amount " + out.getValue() + " Satoshis\nAddress: " + out.getAddress());
        outputTxt.setUserData(i);
        grid.add(outputTxt, 0, gridheight);

        // Add radio button to table
        RadioButton radio = new RadioButton();
        radio.setUserData(i);
        radio.setToggleGroup(outputGroup);
        radio.setSelected(true);
        grid.add(radio, 1, gridheight);
        gridheight++;
    }

    // Fee
    Text fee = new Text("Fee to Pay: " + tx.getFee() + " Satoshis");
    grid.add(fee, 0, gridheight);

    // Recommended fee from bitcoinfees.21.co
    JSONObject apiResult = Utils.getFromAnAPI("http://bitcoinfees.21.co/api/v1/fees/recommended", "GET");
    int fastestFee = apiResult.getInt("fastestFee");
    long recommendedFee = fastestFee * tx.getSize() + fastestFee * 300;
    Text recFeeTxt = new Text("Recommended Fee: " + recommendedFee + " Satoshis");
    grid.add(recFeeTxt, 1, gridheight);
    gridheight += 2;

    // Instructions
    Text instructions = new Text("Choose an output to spend from. Set the total transaction fee below.");
    grid.add(instructions, 0, gridheight, 3, 1);
    gridheight++;

    // Fee spinner
    Spinner feeSpin = new Spinner((double) tx.getFee(), (double) tx.getTotalAmt(), (double) tx.getFee());
    feeSpin.setEditable(true);
    grid.add(feeSpin, 0, gridheight);
    feeSpin.valueProperty().addListener(new ChangeListener() {
        @Override
        public void changed(ObservableValue observable, Object oldValue, Object newValue) {
            double oldVal = (double) oldValue;
            double newVal = (double) newValue;
            Double step = newVal - oldVal;
            tx.setFee(tx.getFee() + step.longValue());
            fee.setText("Fee to Pay: " + tx.getFee() + " Satoshis");
        }
    });

    // Set to recommended fee button
    Button recFeeBtn = new Button("Set fee to recommended");
    grid.add(recFeeBtn, 1, gridheight);
    gridheight++;
    recFeeBtn.setOnAction(new EventHandler<ActionEvent>() {
        @Override
        public void handle(ActionEvent event) {
            long prevFee = tx.getFee();
            long step = recommendedFee - prevFee;
            feeSpin.increment((int) step);
        }
    });

    // Output address
    Label recvAddr = new Label("Address to pay to");
    grid.add(recvAddr, 0, gridheight);
    TextField outAddr = new TextField();
    grid.add(outAddr, 1, gridheight);
    gridheight++;

    // Next Button
    Button nextBtn = new Button("Next");
    nextBtn.setOnAction(new EventHandler<ActionEvent>() {
        @Override
        public void handle(ActionEvent event) {

            if (sceneCursor == scenes.size() - 1) {
                // Referenced output
                int output = (int) outputGroup.getSelectedToggle().getUserData();
                TxOutput refout = tx.getOutputs().get(output);

                // Create output for CPFP transaction
                TxOutput out = null;
                long outval = refout.getValue() - ((Double) feeSpin.getValue()).longValue();
                if (Utils.validateAddress(outAddr.getText())) {
                    byte[] decodedAddr = Utils.base58Decode(outAddr.getText());
                    boolean isP2SH = decodedAddr[0] == 0x00;
                    byte[] hash160 = Arrays.copyOfRange(decodedAddr, 1, decodedAddr.length - 4);
                    if (isP2SH) {
                        byte[] script = new byte[hash160.length + 3];
                        script[0] = (byte) 0xa9;
                        script[1] = (byte) 0x14;
                        System.arraycopy(hash160, 0, script, 2, hash160.length);
                        script[script.length - 1] = (byte) 0x87;
                        out = new TxOutput(outval, script);
                    } else {
                        byte[] script = new byte[hash160.length + 5];
                        script[0] = (byte) 0x76;
                        script[1] = (byte) 0xa9;
                        script[2] = (byte) 0x14;
                        System.arraycopy(hash160, 0, script, 3, hash160.length);
                        script[script.length - 2] = (byte) 0x88;
                        script[script.length - 1] = (byte) 0xac;
                        out = new TxOutput(outval, script);
                    }
                } else {
                    Alert alert = new Alert(Alert.AlertType.ERROR, "Invalid Address");
                    alert.showAndWait();
                    return;
                }

                // Create CPFP Transaction
                Transaction cpfpTx = new Transaction();
                TxInput in = new TxInput(tx.getHash(), output, new byte[] { (0x00) }, 0xffffffff);
                cpfpTx.addOutput(out);
                cpfpTx.addInput(in);

                // Create Scene
                Scene scene = new Scene(unsignedTxGrid(cpfpTx), 900, 500);
                scenes.add(scene);
                sceneCursor++;
                stage.setScene(scene);
            } else {
                sceneCursor++;
                stage.setScene(scenes.get(sceneCursor));
            }
        }
    });
    HBox btnHbox = new HBox(10);

    // Back Button
    Button backBtn = new Button("Back");
    backBtn.setOnAction(new EventHandler<ActionEvent>() {
        @Override
        public void handle(ActionEvent event) {
            sceneCursor--;
            stage.setScene(scenes.get(sceneCursor));
        }
    });
    btnHbox.getChildren().add(backBtn);
    btnHbox.getChildren().add(nextBtn);

    // Cancel Button
    Button cancelBtn = new Button("Cancel");
    cancelBtn.setOnAction(cancelEvent);
    btnHbox.getChildren().add(cancelBtn);
    grid.add(btnHbox, 1, gridheight);

    return grid;
}

From source file:dpfmanager.shell.interfaces.gui.component.report.ReportsView.java

public void addFormatIcons() {
    colFormats.setCellFactory(/*www.j  ava  2s.  c om*/
            new Callback<TableColumn<ReportRow, ObservableMap<String, String>>, TableCell<ReportRow, ObservableMap<String, String>>>() {
                @Override
                public TableCell<ReportRow, ObservableMap<String, String>> call(
                        TableColumn<ReportRow, ObservableMap<String, String>> param) {
                    TableCell<ReportRow, ObservableMap<String, String>> cell = new TableCell<ReportRow, ObservableMap<String, String>>() {
                        @Override
                        public void updateItem(ObservableMap<String, String> item, boolean empty) {
                            super.updateItem(item, empty);
                            if (!empty && item != null) {

                                HBox box = new HBox();
                                box.setSpacing(3);
                                box.setAlignment(Pos.CENTER_LEFT);

                                for (String i : item.keySet()) {
                                    ImageView icon = new ImageView();
                                    icon.setId("but" + i);
                                    icon.setFitHeight(20);
                                    icon.setFitWidth(20);
                                    icon.setImage(new Image("images/formats/" + i + ".png"));
                                    icon.setCursor(Cursor.HAND);

                                    String type = i;
                                    String path = item.get(i);
                                    icon.setOnMouseClicked(new EventHandler<MouseEvent>() {
                                        @Override
                                        public void handle(MouseEvent event) {
                                            ArrayMessage am = new ArrayMessage();
                                            am.add(GuiConfig.PERSPECTIVE_SHOW, new UiMessage());
                                            am.add(GuiConfig.PERSPECTIVE_SHOW + "." + GuiConfig.COMPONENT_SHOW,
                                                    new ShowMessage(type, path));
                                            getContext().send(GuiConfig.PERSPECTIVE_SHOW, am);
                                        }
                                    });

                                    ContextMenu contextMenu = new ContextMenu();
                                    javafx.scene.control.MenuItem download = new javafx.scene.control.MenuItem(
                                            "Download report");
                                    contextMenu.getItems().add(download);
                                    icon.setOnContextMenuRequested(new EventHandler<ContextMenuEvent>() {
                                        public void handle(ContextMenuEvent e) {
                                            contextMenu.show(icon, e.getScreenX(), e.getScreenY());
                                        }
                                    });
                                    box.getChildren().add(icon);
                                }

                                setGraphic(box);
                            } else {
                                setGraphic(null);
                            }
                        }
                    };
                    return cell;
                }
            });
}

From source file:com.properned.application.SystemController.java

public void loadFileList(File selectedFile) {
    Platform.runLater(new Runnable() {

        @Override/*w  w  w  . j a v  a  2s  .  c  o  m*/
        public void run() {
            logger.info("Load the file list associated to '" + selectedFile.getAbsolutePath() + "'");

            if (MultiLanguageProperties.getInstance().getIsDirty()) {
                ButtonType result = askForSave();
                if (result.getButtonData() == ButtonData.CANCEL_CLOSE) {
                    // The file must not be loaded
                    return;
                }
            }
            Preferences.getInstance().setLastPathUsed(selectedFile.getAbsolutePath());
            String fileName = selectedFile.getName();
            String baseNameTemp = fileName.substring(0, fileName.lastIndexOf("."));

            if (fileName.contains("_")) {
                baseNameTemp = fileName.substring(0, fileName.indexOf("_"));
            }
            final String baseName = baseNameTemp;

            List<PropertiesFile> fileList = Arrays
                    .asList(selectedFile.getParentFile().listFiles(new FileFilter() {
                        @Override
                        public boolean accept(File pathname) {
                            return pathname.isFile() && pathname.getName().startsWith(baseName)
                                    && pathname.getName().endsWith(".properties");
                        }
                    })).stream().map(new Function<File, PropertiesFile>() {
                        @Override
                        public PropertiesFile apply(File t) {
                            String language = "";
                            if (t.getName().contains("_")) {
                                language = t.getName().substring(t.getName().indexOf("_") + 1,
                                        t.getName().lastIndexOf("."));
                            }
                            return new PropertiesFile(t.getAbsolutePath(), baseName, new Locale(language));
                        }
                    }).collect(Collectors.<PropertiesFile>toList());

            try {
                multiLanguageProperties.loadFileList(baseName, fileList);
                Preferences.getInstance().addFileToRecentFileList(selectedFile.getAbsolutePath());
                Properned.getInstance().getPrimaryStage().getScene()
                        .setOnKeyReleased(new EventHandler<KeyEvent>() {
                            @Override
                            public void handle(KeyEvent event) {
                                if (event.getCode() == KeyCode.S && event.isControlDown()) {
                                    logger.info("CTRL-S detected");
                                    save();
                                    event.consume();
                                }
                            }
                        });
            } catch (IOException e) {
                Properned.getInstance().showError(MessageReader.getInstance().getMessage("error.load"), e);
            }
        }
    });
}

From source file:org.yccheok.jstock.gui.news.StockNewsJFrame.java

public void retrieveNewsInBackground() {
    if (newsServers == null) {
        return;//from ww w . j a v a 2  s  . c  o  m
    }
    if (newsTask != null) {
        throw new java.lang.RuntimeException("Being called more than once");
    }

    newsTask = new NewsTask(newsServers);

    // on newsTask successfully executed
    newsTask.setOnSucceeded(new EventHandler<WorkerStateEvent>() {
        @Override
        public void handle(WorkerStateEvent t) {
            java.util.List<FeedItem> allMessages = newsTask.getValue();

            messages_o.addAll(allMessages);
            stackPane.getChildren().remove(progressIn);
        }
    });

    new Thread(newsTask).start();
}

From source file:com.danilafe.sbaccountmanager.StarboundServerAccountManager.java

private void createBannedPlayername(ListView<String> to_update) {
    Stage createBannedPlayername = new Stage();
    createBannedPlayername.setTitle("Add Banned Playername");
    createBannedPlayername.initModality(Modality.APPLICATION_MODAL);

    GridPane gp = new GridPane();
    gp.setPadding(new Insets(25, 25, 25, 25));
    gp.setAlignment(Pos.CENTER);/*from w ww  .j a  v  a2s  . c  om*/
    gp.setVgap(10);
    gp.setHgap(10);

    Text title = new Text("Add Banned Playername");
    title.setFont(Font.font("Century Gothic", FontWeight.NORMAL, 20));
    gp.add(title, 0, 0, 2, 1);

    Label newusername = new Label("Ban Playername");
    TextField username = new TextField();
    gp.add(newusername, 0, 1);
    gp.add(username, 1, 1);

    Button finish = new Button("Finish");
    HBox finish_box = new HBox(10);
    finish_box.setAlignment(Pos.CENTER);
    finish_box.getChildren().add(finish);

    finish.setOnAction(new EventHandler<ActionEvent>() {

        @Override
        public void handle(ActionEvent event) {
            banned_playernames.remove(username.getText());
            banned_playernames.add(username.getText());
            to_update.setItems(FXCollections.observableArrayList(banned_playernames));
            createBannedPlayername.close();
        }

    });

    gp.add(finish_box, 0, 2, 2, 1);

    Scene sc = new Scene(gp, 300, 175);
    createBannedPlayername.setScene(sc);
    createBannedPlayername.show();
}

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

public CFBamJavaFXParamPickerPane(ICFFormManager formManager, ICFBamJavaFXSchema argSchema,
        ICFBamParamObj argFocus, ICFBamServerMethodObj argContainer,
        Collection<ICFBamParamObj> argDataCollection, ICFBamJavaFXParamChosen whenChosen) {
    super();/*w w w.j ava 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<ICFBamParamObj>();
    tableColumnId = new TableColumn<ICFBamParamObj, Long>("Id");
    tableColumnId
            .setCellValueFactory(new Callback<CellDataFeatures<ICFBamParamObj, Long>, ObservableValue<Long>>() {
                public ObservableValue<Long> call(CellDataFeatures<ICFBamParamObj, Long> p) {
                    ICFBamParamObj 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<ICFBamParamObj, Long>, TableCell<ICFBamParamObj, Long>>() {
                @Override
                public TableCell<ICFBamParamObj, Long> call(TableColumn<ICFBamParamObj, Long> arg) {
                    return new CFInt64TableCell<ICFBamParamObj>();
                }
            });
    dataTable.getColumns().add(tableColumnId);
    tableColumnName = new TableColumn<ICFBamParamObj, String>("Name");
    tableColumnName.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamParamObj, String>, ObservableValue<String>>() {
                public ObservableValue<String> call(CellDataFeatures<ICFBamParamObj, String> p) {
                    ICFBamParamObj 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<ICFBamParamObj, String>, TableCell<ICFBamParamObj, String>>() {
                @Override
                public TableCell<ICFBamParamObj, String> call(TableColumn<ICFBamParamObj, String> arg) {
                    return new CFStringTableCell<ICFBamParamObj>();
                }
            });
    dataTable.getColumns().add(tableColumnName);
    tableColumnShortDescription = new TableColumn<ICFBamParamObj, String>("Short Description");
    tableColumnShortDescription.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamParamObj, String>, ObservableValue<String>>() {
                public ObservableValue<String> call(CellDataFeatures<ICFBamParamObj, String> p) {
                    ICFBamParamObj obj = p.getValue();
                    if (obj == null) {
                        return (null);
                    } else {
                        String value = obj.getOptionalShortDescription();
                        ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>();
                        observable.setValue(value);
                        return (observable);
                    }
                }
            });
    tableColumnShortDescription.setCellFactory(
            new Callback<TableColumn<ICFBamParamObj, String>, TableCell<ICFBamParamObj, String>>() {
                @Override
                public TableCell<ICFBamParamObj, String> call(TableColumn<ICFBamParamObj, String> arg) {
                    return new CFStringTableCell<ICFBamParamObj>();
                }
            });
    dataTable.getColumns().add(tableColumnShortDescription);
    tableColumnDescription = new TableColumn<ICFBamParamObj, String>("Description");
    tableColumnDescription.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamParamObj, String>, ObservableValue<String>>() {
                public ObservableValue<String> call(CellDataFeatures<ICFBamParamObj, String> p) {
                    ICFBamParamObj obj = p.getValue();
                    if (obj == null) {
                        return (null);
                    } else {
                        String value = obj.getOptionalDescription();
                        ReadOnlyObjectWrapper<String> observable = new ReadOnlyObjectWrapper<String>();
                        observable.setValue(value);
                        return (observable);
                    }
                }
            });
    tableColumnDescription.setCellFactory(
            new Callback<TableColumn<ICFBamParamObj, String>, TableCell<ICFBamParamObj, String>>() {
                @Override
                public TableCell<ICFBamParamObj, String> call(TableColumn<ICFBamParamObj, String> arg) {
                    return new CFStringTableCell<ICFBamParamObj>();
                }
            });
    dataTable.getColumns().add(tableColumnDescription);
    tableColumnIsNullable = new TableColumn<ICFBamParamObj, Boolean>("IsNullable");
    tableColumnIsNullable.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamParamObj, Boolean>, ObservableValue<Boolean>>() {
                public ObservableValue<Boolean> call(CellDataFeatures<ICFBamParamObj, Boolean> p) {
                    ICFBamParamObj obj = p.getValue();
                    if (obj == null) {
                        return (null);
                    } else {
                        boolean value = obj.getRequiredIsNullable();
                        Boolean wrapped = new Boolean(value);
                        ReadOnlyObjectWrapper<Boolean> observable = new ReadOnlyObjectWrapper<Boolean>();
                        observable.setValue(wrapped);
                        return (observable);
                    }
                }
            });
    tableColumnIsNullable.setCellFactory(
            new Callback<TableColumn<ICFBamParamObj, Boolean>, TableCell<ICFBamParamObj, Boolean>>() {
                @Override
                public TableCell<ICFBamParamObj, Boolean> call(TableColumn<ICFBamParamObj, Boolean> arg) {
                    return new CFBoolTableCell<ICFBamParamObj>();
                }
            });
    dataTable.getColumns().add(tableColumnIsNullable);
    tableColumnLookupDefSchema = new TableColumn<ICFBamParamObj, ICFBamSchemaDefObj>(
            "Defining Schema Definition");
    tableColumnLookupDefSchema.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamParamObj, ICFBamSchemaDefObj>, ObservableValue<ICFBamSchemaDefObj>>() {
                public ObservableValue<ICFBamSchemaDefObj> call(
                        CellDataFeatures<ICFBamParamObj, ICFBamSchemaDefObj> p) {
                    ICFBamParamObj 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<ICFBamParamObj, ICFBamSchemaDefObj>, TableCell<ICFBamParamObj, ICFBamSchemaDefObj>>() {
                @Override
                public TableCell<ICFBamParamObj, ICFBamSchemaDefObj> call(
                        TableColumn<ICFBamParamObj, ICFBamSchemaDefObj> arg) {
                    return new CFReferenceTableCell<ICFBamParamObj, ICFBamSchemaDefObj>();
                }
            });
    dataTable.getColumns().add(tableColumnLookupDefSchema);
    tableColumnLookupType = new TableColumn<ICFBamParamObj, ICFBamValueObj>("Type Specification");
    tableColumnLookupType.setCellValueFactory(
            new Callback<CellDataFeatures<ICFBamParamObj, ICFBamValueObj>, ObservableValue<ICFBamValueObj>>() {
                public ObservableValue<ICFBamValueObj> call(
                        CellDataFeatures<ICFBamParamObj, ICFBamValueObj> p) {
                    ICFBamParamObj obj = p.getValue();
                    if (obj == null) {
                        return (null);
                    } else {
                        ICFBamValueObj ref = obj.getRequiredLookupType();
                        ReadOnlyObjectWrapper<ICFBamValueObj> observable = new ReadOnlyObjectWrapper<ICFBamValueObj>();
                        observable.setValue(ref);
                        return (observable);
                    }
                }
            });
    tableColumnLookupType.setCellFactory(
            new Callback<TableColumn<ICFBamParamObj, ICFBamValueObj>, TableCell<ICFBamParamObj, ICFBamValueObj>>() {
                @Override
                public TableCell<ICFBamParamObj, ICFBamValueObj> call(
                        TableColumn<ICFBamParamObj, ICFBamValueObj> arg) {
                    return new CFReferenceTableCell<ICFBamParamObj, ICFBamValueObj>();
                }
            });
    dataTable.getColumns().add(tableColumnLookupType);
    dataTable.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<ICFBamParamObj>() {
        @Override
        public void changed(ObservableValue<? extends ICFBamParamObj> observable, ICFBamParamObj oldValue,
                ICFBamParamObj 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.choseParam(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");
                }
                ICFBamParamObj selectedInstance = getJavaFXFocusAsParam();
                invokeWhenChosen.choseParam(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:frontend.GUIController.java

public Thread processInput(Runnable rSuccess, Runnable rFail) throws Exception {
    System.out.println("Steping to next step...");
    progressBar.progressProperty().unbind();
    progressMessage.textProperty().unbind();
    next1.setDisable(true);/*w w w  .j  ava 2s  .co  m*/
    final ArrayList<String> comboBoxValues = new ArrayList<String>();
    for (ComboBox<String> c : comboBoxes) {
        comboBoxValues.add(c.getValue());
    }
    Task<Boolean> t = new Task<Boolean>() {
        @Override
        protected Boolean call() throws Exception {
            updateMessage("Doing Prediction");
            updateProgress(3, 10);
            int status = at.processAfterLoadFile(comboBoxValues, predModel.getValue(), visualize.isSelected(),
                    predicted.isSelected());
            if (status > 0) {
                System.err.println("ProcessAfterLoadFile Error occured.");
                return false;
            }
            updateMessage("Finished Prediction");
            if (visualize.isSelected()) {
                updateProgress(5, 10);
                at.showVisualization();
                updateMessage("Finished Visualization");
                updateProgress(8, 10);
            }
            updateProgress(10, 10);
            updateMessage("Done");

            //webpage.getChildren().add(new Browser(url));
            //at.addTweets(at.outputDir+"/visualization/Sentiment.tsv", personData);
            return true;
        };

        @Override
        protected void succeeded() {
            super.succeeded();
            updateMessage("Done!");
        }

        @Override
        protected void cancelled() {
            super.cancelled();
            updateMessage("Cancelled!");
        }

        @Override
        protected void failed() {
            super.failed();
            updateMessage("Failed!");
        }

        @Override
        protected void done() {
            super.done();
            updateMessage("Done!");
        }
    };
    progressBar.progressProperty().bind(t.progressProperty());
    progressMessage.textProperty().bind(t.messageProperty());

    t.setOnSucceeded(new EventHandler<WorkerStateEvent>() {

        @Override
        public void handle(WorkerStateEvent event) {
            if (t.getValue()) {
                Platform.runLater(rSuccess);
            } else {
                Platform.runLater(rFail);
            }
        }
    });

    Thread mythread = new Thread(t);
    mythread.start();
    return mythread;
}

From source file:org.sleuthkit.autopsy.imagegallery.gui.GroupPane.java

/**
 * called automatically during constructor by FXMLConstructor.
 *
 * checks that FXML loading went ok and performs additional setup
 *///from  w ww  .j  av a  2  s .  c  om
@FXML
void initialize() {
    assert gridView != null : "fx:id=\"tilePane\" was not injected: check your FXML file 'GroupPane.fxml'.";
    assert grpCatSplitMenu != null : "fx:id=\"grpCatSplitMenu\" was not injected: check your FXML file 'GroupHeader.fxml'.";
    assert grpTagSplitMenu != null : "fx:id=\"grpTagSplitMenu\" was not injected: check your FXML file 'GroupHeader.fxml'.";
    assert headerToolBar != null : "fx:id=\"headerToolBar\" was not injected: check your FXML file 'GroupHeader.fxml'.";
    assert segButton != null : "fx:id=\"previewList\" was not injected: check your FXML file 'GroupHeader.fxml'.";
    assert slideShowToggle != null : "fx:id=\"segButton\" was not injected: check your FXML file 'GroupHeader.fxml'.";
    assert tileToggle != null : "fx:id=\"tileToggle\" was not injected: check your FXML file 'GroupHeader.fxml'.";

    //configure flashing glow animation on next unseen group button
    flashAnimation.setCycleCount(Timeline.INDEFINITE);
    flashAnimation.setAutoReverse(true);

    //configure gridView cell properties
    gridView.cellHeightProperty().bind(Toolbar.getDefault().sizeSliderValue().add(75));
    gridView.cellWidthProperty().bind(Toolbar.getDefault().sizeSliderValue().add(75));
    gridView.setCellFactory((GridView<Long> param) -> new DrawableCell());

    //configure toolbar properties
    HBox.setHgrow(spacer, Priority.ALWAYS);
    spacer.setMinWidth(Region.USE_PREF_SIZE);

    try {
        grpTagSplitMenu.setText(TagUtils.getFollowUpTagName().getDisplayName());
        grpTagSplitMenu.setOnAction(createGrpTagMenuItem(TagUtils.getFollowUpTagName()).getOnAction());
    } catch (TskCoreException tskCoreException) {
        LOGGER.log(Level.WARNING, "failed to load FollowUpTagName", tskCoreException);
    }
    grpTagSplitMenu.setGraphic(new ImageView(DrawableAttribute.TAGS.getIcon()));
    grpTagSplitMenu.showingProperty()
            .addListener((ObservableValue<? extends Boolean> ov, Boolean t, Boolean t1) -> {
                if (t1) {
                    ArrayList<MenuItem> selTagMenues = new ArrayList<>();
                    for (final TagName tn : TagUtils.getNonCategoryTagNames()) {
                        MenuItem menuItem = TagUtils.createSelTagMenuItem(tn, grpTagSplitMenu);
                        selTagMenues.add(menuItem);
                    }
                    grpTagSplitMenu.getItems().setAll(selTagMenues);
                }
            });

    ArrayList<MenuItem> grpCategoryMenues = new ArrayList<>();
    for (final Category cat : Category.values()) {
        MenuItem menuItem = createGrpCatMenuItem(cat);
        grpCategoryMenues.add(menuItem);
    }
    grpCatSplitMenu.setText(Category.FIVE.getDisplayName());
    grpCatSplitMenu.setGraphic(new ImageView(DrawableAttribute.CATEGORY.getIcon()));
    grpCatSplitMenu.getItems().setAll(grpCategoryMenues);
    grpCatSplitMenu.setOnAction(createGrpCatMenuItem(Category.FIVE).getOnAction());

    Runnable syncMode = () -> {
        switch (groupViewMode.get()) {
        case SLIDE_SHOW:
            slideShowToggle.setSelected(true);
            break;
        case TILE:
            tileToggle.setSelected(true);
            break;
        }
    };
    syncMode.run();
    //make togle states match view state
    groupViewMode.addListener((o) -> {
        syncMode.run();
    });

    slideShowToggle.toggleGroupProperty().addListener((o) -> {
        slideShowToggle.getToggleGroup().selectedToggleProperty()
                .addListener((observable, oldToggle, newToggle) -> {
                    if (newToggle == null) {
                        oldToggle.setSelected(true);
                    }
                });
    });

    //listen to toggles and update view state
    slideShowToggle.setOnAction((ActionEvent t) -> {
        activateSlideShowViewer(globalSelectionModel.lastSelectedProperty().get());
    });

    tileToggle.setOnAction((ActionEvent t) -> {
        activateTileViewer();
    });

    controller.viewState().addListener((ObservableValue<? extends GroupViewState> observable,
            GroupViewState oldValue, GroupViewState newValue) -> {
        setViewState(newValue);
    });

    addEventFilter(KeyEvent.KEY_PRESSED, tileKeyboardNavigationHandler);
    gridView.addEventHandler(MouseEvent.MOUSE_CLICKED, new EventHandler<MouseEvent>() {

        private ContextMenu buildContextMenu() {
            ArrayList<MenuItem> menuItems = new ArrayList<>();

            menuItems.add(CategorizeAction.getPopupMenu());

            menuItems.add(AddDrawableTagAction.getInstance().getPopupMenu());

            Collection<? extends ContextMenuActionsProvider> menuProviders = Lookup.getDefault()
                    .lookupAll(ContextMenuActionsProvider.class);

            for (ContextMenuActionsProvider provider : menuProviders) {

                for (final Action act : provider.getActions()) {

                    if (act instanceof Presenter.Popup) {
                        Presenter.Popup aact = (Presenter.Popup) act;

                        menuItems.add(SwingMenuItemAdapter.create(aact.getPopupPresenter()));
                    }
                }
            }
            final MenuItem extractMenuItem = new MenuItem("Extract File(s)");
            extractMenuItem.setOnAction((ActionEvent t) -> {
                SwingUtilities.invokeLater(() -> {
                    TopComponent etc = WindowManager.getDefault()
                            .findTopComponent(ImageGalleryTopComponent.PREFERRED_ID);
                    ExtractAction.getInstance().actionPerformed(new java.awt.event.ActionEvent(etc, 0, null));
                });
            });
            menuItems.add(extractMenuItem);

            ContextMenu contextMenu = new ContextMenu(menuItems.toArray(new MenuItem[] {}));
            contextMenu.setAutoHide(true);
            return contextMenu;
        }

        @Override
        public void handle(MouseEvent t) {
            switch (t.getButton()) {
            case PRIMARY:
                if (t.getClickCount() == 1) {
                    globalSelectionModel.clearSelection();
                    if (contextMenu != null) {
                        contextMenu.hide();
                    }
                }
                t.consume();
                break;
            case SECONDARY:
                if (t.getClickCount() == 1) {
                    selectAllFiles();
                }
                if (globalSelectionModel.getSelected().isEmpty() == false) {
                    if (contextMenu == null) {
                        contextMenu = buildContextMenu();
                    }

                    contextMenu.hide();
                    contextMenu.show(GroupPane.this, t.getScreenX(), t.getScreenY());
                }
                t.consume();
                break;
            }
        }
    });

    ActionUtils.configureButton(nextGroupAction, nextButton);
    final EventHandler<ActionEvent> onAction = nextButton.getOnAction();
    nextButton.setOnAction((ActionEvent event) -> {
        flashAnimation.stop();
        nextButton.setEffect(null);
        onAction.handle(event);
    });

    ActionUtils.configureButton(forwardAction, forwardButton);
    ActionUtils.configureButton(backAction, backButton);

    nextGroupAction.disabledProperty().addListener(
            (ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) -> {
                nextButton.setEffect(newValue ? null : DROP_SHADOW);
                if (newValue == false) {
                    flashAnimation.play();
                } else {
                    flashAnimation.stop();
                }
            });

    //listen to tile selection and make sure it is visible in scroll area
    //TODO: make sure we are testing complete visability not just bounds intersection
    globalSelectionModel.lastSelectedProperty().addListener((observable, oldFileID, newFileId) -> {
        if (groupViewMode.get() == GroupViewMode.SLIDE_SHOW) {
            slideShowPane.setFile(newFileId);
        } else {

            scrollToFileID(newFileId);
        }
    });

    setViewState(controller.viewState().get());
}

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

public CFHBox getPanelHBoxMenu() {
    if (hboxMenu == null) {
        hboxMenu = new CFHBox(10);
        buttonAddPopTopDep = new CFButton();
        buttonAddPopTopDep.setMinWidth(200);
        buttonAddPopTopDep.setText("Add PopTopDep");
        buttonAddPopTopDep.setOnAction(new EventHandler<ActionEvent>() {
            @Override//from  w  ww.ja  v  a  2s .  c o  m
            public void handle(ActionEvent e) {
                final String S_ProcName = "handle";
                try {
                    ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema();
                    ICFBamPopTopDepObj obj = (ICFBamPopTopDepObj) schemaObj.getPopTopDepTableObj()
                            .newInstance();
                    ICFBamPopTopDepEditObj edit = (ICFBamPopTopDepEditObj) (obj.beginEdit());
                    if (edit == null) {
                        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(),
                                S_ProcName, 0, "edit");
                    }
                    ICFSecurityTenantObj secTenant = schemaObj.getSecTenant();
                    edit.setRequiredOwnerTenant(secTenant);
                    ICFBamRelationObj container = (ICFBamRelationObj) (getJavaFXContainer());
                    if (container == null) {
                        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(),
                                S_ProcName, 0, "JavaFXContainer");
                    }
                    edit.setRequiredContainerContRelation(container);
                    CFBorderPane frame = javafxSchema.getPopTopDepFactory().newAddForm(cfFormManager, obj,
                            getViewEditClosedCallback(), true);
                    ICFBamJavaFXPopTopDepPaneCommon jpanelCommon = (ICFBamJavaFXPopTopDepPaneCommon) frame;
                    jpanelCommon.setJavaFXFocus(obj);
                    jpanelCommon.setPaneMode(CFPane.PaneMode.Add);
                    cfFormManager.pushForm(frame);
                } catch (Throwable t) {
                    CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t);
                }
            }
        });
        hboxMenu.getChildren().add(buttonAddPopTopDep);
        buttonViewSelected = new CFButton();
        buttonViewSelected.setMinWidth(200);
        buttonViewSelected.setText("View Selected");
        buttonViewSelected.setOnAction(new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent e) {
                final String S_ProcName = "handle";
                try {
                    ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema();
                    if (schemaObj == null) {
                        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(),
                                S_ProcName, 0, "schemaObj");
                    }
                    ICFBamPopTopDepObj selectedInstance = getJavaFXFocusAsPopTopDep();
                    if (selectedInstance != null) {
                        String classCode = selectedInstance.getClassCode();
                        if ("POPT".equals(classCode)) {
                            CFBorderPane frame = javafxSchema.getPopTopDepFactory().newViewEditForm(
                                    cfFormManager, selectedInstance, getViewEditClosedCallback(), false);
                            ((ICFBamJavaFXPopTopDepPaneCommon) frame).setPaneMode(CFPane.PaneMode.View);
                            cfFormManager.pushForm(frame);
                        } else {
                            throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(),
                                    S_ProcName, "selectedInstance", selectedInstance, "ICFBamPopTopDepObj");
                        }
                    }
                } catch (Throwable t) {
                    CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t);
                }
            }
        });
        hboxMenu.getChildren().add(buttonViewSelected);

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

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

    }
    return (hboxMenu);
}

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

public CFHBox getPanelHBoxMenu() {
    if (hboxMenu == null) {
        hboxMenu = new CFHBox(10);
        buttonAddDelSubDep1 = new CFButton();
        buttonAddDelSubDep1.setMinWidth(200);
        buttonAddDelSubDep1.setText("Add DelSubDep1");
        buttonAddDelSubDep1.setOnAction(new EventHandler<ActionEvent>() {
            @Override/* ww w. ja  va2 s.co  m*/
            public void handle(ActionEvent e) {
                final String S_ProcName = "handle";
                try {
                    ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema();
                    ICFBamDelSubDep1Obj obj = (ICFBamDelSubDep1Obj) schemaObj.getDelSubDep1TableObj()
                            .newInstance();
                    ICFBamDelSubDep1EditObj edit = (ICFBamDelSubDep1EditObj) (obj.beginEdit());
                    if (edit == null) {
                        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(),
                                S_ProcName, 0, "edit");
                    }
                    ICFSecurityTenantObj secTenant = schemaObj.getSecTenant();
                    edit.setRequiredOwnerTenant(secTenant);
                    ICFBamDelTopDepObj container = (ICFBamDelTopDepObj) (getJavaFXContainer());
                    if (container == null) {
                        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(),
                                S_ProcName, 0, "JavaFXContainer");
                    }
                    edit.setRequiredContainerDelTopDep(container);
                    CFBorderPane frame = javafxSchema.getDelSubDep1Factory().newAddForm(cfFormManager, obj,
                            getViewEditClosedCallback(), true);
                    ICFBamJavaFXDelSubDep1PaneCommon jpanelCommon = (ICFBamJavaFXDelSubDep1PaneCommon) frame;
                    jpanelCommon.setJavaFXFocus(obj);
                    jpanelCommon.setPaneMode(CFPane.PaneMode.Add);
                    cfFormManager.pushForm(frame);
                } catch (Throwable t) {
                    CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t);
                }
            }
        });
        hboxMenu.getChildren().add(buttonAddDelSubDep1);
        buttonViewSelected = new CFButton();
        buttonViewSelected.setMinWidth(200);
        buttonViewSelected.setText("View Selected");
        buttonViewSelected.setOnAction(new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent e) {
                final String S_ProcName = "handle";
                try {
                    ICFBamSchemaObj schemaObj = (ICFBamSchemaObj) javafxSchema.getSchema();
                    if (schemaObj == null) {
                        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(),
                                S_ProcName, 0, "schemaObj");
                    }
                    ICFBamDelSubDep1Obj selectedInstance = getJavaFXFocusAsDelSubDep1();
                    if (selectedInstance != null) {
                        String classCode = selectedInstance.getClassCode();
                        if ("DEL1".equals(classCode)) {
                            CFBorderPane frame = javafxSchema.getDelSubDep1Factory().newViewEditForm(
                                    cfFormManager, selectedInstance, getViewEditClosedCallback(), false);
                            ((ICFBamJavaFXDelSubDep1PaneCommon) frame).setPaneMode(CFPane.PaneMode.View);
                            cfFormManager.pushForm(frame);
                        } else {
                            throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(),
                                    S_ProcName, "selectedInstance", selectedInstance, "ICFBamDelSubDep1Obj");
                        }
                    }
                } catch (Throwable t) {
                    CFConsole.formException(S_FormName, ((CFButton) e.getSource()).getText(), t);
                }
            }
        });
        hboxMenu.getChildren().add(buttonViewSelected);

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

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

    }
    return (hboxMenu);
}