javafx.scene.layout.ColumnConstraints Java Examples

The following examples show how to use javafx.scene.layout.ColumnConstraints. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ActivityItemCell.java    From PeerWasp with MIT License 7 votes vote down vote up
private void initializeGrid() {
	grid.setHgap(10);
	grid.setVgap(5);
	grid.setPadding(new Insets(0, 10, 0, 10));

	// icon column
	ColumnConstraints col1 = new ColumnConstraints();
	col1.setFillWidth(false);
	col1.setHgrow(Priority.NEVER);
	grid.getColumnConstraints().add(col1);

	// title column: grows
	ColumnConstraints col2 = new ColumnConstraints();
	col2.setFillWidth(true);
	col2.setHgrow(Priority.ALWAYS);
	grid.getColumnConstraints().add(col2);

	// date column
	ColumnConstraints col3 = new ColumnConstraints();
	col3.setFillWidth(false);
	col3.setHgrow(Priority.NEVER);
	grid.getColumnConstraints().add(col3);
}
 
Example #2
Source File: PluginParametersPane.java    From constellation with Apache License 2.0 6 votes vote down vote up
private void addElements(final PluginParametersNode node, final Region... elements) {
    final HBox singleParam = new HBox();
    singleParam.setSpacing(10);
    for (Region element : elements) {
        if (element != null) {
            singleParam.getChildren().addAll(element);
        }
    }
    ColumnConstraints paramConstraints = new ColumnConstraints();
    if (!SHOULD_NOT_EXPAND.contains(node.getParameter().getType().getId())) {
        singleParam.setMinWidth(USE_PREF_SIZE);
    }
    paramConstraints.minWidthProperty().bind(singleParam.minWidthProperty());
    paramGroupGridPane.getColumnConstraints().add(paramConstraints);
    paramGroupGridPane.add(singleParam, currentCol++, 0);
}
 
Example #3
Source File: ProposalDisplay.java    From bisq with GNU Affero General Public License v3.0 6 votes vote down vote up
@SuppressWarnings("Duplicates")
public ScrollPane getView() {
    ScrollPane scrollPane = new ScrollPane();
    scrollPane.setFitToWidth(true);
    scrollPane.setFitToHeight(true);

    AnchorPane anchorPane = new AnchorPane();
    scrollPane.setContent(anchorPane);

    gridPane.setHgap(5);
    gridPane.setVgap(5);

    ColumnConstraints columnConstraints1 = new ColumnConstraints();
    columnConstraints1.setPercentWidth(100);

    gridPane.getColumnConstraints().addAll(columnConstraints1);

    AnchorPane.setBottomAnchor(gridPane, 10d);
    AnchorPane.setRightAnchor(gridPane, 10d);
    AnchorPane.setLeftAnchor(gridPane, 10d);
    AnchorPane.setTopAnchor(gridPane, 10d);
    anchorPane.getChildren().add(gridPane);

    return scrollPane;
}
 
Example #4
Source File: JFXHelper.java    From Schillsaver with MIT License 6 votes vote down vote up
/**
 * Creates a GridPane with only one row, but where there are as many equal sized columns as there are
 * controls passed to the function.
 *
 * Ex:
 *      If you pass in two controls, then there will be one row with two columns where each column uses
 *      50% of the width.
 *
 * Ex:
 *      If you pass in four controls, then there will be one row with four columns where each column uses
 *      25% of the width.
 *
 * @param controls
 *          The controls.
 *
 * @return
 *          The pane.
 */
public static GridPane createHorizontalGridPane(final Control... controls) {
    if (controls.length == 0) {
        return new GridPane();
    }

    final GridPane pane = new GridPane();
    final double sectionWidth = 100.0 / controls.length;

    for (final Control ignored : controls) {
        final ColumnConstraints constraints = new ColumnConstraints();
        constraints.setPercentWidth(sectionWidth);

        pane.getColumnConstraints().add(constraints);
    }

    for (int i = 0 ; i < controls.length ; i++) {
        pane.add(controls[i], i, 0);
    }

    return pane;
}
 
Example #5
Source File: GridPaneDetailPaneInfo.java    From scenic-view with GNU General Public License v3.0 6 votes vote down vote up
private void updateColumnConstraints() {
    final GridPane gridpane = (GridPane) getTarget();

    final ObservableList<ColumnConstraints> columns = gridpane != null ? gridpane.getColumnConstraints() : null;
    columnConstraintsDetail.setConstraints(columns);

    if (columns != null) {
        for (int rowIndex = 1; rowIndex <= columns.size(); rowIndex++) {
            final ColumnConstraints cc = columns.get(rowIndex - 1);
            int colIndex = 0;
            columnConstraintsDetail.add(Integer.toString(rowIndex - 1), colIndex++, rowIndex);
            columnConstraintsDetail.addSize(cc.getMinWidth(), rowIndex, colIndex++);
            columnConstraintsDetail.addSize(cc.getPrefWidth(), rowIndex, colIndex++);
            columnConstraintsDetail.addSize(cc.getMaxWidth(), rowIndex, colIndex++);
            columnConstraintsDetail.add(cc.getPercentWidth() != -1 ? f.format(cc.getPercentWidth()) : "-", colIndex++, rowIndex);
            columnConstraintsDetail.addObject(cc.getHgrow(), rowIndex, colIndex++);
            columnConstraintsDetail.addObject(cc.getHalignment(), rowIndex, colIndex++);
            columnConstraintsDetail.add(Boolean.toString(cc.isFillWidth()), colIndex, rowIndex);
        }
    }
}
 
Example #6
Source File: ChartsController.java    From trex-stateless-gui with Apache License 2.0 6 votes vote down vote up
public LayoutConfiguration(int columnsCount, int rowsCount) {
    this.columnsCount = columnsCount;
    this.rowsCount = rowsCount;

    columnConstraints = new ColumnConstraints[this.columnsCount];
    double columnPercentWidth = 100.0/this.columnsCount;
    for (int i = 0; i < this.columnsCount; ++i) {
        columnConstraints[i] = new ColumnConstraints();
        columnConstraints[i].setPercentWidth(columnPercentWidth);
    }

    rowConstraints = new RowConstraints[this.rowsCount];
    double rowPercentHeight = 100.0/this.rowsCount;
    for (int i = 0; i < this.rowsCount; ++i) {
        rowConstraints[i] = new RowConstraints();
        rowConstraints[i].setPercentHeight(rowPercentHeight);
    }
}
 
Example #7
Source File: EasyGridPane.java    From constellation with Apache License 2.0 6 votes vote down vote up
public void addColumnConstraint(boolean fillWidth, HPos alignment, Priority grow, double maxWidth, double minWidth, double prefWidth, double percentWidth) {
    ColumnConstraints constraint = new ColumnConstraints();
    constraint.setFillWidth(fillWidth);
    constraint.setHalignment(alignment);
    constraint.setHgrow(grow);
    constraint.setMaxWidth(maxWidth);
    constraint.setMinWidth(minWidth);
    constraint.setPrefWidth(prefWidth);

    if (percentWidth >= 0) {
        constraint.setPercentWidth(percentWidth);
    }

    getColumnConstraints().add(constraint);
}
 
Example #8
Source File: ShortcutInformationPanelSkin.java    From phoenicis with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 * Creates a new {@link GridPane} containing the properties of the selected shortcut
 *
 * @return a new {@link GridPane} containing the properties of the selected shortcut
 */
private GridPane createPropertiesGrid() {
    final GridPane propertiesGrid = new GridPane();
    propertiesGrid.getStyleClass().add("grid");

    ColumnConstraints titleColumn = new ColumnConstraintsWithPercentage(30);
    ColumnConstraints valueColumn = new ColumnConstraintsWithPercentage(70);

    propertiesGrid.getColumnConstraints().addAll(titleColumn, valueColumn);

    // ensure that changes to the shortcutProperties map result in updates to the GridPane
    shortcutProperties.addListener((Observable invalidation) -> updateProperties(propertiesGrid));
    // initialize the properties grid correctly
    updateProperties(propertiesGrid);

    return propertiesGrid;
}
 
Example #9
Source File: DisplayImageController.java    From Augendiagnose with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Show or hide the overlay pane.
 *
 * @param visible
 *            Indicator if the pane should be visible.
 */
public final void showOverlayPane(final boolean visible) {
	mDisplayImageView.storePosition();
	mOverlayPane.setVisible(visible);
	mOverlayPane.setManaged(visible);
	if (mOverlayConstraints instanceof ColumnConstraints) {
		((ColumnConstraints) mOverlayConstraints).setMinWidth(visible ? 75 : 0); // MAGIC_NUMBER
	}
	mDisplayImage.layout();
	mDisplayImageView.retrievePosition();
}
 
Example #10
Source File: DisplayImageController.java    From Augendiagnose with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Show or hide the comment pane.
 *
 * @param visible
 *            Indicator if the pane should be visible.
 */
public final void showCommentPane(final boolean visible) {
	mDisplayImageView.storePosition();
	mCommentPane.setVisible(visible);
	mCommentPane.setManaged(visible);
	if (mCommentConstraints instanceof ColumnConstraints) {
		((ColumnConstraints) mCommentConstraints).setPercentWidth(visible ? 20 : 0); // MAGIC_NUMBER
	}
	if (mCommentConstraints instanceof RowConstraints) {
		((RowConstraints) mCommentConstraints).setPercentHeight(visible ? 20 : 0); // MAGIC_NUMBER
	}
	mDisplayImage.layout();
	mDisplayImageView.retrievePosition();
}
 
Example #11
Source File: RuleContainer.java    From G-Earth with MIT License 5 votes vote down vote up
private void initialize() {

        RowConstraints rowConstraints = new RowConstraints(23);
        getRowConstraints().addAll(rowConstraints);

        for (int i = 0; i < columnWidths.length; i++) {
            ColumnConstraints columnConstraints = new ColumnConstraints(20);
            columnConstraints.setPercentWidth(columnWidths[i]);
            getColumnConstraints().add(columnConstraints);
        }

        Label optionLabel = initNewLabelColumn(item.option().name());
        Label typeLabel = initNewLabelColumn(item.type().name());
        Label valueLabel = initNewLabelColumn(item.value());
        Label replacementLabel = initNewLabelColumn(item.replacement());
        Label destinationLabel = initNewLabelColumn(item.side().name());

        add(optionLabel, 0, 0);
        add(typeLabel, 1, 0);
        add(valueLabel, 2, 0);
        add(replacementLabel, 3,  0);
        add(destinationLabel, 4, 0);

        DeleteButton deleteButton = new DeleteButton();
        deleteButton.setAlignment(Pos.CENTER);
        deleteButton.show();

        RuleContainer thiss = this;
        item.onDelete(observable -> parent.getChildren().remove(thiss));
        deleteButton.addEventHandler(MouseEvent.MOUSE_CLICKED, event -> item.delete());

        add(deleteButton, 5, 0);


        parent.getChildren().add(this);
    }
 
Example #12
Source File: AttributeEditorPanel.java    From constellation with Apache License 2.0 5 votes vote down vote up
@Override
public void updateItem(Object item, boolean empty) {
    super.updateItem(item, empty);

    AbstractAttributeInteraction<?> interaction = AbstractAttributeInteraction.getInteraction(attrDataType);
    final String displayText;
    final List<Node> displayNodes;
    if (item == null) {
        displayText = NO_VALUE_TEXT;
        displayNodes = Collections.emptyList();
    } else {
        displayText = interaction.getDisplayText(item);
        displayNodes = interaction.getDisplayNodes(item, -1, CELL_HEIGHT - 1);
    }

    GridPane gridPane = new GridPane();
    gridPane.setHgap(CELL_ITEM_SPACING);
    ColumnConstraints displayNodeConstraint = new ColumnConstraints(CELL_HEIGHT - 1);
    displayNodeConstraint.setHalignment(HPos.CENTER);

    for (int i = 0; i < displayNodes.size(); i++) {
        final Node displayNode = displayNodes.get(i);
        gridPane.add(displayNode, i, 0);
        gridPane.getColumnConstraints().add(displayNodeConstraint);
    }

    setGraphic(gridPane);
    setPrefHeight(CELL_HEIGHT);
    setText(displayText);
}
 
Example #13
Source File: BaseInfoTab.java    From pdfsam with GNU Affero General Public License v3.0 5 votes vote down vote up
BaseInfoTab() {
    setClosable(false);
    grid.getStyleClass().add("info-props");
    grid.setAlignment(Pos.TOP_CENTER);
    ColumnConstraints column1 = new ColumnConstraints();
    column1.setPercentWidth(25);
    ColumnConstraints column2 = new ColumnConstraints();
    column2.setPercentWidth(75);
    grid.getColumnConstraints().addAll(column1, column2);
    ScrollPane scroll = new ScrollPane(grid);
    scroll.setFitToHeight(true);
    scroll.setFitToWidth(true);
    setContent(scroll);
}
 
Example #14
Source File: TakeOfferView.java    From bisq with GNU Affero General Public License v3.0 5 votes vote down vote up
private void addGridPane() {
    gridPane = new GridPane();
    gridPane.getStyleClass().add("content-pane");
    gridPane.setPadding(new Insets(15, 15, -1, 15));
    gridPane.setHgap(5);
    gridPane.setVgap(5);
    ColumnConstraints columnConstraints1 = new ColumnConstraints();
    columnConstraints1.setHalignment(HPos.RIGHT);
    columnConstraints1.setHgrow(Priority.NEVER);
    columnConstraints1.setMinWidth(200);
    ColumnConstraints columnConstraints2 = new ColumnConstraints();
    columnConstraints2.setHgrow(Priority.ALWAYS);
    gridPane.getColumnConstraints().addAll(columnConstraints1, columnConstraints2);
    scrollPane.setContent(gridPane);
}
 
Example #15
Source File: ConversationBox.java    From constellation with Apache License 2.0 5 votes vote down vote up
public BubbleBox(final ConversationMessage message) {
    setVgap(3);

    final ColumnConstraints spaceColumn = new ColumnConstraints();
    spaceColumn.setHgrow(Priority.ALWAYS);
    spaceColumn.setMinWidth(50);
    spaceColumn.setPrefWidth(50);

    final ColumnConstraints contentColumn = new ColumnConstraints();
    contentColumn.setHalignment(message.getConversationSide() == ConversationSide.LEFT ? HPos.LEFT : HPos.RIGHT);
    contentColumn.setFillWidth(false);
    contentColumn.setHgrow(Priority.NEVER);

    final RowConstraints contentRow = new RowConstraints();
    contentRow.setFillHeight(true);
    contentRow.setMaxHeight(Double.MAX_VALUE);
    contentRow.setValignment(VPos.TOP);

    getRowConstraints().addAll(contentRow);

    if (message.getConversationSide() == ConversationSide.LEFT) {
        contentColumnIndex = 0;
        getColumnConstraints().addAll(contentColumn, spaceColumn);
    } else {
        contentColumnIndex = 1;
        getColumnConstraints().addAll(spaceColumn, contentColumn);
    }

    update(message);
}
 
Example #16
Source File: MutableOfferView.java    From bisq with GNU Affero General Public License v3.0 5 votes vote down vote up
private void addGridPane() {
    gridPane = new GridPane();
    gridPane.getStyleClass().add("content-pane");
    gridPane.setPadding(new Insets(30, 25, -1, 25));
    gridPane.setHgap(5);
    gridPane.setVgap(5);
    ColumnConstraints columnConstraints1 = new ColumnConstraints();
    columnConstraints1.setHalignment(HPos.RIGHT);
    columnConstraints1.setHgrow(Priority.NEVER);
    columnConstraints1.setMinWidth(200);
    ColumnConstraints columnConstraints2 = new ColumnConstraints();
    columnConstraints2.setHgrow(Priority.ALWAYS);
    gridPane.getColumnConstraints().addAll(columnConstraints1, columnConstraints2);
    scrollPane.setContent(gridPane);
}
 
Example #17
Source File: BaseGraphApp.java    From diirt with MIT License 5 votes vote down vote up
public DataSelectionPanel() {
    this.setPadding( new Insets( 5 , 5 , 5 , 5 ) );

    GridPane pnlCenter = new GridPane();
    pnlCenter.setHgap( 5 );
    this.cboSelectData.setPrefWidth( 0 );
    pnlCenter.addRow( 0 , this.lblData , this.cboSelectData , this.cmdConfigure );

    ColumnConstraints allowResize = new ColumnConstraints();
    allowResize.setHgrow( Priority.ALWAYS );
    ColumnConstraints noResize = new ColumnConstraints();
    pnlCenter.getColumnConstraints().addAll( noResize , allowResize , noResize );

    this.setCenter( pnlCenter );

    //allow the combo box to stretch out and fill panel completely
    this.cboSelectData.setMaxSize( Double.MAX_VALUE , Double.MAX_VALUE );
    this.cboSelectData.setEditable( true );

    //watches for when the user selects a new data formula
    cboSelectData.valueProperty().addListener( new ChangeListener< String >() {

        @Override
        public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) {
            pnlGraph.setFormula(newValue);
        }

    });

    this.cmdConfigure.setOnAction( new EventHandler< ActionEvent >() {

        @Override
        public void handle(ActionEvent event) {
            openConfigurationPanel();
        }

    });
}
 
Example #18
Source File: SpectralMatchPanelFX.java    From mzmine3 with GNU General Public License v2.0 5 votes vote down vote up
private GridPane createTitlePane() {
  pnTitle = new GridPane();
  pnTitle.setAlignment(Pos.CENTER);

  // create Top panel
  double simScore = hit.getSimilarity().getScore();
  Color gradientCol = FxColorUtil.awtColorToFX(ColorScaleUtil
      .getColor(FxColorUtil.fxColorToAWT(MIN_COS_COLOR), FxColorUtil.fxColorToAWT(MAX_COS_COLOR),
          MIN_COS_COLOR_VALUE, MAX_COS_COLOR_VALUE, simScore));
  pnTitle.setBackground(
      new Background(new BackgroundFill(gradientCol, CornerRadii.EMPTY, Insets.EMPTY)));

  lblHit = new Label(hit.getName());
  lblHit.getStyleClass().add("white-larger-label");

  lblScore = new Label(COS_FORM.format(simScore));
  lblScore.getStyleClass().add("white-score-label");
  lblScore
      .setTooltip(new Tooltip("Cosine similarity of raw data scan (top, blue) and database scan: "
          + COS_FORM.format(simScore)));

  pnTitle.add(lblHit, 0, 0);
  pnTitle.add(lblScore, 1, 0);
  ColumnConstraints ccTitle0 = new ColumnConstraints(150, -1, -1, Priority.ALWAYS, HPos.LEFT,
      true);
  ColumnConstraints ccTitle1 = new ColumnConstraints(150, 150, 150, Priority.NEVER, HPos.LEFT,
      false);
  pnTitle.getColumnConstraints().add(0, ccTitle0);
  pnTitle.getColumnConstraints().add(1, ccTitle1);

  return pnTitle;
}
 
Example #19
Source File: FormPane.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
public FormPane(String styleClass, int columns) {
    this.columns = columns;
    getStyleClass().addAll("form-pane", styleClass);
    ColumnConstraints cc = new ColumnConstraints();
    cc.setMinWidth(Region.USE_PREF_SIZE);
    getColumnConstraints().add(cc);
    getStyleClass().add(StyleClassHelper.BACKGROUND);
}
 
Example #20
Source File: WebViewBrowser.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public WebViewPane() {
    VBox.setVgrow(this, Priority.ALWAYS);
    setMaxWidth(Double.MAX_VALUE);
    setMaxHeight(Double.MAX_VALUE);

    WebView view = new WebView();
    view.setMinSize(500, 400);
    view.setPrefSize(500, 400);
    final WebEngine eng = view.getEngine();
    eng.load("http://www.oracle.com/us/index.html");
    final TextField locationField = new TextField("http://www.oracle.com/us/index.html");
    locationField.setMaxHeight(Double.MAX_VALUE);
    Button goButton = new Button("Go");
    goButton.setDefaultButton(true);
    EventHandler<ActionEvent> goAction = new EventHandler<ActionEvent>() {
        @Override public void handle(ActionEvent event) {
            eng.load(locationField.getText().startsWith("http://") ? locationField.getText() :
                    "http://" + locationField.getText());
        }
    };
    goButton.setOnAction(goAction);
    locationField.setOnAction(goAction);
    eng.locationProperty().addListener(new ChangeListener<String>() {
        @Override public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) {
            locationField.setText(newValue);
        }
    });
    GridPane grid = new GridPane();
    grid.setVgap(5);
    grid.setHgap(5);
    GridPane.setConstraints(locationField, 0, 0, 1, 1, HPos.CENTER, VPos.CENTER, Priority.ALWAYS, Priority.SOMETIMES);
    GridPane.setConstraints(goButton,1,0);
    GridPane.setConstraints(view, 0, 1, 2, 1, HPos.CENTER, VPos.CENTER, Priority.ALWAYS, Priority.ALWAYS);
    grid.getColumnConstraints().addAll(
            new ColumnConstraints(100, 100, Double.MAX_VALUE, Priority.ALWAYS, HPos.CENTER, true),
            new ColumnConstraints(40, 40, 40, Priority.NEVER, HPos.CENTER, true)
    );
    grid.getChildren().addAll(locationField, goButton, view);
    getChildren().add(grid);
}
 
Example #21
Source File: ProofOfBurnSignatureWindow.java    From bisq with GNU Affero General Public License v3.0 5 votes vote down vote up
@SuppressWarnings("Duplicates")
@Override
protected void createGridPane() {
    gridPane = new GridPane();
    gridPane.setHgap(5);
    gridPane.setVgap(5);
    gridPane.setPadding(new Insets(64, 64, 64, 64));
    gridPane.setPrefWidth(width);

    ColumnConstraints columnConstraints = new ColumnConstraints();
    columnConstraints.setPercentWidth(100);
    gridPane.getColumnConstraints().add(columnConstraints);
}
 
Example #22
Source File: ProofOfBurnVerificationWindow.java    From bisq with GNU Affero General Public License v3.0 5 votes vote down vote up
@SuppressWarnings("Duplicates")
@Override
protected void createGridPane() {
    gridPane = new GridPane();
    gridPane.setHgap(5);
    gridPane.setVgap(5);
    gridPane.setPadding(new Insets(64, 64, 64, 64));
    gridPane.setPrefWidth(width);

    ColumnConstraints columnConstraints = new ColumnConstraints();
    columnConstraints.setPercentWidth(100);
    gridPane.getColumnConstraints().add(columnConstraints);
}
 
Example #23
Source File: Util.java    From pattypan with MIT License 5 votes vote down vote up
public static ColumnConstraints newColumn(int value, String unit, HPos position) {
  ColumnConstraints col = new ColumnConstraints();
  if (unit.equals("%")) {
    col.setPercentWidth(value);
  }
  if (unit.equals("px")) {
    col.setMaxWidth(value);
    col.setMinWidth(value);
  }

  if (position != null) {
    col.setHalignment(position);
  }
  return col;
}
 
Example #24
Source File: MdConvertController.java    From zest-writer with GNU General Public License v3.0 5 votes vote down vote up
public void initStats() {
    String fontSize="-fx-font-size: 0.9em;";
    getMdBox().getMainApp().getMenuController().getHBottomBox().getChildren().clear();
    getMdBox().getMainApp().getMenuController().getHBottomBox().getColumnConstraints().clear();
    getMdBox().getMainApp().getMenuController().getHBottomBox().setPadding(new Insets(5, 5, 5, 5));
    ColumnConstraints c1 = new ColumnConstraints();
    ColumnConstraints c2 = new ColumnConstraints();
    ColumnConstraints c3 = new ColumnConstraints();
    ColumnConstraints c4 = new ColumnConstraints();
    c1.setPercentWidth(50);
    c2.setPercentWidth(20);
    c3.setPercentWidth(15);
    c4.setPercentWidth(15);
    Label chars = new Label();
    Label words = new Label();
    Label times = new Label();
    chars.setStyle(fontSize);
    words.setStyle(fontSize);
    times.setStyle(fontSize);
    getMdBox().getMainApp().getMenuController().getHBottomBox().getColumnConstraints().addAll(c1, c2, c3, c4);
    getMdBox().getMainApp().getMenuController().getHBottomBox().add(times, 1, 0);
    getMdBox().getMainApp().getMenuController().getHBottomBox().add(chars, 2, 0);
    getMdBox().getMainApp().getMenuController().getHBottomBox().add(words, 3, 0);

    chars.textProperty().bind(countChars);
    words.textProperty().bind(countWords);
    times.textProperty().bind(countTimes);
    performStats();
}
 
Example #25
Source File: TrainingExerciseBase.java    From ShootOFF with GNU General Public License v3.0 5 votes vote down vote up
public DelayPane(DelayedStartListener listener) {
	getColumnConstraints().add(new ColumnConstraints(100));
	setVgap(5);

	final Label instructionsLabel = new Label("Set interval within which a beep will sound\n"
			+ "to signal the start of a round.\nDefault: A round starts after a random wait\n"
			+ "between 4 and 8 seconds in length.\n");
	instructionsLabel.setPrefSize(300, 77);

	this.add(instructionsLabel, 0, 0, 2, 3);
	addRow(3, new Label("Min (s)"));
	addRow(4, new Label("Max (s)"));

	final TextField minTextField = new TextField("4");
	this.add(minTextField, 1, 3);

	final TextField maxTextField = new TextField("8");
	this.add(maxTextField, 1, 4);

	minTextField.textProperty().addListener((observable, oldValue, newValue) -> {
		if (!newValue.matches("\\d*")) {
			minTextField.setText(oldValue);
			minTextField.positionCaret(minTextField.getLength());
		} else {
			listener.updatedDelayedStartInterval(Integer.parseInt(minTextField.getText()),
					Integer.parseInt(maxTextField.getText()));
		}
	});

	maxTextField.textProperty().addListener((observable, oldValue, newValue) -> {
		if (!newValue.matches("\\d*")) {
			maxTextField.setText(oldValue);
			maxTextField.positionCaret(maxTextField.getLength());
		} else {
			listener.updatedDelayedStartInterval(Integer.parseInt(minTextField.getText()),
					Integer.parseInt(maxTextField.getText()));
		}
	});
}
 
Example #26
Source File: GUIController.java    From density-converter with Apache License 2.0 5 votes vote down vote up
private void setupLayout() {
    ColumnConstraints column1M = new ColumnConstraints();
    column1M.setPercentWidth(20);
    ColumnConstraints column2M = new ColumnConstraints();
    column2M.setPercentWidth(56);
    ColumnConstraints column3M = new ColumnConstraints();
    column3M.setPercentWidth(12);
    ColumnConstraints column4M = new ColumnConstraints();
    column4M.setPercentWidth(12);
    rootGridPane.getColumnConstraints().addAll(column1M, column2M, column3M, column4M);

    ColumnConstraints column1 = new ColumnConstraints();
    column1.setPercentWidth(20);
    ColumnConstraints column2 = new ColumnConstraints();
    column2.setPercentWidth(30);
    ColumnConstraints column3 = new ColumnConstraints();
    column3.setPercentWidth(20);
    ColumnConstraints column4 = new ColumnConstraints();
    column4.setPercentWidth(30);
    gridPaneChoiceBoxes.getColumnConstraints().addAll(column1, column2, column3, column4);

    ColumnConstraints column1C = new ColumnConstraints();
    column1C.setPercentWidth(50);
    ColumnConstraints column2C = new ColumnConstraints();
    column2C.setPercentWidth(50);
    gridPaneOptionsCheckboxes.getColumnConstraints().addAll(column1C, column2C);
    gridPanePostProcessors.getColumnConstraints().addAll(column1C, column2C);

    ColumnConstraints column1D = new ColumnConstraints();
    column1D.setPercentWidth(25);
    ColumnConstraints column2D = new ColumnConstraints();
    column2D.setPercentWidth(25);
    ColumnConstraints column3D = new ColumnConstraints();
    column3D.setPercentWidth(25);
    ColumnConstraints column4D = new ColumnConstraints();
    column4D.setPercentWidth(25);
    gridPaneToggleGroup.getColumnConstraints().addAll(column1D, column2D, column3D, column4D);
}
 
Example #27
Source File: ShortcutInformationPanelSkin.java    From phoenicis with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * Creates a new {@link GridPane} containing the control buttons for the selected shortcut.
 * These control buttons consist of:
 * <ul>
 * <li>The run button</li>
 * <li>The stop button</li>
 * <li>The uninstall button</li>
 * </ul>
 *
 * @return A new {@link GridPane} containing the control buttons for the selected shortcut
 */
private GridPane createControlButtons() {
    final GridPane controlButtons = new GridPane();
    controlButtons.getStyleClass().add("shortcut-control-button-group");

    ColumnConstraints runColumn = new ColumnConstraintsWithPercentage(25);
    ColumnConstraints stopColumn = new ColumnConstraintsWithPercentage(25);
    ColumnConstraints uninstallColumn = new ColumnConstraintsWithPercentage(25);
    ColumnConstraints editColumn = new ColumnConstraintsWithPercentage(25);

    controlButtons.getColumnConstraints().addAll(runColumn, stopColumn, uninstallColumn, editColumn);

    final Button runButton = new Button(tr("Run"));
    runButton.getStyleClass().addAll("shortcutButton", "runButton");
    runButton.setOnMouseClicked(event -> Optional.ofNullable(getControl().getOnShortcutRun())
            .ifPresent(onShortcutRun -> onShortcutRun.accept(getControl().getShortcut())));
    GridPane.setHalignment(runButton, HPos.CENTER);

    final Button stopButton = new Button(tr("Close"));
    stopButton.getStyleClass().addAll("shortcutButton", "stopButton");
    stopButton.setOnMouseClicked(event -> Optional.ofNullable(getControl().getOnShortcutStop())
            .ifPresent(onShortcutStop -> onShortcutStop.accept(getControl().getShortcut())));
    GridPane.setHalignment(stopButton, HPos.CENTER);

    final Button uninstallButton = new Button(tr("Uninstall"));
    uninstallButton.getStyleClass().addAll("shortcutButton", "uninstallButton");
    uninstallButton.setOnMouseClicked(event -> Optional.ofNullable(getControl().getOnShortcutUninstall())
            .ifPresent(onShortcutUninstall -> onShortcutUninstall.accept(getControl().getShortcut())));
    GridPane.setHalignment(uninstallButton, HPos.CENTER);

    final Button editButton = new Button(tr("Edit"));
    editButton.getStyleClass().addAll("shortcutButton", "editButton");
    editButton.setOnMouseClicked(event -> Optional.ofNullable(getControl().getOnShortcutEdit())
            .ifPresent(onShortcutEdit -> onShortcutEdit.accept(getControl().getShortcut())));
    GridPane.setHalignment(editButton, HPos.CENTER);

    controlButtons.addRow(0, runButton, stopButton, uninstallButton, editButton);

    return controlButtons;
}
 
Example #28
Source File: DetailsListElementSkin.java    From phoenicis with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public void initialise() {
    final GridPane container = new GridPane();
    container.getStyleClass().add("detailsListElement");

    final List<ColumnConstraints> constraints = new ArrayList<>();

    // add the title label
    container.add(createTitle(), 0, 0);

    constraints.add(new ColumnConstraintsWithPercentage(30));

    // TODO: the skin should react to changes done to the additional information list
    // TODO: the skin should react to changes done to the detailed information list
    Stream.concat(getControl().getAdditionalInformation().stream(), getControl().getDetailedInformation().stream())
            .forEach(information -> {
                final Label informationLabel = new Label(information.getContent());
                informationLabel.setWrapText(true);
                informationLabel.getStyleClass().add("information");

                container.add(informationLabel, constraints.size(), 0);

                constraints.add(new ColumnConstraintsWithPercentage(information.getWidth()));
            });

    // set the last constraint to fill the remaining space
    constraints.set(constraints.size() - 1, new ColumnConstraints());

    container.getColumnConstraints().setAll(constraints);

    getChildren().addAll(container);
}
 
Example #29
Source File: CodePane.java    From JRemapper with MIT License 5 votes vote down vote up
/**
 * Setup everything else that isn't the code-area.
 */
private void setupTheRest() {
	info.setPrefHeight(95);
	info.getStyleClass().add("infopane");
	ColumnConstraints colInfo = new ColumnConstraints();
	ColumnConstraints colEdit = new ColumnConstraints();
	colInfo.setPercentWidth(15);
	colEdit.setPercentWidth(85);
	info.getColumnConstraints().addAll(colInfo, colEdit);
	setTop(info);
	pane.animationDurationProperty().setValue(Duration.millis(50));
	pane.setContent(new VirtualizedScrollPane<>(code));
	setCenter(pane);
}
 
Example #30
Source File: CompactListElementSkin.java    From phoenicis with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public void initialise() {
    final GridPane container = new GridPane();
    container.getStyleClass().add("compactListElement");

    List<ColumnConstraints> constraints = new ArrayList<>();

    // add the miniature icon
    container.add(createMiniature(), 0, 0);

    constraints.add(new ColumnConstraints());

    // add the title label
    container.add(createTitle(), 1, 0);

    constraints.add(new ColumnConstraintsWithPercentage(40));

    // add the additional information
    getControl().getAdditionalInformation().forEach(information -> {
        final Label informationLabel = new Label(information.getContent());
        informationLabel.getStyleClass().add("information");

        container.add(informationLabel, constraints.size(), 0);

        constraints.add(new ColumnConstraintsWithPercentage(information.getWidth()));
    });

    // set the last constraint to fill the remaining space
    constraints.set(constraints.size() - 1, new ColumnConstraints());

    container.getColumnConstraints().setAll(constraints);

    getChildren().addAll(container);
}