Package jadex.tools.jcc
Class PlatformControlCenter
- java.lang.Object
-
- jadex.tools.jcc.PlatformControlCenter
-
- All Implemented Interfaces:
IControlCenter,IPropertiesProvider
public class PlatformControlCenter extends java.lang.Object implements IControlCenter, IPropertiesProvider
A control center for a single platform.
-
-
Field Summary
Fields Modifier and Type Field Description protected ControlCentercontrolcenterThe global control center.protected ILibraryServicelibserviceThe library service.protected PlatformControlCenterPanelpccpanelThe single platform control center panel.protected IExternalAccessplatformaccessThe platform access.protected java.util.List<Tuple2<IControlCenterPlugin,javax.swing.JComponent>>pluginsThe plugins (plugin->panel).protected PropertiespropsThe settings of the control center and all plugins.protected java.util.Map<IControlCenterPlugin,java.lang.Boolean>toolbarvisThe plugin toolbar visibility.
-
Constructor Summary
Constructors Constructor Description PlatformControlCenter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IFuture<java.lang.Void>activatePlugin(IControlCenterPlugin plugin)Activate a plugin.protected IFuture<IControlCenterPlugin>addPlugin(java.lang.Class<?> plclass)protected IFuture<IControlCenterPlugin>addPlugin(java.lang.String clname, java.lang.ClassLoader cl)protected voidaddPluginComponent(IControlCenterPlugin pl, javax.swing.JComponent comp)voidaddStatusComponent(java.lang.Object id, javax.swing.JComponent comp)Add a component to the status bar.voiddisplayError(java.lang.String errortitle, java.lang.String errormessage, java.lang.Exception exception)Display an error dialog.IFuture<java.lang.Void>dispose()Close all active plugins.IFuture<java.lang.ClassLoader>getClassLoader(IResourceIdentifier rid)Get the resource identifier.CMSUpdateHandlergetCMSHandler()Get the cms update handler shared by all tools.ControlCentergetControlCenter()Get the global control center.ComponentIconCachegetIconCache()Get the component icon cache shared by all tools.IExternalAccessgetJCCAccess()Get the jcc access.PlatformControlCenterPanelgetPanel()Get the control center panel.IExternalAccessgetPlatformAccess()Get the platform access.protected javax.swing.JComponentgetPluginComponent(IControlCenterPlugin pl)IControlCenterPlugingetPluginForName(java.lang.String name)Find a plugin by name.protected intgetPluginIndex(IControlCenterPlugin pl)IControlCenterPlugin[]getPlugins()Get all plugins.protected Tuple2<IControlCenterPlugin,javax.swing.JComponent>getPluginTuple(IControlCenterPlugin pl)IFuture<Properties>getProperties()Get the current state as properties.PropertyUpdateHandlergetPropertyHandler()Get the property update handler shared by all tools.javax.swing.JComponentgetStatusComponent(java.lang.Object id)Get a component from the status bar.IControlCenterPlugin[]getToolbarPlugins(boolean vis)Get the toolbar plugins that are visible or not visible.IFuture<java.lang.Void>init(IExternalAccess platformaccess, ControlCenter controlcenter, java.lang.String[] plugin_classes)Initialize a control center.protected IFuture<java.lang.Void>initPlugin(IControlCenterPlugin plugin)booleanisPluginVisible(IControlCenterPlugin pl)Test if a plugin is visible in the toolbar.protected IFuture<java.lang.Void>loadPlugins(Property[] ps, int i, java.util.List<Tuple2<IControlCenterPlugin,javax.swing.JComponent>> newpls, java.lang.ClassLoader cl)Load plugins iteratively.protected voidmoveLeftPlugin(IControlCenterPlugin pl)protected voidmoveRightPlugin(IControlCenterPlugin pl)protected voidremovePluginComponent(IControlCenterPlugin pl)voidremoveStatusComponent(java.lang.Object id)Remove a previously added component from the status bar.IFuture<java.lang.Void>savePlatformProperties()Push plugin settings to platform and save platform properties.voidsetPluginVisible(IControlCenterPlugin pl, boolean vis)Set the visible state of a plugin.IFuture<java.lang.Void>setProperties(Properties props)Set state from given properties.voidsetStatusText(java.lang.String text)Set a text to be displayed in the status bar.voidshowPlatform(IExternalAccess platformaccess)Add a new platform control center or switch to tab if already exists.voidshowPlugin(java.lang.String name)Switch to a plugin.
-
-
-
Field Detail
-
platformaccess
protected IExternalAccess platformaccess
The platform access.
-
plugins
protected java.util.List<Tuple2<IControlCenterPlugin,javax.swing.JComponent>> plugins
The plugins (plugin->panel).
-
toolbarvis
protected java.util.Map<IControlCenterPlugin,java.lang.Boolean> toolbarvis
The plugin toolbar visibility.
-
controlcenter
protected ControlCenter controlcenter
The global control center.
-
pccpanel
protected PlatformControlCenterPanel pccpanel
The single platform control center panel.
-
props
protected Properties props
The settings of the control center and all plugins.
-
libservice
protected ILibraryService libservice
The library service.
-
-
Method Detail
-
init
public IFuture<java.lang.Void> init(IExternalAccess platformaccess, ControlCenter controlcenter, java.lang.String[] plugin_classes)
Initialize a control center.
-
addPlugin
protected IFuture<IControlCenterPlugin> addPlugin(java.lang.String clname, java.lang.ClassLoader cl)
-
addPlugin
protected IFuture<IControlCenterPlugin> addPlugin(java.lang.Class<?> plclass)
-
getPluginComponent
protected javax.swing.JComponent getPluginComponent(IControlCenterPlugin pl)
-
getPluginTuple
protected Tuple2<IControlCenterPlugin,javax.swing.JComponent> getPluginTuple(IControlCenterPlugin pl)
-
addPluginComponent
protected void addPluginComponent(IControlCenterPlugin pl, javax.swing.JComponent comp)
-
removePluginComponent
protected void removePluginComponent(IControlCenterPlugin pl)
-
moveLeftPlugin
protected void moveLeftPlugin(IControlCenterPlugin pl)
-
moveRightPlugin
protected void moveRightPlugin(IControlCenterPlugin pl)
-
getPluginIndex
protected int getPluginIndex(IControlCenterPlugin pl)
-
dispose
public IFuture<java.lang.Void> dispose()
Close all active plugins. Called when the JCC exits.
-
getClassLoader
public IFuture<java.lang.ClassLoader> getClassLoader(IResourceIdentifier rid)
Get the resource identifier.- Specified by:
getClassLoaderin interfaceIControlCenter
-
getPanel
public PlatformControlCenterPanel getPanel()
Get the control center panel.
-
savePlatformProperties
public IFuture<java.lang.Void> savePlatformProperties()
Push plugin settings to platform and save platform properties.
-
isPluginVisible
public boolean isPluginVisible(IControlCenterPlugin pl)
Test if a plugin is visible in the toolbar.- Parameters:
pl- The plugin.- Returns:
- True, if is visible.
-
setPluginVisible
public void setPluginVisible(IControlCenterPlugin pl, boolean vis)
Set the visible state of a plugin.
-
getToolbarPlugins
public IControlCenterPlugin[] getToolbarPlugins(boolean vis)
Get the toolbar plugins that are visible or not visible.
-
getControlCenter
public ControlCenter getControlCenter()
Get the global control center.
-
getPlugins
public IControlCenterPlugin[] getPlugins()
Get all plugins.
-
getPluginForName
public IControlCenterPlugin getPluginForName(java.lang.String name)
Find a plugin by name.- Returns:
- null, when plugin is not found.
-
activatePlugin
public IFuture<java.lang.Void> activatePlugin(IControlCenterPlugin plugin)
Activate a plugin.
-
initPlugin
protected IFuture<java.lang.Void> initPlugin(IControlCenterPlugin plugin)
-
setProperties
public IFuture<java.lang.Void> setProperties(Properties props)
Set state from given properties.- Specified by:
setPropertiesin interfaceIPropertiesProvider
-
loadPlugins
protected IFuture<java.lang.Void> loadPlugins(Property[] ps, int i, java.util.List<Tuple2<IControlCenterPlugin,javax.swing.JComponent>> newpls, java.lang.ClassLoader cl)
Load plugins iteratively.
-
getProperties
public IFuture<Properties> getProperties()
Get the current state as properties.- Specified by:
getPropertiesin interfaceIPropertiesProvider
-
showPlatform
public void showPlatform(IExternalAccess platformaccess)
Add a new platform control center or switch to tab if already exists.- Specified by:
showPlatformin interfaceIControlCenter
-
showPlugin
public void showPlugin(java.lang.String name)
Switch to a plugin. Shows the plugin, if available.- Specified by:
showPluginin interfaceIControlCenter
-
setStatusText
public void setStatusText(java.lang.String text)
Set a text to be displayed in the status bar. The text will be removed automatically after some delay (or replaced by some other text).- Specified by:
setStatusTextin interfaceIControlCenter
-
getStatusComponent
public javax.swing.JComponent getStatusComponent(java.lang.Object id)
Get a component from the status bar.- Specified by:
getStatusComponentin interfaceIControlCenter- Parameters:
id- Id used for adding a component.- Returns:
- The component to display.
-
addStatusComponent
public void addStatusComponent(java.lang.Object id, javax.swing.JComponent comp)Add a component to the status bar.- Specified by:
addStatusComponentin interfaceIControlCenter- Parameters:
id- An id for later reference.comp- An id for later reference.
-
removeStatusComponent
public void removeStatusComponent(java.lang.Object id)
Remove a previously added component from the status bar.- Specified by:
removeStatusComponentin interfaceIControlCenter- Parameters:
id- The id used for adding the component.
-
displayError
public void displayError(java.lang.String errortitle, java.lang.String errormessage, java.lang.Exception exception)Display an error dialog.- Specified by:
displayErrorin interfaceIControlCenter- Parameters:
errortitle- The title to use for an error dialog (required).errormessage- An optional error message displayed before the exception.exception- The exception (if any).
-
getPlatformAccess
public IExternalAccess getPlatformAccess()
Get the platform access.- Specified by:
getPlatformAccessin interfaceIControlCenter- Returns:
- The external access.
-
getJCCAccess
public IExternalAccess getJCCAccess()
Get the jcc access.- Specified by:
getJCCAccessin interfaceIControlCenter- Returns:
- The external access.
-
getCMSHandler
public CMSUpdateHandler getCMSHandler()
Get the cms update handler shared by all tools.- Specified by:
getCMSHandlerin interfaceIControlCenter
-
getPropertyHandler
public PropertyUpdateHandler getPropertyHandler()
Get the property update handler shared by all tools.- Specified by:
getPropertyHandlerin interfaceIControlCenter
-
getIconCache
public ComponentIconCache getIconCache()
Get the component icon cache shared by all tools.- Specified by:
getIconCachein interfaceIControlCenter
-
-