public class TabExtension extends CodeExtension
Title: CASA Agent Infrastructure
Copyright: Copyright (c) 2003-2014, Knowledge Science Group, University of Calgary. Permission to use, copy, modify, distribute and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The Knowledge Science Group makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty.
Company: Knowledge Science Group, Department of Computer Science, University of Calgary
An extension that loads itself as a GUI tab pane into aAbstractInternalFrame
frame. TabExtension classes/objects are never
loaded/instantiated until the tab is displayed (made visible) to save on
memory. TabExtensions are always placed in the menu "Tools|Tabs|[tabName]",
but they are only actually shown as a [tabName] tab if the specified by the
descriptor's #AUTOLOAD
attribute is true (or the menu item is
selected, of course). Attributes in jar manifest file:
Extension#ATTR_MAINCLASS
- .
Defaults to the value Main-Class in the manifest main section.
Extension.ATTR_EXTENSIONNAME
-
. Defaults to name (only) of the value
of Extension#ATTR_MAINCLASS
.
ATTR_TABNAME
- "tabName". The text on the tab or
the tab pane. Defaults to ATTR_EXTENSIONNAME.
Extension.ATTR_AUTOLOAD
- . Will display the tab
automatically (initially) iff this is true. Defaults false.
Extension.ATTR_AGENTTYPE
- . Any agent we are
applying this extension to must be a subtype of this. Defaults to
TransientAgent
.
Modifier and Type | Field and Description |
---|---|
static String |
ATTR_TABNAME
The text on the tab itself
|
ATTR_MAINCLASS
ATTR_AGENTTYPE, ATTR_AUTOLOAD, ATTR_DOC, ATTR_EXTENSIONNAME, ATTR_FRAMETYPE, descriptor, TYPE_CODE, TYPE_LISPSCRIPT, TYPE_TAB
Constructor and Description |
---|
TabExtension(ExtensionDescriptor d)
Constructs a new tab extension.
|
Modifier and Type | Method and Description |
---|---|
(package private) void |
load(AbstractInternalFrame frame,
AbstractProcess agent)
If this extension is applicable to the agent (according to
ATTR_AGENTTYPE ) and frame
(according to ATTR_FRAMETYPE ),
instantiates a tab pane in the
agent's frame with the name specified by the descriptor's
ATTR_TABNAME . |
protected Object |
loadFromJar(Class<?>[] constructorTypes,
Object[] constructorObjects)
Loads the jar (specified by the descriptor's
CodeExtension.ATTR_MAINCLASS ) and
constructs a new instance of it using the #constructorTypes and
#constructorObjects parameters. |
protected void |
loadIf()
This method is overridden as a no-op because tabs are not loaded until they
are actually displayed.
|
(package private) int |
validate()
Validate the descriptor with respect to this extension.
|
getNameFromMainClass
compareTo, toString, validateBool, validateClass, validateString
public static final String ATTR_TABNAME
public TabExtension(ExtensionDescriptor d)
d
- int validate() throws InvalidParameterException
This method:
validate
in class CodeExtension
InvalidParameterException
- if a fatal error happens.void load(AbstractInternalFrame frame, AbstractProcess agent)
ATTR_AGENTTYPE
) and frame
(according to ATTR_FRAMETYPE
),
instantiates a tab pane in the
agent's frame with the name specified by the descriptor's
ATTR_TABNAME
. The class specified by the descriptor's
CodeExtension.ATTR_MAINCLASS
will ONLY be loaded when the tab pane is made
visible, and at that time an instance of the class will be instantiated
using it's (TransientAgent
, AbstractInternalFrame
)
constructor with the arguments agent and frame.
If AUTOLOAD
is true, the tab
will actually show up on the frame, but if AUTOLOAD
is not true, then the use can display it by choosing the menu item Tools|Tabs|[tabName].
load
in class CodeExtension
frame
- the frame that will contain this tab pane.agent
- the agent that "owns" the frame and tab pane.protected void loadIf()
loadIf
in class CodeExtension
protected Object loadFromJar(Class<?>[] constructorTypes, Object[] constructorObjects) throws IOException, ClassCastException, ClassNotFoundException, SecurityException, NoSuchMethodException, IllegalArgumentException, InstantiationException, IllegalAccessException, InvocationTargetException
CodeExtension.ATTR_MAINCLASS
) and
constructs a new instance of it using the #constructorTypes
and
#constructorObjects
parameters.constructorTypes
- constructorObjects
- IOException
ClassCastException
ClassNotFoundException
SecurityException
NoSuchMethodException
IllegalArgumentException
InstantiationException
IllegalAccessException
InvocationTargetException