List of usage examples for javafx.scene.layout VBox setMargin
public static void setMargin(Node child, Insets value)
From source file:de.pixida.logtest.designer.automaton.ConfigFrame.java
void addOption(final String name, final Node control) { final Text nameText = new Text(name + ":"); this.vbox.getChildren().add(nameText); final int marginLeft = 8; VBox.setMargin(control, new Insets(0, 0, 0, marginLeft)); this.vbox.getChildren().add(control); }
From source file:com.panemu.tiwulfx.control.DetailPanel.java
private void generateUI() { this.getChildren().removeAll(this.getChildren()); for (String prop : propertyNames) { LabelSeparator labelSeparator = new LabelSeparator(""); labelSeparator.setText(prop);/*from ww w . j a v a2s . c o m*/ VBox.setMargin(labelSeparator, new Insets(10, 0, 0, 0)); this.getChildren().add(labelSeparator); Label lblValue = new Label(); lblValue.getStyleClass().add("valueLabel"); lblValue.setWrapText(true); this.getChildren().add(lblValue); componentMap.put(prop, lblValue); } }
From source file:org.jacp.demo.components.ContactAddDialog.java
private void createAddContactDialog() { final VBox box = new VBox(); box.getStyleClass().add("jacp-option-pane"); box.setMaxSize(300, Region.USE_PREF_SIZE); // the title// w w w . ja v a 2s.co m final Label title = new Label("Add new category"); title.setId(GlobalConstants.CSSConstants.ID_JACP_CUSTOM_TITLE); VBox.setMargin(title, new Insets(2, 2, 10, 2)); final HBox hboxInput = new HBox(); final Label nameLabel = new Label("category name:"); HBox.setMargin(nameLabel, new Insets(2)); final TextField nameInput = new TextField(); HBox.setMargin(nameInput, new Insets(0, 0, 0, 5)); HBox.setHgrow(nameInput, Priority.ALWAYS); hboxInput.getChildren().addAll(nameLabel, nameInput); final HBox hboxButtons = new HBox(); hboxButtons.setAlignment(Pos.CENTER_RIGHT); final Button ok = new Button("OK"); HBox.setMargin(ok, new Insets(6, 5, 4, 2)); final Button cancel = new Button("Cancel"); HBox.setMargin(cancel, new Insets(6, 2, 4, 5)); cancel.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(final ActionEvent arg0) { JACPModalDialog.getInstance().hideModalDialog(); } }); ok.setDefaultButton(true); ok.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(final ActionEvent actionEvent) { final String catName = nameInput.getText(); if (catName != null && StringUtils.hasText(catName)) { // contacts final Contact contact = new Contact(); contact.setFirstName(catName); parent.getContext().send(contact); JACPModalDialog.getInstance().hideModalDialog(); } } }); hboxButtons.getChildren().addAll(ok, cancel); box.getChildren().addAll(title, hboxInput, hboxButtons); JACPModalDialog.getInstance().showModalDialog(box); }
From source file:Main.java
private VBox addVBox() { VBox vbox = new VBox(); vbox.setPadding(new Insets(10)); // Set all sides to 10 vbox.setSpacing(8); // Gap between nodes Text title = new Text("Data"); title.setFont(Font.font("Arial", FontWeight.BOLD, 14)); vbox.getChildren().add(title);//from w ww.j av a2 s .c o m Hyperlink options[] = new Hyperlink[] { new Hyperlink("Sales"), new Hyperlink("Marketing"), new Hyperlink("Distribution"), new Hyperlink("Costs") }; for (int i = 0; i < 4; i++) { // Add offset to left side to indent from title VBox.setMargin(options[i], new Insets(0, 0, 0, 8)); vbox.getChildren().add(options[i]); } return vbox; }
From source file:gov.va.isaac.gui.refexViews.refexEdit.AddRefexPopup.java
private AddRefexPopup() { super();//from ww w.ja va 2s. c om BorderPane root = new BorderPane(); VBox topItems = new VBox(); topItems.setFillWidth(true); title_ = new Label("Create new sememe instance"); title_.getStyleClass().add("titleLabel"); title_.setAlignment(Pos.CENTER); title_.prefWidthProperty().bind(topItems.widthProperty()); topItems.getChildren().add(title_); VBox.setMargin(title_, new Insets(10, 10, 10, 10)); gp_ = new GridPane(); gp_.setHgap(10.0); gp_.setVgap(10.0); VBox.setMargin(gp_, new Insets(5, 5, 5, 5)); topItems.getChildren().add(gp_); Label referencedComponent = new Label("Referenced Component"); referencedComponent.getStyleClass().add("boldLabel"); gp_.add(referencedComponent, 0, 0); unselectableComponentLabel_ = new CopyableLabel(); unselectableComponentLabel_.setWrapText(true); AppContext.getService(DragRegistry.class).setupDragOnly(unselectableComponentLabel_, () -> { if (editRefex_ == null) { if (createRefexFocus_.getComponentNid() != null) { return createRefexFocus_.getComponentNid() + ""; } else { return createRefexFocus_.getAssemblyNid() + ""; } } else { return editRefex_.getRefex().getAssemblageNid() + ""; } }); //delay adding till we know which row Label assemblageConceptLabel = new Label("Assemblage Concept"); assemblageConceptLabel.getStyleClass().add("boldLabel"); gp_.add(assemblageConceptLabel, 0, 1); selectableConcept_ = new ConceptNode(null, true, refexDropDownOptions, null); selectableConcept_.getConceptProperty().addListener(new ChangeListener<ConceptVersionBI>() { @Override public void changed(ObservableValue<? extends ConceptVersionBI> observable, ConceptVersionBI oldValue, ConceptVersionBI newValue) { if (createRefexFocus_ != null && createRefexFocus_.getComponentNid() != null) { if (selectableConcept_.isValid().get()) { //Its a valid concept, but is it a valid assemblage concept? try { assemblageInfo_ = RefexDynamicUsageDescriptionBuilder .readRefexDynamicUsageDescriptionConcept( selectableConcept_.getConceptNoWait().getNid()); assemblageIsValid_.set(true); if (assemblageInfo_.getReferencedComponentTypeRestriction() != null) { String result = RefexDynamicValidatorType.COMPONENT_TYPE .passesValidatorStringReturn( new RefexDynamicNid(createRefexFocus_.getComponentNid()), new RefexDynamicString(assemblageInfo_ .getReferencedComponentTypeRestriction().name()), null); //component type validator doesn't use vc, so null is ok if (result.length() > 0) { selectableConcept_.isValid() .setInvalid("The selected assemblage requires the component type to be " + assemblageInfo_.getReferencedComponentTypeRestriction() .toString() + ", which doesn't match the referenced component."); logger_.info("The selected assemblage requires the component type to be " + assemblageInfo_.getReferencedComponentTypeRestriction().toString() + ", which doesn't match the referenced component."); assemblageIsValid_.set(false); } } } catch (Exception e) { selectableConcept_.isValid().setInvalid( "The selected concept is not properly constructed for use as an Assemblage concept"); logger_.info("Concept not a valid concept for a sememe assemblage", e); assemblageIsValid_.set(false); } } else { assemblageInfo_ = null; assemblageIsValid_.set(false); } buildDataFields(assemblageIsValid_.get(), null); } } }); selectableComponent_ = new TextField(); selectableComponentNodeValid_ = new ValidBooleanBinding() { { setComputeOnInvalidate(true); bind(selectableComponent_.textProperty()); invalidate(); } @Override protected boolean computeValue() { if (createRefexFocus_ != null && createRefexFocus_.getAssemblyNid() != null && !conceptNodeIsConceptType_) { //If the assembly nid was what was set - the component node may vary - validate if we are using the text field String value = selectableComponent_.getText().trim(); if (value.length() > 0) { try { if (Utility.isUUID(value)) { String result = RefexDynamicValidatorType.COMPONENT_TYPE .passesValidatorStringReturn(new RefexDynamicUUID(UUID.fromString(value)), new RefexDynamicString(assemblageInfo_ .getReferencedComponentTypeRestriction().name()), null); //component type validator doesn't use vc, so null is ok if (result.length() > 0) { setInvalidReason(result); logger_.info(result); return false; } } else if (Utility.isInt(value)) { String result = RefexDynamicValidatorType.COMPONENT_TYPE .passesValidatorStringReturn(new RefexDynamicNid(Integer.parseInt(value)), new RefexDynamicString(assemblageInfo_ .getReferencedComponentTypeRestriction().name()), null); //component type validator doesn't use vc, so null is ok if (result.length() > 0) { setInvalidReason(result); logger_.info(result); return false; } } else { setInvalidReason( "Value cannot be parsed as a component identifier. Must be a UUID or a valid NID"); return false; } } catch (Exception e) { logger_.error("Error checking component type validation", e); setInvalidReason("Unexpected error validating entry"); return false; } } else { setInvalidReason("Component identifier is required"); return false; } } clearInvalidReason(); return true; } }; selectableComponentNode_ = ErrorMarkerUtils.setupErrorMarker(selectableComponent_, null, selectableComponentNodeValid_); //delay adding concept / component till we know if / where ColumnConstraints cc = new ColumnConstraints(); cc.setHgrow(Priority.NEVER); cc.setMinWidth(FxUtils.calculateNecessaryWidthOfBoldLabel(referencedComponent)); gp_.getColumnConstraints().add(cc); cc = new ColumnConstraints(); cc.setHgrow(Priority.ALWAYS); gp_.getColumnConstraints().add(cc); Label l = new Label("Data Fields"); l.getStyleClass().add("boldLabel"); VBox.setMargin(l, new Insets(5, 5, 5, 5)); topItems.getChildren().add(l); root.setTop(topItems); sp_ = new ScrollPane(); sp_.visibleProperty().bind(assemblageIsValid_); sp_.setFitToHeight(true); sp_.setFitToWidth(true); root.setCenter(sp_); allValid_ = new UpdateableBooleanBinding() { { addBinding(assemblageIsValid_, selectableConcept_.isValid(), selectableComponentNodeValid_); } @Override protected boolean computeValue() { if (assemblageIsValid_.get() && (conceptNodeIsConceptType_ ? selectableConcept_.isValid().get() : selectableComponentNodeValid_.get())) { boolean allDataValid = true; for (ReadOnlyStringProperty ssp : currentDataFieldWarnings_) { if (ssp.get().length() > 0) { allDataValid = false; break; } } if (allDataValid) { clearInvalidReason(); return true; } } setInvalidReason("All errors must be corrected before save is allowed"); return false; } }; GridPane bottomRow = new GridPane(); //spacer col bottomRow.add(new Region(), 0, 0); Button cancelButton = new Button("Cancel"); cancelButton.setOnAction((action) -> { close(); }); GridPane.setMargin(cancelButton, new Insets(5, 20, 5, 0)); GridPane.setHalignment(cancelButton, HPos.RIGHT); bottomRow.add(cancelButton, 1, 0); Button saveButton = new Button("Save"); saveButton.disableProperty().bind(allValid_.not()); saveButton.setOnAction((action) -> { doSave(); }); Node wrappedSave = ErrorMarkerUtils.setupDisabledInfoMarker(saveButton, allValid_.getReasonWhyInvalid()); GridPane.setMargin(wrappedSave, new Insets(5, 0, 5, 20)); bottomRow.add(wrappedSave, 2, 0); //spacer col bottomRow.add(new Region(), 3, 0); cc = new ColumnConstraints(); cc.setHgrow(Priority.SOMETIMES); cc.setFillWidth(true); bottomRow.getColumnConstraints().add(cc); cc = new ColumnConstraints(); cc.setHgrow(Priority.NEVER); bottomRow.getColumnConstraints().add(cc); cc = new ColumnConstraints(); cc.setHgrow(Priority.NEVER); bottomRow.getColumnConstraints().add(cc); cc = new ColumnConstraints(); cc.setHgrow(Priority.SOMETIMES); cc.setFillWidth(true); bottomRow.getColumnConstraints().add(cc); root.setBottom(bottomRow); Scene scene = new Scene(root); scene.getStylesheets().add(AddRefexPopup.class.getResource("/isaac-shared-styles.css").toString()); setScene(scene); }
From source file:gov.va.isaac.gui.refexViews.refexEdit.AddSememePopup.java
private AddSememePopup() { super();/*from w w w .j a v a2 s . c o m*/ BorderPane root = new BorderPane(); VBox topItems = new VBox(); topItems.setFillWidth(true); title_ = new Label("Create new sememe instance"); title_.getStyleClass().add("titleLabel"); title_.setAlignment(Pos.CENTER); title_.prefWidthProperty().bind(topItems.widthProperty()); topItems.getChildren().add(title_); VBox.setMargin(title_, new Insets(10, 10, 10, 10)); gp_ = new GridPane(); gp_.setHgap(10.0); gp_.setVgap(10.0); VBox.setMargin(gp_, new Insets(5, 5, 5, 5)); topItems.getChildren().add(gp_); Label referencedComponent = new Label("Referenced Component"); referencedComponent.getStyleClass().add("boldLabel"); gp_.add(referencedComponent, 0, 0); unselectableComponentLabel_ = new CopyableLabel(); unselectableComponentLabel_.setWrapText(true); AppContext.getService(DragRegistry.class).setupDragOnly(unselectableComponentLabel_, () -> { if (editRefex_ == null) { return focusNid_ + ""; } else { return Get.identifierService().getConceptNid(editRefex_.getSememe().getAssemblageSequence()) + ""; } }); //delay adding till we know which row Label assemblageConceptLabel = new Label("Assemblage Concept"); assemblageConceptLabel.getStyleClass().add("boldLabel"); gp_.add(assemblageConceptLabel, 0, 1); selectableConcept_ = new ConceptNode(null, true, refexDropDownOptions, null); selectableConcept_.getConceptProperty().addListener(new ChangeListener<ConceptSnapshot>() { @Override public void changed(ObservableValue<? extends ConceptSnapshot> observable, ConceptSnapshot oldValue, ConceptSnapshot newValue) { if (createRefexFocus_ != null && createRefexFocus_ == ViewFocus.REFERENCED_COMPONENT) { if (selectableConcept_.isValid().get()) { //Its a valid concept, but is it a valid assemblage concept? try { assemblageInfo_ = DynamicSememeUsageDescription .read(selectableConcept_.getConceptNoWait().getNid()); assemblageIsValid_.set(true); if (assemblageInfo_.getReferencedComponentTypeRestriction() != null) { String result = DynamicSememeValidatorType.COMPONENT_TYPE .passesValidatorStringReturn(new DynamicSememeNid(focusNid_), new DynamicSememeString(assemblageInfo_ .getReferencedComponentTypeRestriction().name()), null, null); //don't need coordinates for component type validator if (result.length() > 0) { selectableConcept_.isValid() .setInvalid("The selected assemblage requires the component type to be " + assemblageInfo_.getReferencedComponentTypeRestriction() .toString() + ", which doesn't match the referenced component."); logger_.info("The selected assemblage requires the component type to be " + assemblageInfo_.getReferencedComponentTypeRestriction().toString() + ", which doesn't match the referenced component."); assemblageIsValid_.set(false); } } } catch (Exception e) { selectableConcept_.isValid().setInvalid( "The selected concept is not properly constructed for use as an Assemblage concept"); logger_.info("Concept not a valid concept for a sememe assemblage", e); assemblageIsValid_.set(false); } } else { assemblageInfo_ = null; assemblageIsValid_.set(false); } buildDataFields(assemblageIsValid_.get(), null); } } }); selectableComponent_ = new TextField(); selectableComponentNodeValid_ = new ValidBooleanBinding() { { setComputeOnInvalidate(true); bind(selectableComponent_.textProperty()); invalidate(); } @Override protected boolean computeValue() { if (createRefexFocus_ != null && createRefexFocus_ == ViewFocus.ASSEMBLAGE && !conceptNodeIsConceptType_) { //If the assembly nid was what was set - the component node may vary - validate if we are using the text field String value = selectableComponent_.getText().trim(); if (value.length() > 0) { try { if (Utility.isUUID(value)) { String result = DynamicSememeValidatorType.COMPONENT_TYPE .passesValidatorStringReturn(new DynamicSememeUUID(UUID.fromString(value)), new DynamicSememeString(assemblageInfo_ .getReferencedComponentTypeRestriction().name()), null, null); //component type validator doesn't use vc, so null is ok if (result.length() > 0) { setInvalidReason(result); logger_.info(result); return false; } } else if (Utility.isInt(value)) { String result = DynamicSememeValidatorType.COMPONENT_TYPE .passesValidatorStringReturn(new DynamicSememeNid(Integer.parseInt(value)), new DynamicSememeString(assemblageInfo_ .getReferencedComponentTypeRestriction().name()), null, null); //component type validator doesn't use vc, so null is ok if (result.length() > 0) { setInvalidReason(result); logger_.info(result); return false; } } else { setInvalidReason( "Value cannot be parsed as a component identifier. Must be a UUID or a valid NID"); return false; } } catch (Exception e) { logger_.error("Error checking component type validation", e); setInvalidReason("Unexpected error validating entry"); return false; } } else { setInvalidReason("Component identifier is required"); return false; } } clearInvalidReason(); return true; } }; selectableComponentNode_ = ErrorMarkerUtils.setupErrorMarker(selectableComponent_, null, selectableComponentNodeValid_); //delay adding concept / component till we know if / where ColumnConstraints cc = new ColumnConstraints(); cc.setHgrow(Priority.NEVER); cc.setMinWidth(FxUtils.calculateNecessaryWidthOfBoldLabel(referencedComponent)); gp_.getColumnConstraints().add(cc); cc = new ColumnConstraints(); cc.setHgrow(Priority.ALWAYS); gp_.getColumnConstraints().add(cc); Label l = new Label("Data Fields"); l.getStyleClass().add("boldLabel"); VBox.setMargin(l, new Insets(5, 5, 5, 5)); topItems.getChildren().add(l); root.setTop(topItems); sp_ = new ScrollPane(); sp_.visibleProperty().bind(assemblageIsValid_); sp_.setFitToHeight(true); sp_.setFitToWidth(true); root.setCenter(sp_); allValid_ = new UpdateableBooleanBinding() { { addBinding(assemblageIsValid_, selectableConcept_.isValid(), selectableComponentNodeValid_); } @Override protected boolean computeValue() { if (assemblageIsValid_.get() && (conceptNodeIsConceptType_ ? selectableConcept_.isValid().get() : selectableComponentNodeValid_.get())) { boolean allDataValid = true; for (ReadOnlyStringProperty ssp : currentDataFieldWarnings_) { if (ssp.get().length() > 0) { allDataValid = false; break; } } if (allDataValid) { clearInvalidReason(); return true; } } setInvalidReason("All errors must be corrected before save is allowed"); return false; } }; GridPane bottomRow = new GridPane(); //spacer col bottomRow.add(new Region(), 0, 0); Button cancelButton = new Button("Cancel"); cancelButton.setOnAction((action) -> { close(); }); GridPane.setMargin(cancelButton, new Insets(5, 20, 5, 0)); GridPane.setHalignment(cancelButton, HPos.RIGHT); bottomRow.add(cancelButton, 1, 0); Button saveButton = new Button("Save"); saveButton.disableProperty().bind(allValid_.not()); saveButton.setOnAction((action) -> { doSave(); }); Node wrappedSave = ErrorMarkerUtils.setupDisabledInfoMarker(saveButton, allValid_.getReasonWhyInvalid()); GridPane.setMargin(wrappedSave, new Insets(5, 0, 5, 20)); bottomRow.add(wrappedSave, 2, 0); //spacer col bottomRow.add(new Region(), 3, 0); cc = new ColumnConstraints(); cc.setHgrow(Priority.SOMETIMES); cc.setFillWidth(true); bottomRow.getColumnConstraints().add(cc); cc = new ColumnConstraints(); cc.setHgrow(Priority.NEVER); bottomRow.getColumnConstraints().add(cc); cc = new ColumnConstraints(); cc.setHgrow(Priority.NEVER); bottomRow.getColumnConstraints().add(cc); cc = new ColumnConstraints(); cc.setHgrow(Priority.SOMETIMES); cc.setFillWidth(true); bottomRow.getColumnConstraints().add(cc); root.setBottom(bottomRow); Scene scene = new Scene(root); scene.getStylesheets().add(AddSememePopup.class.getResource("/isaac-shared-styles.css").toString()); setScene(scene); }
From source file:acmi.l2.clientmod.xdat.Controller.java
private Tab createTab(Field listField) { Tab tab = new Tab(listField.getName()); SplitPane pane = new SplitPane(); TextField filter = TextFields.createClearableTextField(); VBox.setMargin(filter, new Insets(2)); TreeView<Object> elements = createTreeView(listField, filter.textProperty()); VBox.setVgrow(elements, Priority.ALWAYS); PropertySheet properties = createPropertySheet(elements); pane.getItems().addAll(new VBox(filter, elements), properties); pane.setDividerPositions(0.3);/*from w w w. ja v a2 s. c om*/ tab.setContent(wrap(pane)); return tab; }
From source file:dpfmanager.shell.interfaces.gui.component.dessign.DessignView.java
private void showLoadingConfig() { ProgressIndicator pi = new ProgressIndicator(); pi.setPrefWidth(75);/* w w w. ja va 2s. c o m*/ pi.setPrefHeight(75); pi.setProgress(-1); vBoxConfig = new VBox(); vBoxConfig.setAlignment(Pos.TOP_CENTER); vBoxConfig.setPrefWidth(configScroll.getWidth() - 5); vBoxConfig.getChildren().add(pi); VBox.setMargin(pi, new Insets(10, 0, 0, 0)); configScroll.setContent(vBoxConfig); }
From source file:se.trixon.mapollage.ui.config.FoldersTab.java
private void createUI() { VBox leftBox = new VBox(); VBox rightBox = new VBox(); setContent(leftBox);// w ww. j a v a2 s .c om //Left Pane Label rootNameLabel = new Label(mBundle.getString("FoldersTab.rootNameLabel")); Label rootDescLabel = new Label(mBundle.getString("FoldersTab.rootDescriptionLabel")); Label regexLabel = new Label(Dict.DEFAULT_VALUE.toString()); leftBox.getChildren().addAll(rootNameLabel, mRootNameTextField, rootDescLabel, mRootDescTextArea, rightBox); VBox.setVgrow(mRootDescTextArea, Priority.ALWAYS); //Right Pane mFolderByDirectoryRadioButton.setToggleGroup(mToggleGroup); mFolderByDateRadioButton.setToggleGroup(mToggleGroup); mFolderByRegexRadioButton.setToggleGroup(mToggleGroup); mFolderByNoneRadioButton.setToggleGroup(mToggleGroup); mDatePatternComboBox.setMaxWidth(Double.MAX_VALUE); mDatePatternComboBox.setEditable(true); mDatePatternComboBox .setItems(FXCollections.observableList(Arrays.asList(mBundle.getString("dateFormats").split(";")))); Label label = new Label(mBundle.getString("FoldersTab.folderByLabel")); rightBox.getChildren().addAll(label, mFolderByDirectoryRadioButton, mFolderByDateRadioButton, mDatePatternComboBox, mFolderByRegexRadioButton, mRegexTextField, regexLabel, mRegexDefaultTextField, mFolderByNoneRadioButton); addTopPadding(rootDescLabel, mFolderByDirectoryRadioButton, mFolderByDateRadioButton, mFolderByRegexRadioButton, regexLabel, mFolderByNoneRadioButton, rightBox); Insets leftInsets = new Insets(0, 0, 0, 24); VBox.setMargin(mDatePatternComboBox, leftInsets); VBox.setMargin(mRegexTextField, leftInsets); VBox.setMargin(mRegexDefaultTextField, leftInsets); VBox.setMargin(regexLabel, leftInsets); mDatePatternComboBox.disableProperty().bind(mFolderByDateRadioButton.selectedProperty().not()); mRegexTextField.disableProperty().bind(mFolderByRegexRadioButton.selectedProperty().not()); mRegexDefaultTextField.disableProperty().bind(mFolderByRegexRadioButton.selectedProperty().not()); // EventHandler eventHandler = (EventHandler) (Event event) -> { //// sValidationSupport.initInitialDecoration(); // sValidationSupport.getValidationDecorator().removeDecorations(mDatePatternComboBox); // // sValidationSupport.redecorate(); // System.out.println(event); // }; // // mFolderByDateRadioButton.setOnAction(eventHandler); // mFolderByDirectoryRadioButton.setOnAction(eventHandler); // mFolderByNoneRadioButton.setOnAction(eventHandler); // mFolderByRegexRadioButton.setOnAction(eventHandler); }