public abstract class AbstractInternalFrame extends ObservingAgentUI implements AgentUI, InternalFrameListener, WindowListener
Copyright: Copyright 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.
Modifier and Type | Field and Description |
---|---|
(package private) static boolean |
appIconSet |
private boolean |
avoidRecursion1
Used only by
refreshTabMenu() to avoid recursion in AWT. |
private static String |
buildTime |
protected static int |
buttonPAUSE |
protected static int |
buttonRESUME |
protected static int |
buttonSTEP |
protected CommandPanel |
commandPanel |
protected Container |
frame
The frame used by this class.
|
protected Hashtable<String,URLDescriptor> |
guiObserver |
protected JFrame |
jFrame
Set to either the same value as frame or null, it will be the same as frame
only if this is an independent window.
|
protected JInternalFrame |
jInternalFrame
Set to either the same value as frame or null, it will be the same as frame
only if this is a JInternalFrame, usually a frame within the LAC window.
|
private TreeMap<String,Component> |
knownTabs |
protected JList |
listCDMembers
The list of member agents in the CD that has focus (selected) in
listCDs ; part of #cdsPanel . |
protected JList |
listCDs
The list of CDs in the
#cdsPanel . |
protected JMenu |
menuAgent |
protected JMenuItem |
menuAgent_editActs |
protected JMenuItem |
menuAgent_editPerformatives |
protected JMenu |
menuAgentCommands |
private JMenuBar |
menuBar
The menu bar
|
protected JMenuItem |
menuCD_Invite |
protected JMenuItem |
menuCD_Withdraw |
protected static int |
menuEDIT_ACT_TYPES |
protected static int |
menuEDIT_PERFORMATIVE_TYPES |
protected JMenuItem |
menuEditTypes |
protected static int |
menuEDITTYPES |
protected JMenu |
menuHelp |
protected JMenuItem |
menuHelp_helpJade |
protected JMenuItem |
menuHelp_helpLisp |
protected JMenuItem |
menuHelp_helpOWL2 |
protected JMenuItem |
menuHelp_homepage |
protected JMenuItem |
menuHelp_htmanual |
protected JMenuItem |
menuHelp_info |
protected JMenuItem |
menuHelp_javadoc |
protected JMenuItem |
menuHelp_umanual |
protected static int |
menuHelpJade |
protected static int |
menuHelpLisp |
protected static int |
menuHelpOWL2 |
protected static int |
menuHIDE_DEBUG_BAR |
protected static int |
menuHomePage |
protected static int |
menuHowTo |
protected static int |
menuINFO |
protected static int |
menuJavaDoc |
protected static int |
menuNEW_MENU_ITEM |
protected JMenuItem |
menuOptions |
protected static int |
menuOPTIONS |
protected JMenu |
menuScripts |
protected static int |
menuSET_CREATE_PROXY_WINDOWS |
protected static int |
menuSET_SHOW_INACTIVE |
protected static int |
menuSETDEBUG |
protected static int |
menuSHOW_DEBUG_BAR |
protected JMenuItem |
menuShowTrace |
protected static int |
menuSHOWTRACE |
protected static int |
menuSYSTEM_CLEAR_TAGS_TYPES |
protected static int |
menuSYSTEM_LAC_DAEMON_TYPES |
protected static int |
menuSYSTEM_Preferences |
protected JMenu |
menuTools |
protected static int |
menuUserManual |
protected JMenu |
menuWindow |
protected static int |
noAction |
protected TransientAgent |
process
The agent that this window is attached to.
|
private JTabbedPane |
tabPane |
agent, showEvents, showInfo, showMessages, showTrace, showUnknown
TYPE_ANY, TYPE_BOOLEAN, TYPE_FLOAT, TYPE_INT, TYPE_STRING
Constructor and Description |
---|
AbstractInternalFrame(TransientAgent theProcess,
String title,
Container aFrame)
Constructor
Sets the process and the title of this window, and determines if this
is a JFrame, or JInternalFrame -type window.
|
Modifier and Type | Method and Description |
---|---|
void |
addFrameListener(EventListener listener)
Adaptor method for jInternalFrame.addInternalFrameListener(InternalFrameListener)
and jFrame.addWindowListener (WindowListener).
|
void |
addScript(JMenuItem menuItem)
Adds a new script to the script menu.
|
void |
addTab(String title,
Component component,
boolean visible)
Adds a new tab to the tab pane.
|
protected void |
CDMembersMouseHook(JList membertemp)
Mouse hook used by makeCDPanel in case we want to add context sensitive menus
or other flashy garbage to the list of CD members.
|
protected void |
CDSelectionChanged()
Updates window if a different CD is selected.
|
protected void |
closeInternalFrame()
Adaptor method: when isInternalFrameClosable() returns true, this method ensures that observers are notified
and that the window is disposed off.
|
protected void |
closeWindow() |
void |
createRequestedMenuItem(MLMessage message)
This method sets a new
JMenu and JMenuItem based on the information
submitted by the agent that "observes" a GUI. |
void |
dispose()
Adaptor method.
|
void |
doDefaultCloseAction()
Adaptor method.
|
private void |
eventAgentMatch(ActionEvent e,
MLMessage message) |
static String |
getBuildTime() |
CommandPanel |
getCommandPanel() |
Container |
getContentPane()
Adaptor method.
|
JInternalFrame.JDesktopIcon |
getDesktopIcon()
Adaptor method.
|
protected Frame |
getFrame()
Returns the outermost frame for this window.
|
int |
getHeight()
Adaptor method that returns the current height of the window, taking
into account whether the window is iconified or not.
|
JLayeredPane |
getLayeredPane()
Adaptor method.
|
protected JList |
getListCDMembers() |
private int |
getMenuBarIndexOf(String name) |
JMenu |
getMenuBarMenu(String name) |
JRootPane |
getRootPane()
Adaptor method.
|
Component |
getTab(String name)
Returns the Component associated with the tab with label name
|
Component |
getTabComponent(String title) |
private int |
getTabIndexOf(String name) |
protected JTabbedPane |
getTabPane() |
String |
getTitle()
Adaptor method.
|
int |
getWidth()
Adaptor method.
|
void |
insertMenuBar(JMenu menu,
int location)
Inserts a new menu.
|
void |
insertMenuBarAfter(JMenu menu,
String name)
Inserts a new menu in the agent menu bar
|
void |
insertMenuBarBefore(JMenu menu,
String name)
Inserts a new menu in the agent menu bar
|
void |
insertTab(String title,
Component component,
int location,
String toolTipText)
Insert the tab at the location location.
|
void |
insertTabAfter(String title,
Component component,
String name,
String toolTipText)
Insert the tab after the tab named name.
|
void |
internalFrameActivated(InternalFrameEvent e)
stub implementation of method from InternalFrameListener interface
as the abstract window is it's own internalframe event listener
sub classes should override this as needed |
void |
internalFrameClosed(InternalFrameEvent e)
stub implementation of method from InternalFrameListener interface
as the abstract window is it's own internalframe event listener
sub classes should override this as needed |
void |
internalFrameClosing(InternalFrameEvent e)
stub implementation of method from InternalFrameListener interface
as the abstract window is it's own internalframe event listener
sub classes should override this as needed |
void |
internalFrameDeactivated(InternalFrameEvent e)
stub implementation of method from InternalFrameListener interface
as the abstract window is it's own internalframe event listener
sub classes should override this as needed |
void |
internalFrameDeiconified(InternalFrameEvent e)
stub implementation of method from InternalFrameListener interface
as the abstract window is it's own internalframe event listener
sub classes should override this as needed |
void |
internalFrameIconified(InternalFrameEvent e)
stub implementation of method from InternalFrameListener interface
as the abstract window is it's own internalframe event listener
sub classes should override this as needed |
void |
internalFrameOpened(InternalFrameEvent e)
stub implementation of method from InternalFrameListener interface
as the abstract window is it's own internalframe event listener
sub classes should override this as needed |
boolean |
isClosed()
Adaptor method.
|
boolean |
isIcon()
Adaptor method.
|
protected boolean |
isInternalFrameClosable()
This method is called from closeInternalFrame() to check if InternalFrame is currently in
a closable state.
|
boolean |
isMaximized()
Adaptor method.
|
protected JMenu |
makeAgentMenu() |
protected JPanel |
makeCDPanel()
Makes and returns the CD panel that looks like:
+----------------------------------------------+
| +-------------------+----------------------+ |
| |Cooperation Domains|CD Participants | |
| |-------------------|----------------------| |
| | listCDs |^| listCDMembers |^| |
| | in | | in | | |
| | scrollCDlist | |ScrollCDparticipants| | |
| | |v| |v| |
| +-------------------+----------------------+ |
+----------------------------------------------+
All components placed in vectors will be at index i.
|
protected CommandPanel |
makeCommandPanel()
Returns a command panel that looks like this:
+--------------------------------------------+
| +----------------------------------------+ |
| | msgArea |^| |
| | in | | |
| | msgScroller |v| |
| +----------------------------------------+ |
| +--------------------+ +---------+ | \
| Command:| commandTextField | | Execute | | makeCommandPanel()
| +--------------------+ +---------+ | /
+--------------------------------------------+
This panel will be at index i of all vectors.
|
protected JMenu |
makeHelpMenu() |
protected JMenuBar |
makeMenuBar()
Factory Method to create a generic Agent menu bar.
|
protected JTabbedPane |
makeTabPane() |
protected JMenu |
makeToolsMenu() |
protected TypeEditDialog |
makeTypeEditDialog() |
protected JMenu |
makeWindowMenu() |
void |
pack()
Adaptor method.
|
protected void |
refreshTabMenu()
Refreshes (removes and replaces the menu with a newly created menu) the Tabs menu.
|
void |
removeTab(String name)
Removes the tab with the label name
|
void |
replaceMenuBar(JMenu menu)
Replace the menu with the same name.
|
void |
replaceTabComponent(String title,
Component component,
String toolTipText)
Replaces the tab content pane with name title with component and
resets it's toolTipText.
|
static void |
runInEventDispatchThread(Runnable r)
|
static void |
runInEventDispatchThread(Runnable r,
boolean wait)
Guarantees to run r.run() in the AWT dispatch Thread (EDT) by checking
EventQueue.isDispatchThread() and if it returns true, will
simply call r.run(), otherwise, it will call either
EventQueue.invokeLater(Runnable) if wait is false
or EventQueue.invokeAndWait(Runnable) if wait is true |
void |
setClosable(boolean b)
Adaptor method.
|
void |
setContentPane(Container pain)
Adaptor method.
|
void |
setFrameIcon(ImageIcon icon)
Adaptor method.
|
void |
setIcon(boolean b)
Adaptor method.
|
void |
setIconifiable(boolean b)
Adaptor method.
|
protected JPanel |
setInfoPanel()
Displays information about the agent in infoPanel.
|
protected int |
setInfoPanel(JPanel infoPanel,
Vector<String> agentVector)
Displays information about the agent in infoPanel.
|
void |
setJMenuBar(JMenuBar menuBar)
Adaptor method.
|
void |
setLocation(Point p)
Adaptor method.
|
void |
setMaximizable(boolean b)
Adaptor method.
|
void |
setMaximized(boolean b)
Adaptor method.
|
void |
setName(String name)
Adaptor method.
|
void |
setOpaque(boolean b)
Adaptor method.
|
void |
setResizable(boolean b)
Adaptor method.
|
void |
setSelected(boolean b)
Adaptor method.
|
boolean |
setSelectedTab(String name)
Set the tab with the label name as the selected tab.
|
void |
setSize(int x,
int y)
Adaptor method.
|
void |
setTitle(String title)
Adaptor method.
|
void |
setVisible(boolean visibility)
Adaptor method.
|
void |
show()
Adaptor method.
|
void |
toFront()
Adaptor method.
|
void |
update(Observable observable,
Object argument)
As an Observer, this methed will be called when the an event happens with the
agent.
|
protected void |
updateCDListFromAgent() |
protected void |
updateCDmemberJList(Vector<URLDescriptor> memberList)
Updates the listCDMembers JLists and enables or disables the menuCD_Withdrawn menu item
according to the parameter.
|
void |
updateEventHandler(Observable observable,
String event,
Object argObject)
This method is called whenever the
update(Observable, Object)
gets an Object that's a ObserverNotification . |
void |
updateHandler(Observable observable,
Object obj)
This method is called from
update(Observable, Object) but
this method to always be executed in the AWT Event thread. |
protected void |
updateMemberList() |
protected void |
updateOptions() |
protected void |
updateStrategyPanel()
Updates the commitment panels, to display the strategyGUI of the agent
if it has one.
|
protected boolean |
validate() |
void |
windowActivated(WindowEvent e)
stub implementation of method from WindowListener interface
as the abstract window is it's own internalframe event listener
sub classes should override this as needed |
void |
windowClosed(WindowEvent e)
stub implementation of method from WindowListener interface
as the abstract window is it's own internalframe event listener
sub classes should override this as needed |
void |
windowClosing(WindowEvent e)
stub implementation of method from WindowListener interface
as the abstract window is it's own internalframe event listener
sub classes should override this as needed |
void |
windowDeactivated(WindowEvent e)
stub implementation of method from WindowListener interface
as the abstract window is it's own internalframe event listener
sub classes should override this as needed |
void |
windowDeiconified(WindowEvent e)
stub implementation of method from WindowListener interface
as the abstract window is it's own internalframe event listener
sub classes should override this as needed |
void |
windowIconified(WindowEvent e)
stub implementation of method from WindowListener interface
as the abstract window is it's own internalframe event listener
sub classes should override this as needed |
void |
windowOpened(WindowEvent e)
stub implementation of method from WindowListener interface
as the abstract window is it's own internalframe event listener
sub classes should override this as needed |
protected void |
withdrawCD()
Attempts to remove the currently selcted CD from the
listCDs component. |
eval, evalWithHistory, handleEvent, handleOther, printlnObject
protected static final int noAction
protected static final int menuNEW_MENU_ITEM
protected static final int menuSET_SHOW_INACTIVE
protected static final int menuSET_CREATE_PROXY_WINDOWS
protected static final int menuSETDEBUG
protected static final int menuSHOWTRACE
protected static final int menuOPTIONS
protected static final int menuEDITTYPES
protected static final int menuEDIT_PERFORMATIVE_TYPES
protected static final int menuEDIT_ACT_TYPES
protected static final int menuINFO
protected static final int buttonPAUSE
protected static final int buttonRESUME
protected static final int buttonSTEP
protected static final int menuSHOW_DEBUG_BAR
protected static final int menuHIDE_DEBUG_BAR
protected static final int menuSYSTEM_CLEAR_TAGS_TYPES
protected static final int menuSYSTEM_LAC_DAEMON_TYPES
protected static final int menuSYSTEM_Preferences
protected static final int menuUserManual
protected static final int menuHowTo
protected static final int menuJavaDoc
protected static final int menuHomePage
protected static final int menuHelpLisp
protected static final int menuHelpOWL2
protected static final int menuHelpJade
protected JMenuItem menuShowTrace
protected JMenuItem menuOptions
protected JMenuItem menuEditTypes
protected JMenuItem menuAgent_editPerformatives
protected JMenuItem menuAgent_editActs
protected JMenuItem menuCD_Invite
protected JMenuItem menuCD_Withdraw
protected JMenu menuWindow
protected JMenu menuTools
protected JMenu menuScripts
protected JMenu menuHelp
protected JMenuItem menuHelp_info
protected JMenuItem menuHelp_umanual
protected JMenuItem menuHelp_htmanual
protected JMenuItem menuHelp_javadoc
protected JMenuItem menuHelp_homepage
protected JMenuItem menuHelp_helpLisp
protected JMenuItem menuHelp_helpOWL2
protected JMenuItem menuHelp_helpJade
protected JMenu menuAgent
protected JMenu menuAgentCommands
protected JList listCDs
#cdsPanel
.protected JList listCDMembers
listCDs
; part of #cdsPanel
.private JMenuBar menuBar
protected Container frame
JFrame
,
JInternalFrame
protected JFrame jFrame
protected JInternalFrame jInternalFrame
protected TransientAgent process
protected Hashtable<String,URLDescriptor> guiObserver
protected CommandPanel commandPanel
private JTabbedPane tabPane
static boolean appIconSet
private static String buildTime
private boolean avoidRecursion1
refreshTabMenu()
to avoid recursion in AWT.public AbstractInternalFrame(TransientAgent theProcess, String title, Container aFrame)
theProcess
- AbstractProcess set as this object processtitle
- String to be set as this windows titleaFrame
- Container of type either JInternalFrame or JFrame to use for this windowprotected JTabbedPane getTabPane()
public void addScript(JMenuItem menuItem)
title
- The title of the script (used in the menu).component
- The component in the tab body.visible
- TODOpublic void addTab(String title, Component component, boolean visible)
title
- The title in the tab.component
- The component in the tab body.visible
- if true make the tab visible; if false remove the tab (removeTab(String)
).public void removeTab(String name)
name
- The label name to remove.public void insertTabAfter(String title, Component component, String name, String toolTipText)
title
- The title of the new tab.component
- The component that forms the body of the new tab.name
- The name of the tab after which to place the new tab.toolTipText
- The text for the tooltip of the tab.public void insertTab(String title, Component component, int location, String toolTipText)
title
- The title of the new tab.component
- The component that forms the body of the new tab.location
- The index at which the new tab sould be placed.toolTipText
- The text for the tooltip of the tab.public void replaceTabComponent(String title, Component component, String toolTipText)
title
- The title of the new tab.component
- The component that forms the body of the new tab.toolTipText
- The text for the tooltip of the tab.private int getTabIndexOf(String name)
public Component getTab(String name)
name
- The name to search for.public boolean setSelectedTab(String name)
name
- The name to select.protected JTabbedPane makeTabPane()
public Component getTabComponent(String title)
title
- The title of the tab Component to search for.protected void closeWindow()
protected JMenuBar makeMenuBar()
protected void refreshTabMenu()
protected JMenu makeWindowMenu()
protected JMenu makeToolsMenu()
protected JMenu makeHelpMenu()
public void insertMenuBar(JMenu menu, int location)
menu
- The menu to insert.location
- The location at which to isert the new menu (<=0 = first; >n = last).public void insertMenuBarAfter(JMenu menu, String name)
menu
- The menu to insertname
- The name AFTER which to insert the new menu; if null it
will be first, if not found it will be "last" (but before Help, etc).public void insertMenuBarBefore(JMenu menu, String name)
menu
- The menu to insertname
- The name BEFORE which to insert the new menu; ; if null it
will be first, if not found it will be "last" (but before Help, etc).public void replaceMenuBar(JMenu menu)
menu
- The menu to replace the old one with.private int getMenuBarIndexOf(String name)
name
- The name to find.public JMenu getMenuBarMenu(String name)
name
- The menu label to findprotected JMenu makeAgentMenu()
protected JPanel makeCDPanel()
protected void updateCDmemberJList(Vector<URLDescriptor> memberList)
memberList
- A Vector of URLDescriptors.protected void CDMembersMouseHook(JList membertemp)
protected void CDSelectionChanged()
protected void updateCDListFromAgent()
protected JList getListCDMembers()
protected void updateMemberList()
protected void withdrawCD()
listCDs
component.protected void updateStrategyPanel()
protected void updateOptions()
public void createRequestedMenuItem(MLMessage message)
JMenu
and JMenuItem
based on the information
submitted by the agent that "observes" a GUI. The information should be formated as follows in
the respective message content
: menuTitle|menuItemTitlemessage
- MLMessageprivate void eventAgentMatch(ActionEvent e, MLMessage message)
protected TypeEditDialog makeTypeEditDialog()
public void addFrameListener(EventListener listener)
listener
- protected void closeInternalFrame()
public void dispose()
public void doDefaultCloseAction()
public Container getContentPane()
public void setContentPane(Container pain)
public JInternalFrame.JDesktopIcon getDesktopIcon()
protected Frame getFrame()
LACWindow
it will return the LAC's frame (LACinfo.desktop
).
Otherwise it returns this windows outer frame, jFrame
.public int getHeight()
public JLayeredPane getLayeredPane()
public JRootPane getRootPane()
public int getWidth()
public void internalFrameActivated(InternalFrameEvent e)
internalFrameActivated
in interface InternalFrameListener
public void internalFrameClosed(InternalFrameEvent e)
internalFrameClosed
in interface InternalFrameListener
public void internalFrameClosing(InternalFrameEvent e)
internalFrameClosing
in interface InternalFrameListener
public void internalFrameDeactivated(InternalFrameEvent e)
internalFrameDeactivated
in interface InternalFrameListener
public void internalFrameDeiconified(InternalFrameEvent e)
internalFrameDeiconified
in interface InternalFrameListener
public void internalFrameIconified(InternalFrameEvent e)
internalFrameIconified
in interface InternalFrameListener
public void internalFrameOpened(InternalFrameEvent e)
internalFrameOpened
in interface InternalFrameListener
public boolean isIcon()
public boolean isMaximized()
public boolean isClosed()
public void setVisible(boolean visibility)
protected boolean isInternalFrameClosable()
public void pack()
public void setClosable(boolean b)
public void setFrameIcon(ImageIcon icon)
public void setIcon(boolean b)
public void setMaximized(boolean b)
public void setIconifiable(boolean b)
public void setJMenuBar(JMenuBar menuBar)
public void setLocation(Point p)
public static void runInEventDispatchThread(Runnable r)
r
- The Runnable to run in the EDTpublic static void runInEventDispatchThread(Runnable r, boolean wait)
EventQueue.isDispatchThread()
and if it returns true, will
simply call r.run(), otherwise, it will call either
EventQueue.invokeLater(Runnable)
if wait is false
or EventQueue.invokeAndWait(Runnable)
if wait is truer
- The Runnable to run on the EDTwait
- indicates whether to wait on the call or place on the EDT's queuepublic void updateEventHandler(Observable observable, String event, Object argObject)
update(Observable, Object)
gets an Object that's a ObserverNotification
. The ObserverNotification
is split into the components, and that forms the arguments to this method.
Note that if you need to you the raw info from update(Observable, Object)
,
then you should put your code in updateHandler(Observable, Object)
which is unconditionally called with the raw parameters.
You can expect this method to always be executed in the AWT Event thread.observable
- The Observable that triggered this update callevent
- The eventargObject
- The parameter to the eventpublic void setMaximizable(boolean b)
public void setName(String name)
public void setOpaque(boolean b)
public void setResizable(boolean b)
public void setSelected(boolean b)
public void setSize(int x, int y)
public void setTitle(String title)
public String getTitle()
public void show()
public void toFront()
public void windowActivated(WindowEvent e)
windowActivated
in interface WindowListener
public void windowClosed(WindowEvent e)
windowClosed
in interface WindowListener
public void windowClosing(WindowEvent e)
windowClosing
in interface WindowListener
public void windowDeactivated(WindowEvent e)
windowDeactivated
in interface WindowListener
public void windowDeiconified(WindowEvent e)
windowDeiconified
in interface WindowListener
public void windowIconified(WindowEvent e)
windowIconified
in interface WindowListener
public void windowOpened(WindowEvent e)
windowOpened
in interface WindowListener
public final void update(Observable observable, Object argument)
updateHandler(Observable, Object)
to handle the event, and if
the Object argument is of type ObserverNotification
,
we also call updateEventHandler(Observable, String, Object)
.update
in interface Observer
update
in class ObservingAgentUI
observable
- argument
- public void updateHandler(Observable observable, Object obj)
update(Observable, Object)
but
this method to always be executed in the AWT Event thread. You should
use this instead of update(Observable, Object)
(which is final).observable
- The Observable that triggered this update callobj
- The parameter objectprotected boolean validate()
protected CommandPanel makeCommandPanel()
i
- protected JPanel setInfoPanel()
infoPanel
- protected int setInfoPanel(JPanel infoPanel, Vector<String> agentVector)
infoPanel
- agentVector
- public CommandPanel getCommandPanel()
public static String getBuildTime()