Initial commit
Some checks failed
Gradle Build / build (push) Has been cancelled

This commit is contained in:
CaiXiang
2024-11-30 18:36:13 +08:00
commit aa56926258
2134 changed files with 232943 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
// SPDX-FileCopyrightText: The openTCS Authors
// SPDX-License-Identifier: MIT
package org.opentcs.operationsdesk;
import org.opentcs.customizations.plantoverview.PlantOverviewInjectionModule;
/**
* Configures/binds the default importers and exporters of the openTCS plant overview.
*/
public class DefaultImportersExportersModule
extends
PlantOverviewInjectionModule {
/**
* Creates a new instance.
*/
public DefaultImportersExportersModule() {
}
@Override
protected void configure() {
plantModelImporterBinder();
plantModelExporterBinder();
}
}

View File

@@ -0,0 +1,166 @@
// SPDX-FileCopyrightText: The openTCS Authors
// SPDX-License-Identifier: MIT
package org.opentcs.operationsdesk;
import com.google.inject.TypeLiteral;
import jakarta.inject.Singleton;
import java.io.File;
import java.util.List;
import java.util.Locale;
import javax.swing.ToolTipManager;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
import org.opentcs.access.KernelServicePortal;
import org.opentcs.access.SslParameterSet;
import org.opentcs.access.rmi.KernelServicePortalBuilder;
import org.opentcs.access.rmi.factories.NullSocketFactoryProvider;
import org.opentcs.access.rmi.factories.SecureSocketFactoryProvider;
import org.opentcs.access.rmi.factories.SocketFactoryProvider;
import org.opentcs.common.GuestUserCredentials;
import org.opentcs.components.plantoverview.LocationTheme;
import org.opentcs.components.plantoverview.VehicleTheme;
import org.opentcs.customizations.ApplicationHome;
import org.opentcs.customizations.plantoverview.PlantOverviewInjectionModule;
import org.opentcs.drivers.LowLevelCommunicationEvent;
import org.opentcs.guing.common.exchange.ApplicationPortalProviderConfiguration;
import org.opentcs.guing.common.exchange.SslConfiguration;
import org.opentcs.operationsdesk.application.ApplicationInjectionModule;
import org.opentcs.operationsdesk.components.ComponentsInjectionModule;
import org.opentcs.operationsdesk.exchange.ExchangeInjectionModule;
import org.opentcs.operationsdesk.model.ModelInjectionModule;
import org.opentcs.operationsdesk.notifications.NotificationInjectionModule;
import org.opentcs.operationsdesk.peripherals.jobs.PeripheralJobInjectionModule;
import org.opentcs.operationsdesk.persistence.DefaultPersistenceInjectionModule;
import org.opentcs.operationsdesk.transport.TransportInjectionModule;
import org.opentcs.operationsdesk.util.OperationsDeskConfiguration;
import org.opentcs.operationsdesk.util.UtilInjectionModule;
import org.opentcs.util.ClassMatcher;
import org.opentcs.util.gui.dialog.ConnectionParamSet;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* A Guice module for the openTCS plant overview application.
*/
public class DefaultPlantOverviewInjectionModule
extends
PlantOverviewInjectionModule {
/**
* This class's logger.
*/
private static final Logger LOG
= LoggerFactory.getLogger(DefaultPlantOverviewInjectionModule.class);
/**
* Creates a new instance.
*/
public DefaultPlantOverviewInjectionModule() {
}
@Override
protected void configure() {
File applicationHome = new File(System.getProperty("opentcs.home", "."));
bind(File.class)
.annotatedWith(ApplicationHome.class)
.toInstance(applicationHome);
configurePlantOverviewDependencies();
install(new ApplicationInjectionModule());
install(new ComponentsInjectionModule());
install(new ExchangeInjectionModule());
install(new ModelInjectionModule());
install(new DefaultPersistenceInjectionModule());
install(new TransportInjectionModule());
install(new NotificationInjectionModule());
install(new PeripheralJobInjectionModule());
install(new UtilInjectionModule());
// Ensure there is at least an empty binder for pluggable panels.
pluggablePanelFactoryBinder();
// Ensure there is at least an empty binder for history entry formatters.
objectHistoryEntryFormatterBinder();
}
private void configurePlantOverviewDependencies() {
OperationsDeskConfiguration configuration
= getConfigBindingProvider().get(
OperationsDeskConfiguration.PREFIX,
OperationsDeskConfiguration.class
);
bind(ApplicationPortalProviderConfiguration.class)
.toInstance(configuration);
bind(OperationsDeskConfiguration.class)
.toInstance(configuration);
configurePlantOverview(configuration);
configureThemes(configuration);
configureSocketConnections();
bind(new TypeLiteral<List<ConnectionParamSet>>() {
})
.toInstance(configuration.connectionBookmarks());
}
private void configureSocketConnections() {
SslConfiguration sslConfiguration = getConfigBindingProvider().get(
SslConfiguration.PREFIX,
SslConfiguration.class
);
//Create the data object for the ssl configuration
SslParameterSet sslParamSet = new SslParameterSet(
SslParameterSet.DEFAULT_KEYSTORE_TYPE,
null,
null,
new File(sslConfiguration.truststoreFile()),
sslConfiguration.truststorePassword()
);
bind(SslParameterSet.class).toInstance(sslParamSet);
SocketFactoryProvider socketFactoryProvider;
if (sslConfiguration.enable()) {
socketFactoryProvider = new SecureSocketFactoryProvider(sslParamSet);
}
else {
LOG.warn("SSL encryption disabled, connections will not be secured!");
socketFactoryProvider = new NullSocketFactoryProvider();
}
//Bind socket provider to the kernel portal
bind(KernelServicePortal.class)
.toInstance(
new KernelServicePortalBuilder(
GuestUserCredentials.USER,
GuestUserCredentials.PASSWORD
)
.setSocketFactoryProvider(socketFactoryProvider)
.setEventFilter(new ClassMatcher(LowLevelCommunicationEvent.class).negate())
.build()
);
}
private void configureThemes(OperationsDeskConfiguration configuration) {
bind(LocationTheme.class)
.to(configuration.locationThemeClass())
.in(Singleton.class);
bind(VehicleTheme.class)
.to(configuration.vehicleThemeClass())
.in(Singleton.class);
}
private void configurePlantOverview(
OperationsDeskConfiguration configuration
) {
Locale.setDefault(Locale.forLanguageTag(configuration.locale()));
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
}
catch (ClassNotFoundException | InstantiationException | IllegalAccessException
| UnsupportedLookAndFeelException ex) {
LOG.warn("Could not set look-and-feel", ex);
}
// Show tooltips for 30 seconds (Default: 4 sec)
ToolTipManager.sharedInstance().setDismissDelay(30 * 1000);
}
}

View File

@@ -0,0 +1,52 @@
// SPDX-FileCopyrightText: The openTCS Authors
// SPDX-License-Identifier: MIT
package org.opentcs.operationsdesk;
import java.util.HashSet;
import java.util.Set;
import org.opentcs.common.LoopbackAdapterConstants;
import org.opentcs.components.kernel.Dispatcher;
import org.opentcs.components.kernel.Router;
import org.opentcs.components.kernel.Scheduler;
import org.opentcs.components.plantoverview.PropertySuggestions;
/**
* The default property suggestions of the baseline plant overview.
*/
public class DefaultPropertySuggestions
implements
PropertySuggestions {
private final Set<String> keySuggestions = new HashSet<>();
private final Set<String> valueSuggestions = new HashSet<>();
/**
* Creates a new instance.
*/
public DefaultPropertySuggestions() {
keySuggestions.add(Scheduler.PROPKEY_BLOCK_ENTRY_DIRECTION);
keySuggestions.add(Router.PROPKEY_ROUTING_GROUP);
keySuggestions.add(Dispatcher.PROPKEY_PARKING_POSITION_PRIORITY);
keySuggestions.add(Dispatcher.PROPKEY_ASSIGNED_PARKING_POSITION);
keySuggestions.add(Dispatcher.PROPKEY_PREFERRED_PARKING_POSITION);
keySuggestions.add(Dispatcher.PROPKEY_ASSIGNED_RECHARGE_LOCATION);
keySuggestions.add(Dispatcher.PROPKEY_PREFERRED_RECHARGE_LOCATION);
keySuggestions.add(LoopbackAdapterConstants.PROPKEY_INITIAL_POSITION);
keySuggestions.add(LoopbackAdapterConstants.PROPKEY_OPERATING_TIME);
keySuggestions.add(LoopbackAdapterConstants.PROPKEY_LOAD_OPERATION);
keySuggestions.add(LoopbackAdapterConstants.PROPKEY_UNLOAD_OPERATION);
keySuggestions.add(LoopbackAdapterConstants.PROPKEY_ACCELERATION);
keySuggestions.add(LoopbackAdapterConstants.PROPKEY_DECELERATION);
}
@Override
public Set<String> getKeySuggestions() {
return keySuggestions;
}
@Override
public Set<String> getValueSuggestions() {
return valueSuggestions;
}
}

View File

@@ -0,0 +1,27 @@
// SPDX-FileCopyrightText: The openTCS Authors
// SPDX-License-Identifier: MIT
package org.opentcs.operationsdesk;
import jakarta.inject.Singleton;
import org.opentcs.customizations.plantoverview.PlantOverviewInjectionModule;
/**
* This module configures the multibinder used to suggest key value properties in the editor.
*/
public class PropertySuggestionsModule
extends
PlantOverviewInjectionModule {
/**
* Creates a new instance.
*/
public PropertySuggestionsModule() {
}
@Override
protected void configure() {
propertySuggestionsBinder().addBinding()
.to(DefaultPropertySuggestions.class)
.in(Singleton.class);
}
}

View File

@@ -0,0 +1,135 @@
// SPDX-FileCopyrightText: The openTCS Authors
// SPDX-License-Identifier: MIT
package org.opentcs.operationsdesk;
import com.google.inject.Guice;
import com.google.inject.Injector;
import com.google.inject.Module;
import com.google.inject.util.Modules;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.List;
import java.util.ServiceLoader;
import org.opentcs.configuration.ConfigurationBindingProvider;
import org.opentcs.configuration.gestalt.GestaltConfigurationBindingProvider;
import org.opentcs.customizations.ConfigurableInjectionModule;
import org.opentcs.customizations.plantoverview.PlantOverviewInjectionModule;
import org.opentcs.guing.common.util.CompatibilityChecker;
import org.opentcs.operationsdesk.application.PlantOverviewStarter;
import org.opentcs.util.Environment;
import org.opentcs.util.logging.UncaughtExceptionLogger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* The plant overview process's default entry point.
*/
public class RunOperationsDesk {
/**
* This class's logger.
*/
private static final Logger LOG = LoggerFactory.getLogger(RunOperationsDesk.class);
/**
* Prevents external instantiation.
*/
private RunOperationsDesk() {
}
/**
* The plant overview client's main entry point.
*
* @param args the command line arguments
*/
public static void main(final String[] args) {
Thread.setDefaultUncaughtExceptionHandler(new UncaughtExceptionLogger(false));
Environment.logSystemInfo();
ensureVersionCompatibility();
Injector injector = Guice.createInjector(customConfigurationModule());
injector.getInstance(PlantOverviewStarter.class).startPlantOverview();
}
private static void ensureVersionCompatibility() {
String version = System.getProperty("java.version");
if (!CompatibilityChecker.versionCompatibleWithDockingFrames(version)) {
LOG.error("Version incompatible with Docking Frames: '{}'", version);
CompatibilityChecker.showVersionIncompatibleWithDockingFramesMessage();
System.exit(1);
}
}
/**
* Builds and returns a Guice module containing the custom configuration for the plant overview
* application, including additions and overrides by the user.
*
* @return The custom configuration module.
*/
private static Module customConfigurationModule() {
ConfigurationBindingProvider bindingProvider = configurationBindingProvider();
ConfigurableInjectionModule plantOverviewInjectionModule
= new DefaultPlantOverviewInjectionModule();
plantOverviewInjectionModule.setConfigBindingProvider(bindingProvider);
return Modules.override(plantOverviewInjectionModule)
.with(findRegisteredModules(bindingProvider));
}
/**
* Finds and returns all Guice modules registered via ServiceLoader.
*
* @return The registered/found modules.
*/
private static List<PlantOverviewInjectionModule> findRegisteredModules(
ConfigurationBindingProvider bindingProvider
) {
List<PlantOverviewInjectionModule> registeredModules = new ArrayList<>();
for (PlantOverviewInjectionModule module : ServiceLoader.load(
PlantOverviewInjectionModule.class
)) {
LOG.info(
"Integrating injection module {} (source: {})",
module.getClass().getName(),
module.getClass().getProtectionDomain().getCodeSource()
);
module.setConfigBindingProvider(bindingProvider);
registeredModules.add(module);
}
return registeredModules;
}
private static ConfigurationBindingProvider configurationBindingProvider() {
String chosenProvider = System.getProperty("opentcs.configuration.provider", "gestalt");
switch (chosenProvider) {
case "gestalt":
default:
LOG.info("Using gestalt as the configuration provider.");
return gestaltConfigurationBindingProvider();
}
}
private static ConfigurationBindingProvider gestaltConfigurationBindingProvider() {
return new GestaltConfigurationBindingProvider(
Paths.get(
System.getProperty("opentcs.base", "."),
"config",
"opentcs-operationsdesk-defaults-baseline.properties"
)
.toAbsolutePath(),
Paths.get(
System.getProperty("opentcs.base", "."),
"config",
"opentcs-operationsdesk-defaults-custom.properties"
)
.toAbsolutePath(),
Paths.get(
System.getProperty("opentcs.home", "."),
"config",
"opentcs-operationsdesk.properties"
)
.toAbsolutePath()
);
}
}

View File

@@ -0,0 +1,83 @@
// SPDX-FileCopyrightText: The openTCS Authors
// SPDX-License-Identifier: MIT
package org.opentcs.operationsdesk.application;
import com.google.inject.AbstractModule;
import jakarta.inject.Singleton;
import java.awt.Component;
import javax.swing.JFrame;
import org.jhotdraw.app.Application;
import org.opentcs.common.KernelClientApplication;
import org.opentcs.customizations.plantoverview.ApplicationFrame;
import org.opentcs.guing.common.application.ApplicationState;
import org.opentcs.guing.common.application.ComponentsManager;
import org.opentcs.guing.common.application.GuiManager;
import org.opentcs.guing.common.application.PluginPanelManager;
import org.opentcs.guing.common.application.ProgressIndicator;
import org.opentcs.guing.common.application.SplashFrame;
import org.opentcs.guing.common.application.StatusPanel;
import org.opentcs.guing.common.application.ViewManager;
import org.opentcs.operationsdesk.application.action.ActionInjectionModule;
import org.opentcs.operationsdesk.application.menus.MenusInjectionModule;
import org.opentcs.operationsdesk.application.toolbar.ToolBarInjectionModule;
import org.opentcs.thirdparty.guing.common.jhotdraw.application.action.edit.UndoRedoManager;
import org.opentcs.thirdparty.operationsdesk.jhotdraw.application.OpenTCSSDIApplication;
/**
* An injection module for this package.
*/
public class ApplicationInjectionModule
extends
AbstractModule {
/**
* The application's main frame.
*/
private final JFrame applicationFrame = new JFrame();
/**
* Creates a new instance.
*/
public ApplicationInjectionModule() {
}
@Override
protected void configure() {
install(new ActionInjectionModule());
install(new MenusInjectionModule());
install(new ToolBarInjectionModule());
bind(ApplicationState.class).in(Singleton.class);
bind(UndoRedoManager.class).in(Singleton.class);
bind(ProgressIndicator.class)
.to(SplashFrame.class)
.in(Singleton.class);
bind(StatusPanel.class).in(Singleton.class);
bind(JFrame.class)
.annotatedWith(ApplicationFrame.class)
.toInstance(applicationFrame);
bind(Component.class)
.annotatedWith(ApplicationFrame.class)
.toInstance(applicationFrame);
bind(ViewManagerOperating.class)
.in(Singleton.class);
bind(ViewManager.class).to(ViewManagerOperating.class);
bind(Application.class)
.to(OpenTCSSDIApplication.class)
.in(Singleton.class);
bind(OpenTCSView.class).in(Singleton.class);
bind(GuiManager.class).to(OpenTCSView.class);
bind(ComponentsManager.class).to(OpenTCSView.class);
bind(PluginPanelManager.class).to(OpenTCSView.class);
bind(KernelClientApplication.class)
.to(OperationsDeskApplication.class)
.in(Singleton.class);
}
}

View File

@@ -0,0 +1,29 @@
// SPDX-FileCopyrightText: The openTCS Authors
// SPDX-License-Identifier: MIT
package org.opentcs.operationsdesk.application.action;
import com.google.inject.AbstractModule;
import com.google.inject.assistedinject.FactoryModuleBuilder;
import jakarta.inject.Singleton;
/**
* An injection module for this package.
*/
public class ActionInjectionModule
extends
AbstractModule {
/**
* Creates a new instance.
*/
public ActionInjectionModule() {
}
@Override
protected void configure() {
install(new FactoryModuleBuilder().build(ActionFactory.class));
bind(ViewActionMap.class).in(Singleton.class);
}
}

View File

@@ -0,0 +1,25 @@
// SPDX-FileCopyrightText: The openTCS Authors
// SPDX-License-Identifier: MIT
package org.opentcs.operationsdesk.application.menus;
import com.google.inject.AbstractModule;
import com.google.inject.assistedinject.FactoryModuleBuilder;
/**
*/
public class MenusInjectionModule
extends
AbstractModule {
/**
* Creates a new instance.
*/
public MenusInjectionModule() {
}
@Override
protected void configure() {
install(new FactoryModuleBuilder().build(MenuFactory.class));
}
}

View File

@@ -0,0 +1,36 @@
// SPDX-FileCopyrightText: The openTCS Authors
// SPDX-License-Identifier: MIT
package org.opentcs.operationsdesk.application.toolbar;
import com.google.inject.AbstractModule;
import com.google.inject.assistedinject.FactoryModuleBuilder;
import jakarta.inject.Singleton;
import org.jhotdraw.draw.tool.DragTracker;
import org.jhotdraw.draw.tool.SelectAreaTracker;
import org.opentcs.operationsdesk.application.action.ToolBarManager;
import org.opentcs.thirdparty.guing.common.jhotdraw.application.toolbar.OpenTCSDragTracker;
import org.opentcs.thirdparty.guing.common.jhotdraw.application.toolbar.OpenTCSSelectAreaTracker;
/**
*/
public class ToolBarInjectionModule
extends
AbstractModule {
/**
* Creates a new instance.
*/
public ToolBarInjectionModule() {
}
@Override
protected void configure() {
install(new FactoryModuleBuilder().build(SelectionToolFactory.class));
bind(ToolBarManager.class).in(Singleton.class);
bind(SelectAreaTracker.class).to(OpenTCSSelectAreaTracker.class);
bind(DragTracker.class).to(OpenTCSDragTracker.class);
}
}

View File

@@ -0,0 +1,116 @@
// SPDX-FileCopyrightText: The openTCS Authors
// SPDX-License-Identifier: MIT
package org.opentcs.operationsdesk.components;
import com.google.inject.AbstractModule;
import com.google.inject.PrivateModule;
import jakarta.inject.Singleton;
import java.awt.event.MouseListener;
import org.opentcs.guing.common.components.tree.AbstractTreeViewPanel;
import org.opentcs.guing.common.components.tree.BlockMouseListener;
import org.opentcs.guing.common.components.tree.BlocksTreeViewManager;
import org.opentcs.guing.common.components.tree.BlocksTreeViewPanel;
import org.opentcs.guing.common.components.tree.ComponentsTreeViewManager;
import org.opentcs.guing.common.components.tree.ComponentsTreeViewPanel;
import org.opentcs.guing.common.components.tree.TreeMouseAdapter;
import org.opentcs.guing.common.components.tree.TreeView;
import org.opentcs.operationsdesk.components.dialogs.DialogsInjectionModule;
import org.opentcs.operationsdesk.components.dockable.DockableInjectionModule;
import org.opentcs.operationsdesk.components.drawing.DrawingInjectionModule;
import org.opentcs.operationsdesk.components.layer.LayersInjectionModule;
import org.opentcs.operationsdesk.components.properties.PropertiesInjectionModule;
import org.opentcs.operationsdesk.components.tree.elements.TreeElementsInjectionModule;
/**
* A Guice module for this package.
*/
public class ComponentsInjectionModule
extends
AbstractModule {
/**
* Creates a new instance.
*/
public ComponentsInjectionModule() {
}
@Override
protected void configure() {
install(new DialogsInjectionModule());
install(new DockableInjectionModule());
install(new DrawingInjectionModule());
install(new PropertiesInjectionModule());
install(new TreeElementsInjectionModule());
install(new ComponentsTreeViewModule());
install(new BlocksTreeViewModule());
install(new LayersInjectionModule());
}
private static class ComponentsTreeViewModule
extends
PrivateModule {
ComponentsTreeViewModule() {
}
@Override
protected void configure() {
// Within this (private) module, there should only be a single tree panel.
bind(ComponentsTreeViewPanel.class)
.in(Singleton.class);
// Bind the tree panel annotated with the given annotation to our single
// instance and expose only this annotated version.
bind(AbstractTreeViewPanel.class)
.to(ComponentsTreeViewPanel.class);
expose(ComponentsTreeViewPanel.class);
// Bind TreeView to the single tree panel, too.
bind(TreeView.class)
.to(ComponentsTreeViewPanel.class);
// Bind and expose a single manager for the single tree view/panel.
bind(ComponentsTreeViewManager.class)
.in(Singleton.class);
expose(ComponentsTreeViewManager.class);
bind(MouseListener.class)
.to(TreeMouseAdapter.class);
}
}
private static class BlocksTreeViewModule
extends
PrivateModule {
BlocksTreeViewModule() {
}
@Override
protected void configure() {
// Within this (private) module, there should only be a single tree panel.
bind(BlocksTreeViewPanel.class)
.in(Singleton.class);
// Bind the tree panel annotated with the given annotation to our single
// instance and expose only this annotated version.
bind(AbstractTreeViewPanel.class)
.to(BlocksTreeViewPanel.class);
expose(BlocksTreeViewPanel.class);
// Bind TreeView to the single tree panel, too.
bind(TreeView.class)
.to(BlocksTreeViewPanel.class);
// Bind and expose a single manager for the single tree view/panel.
bind(BlocksTreeViewManager.class)
.in(Singleton.class);
expose(BlocksTreeViewManager.class);
bind(MouseListener.class)
.to(BlockMouseListener.class);
}
}
}

View File

@@ -0,0 +1,29 @@
// SPDX-FileCopyrightText: The openTCS Authors
// SPDX-License-Identifier: MIT
package org.opentcs.operationsdesk.components.dialogs;
import com.google.inject.AbstractModule;
import com.google.inject.assistedinject.FactoryModuleBuilder;
import jakarta.inject.Singleton;
/**
* A Guice module for this package.
*/
public class DialogsInjectionModule
extends
AbstractModule {
/**
* Creates a new instance.
*/
public DialogsInjectionModule() {
}
@Override
protected void configure() {
install(new FactoryModuleBuilder().build(SingleVehicleViewFactory.class));
install(new FactoryModuleBuilder().build(FindVehiclePanelFactory.class));
bind(VehiclesPanel.class).in(Singleton.class);
}
}

View File

@@ -0,0 +1,31 @@
// SPDX-FileCopyrightText: The openTCS Authors
// SPDX-License-Identifier: MIT
package org.opentcs.operationsdesk.components.dockable;
import com.google.inject.AbstractModule;
import com.google.inject.assistedinject.FactoryModuleBuilder;
import jakarta.inject.Singleton;
import org.opentcs.guing.common.components.dockable.DockableHandlerFactory;
import org.opentcs.guing.common.components.dockable.DockingManager;
/**
* A Guice module for this package.
*/
public class DockableInjectionModule
extends
AbstractModule {
/**
* Creates a new instance.
*/
public DockableInjectionModule() {
}
@Override
protected void configure() {
install(new FactoryModuleBuilder().build(DockableHandlerFactory.class));
bind(DockingManagerOperating.class).in(Singleton.class);
bind(DockingManager.class).to(DockingManagerOperating.class);
}
}

View File

@@ -0,0 +1,48 @@
// SPDX-FileCopyrightText: The openTCS Authors
// SPDX-License-Identifier: MIT
package org.opentcs.operationsdesk.components.drawing;
import com.google.inject.AbstractModule;
import com.google.inject.assistedinject.FactoryModuleBuilder;
import jakarta.inject.Singleton;
import org.jhotdraw.draw.DrawingEditor;
import org.opentcs.guing.common.components.drawing.DrawingOptions;
import org.opentcs.guing.common.components.drawing.OpenTCSDrawingEditor;
import org.opentcs.guing.common.components.drawing.OpenTCSDrawingView;
import org.opentcs.guing.common.components.drawing.figures.ToolTipTextGenerator;
import org.opentcs.guing.common.util.CourseObjectFactory;
import org.opentcs.operationsdesk.components.drawing.figures.ToolTipTextGeneratorOperationsDesk;
import org.opentcs.operationsdesk.components.drawing.figures.VehicleFigureFactory;
import org.opentcs.operationsdesk.util.VehicleCourseObjectFactory;
import org.opentcs.thirdparty.operationsdesk.components.drawing.OpenTCSDrawingViewOperating;
/**
* A Guice module for this package.
*/
public class DrawingInjectionModule
extends
AbstractModule {
/**
* Creates a new instance.
*/
public DrawingInjectionModule() {
}
@Override
protected void configure() {
install(new FactoryModuleBuilder().build(VehicleFigureFactory.class));
bind(CourseObjectFactory.class).to(VehicleCourseObjectFactory.class);
bind(OpenTCSDrawingEditorOperating.class).in(Singleton.class);
bind(OpenTCSDrawingEditor.class).to(OpenTCSDrawingEditorOperating.class);
bind(DrawingEditor.class).to(OpenTCSDrawingEditorOperating.class);
bind(OpenTCSDrawingView.class).to(OpenTCSDrawingViewOperating.class);
bind(DrawingOptions.class).in(Singleton.class);
bind(ToolTipTextGeneratorOperationsDesk.class).in(Singleton.class);
bind(ToolTipTextGenerator.class).to(ToolTipTextGeneratorOperationsDesk.class);
}
}

View File

@@ -0,0 +1,37 @@
// SPDX-FileCopyrightText: The openTCS Authors
// SPDX-License-Identifier: MIT
package org.opentcs.operationsdesk.components.layer;
import jakarta.inject.Singleton;
import org.opentcs.customizations.plantoverview.PlantOverviewInjectionModule;
import org.opentcs.guing.common.components.layer.DefaultLayerManager;
import org.opentcs.guing.common.components.layer.LayerEditor;
import org.opentcs.guing.common.components.layer.LayerGroupEditor;
import org.opentcs.guing.common.components.layer.LayerGroupManager;
import org.opentcs.guing.common.components.layer.LayerManager;
/**
* A Guice module for this package.
*/
public class LayersInjectionModule
extends
PlantOverviewInjectionModule {
/**
* Creates a new instance.
*/
public LayersInjectionModule() {
}
@Override
protected void configure() {
bind(DefaultLayerManager.class).in(Singleton.class);
bind(LayerManager.class).to(DefaultLayerManager.class);
bind(LayerEditor.class).to(DefaultLayerManager.class);
bind(LayersPanel.class).in(Singleton.class);
bind(LayerGroupManager.class).to(DefaultLayerManager.class);
bind(LayerGroupEditor.class).to(DefaultLayerManager.class);
bind(LayerGroupsPanel.class).in(Singleton.class);
}
}

View File

@@ -0,0 +1,90 @@
// SPDX-FileCopyrightText: The openTCS Authors
// SPDX-License-Identifier: MIT
package org.opentcs.operationsdesk.components.properties;
import com.google.inject.TypeLiteral;
import com.google.inject.assistedinject.FactoryModuleBuilder;
import com.google.inject.multibindings.MapBinder;
import jakarta.inject.Singleton;
import org.opentcs.customizations.plantoverview.PlantOverviewInjectionModule;
import org.opentcs.guing.base.components.properties.type.AbstractComplexProperty;
import org.opentcs.guing.base.components.properties.type.EnergyLevelThresholdSetProperty;
import org.opentcs.guing.base.components.properties.type.KeyValueProperty;
import org.opentcs.guing.base.components.properties.type.KeyValueSetProperty;
import org.opentcs.guing.base.components.properties.type.LinkActionsProperty;
import org.opentcs.guing.base.components.properties.type.LocationTypeActionsProperty;
import org.opentcs.guing.base.components.properties.type.OrderTypesProperty;
import org.opentcs.guing.base.components.properties.type.ResourceProperty;
import org.opentcs.guing.base.components.properties.type.SymbolProperty;
import org.opentcs.guing.common.components.dialogs.DetailsDialogContent;
import org.opentcs.guing.common.components.properties.PropertiesComponentsFactory;
import org.opentcs.guing.common.components.properties.SelectionPropertiesComponent;
import org.opentcs.guing.common.components.properties.panel.EnergyLevelThresholdSetPropertyEditorPanel;
import org.opentcs.guing.common.components.properties.panel.KeyValuePropertyEditorPanel;
import org.opentcs.guing.common.components.properties.panel.KeyValueSetPropertyViewerEditorPanel;
import org.opentcs.guing.common.components.properties.panel.LinkActionsEditorPanel;
import org.opentcs.guing.common.components.properties.panel.LocationTypeActionsEditorPanel;
import org.opentcs.guing.common.components.properties.panel.OrderTypesPropertyEditorPanel;
import org.opentcs.guing.common.components.properties.panel.PropertiesPanelFactory;
import org.opentcs.guing.common.components.properties.panel.ResourcePropertyViewerEditorPanel;
import org.opentcs.guing.common.components.properties.panel.SymbolPropertyEditorPanel;
import org.opentcs.guing.common.components.properties.table.CellEditorFactory;
/**
* A Guice module for this package.
*/
public class PropertiesInjectionModule
extends
PlantOverviewInjectionModule {
/**
* Creates a new instance.
*/
public PropertiesInjectionModule() {
}
@Override
protected void configure() {
install(new FactoryModuleBuilder().build(PropertiesPanelFactory.class));
install(new FactoryModuleBuilder().build(CellEditorFactory.class));
install(new FactoryModuleBuilder().build(PropertiesComponentsFactory.class));
MapBinder<Class<? extends AbstractComplexProperty>, DetailsDialogContent> dialogContentMapBinder
= MapBinder.newMapBinder(
binder(),
new TypeLiteral<Class<? extends AbstractComplexProperty>>() {
},
new TypeLiteral<DetailsDialogContent>() {
}
);
dialogContentMapBinder
.addBinding(KeyValueProperty.class)
.to(KeyValuePropertyEditorPanel.class);
dialogContentMapBinder
.addBinding(KeyValueSetProperty.class)
.to(KeyValueSetPropertyViewerEditorPanel.class);
dialogContentMapBinder
.addBinding(LocationTypeActionsProperty.class)
.to(LocationTypeActionsEditorPanel.class);
dialogContentMapBinder
.addBinding(LinkActionsProperty.class)
.to(LinkActionsEditorPanel.class);
dialogContentMapBinder
.addBinding(SymbolProperty.class)
.to(SymbolPropertyEditorPanel.class);
dialogContentMapBinder
.addBinding(OrderTypesProperty.class)
.to(OrderTypesPropertyEditorPanel.class);
dialogContentMapBinder
.addBinding(EnergyLevelThresholdSetProperty.class)
.to(EnergyLevelThresholdSetPropertyEditorPanel.class);
dialogContentMapBinder
.addBinding(ResourceProperty.class)
.to(ResourcePropertyViewerEditorPanel.class);
bind(SelectionPropertiesComponent.class)
.in(Singleton.class);
}
}

View File

@@ -0,0 +1,31 @@
// SPDX-FileCopyrightText: The openTCS Authors
// SPDX-License-Identifier: MIT
package org.opentcs.operationsdesk.components.tree.elements;
import com.google.inject.AbstractModule;
import com.google.inject.assistedinject.FactoryModuleBuilder;
import org.opentcs.guing.common.components.tree.elements.UserObjectFactory;
import org.opentcs.guing.common.components.tree.elements.VehicleUserObject;
/**
* A Guice module for this package.
*/
public class TreeElementsInjectionModule
extends
AbstractModule {
/**
* Creates a new instance.
*/
public TreeElementsInjectionModule() {
}
@Override
protected void configure() {
install(
new FactoryModuleBuilder()
.implement(VehicleUserObject.class, VehicleUserObjectOperating.class)
.build(UserObjectFactory.class)
);
}
}

View File

@@ -0,0 +1,68 @@
// SPDX-FileCopyrightText: The openTCS Authors
// SPDX-License-Identifier: MIT
package org.opentcs.operationsdesk.exchange;
import com.google.inject.AbstractModule;
import jakarta.inject.Singleton;
import org.opentcs.access.SharedKernelServicePortalProvider;
import org.opentcs.common.DefaultPortalManager;
import org.opentcs.common.PortalManager;
import org.opentcs.customizations.ApplicationEventBus;
import org.opentcs.guing.common.exchange.AllocationHistory;
import org.opentcs.guing.common.exchange.ApplicationPortalProvider;
import org.opentcs.guing.common.exchange.adapter.VehicleAdapter;
import org.opentcs.operationsdesk.exchange.adapter.OpsDeskVehicleAdapter;
import org.opentcs.util.event.EventBus;
import org.opentcs.util.event.EventHandler;
import org.opentcs.util.event.EventSource;
import org.opentcs.util.event.SimpleEventBus;
/**
* A Guice configuration module for this package.
*/
public class ExchangeInjectionModule
extends
AbstractModule {
/**
* Creates a new instance.
*/
public ExchangeInjectionModule() {
}
@Override
protected void configure() {
bind(PortalManager.class)
.to(DefaultPortalManager.class)
.in(Singleton.class);
bind(KernelEventFetcher.class)
.in(Singleton.class);
EventBus eventBus = new SimpleEventBus();
bind(EventSource.class)
.annotatedWith(ApplicationEventBus.class)
.toInstance(eventBus);
bind(EventHandler.class)
.annotatedWith(ApplicationEventBus.class)
.toInstance(eventBus);
bind(EventBus.class)
.annotatedWith(ApplicationEventBus.class)
.toInstance(eventBus);
bind(SharedKernelServicePortalProvider.class)
.to(ApplicationPortalProvider.class)
.in(Singleton.class);
bind(AttributeAdapterRegistry.class)
.in(Singleton.class);
bind(OpenTCSEventDispatcher.class)
.in(Singleton.class);
bind(AllocationHistory.class)
.in(Singleton.class);
bind(VehicleAdapter.class)
.to(OpsDeskVehicleAdapter.class);
}
}

View File

@@ -0,0 +1,26 @@
// SPDX-FileCopyrightText: The openTCS Authors
// SPDX-License-Identifier: MIT
package org.opentcs.operationsdesk.model;
import com.google.inject.AbstractModule;
import org.opentcs.guing.common.model.SystemModel;
/**
* A Guice module for the model package.
*/
public class ModelInjectionModule
extends
AbstractModule {
/**
* Creates a new instance.
*/
public ModelInjectionModule() {
}
@Override
protected void configure() {
bind(SystemModel.class).to(CachedSystemModel.class);
}
}

View File

@@ -0,0 +1,30 @@
// SPDX-FileCopyrightText: The openTCS Authors
// SPDX-License-Identifier: MIT
package org.opentcs.operationsdesk.notifications;
import com.google.inject.AbstractModule;
import com.google.inject.assistedinject.FactoryModuleBuilder;
import jakarta.inject.Singleton;
/**
* A Guice module for this package.
*/
public class NotificationInjectionModule
extends
AbstractModule {
/**
* Creates a new instance.
*/
public NotificationInjectionModule() {
}
@Override
protected void configure() {
install(new FactoryModuleBuilder().build(UserNotificationViewFactory.class));
bind(UserNotificationsContainer.class)
.in(Singleton.class);
}
}

View File

@@ -0,0 +1,27 @@
// SPDX-FileCopyrightText: The openTCS Authors
// SPDX-License-Identifier: MIT
package org.opentcs.operationsdesk.peripherals.jobs;
import com.google.inject.AbstractModule;
import com.google.inject.assistedinject.FactoryModuleBuilder;
import jakarta.inject.Singleton;
/**
* A Guice module for this package.
*/
public class PeripheralJobInjectionModule
extends
AbstractModule {
/**
* Creates a new instance.
*/
public PeripheralJobInjectionModule() {
}
@Override
protected void configure() {
install(new FactoryModuleBuilder().build(PeripheralJobViewFactory.class));
bind(PeripheralJobsContainer.class).in(Singleton.class);
}
}

View File

@@ -0,0 +1,32 @@
// SPDX-FileCopyrightText: The openTCS Authors
// SPDX-License-Identifier: MIT
package org.opentcs.operationsdesk.persistence;
import com.google.inject.AbstractModule;
import com.google.inject.Singleton;
import org.opentcs.guing.common.persistence.ModelFilePersistor;
import org.opentcs.guing.common.persistence.ModelManager;
import org.opentcs.guing.common.persistence.OpenTCSModelManager;
import org.opentcs.guing.common.persistence.unified.UnifiedModelPersistor;
/**
* Default bindings for model readers and persistors.
*/
public class DefaultPersistenceInjectionModule
extends
AbstractModule {
/**
* Creates a new instance.
*/
public DefaultPersistenceInjectionModule() {
}
@Override
protected void configure() {
bind(ModelManager.class).to(OpenTCSModelManager.class).in(Singleton.class);
bind(ModelFilePersistor.class).to(UnifiedModelPersistor.class);
}
}

View File

@@ -0,0 +1,36 @@
// SPDX-FileCopyrightText: The openTCS Authors
// SPDX-License-Identifier: MIT
package org.opentcs.operationsdesk.transport;
import java.util.HashSet;
import java.util.Set;
import org.opentcs.components.plantoverview.OrderTypeSuggestions;
import org.opentcs.data.order.OrderConstants;
/**
* The default suggestions for transport order types.
*/
public class DefaultOrderTypeSuggestions
implements
OrderTypeSuggestions {
/**
* The transport order type suggestions.
*/
private final Set<String> typeSuggestions = new HashSet<>();
/**
* Creates a new instance.
*/
public DefaultOrderTypeSuggestions() {
typeSuggestions.add(OrderConstants.TYPE_NONE);
typeSuggestions.add(OrderConstants.TYPE_CHARGE);
typeSuggestions.add(OrderConstants.TYPE_PARK);
typeSuggestions.add(OrderConstants.TYPE_TRANSPORT);
}
@Override
public Set<String> getTypeSuggestions() {
return typeSuggestions;
}
}

View File

@@ -0,0 +1,30 @@
// SPDX-FileCopyrightText: The openTCS Authors
// SPDX-License-Identifier: MIT
package org.opentcs.operationsdesk.transport;
import jakarta.inject.Singleton;
import org.opentcs.customizations.plantoverview.PlantOverviewInjectionModule;
import org.opentcs.guing.common.transport.OrderTypeSuggestionsPool;
/**
* A Guice module for the transport order type suggestions.
*/
public class OrderTypeSuggestionsModule
extends
PlantOverviewInjectionModule {
/**
* Creates a new instance.
*/
public OrderTypeSuggestionsModule() {
}
@Override
protected void configure() {
orderTypeSuggestionsBinder().addBinding()
.to(DefaultOrderTypeSuggestions.class)
.in(Singleton.class);
bind(OrderTypeSuggestionsPool.class).in(Singleton.class);
}
}

View File

@@ -0,0 +1,35 @@
// SPDX-FileCopyrightText: The openTCS Authors
// SPDX-License-Identifier: MIT
package org.opentcs.operationsdesk.transport;
import com.google.inject.AbstractModule;
import com.google.inject.assistedinject.FactoryModuleBuilder;
import jakarta.inject.Singleton;
import org.opentcs.operationsdesk.transport.orders.TransportOrdersContainer;
import org.opentcs.operationsdesk.transport.orders.TransportViewFactory;
import org.opentcs.operationsdesk.transport.sequences.OrderSequencesContainer;
/**
* A Guice module for this package.
*/
public class TransportInjectionModule
extends
AbstractModule {
/**
* Creates a new instance.
*/
public TransportInjectionModule() {
}
@Override
protected void configure() {
install(new FactoryModuleBuilder().build(TransportViewFactory.class));
bind(TransportOrdersContainer.class)
.in(Singleton.class);
bind(OrderSequencesContainer.class)
.in(Singleton.class);
}
}

View File

@@ -0,0 +1,26 @@
// SPDX-FileCopyrightText: The openTCS Authors
// SPDX-License-Identifier: MIT
package org.opentcs.operationsdesk.util;
import com.google.inject.AbstractModule;
import jakarta.inject.Singleton;
import org.opentcs.guing.common.util.PanelRegistry;
/**
* A default Guice module for this package.
*/
public class UtilInjectionModule
extends
AbstractModule {
/**
* Creates a new instance.
*/
public UtilInjectionModule() {
}
@Override
protected void configure() {
bind(PanelRegistry.class).in(Singleton.class);
}
}

View File

@@ -0,0 +1,6 @@
# SPDX-FileCopyrightText: The openTCS Authors
# SPDX-License-Identifier: MIT
org.opentcs.operationsdesk.DefaultImportersExportersModule
org.opentcs.operationsdesk.PropertySuggestionsModule
org.opentcs.operationsdesk.transport.OrderTypeSuggestionsModule