Example usage for javafx.scene.control ToggleGroup ToggleGroup

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

Introduction

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

Prototype

public ToggleGroup() 

Source Link

Document

Creates a default ToggleGroup instance.

Usage

From source file:dpfmanager.shell.interfaces.gui.component.dessign.DessignView.java

private void addConfigFiles() {
    String previous = null;/* ww  w. j  ava  2 s.c  o  m*/
    if (selectedButton != null) {
        previous = selectedButton.getText();
    }
    selectedButton = null;
    group = new ToggleGroup();
    vBoxConfig = new VBox();
    vBoxConfig.setId("vBoxConfig");
    vBoxConfig.setSpacing(3);
    vBoxConfig.setPadding(new Insets(5));

    // Default one
    String description = interService.getDescriptionFromDefault();
    if (description != null) {
        addConfigFile(bundle.getString("default"), description,
                bundle.getString("default").equalsIgnoreCase(previous));
    }

    // User configs
    File folder = new File(DPFManagerProperties.getConfigDir());
    for (final File fileEntry : folder.listFiles()) {
        if (fileEntry.isFile()) {
            if (fileEntry.getName().toLowerCase().endsWith(".dpf")) {
                description = getController().readDescription(fileEntry);
                addConfigFile(fileEntry.getName(), description, fileEntry.getName().equalsIgnoreCase(previous));
            }
        }
    }

    // Drag and drop
    configScroll.setOnDragDropped(event -> {
        // Files dropped
        Dragboard db = event.getDragboard();
        boolean success = false;
        if (db.hasFiles()) {
            success = true;
            for (File file : db.getFiles()) {
                getController().addConfigFile(file, false);
            }
        }
        event.setDropCompleted(success);
        event.consume();
    });
    configScroll.setOnDragOver(event -> {
        if (acceptedFiles(event.getDragboard(), Arrays.asList("dpf"), false)) {
            event.acceptTransferModes(TransferMode.MOVE);
        }
        event.consume();
    });
    configScroll.setOnDragEntered(event -> {
        if (acceptedFiles(event.getDragboard(), Arrays.asList("dpf"), false)) {
            configScroll.getStyleClass().add("on-drag");
        }
        event.consume();
    });
    configScroll.setOnDragExited(event -> {
        configScroll.getStyleClass().remove("on-drag");
        event.consume();
    });

    configScroll.setContent(vBoxConfig);
}

From source file:dsfixgui.view.DSPWPane.java

private void initialize() {

    //Basic layout
    this.setFitToWidth(true);

    spacerColumn = new ColumnConstraints();
    spacerColumn.setFillWidth(true);/*from   www  .j a va 2 s .c  o m*/
    spacerColumn.setPercentWidth(3.0);
    primaryColumn = new ColumnConstraints();
    primaryColumn.setFillWidth(true);
    primaryColumn.setPercentWidth(95.0);
    primaryPane = new GridPane();
    primaryPane.getColumnConstraints().addAll(spacerColumn, primaryColumn);
    primaryVBox = new VBox();
    primaryVBox.getStyleClass().add("spacing_15");
    primaryPane.add(primaryVBox, 1, 0);
    titleLabel = new Label(DSPW_SHORT.toUpperCase() + " " + SETTINGS.toUpperCase());
    titleLabel.getStyleClass().add("settings_title");
    titleBar = new HBox();
    titleBar.setAlignment(Pos.CENTER);
    titleBar.getChildren().add(titleLabel);
    restoreDefaultsBar = new HBox();
    restoreDefaultsBar.setAlignment(Pos.CENTER);
    restoreDefaultsBar.setSpacing(5.0);
    applySettingsButton = new Button(APPLY_SETTINGS);
    restoreDefaultsButton = new Button(RESTORE_DEFAULTS);
    applySettingsButton.getStyleClass().add("translate_y_4");
    restoreDefaultsButton.getStyleClass().add("translate_y_4");
    restoreDefaultsBar.getChildren().addAll(applySettingsButton, restoreDefaultsButton);
    spacerHBox = new HBox();
    spacerHBox.setMinHeight(10.0);
    bottomSpacerHBox = new HBox();
    bottomSpacerHBox.setMinHeight(10.0);

    /////////////////////SETTINGS PANES/////////////////////
    //
    //
    //Version Banner
    versionBannerPane = new FlowPane();
    versionBannerPane.getStyleClass().add("settings_pane");
    versionBannerLabel = new Label(VERSION_LABEL);
    versionBannerLabel.getStyleClass().addAll("bold_text", "font_12_pt");
    versionBannerLabel.setTooltip(new Tooltip(VERSION_TT));
    versionBannerChoice = new ToggleGroup();
    versionBannerOn = new RadioButton(ON_OFF[0] + "   ");
    versionBannerOn.setToggleGroup(versionBannerChoice);
    versionBannerOff = new RadioButton(ON_OFF[1]);
    versionBannerOff.setToggleGroup(versionBannerChoice);
    if (config.ShowVersionBanner.toString().equals(TRUE_FALSE[0])) {
        versionBannerOn.setSelected(true);
    } else {
        versionBannerOff.setSelected(true);
    }
    versionBannerPane.getChildren().addAll(versionBannerLabel, versionBannerOn, versionBannerOff);
    //
    //Toggle Overlay
    overlayPane = new FlowPane();
    overlayPane.getStyleClass().add("settings_pane");
    overlayLabel = new Label(OVERLAY_LABEL);
    overlayLabel.getStyleClass().addAll("bold_text", "font_12_pt");
    overlayLabel.setTooltip(new Tooltip(OVERLAY_TT));
    overlayChoice = new ToggleGroup();
    overlayOn = new RadioButton(ON_OFF[0] + "   ");
    overlayOn.setToggleGroup(overlayChoice);
    overlayOff = new RadioButton(ON_OFF[1]);
    overlayOff.setToggleGroup(overlayChoice);
    if (config.ShowOverlay.toString().equals(TRUE_FALSE[0])) {
        overlayOn.setSelected(true);
    } else {
        overlayOff.setSelected(true);
    }
    overlayPane.getChildren().addAll(overlayLabel, overlayOn, overlayOff);
    //
    //Text Alignment
    textAlignmentPane = new FlowPane();
    textAlignmentPane.getStyleClass().add("settings_pane");
    textAlignmentLabel = new Label(TEXT_ALIGNMENT_LABEL);
    textAlignmentLabel.getStyleClass().addAll("bold_text", "font_12_pt");
    textAlignmentLabel.setTooltip(new Tooltip(TEXT_ALIGNMENT_TT));
    textAlignmentChoice = new ToggleGroup();
    textAlignmentLeft = new RadioButton(DSPW_TEXT_ALIGNMENT_OPTIONS[0] + "   ");
    textAlignmentLeft.setToggleGroup(textAlignmentChoice);
    textAlignmentCenter = new RadioButton(DSPW_TEXT_ALIGNMENT_OPTIONS[1]);
    textAlignmentCenter.setToggleGroup(textAlignmentChoice);
    textAlignmentRight = new RadioButton(DSPW_TEXT_ALIGNMENT_OPTIONS[2]);
    textAlignmentRight.setToggleGroup(textAlignmentChoice);
    if (config.TextAlignment.toString().equals(DSPW_TEXT_ALIGNMENT_OPTIONS[0])) {
        textAlignmentLeft.setSelected(true);
    } else if (config.TextAlignment.toString().equals(DSPW_TEXT_ALIGNMENT_OPTIONS[1])) {
        textAlignmentCenter.setSelected(true);
    } else {
        textAlignmentRight.setSelected(true);
    }
    textAlignmentPane.getChildren().addAll(textAlignmentLabel, textAlignmentLeft, textAlignmentCenter,
            textAlignmentRight);
    //
    //Invasion Notification Sound
    invasionNotifPane = new FlowPane();
    invasionNotifPane.getStyleClass().add("settings_pane");
    invasionNotifLabel = new Label(INVASION_NOTIF_LABEL);
    invasionNotifLabel.getStyleClass().addAll("bold_text", "font_12_pt");
    invasionNotifLabel.setTooltip(new Tooltip(INVASION_NOTIF_TT));
    invasionNotifChoice = new ToggleGroup();
    invasionNotifOn = new RadioButton(ON_OFF[0] + "   ");
    invasionNotifOn.setToggleGroup(invasionNotifChoice);
    invasionNotifOff = new RadioButton(ON_OFF[1]);
    invasionNotifOff.setToggleGroup(invasionNotifChoice);
    if (config.InvasionSoundNotification.toString().equals(TRUE_FALSE[0])) {
        invasionNotifOn.setSelected(true);
    } else {
        invasionNotifOff.setSelected(true);
    }
    invasionNotifPane.getChildren().addAll(invasionNotifLabel, invasionNotifOn, invasionNotifOff);
    //
    //Cheater Notification Sound
    cheaterNotifPane = new FlowPane();
    cheaterNotifPane.getStyleClass().add("settings_pane");
    cheaterNotifLabel = new Label(CHEATER_NOTIF_LABEL);
    cheaterNotifLabel.getStyleClass().addAll("bold_text", "font_12_pt");
    cheaterNotifLabel.setTooltip(new Tooltip(CHEATER_NOTIF_TT));
    cheaterNotifChoice = new ToggleGroup();
    cheaterNotifOn = new RadioButton(ON_OFF[0] + "   ");
    cheaterNotifOn.setToggleGroup(cheaterNotifChoice);
    cheaterNotifOff = new RadioButton(ON_OFF[1]);
    cheaterNotifOff.setToggleGroup(cheaterNotifChoice);
    if (config.CheaterSoundNotification.toString().equals(TRUE_FALSE[0])) {
        cheaterNotifOn.setSelected(true);
    } else {
        cheaterNotifOff.setSelected(true);
    }
    cheaterNotifPane.getChildren().addAll(cheaterNotifLabel, cheaterNotifOn, cheaterNotifOff);
    //
    //Block Arena Freeze
    blockArenaFreezePane = new FlowPane();
    blockArenaFreezePane.getStyleClass().add("settings_pane");
    blockArenaFreezeLabel = new Label(BLOCK_ARENA_FREEZE_LABEL);
    blockArenaFreezeLabel.getStyleClass().addAll("bold_text", "font_12_pt");
    blockArenaFreezeLabel.setTooltip(new Tooltip(BLOCK_ARENA_FREEZE_TT));
    blockArenaFreezeChoice = new ToggleGroup();
    blockArenaFreezeOn = new RadioButton(BLOCK_FREEZE_CHOICES[0] + "   ");
    blockArenaFreezeOn.setToggleGroup(blockArenaFreezeChoice);
    blockArenaFreezeOff = new RadioButton(BLOCK_FREEZE_CHOICES[1]);
    blockArenaFreezeOff.setToggleGroup(blockArenaFreezeChoice);
    if (config.BlockArenaFreeze.toString().equals(TRUE_FALSE[0])) {
        blockArenaFreezeOn.setSelected(true);
    } else {
        blockArenaFreezeOff.setSelected(true);
    }
    blockArenaFreezePane.getChildren().addAll(blockArenaFreezeLabel, blockArenaFreezeOn, blockArenaFreezeOff);
    //
    //Show Node Count
    nodeCountPane = new FlowPane();
    nodeCountPane.getStyleClass().add("settings_pane");
    nodeCountLabel = new Label(NODE_COUNT_LABEL);
    nodeCountLabel.getStyleClass().addAll("bold_text", "font_12_pt");
    nodeCountLabel.setTooltip(new Tooltip(NODE_COUNT_TT));
    nodeCountChoice = new ToggleGroup();
    nodeCountOn = new RadioButton(ON_OFF[0] + "   ");
    nodeCountOn.setToggleGroup(nodeCountChoice);
    nodeCountOff = new RadioButton(ON_OFF[1]);
    nodeCountOff.setToggleGroup(nodeCountChoice);
    if (config.ShowNodeDbCount.toString().equals(TRUE_FALSE[0])) {
        nodeCountOn.setSelected(true);
    } else {
        nodeCountOff.setSelected(true);
    }
    nodeCountPane.getChildren().addAll(nodeCountLabel, nodeCountOn, nodeCountOff);
    //
    //Increase Node Limit
    increaseNodesPane = new FlowPane();
    increaseNodesPane.getStyleClass().add("settings_pane");
    increaseNodesLabel = new Label(INCREASE_NODES_LABEL);
    increaseNodesLabel.getStyleClass().addAll("bold_text", "font_12_pt");
    increaseNodesLabel.setTooltip(new Tooltip(INCREASE_NODES_TT));
    increaseNodesChoice = new ToggleGroup();
    increaseNodesOn = new RadioButton(ON_OFF[0] + "   ");
    increaseNodesOn.setToggleGroup(increaseNodesChoice);
    increaseNodesOff = new RadioButton(ON_OFF[1]);
    increaseNodesOff.setToggleGroup(increaseNodesChoice);
    if (config.IncreaseNodeDbLimit.toString().equals(TRUE_FALSE[0])) {
        increaseNodesOn.setSelected(true);
    } else {
        increaseNodesOff.setSelected(true);
    }
    increaseNodesPane.getChildren().addAll(increaseNodesLabel, increaseNodesOn, increaseNodesOff);
    //
    //Font Size
    fontSizePane = new FlowPane();
    fontSizePane.getStyleClass().add("settings_pane");
    fontSizeLabel = new Label(FONT_SIZE_LABEL + " ");
    fontSizeLabel.setTooltip(new Tooltip(FONT_SIZE_TT));
    fontSizeLabel.getStyleClass().addAll("bold_text", "font_12_pt");
    fontSizeField = new TextField("" + config.FontSize.toString());
    fontSizeField.getStyleClass().add("settings_text_field");
    fontSizeField.setTooltip(new Tooltip(FONT_SIZE_FIELD_TT));
    fontSizePane.getChildren().addAll(fontSizeLabel, fontSizeField);
    //
    //Toggle Date
    datePane = new FlowPane();
    datePane.getStyleClass().add("settings_pane");
    dateLabel = new Label(DATE_LABEL);
    dateLabel.getStyleClass().addAll("bold_text", "font_12_pt");
    dateLabel.setTooltip(new Tooltip(DATE_TT));
    dateChoice = new ToggleGroup();
    dateOn = new RadioButton(ON_OFF[0] + "   ");
    dateOn.setToggleGroup(dateChoice);
    dateOff = new RadioButton(ON_OFF[1]);
    dateOff.setToggleGroup(dateChoice);
    if (config.DisplayDate.toString().equals(TRUE_FALSE[0])) {
        dateOn.setSelected(true);
    } else {
        dateOff.setSelected(true);
    }
    datePane.getChildren().addAll(dateLabel, dateOn, dateOff);
    //
    //Toggle Time
    timePane = new FlowPane();
    timePane.getStyleClass().add("settings_pane");
    timeLabel = new Label(TIME_LABEL);
    timeLabel.getStyleClass().addAll("bold_text", "font_12_pt");
    timeLabel.setTooltip(new Tooltip(TIME_TT));
    timeChoice = new ToggleGroup();
    timeOn = new RadioButton(ON_OFF[0] + "   ");
    timeOn.setToggleGroup(timeChoice);
    timeOff = new RadioButton(ON_OFF[1]);
    timeOff.setToggleGroup(timeChoice);
    if (config.DisplayClock.toString().equals(TRUE_FALSE[0])) {
        timeOn.setSelected(true);
    } else {
        timeOff.setSelected(true);
    }
    timePane.getChildren().addAll(timeLabel, timeOn, timeOff);
    //
    //Check for Updates
    updatePane = new FlowPane();
    updatePane.getStyleClass().add("settings_pane");
    updateLabel = new Label(UPDATE_LABEL);
    updateLabel.getStyleClass().addAll("bold_text", "font_12_pt");
    updateLabel.setTooltip(new Tooltip(UPDATE_TT));
    updateChoice = new ToggleGroup();
    updateOn = new RadioButton(ON_OFF[0] + "   ");
    updateOn.setToggleGroup(updateChoice);
    updateOff = new RadioButton(ON_OFF[1]);
    updateOff.setToggleGroup(updateChoice);
    if (config.CheckForUpdates.toString().equals(TRUE_FALSE[0])) {
        updateOn.setSelected(true);
    } else {
        updateOff.setSelected(true);
    }
    updatePane.getChildren().addAll(updateLabel, updateOn, updateOff);
    //
    //DLL Chaining
    dllChainPane = new FlowPane();
    dllChainPane.getStyleClass().add("settings_pane");
    dllChainLabel = new Label(DLL_CHAIN_LABEL + " ");
    dllChainLabel.getStyleClass().addAll("bold_text", "font_12_pt");
    dllChainLabel.setTooltip(new Tooltip(DSPW_DLL_CHAIN_TT));
    dllChainField = new TextField();
    dllChainField.setEditable(false);
    dllChainButton = new Button("...");
    dllChainButton.setTooltip(new Tooltip(DLL_CHAIN_TOOLTIP));
    noChainButton = new Button(NO_CHAIN_BT);
    if (config.d3d9dllWrapper.toString().equals(NONE)) {
        noChainButton.setDisable(true);
        dllChainField.setStyle("-fx-text-fill: gray;");
    } else {
        noChainButton.setDisable(false);
    }
    dllChainField.setText(config.d3d9dllWrapper.toString());
    dllChainPane.getChildren().addAll(dllChainLabel, dllChainField, dllChainButton, noChainButton);
    //
    //
    //
    //////////////////////////////////
    ///////////Key Bindings///////////
    //////////////////////////////////
    //
    //
    //Keybinds Parent Label
    keybindsPane = new FlowPane();
    keybindsPane.getStyleClass().add("settings_pane");
    keybindsLabel = new Label(KEYBINDS_LABEL);
    keybindsLabel.getStyleClass().addAll("bold_text", "font_14_pt");
    keybindsPane.getChildren().add(keybindsLabel);
    //
    //Ban Phantom
    banPane = new FlowPane();
    banPane.getStyleClass().add("settings_pane");
    banLabel = new Label(BAN_LABEL + "  ");
    banLabel.getStyleClass().addAll("bold_text", "font_12_pt");
    banPicker = new ComboBox(keybinds);
    banPicker.setValue(keybinds.get(keybindsHex.indexOf(config.key_BanPhantom.toString())));
    banPane.getChildren().addAll(banLabel, banPicker);
    //
    //Ignore Phantom
    ignorePane = new FlowPane();
    ignorePane.getStyleClass().add("settings_pane");
    ignoreLabel = new Label(IGNORE_LABEL + "  ");
    ignoreLabel.getStyleClass().addAll("bold_text", "font_12_pt");
    ignorePicker = new ComboBox(keybinds);
    ignorePicker.setValue(keybinds.get(keybindsHex.indexOf(config.key_IgnorePhantom.toString())));
    ignorePane.getChildren().addAll(ignoreLabel, ignorePicker);
    //
    //Toggle Overlay
    toggleOverlayPane = new FlowPane();
    toggleOverlayPane.getStyleClass().add("settings_pane");
    toggleOverlayLabel = new Label(TOGGLE_OVERLAY_LABEL + "  ");
    toggleOverlayLabel.getStyleClass().addAll("bold_text", "font_12_pt");
    toggleOverlayPicker = new ComboBox(keybinds);
    toggleOverlayPicker.setValue(keybinds.get(keybindsHex.indexOf(config.key_HideOverlay.toString())));
    toggleOverlayPane.getChildren().addAll(toggleOverlayLabel, toggleOverlayPicker);
    //
    //About Dark Souls PvP Watchdog
    aboutPane = new FlowPane();
    aboutPane.getStyleClass().add("settings_pane");
    aboutLabel = new Label(ABOUT_DSPW_LABEL + "  ");
    aboutLabel.getStyleClass().addAll("bold_text", "font_12_pt");
    aboutPicker = new ComboBox(keybinds);
    aboutPicker.setValue(keybinds.get(keybindsHex.indexOf(config.key_AboutDSPW.toString())));
    aboutPane.getChildren().addAll(aboutLabel, aboutPicker);

    primaryVBox.getChildren().addAll(titleBar, restoreDefaultsBar, spacerHBox, versionBannerPane, overlayPane,
            textAlignmentPane, invasionNotifPane, cheaterNotifPane, blockArenaFreezePane, nodeCountPane,
            increaseNodesPane, fontSizePane, datePane, timePane, updatePane, dllChainPane, keybindsPane,
            banPane, ignorePane, toggleOverlayPane, aboutPane, bottomSpacerHBox);

    initializeEventHandlers();

    this.setContent(primaryPane);
}

From source file:boundary.GraphPane.java

private HBox addTransformingModeOptions() {
    HBox hBox = new HBox();

    hBox.setPadding(new Insets(15, 12, 15, 12));
    hBox.setSpacing(10);/*  w w w  . j  ava  2 s.c  o m*/
    hBox.setStyle("-fx-background-color: #66FFFF;");

    final ToggleGroup optionGroup = new ToggleGroup();

    Label lblMouseMode = new Label("Mouse Mode: ");
    lblMouseMode.setPrefSize(100, 20);

    RadioButton rbTransform = new RadioButton("Pan & Zoom");
    rbTransform.setPrefSize(100, 20);
    rbTransform.setToggleGroup(optionGroup);
    rbTransform.setUserData("T");
    rbTransform.setSelected(true);

    RadioButton rbPick = new RadioButton("Picking");
    rbPick.setPrefSize(100, 20);
    rbPick.setUserData("P");
    rbPick.setToggleGroup(optionGroup);

    optionGroup.selectedToggleProperty().addListener(new ChangeListener<Toggle>() {

        @Override
        public void changed(ObservableValue<? extends Toggle> observable, Toggle oldValue, Toggle newValue) {
            if (optionGroup.getSelectedToggle() != null) {
                DefaultModalGraphMouse dmg = (DefaultModalGraphMouse) vv.getGraphMouse();

                if (optionGroup.getSelectedToggle().getUserData().equals("T")) {
                    dmg.setMode(Mode.TRANSFORMING);
                } else if (optionGroup.getSelectedToggle().getUserData().equals("P")) {
                    dmg.setMode(Mode.PICKING);
                }
            }

        }
    });

    hBox.getChildren().addAll(lblMouseMode, rbTransform, rbPick);

    return hBox;

}

From source file:FeeBooster.java

private GridPane cpfpGrid(Transaction tx) {
    // Setup Grid
    GridPane grid = new GridPane();
    grid.setAlignment(Pos.CENTER);/*from  w ww. java 2  s.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:de.pixida.logtest.designer.automaton.AutomatonEdge.java

@Override
public Node getConfigFrame() {
    final ConfigFrame cf = new ConfigFrame("Edge properties");

    final int nameInputLines = 1;
    this.createTextAreaInput(nameInputLines, cf, "Name", this.getName(), newValue -> this.setName(newValue),
            Monospace.NO);//  w w  w .  ja v a  2 s  .c  o m

    final int descriptionInputLines = 2;
    this.createTextAreaInput(descriptionInputLines, cf, "Description", this.getDescription(),
            newValue -> this.setDescription(newValue), Monospace.NO);

    this.createTextFieldInput(cf, "Regular Expression", this.getRegExp(), newValue -> this.setRegExp(newValue),
            Monospace.YES);

    final int scriptInputLines = 3;
    this.createTextAreaInput(scriptInputLines, cf, "Check Expression", this.getCheckExp(),
            newValue -> this.setCheckExp(newValue), Monospace.YES);

    final VBox specialTriggers = new VBox();
    specialTriggers.getChildren().add(this.createCheckBoxInput("Always Trigger (don't evaluate any conditions)",
            this.getTriggerAlways(), newValue -> this.setTriggerAlways(newValue)));
    specialTriggers.getChildren().add(this.createCheckBoxInput("Trigger On EOF", this.getTriggerOnEof(),
            newValue -> this.setTriggerOnEof(newValue)));
    cf.addOption("Special Triggers", specialTriggers);

    this.createTextAreaInput(scriptInputLines, cf, "On Walk", this.getOnWalk(),
            newValue -> this.setOnWalk(newValue), Monospace.YES);

    final VBox requiredConditionsAndOrOr = new VBox();
    final ToggleGroup tg = new ToggleGroup();
    if (this.getRequiredConditions() == null) {
        this.setRequiredConditions(IEdgeDefinition.DEFAULT_REQUIRED_CONDITIONS_VALUE);
    }
    requiredConditionsAndOrOr.getChildren().add(this.createRadioButtonInput(tg, "All (AND)",
            this.getRequiredConditions() == RequiredConditions.ALL, newValue -> {
                if (newValue) {
                    this.setRequiredConditions(RequiredConditions.ALL);
                }
            }));
    requiredConditionsAndOrOr.getChildren().add(this.createRadioButtonInput(tg, "One (OR)",
            this.getRequiredConditions() == RequiredConditions.ONE, newValue -> {
                if (newValue) {
                    this.setRequiredConditions(RequiredConditions.ONE);
                }
            }));
    cf.addOption("Required Conditions", requiredConditionsAndOrOr);

    this.createTextFieldInput(cf, "Channel", this.getChannel(), newValue -> this.setChannel(newValue),
            Monospace.NO);

    this.createTimeIntervalInput(cf, this.timeIntervalSinceLastMicrotransition);
    this.createTimeIntervalInput(cf, this.timeIntervalSinceLastTransition);
    this.createTimeIntervalInput(cf, this.timeIntervalSinceAutomatonStart);
    this.createTimeIntervalInput(cf, this.timeIntervalForEvent);

    return cf;
}

From source file:dsfixgui.view.DSFGraphicsPane.java

private void initialize() {

    //Basic layout
    this.setFitToWidth(true);

    spacerColumn = new ColumnConstraints();
    spacerColumn.setFillWidth(true);//from w w w.j  a v a  2 s  . co  m
    spacerColumn.setPercentWidth(3.0);
    primaryColumn = new ColumnConstraints();
    primaryColumn.setFillWidth(true);
    primaryColumn.setPercentWidth(95.0);
    primaryPane = new GridPane();
    primaryPane.getColumnConstraints().addAll(spacerColumn, primaryColumn);
    primaryVBox = new VBox();
    primaryVBox.getStyleClass().add("spacing_15");
    primaryPane.add(primaryVBox, 1, 0);
    titleLabel = new Label(GRAPHICS.toUpperCase() + " " + SETTINGS.toUpperCase());
    titleLabel.getStyleClass().add("settings_title");
    titleBar = new HBox();
    titleBar.setAlignment(Pos.CENTER);
    titleBar.getChildren().add(titleLabel);
    restoreDefaultsBar = new HBox();
    restoreDefaultsBar.setAlignment(Pos.CENTER);
    restoreDefaultsBar.setSpacing(5.0);
    applySettingsButton = new Button(APPLY_SETTINGS);
    restoreDefaultsButton = new Button(RESTORE_DEFAULTS);
    applySettingsButton.getStyleClass().add("translate_y_4");
    restoreDefaultsButton.getStyleClass().add("translate_y_4");
    restoreDefaultsBar.getChildren().addAll(applySettingsButton, restoreDefaultsButton);
    spacerHBox = new HBox();
    spacerHBox.setMinHeight(10.0);
    bottomSpacerHBox = new HBox();
    bottomSpacerHBox.setMinHeight(10.0);

    /////////////////////SETTINGS PANES/////////////////////
    //
    //
    //
    //MAIN GRAPHICS OPTIONS
    //
    //Render resolution
    renderResPane = new FlowPane();
    renderResPane.getStyleClass().add("settings_pane");
    renderResLabel = new Label(RENDER_RES_LABEL + "   ");
    renderResLabel.getStyleClass().addAll("bold_text", "font_12_pt");
    renderResLabel.setTooltip(new Tooltip(RENDER_RES_TT));
    renderWidthLabel = new Label(WIDTH_HEIGHT[0] + ":");
    renderWidthField = new TextField("");
    renderWidthField.appendText("" + config.getRenderWidth());
    renderWidthField.getStyleClass().add("settings_text_field");
    renderHeightLabel = new Label("  " + WIDTH_HEIGHT[1] + ":");
    renderHeightField = new TextField("");
    renderHeightField.appendText("" + config.getRenderHeight());
    renderHeightField.getStyleClass().add("settings_text_field");
    setWindowsRenderRes = new Button(USE_WINDOWS_RES);
    renderResPane.getChildren().addAll(renderResLabel, renderWidthLabel, renderWidthField, renderHeightLabel,
            renderHeightField, setWindowsRenderRes);
    //
    //Present Resolution
    presentResPane = new FlowPane();
    presentResPane.getStyleClass().add("settings_pane");
    presentResLabel = new Label(PRESENT_RES_LABEL + "  ");
    presentResLabel.getStyleClass().addAll("bold_text", "font_12_pt");
    presentResLabel.setTooltip(new Tooltip(PRESENT_RES_TT));
    presentResSpacer = new HBox();
    presentResSpacer.setMinWidth(3);
    presentWidthLabel = new Label(WIDTH_HEIGHT[0] + ":");
    presentWidthField = new TextField("");
    presentWidthField.appendText(config.getPresentWidth() + "");
    presentRes[0] = config.getPresentWidth() + "";
    presentWidthField.getStyleClass().add("settings_text_field");
    presentHeightLabel = new Label("  " + WIDTH_HEIGHT[1] + ":");
    presentHeightField = new TextField("");
    presentHeightField.appendText(config.getPresentHeight() + "");
    presentRes[1] = config.getPresentHeight() + "";
    presentHeightField.getStyleClass().add("settings_text_field");
    setWindowsPresentRes = new Button(USE_WINDOWS_RES);
    presentResSpacer2 = new HBox();
    presentResSpacer2.setMinWidth(5);
    presentResChoice = new ToggleGroup();
    usePresentRes = new RadioButton(USE_PRESENT_RES + "   ");
    usePresentRes.setToggleGroup(presentResChoice);
    dontUsePresentRes = new RadioButton(DONT_USE_PRES_RES);
    dontUsePresentRes.setToggleGroup(presentResChoice);
    //Check if presentRes is off
    if (config.getPresentWidth() == 0 && config.getPresentHeight() == 0) {
        presentWidthField.setDisable(true);
        presentHeightField.setDisable(true);
        setWindowsPresentRes.setDisable(true);
        dontUsePresentRes.setSelected(true);
    } else {
        presentWidthField.setDisable(false);
        presentWidthField.setText("" + config.getPresentWidth());
        presentHeightField.setDisable(false);
        presentHeightField.setText("" + config.getPresentHeight());
        setWindowsPresentRes.setDisable(false);
        usePresentRes.setSelected(true);
        recheckTextInput(presentWidthField);
        recheckTextInput(presentHeightField);
    }
    presentResPane.getChildren().addAll(presentResLabel, presentResSpacer, presentWidthLabel, presentWidthField,
            presentHeightLabel, presentHeightField, setWindowsPresentRes, presentResSpacer2, usePresentRes,
            dontUsePresentRes);
    //
    //
    //
    //ANTIALIASING OPTIONS
    //
    //AA Quality
    aaQualityPane = new FlowPane();
    aaQualityPane.getStyleClass().add("settings_pane");
    aaQualityLabel = new Label(AA_QUALITY_LABEL + "  ");
    aaQualityLabel.getStyleClass().addAll("bold_text", "font_12_pt");
    aaQualityLabel.setTooltip(new Tooltip(AA_QUALITY_TT));
    aaQualityPicker = new ComboBox(FXCollections.observableArrayList(AAQUALITIES));
    aaQualityPicker.setValue(AAQUALITIES[config.aaQuality.get()]);
    aaQualityPane.getChildren().addAll(aaQualityLabel, aaQualityPicker);
    //
    //AA Type
    aaTypePane = new FlowPane();
    aaTypePane.getStyleClass().add("settings_pane");
    aaTypeLabel = new Label(AA_TYPE_LABEL + "  ");
    aaTypeLabel.getStyleClass().addAll("bold_text", "font_12_pt");
    aaTypeLabel.setTooltip(new Tooltip(AA_TYPE_TT));
    aaTypePicker = new ComboBox(FXCollections.observableArrayList(AATYPES));
    aaTypePicker.setValue(config.aaType.toString());
    if (config.aaQuality.get() == 0) {
        aaTypePicker.setDisable(true);
    }
    aaTypePane.getChildren().addAll(aaTypeLabel, aaTypePicker);
    //
    //
    //
    //AMBIENT OCCLUSION OPTIONS
    //
    //SSAO Strength
    ssaoStrengthPane = new FlowPane();
    ssaoStrengthPane.getStyleClass().add("settings_pane");
    ssaoStrengthLabel = new Label(SSAO_STRENGTH_LABEL + "  ");
    ssaoStrengthLabel.getStyleClass().addAll("bold_text", "font_12_pt");
    ssaoStrengthLabel.setTooltip(new Tooltip(SSAO_STRENGTH_TT));
    ssaoStrengthPicker = new ComboBox(FXCollections.observableArrayList(SSAOSTRENGTHS));
    ssaoStrengthPicker.setValue(SSAOSTRENGTHS[config.ssaoStrength.get()]);
    ssaoStrengthPane.getChildren().addAll(ssaoStrengthLabel, ssaoStrengthPicker);
    //
    //SSAO Scale
    ssaoScalePane = new FlowPane();
    ssaoScalePane.getStyleClass().add("settings_pane");
    ssaoScaleLabel = new Label(SSAO_SCALE_LABEL + "  ");
    ssaoScaleLabel.getStyleClass().addAll("bold_text", "font_12_pt");
    ssaoScaleLabel.setTooltip(new Tooltip(SSAO_SCALE_TT));
    ssaoScalePicker = new ComboBox(FXCollections.observableArrayList(SSAOSCALES));
    ssaoScalePicker.setValue(SSAOSCALES[config.ssaoScale.get() - 1]);
    if (config.ssaoStrength.get() == 0) {
        ssaoScalePicker.setDisable(true);
    }
    ssaoScalePane.getChildren().addAll(ssaoScaleLabel, ssaoScalePicker);
    //
    //SSAO Type
    ssaoTypePane = new FlowPane();
    ssaoTypePane.getStyleClass().add("settings_pane");
    ssaoTypeLabel = new Label(SSAO_TYPE_LABEL + "  ");
    ssaoTypeLabel.setTooltip(new Tooltip(SSAO_TYPE_TT));
    ssaoTypeLabel.getStyleClass().addAll("bold_text", "font_12_pt");
    ssaoTypePicker = new ComboBox(FXCollections.observableArrayList(SSAOTYPES));
    ssaoTypePicker.setValue(config.ssaoType.toString());
    if (config.ssaoStrength.get() == 0) {
        ssaoTypePicker.setDisable(true);
    }
    ssaoTypePane.getChildren().addAll(ssaoTypeLabel, ssaoTypePicker);
    //
    //
    //
    //DEPTH OF FIELD OPTIONS
    //
    //DOF Override Resolution
    dofOverridePane = new FlowPane();
    dofOverridePane.getStyleClass().add("settings_pane");
    dofOverrideLabel = new Label(DOF_OVERRIDE_LABEL + "  ");
    dofOverrideLabel.getStyleClass().addAll("bold_text", "font_12_pt");
    dofOverrideLabel.setTooltip(new Tooltip(DOF_OVERRIDE_TT));
    dofOverridePicker = new ComboBox(FXCollections.observableArrayList(DOFOVERRIDERESOLUTIONS));
    for (int i = 0; i < DOF_OVERRIDE_OPTIONS.length; i++) {
        if (config.getDOFOverride() == DOF_OVERRIDE_OPTIONS[i]) {
            dofOverridePicker.setValue(DOFOVERRIDERESOLUTIONS[i]);
        }
    }
    dofOverridePane.getChildren().addAll(dofOverrideLabel, dofOverridePicker);
    //
    //DOF Scaling
    dofScalingPane = new FlowPane();
    dofScalingPane.getStyleClass().add("settings_pane");
    dofScalingLabel = new Label(DOF_SCALING_LABEL + "  ");
    dofScalingLabel.getStyleClass().addAll("bold_text", "font_12_pt");
    dofScalingLabel.setTooltip(new Tooltip(DOF_SCALING_OR_TT));
    dofScalingChoice = new ToggleGroup();
    dofScalingEnabled = new RadioButton(ENABLE_DISABLE[0] + "   ");
    dofScalingEnabled.setToggleGroup(dofScalingChoice);
    dofScalingDisabled = new RadioButton(ENABLE_DISABLE[1]);
    dofScalingDisabled.setToggleGroup(dofScalingChoice);
    if (config.disableDofScaling.get() == 0) {
        dofScalingEnabled.setSelected(true);
    } else {
        dofScalingDisabled.setSelected(true);
    }
    dofScalingPane.getChildren().addAll(dofScalingLabel, dofScalingEnabled, dofScalingDisabled);
    //
    //DOF Additional Blur
    dofAddPane = new FlowPane();
    dofAddPane.getStyleClass().add("settings_pane");
    dofAddLabel = new Label(DOF_ADD_BLUR_LABEL + "  ");
    dofAddLabel.getStyleClass().addAll("bold_text", "font_12_pt");
    dofAddLabel.setTooltip(new Tooltip(DOF_ADD_BLUR_TT));
    dofAddPicker = new ComboBox(FXCollections.observableArrayList(DOF_ADDITIONAL_BLUR));
    for (int i = 0; i < DOF_ADDITIONAL_BLUR_OPTIONS.length; i++) {
        if (config.dofBlurAmount.toString().equals(DOF_ADDITIONAL_BLUR_OPTIONS[i])) {
            dofAddPicker.setValue(DOF_ADDITIONAL_BLUR[i]);
        }
    }
    dofAddPane.getChildren().addAll(dofAddLabel, dofAddPicker);
    if (config.disableDOF) {
        dofScalingEnabled.setDisable(true);
        dofScalingDisabled.setDisable(true);
        dofAddPicker.setDisable(true);
        dofOverridePicker.setValue(DOFOVERRIDERESOLUTIONS[5]);
        setWindowsPresentRes.setDisable(true);
        presentWidthField.setDisable(true);
        presentHeightField.setDisable(true);
        usePresentRes.setDisable(true);
        dontUsePresentRes.setDisable(true);
    }
    //
    //
    //
    //FRAMERATE OPTIONS
    //
    //Unlock Framerate
    unlockFPSPane = new FlowPane();
    unlockFPSPane.getStyleClass().add("settings_pane");
    unlockFPSLabel = new Label(UNLOCK_FPS_LABEL + "  ");
    unlockFPSLabel.getStyleClass().addAll("bold_text", "font_12_pt");
    unlockFPSLabel.setTooltip(new Tooltip(UNLOCK_FPS_TT));
    unlockFPSChoice = new ToggleGroup();
    fpsLocked = new RadioButton(LOCK_UNLOCK[0] + "   ");
    fpsLocked.setToggleGroup(unlockFPSChoice);
    fpsUnlocked = new RadioButton(LOCK_UNLOCK[1]);
    fpsUnlocked.setToggleGroup(unlockFPSChoice);
    if (config.unlockFPS.get() == 0) {
        fpsLocked.setSelected(true);
    } else {
        fpsUnlocked.setSelected(true);
    }
    unlockFPSPane.getChildren().addAll(unlockFPSLabel, fpsLocked, fpsUnlocked);
    //
    //Bonfire FPSFix Keybind
    fpsFixKeyPane = new FlowPane();
    fpsFixKeyPane.getStyleClass().add("settings_pane");
    fpsFixKeyLabel = new Label(FPS_FIX_KEY_LABEL + "  ");
    fpsFixKeyLabel.getStyleClass().addAll("bold_text", "font_12_pt");
    fpsFixKeyLabel.setTooltip(new Tooltip(FPS_FIX_TT));

    fpsFixKeyPicker = new ComboBox(FPS_FIX_KEYS_ARRAY_LIST);
    fpsFixKeyPicker.setTooltip(new Tooltip(FPS_FIX_TT));
    fpsFixKeyPane.getChildren().addAll(fpsFixKeyLabel, fpsFixKeyPicker);
    //
    fpsFixKey = getFPSFixKey();
    if (fpsFixKey != null) {
        fpsFixKeyPicker.setValue(FPS_FIX_KEYS[FPS_FIX_KEYS_HEX_ARRAY_LIST.indexOf("0x" + fpsFixKey)]);
    } else {
        fpsFixKeyPicker.setValue(FPS_FIX_KEYS[4]);
        fpsFixKeyPicker.setDisable(true);
    }
    //
    //FPS Limit
    fpsLimitPane = new FlowPane();
    fpsLimitPane.getStyleClass().add("settings_pane");
    fpsLimitLabel = new Label(FPS_LIMIT_LABEL + "         ");
    fpsLimitLabel.getStyleClass().addAll("bold_text", "font_12_pt");
    fpsLimitLabel.setTooltip(new Tooltip(FPS_LIMIT_TT));
    fpsLimitField = new TextField("" + config.FPSlimit);
    fpsLimitField.getStyleClass().add("settings_small_text_field");
    fpsLimitPane.getChildren().addAll(fpsLimitLabel, fpsLimitField);
    //
    if (config.unlockFPS.get() == 0) {
        fpsLimitField.setDisable(true);
    }
    //
    //FPS Threshold (for automatic disabling of AA)
    fpsThresholdPane = new FlowPane();
    fpsThresholdPane.getStyleClass().add("settings_pane");
    fpsThresholdLabel = new Label(FPS_THRESHOLD_LABEL + " ");
    fpsThresholdLabel.getStyleClass().addAll("bold_text", "font_12_pt");
    fpsThresholdLabel.setTooltip(new Tooltip(FPS_THRESHOLD_TT));
    fpsThresholdField = new TextField("" + config.FPSthreshold);
    fpsThresholdField.getStyleClass().add("settings_small_text_field");
    fpsThresholdPane.getChildren().addAll(fpsThresholdLabel, fpsThresholdField);
    //
    //
    //
    //TEXTURE FILTERING OPTIONS
    //
    //Texture Filtering Override
    texOverridePane = new FlowPane();
    texOverridePane.getStyleClass().add("settings_pane");
    texOverrideLabel = new Label(TEX_FILTERING_OVERRIDE_LABEL + "  ");
    texOverrideLabel.getStyleClass().addAll("bold_text", "font_12_pt");
    texOverrideLabel.setTooltip(new Tooltip(TEX_FILT_OR_TT));
    texOverridePicker = new ComboBox(FXCollections.observableArrayList(FILTERINGOVERRIDES));
    for (int i = 0; i < FILTERING_OVERRIDE_OPTIONS.length; i++) {
        if (config.filteringOverride.get() == i) {
            texOverridePicker.setValue(FILTERINGOVERRIDES[i]);
        }
    }
    texOverridePane.getChildren().addAll(texOverrideLabel, texOverridePicker);

    primaryVBox.getChildren().addAll(titleBar, restoreDefaultsBar, spacerHBox, renderResPane, presentResPane,
            aaQualityPane, aaTypePane, ssaoStrengthPane, ssaoScalePane, ssaoTypePane, dofOverridePane,
            dofScalingPane, dofAddPane, fpsFixKeyPane, unlockFPSPane, fpsLimitPane, fpsThresholdPane,
            texOverridePane, bottomSpacerHBox);

    if (config.disableDOF) {
        dofScalingEnabled.setDisable(true);
        dofScalingDisabled.setDisable(true);
        dofAddPicker.setDisable(true);
        presentWidthField.setDisable(true);
        presentHeightField.setDisable(true);
        setWindowsPresentRes.setDisable(true);
        usePresentRes.setDisable(true);
        dontUsePresentRes.setDisable(true);
        dofScalingDisabled.setSelected(true);
        dofAddPicker.setValue(dofAddPicker.getItems().get(0));
        if (usePresentRes.isSelected()) {
            presentRes[0] = presentWidthField.getText();
            presentRes[1] = presentHeightField.getText();
        }
        presentWidthField.setText("0");
        presentHeightField.setText("0");
    }

    recheckTextInput(presentWidthField);
    recheckTextInput(presentHeightField);
    recheckTextInput(renderWidthField);
    recheckTextInput(renderHeightField);

    initializeEventHandlers();
    this.setContent(primaryPane);
}

From source file:de.pixida.logtest.designer.testrun.TestRunEditor.java

public void createLogFileSourceInputItems(final List<Triple<String, Node, String>> formItems) {
    final TextField logFilePath = new TextField();
    this.logFilePathProperty.bind(logFilePath.textProperty());
    HBox.setHgrow(logFilePath, Priority.ALWAYS);
    final Button selectLogFileButton = SelectFileButton.createButtonWithFileSelection(logFilePath,
            LogReaderEditor.LOG_FILE_ICON_NAME, "Select log file", null, null);
    final HBox fileInputConfig = new HBox(logFilePath, selectLogFileButton);
    final VBox lines = new VBox();
    final double spacingOfLines = 5d;
    lines.setSpacing(spacingOfLines);/*w ww . j  a va 2 s.  c o m*/
    final HBox inputTypeLine = new HBox();
    final double hSpacingOfInputTypeChoices = 30d;
    inputTypeLine.setSpacing(hSpacingOfInputTypeChoices);
    final ToggleGroup group = new ToggleGroup();
    final RadioButton inputTypeText = new RadioButton("Paste/Enter log");
    inputTypeText.setToggleGroup(group);
    this.loadLogFromEnteredTextProperty.bind(inputTypeText.selectedProperty());
    final RadioButton inputTypeFile = new RadioButton("Read log file");
    inputTypeFile.setToggleGroup(group);
    this.loadLogFromFileProperty.bind(inputTypeFile.selectedProperty());
    inputTypeFile.setSelected(true);
    inputTypeLine.getChildren().add(inputTypeText);
    inputTypeLine.getChildren().add(inputTypeFile);
    fileInputConfig.visibleProperty().bind(inputTypeFile.selectedProperty());
    fileInputConfig.managedProperty().bind(fileInputConfig.visibleProperty());
    final TextArea logInputText = new TextArea();
    HBox.setHgrow(logInputText, Priority.ALWAYS);
    final int numLinesForEnteringLogInputManually = 10;
    logInputText.setPrefRowCount(numLinesForEnteringLogInputManually);
    logInputText.setStyle("-fx-font-family: monospace");
    this.enteredLogTextProperty.bind(logInputText.textProperty());
    final HBox enterTextConfig = new HBox();
    enterTextConfig.getChildren().add(logInputText);
    enterTextConfig.visibleProperty().bind(inputTypeText.selectedProperty());
    enterTextConfig.managedProperty().bind(enterTextConfig.visibleProperty());
    lines.getChildren().addAll(inputTypeLine, fileInputConfig, enterTextConfig);
    formItems.add(Triple.of("Trace Log", lines, null));
}

From source file:snpviewer.SnpViewer.java

@Override
public void initialize(URL url, ResourceBundle rb) {
    labelSplitPane.setDividerPositions();
    chromSplitPane.setDividerPositions();
    Pane lpane = (Pane) horizontalSplit.getItems().get(0);
    SplitPane.setResizableWithParent(lpane, false);
    //mnemonics/shortcuts for menus        
    mainMenu.useSystemMenuBarProperty().set(true);
    fileMenu.setMnemonicParsing(true);//from w w  w  .ja va  2s. c om
    sampleMenu.setMnemonicParsing(true);
    goMenu.setMnemonicParsing(true);
    helpMenu.setMnemonicParsing(true);
    newProjectMenu.setAccelerator(new KeyCodeCombination(KeyCode.N, KeyCombination.SHORTCUT_DOWN));
    loadProjectMenu.setAccelerator(new KeyCodeCombination(KeyCode.L, KeyCombination.SHORTCUT_DOWN));
    addAffSampleMenu.setAccelerator(
            new KeyCodeCombination(KeyCode.A, KeyCombination.SHORTCUT_DOWN, KeyCombination.SHIFT_DOWN));
    addUnSampleMenu.setAccelerator(
            new KeyCodeCombination(KeyCode.U, KeyCombination.SHORTCUT_DOWN, KeyCombination.SHIFT_DOWN));
    nextChromMenu.setAccelerator(new KeyCodeCombination(KeyCode.EQUALS, KeyCombination.SHORTCUT_DOWN));
    prevChromMenu.setAccelerator(new KeyCodeCombination(KeyCode.MINUS, KeyCombination.SHORTCUT_DOWN));
    firstChromMenu.setAccelerator(new KeyCodeCombination(KeyCode.DIGIT1, KeyCombination.SHORTCUT_DOWN));
    lastChromMenu.setAccelerator(new KeyCodeCombination(KeyCode.DIGIT0, KeyCombination.SHORTCUT_DOWN));
    redrawMenu.setAccelerator(new KeyCodeCombination(KeyCode.R, KeyCombination.SHORTCUT_DOWN));
    cacheChromsMenu.setAccelerator(
            new KeyCodeCombination(KeyCode.C, KeyCombination.SHORTCUT_DOWN, KeyCombination.SHIFT_DOWN));
    saveToPngMenu.setAccelerator(
            new KeyCodeCombination(KeyCode.S, KeyCombination.SHORTCUT_DOWN, KeyCombination.SHIFT_DOWN));
    autoFindRegions.setAccelerator(new KeyCodeCombination(KeyCode.F, KeyCombination.SHORTCUT_DOWN));
    //need to disable hideSavedRegionsMenu accelerator for linux - doesn't work for check menus
    hideSavedRegionsMenu.setAccelerator(
            new KeyCodeCombination(KeyCode.H, KeyCombination.SHORTCUT_DOWN, KeyCombination.SHIFT_DOWN));
    clearSavedRegionsMenu.setAccelerator(
            new KeyCodeCombination(KeyCode.X, KeyCombination.SHORTCUT_DOWN, KeyCombination.SHIFT_DOWN));
    displaySavedsRegionsMenu.setAccelerator(new KeyCodeCombination(KeyCode.T, KeyCombination.SHORTCUT_DOWN));
    outputSavedRegionsMenu.setAccelerator(new KeyCodeCombination(KeyCode.O, KeyCombination.SHORTCUT_DOWN));
    removeSampleMenu.setAccelerator(
            new KeyCodeCombination(KeyCode.R, KeyCombination.SHORTCUT_DOWN, KeyCombination.SHIFT_DOWN));
    //set radio menu item toggle group
    ArrayList<RadioMenuItem> callQualityRadios = new ArrayList<>(
            Arrays.asList(noFilteringRadio, filter99, filter95, filter90, filter85));
    ToggleGroup callQualityToggle = new ToggleGroup();
    for (RadioMenuItem r : callQualityRadios) {
        r.setToggleGroup(callQualityToggle);
    }
    noFilteringRadio.setOnAction(new EventHandler() {
        @Override
        public void handle(Event ev) {
            setQualityFilter(null);
        }
    });

    filter99.setOnAction(new EventHandler() {
        @Override
        public void handle(Event ev) {
            setQualityFilter(0.01);
        }
    });

    filter95.setOnAction(new EventHandler() {
        @Override
        public void handle(Event ev) {
            setQualityFilter(0.05);
        }
    });

    filter90.setOnAction(new EventHandler() {
        @Override
        public void handle(Event ev) {
            setQualityFilter(0.10);
        }
    });

    filter85.setOnAction(new EventHandler() {
        @Override
        public void handle(Event ev) {
            setQualityFilter(0.15);
        }
    });

    nextChromMenu.setOnAction(new EventHandler() {
        @Override
        public void handle(Event ev) {
            selectNextChromosome(true);
        }
    });

    prevChromMenu.setOnAction(new EventHandler() {
        @Override
        public void handle(Event ev) {
            selectNextChromosome(false);
        }
    });

    firstChromMenu.setOnAction(new EventHandler() {
        @Override
        public void handle(Event ev) {
            if (!cancelButton.isDisabled()) {
                cancelButton.fire();
            }
            if (!chromosomeSelector.isDisabled()) {

                chromosomeSelector.getSelectionModel().selectFirst();
            }
        }
    });

    lastChromMenu.setOnAction(new EventHandler() {
        @Override
        public void handle(Event ev) {
            if (!cancelButton.isDisabled()) {
                cancelButton.fire();
            }
            if (!chromosomeSelector.isDisabled()) {
                chromosomeSelector.getSelectionModel().selectLast();
            }
        }
    });

    hideSavedRegionsMenu.setOnAction(new EventHandler() {
        @Override
        public void handle(Event ev) {
            showHideSavedRegions();
        }
    });

    colorComp.addAll(Arrays.asList(colorComponants));

    //selection context menu
    final ContextMenu scm = new ContextMenu();
    final MenuItem scmItem1 = new MenuItem("Display Flanking SNP IDs");
    scmItem1.setOnAction(new EventHandler<ActionEvent>() {
        @Override
        public void handle(ActionEvent e) {
            /* get coordinates of selection and report back
             * flanking snp ids and coordinates
             */
            displayFlankingSnpIDs(dragSelectRectangle);

        }
    });
    final MenuItem scmItem2 = new MenuItem("Write Selected Region to File");
    scmItem2.setOnAction(new EventHandler<ActionEvent>() {
        @Override
        public void handle(ActionEvent e) {
            Platform.runLater(new Runnable() {
                @Override
                public void run() {
                    /* get coordinates of selection and report back
                     * write SNPs in region to file
                     */
                    writeRegionToFile(dragSelectRectangle);
                }
            });
        }
    });
    final MenuItem scmItem3 = new MenuItem("Add To Saved Regions");
    scmItem3.setOnAction(new EventHandler<ActionEvent>() {
        @Override
        public void handle(ActionEvent e) {
            /* get coordinates of selection and report back
             * write SNPs in region to file
             */
            saveSelection();
        }
    });
    final MenuItem scmItem4 = new MenuItem("Show/Hide Saved Regions");
    scmItem4.setOnAction(new EventHandler<ActionEvent>() {
        @Override
        public void handle(ActionEvent e) {
            /* get coordinates of selection and report back
             * write SNPs in region to file
             */
            hideSavedRegionsMenu.selectedProperty().setValue(!hideSavedRegionsMenu.isSelected());
            hideSavedRegionsMenu.fire();
        }
    });
    final MenuItem scmItem5 = new MenuItem("Zoom Region");
    scmItem5.setOnAction(new EventHandler<ActionEvent>() {
        @Override
        public void handle(ActionEvent e) {
            Platform.runLater(new Runnable() {
                @Override
                public void run() {
                    /* get coordinates of selection and report back
                     * write SNPs in region to file
                     */
                    zoomRegion(dragSelectRectangle);
                }
            });
        }
    });
    final MenuItem scmItem6 = new MenuItem("Write Saved Regions to File");
    scmItem6.setOnAction(new EventHandler<ActionEvent>() {
        @Override
        public void handle(ActionEvent e) {
            Platform.runLater(new Runnable() {
                @Override
                public void run() {
                    /* get coordinates of selection and report back
                     * write SNPs in region to file
                     */
                    writeSavedRegionsToFile();
                }
            });
        }
    });

    scm.getItems().add(scmItem1);
    scm.getItems().add(scmItem2);
    scm.getItems().add(scmItem3);
    scm.getItems().add(scmItem4);
    scm.getItems().add(scmItem5);
    scm.getItems().add(scmItem6);
    //overlayPane context menu
    ocm = new ContextMenu();
    final MenuItem ocmItem1 = new MenuItem("Save Image to File");
    ocmItem1.setOnAction(new EventHandler<ActionEvent>() {
        @Override
        public void handle(ActionEvent e) {
            Platform.runLater(new Runnable() {
                @Override
                public void run() {
                    drawPaneToPng();
                }
            });
        }
    });

    ocm.getItems().add(ocmItem1);
    ocm.getItems().add(scmItem4);
    ocm.getItems().add(scmItem6);

    //color selections
    colorComponantSelector.getItems().clear();
    colorComponantSelector.getItems().add("AA");
    colorComponantSelector.getItems().add("BB");
    colorComponantSelector.getItems().add("AB");
    colorComponantSelector.getItems().add("Selection Outline");
    colorComponantSelector.getItems().add("Selection Fill");
    colorComponantSelector.getItems().add("Saved Region Outline");
    colorComponantSelector.getItems().add("Saved Region Fill");
    colorComponantSelector.getSelectionModel().selectFirst();
    colorPicker.setValue(colorComponants[0]);
    colorComponantSelector.getSelectionModel().selectedIndexProperty()
            .addListener(new ChangeListener<Number>() {
                @Override
                public void changed(ObservableValue ov, Number value, Number new_value) {
                    colorPicker.setValue(colorComp.get(new_value.intValue()));
                    colorPicker.fireEvent(new ActionEvent());
                }
            });
    colorPicker.setOnAction(new EventHandler() {
        @Override
        public void handle(Event t) {
            if (!colorComp.get(colorComponantSelector.getSelectionModel().getSelectedIndex())
                    .equals(colorPicker.getValue())) {
                colorComp.set(colorComponantSelector.getSelectionModel().getSelectedIndex(),
                        colorPicker.getValue());
                saveProject();
                //colorComponants[colorComponantSelector.getSelectionModel().getSelectedIndex()] = colorPicker.getValue();
                if (colorComponantSelector.getSelectionModel().getSelectedIndex() == Colors.fill.value) {
                    dragSelectRectangle.setFill(colorPicker.getValue());
                } else if (colorComponantSelector.getSelectionModel().getSelectedIndex() == Colors.line.value) {
                    dragSelectRectangle.setStroke(colorPicker.getValue());
                } else if (colorComponantSelector.getSelectionModel()
                        .getSelectedIndex() == Colors.saveLine.value) {
                    for (Rectangle r : savedRegionsDisplay) {
                        r.setStroke(colorPicker.getValue());
                    }
                } else if (colorComponantSelector.getSelectionModel()
                        .getSelectedIndex() == Colors.saveFill.value) {
                    for (Rectangle r : savedRegionsDisplay) {
                        r.setFill(colorPicker.getValue());
                    }
                } else {
                    removeSavedChromosomeImages();
                    if (redrawCheckBox.isSelected()) {
                        refreshView(null, true);
                    }
                }
            }
        }
    });

    /*perform appropriate action when user selects a chromosome
     * from the chromosome choice box
     */
    chromosomeSelector.getSelectionModel().selectedIndexProperty().addListener(new ChangeListener<Number>() {
        @Override
        public void changed(ObservableValue ov, Number value, Number new_value) {
            chromosomeBoxList = chromosomeSelector.getItems().toArray();

            if (new_value.intValue() > -1) {
                chromosomeSelected((String) chromosomeBoxList[new_value.intValue()]);
            }
        }
    });

    chromosomeSelector.addEventFilter(KeyEvent.ANY, new EventHandler<KeyEvent>() {
        @Override
        public void handle(KeyEvent ke) {
            if (ke.getCode() == KeyCode.UP) {
                ke.consume();
                chromosomeSelector.show();
            }
        }
    });

    selectionOverlayPane.heightProperty().addListener(new ChangeListener<Number>() {
        @Override
        public void changed(ObservableValue<? extends Number> observableValue, Number oldSceneWidth,
                Number newSceneWidth) {
            windowResized(new ActionEvent());

        }
    });

    selectionOverlayPane.widthProperty().addListener(new ChangeListener<Number>() {
        @Override
        public void changed(ObservableValue<? extends Number> observableValue, Number oldSceneWidth,
                Number newSceneWidth) {
            windowResized(new ActionEvent());
        }
    });

    /*upon addition of a new affected file adjust components accordingly
     * i.e. ensure appropriate chromosomes are in the choice box
     * adjust the split panes to fit all files and redisplay
     */

    affObserve.addListener(new ListChangeListener() {
        @Override
        public void onChanged(ListChangeListener.Change change) {
            change.next();/*from the javadoc 
                          * 'Go to the next change. In initial state is invalid a require 
                          * a call to next() before calling other methods. The first 
                          * next() call will make this object represent the first change.
                          */
            if (change.getRemovedSize() > 0) {
                List<SnpFile> both = new ArrayList<>(unFiles);
                both.addAll(affFiles);
                recheckChromosomeSelector(both);//need to check all files again, not just affFiles
            } else if (change.getAddedSize() > 0) {
                addToChromosomeSelector(affFiles);
            }
        }
    });

    /*as above 
     * but for unaffected files
     */
    unObserve.addListener(new ListChangeListener() {
        @Override
        public void onChanged(ListChangeListener.Change change) {
            change.next();
            if (change.getRemovedSize() > 0) {
                List<SnpFile> both = new ArrayList<>(unFiles);
                both.addAll(affFiles);
                recheckChromosomeSelector(both);//need to check all files again, not just unFiles
            } else if (change.getAddedSize() > 0) {
                addToChromosomeSelector(unFiles);
            }

        }
    });

    selectionOverlayPane.addEventHandler(MouseEvent.MOUSE_MOVED, new EventHandler<MouseEvent>() {
        @Override
        public void handle(MouseEvent e) {
            if (!genomeVersion.equals("") && chromosomeSelector.getSelectionModel().getSelectedIndex() > -1) {
                try {
                    ChromosomeLength chromLength = new ChromosomeLength(genomeVersion);
                    String currentChrom = (String) chromosomeBoxList[chromosomeSelector.getSelectionModel()
                            .getSelectedIndex()];
                    double coordinate = chromLength.getLength(currentChrom) / chromSplitPane.getWidth()
                            * e.getX();
                    positionIndicator.setText(nf.format(coordinate));

                } catch (Exception ex) {
                    positionIndicator.setText("Build Error!");
                }

            }
        }
    });
    /*handle mouse dragging and effect on dragSelectRectangle
     * 
     */
    dragSelectRectangle.widthProperty().bind(dragSelectRectX.subtract(dragSelectRectInitX));
    dragSelectRectangle.heightProperty().bind(selectionOverlayPane.heightProperty());
    //dragSelectRectangle.strokeProperty().set(colorComponants[Colors.line.value]);
    dragSelectRectangle.setStrokeWidth(4.0);

    //dragSelectRectangle.setBlendMode(BlendMode.SCREEN);
    dragSelectRectangle.setOpacity(0.45);
    dragSelectRectangle.setVisible(false);
    selectionOverlayPane.getChildren().add(dragSelectRectangle);

    selectionOverlayPane.addEventHandler(MouseEvent.MOUSE_PRESSED, new EventHandler<MouseEvent>() {
        @Override
        public void handle(MouseEvent e) {
            if (scm.isShowing()) {
                scm.hide();
            }
            if (!e.isPrimaryButtonDown()) {
                if (e.isSecondaryButtonDown()) {
                    //check we're not overlapping selection
                    if (e.getX() >= dragSelectRectangle.getX()
                            && e.getX() <= (dragSelectRectangle.getX() + dragSelectRectangle.getWidth())) {
                        return;
                    }
                    //check we're not overlapping saved regions
                    for (Rectangle r : savedRegionsDisplay) {
                        if (r.isVisible() && e.getX() >= r.getX() && e.getX() <= r.getX() + r.getWidth()) {
                            return;
                        }
                    }
                    if (chromosomeSelector.getSelectionModel().isEmpty()) {
                        ocmItem1.setDisable(true);
                    } else {
                        ocmItem1.setDisable(false);
                    }
                    ocm.show(selectionOverlayPane, e.getScreenX(), e.getScreenY());

                    return;
                }
            }
            if (ocm.isShowing()) {
                ocm.hide();
            }

            dragSelectRectangle.strokeProperty().set(colorComp.get(Colors.line.value));
            dragSelectRectangle.fillProperty().set(colorComp.get(Colors.fill.value));
            dragSelectRectX.set(0);
            dragSelectRectangle.setVisible(true);
            dragSelectRectangle.setX(e.getX());
            dragSelectRectangle.setY(0);
            dragSelectRectInitX.set(e.getX());
            anchorInitX.set(e.getX());

        }
    });
    selectionOverlayPane.addEventHandler(MouseEvent.MOUSE_DRAGGED, new EventHandler<MouseEvent>() {
        @Override
        public void handle(MouseEvent e) {
            if (!e.isPrimaryButtonDown()) {
                return;
            }
            dragSelectRectangle.setVisible(true);
            if (e.getX() > anchorInitX.doubleValue()) {//dragging to the right
                if (e.getX() <= selectionOverlayPane.getLayoutX() + selectionOverlayPane.getWidth()) {
                    //mouse is before the edge of the pane
                    dragSelectRectInitX.set(anchorInitX.doubleValue());
                    dragSelectRectX.set(e.getX());
                } else {
                    //mouse is over the edge
                    dragSelectRectX.set(selectionOverlayPane.getWidth());
                }
            } else {
                if (e.getX() > selectionOverlayPane.getLayoutX()) {
                    dragSelectRectInitX.set(e.getX());
                    dragSelectRectangle.setX(e.getX());
                    dragSelectRectX.set(anchorInitX.doubleValue());
                } else {
                    dragSelectRectInitX.set(0);
                    dragSelectRectangle.setX(0);
                    /* the two lines below are just to trigger 
                    * dragSelectRectangle.widthProperty listener 
                    * so that start coordinate changes to 1
                    */
                    dragSelectRectX.set(anchorInitX.doubleValue() + 1);
                    dragSelectRectX.set(anchorInitX.doubleValue() + 1);

                }
            }
        }
    });

    selectionOverlayPane.addEventHandler(MouseEvent.MOUSE_RELEASED, new EventHandler<MouseEvent>() {
        @Override
        public void handle(MouseEvent e) {
            //dragSelectRectX.set(e.getX());
            if (!e.isPrimaryButtonDown()) {
                return;
            }
            dragSelectRectangle.setVisible(true);
            if (dragSelectRectangle.getWidth() == 0) {
                clearDragSelectRectangle();
            }
        }
    });

    dragSelectRectangle.widthProperty().addListener(new ChangeListener() {
        @Override
        public void changed(ObservableValue observableValue, Object oldValue, Object newRectWidth) {
            if (!genomeVersion.equals("") && chromosomeSelector.getSelectionModel().getSelectedIndex() > -1
                    && dragSelectRectangle.getWidth() > 0) {
                try {
                    ChromosomeLength chromLength = new ChromosomeLength(genomeVersion);
                    String currentChrom = (String) chromosomeBoxList[chromosomeSelector.getSelectionModel()
                            .getSelectedIndex()];
                    double startCoordinate = chromLength.getLength(currentChrom)
                            / selectionOverlayPane.getWidth() * dragSelectRectangle.getX();
                    double selectionWidth = chromLength.getLength(currentChrom)
                            / selectionOverlayPane.getWidth() * dragSelectRectangle.getWidth();
                    if (dragSelectRectangle.getX() == 0) {
                        startCoordinate = 1;
                    }
                    selectionIndicator.setText("chr" + currentChrom + ":" + nf.format(startCoordinate) + "-"
                            + nf.format(startCoordinate + selectionWidth));
                } catch (Exception ex) {
                    selectionIndicator.setText("Build Error!");
                }
            } else {
                selectionIndicator.setText("");
            }

        }
    });

    dragSelectRectangle.addEventHandler(MouseEvent.MOUSE_CLICKED, new EventHandler<MouseEvent>() {
        @Override
        public void handle(MouseEvent e) {
            if (e.getButton() == MouseButton.SECONDARY) {
                if (chromosomeSelector.getSelectionModel().isEmpty()) {
                    scmItem1.setDisable(true);
                    scmItem2.setDisable(true);
                } else {
                    scmItem1.setDisable(false);
                    scmItem2.setDisable(false);
                }
                if (ocm.isShowing()) {
                    ocm.hide();
                }

                scm.show(selectionOverlayPane, e.getScreenX(), e.getScreenY());
            }
        }
    });

}

From source file:gov.va.isaac.gui.preferences.plugins.ViewCoordinatePreferencesPluginViewController.java

private void initializeStatusesToggleGroup() {
    statusesToggleGroup = new ToggleGroup();
    Tooltip statusButtonsTooltip = new Tooltip("Default Status(es) is " + getDefaultStatuses());
    activeStatusButton = new RadioButton();
    activeStatusButton.setText("Active");
    activeStatusButton.setTooltip(statusButtonsTooltip);
    statusesToggleGroup.getToggles().add(activeStatusButton);
    activeStatusButton.selectedProperty().addListener((observable, oldValue, newValue) -> {
        if (newValue) {
            currentStatusesProperty.get().clear();
            currentStatusesProperty.add(Status.ACTIVE);
        }/*from  ww  w. j a v a2s .  co  m*/
    });
    statusesToggleGroupVBox.getChildren().add(activeStatusButton);

    inactiveStatusButton = new RadioButton();
    inactiveStatusButton.setText("Inactive");
    inactiveStatusButton.setTooltip(statusButtonsTooltip);
    statusesToggleGroup.getToggles().add(inactiveStatusButton);
    inactiveStatusButton.selectedProperty().addListener((observable, oldValue, newValue) -> {
        if (newValue) {
            currentStatusesProperty.get().clear();
            currentStatusesProperty.add(Status.INACTIVE);
        }
    });
    statusesToggleGroupVBox.getChildren().add(inactiveStatusButton);

    activeAndInactiveStatusButton = new RadioButton();
    activeAndInactiveStatusButton.setText("All");
    activeAndInactiveStatusButton.setTooltip(statusButtonsTooltip);
    statusesToggleGroup.getToggles().add(activeAndInactiveStatusButton);
    activeAndInactiveStatusButton.selectedProperty().addListener((observable, oldValue, newValue) -> {
        if (newValue) {
            currentStatusesProperty.get().clear();
            currentStatusesProperty.add(Status.ACTIVE);
            currentStatusesProperty.add(Status.INACTIVE);
        }
    });
    statusesToggleGroupVBox.getChildren().add(activeAndInactiveStatusButton);
}

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

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

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

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

            ExecutionService.measureStop(t2, UIConstants.UITASK_MP_LOADCONFIGURATION);

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

            cleanRMIPool();

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

        @Override
        public void _succeeded() {

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

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

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

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