use of org.phoenicis.javafx.views.mainwindow.installations.dto.InstallationDTO in project POL-POM-5 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 MainWindow method createInstallationsTab.
private Tab createInstallationsTab(InstallationsFeaturePanel installationsFeaturePanel) {
final Tab installationsTab = new Tab(tr("Installations"), installationsFeaturePanel);
installationsTab.setClosable(false);
final ConcatenatedList<InstallationDTO> installations = ConcatenatedList.create(new MappedList<>(installationsFeaturePanel.getInstallationCategories(), InstallationCategoryDTO::getInstallations));
// a binding containing the number of currently active installations
final IntegerBinding openInstallations = Bindings.createIntegerBinding(installations::size, installations);
final TabIndicator indicator = new TabIndicator();
indicator.textProperty().bind(StringBindings.map(openInstallations, numberOfInstallations -> {
if (numberOfInstallations.intValue() < 10) {
return String.valueOf(numberOfInstallations);
} else {
return "+";
}
}));
// only show the tab indicator if at least one active installation exists
installationsTab.graphicProperty().bind(Bindings.when(Bindings.notEqual(openInstallations, 0)).then(indicator).otherwise(new SimpleObjectProperty<>()));
return installationsTab;
}
use of org.phoenicis.javafx.views.mainwindow.installations.dto.InstallationDTO in project POL-POM-5 by PlayOnLinux.
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);
final 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 POL-POM-5 by PhoenicisOrg.
the class MainWindow method createInstallationsTab.
private Tab createInstallationsTab(InstallationsFeaturePanel installationsFeaturePanel) {
final Tab installationsTab = new Tab(tr("Installations"), installationsFeaturePanel);
installationsTab.setClosable(false);
final ConcatenatedList<InstallationDTO> installations = ConcatenatedList.create(new MappedList<>(installationsFeaturePanel.getInstallationCategories(), InstallationCategoryDTO::getInstallations));
// a binding containing the number of currently active installations
final IntegerBinding openInstallations = Bindings.createIntegerBinding(installations::size, installations);
final TabIndicator indicator = new TabIndicator();
indicator.textProperty().bind(StringBindings.map(openInstallations, numberOfInstallations -> {
if (numberOfInstallations.intValue() < 10) {
return String.valueOf(numberOfInstallations);
} else {
return "+";
}
}));
// only show the tab indicator if at least one active installation exists
installationsTab.graphicProperty().bind(Bindings.when(Bindings.notEqual(openInstallations, 0)).then(indicator).otherwise(new SimpleObjectProperty<>()));
return installationsTab;
}
use of org.phoenicis.javafx.views.mainwindow.installations.dto.InstallationDTO in project POL-POM-5 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);
final 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;
}
Aggregations