mirror of
https://github.com/sirjonasxx/G-Earth.git
synced 2024-11-26 10:20:51 +01:00
renames
This commit is contained in:
parent
33afab4353
commit
64dea6fc0f
@ -1,80 +0,0 @@
|
|||||||
package gearth.extensions;
|
|
||||||
|
|
||||||
import gearth.GEarth;
|
|
||||||
import gearth.services.extension_handler.extensions.GEarthExtension;
|
|
||||||
import gearth.services.extension_handler.extensions.extensionproducers.ExtensionProducerObserver;
|
|
||||||
import javafx.application.Platform;
|
|
||||||
import javafx.stage.Stage;
|
|
||||||
|
|
||||||
public class InternalExtensionFormBuilder<L extends InternalExtensionFormLauncher<T>, T extends ExtensionForm> {
|
|
||||||
|
|
||||||
public T launch(L launcher, ExtensionProducerObserver observer) {
|
|
||||||
try {
|
|
||||||
Stage stage = new Stage();
|
|
||||||
T extensionForm = launcher.createForm(stage);
|
|
||||||
|
|
||||||
ExtensionInfo extInfo = extensionForm.getClass().getAnnotation(ExtensionInfo.class);
|
|
||||||
|
|
||||||
InternalExtension internalExtension = new InternalExtension() {
|
|
||||||
@Override
|
|
||||||
protected void initExtension() {
|
|
||||||
extensionForm.initExtension();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onClick() {
|
|
||||||
extensionForm.onClick();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onStartConnection() {
|
|
||||||
extensionForm.onStartConnection();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onEndConnection() {
|
|
||||||
extensionForm.onEndConnection();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected ExtensionInfo getInfoAnnotations() {
|
|
||||||
return extInfo;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean canLeave() {
|
|
||||||
return extensionForm.canLeave();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean canDelete() {
|
|
||||||
return extensionForm.canDelete();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
extensionForm.hostServices = GEarth.main.getHostServices();
|
|
||||||
extensionForm.extension = internalExtension;
|
|
||||||
extensionForm.primaryStage = stage;
|
|
||||||
|
|
||||||
extensionForm.fieldsInitialized.fireEvent();
|
|
||||||
GEarthExtension gEarthExtension = new InternalExtensionBuilder(internalExtension);
|
|
||||||
observer.onExtensionProduced(gEarthExtension);
|
|
||||||
|
|
||||||
|
|
||||||
Platform.setImplicitExit(false);
|
|
||||||
|
|
||||||
stage.setOnCloseRequest(event -> {
|
|
||||||
event.consume();
|
|
||||||
Platform.runLater(() -> {
|
|
||||||
stage.hide();
|
|
||||||
extensionForm.onHide();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
return extensionForm;
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
@ -0,0 +1,10 @@
|
|||||||
|
package gearth.extensions;
|
||||||
|
|
||||||
|
import javafx.stage.Stage;
|
||||||
|
|
||||||
|
public abstract class InternalExtensionFormCreator<T extends ExtensionForm> {
|
||||||
|
|
||||||
|
// creates an ExtensionForm object and initializes the JavaFX application
|
||||||
|
public abstract T createForm(Stage primaryStage) throws Exception;
|
||||||
|
|
||||||
|
}
|
@ -1,10 +1,80 @@
|
|||||||
package gearth.extensions;
|
package gearth.extensions;
|
||||||
|
|
||||||
|
import gearth.GEarth;
|
||||||
|
import gearth.services.extension_handler.extensions.GEarthExtension;
|
||||||
|
import gearth.services.extension_handler.extensions.extensionproducers.ExtensionProducerObserver;
|
||||||
|
import javafx.application.Platform;
|
||||||
import javafx.stage.Stage;
|
import javafx.stage.Stage;
|
||||||
|
|
||||||
public abstract class InternalExtensionFormLauncher<T extends ExtensionForm> {
|
public class InternalExtensionFormLauncher<L extends InternalExtensionFormCreator<T>, T extends ExtensionForm> {
|
||||||
|
|
||||||
// creates an ExtensionForm object and initializes the JavaFX application
|
public T launch(L launcher, ExtensionProducerObserver observer) {
|
||||||
public abstract T createForm(Stage primaryStage) throws Exception;
|
try {
|
||||||
|
Stage stage = new Stage();
|
||||||
|
T extensionForm = launcher.createForm(stage);
|
||||||
|
|
||||||
|
ExtensionInfo extInfo = extensionForm.getClass().getAnnotation(ExtensionInfo.class);
|
||||||
|
|
||||||
|
InternalExtension internalExtension = new InternalExtension() {
|
||||||
|
@Override
|
||||||
|
protected void initExtension() {
|
||||||
|
extensionForm.initExtension();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onClick() {
|
||||||
|
extensionForm.onClick();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onStartConnection() {
|
||||||
|
extensionForm.onStartConnection();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onEndConnection() {
|
||||||
|
extensionForm.onEndConnection();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected ExtensionInfo getInfoAnnotations() {
|
||||||
|
return extInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean canLeave() {
|
||||||
|
return extensionForm.canLeave();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean canDelete() {
|
||||||
|
return extensionForm.canDelete();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
extensionForm.hostServices = GEarth.main.getHostServices();
|
||||||
|
extensionForm.extension = internalExtension;
|
||||||
|
extensionForm.primaryStage = stage;
|
||||||
|
|
||||||
|
extensionForm.fieldsInitialized.fireEvent();
|
||||||
|
GEarthExtension gEarthExtension = new InternalExtensionBuilder(internalExtension);
|
||||||
|
observer.onExtensionProduced(gEarthExtension);
|
||||||
|
|
||||||
|
|
||||||
|
Platform.setImplicitExit(false);
|
||||||
|
|
||||||
|
stage.setOnCloseRequest(event -> {
|
||||||
|
event.consume();
|
||||||
|
Platform.runLater(() -> {
|
||||||
|
stage.hide();
|
||||||
|
extensionForm.onHide();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
return extensionForm;
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
package gearth.services.extension_handler.extensions.implementations.simple;
|
package gearth.services.extension_handler.extensions.implementations.simple;
|
||||||
|
|
||||||
import gearth.extensions.InternalExtensionFormBuilder;
|
import gearth.extensions.InternalExtensionFormLauncher;
|
||||||
import gearth.services.extension_handler.extensions.extensionproducers.ExtensionProducer;
|
import gearth.services.extension_handler.extensions.extensionproducers.ExtensionProducer;
|
||||||
import gearth.services.extension_handler.extensions.extensionproducers.ExtensionProducerObserver;
|
import gearth.services.extension_handler.extensions.extensionproducers.ExtensionProducerObserver;
|
||||||
import gearth.services.internal_extensions.extensionstore.GExtensionStore;
|
import gearth.services.internal_extensions.extensionstore.GExtensionStore;
|
||||||
import gearth.services.internal_extensions.extensionstore.GExtensionStoreLauncher;
|
import gearth.services.internal_extensions.extensionstore.GExtensionStoreCreator;
|
||||||
|
|
||||||
public class SimpleExtensionProducer implements ExtensionProducer {
|
public class SimpleExtensionProducer implements ExtensionProducer {
|
||||||
|
|
||||||
@ -14,8 +14,8 @@ public class SimpleExtensionProducer implements ExtensionProducer {
|
|||||||
// uncomment the next line if you want to see an embedded example extension in G-Earth
|
// uncomment the next line if you want to see an embedded example extension in G-Earth
|
||||||
// observer.onExtensionProduced(new ExampleExtension());
|
// observer.onExtensionProduced(new ExampleExtension());
|
||||||
|
|
||||||
new InternalExtensionFormBuilder<GExtensionStoreLauncher, GExtensionStore>()
|
new InternalExtensionFormLauncher<GExtensionStoreCreator, GExtensionStore>()
|
||||||
.launch(new GExtensionStoreLauncher(), observer);
|
.launch(new GExtensionStoreCreator(), observer);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package gearth.services.internal_extensions.extensionstore;
|
package gearth.services.internal_extensions.extensionstore;
|
||||||
|
|
||||||
import gearth.GEarth;
|
import gearth.GEarth;
|
||||||
import gearth.extensions.InternalExtensionFormLauncher;
|
import gearth.extensions.InternalExtensionFormCreator;
|
||||||
import gearth.services.internal_extensions.extensionstore.application.GExtensionStoreController;
|
import gearth.services.internal_extensions.extensionstore.application.GExtensionStoreController;
|
||||||
import gearth.ui.GEarthController;
|
import gearth.ui.GEarthController;
|
||||||
import javafx.fxml.FXMLLoader;
|
import javafx.fxml.FXMLLoader;
|
||||||
@ -10,7 +10,7 @@ import javafx.scene.Scene;
|
|||||||
import javafx.scene.image.Image;
|
import javafx.scene.image.Image;
|
||||||
import javafx.stage.Stage;
|
import javafx.stage.Stage;
|
||||||
|
|
||||||
public class GExtensionStoreLauncher extends InternalExtensionFormLauncher<GExtensionStore> {
|
public class GExtensionStoreCreator extends InternalExtensionFormCreator<GExtensionStore> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public GExtensionStore createForm(Stage stage) throws Exception {
|
public GExtensionStore createForm(Stage stage) throws Exception {
|
@ -1,9 +1,6 @@
|
|||||||
package gearth.services.internal_extensions.uilogger;
|
package gearth.services.internal_extensions.uilogger;
|
||||||
|
|
||||||
import gearth.GEarth;
|
import gearth.extensions.InternalExtensionFormCreator;
|
||||||
import gearth.extensions.InternalExtensionFormLauncher;
|
|
||||||
import gearth.ui.titlebar.DefaultTitleBarConfig;
|
|
||||||
import gearth.ui.titlebar.TitleBarController;
|
|
||||||
import javafx.fxml.FXMLLoader;
|
import javafx.fxml.FXMLLoader;
|
||||||
import javafx.scene.Parent;
|
import javafx.scene.Parent;
|
||||||
import javafx.scene.Scene;
|
import javafx.scene.Scene;
|
||||||
@ -11,7 +8,7 @@ import javafx.scene.image.Image;
|
|||||||
import javafx.stage.Modality;
|
import javafx.stage.Modality;
|
||||||
import javafx.stage.Stage;
|
import javafx.stage.Stage;
|
||||||
|
|
||||||
public class UiLoggerLauncher extends InternalExtensionFormLauncher<UiLogger> {
|
public class UiLoggerCreator extends InternalExtensionFormCreator<UiLogger> {
|
||||||
@Override
|
@Override
|
||||||
public UiLogger createForm(Stage stage) throws Exception {
|
public UiLogger createForm(Stage stage) throws Exception {
|
||||||
UiLogger uiLogger = new UiLogger();
|
UiLogger uiLogger = new UiLogger();
|
@ -1,13 +1,13 @@
|
|||||||
package gearth.ui.subforms.logger.loggerdisplays;
|
package gearth.ui.subforms.logger.loggerdisplays;
|
||||||
|
|
||||||
import gearth.GEarth;
|
import gearth.GEarth;
|
||||||
import gearth.extensions.InternalExtensionFormBuilder;
|
import gearth.extensions.InternalExtensionFormLauncher;
|
||||||
import gearth.misc.OSValidator;
|
import gearth.misc.OSValidator;
|
||||||
import gearth.services.extension_handler.ExtensionHandler;
|
import gearth.services.extension_handler.ExtensionHandler;
|
||||||
import gearth.services.extension_handler.extensions.extensionproducers.ExtensionProducer;
|
import gearth.services.extension_handler.extensions.extensionproducers.ExtensionProducer;
|
||||||
import gearth.services.extension_handler.extensions.extensionproducers.ExtensionProducerObserver;
|
import gearth.services.extension_handler.extensions.extensionproducers.ExtensionProducerObserver;
|
||||||
import gearth.services.internal_extensions.uilogger.UiLogger;
|
import gearth.services.internal_extensions.uilogger.UiLogger;
|
||||||
import gearth.services.internal_extensions.uilogger.UiLoggerLauncher;
|
import gearth.services.internal_extensions.uilogger.UiLoggerCreator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by Jonas on 04/04/18.
|
* Created by Jonas on 04/04/18.
|
||||||
@ -40,8 +40,8 @@ public class PacketLoggerFactory implements ExtensionProducer {
|
|||||||
@Override
|
@Override
|
||||||
public void startProducing(ExtensionProducerObserver observer) {
|
public void startProducing(ExtensionProducerObserver observer) {
|
||||||
if (usesUIlogger()) {
|
if (usesUIlogger()) {
|
||||||
uiLogger = new InternalExtensionFormBuilder<UiLoggerLauncher, UiLogger>()
|
uiLogger = new InternalExtensionFormLauncher<UiLoggerCreator, UiLogger>()
|
||||||
.launch(new UiLoggerLauncher(), observer);
|
.launch(new UiLoggerCreator(), observer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user