Example usage for javafx.geometry Insets Insets

List of usage examples for javafx.geometry Insets Insets

Introduction

In this page you can find the example usage for javafx.geometry Insets Insets.

Prototype

public Insets(@NamedArg("top") double top, @NamedArg("right") double right, @NamedArg("bottom") double bottom,
        @NamedArg("left") double left) 

Source Link

Document

Constructs a new Insets instance with four different offsets.

Usage

From source file:gov.va.isaac.gui.ConceptNode.java

/**
 * descriptionReader is optional/*from  www . j  a v a2s .c  om*/
 */
public ConceptNode(ConceptVersionBI initialConcept, boolean flagAsInvalidWhenBlank,
        ObservableList<SimpleDisplayConcept> dropDownOptions,
        Function<ConceptVersionBI, String> descriptionReader) {
    c_ = initialConcept;
    //We can't simply use the ObservableList from the CommonlyUsedConcepts, because it infinite loops - there doesn't seem to be a way 
    //to change the items in the drop down without changing the selection.  So, we have this hack instead.
    listChangeListener_ = new ListChangeListener<SimpleDisplayConcept>() {
        @Override
        public void onChanged(Change<? extends SimpleDisplayConcept> c) {
            //TODO I still have an infinite loop here.  Find and fix.
            logger.debug("updating concept dropdown");
            disableChangeListener_ = true;
            SimpleDisplayConcept temp = cb_.getValue();
            cb_.setItems(FXCollections.observableArrayList(dropDownOptions_));
            cb_.setValue(temp);
            cb_.getSelectionModel().select(temp);
            disableChangeListener_ = false;
        }
    };
    descriptionReader_ = (descriptionReader == null ? (conceptVersion) -> {
        return conceptVersion == null ? "" : OTFUtility.getDescription(conceptVersion);
    } : descriptionReader);
    dropDownOptions_ = dropDownOptions == null
            ? AppContext.getService(CommonlyUsedConcepts.class).getObservableConcepts()
            : dropDownOptions;
    dropDownOptions_.addListener(new WeakListChangeListener<SimpleDisplayConcept>(listChangeListener_));
    conceptBinding_ = new ObjectBinding<ConceptVersionBI>() {
        @Override
        protected ConceptVersionBI computeValue() {
            return c_;
        }
    };

    flagAsInvalidWhenBlank_ = flagAsInvalidWhenBlank;
    cb_ = new ComboBox<>();
    cb_.setConverter(new StringConverter<SimpleDisplayConcept>() {
        @Override
        public String toString(SimpleDisplayConcept object) {
            return object == null ? "" : object.getDescription();
        }

        @Override
        public SimpleDisplayConcept fromString(String string) {
            return new SimpleDisplayConcept(string, 0);
        }
    });
    cb_.setValue(new SimpleDisplayConcept("", 0));
    cb_.setEditable(true);
    cb_.setMaxWidth(Double.MAX_VALUE);
    cb_.setPrefWidth(ComboBox.USE_COMPUTED_SIZE);
    cb_.setMinWidth(200.0);
    cb_.setPromptText("Type, drop or select a concept");

    cb_.setItems(FXCollections.observableArrayList(dropDownOptions_));
    cb_.setVisibleRowCount(11);

    cm_ = new ContextMenu();

    MenuItem copyText = new MenuItem("Copy Description");
    copyText.setGraphic(Images.COPY.createImageView());
    copyText.setOnAction(new EventHandler<ActionEvent>() {
        @Override
        public void handle(ActionEvent event) {
            CustomClipboard.set(cb_.getEditor().getText());
        }
    });
    cm_.getItems().add(copyText);

    CommonMenusNIdProvider nidProvider = new CommonMenusNIdProvider() {
        @Override
        public Set<Integer> getNIds() {
            Set<Integer> nids = new HashSet<>();
            if (c_ != null) {
                nids.add(c_.getNid());
            }
            return nids;
        }
    };
    CommonMenuBuilderI menuBuilder = CommonMenus.CommonMenuBuilder.newInstance();
    menuBuilder.setInvisibleWhenFalse(isValid);
    CommonMenus.addCommonMenus(cm_, menuBuilder, nidProvider);

    cb_.getEditor().setContextMenu(cm_);

    updateGUI();

    new LookAheadConceptPopup(cb_);

    if (cb_.getValue().getNid() == 0) {
        if (flagAsInvalidWhenBlank_) {
            isValid.setInvalid("Concept Required");
        }
    } else {
        isValid.setValid();
    }

    cb_.valueProperty().addListener(new ChangeListener<SimpleDisplayConcept>() {
        @Override
        public void changed(ObservableValue<? extends SimpleDisplayConcept> observable,
                SimpleDisplayConcept oldValue, SimpleDisplayConcept newValue) {
            if (newValue == null) {
                logger.debug("Combo Value Changed - null entry");
            } else {
                logger.debug("Combo Value Changed: {} {}", newValue.getDescription(), newValue.getNid());
            }

            if (disableChangeListener_) {
                logger.debug("change listener disabled");
                return;
            }

            if (newValue == null) {
                //This can happen if someone calls clearSelection() - it passes in a null.
                cb_.setValue(new SimpleDisplayConcept("", 0));
                return;
            } else {
                if (newValue.shouldIgnoreChange()) {
                    logger.debug("One time change ignore");
                    return;
                }
                //Whenever the focus leaves the combo box editor, a new combo box is generated.  But, the new box will have 0 for an id.  detect and ignore
                if (oldValue != null && oldValue.getDescription().equals(newValue.getDescription())
                        && newValue.getNid() == 0) {
                    logger.debug("Not a real change, ignore");
                    newValue.setNid(oldValue.getNid());
                    return;
                }
                lookup();
            }
        }
    });

    AppContext.getService(DragRegistry.class).setupDragAndDrop(cb_, new SingleConceptIdProvider() {
        @Override
        public String getConceptId() {
            return cb_.getValue().getNid() + "";
        }
    }, true);

    pi_ = new ProgressIndicator(ProgressIndicator.INDETERMINATE_PROGRESS);
    pi_.visibleProperty().bind(isLookupInProgress_);
    pi_.setPrefHeight(16.0);
    pi_.setPrefWidth(16.0);
    pi_.setMaxWidth(16.0);
    pi_.setMaxHeight(16.0);

    lookupFailImage_ = Images.EXCLAMATION.createImageView();
    lookupFailImage_.visibleProperty().bind(isValid.not().and(isLookupInProgress_.not()));
    Tooltip t = new Tooltip();
    t.textProperty().bind(isValid.getReasonWhyInvalid());
    Tooltip.install(lookupFailImage_, t);

    StackPane sp = new StackPane();
    sp.setMaxWidth(Double.MAX_VALUE);
    sp.getChildren().add(cb_);
    sp.getChildren().add(lookupFailImage_);
    sp.getChildren().add(pi_);
    StackPane.setAlignment(cb_, Pos.CENTER_LEFT);
    StackPane.setAlignment(lookupFailImage_, Pos.CENTER_RIGHT);
    StackPane.setMargin(lookupFailImage_, new Insets(0.0, 30.0, 0.0, 0.0));
    StackPane.setAlignment(pi_, Pos.CENTER_RIGHT);
    StackPane.setMargin(pi_, new Insets(0.0, 30.0, 0.0, 0.0));

    hbox_ = new HBox();
    hbox_.setSpacing(5.0);
    hbox_.setAlignment(Pos.CENTER_LEFT);

    hbox_.getChildren().add(sp);
    HBox.setHgrow(sp, Priority.SOMETIMES);
}

From source file:io.bitsquare.gui.main.overlays.Overlay.java

protected void createGridPane() {
    gridPane = new GridPane();
    gridPane.setHgap(5);//from   w w  w  .  ja va  2 s.  c  om
    gridPane.setVgap(5);
    gridPane.setPadding(new Insets(30, 30, 30, 30));
    gridPane.setPrefWidth(width);

    ColumnConstraints columnConstraints1 = new ColumnConstraints();
    columnConstraints1.setHalignment(HPos.RIGHT);
    columnConstraints1.setHgrow(Priority.SOMETIMES);
    ColumnConstraints columnConstraints2 = new ColumnConstraints();
    columnConstraints2.setHgrow(Priority.ALWAYS);
    gridPane.getColumnConstraints().addAll(columnConstraints1, columnConstraints2);
}

From source file:FeeBooster.java

private GridPane cpfpGrid(Transaction tx) {
    // Setup Grid
    GridPane grid = new GridPane();
    grid.setAlignment(Pos.CENTER);//  w  w w .j  a v a  2  s . c  om
    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:boundary.GraphPane.java

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

    hBox.setPadding(new Insets(15, 12, 15, 12));
    hBox.setSpacing(10);/*from w  ww.  jav  a 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:spdxedit.PackageEditor.java

@FXML
private void initialize() {
    assert tabFiles != null : "fx:id=\"tabFiles\" was not injected: check your FXML file 'PackageEditor.fxml'.";
    assert tabPackageProperties != null : "fx:id=\"tabPackageProperties\" was not injected: check your FXML file 'PackageEditor.fxml'.";
    assert tabExternalRefs != null : "fx:id=\"tabExternalRefs\" was not injected: check your FXML file 'PackageEditor.fxml'.";

    assert filesTable != null : "fx:id=\"filesTable\" was not injected: check your FXML file 'PackageEditor.fxml'.";
    assert tblColumnFile != null : "fx:id=\"tblColumnFile\" was not injected: check your FXML file 'PackageEditor.fxml'.";
    assert chkListFileTypes != null : "fx:id=\"chkListFileTypes\" was not injected: check your FXML file 'PackageEditor.fxml'.";
    assert tabRelationships != null : "fx:id=\"tabRelationships\" was not injected: check your FXML file 'PackageEditor.fxml'.";
    assert btnOk != null : "fx:id=\"btnOk\" was not injected: check your FXML file 'PackageEditor.fxml'.";
    assert btnDeleteFileFromPackage != null : "fx:id=\"btnDeleteFileFromPackage\" was not injected: check your FXML file 'PackageEditor.fxml'.";
    assert btnAddFile != null : "fx:id=\"btnAddFile\" was not injected: check your FXML file 'PackageEditor.fxml'.";
    assert btnCopyright != null : "fx:id=\"btnCopyright\" was not injected: check your FXML file 'PackageEditor.fxml'.";
    assert btnFileLicense != null : "fx:id=\"btnFileLicense\" was not injected: check your FXML file 'PackageEditor.fxml'.";

    //File relationship checkboxes
    assert chkDataFile != null : "fx:id=\"chkDataFile\" was not injected: check your FXML file 'PackageEditor.fxml'.";
    assert chkTestCase != null : "fx:id=\"chkTestCase\" was not injected: check your FXML file 'PackageEditor.fxml'.";
    assert chkDocumentation != null : "fx:id=\"chkDocumentation\" was not injected: check your FXML file 'PackageEditor.fxml'.";
    assert chkOptionalComponent != null : "fx:id=\"chkOptionalComponent\" was not injected: check your FXML file 'PackageEditor.fxml'.";
    assert chkMetafile != null : "fx:id=\"chkMetafile\" was not injected: check your FXML file 'PackageEditor.fxml'.";
    assert chkBuildTool != null : "fx:id=\"chkBuildTool\" was not injected: check your FXML file 'PackageEditor.fxml'.";
    assert chkExcludeFile != null : "fx:id=\"chkExcludeFile\" was not injected: check your FXML file 'PackageEditor.fxml'.";

    //Initialise file relationship checkbox handling
    //TODO: Could make this easier by extending the CheckBox control?
    chkDataFile.selectedProperty().addListener((observable, oldValue,
            newValue) -> addOrRemoveFileRelationshipToPackage(RelationshipType.DATA_FILE_OF, newValue));
    chkTestCase.selectedProperty().addListener((observable, oldValue,
            newValue) -> addOrRemoveFileRelationshipToPackage(RelationshipType.TEST_CASE_OF, newValue));
    chkDocumentation.selectedProperty().addListener((observable, oldValue,
            newValue) -> addOrRemoveFileRelationshipToPackage(RelationshipType.DOCUMENTATION_OF, newValue));
    chkOptionalComponent.selectedProperty()
            .addListener((observable, oldValue, newValue) -> addOrRemoveFileRelationshipToPackage(
                    RelationshipType.OPTIONAL_COMPONENT_OF, newValue));
    chkMetafile.selectedProperty().addListener((observable, oldValue,
            newValue) -> addOrRemoveFileRelationshipToPackage(RelationshipType.METAFILE_OF, newValue));
    chkBuildTool.selectedProperty().addListener((observable, oldValue,
            newValue) -> addOrRemoveFileRelationshipToPackage(RelationshipType.BUILD_TOOL_OF, newValue));
    chkExcludeFile.selectedProperty()//  w w w.  j a  v a  2  s. c  o  m
            .addListener((observable, oldValue, newValue) -> handleChkExcludeFileChange(newValue));

    //Package relationship controls
    assert lstTargetPackages != null : "fx:id=\"lstTargetPackages\" was not injected: check your FXML file 'PackageEditor.fxml'.";
    assert chcNewRelationshipType != null : "fx:id=\"chcNewRelationshipType\" was not injected: check your FXML file 'PackageEditor.fxml'.";
    assert btnAddRelationship != null : "fx:id=\"btnAddRelationship\" was not injected: check your FXML file 'PackageEditor.fxml'.";
    assert btnRemoveRelationship != null : "fx:id=\"btnRemoveRelationship\" was not injected: check your FXML file 'PackageEditor.fxml'.";

    //Initialize package relationship controls
    lstTargetPackages.getSelectionModel().selectedItemProperty()
            .addListener((observable1, oldValue1, newValue1) -> handleTargetPackageSelected(newValue1));
    lstTargetPackages.setCellFactory(listView -> new MainSceneController.SpdxPackageListCell());
    lstPackageRelationships.getSelectionModel().selectedItemProperty().addListener(
            (observable1, oldValue1, newValue1) -> btnRemoveRelationship.setDisable(newValue1 == null));
    //Package relationship types
    chcNewRelationshipType.setConverter(RELATIONSHIP_TYPE_STRING_CONVERTER);
    chcNewRelationshipType.getItems()
            .setAll(Stream.of(RelationshipType.AMENDS, RelationshipType.DESCENDANT_OF,
                    RelationshipType.DYNAMIC_LINK, RelationshipType.GENERATED_FROM, RelationshipType.GENERATES,
                    RelationshipType.HAS_PREREQUISITE, RelationshipType.PREREQUISITE_FOR,
                    RelationshipType.STATIC_LINK, RelationshipType.OTHER).collect(Collectors.toList()));
    chcNewRelationshipType.getSelectionModel().selectFirst();
    assert (otherPackages != null); //Constructor finished executing
    lstTargetPackages.getItems().setAll(otherPackages);

    //Package license editor
    assert tabPkgLicenses != null : "fx:id=\"tabPkgLicenses\" was not injected: check your FXML file 'PackageEditor.fxml'.";
    assert tabPkgDeclaredLicense != null : "fx:id=\"tabPkgDeclaredLicense\" was not injected: check your FXML file 'PackageEditor.fxml'.";
    assert tabPkgConcludedLicense != null : "fx:id=\"tabPkgConcludedLicense\" was not injected: check your FXML file 'PackageEditor.fxml'.";

    pkgConcludedLicenseEdit = new LicenseEditControl(documentContainer);
    pkgConcludedLicenseEdit.setInitialValue(pkg.getLicenseConcluded());
    pkgConcludedLicenseEdit
            .setOnLicenseChange(license -> SpdxWithoutExeption.setLicenseConcluded(pkg, license));
    tabPkgConcludedLicense.setContent(pkgConcludedLicenseEdit.getUi());
    pkgDeclaredLicenseEdit = new LicenseEditControl(documentContainer);
    pkgDeclaredLicenseEdit.setInitialValue(SpdxWithoutExeption.getLicenseDeclared(pkg));
    pkgDeclaredLicenseEdit.setOnLicenseChange(license -> SpdxWithoutExeption.setLicenseDeclared(pkg, license));
    tabPkgDeclaredLicense.setContent(pkgDeclaredLicenseEdit.getUi());

    //Initialize other elements
    tblColumnFile.setCellValueFactory(
            (TreeTableColumn.CellDataFeatures<SpdxFile, String> param) -> new ReadOnlyStringWrapper(
                    param.getValue().getValue().getName()));
    //Load all file types into the file type list in order.
    chkListFileTypes.getItems().setAll(Stream.of(FileType.values()).sorted(Ordering.usingToString()) //Sort
            .map(fileType -> StringableWrapper.wrap(fileType, SpdxLogic::toString)) //Wrap so that the nice toString function gets used by the checkbox
            .collect(Collectors.toList()));
    chkListFileTypes.getCheckModel().getCheckedItems().addListener(this::handleFileTypeCheckedOrUnchecked);
    filesTable.getSelectionModel().selectedItemProperty()
            .addListener((observable, oldValue, newValue) -> handleFileSelected(newValue));
    filesTable.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
    filesTable.setShowRoot(false);

    AnchorPane externalRefControl = new ExternalRefListControl(pkg).getUi();
    externalRefControl.setPadding(new Insets(12, 10, 5, 10));
    tabExternalRefs.setContent(externalRefControl);
    externalRefControl.setManaged(true);

    new PackagePropertyEditor(pkg).initialize(tabPackageProperties);

}

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

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

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

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

    Label newusername = new Label("Ban Username");
    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_usernames.remove(username.getText());
            banned_usernames.add(username.getText());
            to_update.setItems(FXCollections.observableArrayList(banned_usernames));
            createBannedUser.close();
        }

    });

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

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

From source file:org.beryx.viewreka.fxapp.ProjectLibs.java

public void installLibs(String prjName, File prjDir) {
    InstallLibsTask task = new InstallLibsTask(prjName, prjDir, lstLib);

    Stage progressStage = new Stage();
    progressStage.setOnCloseRequest(ev -> {
        if (Dialogs.confirmYesNo("Cancel",
                "Are you sure you want to cancel the installation of project libraries?", null)) {
            task.cancel();//from w  w w  .j a v  a  2  s. com
        }
    });
    progressStage.initStyle(StageStyle.UTILITY);
    progressStage.initModality(Modality.APPLICATION_MODAL);
    progressStage.setTitle("Create project " + prjName);

    GridPane grid = new GridPane();
    grid.setHgap(20);
    grid.setVgap(20);
    grid.setPadding(new Insets(24, 10, 0, 24));

    ProgressIndicator progressIndicator = new ProgressIndicator();
    progressIndicator.setPrefSize(64, 64);
    progressIndicator.setMinSize(64, 64);
    progressIndicator.setMaxSize(64, 64);
    //        progressIndicator.progressProperty().bind(task.progressProperty());
    grid.add(progressIndicator, 0, 0);

    Label actionLabel = new Label("Install project libraries...");
    actionLabel.textProperty().bind(task.messageProperty());
    grid.add(actionLabel, 1, 0);

    progressStage.setScene(new Scene(grid, 600, 120));

    task.setOnSucceeded(ev -> closeProgress(progressStage, task));
    task.setOnFailed(ev -> closeProgress(progressStage, task));
    task.setOnCancelled(ev -> closeProgress(progressStage, task));

    progressStage.setOnShown(ev -> Executors.newSingleThreadExecutor().submit(task));
    progressStage.showAndWait();
}

From source file:com.anavationllc.o2jb.ConfigurationApp.java

private GridPane getGrid() {
    if (grid == null) {
        grid = new GridPane();
        grid.setAlignment(Pos.CENTER);//from w  w  w .  ja  v a  2s.  c o m
        grid.setHgap(10);
        grid.setVgap(10);
        grid.setPadding(new Insets(25, 25, 25, 25));

        int row = 0;
        int col = 0;

        grid.add(getSceneTitle(), col, row, MAX_COLS, 1);
        grid.add(getOdbcDsnLabel(), col = 0, ++row);
        grid.add(getOdbcDsn(), ++col, row, INPUT_COL_SPAN, 1);
        grid.add(getClassPathLabel(), col = 0, ++row);
        grid.add(getClassPath(), ++col, row, INPUT_COL_SPAN, 1);
        grid.add(getDriverClassLabel(), col = 0, ++row);
        grid.add(getDriverClass(), ++col, row, INPUT_COL_SPAN, 1);
        grid.add(getJdbcUrlLabel(), col = 0, ++row);
        grid.add(getJdbcUrl(), ++col, row, INPUT_COL_SPAN, 1);
        grid.add(getUserLabel(), col = 0, ++row);
        grid.add(getUser(), ++col, row, INPUT_COL_SPAN, 1);
        grid.add(getPasswordLabel(), col = 0, ++row);
        grid.add(getPassword(), ++col, row, INPUT_COL_SPAN, 1);
        grid.add(getBtnBox(), col = 1, ++row, INPUT_COL_SPAN, 1);
    }
    return grid;
}

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

private void createBannedIP(ListView<String> to_update) {
    Stage createBannedIP = new Stage();
    createBannedIP.setTitle("Add Banned IP");
    createBannedIP.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 a2 s. co  m
    gp.setVgap(10);
    gp.setHgap(10);

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

    Label newusername = new Label("Ban IP");
    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_ips.remove(username.getText());
            banned_ips.add(username.getText());
            to_update.setItems(FXCollections.observableArrayList(banned_ips));
            createBannedIP.close();
        }

    });

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

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

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 w  w. j  av a  2s.c  o  m*/
    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();
}