Package jade.gui
Class AclGui
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- javax.swing.JComponent
-
- javax.swing.JPanel
-
- jade.gui.AclGui
-
- All Implemented Interfaces:
ImageObserver,MenuContainer,Serializable,Accessible
public class AclGui extends JPanel
The AclGui class extends the Swing JPanel class by adding all the controls required to properly edit/show the fields of an an ACL message compliant to the FIPA 97 specs.There are basically two ways of using the AclGui class.
- Non Static Mode. As AclGui extends JPanel, an
instance of AclGui can be directly added to whatever Container thus providing an easy way
to permanently insert into a GUI a panel for the editing/display of an ACL message.
The setMsg() and getMsg() methods can be used to display a given ACL message in the panel and to retrieve the ACL message currently displayed.
The setEnabled() and setSenderEnabled() methods can be used to enable/disable modifications to all fields in the ACL message and/or the sender field respectively.
E.g.
This code creates an agent GUI with a panel (in the left part of the GUI) that displays each new message received by the agent.....Each time a new message is received (assuming the message has been stored in the msg variable of type ACLMessage)
AclGui acl;
.....
JFrame agentGui = new JFrame();
agentGui.getContentPane().setLayout(new BorderLayout());
acl = new AclGui();
acl.setEnabled(false);
agentGui.getContentPane().add("West", acl);
.....
acl.setMsg(msg);
- Static Mode. The AclGui class also provides the editMsgInDialog() and showMsgInDlg()
static methods that pop up a temporary dialog window (including an AclGui panel and the proper OK and
Cancel buttons) by means of which it is possible to edit and show a given ACL message.
E.g.
This code creates a button that allows the user to edit an ACL message by means of a temporary dialog window.....
ACLMessage msg;
.....
JButton b = new JButton("edit");
b.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
msg = AclGui.editMsgInDialog(new ACLMessage("", null);
}
} );
- Version:
- $Date$ $Revision$
- Author:
- Giovanni Caire - CSELT
- See Also:
ACLMessage, Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
-
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
-
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
-
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
-
-
Field Summary
-
Fields inherited from class javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
-
Fields inherited from class java.awt.Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
-
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ACLMessageeditMsgInDialog(ACLMessage msg, Frame parent)Pops up a dialog window including an editing-enabled AclGui panel and displays the specified ACL message in it.ACLMessagegetMsg()Get the ACL message currently displayed by the AclGui panelvoidpaint(Graphics g)Paint the AclGui panelvoidsetEnabled(boolean enabledFlag)Enables/disables the editability of all the controls in an AclGui panel (default is enabled)voidsetMsg(ACLMessage msg)Displays the specified ACL message into the AclGui panelvoidsetSenderEnabled(boolean enabledFlag)Enables/disables the editability of the sender field of an AclGui panel (default is enabled)static voidshowMsgInDialog(ACLMessage msg, Frame parent)Pops up a dialog window including an editing-disabled AclGui panel and displays the specified ACL message in it.-
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
-
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
-
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
-
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
-
-
-
Constructor Detail
-
AclGui
public AclGui(Component owner)
OrdinaryAclGuiconstructor.- See Also:
ACLMessage(int)
-
-
Method Detail
-
setMsg
public void setMsg(ACLMessage msg)
Displays the specified ACL message into the AclGui panel- Parameters:
msg- The ACL message to be displayed- See Also:
getMsg()
-
getMsg
public ACLMessage getMsg()
Get the ACL message currently displayed by the AclGui panel- Returns:
- The ACL message currently displayed by the AclGui panel as an ACLMessage object
- See Also:
setMsg(ACLMessage msg)
-
setEnabled
public void setEnabled(boolean enabledFlag)
Enables/disables the editability of all the controls in an AclGui panel (default is enabled)- Overrides:
setEnabledin classJComponent- Parameters:
enabledFlag- If true enables editability- See Also:
setSenderEnabled(boolean enabledFlag)
-
setSenderEnabled
public void setSenderEnabled(boolean enabledFlag)
Enables/disables the editability of the sender field of an AclGui panel (default is enabled)- Parameters:
enabledFlag- If true enables editability- See Also:
setEnabled(boolean enabledFlag)
-
paint
public void paint(Graphics g)
Paint the AclGui panel- Overrides:
paintin classJComponent
-
showMsgInDialog
public static void showMsgInDialog(ACLMessage msg, Frame parent)
Pops up a dialog window including an editing-disabled AclGui panel and displays the specified ACL message in it.- Parameters:
m- The ACL message to be displayedparent- The parent window of the dialog window- See Also:
editMsgInDialog(ACLMessage msg, Frame parent)
-
editMsgInDialog
public static ACLMessage editMsgInDialog(ACLMessage msg, Frame parent)
Pops up a dialog window including an editing-enabled AclGui panel and displays the specified ACL message in it. The dialog window also includes an OK and a Cancel button to accept or discard the performed editing.- Parameters:
m- The ACL message to be initially displayedparent- The parent window of the dialog window- Returns:
- The ACL message displayed in the dialog window or null depending on whether the user close the window by clicking the OK or Cancel button
- See Also:
showMsgInDialog(ACLMessage msg, Frame parent)
-
-