List of usage examples for javafx.scene.layout BorderPane BorderPane
public BorderPane()
From source file:de.hs.mannheim.modUro.controller.diagram.fx.ChartViewerSkin.java
/** * Creates the node representing this control. * * @return The node./*from ww w . j a v a 2 s .c o m*/ */ private BorderPane createNode(ChartViewer control) { BorderPane borderPane = new BorderPane(); borderPane.setPrefSize(800, 500); StackPane sp = new StackPane(); sp.setMinSize(10, 10); sp.setPrefSize(150, 200); this.canvas = new ChartCanvas(getSkinnable().getChart()); this.canvas.setTooltipEnabled(control.isTooltipEnabled()); this.canvas.addChartMouseListener(control); this.canvas.widthProperty().bind(sp.widthProperty()); this.canvas.heightProperty().bind(sp.heightProperty()); this.canvas.addMouseHandler(new ZoomHandlerFX("zoom", control)); sp.getChildren().add(this.canvas); borderPane.setCenter(sp); return borderPane; }
From source file:eu.ggnet.dwoss.redtape.document.DocumentUpdateView.java
private void initFxComponents() { final JFXPanel jfxp = new JFXPanel(); positionPanelFx.add(jfxp, BorderLayout.CENTER); Platform.runLater(() -> {// www . jav a 2 s. co m BorderPane pane = new BorderPane(); Scene scene = new Scene(pane, Color.ALICEBLUE); positionsFxList = new ListView<>(); positionsFxList.getSelectionModel().setSelectionMode(SelectionMode.SINGLE); positionsFxList.setCellFactory(new PositionListCell.Factory()); positionsFxList.setItems(positions); positionsFxList.setOnMouseClicked((mouseEvent) -> { if (mouseEvent.getButton().equals(MouseButton.PRIMARY) && mouseEvent.getClickCount() == 2) { if (isChangeAllowed()) { controller.editPosition(positionsFxList.getSelectionModel().getSelectedItem()); positionsFxList.refresh(); } else { Alert.show("nderung an Positionen ist nicht erlaubt."); } } }); pane.setCenter(positionsFxList); jfxp.setScene(scene); }); }
From source file:cz.lbenda.rcp.DialogHelper.java
/** Show unsaved object if aren't saved. if user want cancel the closing then return false, elserwhere return true * @param savableRegistry register which hold unsaved data * @return true if window/object can be closed */ public boolean showUnsavedObjectDialog(SavableRegistry savableRegistry) { Set<Savable> savables = savableRegistry.dirtySavables(); if (savables.size() == 0) { return true; }/* w ww.ja v a 2 s.c o m*/ Dialog<?> dialog = new Dialog<>(); dialog.setResizable(false); dialog.setTitle(msgNotSavedObjectsTitle); dialog.setHeaderText(msgNotSavedObjectsHeader); BorderPane pane = new BorderPane(); pane.setPrefHeight(400); pane.setPrefWidth(300); ListView<DialogHelper.Item> listView = new ListView<>(); listView.getItems() .addAll(savables.stream().map(savable -> new Item(savable, true)).collect(Collectors.toList())); listView.setCellFactory(CheckBoxListCell.forListView(DialogHelper.Item::onProperty)); pane.setCenter(listView); dialog.getDialogPane().setContent(pane); ButtonType btCancel = new ButtonType(button_cancel, ButtonBar.ButtonData.CANCEL_CLOSE); ButtonType btSaveClose = new ButtonType(button_saveAndClose, ButtonBar.ButtonData.OK_DONE); ButtonType btClose = new ButtonType(button_closeWithoutSave); dialog.getDialogPane().getButtonTypes().addAll(btClose, btSaveClose, btCancel); Optional<?> result = dialog.showAndWait(); if (result.isPresent()) { if (btCancel == result.get()) { return false; } if (btSaveClose == result.get()) { listView.getItems().stream().filter(Item::isOn).forEach(item -> item.getSavable().save()); } } else { return false; } return true; }
From source file:com.cdd.bao.editor.EditSchema.java
public EditSchema(Stage stage) { this.stage = stage; if (MainApplication.icon != null) stage.getIcons().add(MainApplication.icon); menuBar = new MenuBar(); menuBar.setUseSystemMenuBar(true);//from www. j a v a2 s. com menuBar.getMenus().add(menuFile = new Menu("_File")); menuBar.getMenus().add(menuEdit = new Menu("_Edit")); menuBar.getMenus().add(menuValue = new Menu("_Value")); menuBar.getMenus().add(menuView = new Menu("Vie_w")); createMenuItems(); treeRoot = new TreeItem<>(new Branch(this)); treeView = new TreeView<>(treeRoot); treeView.setEditable(true); treeView.setCellFactory(p -> new HierarchyTreeCell()); treeView.getSelectionModel().selectedItemProperty().addListener((observable, oldVal, newVal) -> { if (oldVal != null) pullDetail(oldVal); if (newVal != null) pushDetail(newVal); }); treeView.focusedProperty() .addListener((val, oldValue, newValue) -> Platform.runLater(() -> maybeUpdateTree())); detail = new DetailPane(this); StackPane sp1 = new StackPane(), sp2 = new StackPane(); sp1.getChildren().add(treeView); sp2.getChildren().add(detail); splitter = new SplitPane(); splitter.setOrientation(Orientation.HORIZONTAL); splitter.getItems().addAll(sp1, sp2); splitter.setDividerPositions(0.4, 1.0); progBar = new ProgressBar(); progBar.setMaxWidth(Double.MAX_VALUE); root = new BorderPane(); root.setTop(menuBar); root.setCenter(splitter); root.setBottom(progBar); BorderPane.setMargin(progBar, new Insets(2, 2, 2, 2)); Scene scene = new Scene(root, 1000, 800, Color.WHITE); stage.setScene(scene); treeView.setShowRoot(false); treeRoot.getChildren().add(treeTemplate = new TreeItem<>(new Branch(this, "Template"))); treeRoot.getChildren().add(treeAssays = new TreeItem<>(new Branch(this, "Assays"))); treeTemplate.setExpanded(true); treeAssays.setExpanded(true); rebuildTree(); Platform.runLater(() -> treeView.getFocusModel().focus(treeView.getSelectionModel().getSelectedIndex())); // for some reason it defaults to not the first item stage.setOnCloseRequest(event -> { if (!confirmClose()) event.consume(); }); updateTitle(); // loading begins in a background thread, and is updated with a status bar Vocabulary.Listener listener = new Vocabulary.Listener() { public void vocabLoadingProgress(Vocabulary vocab, float progress) { Platform.runLater(() -> { progBar.setProgress(progress); if (vocab.isLoaded()) root.getChildren().remove(progBar); }); } public void vocabLoadingException(Exception ex) { ex.printStackTrace(); } }; Vocabulary.globalInstance(listener); }
From source file:se.trixon.filebydate.ui.MainApp.java
private void createUI() { mRoot = new BorderPane(); Scene scene = new Scene(mRoot); //scene.getStylesheets().add("css/modena_dark.css"); mDefaultFont = Font.getDefault(); initActions();//ww w . jav a 2 s .c o m mListView = new ListView<>(); mListView.setItems(mItems); mListView.setCellFactory((ListView<Profile> param) -> new ProfileListCell()); Label welcomeLabel = new Label(mBundle.getString("welcome")); welcomeLabel.setFont(Font.font(mDefaultFont.getName(), FontPosture.ITALIC, 18)); mListView.setPlaceholder(welcomeLabel); mPreviewPanel = new PreviewPanel(); mRoot.setCenter(mListView); mRoot.setBottom(mPreviewPanel); mStage.setScene(scene); setRunningState(RunState.STARTABLE); }
From source file:photobooth.views.ExplorerPane.java
private BorderPane createImageView(final File imageFile) { // DEFAULT_THUMBNAIL_WIDTH is a constant you need to define // The last two arguments are: preserveRatio, and use smooth (slower) // resizing//w w w . j a v a 2 s . c o m ExplorerPane explorerPane = this; ImageView imageView = null; BorderPane borderPane = new BorderPane(); try { borderPane.setMaxSize(100, 100); borderPane.setMinSize(100, 100); FileInputStream fileInputStream = new FileInputStream(imageFile); final Image image = new Image(fileInputStream, 100, 100, true, true); imageView = new ImageView(image); fileInputStream.close(); imageView.getStyleClass().add("image-view"); borderPane.setCenter(imageView); //imageView.setFitWidth(80); imageView.setOnMouseClicked(new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent mouseEvent) { if (mouseEvent.getButton().equals(MouseButton.PRIMARY)) { if (mouseEvent.getClickCount() == 1) { Global.getInstance().setSceneRoot(LoadingPane.getInstance()); Platform.runLater(() -> { new Thread(new Runnable() { @Override public void run() { ImagePane.getInstance().init(explorerPane, imageFile); Global.getInstance().setSceneRoot(ImagePane.getInstance()); } }).start(); }); } } } }); } catch (FileNotFoundException ex) { ex.printStackTrace(); } catch (IOException ex) { Logger.getLogger(ExplorerPane.class.getName()).log(Level.SEVERE, null, ex); } return borderPane; }
From source file:be.makercafe.apps.makerbench.editors.GCodeEditor.java
public GCodeEditor(String tabText, Path path) { super(tabText); this.viewGroup = new Group(); this.editorContainer = new BorderPane(); this.viewContainer = new Pane(); this.caCodeArea = new CodeArea(""); this.caCodeArea.setEditable(true); this.caCodeArea.setParagraphGraphicFactory(LineNumberFactory.get(caCodeArea)); this.caCodeArea.setPrefSize(Double.MAX_VALUE, Double.MAX_VALUE); // this.caCodeArea.getStylesheets().add(this.getClass().getResource("java-keywords.css").toExternalForm()); // this.caCodeArea.richChanges().subscribe(change -> { // caCodeArea.setStyleSpans(0, // computeHighlighting(caCodeArea.getText())); // });// w ww .j av a2 s.c o m addContextMenu(this.caCodeArea); EventStream<Change<String>> textEvents = EventStreams.changesOf(caCodeArea.textProperty()); textEvents.reduceSuccessions((a, b) -> b, Duration.ofMillis(3000)).subscribe(code -> { if (autoCompile) { compile(code.getNewValue()); } }); if (path == null) { this.caCodeArea.replaceText("#empty"); } else { try { this.caCodeArea.replaceText(FileUtils.readFileToString(path.toFile())); } catch (IOException ex) { Logger.getLogger(this.getClass().getName()).log(Level.SEVERE, "Error reading file.", ex); } } // editorContainer.setCenter(this.codeArea); subScene = new SubScene(viewGroup, 100, 100, true, SceneAntialiasing.BALANCED); subScene.widthProperty().bind(viewContainer.widthProperty()); subScene.heightProperty().bind(viewContainer.heightProperty()); PerspectiveCamera subSceneCamera = new PerspectiveCamera(false); subScene.setCamera(subSceneCamera); viewContainer.getChildren().add(subScene); SplitPane editorPane = new SplitPane(caCodeArea, viewContainer); editorPane.setOrientation(Orientation.HORIZONTAL); BorderPane rootPane = new BorderPane(); BorderPane pane = (BorderPane) this.getTab().getContent(); toolBar = createToolBar(); rootPane.setTop(toolBar); rootPane.setCenter(editorPane); this.getTab().setContent(rootPane); subScene.setOnScroll(new EventHandler<ScrollEvent>() { @Override public void handle(ScrollEvent event) { System.out .println(String.format("deltaX: %.3f deltaY: %.3f", event.getDeltaX(), event.getDeltaY())); double z = subSceneCamera.getTranslateZ(); double newZ = z + event.getDeltaY(); subSceneCamera.setTranslateZ(newZ); } }); }
From source file:se.trixon.mapollage.ui.MainApp.java
private void createUI() { mRoot = new BorderPane(); Scene scene = new Scene(mRoot); //scene.getStylesheets().add("css/modena_dark.css"); mDefaultFont = Font.getDefault(); initActions();/*from ww w .jav a2s.c om*/ mListView = new ListView<>(); mListView.setItems(mItems); mListView.setCellFactory((ListView<Profile> param) -> new ProfileListCell()); Label welcomeLabel = new Label(mBundle.getString("welcome")); welcomeLabel.setFont(Font.font(mDefaultFont.getName(), FontPosture.ITALIC, 18)); mOpenButton = mProgressPanel.getOpenButton(); mOpenButton.setOnAction((ActionEvent event) -> { SystemHelper.desktopOpen(mDestination); }); mOpenButton.setGraphic( mFontAwesome.create(FontAwesome.Glyph.GLOBE).size(ICON_SIZE_TOOLBAR / 2).color(mIconColor)); mListView.setPlaceholder(welcomeLabel); mRoot.setCenter(mListView); mStage.setScene(scene); setRunningState(RunState.STARTABLE); }
From source file:gov.va.isaac.gui.refexViews.refexEdit.AddRefexPopup.java
private AddRefexPopup() { super();/*from w ww . j a v a2s . 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) { 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 ww . jav a 2 s . com*/ 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); }