Search in sources :

Example 31 with SimpleObjectProperty

use of javafx.beans.property.SimpleObjectProperty in project POL-POM-5 by PlayOnLinux.

the class ContainersFeaturePanelSkin method createSidebar.

/**
 * {@inheritDoc}
 */
@Override
public ObjectExpression<SidebarBase<?, ?, ?>> createSidebar() {
    /*
         * initialize the container categories by sorting them
         */
    final SortedList<ContainerCategoryDTO> sortedCategories = getControl().getCategories().sorted(Comparator.comparing(ContainerCategoryDTO::getName));
    final ContainerSidebar sidebar = new ContainerSidebar(getControl().getFilter(), sortedCategories, this.selectedListWidget);
    // set the default selection
    sidebar.setSelectedListWidget(Optional.ofNullable(getControl().getJavaFxSettingsManager()).map(JavaFxSettingsManager::getContainersListType).orElse(ListWidgetType.ICONS_LIST));
    // save changes to the list widget selection to the hard drive
    sidebar.selectedListWidgetProperty().addListener((observable, oldValue, newValue) -> {
        final JavaFxSettingsManager javaFxSettingsManager = getControl().getJavaFxSettingsManager();
        if (newValue != null) {
            javaFxSettingsManager.setContainersListType(newValue);
            javaFxSettingsManager.save();
        }
    });
    return new SimpleObjectProperty<>(sidebar);
}
Also used : SimpleObjectProperty(javafx.beans.property.SimpleObjectProperty) ContainerCategoryDTO(org.phoenicis.containers.dto.ContainerCategoryDTO) ContainerSidebar(org.phoenicis.javafx.components.container.control.ContainerSidebar) JavaFxSettingsManager(org.phoenicis.javafx.settings.JavaFxSettingsManager)

Example 32 with SimpleObjectProperty

use of javafx.beans.property.SimpleObjectProperty in project POL-POM-5 by PlayOnLinux.

the class LibraryFeaturePanelSkin method createSidebar.

/**
 * {@inheritDoc}
 */
@Override
public ObjectExpression<SidebarBase<?, ?, ?>> createSidebar() {
    final SortedList<ShortcutCategoryDTO> sortedCategories = getControl().getCategories().sorted(Comparator.comparing(ShortcutCategoryDTO::getName));
    final LibrarySidebar sidebar = new LibrarySidebar(getControl().getFilter(), sortedCategories, this.selectedListWidget);
    sidebar.applicationNameProperty().bind(getControl().applicationNameProperty());
    sidebar.javaFxSettingsManagerProperty().bind(getControl().javaFxSettingsManagerProperty());
    sidebar.setOnCreateShortcut(() -> {
        // deselect the currently selected shortcut
        getControl().setSelectedShortcut(null);
        // open the shortcut creation details panel
        getControl().setOpenedDetailsPanel(new ShortcutCreation());
    });
    sidebar.setOnOpenConsole(getControl()::openConsole);
    // set the default selection
    sidebar.setSelectedListWidget(Optional.ofNullable(getControl().getJavaFxSettingsManager()).map(JavaFxSettingsManager::getLibraryListType).orElse(ListWidgetType.ICONS_LIST));
    // save changes to the list widget selection to the hard drive
    sidebar.selectedListWidgetProperty().addListener((observable, oldValue, newValue) -> {
        final JavaFxSettingsManager javaFxSettingsManager = getControl().getJavaFxSettingsManager();
        if (newValue != null) {
            javaFxSettingsManager.setLibraryListType(newValue);
            javaFxSettingsManager.save();
        }
    });
    return new SimpleObjectProperty<>(sidebar);
}
Also used : SimpleObjectProperty(javafx.beans.property.SimpleObjectProperty) ShortcutCreation(org.phoenicis.javafx.components.library.panelstates.ShortcutCreation) ShortcutCategoryDTO(org.phoenicis.library.dto.ShortcutCategoryDTO) JavaFxSettingsManager(org.phoenicis.javafx.settings.JavaFxSettingsManager)

Example 33 with SimpleObjectProperty

use of javafx.beans.property.SimpleObjectProperty in project POL-POM-5 by PlayOnLinux.

the class LibraryFeaturePanelSkin method createContent.

/**
 * {@inheritDoc}
 */
@Override
public ObjectExpression<Node> createContent() {
    final CombinedListWidget<ShortcutDTO> combinedListWidget = createCombinedListWidget();
    final Tab installedApplicationsTab = new Tab(tr("My applications"), combinedListWidget);
    installedApplicationsTab.setClosable(false);
    final TabPane container = new TabPane();
    container.getStyleClass().add("rightPane");
    getControl().selectedTabProperty().addListener((Observable invalidation) -> {
        final Tab selectedTab = getControl().getSelectedTab();
        if (selectedTab != null) {
            container.getSelectionModel().select(selectedTab);
        } else {
            container.getSelectionModel().selectFirst();
        }
    });
    container.getSelectionModel().selectedItemProperty().addListener((Observable invalidation) -> getControl().setSelectedTab(container.getSelectionModel().getSelectedItem()));
    Bindings.bindContentBidirectional(container.getTabs(), getControl().getTabs());
    container.getTabs().add(installedApplicationsTab);
    return new SimpleObjectProperty<>(container);
}
Also used : TabPane(javafx.scene.control.TabPane) SimpleObjectProperty(javafx.beans.property.SimpleObjectProperty) Tab(javafx.scene.control.Tab) ShortcutDTO(org.phoenicis.library.dto.ShortcutDTO) Observable(javafx.beans.Observable)

Example 34 with SimpleObjectProperty

use of javafx.beans.property.SimpleObjectProperty in project POL-POM-5 by PlayOnLinux.

the class ContainersFeaturePanelSkin method createContent.

/**
 * {@inheritDoc}
 */
@Override
public ObjectExpression<Node> createContent() {
    /*
         * initialize the container lists by:
         * 1. sorting the containers by their name
         * 2. filtering the containers
         */
    final FilteredList<ContainerDTO> filteredContainers = ConcatenatedList.create(new MappedList<>(getControl().getCategories().sorted(Comparator.comparing(ContainerCategoryDTO::getName)), ContainerCategoryDTO::getContainers)).sorted(Comparator.comparing(ContainerDTO::getName)).filtered(getControl().getFilter()::filter);
    filteredContainers.predicateProperty().bind(Bindings.createObjectBinding(() -> getControl().getFilter()::filter, getControl().getFilter().searchTermProperty()));
    final ObservableList<ListWidgetElement<ContainerDTO>> listWidgetEntries = new MappedList<>(filteredContainers, ListWidgetElement::create);
    final CombinedListWidget<ContainerDTO> combinedListWidget = new CombinedListWidget<>(listWidgetEntries, this.selectedListWidget);
    // bind direction: controller property -> skin property
    getControl().selectedContainerProperty().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 ContainerDTO selectedItem = newValue.getItem();
            getControl().setSelectedContainer(selectedItem);
            getControl().setOpenedDetailsPanel(new ContainerInformation(selectedItem));
        } else {
            getControl().setSelectedContainer(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) ListWidgetElement(org.phoenicis.javafx.components.common.widgets.utils.ListWidgetElement) ContainerInformation(org.phoenicis.javafx.components.container.panelstates.ContainerInformation) ContainerDTO(org.phoenicis.containers.dto.ContainerDTO) None(org.phoenicis.javafx.components.common.panelstates.None)

Example 35 with SimpleObjectProperty

use of javafx.beans.property.SimpleObjectProperty in project POL-POM-5 by PlayOnLinux.

the class ApplicationsFeaturePanelSkin method createSidebar.

/**
 * {@inheritDoc}
 */
@Override
public ObjectExpression<SidebarBase<?, ?, ?>> createSidebar() {
    /*
         * initialize the category lists by:
         * 1. filtering by installer categories
         * 2. sorting the remaining categories by their name
         */
    final SortedList<CategoryDTO> sortedCategories = getControl().getCategories().filtered(category -> category.getType() == CategoryDTO.CategoryType.INSTALLERS).sorted(Comparator.comparing(CategoryDTO::getName));
    final ApplicationSidebar sidebar = new ApplicationSidebar(sortedCategories, this.selectedListWidget);
    sidebar.operatingSystemProperty().bind(getControl().operatingSystemProperty());
    sidebar.fuzzySearchRatioProperty().bind(getControl().fuzzySearchRatioProperty());
    getControl().searchTermProperty().bind(sidebar.searchTermProperty());
    getControl().filterCategoryProperty().bind(sidebar.selectedItemProperty());
    getControl().containCommercialApplicationsProperty().bind(sidebar.containCommercialApplicationsProperty());
    getControl().containRequiresPatchApplicationsProperty().bind(sidebar.containRequiresPatchApplicationsProperty());
    getControl().containTestingApplicationsProperty().bind(sidebar.containTestingApplicationsProperty());
    getControl().containAllOSCompatibleApplicationsProperty().bind(sidebar.containAllOSCompatibleApplicationsProperty());
    // set the default selection
    sidebar.setSelectedListWidget(Optional.ofNullable(getControl().getJavaFxSettingsManager()).map(JavaFxSettingsManager::getAppsListType).orElse(ListWidgetType.ICONS_LIST));
    // save changes to the list widget selection to the hard drive
    sidebar.selectedListWidgetProperty().addListener((observable, oldValue, newValue) -> {
        final JavaFxSettingsManager javaFxSettingsManager = getControl().getJavaFxSettingsManager();
        if (newValue != null) {
            javaFxSettingsManager.setAppsListType(newValue);
            javaFxSettingsManager.save();
        }
    });
    return new SimpleObjectProperty<>(sidebar);
}
Also used : CategoryDTO(org.phoenicis.repository.dto.CategoryDTO) ApplicationSidebar(org.phoenicis.javafx.components.application.control.ApplicationSidebar) CombinedListWidget(org.phoenicis.javafx.components.common.widgets.control.CombinedListWidget) StringBindings(org.phoenicis.javafx.utils.StringBindings) ObjectExpression(javafx.beans.binding.ObjectExpression) MappedList(org.phoenicis.javafx.collections.MappedList) Bindings(javafx.beans.binding.Bindings) SidebarBase(org.phoenicis.javafx.components.common.control.SidebarBase) ListWidgetElement(org.phoenicis.javafx.components.common.widgets.utils.ListWidgetElement) None(org.phoenicis.javafx.components.common.panelstates.None) FeaturePanelSkin(org.phoenicis.javafx.components.common.skin.FeaturePanelSkin) SwitchBinding(org.phoenicis.javafx.utils.SwitchBinding) SortedList(javafx.collections.transformation.SortedList) ListWidgetType(org.phoenicis.javafx.components.common.widgets.utils.ListWidgetType) CategoryDTO(org.phoenicis.repository.dto.CategoryDTO) ObjectProperty(javafx.beans.property.ObjectProperty) Node(javafx.scene.Node) FilteredList(javafx.collections.transformation.FilteredList) ApplicationsFeaturePanel(org.phoenicis.javafx.components.application.control.ApplicationsFeaturePanel) ApplicationInformationPanel(org.phoenicis.javafx.components.application.control.ApplicationInformationPanel) ApplicationInformation(org.phoenicis.javafx.components.application.panelstates.ApplicationInformation) ApplicationDTO(org.phoenicis.repository.dto.ApplicationDTO) JavaFxSettingsManager(org.phoenicis.javafx.settings.JavaFxSettingsManager) SimpleObjectProperty(javafx.beans.property.SimpleObjectProperty) OpenDetailsPanel(org.phoenicis.javafx.components.common.panelstates.OpenDetailsPanel) DetailsPanel(org.phoenicis.javafx.components.common.control.DetailsPanel) Optional(java.util.Optional) ObservableList(javafx.collections.ObservableList) ConcatenatedList(org.phoenicis.javafx.collections.ConcatenatedList) Comparator(java.util.Comparator) SimpleObjectProperty(javafx.beans.property.SimpleObjectProperty) ApplicationSidebar(org.phoenicis.javafx.components.application.control.ApplicationSidebar) JavaFxSettingsManager(org.phoenicis.javafx.settings.JavaFxSettingsManager)

Aggregations

SimpleObjectProperty (javafx.beans.property.SimpleObjectProperty)37 TableColumn (javafx.scene.control.TableColumn)12 MappedList (org.phoenicis.javafx.collections.MappedList)10 JavaFxSettingsManager (org.phoenicis.javafx.settings.JavaFxSettingsManager)10 BigDecimal (java.math.BigDecimal)9 None (org.phoenicis.javafx.components.common.panelstates.None)8 CombinedListWidget (org.phoenicis.javafx.components.common.widgets.control.CombinedListWidget)8 ListWidgetElement (org.phoenicis.javafx.components.common.widgets.utils.ListWidgetElement)8 Bindings (javafx.beans.binding.Bindings)7 Button (javafx.scene.control.Button)7 SimpleStringProperty (javafx.beans.property.SimpleStringProperty)6 LocalDate (java.time.LocalDate)5 Optional (java.util.Optional)5 ObjectProperty (javafx.beans.property.ObjectProperty)5 ObservableList (javafx.collections.ObservableList)5 FXML (javafx.fxml.FXML)5 Scene (javafx.scene.Scene)5 TableCell (javafx.scene.control.TableCell)5 ArrayList (java.util.ArrayList)4 List (java.util.List)4