Search in sources :

Example 6 with None

use of org.phoenicis.javafx.components.common.panelstates.None in project POL-POM-5 by PhoenicisOrg.

the class InstallationsFeaturePanel method closeDetailsPanel.

/**
 * {@inheritDoc}
 */
@Override
public void closeDetailsPanel() {
    // deselect the currently selected installation
    setSelectedInstallation(null);
    // close the details panel
    setOpenedDetailsPanel(new None());
}
Also used : None(org.phoenicis.javafx.components.common.panelstates.None)

Example 7 with None

use of org.phoenicis.javafx.components.common.panelstates.None in project POL-POM-5 by PhoenicisOrg.

the class InstallationsFeaturePanelSkin method createContent.

/**
 * {@inheritDoc}
 */
@Override
public ObjectExpression<Node> createContent() {
    final FilteredList<InstallationDTO> filteredInstallations = ConcatenatedList.create(new MappedList<>(getControl().getInstallationCategories().sorted(Comparator.comparing(InstallationCategoryDTO::getName)), InstallationCategoryDTO::getInstallations)).filtered(getControl().getFilter()::filter);
    filteredInstallations.predicateProperty().bind(Bindings.createObjectBinding(() -> getControl().getFilter()::filter, getControl().getFilter().searchTermProperty(), getControl().getFilter().selectedInstallationCategoryProperty()));
    final SortedList<InstallationDTO> sortedInstallations = filteredInstallations.sorted(Comparator.comparing(InstallationDTO::getName));
    final ObservableList<ListWidgetElement<InstallationDTO>> listWidgetEntries = new MappedList<>(sortedInstallations, ListWidgetElement::create);
    final CombinedListWidget<InstallationDTO> combinedListWidget = new CombinedListWidget<>(listWidgetEntries, this.selectedListWidget);
    // bind direction: controller property -> skin property
    getControl().selectedInstallationProperty().addListener((observable, oldValue, newValue) -> {
        if (newValue != null) {
            combinedListWidget.select(newValue);
        } else {
            combinedListWidget.deselect();
        }
    });
    // bind direction: skin property -> controller properties
    combinedListWidget.selectedElementProperty().addListener((observable, oldValue, newValue) -> {
        if (newValue != null) {
            final InstallationDTO selectedItem = newValue.getItem();
            getControl().setSelectedInstallation(selectedItem);
            getControl().setOpenedDetailsPanel(new Installation(selectedItem));
        } else {
            getControl().setSelectedInstallation(null);
            getControl().setOpenedDetailsPanel(new None());
        }
    });
    return new SimpleObjectProperty<>(combinedListWidget);
}
Also used : MappedList(org.phoenicis.javafx.collections.MappedList) SimpleObjectProperty(javafx.beans.property.SimpleObjectProperty) CombinedListWidget(org.phoenicis.javafx.components.common.widgets.control.CombinedListWidget) Installation(org.phoenicis.javafx.components.installation.panelstates.Installation) ListWidgetElement(org.phoenicis.javafx.components.common.widgets.utils.ListWidgetElement) InstallationDTO(org.phoenicis.javafx.views.mainwindow.installations.dto.InstallationDTO) InstallationCategoryDTO(org.phoenicis.javafx.views.mainwindow.installations.dto.InstallationCategoryDTO) None(org.phoenicis.javafx.components.common.panelstates.None)

Example 8 with None

use of org.phoenicis.javafx.components.common.panelstates.None in project POL-POM-5 by PhoenicisOrg.

the class ContainersFeaturePanel method closeDetailsPanel.

/**
 * {@inheritDoc}
 */
@Override
public void closeDetailsPanel() {
    // deselect the currently selected container
    setSelectedContainer(null);
    // close the details panel
    setOpenedDetailsPanel(new None());
}
Also used : None(org.phoenicis.javafx.components.common.panelstates.None)

Example 9 with None

use of org.phoenicis.javafx.components.common.panelstates.None in project POL-POM-5 by PlayOnLinux.

the class InstallationsFeaturePanel method closeDetailsPanel.

/**
 * {@inheritDoc}
 */
@Override
public void closeDetailsPanel() {
    // deselect the currently selected installation
    setSelectedInstallation(null);
    // close the details panel
    setOpenedDetailsPanel(new None());
}
Also used : None(org.phoenicis.javafx.components.common.panelstates.None)

Example 10 with None

use of org.phoenicis.javafx.components.common.panelstates.None in project POL-POM-5 by PlayOnLinux.

the class InstallationsFeaturePanelSkin method createContent.

/**
 * {@inheritDoc}
 */
@Override
public ObjectExpression<Node> createContent() {
    final FilteredList<InstallationDTO> filteredInstallations = ConcatenatedList.create(new MappedList<>(getControl().getInstallationCategories().sorted(Comparator.comparing(InstallationCategoryDTO::getName)), InstallationCategoryDTO::getInstallations)).filtered(getControl().getFilter()::filter);
    filteredInstallations.predicateProperty().bind(Bindings.createObjectBinding(() -> getControl().getFilter()::filter, getControl().getFilter().searchTermProperty(), getControl().getFilter().selectedInstallationCategoryProperty()));
    final SortedList<InstallationDTO> sortedInstallations = filteredInstallations.sorted(Comparator.comparing(InstallationDTO::getName));
    final ObservableList<ListWidgetElement<InstallationDTO>> listWidgetEntries = new MappedList<>(sortedInstallations, ListWidgetElement::create);
    final CombinedListWidget<InstallationDTO> combinedListWidget = new CombinedListWidget<>(listWidgetEntries, this.selectedListWidget);
    // bind direction: controller property -> skin property
    getControl().selectedInstallationProperty().addListener((observable, oldValue, newValue) -> {
        if (newValue != null) {
            combinedListWidget.select(newValue);
        } else {
            combinedListWidget.deselect();
        }
    });
    // bind direction: skin property -> controller properties
    combinedListWidget.selectedElementProperty().addListener((observable, oldValue, newValue) -> {
        if (newValue != null) {
            final InstallationDTO selectedItem = newValue.getItem();
            getControl().setSelectedInstallation(selectedItem);
            getControl().setOpenedDetailsPanel(new Installation(selectedItem));
        } else {
            getControl().setSelectedInstallation(null);
            getControl().setOpenedDetailsPanel(new None());
        }
    });
    return new SimpleObjectProperty<>(combinedListWidget);
}
Also used : MappedList(org.phoenicis.javafx.collections.MappedList) SimpleObjectProperty(javafx.beans.property.SimpleObjectProperty) CombinedListWidget(org.phoenicis.javafx.components.common.widgets.control.CombinedListWidget) Installation(org.phoenicis.javafx.components.installation.panelstates.Installation) ListWidgetElement(org.phoenicis.javafx.components.common.widgets.utils.ListWidgetElement) InstallationDTO(org.phoenicis.javafx.views.mainwindow.installations.dto.InstallationDTO) InstallationCategoryDTO(org.phoenicis.javafx.views.mainwindow.installations.dto.InstallationCategoryDTO) None(org.phoenicis.javafx.components.common.panelstates.None)

Aggregations

None (org.phoenicis.javafx.components.common.panelstates.None)16 SimpleObjectProperty (javafx.beans.property.SimpleObjectProperty)8 MappedList (org.phoenicis.javafx.collections.MappedList)8 CombinedListWidget (org.phoenicis.javafx.components.common.widgets.control.CombinedListWidget)8 ListWidgetElement (org.phoenicis.javafx.components.common.widgets.utils.ListWidgetElement)8 Comparator (java.util.Comparator)2 Optional (java.util.Optional)2 Observable (javafx.beans.Observable)2 Bindings (javafx.beans.binding.Bindings)2 ObjectExpression (javafx.beans.binding.ObjectExpression)2 ObjectProperty (javafx.beans.property.ObjectProperty)2 ObservableList (javafx.collections.ObservableList)2 FilteredList (javafx.collections.transformation.FilteredList)2 SortedList (javafx.collections.transformation.SortedList)2 Node (javafx.scene.Node)2 Tab (javafx.scene.control.Tab)2 TabPane (javafx.scene.control.TabPane)2 MouseEvent (javafx.scene.input.MouseEvent)2 Localisation.tr (org.phoenicis.configuration.localisation.Localisation.tr)2 ContainerDTO (org.phoenicis.containers.dto.ContainerDTO)2