From 60992d9e38e5dfd367b2d1d5432ff57c91a3bfb0 Mon Sep 17 00:00:00 2001 From: sirjonasxx <36828922+sirjonasxx@users.noreply.github.com> Date: Sun, 25 Apr 2021 19:31:37 +0200 Subject: [PATCH] highlight internal exts --- .../java/gearth/extensions/InternalExtensionBuilder.java | 6 ++++++ .../services/extensionhandler/extensions/ExtensionType.java | 6 ++++++ .../extensionhandler/extensions/GEarthExtension.java | 3 +++ .../implementations/network/NetworkExtension.java | 6 ++++++ .../extensions/implementations/simple/ExampleExtension.java | 6 ++++++ .../java/gearth/ui/extensions/ExtensionItemContainer.java | 6 ++++++ 6 files changed, 33 insertions(+) create mode 100644 G-Earth/src/main/java/gearth/services/extensionhandler/extensions/ExtensionType.java diff --git a/G-Earth/src/main/java/gearth/extensions/InternalExtensionBuilder.java b/G-Earth/src/main/java/gearth/extensions/InternalExtensionBuilder.java index e1631b7..b7fe5d4 100644 --- a/G-Earth/src/main/java/gearth/extensions/InternalExtensionBuilder.java +++ b/G-Earth/src/main/java/gearth/extensions/InternalExtensionBuilder.java @@ -5,6 +5,7 @@ import gearth.misc.packet_info.PacketInfoManager; import gearth.protocol.HMessage; import gearth.protocol.HPacket; import gearth.protocol.connection.HClient; +import gearth.services.extensionhandler.extensions.ExtensionType; import gearth.services.extensionhandler.extensions.GEarthExtension; // wraps internal GEarthExtension class to IExtension interface @@ -136,4 +137,9 @@ public class InternalExtensionBuilder extends GEarthExtension { // no need in java ext } + @Override + public ExtensionType extensionType() { + return ExtensionType.INTERNAL; + } + } diff --git a/G-Earth/src/main/java/gearth/services/extensionhandler/extensions/ExtensionType.java b/G-Earth/src/main/java/gearth/services/extensionhandler/extensions/ExtensionType.java new file mode 100644 index 0000000..00d0358 --- /dev/null +++ b/G-Earth/src/main/java/gearth/services/extensionhandler/extensions/ExtensionType.java @@ -0,0 +1,6 @@ +package gearth.services.extensionhandler.extensions; + +public enum ExtensionType { + INTERNAL, + EXTERNAL +} diff --git a/G-Earth/src/main/java/gearth/services/extensionhandler/extensions/GEarthExtension.java b/G-Earth/src/main/java/gearth/services/extensionhandler/extensions/GEarthExtension.java index adaf8c9..a4dc25a 100644 --- a/G-Earth/src/main/java/gearth/services/extensionhandler/extensions/GEarthExtension.java +++ b/G-Earth/src/main/java/gearth/services/extensionhandler/extensions/GEarthExtension.java @@ -123,4 +123,7 @@ public abstract class GEarthExtension { } // ---------------------------------------------------------------------------------------- + + + public abstract ExtensionType extensionType(); } diff --git a/G-Earth/src/main/java/gearth/services/extensionhandler/extensions/implementations/network/NetworkExtension.java b/G-Earth/src/main/java/gearth/services/extensionhandler/extensions/implementations/network/NetworkExtension.java index 723f822..bf0f3fd 100644 --- a/G-Earth/src/main/java/gearth/services/extensionhandler/extensions/implementations/network/NetworkExtension.java +++ b/G-Earth/src/main/java/gearth/services/extensionhandler/extensions/implementations/network/NetworkExtension.java @@ -3,6 +3,7 @@ package gearth.services.extensionhandler.extensions.implementations.network; import gearth.misc.packet_info.PacketInfoManager; import gearth.protocol.HMessage; import gearth.protocol.connection.HClient; +import gearth.services.extensionhandler.extensions.ExtensionType; import gearth.services.extensionhandler.extensions.GEarthExtension; import gearth.protocol.HPacket; @@ -239,4 +240,9 @@ public class NetworkExtension extends GEarthExtension { packet.appendLongString(packetFromString.stringify()); sendMessage(packet); } + + @Override + public ExtensionType extensionType() { + return ExtensionType.EXTERNAL; + } } \ No newline at end of file diff --git a/G-Earth/src/main/java/gearth/services/extensionhandler/extensions/implementations/simple/ExampleExtension.java b/G-Earth/src/main/java/gearth/services/extensionhandler/extensions/implementations/simple/ExampleExtension.java index c580eeb..742cc4f 100644 --- a/G-Earth/src/main/java/gearth/services/extensionhandler/extensions/implementations/simple/ExampleExtension.java +++ b/G-Earth/src/main/java/gearth/services/extensionhandler/extensions/implementations/simple/ExampleExtension.java @@ -4,6 +4,7 @@ import gearth.misc.packet_info.PacketInfoManager; import gearth.protocol.HMessage; import gearth.protocol.HPacket; import gearth.protocol.connection.HClient; +import gearth.services.extensionhandler.extensions.ExtensionType; import gearth.services.extensionhandler.extensions.GEarthExtension; public class ExampleExtension extends GEarthExtension { @@ -122,4 +123,9 @@ public class ExampleExtension extends GEarthExtension { public void stringToPacketResponse(HPacket packet) { } + + @Override + public ExtensionType extensionType() { + return ExtensionType.INTERNAL; + } } diff --git a/G-Earth/src/main/java/gearth/ui/extensions/ExtensionItemContainer.java b/G-Earth/src/main/java/gearth/ui/extensions/ExtensionItemContainer.java index 43b1158..12729b5 100644 --- a/G-Earth/src/main/java/gearth/ui/extensions/ExtensionItemContainer.java +++ b/G-Earth/src/main/java/gearth/ui/extensions/ExtensionItemContainer.java @@ -1,5 +1,6 @@ package gearth.ui.extensions; +import gearth.services.extensionhandler.extensions.ExtensionType; import gearth.services.extensionhandler.extensions.GEarthExtension; import javafx.application.Platform; import javafx.event.EventHandler; @@ -142,6 +143,11 @@ public class ExtensionItemContainer extends GridPane { parent.getChildren().add(this); + if (item.extensionType() == ExtensionType.INTERNAL) { + setBackground(new Background(new BackgroundFill(Paint.valueOf("F0FFFF"), CornerRadii.EMPTY, Insets.EMPTY))); + } + + initExtension(); }