use of org.phoenicis.javafx.views.mainwindow.installations.dto.InstallationDTO 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);
}
use of org.phoenicis.javafx.views.mainwindow.installations.dto.InstallationDTO in project phoenicis by PhoenicisOrg.
the class SetupUiFactoryJavaFX method createSetupWindow.
/**
* creates a setup UI to install an application
* @param title title of the setup UI
* @param miniature miniature which is shown in the "Installations" tab (usually the miniature of the installed application)
* @param installationType apps/engines
* @return setup window
*/
@Override
public SetupUi createSetupWindow(String title, Optional<URI> miniature, InstallationType installationType) {
final SetupUiJavaFXImplementation setupWindow = new SetupUiJavaFXImplementation(title, this.operatingSystemFetcher, this.themeManager);
this.installationsView.closeDetailsView();
InstallationDTO installationDTO = new InstallationDTO.Builder().withCategory(installationType).withId(title + "_" + new Date().getTime()).withName(title).withMiniature(miniature.orElse(null)).withNode(setupWindow.getContent()).build();
this.installationsView.addInstallation(installationDTO);
setupWindow.setOnShouldClose(() -> this.installationsView.removeInstallation(installationDTO));
return setupWindow;
}
use of org.phoenicis.javafx.views.mainwindow.installations.dto.InstallationDTO in project phoenicis by PhoenicisOrg.
the class InstallationsUtils method mergeCategories.
private InstallationCategoryDTO mergeCategories(InstallationCategoryDTO leftCategory, InstallationCategoryDTO rightCategory) {
final Map<String, InstallationDTO> leftInstallations = createSortedMap(leftCategory.getInstallations(), InstallationDTO::getId);
final Map<String, InstallationDTO> rightInstallations = createSortedMap(rightCategory.getInstallations(), InstallationDTO::getId);
final SortedMap<String, InstallationDTO> mergedInstallations = new TreeMap<>(rightInstallations);
for (Map.Entry<String, InstallationDTO> entry : leftInstallations.entrySet()) {
final InstallationDTO application = entry.getValue();
if (mergedInstallations.containsKey(entry.getKey())) {
LOGGER.error(String.format("Installation %s exists already!", entry.getKey()));
} else {
mergedInstallations.put(entry.getKey(), application);
}
}
final List<InstallationDTO> installations = new ArrayList<>(mergedInstallations.values());
installations.sort(InstallationDTO.nameComparator());
return new InstallationCategoryDTO.Builder().withId(leftCategory.getId()).withName(leftCategory.getName()).withInstallations(installations).withIcon(leftCategory.getIcon()).build();
}
use of org.phoenicis.javafx.views.mainwindow.installations.dto.InstallationDTO 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);
}
use of org.phoenicis.javafx.views.mainwindow.installations.dto.InstallationDTO in project POL-POM-5 by PlayOnLinux.
the class InstallationsFeaturePanelSkin method createInstallationDetailsPanel.
private DetailsPanel createInstallationDetailsPanel(Installation action) {
final InstallationDTO installation = action.getInstallation();
final DetailsPanel detailsPanel = new DetailsPanel();
detailsPanel.setTitle(installation.getName());
detailsPanel.setContent(installation.getNode());
detailsPanel.setOnClose(getControl()::closeDetailsPanel);
detailsPanel.prefWidthProperty().bind(getControl().widthProperty().divide(3));
return detailsPanel;
}
Aggregations