Package mgui.interfaces
Class InterfacePanel
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
mgui.interfaces.InterfacePanel
- All Implemented Interfaces:
java.awt.event.ComponentListener
,java.awt.event.KeyListener
,java.awt.event.MouseListener
,java.awt.event.MouseMotionListener
,java.awt.image.ImageObserver
,java.awt.MenuContainer
,java.io.Serializable
,java.util.EventListener
,javax.accessibility.Accessible
,AttributeListener
,AttributeObject
,DisplayListener
,InterfaceObject
,CategoryObject
,PopupMenuObject
,NamedObject
,ShapeListener
,TreeObject
,CleanableObject
,IconObject
- Direct Known Subclasses:
ContinuousColourBar
,InterfaceAttributePanel
,InterfaceButtonPanel
,InterfaceCaminoPanel
,InterfaceCoCoMacPanel
,InterfaceComboPanel
,InterfaceCorticalThicknessPanel
,InterfaceDatasourcePanel
,InterfaceDisplayPanel
,InterfaceDynamicModelPanel
,InterfaceFilePanel
,InterfaceGraphic
,InterfaceGraphicPanel
,InterfaceGraphicWindow
,InterfaceHideablePanel
,InterfaceLayoutPanel
,InterfaceListPanel
,InterfaceMapPanel
,InterfaceMeshPanel
,InterfaceMorphPanel
,InterfaceMorphPanel2
,InterfaceNeuroMeshPanel
,InterfaceNeuroMeshPanel2
,InterfacePipelinesPanel
,InterfacePlot
,InterfacePlotPanel
,InterfacePolygonPanel
,InterfaceProjectPanel
,InterfaceQueryPanel
,InterfaceRadialRep
,InterfaceRadialRep2
,InterfaceSectionSetPanel
,InterfaceSelectionPanel
,InterfaceSelectionSet
,InterfaceShapesPanel
,InterfaceStatusBarPanel
,InterfaceTool2DPanel
,InterfaceToolPanel
,InterfaceTreePanel
,InterfaceVolumePanel
,InterfaceVolumeSetPanel
,ShapeStatsPanel
,VideoTaskDialogPanel
public abstract class InterfacePanel extends javax.swing.JPanel implements InterfaceObject, DisplayListener, AttributeObject, AttributeListener, java.awt.event.ComponentListener, ShapeListener, IconObject, PopupMenuObject, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, CategoryObject, java.awt.event.KeyListener
Base class for all Swing panels (i.e., extensions of
JPanel
) to be show in an instance of
InterfaceDisplayPanel
. Provides empty or skeletal implementations of a number of interfaces,
which can be overridden by subclasses when necessary.
Listens to:
- Component events
- Mouse events
- Keyboard events
- Since:
- 1.0
- Version:
- 1.0
- Author:
- Andrew Reid
- See Also:
- Serialized Form
-
Nested Class Summary
Nested classes/interfaces inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
-
Field Summary
Fields Modifier and Type Field Description AttributeList
attributes
java.util.ArrayList<DisplayListener>
displayListeners
protected boolean
isDestroyed
protected java.awt.Point
last_click_point
InterfaceStatusBarPanel
statusBar
protected java.util.ArrayList<InterfaceTreeNode>
tree_nodes
InterfaceTreeNode
treeNode
java.lang.String
type
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
-
Constructor Summary
Constructors Constructor Description InterfacePanel()
-
Method Summary
Modifier and Type Method Description protected void
_init()
void
addDisplayListener(DisplayListener thisListener)
void
attributeUpdated(AttributeEvent e)
Called when an Attribute's value has been updated.void
clean()
Instructs this object to search its members for any object which has been destroyed, and release the pointer to it.void
cleanUpPanel()
Cleans up the panel's data when it loses focus.void
collapseAllCategories()
void
collapseCategory(java.lang.String cat)
void
collapseOtherCategories(java.lang.String cat)
void
componentHidden(java.awt.event.ComponentEvent e)
void
componentMoved(java.awt.event.ComponentEvent e)
void
componentResized(java.awt.event.ComponentEvent e)
void
componentShown(java.awt.event.ComponentEvent e)
void
destroy()
Destroy this object (prepare it to be removed from memory)void
expandAllCategories()
void
expandCategory(java.lang.String cat)
void
fireDisplayListeners()
Attribute<?>
getAttribute(java.lang.String attrName)
Returns a specific attribute for this object.AttributeList
getAttributes()
Returns the list of current attributes for this object.java.lang.Object
getAttributeValue(java.lang.String name)
Gets the value of attributename
, ornull
if it does not exist.AttributeList
getLocalAttributes()
javax.swing.Icon
getObjectIcon()
Returns theIcon
associated with this object.InterfacePopupMenu
getPopupMenu()
Produces and returns a popup menu for this object.InterfacePopupMenu
getPopupMenu(java.util.List<java.lang.Object> selection)
Produces and returns a popup menu for this object.java.lang.Object
getSource()
Returns the source object for this panel; returnsnull
if no source object is set.java.lang.String
getTitle()
java.lang.String
getTreeLabel()
Returns the label text to appear in a tree node.java.lang.String
getType()
void
handlePopupEvent(java.awt.event.ActionEvent e)
Handles an event on this object's popup menu.protected abstract void
init()
boolean
isDestroyed()
Test whether this object has been destroyedInterfaceTreeNode
issueTreeNode()
Issues a newInterfaceTreeNode
for this object.void
keyPressed(java.awt.event.KeyEvent e)
void
keyReleased(java.awt.event.KeyEvent e)
void
keyTyped(java.awt.event.KeyEvent e)
void
mouseClicked(java.awt.event.MouseEvent e)
void
mouseDragged(java.awt.event.MouseEvent e)
void
mouseEntered(java.awt.event.MouseEvent e)
void
mouseExited(java.awt.event.MouseEvent e)
void
mouseMoved(java.awt.event.MouseEvent e)
void
mousePressed(java.awt.event.MouseEvent e)
void
mouseReleased(java.awt.event.MouseEvent e)
void
removeDisplayListener(DisplayListener thisListener)
void
setAttribute(java.lang.String attrName, java.lang.Object newValue)
Sets a value for a specific attribute.void
setAttributes(AttributeList thisList)
Sets the list of attributes for this object.boolean
setSource(java.lang.Object obj)
Sets the source object for this panel.void
setStatusBar(InterfaceStatusBarPanel p)
void
setTreeNode(InterfaceTreeNode treeNode)
Sets the children for this node'sInterfaceTreeNode
.void
setType(java.lang.String t)
void
shapeUpdated(ShapeEvent e)
A shape that this object is listening to has been updated.void
showPanel()
This method is called when a panel is displayed.void
showPopupMenu(java.awt.event.MouseEvent e)
Shows a popup menu at the point of the givenMouseEvent
.void
updateDisplay()
Requests this panel to update its display.void
updateDisplays()
void
updateFromDialog(InterfaceDialogBox box)
protected void
updateTreeNodes()
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, paint, 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, setEnabled, 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
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface mgui.interfaces.NamedObject
getName, setName
-
Field Details
-
attributes
-
statusBar
-
displayListeners
-
treeNode
-
type
public java.lang.String type -
isDestroyed
protected transient boolean isDestroyed -
tree_nodes
-
last_click_point
protected java.awt.Point last_click_point
-
-
Constructor Details
-
InterfacePanel
public InterfacePanel()
-
-
Method Details
-
_init
protected void _init() -
clean
public void clean()Description copied from interface:CleanableObject
Instructs this object to search its members for any object which has been destroyed, and release the pointer to it.- Specified by:
clean
in interfaceCleanableObject
-
attributeUpdated
Description copied from interface:AttributeListener
Called when an Attribute's value has been updated.- Specified by:
attributeUpdated
in interfaceAttributeListener
-
getPopupMenu
Description copied from interface:PopupMenuObject
Produces and returns a popup menu for this object.- Specified by:
getPopupMenu
in interfacePopupMenuObject
- Returns:
-
getPopupMenu
Description copied from interface:PopupMenuObject
Produces and returns a popup menu for this object. Allows an associated list of objects to be passed as an argument.- Specified by:
getPopupMenu
in interfacePopupMenuObject
- Returns:
-
handlePopupEvent
public void handlePopupEvent(java.awt.event.ActionEvent e)Description copied from interface:PopupMenuObject
Handles an event on this object's popup menu.- Specified by:
handlePopupEvent
in interfacePopupMenuObject
-
showPopupMenu
public void showPopupMenu(java.awt.event.MouseEvent e)Description copied from interface:PopupMenuObject
Shows a popup menu at the point of the givenMouseEvent
.- Specified by:
showPopupMenu
in interfacePopupMenuObject
-
getType
public java.lang.String getType() -
setType
public void setType(java.lang.String t) -
getTreeLabel
public java.lang.String getTreeLabel()Description copied from interface:TreeObject
Returns the label text to appear in a tree node.- Specified by:
getTreeLabel
in interfaceTreeObject
- Returns:
-
getObjectIcon
public javax.swing.Icon getObjectIcon()Description copied from interface:IconObject
Returns theIcon
associated with this object.- Specified by:
getObjectIcon
in interfaceIconObject
- Returns:
-
setStatusBar
-
getAttribute
Description copied from interface:AttributeObject
Returns a specific attribute for this object.- Specified by:
getAttribute
in interfaceAttributeObject
- Returns:
-
getAttributeValue
public java.lang.Object getAttributeValue(java.lang.String name)Description copied from interface:AttributeObject
Gets the value of attributename
, ornull
if it does not exist.- Specified by:
getAttributeValue
in interfaceAttributeObject
- Parameters:
name
- Name of the attribute- Returns:
- the value of attribute
name
, ornull
if it does not exist
-
getAttributes
Description copied from interface:AttributeObject
Returns the list of current attributes for this object.- Specified by:
getAttributes
in interfaceAttributeObject
- Returns:
-
getLocalAttributes
-
setAttribute
public void setAttribute(java.lang.String attrName, java.lang.Object newValue)Description copied from interface:AttributeObject
Sets a value for a specific attribute.- Specified by:
setAttribute
in interfaceAttributeObject
-
setAttributes
Description copied from interface:AttributeObject
Sets the list of attributes for this object.- Specified by:
setAttributes
in interfaceAttributeObject
-
getTitle
public java.lang.String getTitle() -
fireDisplayListeners
public void fireDisplayListeners() -
updateDisplay
public void updateDisplay()Requests this panel to update its display.- Specified by:
updateDisplay
in interfaceDisplayListener
-
updateDisplays
public void updateDisplays() -
addDisplayListener
-
removeDisplayListener
-
issueTreeNode
Description copied from interface:TreeObject
Issues a newInterfaceTreeNode
for this object. The object is responsible for maintaining, updating, and destroying the tree nodes it issues, or notifying containers -- i.e., parent trees -- of changes which require the tree nodes to be modified or destroyed.- Specified by:
issueTreeNode
in interfaceTreeObject
- Returns:
-
setTreeNode
Description copied from interface:TreeObject
Sets the children for this node'sInterfaceTreeNode
.- Specified by:
setTreeNode
in interfaceTreeObject
-
updateTreeNodes
protected void updateTreeNodes() -
showPanel
public void showPanel()This method is called when a panel is displayed. Subclasses should override to implement specific behaviour. -
setSource
public boolean setSource(java.lang.Object obj)Sets the source object for this panel.- Parameters:
obj
-- Returns:
-
getSource
public java.lang.Object getSource()Returns the source object for this panel; returnsnull
if no source object is set.- Returns:
-
init
protected abstract void init() -
destroy
public void destroy()Description copied from interface:InterfaceObject
Destroy this object (prepare it to be removed from memory)- Specified by:
destroy
in interfaceInterfaceObject
- Specified by:
destroy
in interfaceShapeListener
-
isDestroyed
public boolean isDestroyed()Description copied from interface:InterfaceObject
Test whether this object has been destroyed- Specified by:
isDestroyed
in interfaceInterfaceObject
- Specified by:
isDestroyed
in interfaceShapeListener
- Returns:
-
cleanUpPanel
public void cleanUpPanel()Cleans up the panel's data when it loses focus. Does nothing by default; override this method to perform custom housekeeping. -
componentHidden
public void componentHidden(java.awt.event.ComponentEvent e)- Specified by:
componentHidden
in interfacejava.awt.event.ComponentListener
-
componentMoved
public void componentMoved(java.awt.event.ComponentEvent e)- Specified by:
componentMoved
in interfacejava.awt.event.ComponentListener
-
componentResized
public void componentResized(java.awt.event.ComponentEvent e)- Specified by:
componentResized
in interfacejava.awt.event.ComponentListener
-
componentShown
public void componentShown(java.awt.event.ComponentEvent e)- Specified by:
componentShown
in interfacejava.awt.event.ComponentListener
-
shapeUpdated
Description copied from interface:ShapeListener
A shape that this object is listening to has been updated. The specific type of event is defined by ShapeEvent.EventType.- Specified by:
shapeUpdated
in interfaceShapeListener
-
updateFromDialog
-
mouseClicked
public void mouseClicked(java.awt.event.MouseEvent e)- Specified by:
mouseClicked
in interfacejava.awt.event.MouseListener
-
mouseEntered
public void mouseEntered(java.awt.event.MouseEvent e)- Specified by:
mouseEntered
in interfacejava.awt.event.MouseListener
-
mouseExited
public void mouseExited(java.awt.event.MouseEvent e)- Specified by:
mouseExited
in interfacejava.awt.event.MouseListener
-
mousePressed
public void mousePressed(java.awt.event.MouseEvent e)- Specified by:
mousePressed
in interfacejava.awt.event.MouseListener
-
mouseReleased
public void mouseReleased(java.awt.event.MouseEvent e)- Specified by:
mouseReleased
in interfacejava.awt.event.MouseListener
-
mouseDragged
public void mouseDragged(java.awt.event.MouseEvent e)- Specified by:
mouseDragged
in interfacejava.awt.event.MouseMotionListener
-
mouseMoved
public void mouseMoved(java.awt.event.MouseEvent e)- Specified by:
mouseMoved
in interfacejava.awt.event.MouseMotionListener
-
collapseAllCategories
public void collapseAllCategories()- Specified by:
collapseAllCategories
in interfaceCategoryObject
-
collapseCategory
public void collapseCategory(java.lang.String cat)- Specified by:
collapseCategory
in interfaceCategoryObject
-
collapseOtherCategories
public void collapseOtherCategories(java.lang.String cat)- Specified by:
collapseOtherCategories
in interfaceCategoryObject
-
expandAllCategories
public void expandAllCategories()- Specified by:
expandAllCategories
in interfaceCategoryObject
-
expandCategory
public void expandCategory(java.lang.String cat)- Specified by:
expandCategory
in interfaceCategoryObject
-
keyPressed
public void keyPressed(java.awt.event.KeyEvent e)- Specified by:
keyPressed
in interfacejava.awt.event.KeyListener
-
keyReleased
public void keyReleased(java.awt.event.KeyEvent e)- Specified by:
keyReleased
in interfacejava.awt.event.KeyListener
-
keyTyped
public void keyTyped(java.awt.event.KeyEvent e)- Specified by:
keyTyped
in interfacejava.awt.event.KeyListener
-