use of org.phoenicis.javafx.views.common.ColumnConstraintsWithPercentage in project POL-POM-5 by PlayOnLinux.
the class ShortcutInformationPanelSkin method createControlButtons.
/**
* 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");
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);
if (getControl().getJavaFxSettingsManager().isAdvancedMode()) {
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);
ColumnConstraints runColumn = new ColumnConstraintsWithPercentage(100 / 4);
ColumnConstraints stopColumn = new ColumnConstraintsWithPercentage(100 / 4);
ColumnConstraints uninstallColumn = new ColumnConstraintsWithPercentage(100 / 4);
ColumnConstraints editColumn = new ColumnConstraintsWithPercentage(100 / 4);
controlButtons.getColumnConstraints().addAll(runColumn, stopColumn, uninstallColumn, editColumn);
controlButtons.addRow(0, runButton, stopButton, uninstallButton, editButton);
} else {
ColumnConstraints runColumn = new ColumnConstraintsWithPercentage(100 / 3);
ColumnConstraints stopColumn = new ColumnConstraintsWithPercentage(100 / 3);
ColumnConstraints uninstallColumn = new ColumnConstraintsWithPercentage(100 / 3);
controlButtons.getColumnConstraints().addAll(runColumn, stopColumn, uninstallColumn);
controlButtons.addRow(0, runButton, stopButton, uninstallButton);
}
return controlButtons;
}
use of org.phoenicis.javafx.views.common.ColumnConstraintsWithPercentage in project POL-POM-5 by PhoenicisOrg.
the class DetailsListElementSkin method initialise.
/**
* {@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);
}
use of org.phoenicis.javafx.views.common.ColumnConstraintsWithPercentage in project POL-POM-5 by PhoenicisOrg.
the class ShortcutInformationPanelSkin method createControlButtons.
/**
* 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");
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);
if (getControl().getJavaFxSettingsManager().isAdvancedMode()) {
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);
ColumnConstraints runColumn = new ColumnConstraintsWithPercentage(100 / 4);
ColumnConstraints stopColumn = new ColumnConstraintsWithPercentage(100 / 4);
ColumnConstraints uninstallColumn = new ColumnConstraintsWithPercentage(100 / 4);
ColumnConstraints editColumn = new ColumnConstraintsWithPercentage(100 / 4);
controlButtons.getColumnConstraints().addAll(runColumn, stopColumn, uninstallColumn, editColumn);
controlButtons.addRow(0, runButton, stopButton, uninstallButton, editButton);
} else {
ColumnConstraints runColumn = new ColumnConstraintsWithPercentage(100 / 3);
ColumnConstraints stopColumn = new ColumnConstraintsWithPercentage(100 / 3);
ColumnConstraints uninstallColumn = new ColumnConstraintsWithPercentage(100 / 3);
controlButtons.getColumnConstraints().addAll(runColumn, stopColumn, uninstallColumn);
controlButtons.addRow(0, runButton, stopButton, uninstallButton);
}
return controlButtons;
}
Aggregations