List of usage examples for javafx.scene.layout VBox getStyleClass
@Override public final ObservableList<String> getStyleClass()
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/*from w w w. j av a 2 s. c om*/ 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:com.github.drbookings.ui.controller.UpcomingController.java
private void addEvents(final LocalDate date, final Collection<BookingEntry> upcomingBookings, final Collection<CleaningEntry> upcomingCleanings) { final VBox box = new VBox(4); if (date.equals(LocalDate.now())) { box.getStyleClass().add("first-day"); } else if (date.equals(LocalDate.now().plusDays(1))) { box.getStyleClass().add("second-day"); } else if (date.isAfter(LocalDate.now().plusDays(1))) { box.getStyleClass().add("later"); }/*from w ww . j a v a 2 s . c o m*/ if (upcomingBookings.stream().filter(b -> b.isCheckIn() || b.isCheckOut()).collect(Collectors.toList()) .isEmpty() && upcomingCleanings.isEmpty()) { final Text t0 = new Text(getDateString(date)); final Text t1 = new Text(" there are no events."); t0.getStyleClass().add("emphasis"); final TextFlow tf = new TextFlow(); tf.getChildren().addAll(t0, t1); box.getChildren().addAll(tf); } else { final List<CheckInOutDetails> checkInNotes = Collections.synchronizedList(new ArrayList<>()); final List<CheckInOutDetails> checkOutNotes = Collections.synchronizedList(new ArrayList<>()); upcomingBookings.forEach(b -> { if (b.isCheckIn()) { String note = ""; if (b.getElement().getCheckInNote() != null) { note = b.getElement().getCheckInNote(); } if (b.getElement().getSpecialRequestNote() != null) { note = note + "\n" + b.getElement().getSpecialRequestNote(); } checkInNotes.add(new CheckInOutDetails(b.getRoom().getName(), b.getElement().getBookingOrigin().getName(), note)); } else if (b.isCheckOut()) { checkOutNotes.add(new CheckInOutDetails(b.getRoom().getName(), b.getElement().getBookingOrigin().getName(), b.getElement().getCheckOutNote())); } }); Collections.sort(checkInNotes); Collections.sort(checkOutNotes); addGeneralSummary(date, box, checkInNotes); addCheckOutSummary(date, box, checkOutNotes); addCheckOutNotes(date, box, checkOutNotes); addCheckInSummary(date, box, checkInNotes); addCheckInNotes(date, box, checkInNotes); addCleaningSummary(date, box, upcomingCleanings); addCleanings(date, box, upcomingCleanings); } this.box.getChildren().add(box); }
From source file:ambroafb.clients.dialog.ClientDialogController.java
private void changeSceneVisualAsPerson(String delimiter) { first_name.setText(conf.getTitleFor("first_name")); last_name.setText(conf.getTitleFor("last_name")); VBox lastNameVBox = new VBox(last_name, lastName); namesRootPane.getChildren().add(1, lastNameVBox); lastNameVBox.getStyleClass().add("couple"); setStylesForNamesPaneElements("oneThirds", "couple", "couple"); String firmDescrip = firstName.getText(); String firstNameText = StringUtils.substringBeforeLast(firmDescrip, delimiter); String lastNameText = StringUtils.substringAfterLast(firmDescrip, delimiter); firstName.setText(firstNameText.trim()); lastName.setText(lastNameText.trim()); }
From source file:com.playonlinux.javafx.mainwindow.console.ConsoleTab.java
public ConsoleTab(CommandLineInterpreterFactory commandLineInterpreterFactory) { final VBox content = new VBox(); commandInterpreter = commandLineInterpreterFactory.createInstance(); this.setText(translate("Console")); this.setContent(content); final TextField command = new TextField(); command.getStyleClass().add("consoleCommandType"); final TextFlow console = new TextFlow(); final ScrollPane consolePane = new ScrollPane(console); content.getStyleClass().add("rightPane"); consolePane.getStyleClass().add("console"); consolePane.setVbarPolicy(ScrollPane.ScrollBarPolicy.NEVER); content.getChildren().addAll(consolePane, command); command.requestFocus();/* w w w . j av a 2s. c o m*/ command.setOnKeyPressed(event -> { if (event.getCode() == KeyCode.ENTER) { final String commandToSend = command.getText(); final int cursorPosition = command.getCaretPosition(); command.setDisable(true); commandHistory.add(new CommandHistory.Item(commandToSend, cursorPosition)); Text commandText = new Text(nextSymbol + commandToSend + "\n"); commandText.getStyleClass().add("commandText"); console.getChildren().add(commandText); command.setText(""); if (commandInterpreter.sendLine(commandToSend, message -> { Platform.runLater(() -> { if (!StringUtils.isBlank(message)) { Text resultText = new Text(message); resultText.getStyleClass().add("resultText"); console.getChildren().add(resultText); } command.setDisable(false); command.requestFocus(); consolePane.setVvalue(consolePane.getVmax()); }); })) { nextSymbol = NOT_INSIDE_BLOCK; } else { nextSymbol = INSIDE_BLOCK; } } }); command.setOnKeyReleased(event -> { if (event.getCode() == KeyCode.UP) { CommandHistory.Item historyItem = commandHistory.up(); command.setText(historyItem.getCommand()); command.positionCaret(historyItem.getCursorPosition()); } else if (event.getCode() == KeyCode.DOWN) { CommandHistory.Item historyItem = commandHistory.down(); command.setText(historyItem.getCommand()); command.positionCaret(historyItem.getCursorPosition()); } }); this.setOnCloseRequest(event -> commandInterpreter.close()); }
From source file:gov.va.isaac.sync.view.SyncView.java
private void initGui() { root_ = new BorderPane(); root_.setPrefWidth(550);/*from w w w .j av a 2 s.c o m*/ VBox titleBox = new VBox(); Label title = new Label("Datastore Synchronization"); title.getStyleClass().add("titleLabel"); title.setAlignment(Pos.CENTER); title.setMaxWidth(Double.MAX_VALUE); title.setPadding(new Insets(10)); titleBox.getChildren().add(title); titleBox.getStyleClass().add("headerBackground"); url_ = AppContext.getAppConfiguration().getCurrentChangeSetUrl(); String urlType = AppContext.getAppConfiguration().getChangeSetUrlTypeName(); String syncUsername = ExtendedAppContext.getCurrentlyLoggedInUserProfile().getSyncUsername(); if (StringUtils.isBlank(syncUsername)) { syncUsername = ExtendedAppContext.getCurrentlyLoggedInUser(); } url_ = syncService_.substituteURL(url_, syncUsername); Label info = new CopyableLabel("Sync using " + urlType + ": " + url_); info.setTooltip(new Tooltip(url_)); titleBox.getChildren().add(info); titleBox.setPadding(new Insets(5, 5, 5, 5)); root_.setTop(titleBox); VBox centerContent = new VBox(); centerContent.setFillWidth(true); centerContent.setPrefWidth(Double.MAX_VALUE); centerContent.setPadding(new Insets(10)); centerContent.getStyleClass().add("itemBorder"); centerContent.setSpacing(10.0); centerContent.getChildren().add(new Label("Status:")); summary_ = new TextArea(); summary_.setWrapText(true); summary_.setEditable(false); summary_.setMaxWidth(Double.MAX_VALUE); summary_.setMaxHeight(Double.MAX_VALUE); summary_.setPrefHeight(150.0); centerContent.getChildren().add(summary_); VBox.setVgrow(summary_, Priority.ALWAYS); pb_ = new ProgressBar(0.0); pb_.setPrefHeight(20); pb_.setMaxWidth(Double.MAX_VALUE); centerContent.getChildren().add(pb_); root_.setCenter(centerContent); //Bottom buttons HBox buttons = new HBox(); buttons.setMaxWidth(Double.MAX_VALUE); buttons.setAlignment(Pos.CENTER); buttons.setPadding(new Insets(5)); buttons.setSpacing(30); Button cancel = new Button("Close"); cancel.setOnAction((action) -> { if (running_.get()) { addLine("Cancelling..."); cancel.setDisable(true); cancelRequested_ = true; } else { cancel.getScene().getWindow().hide(); root_ = null; } }); buttons.getChildren().add(cancel); Button action = new Button("Synchronize"); action.disableProperty().bind(running_); action.setOnAction((theAction) -> { summary_.setText(""); pb_.setProgress(-1.0); running_.set(true); Utility.execute(() -> sync()); }); buttons.getChildren().add(action); cancel.minWidthProperty().bind(action.widthProperty()); running_.addListener(change -> { if (running_.get()) { cancel.setText("Cancel"); } else { cancel.setText("Close"); } cancel.setDisable(false); }); root_.setBottom(buttons); }
From source file:org.pdfsam.ui.module.Footer.java
public Footer(RunButton runButton, OpenButton openButton, String ownerModule) { this.ownerModule = defaultString(ownerModule); this.openButton = openButton; this.runButton = runButton; this.getStyleClass().addAll("pdfsam-container", "footer-pane"); this.statusLabel.getStyleClass().add("status-label"); this.statusLabel.setVisible(false); this.bar.setMaxWidth(Double.MAX_VALUE); this.bar.getStyleClass().add("pdfsam-footer-bar"); this.statusLabel.setMaxHeight(Double.MAX_VALUE); VBox progressPane = new VBox(statusLabel, bar); progressPane.getStyleClass().add("progress-pane"); VBox.setVgrow(statusLabel, Priority.ALWAYS); HBox.setHgrow(bar, Priority.ALWAYS); HBox.setHgrow(progressPane, Priority.ALWAYS); this.failed.setVisible(false); StackPane buttons = new StackPane(failed, openButton); buttons.setAlignment(Pos.CENTER_LEFT); this.getChildren().addAll(runButton, buttons, progressPane); eventStudio().add(TaskExecutionRequestEvent.class, e -> { if (e.getModuleId().equals(ownerModule)) { failed.setVisible(false);/* ww w . j av a 2 s .co m*/ openButton.setVisible(false); statusLabel.setVisible(true); statusLabel.setText(DefaultI18nContext.getInstance().i18n("Requested")); bar.setProgress(0); } }); eventStudio().addAnnotatedListeners(this); }