mirror of
https://github.com/sirjonasxx/G-Earth.git
synced 2025-01-18 16:26:26 +01:00
seperate colors for removed and outdated extensions
This commit is contained in:
parent
e1ab090852
commit
16a014b96d
@ -94,6 +94,8 @@ public class StoreExtensionDetailsItem implements ContentItem {
|
||||
.append("> Framework: ").append(storeExtension.getFramework().getFramework().getName()).append(" - v").append(storeExtension.getFramework().getVersion()).append("\n")
|
||||
.append("> Systems: ").append(String.join(", ", storeExtension.getCompatibility().getSystems())).append("\n \n");
|
||||
|
||||
contentBuilder.append("*Compatible clients:* ").append(String.join(", ", storeExtension.getCompatibility().getClients())).append("\n\n");
|
||||
|
||||
if (storeExtension.getFramework().getFramework().isInstallationRequired()) {
|
||||
contentBuilder.append("Warning: the framework requires --url:additional installations-")
|
||||
.append(storeExtension.getFramework().getFramework().getInstallationInstructions()).append(" !\n");
|
||||
|
@ -1,9 +1,13 @@
|
||||
package gearth.services.internal_extensions.extensionstore.application.entities.installed;
|
||||
|
||||
import gearth.services.internal_extensions.extensionstore.GExtensionStore;
|
||||
import gearth.services.internal_extensions.extensionstore.application.GExtensionStoreController;
|
||||
import gearth.services.internal_extensions.extensionstore.application.WebUtils;
|
||||
import gearth.services.internal_extensions.extensionstore.application.entities.StoreExtensionItem;
|
||||
import gearth.services.internal_extensions.extensionstore.repository.models.StoreExtension;
|
||||
import gearth.services.internal_extensions.extensionstore.tools.InstalledExtension;
|
||||
import netscape.javascript.JSObject;
|
||||
import org.apache.maven.artifact.versioning.ComparableVersion;
|
||||
|
||||
public class StoreExtensionInstalledItem extends StoreExtensionItem {
|
||||
|
||||
@ -20,8 +24,13 @@ public class StoreExtensionInstalledItem extends StoreExtensionItem {
|
||||
|
||||
@Override
|
||||
protected String displayColor(int i) {
|
||||
return super.displayColor(i);
|
||||
// todo color depending on if it needs an update
|
||||
if (storeExtension != null) {
|
||||
if (new ComparableVersion(this.installedExtension.getVersion()).compareTo(new ComparableVersion(storeExtension.getVersion())) < 0) {
|
||||
return "item_orange";
|
||||
}
|
||||
return super.displayColor(i);
|
||||
}
|
||||
return "item_red";
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -33,9 +42,35 @@ public class StoreExtensionInstalledItem extends StoreExtensionItem {
|
||||
@Override
|
||||
public void addHtml(int i, GExtensionStore gExtensionStore) {
|
||||
if (this.storeExtension != null) {
|
||||
super.addHtml(i, gExtensionStore /* add custom color here */);
|
||||
super.addHtml(i, gExtensionStore);
|
||||
}
|
||||
else {
|
||||
|
||||
//todo html when extension isn't in store
|
||||
// display a red item that can't be clicked - to mark that this is no available extension
|
||||
StringBuilder htmlBuilder = new StringBuilder()
|
||||
.append("<div class=\"overview_item ").append(displayColor(i)).append(" content_item\">")
|
||||
|
||||
.append("<div class=\"overview_item_logo\">")
|
||||
.append("<img src=\"\" alt=\"\">")
|
||||
.append("</div>")
|
||||
|
||||
.append("<div class=\"overview_item_info\">")
|
||||
.append("<div class=\"oii_name\">").append(WebUtils.escapeMessage(installedExtension.getName())).append("</div>")
|
||||
.append("<div class=\"oii_desc\">Not found in G-ExtensionStore</div>")
|
||||
.append("</div>")
|
||||
|
||||
.append("<div class=\"overview_item_msgs\">")
|
||||
.append("<div class=\"oim_top\">").append("Version: ").append(displayVersion()).append("</div>")
|
||||
.append("<div class=\"oim_bottom\"></div>")
|
||||
.append("</div>")
|
||||
|
||||
.append("</div>");
|
||||
|
||||
String extension = htmlBuilder.toString();
|
||||
GExtensionStoreController controller = gExtensionStore.getController();
|
||||
|
||||
controller.getWebView().getEngine().executeScript("document.getElementById('" +
|
||||
controller.getContentItemsContainer() + "').innerHTML += '" + extension + "';");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -34,6 +34,10 @@
|
||||
background-color: #b5e6f9;
|
||||
}
|
||||
|
||||
.item_orange {
|
||||
background-color: #ffcc80;
|
||||
}
|
||||
|
||||
.item_grey {
|
||||
background-color: #aaaaaa;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user