List of usage examples for javafx.scene.layout HBox setHgrow
public static void setHgrow(Node child, Priority value)
From source file:de.pixida.logtest.designer.logreader.LogReaderEditor.java
public VBox createRunForm() { // CHECKSTYLE:OFF Yes, we are using lots of constants here. It does not make sense to name them using final variables. final VBox lines = new VBox(); lines.setSpacing(10d);/*w w w .j a va 2s .co m*/ final HBox inputTypeLine = new HBox(); inputTypeLine.setSpacing(30d); final ToggleGroup group = new ToggleGroup(); final RadioButton inputTypeText = new RadioButton("Paste/Enter text"); inputTypeText.setToggleGroup(group); final RadioButton inputTypeFile = new RadioButton("Read log file"); inputTypeFile.setToggleGroup(group); inputTypeLine.getChildren().add(inputTypeText); inputTypeLine.getChildren().add(inputTypeFile); inputTypeText.setSelected(true); final TextField pathInput = new TextField(); HBox.setHgrow(pathInput, Priority.ALWAYS); final Button selectLogFileButton = SelectFileButton.createButtonWithFileSelection(pathInput, LOG_FILE_ICON_NAME, "Select log file", null, null); final Text pathInputLabel = new Text("Log file path: "); final HBox fileInputConfig = new HBox(); fileInputConfig.setAlignment(Pos.CENTER_LEFT); fileInputConfig.visibleProperty().bind(inputTypeFile.selectedProperty()); fileInputConfig.managedProperty().bind(fileInputConfig.visibleProperty()); fileInputConfig.getChildren().addAll(pathInputLabel, pathInput, selectLogFileButton); final TextArea logInputText = new TextArea(); HBox.setHgrow(logInputText, Priority.ALWAYS); logInputText.setPrefRowCount(10); logInputText.setStyle("-fx-font-family: monospace"); final HBox enterTextConfig = new HBox(); enterTextConfig.getChildren().add(logInputText); enterTextConfig.visibleProperty().bind(inputTypeText.selectedProperty()); enterTextConfig.managedProperty().bind(enterTextConfig.visibleProperty()); final Button startBtn = new Button("Read Log"); startBtn.setPadding(new Insets(8d)); // CHECKSTYLE:ON startBtn.setGraphic(Icons.getIconGraphics("control_play_blue")); HBox.setHgrow(startBtn, Priority.ALWAYS); startBtn.setMaxWidth(Double.MAX_VALUE); startBtn.setOnAction(event -> this.runLogFileReader(inputTypeFile, pathInput, logInputText)); final HBox startLine = new HBox(); startLine.getChildren().add(startBtn); lines.getChildren().addAll(inputTypeLine, fileInputConfig, enterTextConfig, startLine, new Text("Results:"), this.parsedLogEntries); return lines; }
From source file:dpfmanager.shell.interfaces.gui.component.dessign.DessignView.java
private void addTreeView() { // Root node (my computer) CheckBoxTreeItem<String> rootNode = new CheckBoxTreeItem<>(getHostName(), new ImageView(new Image("images/computer.png"))); checkTreeView = new CheckTreeView<>(rootNode); rootNode.addEventHandler(TreeItem.<Object>branchExpandedEvent(), new ExpandEventHandler(checkTreeView)); rootNode.addEventHandler(TreeItem.<Object>branchCollapsedEvent(), new CollapseEventHandler()); // Root items Iterable<Path> rootDirectories = FileSystems.getDefault().getRootDirectories(); for (Path name : rootDirectories) { if (Files.isDirectory(name)) { FilePathTreeItem treeNode = new FilePathTreeItem(name); rootNode.getChildren().add(treeNode); }/*from w w w .j av a 2 s . co m*/ } rootNode.setExpanded(true); // Add data and add to gui treeViewHBox.getChildren().clear(); treeViewHBox.getChildren().add(checkTreeView); HBox.setHgrow(checkTreeView, Priority.ALWAYS); }
From source file:gov.va.isaac.gui.ConceptNode.java
/** * descriptionReader is optional/*ww w . ja v a 2 s . c o m*/ */ 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:de.pixida.logtest.designer.testrun.TestRunEditor.java
public TitledPane createPanelForLaunchingTests() { final Button startBtn = new Button("Run Test"); startBtn.disableProperty().bind(this.testRunService.runningProperty()); final double startButtonPadding = 8d; startBtn.setPadding(new Insets(startButtonPadding)); startBtn.setGraphic(Icons.getIconGraphics("control_play_blue")); HBox.setHgrow(startBtn, Priority.ALWAYS); startBtn.setMaxWidth(Double.MAX_VALUE); startBtn.setOnAction(event -> {/*from w w w . ja v a2s. c o m*/ final Job job = this.createJobFromConfig(); this.testRunService.setJob(job); this.testRunService.start(); }); final HBox startLine = new HBox(); startLine.getChildren().add(startBtn); final VBox runLines = new VBox(); final double linesSpacing = 10d; runLines.setSpacing(linesSpacing); final TextFlow resultBar = new TextFlow(); resultBar.backgroundProperty().bind(this.resultBarBackgroundProperty); this.resultBarBackgroundProperty.set(RESULT_BAR_BACKGROUND_IDLE); resultBar.setStyle("-fx-border-color: black; -fx-border-width:1"); final Text resultBarText = new Text(); resultBarText.textProperty().bind(this.resultBarTextProperty); this.resultBarTextProperty.set("Idle"); resultBar.getChildren().add(resultBarText); resultBar.setTextAlignment(TextAlignment.CENTER); final double resultBarPadding = 2d; resultBar.setPadding(new Insets(resultBarPadding)); final int logOutputLinesSize = 25; this.resultLogOutputText.setPrefRowCount(logOutputLinesSize); this.resultLogOutputText.setEditable(false); this.resultLogOutputText.setStyle("-fx-font-family: monospace"); HBox.setHgrow(this.resultLogOutputText, Priority.ALWAYS); runLines.getChildren().addAll(startLine, new Text("Recent results:"), resultBar, this.resultLogOutputText); final TitledPane runPane = new TitledPane("Run", runLines); runPane.setGraphic(Icons.getIconGraphics("lightning_go")); runPane.setCollapsible(false); return runPane; }
From source file:de.pixida.logtest.designer.testrun.TestRunEditor.java
private List<Triple<String, Node, String>> createConfigurationForm() { final List<Triple<String, Node, String>> formItems = new ArrayList<>(); // Automaton file final TextField automatonFilePath = new TextField(); this.automatonFilePathProperty.bind(automatonFilePath.textProperty()); HBox.setHgrow(automatonFilePath, Priority.ALWAYS); final Button selectAutomatonFilePathButton = SelectFileButton.createButtonWithFileSelection( automatonFilePath, Editor.Type.AUTOMATON.getIconName(), "Select " + Editor.Type.AUTOMATON.getName(), Editor.Type.AUTOMATON.getFileMask(), Editor.Type.AUTOMATON.getFileDescription()); final HBox automatonFilePathConfig = new HBox(automatonFilePath, selectAutomatonFilePathButton); formItems.add(Triple.of("Automaton", automatonFilePathConfig, null)); // Automaton parameters final TextArea parametersInputText = new TextArea(); parametersInputText.setStyle("-fx-font-family: monospace"); HBox.setHgrow(parametersInputText, Priority.ALWAYS); final int parametersInputLinesSize = 4; parametersInputText.setPrefRowCount(parametersInputLinesSize); this.parametersProperty.bind(parametersInputText.textProperty()); formItems.add(Triple.of("Parameters", parametersInputText, "Set parameters for the execution. Each line can contain a parameter as follows: ${PARAMETER}=value, e.g. ${TIMEOUT}=10.")); // Log file/*from w ww .ja v a 2 s . c o m*/ this.createLogFileSourceInputItems(formItems); // Log reader configuration file final TextField logReaderConfigurationFilePath = new TextField(); this.logReaderConfigurationFilePathProperty.bind(logReaderConfigurationFilePath.textProperty()); HBox.setHgrow(logReaderConfigurationFilePath, Priority.ALWAYS); final Button selectLogReaderConfigurationFilePathButton = SelectFileButton.createButtonWithFileSelection( logReaderConfigurationFilePath, Editor.Type.LOG_READER_CONFIG.getIconName(), "Select " + Editor.Type.LOG_READER_CONFIG.getName(), Editor.Type.LOG_READER_CONFIG.getFileMask(), Editor.Type.LOG_READER_CONFIG.getFileDescription()); final HBox logReaderConfigurationFilePathConfig = new HBox(logReaderConfigurationFilePath, selectLogReaderConfigurationFilePathButton); formItems.add(Triple.of("Log Reader Configuration", logReaderConfigurationFilePathConfig, null)); // Debug output final CheckBox cb = new CheckBox(); this.showDebugOutputProperty.bind(cb.selectedProperty()); formItems.add(Triple.of("Show Debug Output", cb, "Show verbose debug output. Might generate lots of text and slows down the" + " evaluation, but is very helpful for debugging automatons while developing them.")); return formItems; }
From source file:com.panemu.tiwulfx.table.TableControl.java
private void initControls() { this.getStyleClass().add("table-control"); btnAdd = buildButton(TiwulFXUtil.getGraphicFactory().createAddGraphic()); btnDelete = buildButton(TiwulFXUtil.getGraphicFactory().createDeleteGraphic()); btnEdit = buildButton(TiwulFXUtil.getGraphicFactory().createEditGraphic()); btnExport = buildButton(TiwulFXUtil.getGraphicFactory().createExportGraphic()); btnReload = buildButton(TiwulFXUtil.getGraphicFactory().createReloadGraphic()); btnSave = buildButton(TiwulFXUtil.getGraphicFactory().createSaveGraphic()); btnFirstPage = new Button(); btnFirstPage.setGraphic(TiwulFXUtil.getGraphicFactory().createPageFirstGraphic()); btnFirstPage.setOnAction(paginationHandler); btnFirstPage.setDisable(true);/*from w ww . j a v a2 s .c om*/ btnFirstPage.setFocusTraversable(false); btnFirstPage.getStyleClass().addAll("pill-button", "pill-button-left"); btnPrevPage = new Button(); btnPrevPage.setGraphic(TiwulFXUtil.getGraphicFactory().createPagePrevGraphic()); btnPrevPage.setOnAction(paginationHandler); btnPrevPage.setDisable(true); btnPrevPage.setFocusTraversable(false); btnPrevPage.getStyleClass().addAll("pill-button", "pill-button-center"); btnNextPage = new Button(); btnNextPage.setGraphic(TiwulFXUtil.getGraphicFactory().createPageNextGraphic()); btnNextPage.setOnAction(paginationHandler); btnNextPage.setDisable(true); btnNextPage.setFocusTraversable(false); btnNextPage.getStyleClass().addAll("pill-button", "pill-button-center"); btnLastPage = new Button(); btnLastPage.setGraphic(TiwulFXUtil.getGraphicFactory().createPageLastGraphic()); btnLastPage.setOnAction(paginationHandler); btnLastPage.setDisable(true); btnLastPage.setFocusTraversable(false); btnLastPage.getStyleClass().addAll("pill-button", "pill-button-right"); cmbPage = new ComboBox<>(); cmbPage.setEditable(true); cmbPage.setOnAction(paginationHandler); cmbPage.setFocusTraversable(false); cmbPage.setDisable(true); cmbPage.getStyleClass().addAll("combo-page"); cmbPage.setPrefWidth(75); paginationBox = new HBox(); paginationBox.setAlignment(Pos.CENTER); paginationBox.getChildren().addAll(btnFirstPage, btnPrevPage, cmbPage, btnNextPage, btnLastPage); spacer = new Region(); HBox.setHgrow(spacer, Priority.ALWAYS); toolbar = new ToolBar(btnReload, btnAdd, btnEdit, btnSave, btnDelete, btnExport, spacer, paginationBox); toolbar.getStyleClass().add("table-toolbar"); footer = new StackPane(); footer.getStyleClass().add("table-footer"); lblRowIndex = new Label(); lblTotalRow = new Label(); menuButton = new TableControlMenu(this); StackPane.setAlignment(lblRowIndex, Pos.CENTER_LEFT); StackPane.setAlignment(lblTotalRow, Pos.CENTER); StackPane.setAlignment(menuButton, Pos.CENTER_RIGHT); lblTotalRow.visibleProperty().bind(progressIndicator.visibleProperty().not()); progressIndicator.setProgress(-1); progressIndicator.visibleProperty().bind(service.runningProperty()); toolbar.disableProperty().bind(service.runningProperty()); menuButton.disableProperty().bind(service.runningProperty()); footer.getChildren().addAll(lblRowIndex, lblTotalRow, menuButton, progressIndicator); VBox.setVgrow(tblView, Priority.ALWAYS); getChildren().addAll(toolbar, tblView, footer); }
From source file:com.github.drbookings.ui.controller.BookingDetailsController.java
private void addSeparator() { final HBox bb = new HBox(); bb.setPrefHeight(20);/*from www.ja va 2 s .com*/ bb.setAlignment(Pos.CENTER); final Separator s = new Separator(); s.getStyleClass().add("large-separator"); bb.getChildren().add(s); HBox.setHgrow(s, Priority.ALWAYS); content.getChildren().add(bb); }
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);/* www .ja va 2 s . c om*/ 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:io.bitsquare.gui.main.overlays.Overlay.java
protected void addCloseButton() { closeButton = new Button(closeButtonText == null ? "Close" : closeButtonText); closeButton.setOnAction(event -> doClose()); if (actionHandlerOptional.isPresent() || actionButtonText != null) { actionButton = new Button(actionButtonText == null ? "Ok" : actionButtonText); actionButton.setDefaultButton(true); //TODO app wide focus //actionButton.requestFocus(); actionButton.setOnAction(event -> { hide();// w w w. j a va 2s . c om actionHandlerOptional.ifPresent(Runnable::run); }); Pane spacer = new Pane(); HBox hBox = new HBox(); hBox.setSpacing(10); hBox.getChildren().addAll(spacer, closeButton, actionButton); HBox.setHgrow(spacer, Priority.ALWAYS); GridPane.setHalignment(hBox, HPos.RIGHT); GridPane.setRowIndex(hBox, ++rowIndex); GridPane.setColumnSpan(hBox, 2); GridPane.setMargin(hBox, new Insets(buttonDistance, 0, 0, 0)); gridPane.getChildren().add(hBox); } else if (!hideCloseButton) { closeButton.setDefaultButton(true); GridPane.setHalignment(closeButton, HPos.RIGHT); if (!showReportErrorButtons) GridPane.setMargin(closeButton, new Insets(buttonDistance, 0, 0, 0)); GridPane.setRowIndex(closeButton, ++rowIndex); GridPane.setColumnIndex(closeButton, 1); gridPane.getChildren().add(closeButton); } }
From source file:org.pdfsam.ui.banner.BannerPane.java
@Inject public BannerPane(BannerButtons buttons, ImageView payoff, @Named("logo32") Image logo) { getStyleClass().add("pdfsam-banner"); current.getStyleClass().add("header-title"); HBox.setHgrow(buttons, Priority.ALWAYS); HBox logoView = new HBox(); logoView.getStyleClass().add("pdfsam-logo"); logoView.getChildren().addAll(new ImageView(logo), payoff); getChildren().addAll(logoView, current, buttons); eventStudio().addAnnotatedListeners(this); }