Package mgui.interfaces.graphics
Class InterfaceGraphic<T extends Tool>
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
mgui.interfaces.InterfacePanel
mgui.interfaces.graphics.InterfaceGraphic<T>
- 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.lang.Comparable<InterfaceGraphic<T>>,java.util.EventListener,javax.accessibility.Accessible,AttributeListener,AttributeObject,DisplayListener,InterfaceMouseObject,InterfaceObject,CategoryObject,MapListener,PopupMenuObject,NamedObject,ShapeListener,Toolable<T>,ToolListener,TreeObject,CleanableObject,XMLObject,IconObject
- Direct Known Subclasses:
 InterfaceConsoleDisplay,InterfaceDataTable,InterfaceGraphDisplay,InterfaceGraphic2D,InterfaceGraphic3D,InterfaceLayoutWindow,InterfacePlotDisplay
public abstract class InterfaceGraphic<T extends Tool> extends InterfacePanel implements Toolable<T>, InterfaceMouseObject, IconObject, MapListener, ToolListener, XMLObject, java.lang.Comparable<InterfaceGraphic<T>>
The base class for all graphical interface windows. Has a list of implementing
 subclasses and has several methods for determining a particular instance type. Methods
 for setting interface-specific tools are also declared in this class.
 
 
TODO: make this class more generic; either by building a list of implementing classes at runtime, or by having them set by the instantiating frame.
- Since:
 - 1.0
 - Version:
 - 1.0
 - Author:
 - Andrew Reid
 - See Also:
 - Serialized Form
 
- 
Nested Class Summary
Nested Classes Modifier and Type Class Description static classInterfaceGraphic.GraphicTypeNested classes/interfaces inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanelNested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponentNested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainerNested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategyNested classes/interfaces inherited from interface mgui.interfaces.xml.XMLObject
XMLObject.XMLEncoding, XMLObject.XMLType - 
Field Summary
Fields Modifier and Type Field Description booleanexcludeToSelectionprotected java.util.ArrayList<InterfaceGraphicListener>graphic_listenersprotected booleaninit_onceprotected booleanis_snapshotprotected java.io.Filelast_screen_shot_fileprotected java.util.HashMap<java.lang.String,java.lang.Object>post_render_tasksprotected java.util.ArrayList<GraphicMouseListener>status_listenersprotected java.util.HashMap<GraphicMouseListener,java.lang.Integer>status_mapprotected MaptheMapInterfaceGraphicWindowtitle_panelToolInputAdaptertoolInputAdapterFields inherited from class mgui.interfaces.InterfacePanel
attributes, displayListeners, isDestroyed, last_click_point, statusBar, tree_nodes, treeNode, typeFields inherited from class javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOWFields inherited from class java.awt.Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTFields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH - 
Constructor Summary
Constructors Constructor Description InterfaceGraphic() - 
Method Summary
Modifier and Type Method Description voidaddGraphicListener(InterfaceGraphicListener l)voidaddMouseListener(InterfaceMouseListener thisObj)voidaddStatusListener(GraphicMouseListener thisObj)intcompareTo(InterfaceGraphic panel)protected voidfireGraphicListeners()java.awt.ColorgetBackgroundColour()TgetCurrentTool()javax.swing.tree.DefaultMutableTreeNodegetDisplayObjectsNode()Returns a tree node containing a list of objects displayable by a class of InterfaceGraphic.MapgetMap()org.jogamp.vecmath.Point2fgetMouseCoords(java.awt.Point p)Return the mapped coordinates, depending on the InterfaceGraphic window, for the given screen coordinates.java.lang.StringgetName()Gets the name for this object.javax.swing.IcongetObjectIcon()Returns theIconassociated with this object.protected intgetPopupLength()InterfacePopupMenugetPopupMenu()Produces and returns a popup menu for this object.static java.util.ArrayList<InterfaceGraphic<?>>getSourceTypes()java.util.ArrayList<java.lang.String>getStatusMessages(java.awt.Point p)Returns a list of status messages, to be displayed in the status barprotected javax.swing.tree.DefaultMutableTreeNodegetTreeNode(ShapeSet3DInt set)static InterfaceGraphic.GraphicTypegetType(java.lang.String str)static java.lang.StringgetTypeStr(InterfaceGraphic.GraphicType g)voidhandlePopupEvent(java.awt.event.ActionEvent e)Handles an event on this object's popup menu.protected voidinit()booleanisDisplayable(java.lang.Object obj)booleanisToolable(Tool tool)Tests whether this object is toolable bytoolvoidmapUpdated(MapEvent e)voidmouseDragged(java.awt.event.MouseEvent e)voidmouseMoved(java.awt.event.MouseEvent e)voidremoveGraphicListener(InterfaceGraphicListener l)voidremoveMouseListener(InterfaceMouseListener thisObj)voidremoveMouseObject(GraphicMouseListener thisObj)voidsetBackgroundColour(java.awt.Color c)<E extends T>
booleansetCurrentTool(E tool)<E extends T>
booleansetDefaultTool(E tool)voidsetExcludeToSelection(boolean ex)voidsetMap(Map m)voidsetName(java.lang.String name)Sets the name for this object.voidsetStatusBar(InterfaceStatusBarPanel status_bar)booleansetTool(Tool tool)Sets the current tool.voidtoolDeactivated(ToolEvent e)voidtoolStateChanged(ToolEvent e)intupdateStatusBox(InterfaceGraphicTextBox box, java.awt.event.MouseEvent e)Notifies this window to update the given status text box with information as it sees fit.booleanwriteSnapshotToFile(java.io.File file)Writes a snapshot of this window to file as a Portable Network Graphics (png) image.voidwriteXML(int tab, java.io.Writer writer)Writes the XML representation of this object to file.voidwriteXML(int tab, java.io.Writer writer, ProgressUpdater progress_bar)Writes the XML representation of this object to file, asXMLType.Normal.Methods inherited from class mgui.interfaces.InterfacePanel
_init, addDisplayListener, attributeUpdated, clean, cleanUpPanel, collapseAllCategories, collapseCategory, collapseOtherCategories, componentHidden, componentMoved, componentResized, componentShown, destroy, expandAllCategories, expandCategory, fireDisplayListeners, getAttribute, getAttributes, getAttributeValue, getLocalAttributes, getPopupMenu, getSource, getTitle, getTreeLabel, getType, isDestroyed, issueTreeNode, keyPressed, keyReleased, keyTyped, mouseClicked, mouseEntered, mouseExited, mousePressed, mouseReleased, removeDisplayListener, setAttribute, setAttributes, setSource, setTreeNode, setType, shapeUpdated, showPanel, showPopupMenu, updateDisplay, updateDisplays, updateFromDialog, updateTreeNodesMethods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUIMethods 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, updateMethods 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, validateTreeMethods 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, 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, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycleMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface mgui.interfaces.xml.XMLObject
getDTD, getLocalName, getShortXML, getXML, getXML, getXMLSchema, handleXMLElementEnd, handleXMLElementStart, handleXMLString, writeXML 
- 
Field Details
- 
status_listeners
 - 
status_map
 - 
toolInputAdapter
 - 
excludeToSelection
public boolean excludeToSelection - 
theMap
 - 
init_once
protected boolean init_once - 
graphic_listeners
 - 
title_panel
 - 
post_render_tasks
protected java.util.HashMap<java.lang.String,java.lang.Object> post_render_tasks - 
last_screen_shot_file
protected java.io.File last_screen_shot_file - 
is_snapshot
protected boolean is_snapshot 
 - 
 - 
Constructor Details
- 
InterfaceGraphic
public InterfaceGraphic() 
 - 
 - 
Method Details
- 
getObjectIcon
public javax.swing.Icon getObjectIcon()Description copied from interface:IconObjectReturns theIconassociated with this object.- Specified by:
 getObjectIconin interfaceIconObject- Overrides:
 getObjectIconin classInterfacePanel- Returns:
 
 - 
compareTo
 - 
init
protected void init()- Specified by:
 initin classInterfacePanel
 - 
getMouseCoords
public org.jogamp.vecmath.Point2f getMouseCoords(java.awt.Point p)Return the mapped coordinates, depending on the InterfaceGraphic window, for the given screen coordinates.- Parameters:
 p-- Returns:
 - mapped coordinates; or 
nullif not applicable. 
 - 
getStatusMessages
public java.util.ArrayList<java.lang.String> getStatusMessages(java.awt.Point p)Returns a list of status messages, to be displayed in the status bar- Returns:
 
 - 
toolStateChanged
- Specified by:
 toolStateChangedin interfaceToolListener
 - 
toolDeactivated
- Specified by:
 toolDeactivatedin interfaceToolListener
 - 
addGraphicListener
 - 
removeGraphicListener
 - 
fireGraphicListeners
protected void fireGraphicListeners() - 
getTypeStr
 - 
getType
 - 
getSourceTypes
 - 
addMouseListener
- Specified by:
 addMouseListenerin interfaceInterfaceMouseObject
 - 
removeMouseListener
- Specified by:
 removeMouseListenerin interfaceInterfaceMouseObject
 - 
setExcludeToSelection
public void setExcludeToSelection(boolean ex) - 
getMap
 - 
setMap
 - 
mapUpdated
- Specified by:
 mapUpdatedin interfaceMapListener
 - 
isDisplayable
public boolean isDisplayable(java.lang.Object obj) - 
setStatusBar
- Overrides:
 setStatusBarin classInterfacePanel
 - 
updateStatusBox
Notifies this window to update the given status text box with information as it sees fit. Boxes are mapped to indices within this class; By default, if the box's index is 1, the value will be set to the name of the current window; otherwise it will be set to an empty string. Overriding classes should call this super method first.- Parameters:
 box- Text box to update- Returns:
 - The index of the box; mostly useful for internal purposes
 
 - 
addStatusListener
 - 
removeMouseObject
 - 
getName
public java.lang.String getName()Description copied from interface:NamedObjectGets the name for this object.- Specified by:
 getNamein interfaceNamedObject- Overrides:
 getNamein classjava.awt.Component- Returns:
 
 - 
setName
public void setName(java.lang.String name)Description copied from interface:NamedObjectSets the name for this object.- Specified by:
 setNamein interfaceNamedObject- Overrides:
 setNamein classjava.awt.Component
 - 
setBackgroundColour
public void setBackgroundColour(java.awt.Color c) - 
getBackgroundColour
public java.awt.Color getBackgroundColour() - 
getDisplayObjectsNode
public javax.swing.tree.DefaultMutableTreeNode getDisplayObjectsNode()Returns a tree node containing a list of objects displayable by a class of InterfaceGraphic. Must therefore be overriden by that class.- Parameters:
 p- InterfaceDisplayPanel containing displayable data objects- Returns:
 - DefaultMutableTreeNode with a tree list of displayable objects
 
 - 
getTreeNode
 - 
getPopupMenu
Description copied from interface:PopupMenuObjectProduces and returns a popup menu for this object.- Specified by:
 getPopupMenuin interfacePopupMenuObject- Overrides:
 getPopupMenuin classInterfacePanel- Returns:
 
 - 
getPopupLength
protected int getPopupLength() - 
handlePopupEvent
public void handlePopupEvent(java.awt.event.ActionEvent e)Description copied from interface:PopupMenuObjectHandles an event on this object's popup menu.- Specified by:
 handlePopupEventin interfacePopupMenuObject- Overrides:
 handlePopupEventin classInterfacePanel
 - 
mouseMoved
public void mouseMoved(java.awt.event.MouseEvent e)- Specified by:
 mouseMovedin interfacejava.awt.event.MouseMotionListener- Overrides:
 mouseMovedin classInterfacePanel
 - 
mouseDragged
public void mouseDragged(java.awt.event.MouseEvent e)- Specified by:
 mouseDraggedin interfacejava.awt.event.MouseMotionListener- Overrides:
 mouseDraggedin classInterfacePanel
 - 
writeSnapshotToFile
public boolean writeSnapshotToFile(java.io.File file)Writes a snapshot of this window to file as a Portable Network Graphics (png) image.- Parameters:
 file-- Returns:
 
 - 
writeXML
public void writeXML(int tab, java.io.Writer writer) throws java.io.IOExceptionDescription copied from interface:XMLObjectWrites the XML representation of this object to file. The basic contract for this method is that it should not write a newline character at its start or end. The default format ofXMLFormat.Asciiwill be used. - 
writeXML
public void writeXML(int tab, java.io.Writer writer, ProgressUpdater progress_bar) throws java.io.IOExceptionDescription copied from interface:XMLObjectWrites the XML representation of this object to file, asXMLType.Normal. The default format ofXMLFormat.Asciiwill be used. The basic contract for this method is that it should not write a newline character at its start or end. - 
getCurrentTool
- Specified by:
 getCurrentToolin interfaceToolable<T extends Tool>
 - 
setTool
Sets the current tool. Use this method if the type of the InterfaceGraphic object is unknown.- Parameters:
 tool-- Returns:
 falseif this object is not toolable bytool.
 - 
setCurrentTool
- Specified by:
 setCurrentToolin interfaceToolable<T extends Tool>
 - 
setDefaultTool
- Specified by:
 setDefaultToolin interfaceToolable<T extends Tool>
 - 
isToolable
Description copied from interface:ToolableTests whether this object is toolable bytool- Specified by:
 isToolablein interfaceToolable<T extends Tool>- Returns:
 
 
 -