use of org.phoenicis.javafx.views.common.ColumnConstraintsWithPercentage in project POL-POM-5 by PlayOnLinux.
the class CompactListElementSkin method initialise.
/**
* {@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);
}
use of org.phoenicis.javafx.views.common.ColumnConstraintsWithPercentage in project POL-POM-5 by PlayOnLinux.
the class ShortcutInformationPanelSkin method createPropertiesGrid.
/**
* 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;
}
use of org.phoenicis.javafx.views.common.ColumnConstraintsWithPercentage in project POL-POM-5 by PhoenicisOrg.
the class ShortcutCreationPanelSkin method initialise.
/**
* {@inheritDoc}
*/
@Override
public void initialise() {
final GridPane gridPane = new GridPane();
gridPane.getStyleClass().add("shortcut-information-grid");
ColumnConstraints labelConstraints = new ColumnConstraintsWithPercentage(30);
ColumnConstraints valueConstraints = new ColumnConstraintsWithPercentage(70);
gridPane.getColumnConstraints().addAll(labelConstraints, valueConstraints);
// add name input
final TextField name = addName(gridPane);
final Tooltip nameErrorTooltip = new Tooltip(tr("Please specify a name!"));
// add category input
final TextField category = addCategory(gridPane);
final Tooltip categoryErrorTooltip = new Tooltip(tr("Please specify a category!"));
// add description input
final TextArea description = addDescription(gridPane);
// add miniature input
final TextField miniature = addMiniature(gridPane);
final Tooltip miniatureErrorTooltip = new Tooltip(tr("Please specify a valid miniature!"));
// add executable input
final TextField executable = addExecutable(gridPane);
final Tooltip executableErrorTooltip = new Tooltip(tr("Please specify a valid executable!"));
// add create button
final Button createButton = new Button(tr("Create"));
createButton.setOnMouseClicked(event -> {
boolean error = false;
if (StringUtils.isEmpty(name.getText())) {
name.pseudoClassStateChanged(errorClass, true);
name.setTooltip(nameErrorTooltip);
error = true;
}
if (StringUtils.isEmpty(category.getText())) {
category.pseudoClassStateChanged(errorClass, true);
category.setTooltip(categoryErrorTooltip);
error = true;
}
URI miniatureUri = null;
// but if a miniature is given, it must exist
if (StringUtils.isNotEmpty(miniature.getText())) {
File miniatureFile = new File(miniature.getText());
if (miniatureFile.exists()) {
miniatureUri = miniatureFile.toURI();
} else {
miniature.pseudoClassStateChanged(errorClass, true);
miniature.setTooltip(miniatureErrorTooltip);
error = true;
}
}
File executableFile = new File(executable.getText());
if (!executableFile.exists()) {
executable.pseudoClassStateChanged(errorClass, true);
executable.setTooltip(executableErrorTooltip);
error = true;
}
if (!error) {
final ShortcutCreationDTO newShortcut = new ShortcutCreationDTO.Builder().withName(name.getText()).withCategory(category.getText()).withDescription(description.getText()).withMiniature(miniatureUri).withExecutable(executableFile).build();
getControl().getOnCreateShortcut().accept(newShortcut);
}
});
final VBox container = new VBox(gridPane, createButton);
container.getStyleClass().addAll("library-details-panel-content", "create-shortcut-panel-content");
getChildren().setAll(container);
}
use of org.phoenicis.javafx.views.common.ColumnConstraintsWithPercentage in project POL-POM-5 by PhoenicisOrg.
the class ShortcutInformationPanelSkin method createPropertiesGrid.
/**
* 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;
}
use of org.phoenicis.javafx.views.common.ColumnConstraintsWithPercentage in project POL-POM-5 by PhoenicisOrg.
the class CompactListElementSkin method initialise.
/**
* {@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);
}
Aggregations