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 ControlCenter
controlcenter
The global control center.protected ILibraryService
libservice
The library service.protected PlatformControlCenterPanel
pccpanel
The single platform control center panel.protected IExternalAccess
platformaccess
The platform access.protected java.util.List<Tuple2<IControlCenterPlugin,javax.swing.JComponent>>
plugins
The plugins (plugin->panel).protected Properties
props
The settings of the control center and all plugins.protected java.util.Map<IControlCenterPlugin,java.lang.Boolean>
toolbarvis
The 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 void
addPluginComponent(IControlCenterPlugin pl, javax.swing.JComponent comp)
void
addStatusComponent(java.lang.Object id, javax.swing.JComponent comp)
Add a component to the status bar.void
displayError(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.CMSUpdateHandler
getCMSHandler()
Get the cms update handler shared by all tools.ControlCenter
getControlCenter()
Get the global control center.ComponentIconCache
getIconCache()
Get the component icon cache shared by all tools.IExternalAccess
getJCCAccess()
Get the jcc access.PlatformControlCenterPanel
getPanel()
Get the control center panel.IExternalAccess
getPlatformAccess()
Get the platform access.protected javax.swing.JComponent
getPluginComponent(IControlCenterPlugin pl)
IControlCenterPlugin
getPluginForName(java.lang.String name)
Find a plugin by name.protected int
getPluginIndex(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.PropertyUpdateHandler
getPropertyHandler()
Get the property update handler shared by all tools.javax.swing.JComponent
getStatusComponent(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)
boolean
isPluginVisible(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 void
moveLeftPlugin(IControlCenterPlugin pl)
protected void
moveRightPlugin(IControlCenterPlugin pl)
protected void
removePluginComponent(IControlCenterPlugin pl)
void
removeStatusComponent(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.void
setPluginVisible(IControlCenterPlugin pl, boolean vis)
Set the visible state of a plugin.IFuture<java.lang.Void>
setProperties(Properties props)
Set state from given properties.void
setStatusText(java.lang.String text)
Set a text to be displayed in the status bar.void
showPlatform(IExternalAccess platformaccess)
Add a new platform control center or switch to tab if already exists.void
showPlugin(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:
getClassLoader
in 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:
setProperties
in 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:
getProperties
in interfaceIPropertiesProvider
-
showPlatform
public void showPlatform(IExternalAccess platformaccess)
Add a new platform control center or switch to tab if already exists.- Specified by:
showPlatform
in interfaceIControlCenter
-
showPlugin
public void showPlugin(java.lang.String name)
Switch to a plugin. Shows the plugin, if available.- Specified by:
showPlugin
in 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:
setStatusText
in interfaceIControlCenter
-
getStatusComponent
public javax.swing.JComponent getStatusComponent(java.lang.Object id)
Get a component from the status bar.- Specified by:
getStatusComponent
in 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:
addStatusComponent
in 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:
removeStatusComponent
in 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:
displayError
in 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:
getPlatformAccess
in interfaceIControlCenter
- Returns:
- The external access.
-
getJCCAccess
public IExternalAccess getJCCAccess()
Get the jcc access.- Specified by:
getJCCAccess
in interfaceIControlCenter
- Returns:
- The external access.
-
getCMSHandler
public CMSUpdateHandler getCMSHandler()
Get the cms update handler shared by all tools.- Specified by:
getCMSHandler
in interfaceIControlCenter
-
getPropertyHandler
public PropertyUpdateHandler getPropertyHandler()
Get the property update handler shared by all tools.- Specified by:
getPropertyHandler
in interfaceIControlCenter
-
getIconCache
public ComponentIconCache getIconCache()
Get the component icon cache shared by all tools.- Specified by:
getIconCache
in interfaceIControlCenter
-
-