gov.noaa.pmel.sgt.beans
Class Panel

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by gov.noaa.pmel.sgt.beans.Panel
All Implemented Interfaces:
LayerControl, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public class Panel
extends javax.swing.JComponent
implements LayerControl

A Layer container that provides a StackedLayout of the Layers.

Since:
3.0
Version:
$Revision$, $Date$
Author:
Donald Denbo
See Also:
Serialized Form

Nested Class Summary
 
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.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
 
Fields inherited from class javax.swing.JComponent
accessibleContext, 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
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
Panel(PanelHolder ph)
          Panel constructor with PanelHolder argument.
Panel(java.lang.String name)
          Panel constructor.
 
Method Summary
 void addData(SGTData data, Attribute attr, DataGroup dataGroup, Legend legend)
          Add data to this Panel and DataGroup.
 void draw(java.awt.Graphics g)
          Used internally by sgt.
 void drawDraggableItems(java.awt.Graphics g)
          Used internally by sgt.
 DataGroupLayer findDataGroupLayer(java.lang.String id)
          Find DataGroupLayer in Panel.
 java.lang.String getId()
          Get the identifier for the Panel
 Layer getLayer(java.lang.String id)
          Get Layer from this Panel.
 Layer getLayerFromDataId(java.lang.String id)
          Get Layer from this Panel.
 java.lang.Object getObjectAt(int x, int y, boolean check)
          Find object associated with a MOUSE_DOWN event.
 java.lang.Object[] getObjectsAt(int x, int y, boolean check)
          Find objects associated with a MOUSE_DOWN event.
 JPane getPane()
          Get the JPane the Panel is associated with.
 boolean hasLayer(java.lang.String id)
          Does this Panel contain this Layer?
 boolean isDataInPanel(java.lang.String id)
          Checks to see if a data id matches that data attached to the Graph.
 void resetZoom()
          Reset the zoom for all DataGroupLayers in this Panel.
 void setClipping(boolean clip)
          Set clipping for DataGroupLayers in this Panel.
 void setPane(AbstractPane pane)
          Set the Pane the Panel is associated with.
 void setPanelHolder(PanelHolder ph)
          Set PanelHolder.
 java.lang.String toString()
          Get a String representation of the Layer.
 void update()
          Traverses the PanelHolder and adds any new objects and updates exisiting objects.
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, 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, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, 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, updateUI
 
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, transferFocusBackward, 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, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, 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, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Panel

public Panel(java.lang.String name)
Panel constructor. PanelHolder will need to be set.

Parameters:
name - Panel name

Panel

public Panel(PanelHolder ph)
Panel constructor with PanelHolder argument. Panel name set from PanelHolder identifier.

Parameters:
ph - PanelHolder
Method Detail

setPanelHolder

public void setPanelHolder(PanelHolder ph)
Set PanelHolder. PanelHolder contains the layout information and DataGroups associated with the Panel.

Parameters:
ph - PanelHolder

update

public void update()
Traverses the PanelHolder and adds any new objects and updates exisiting objects.


getObjectAt

public java.lang.Object getObjectAt(int x,
                                    int y,
                                    boolean check)
Find object associated with a MOUSE_DOWN event. The getObjectAt method scans through all the objects associated with the Panel to find one whose bounding box contains the mouse location. This method should not be called by a user.

Parameters:
x - mouse coordinate
y - mouse coordinate
check - if true requires that object isSelectable
Returns:
object at location

resetZoom

public void resetZoom()
Reset the zoom for all DataGroupLayers in this Panel.


setClipping

public void setClipping(boolean clip)
Set clipping for DataGroupLayers in this Panel.

Parameters:
clip - if true clip data to bounds.

hasLayer

public boolean hasLayer(java.lang.String id)
Does this Panel contain this Layer?

Parameters:
id - layer identification
Returns:
true, if Layer is in Panel

getLayer

public Layer getLayer(java.lang.String id)
Get Layer from this Panel. Returns null if Layer is not found.

Parameters:
id - Layer identifier
Returns:
Layer

isDataInPanel

public boolean isDataInPanel(java.lang.String id)
Checks to see if a data id matches that data attached to the Graph.

Parameters:
id - data identifier
Returns:
true if data is in Panel

getLayerFromDataId

public Layer getLayerFromDataId(java.lang.String id)
Get Layer from this Panel. Returns null if Layer is not found.

Parameters:
id - SGTData identifier
Returns:
Layer

getObjectsAt

public java.lang.Object[] getObjectsAt(int x,
                                       int y,
                                       boolean check)
Find objects associated with a MOUSE_DOWN event. The getObjecstAt method scans through all the objects associated with the Panel to find those whose bounding box contains the mouse location. This method should not be called by a user.

Parameters:
x - mouse coordinate
y - mouse coordinate
check - if selectable
Returns:
object array

findDataGroupLayer

public DataGroupLayer findDataGroupLayer(java.lang.String id)
Find DataGroupLayer in Panel.

Parameters:
id - DataGroupLayer identifier
Returns:
DataGroupLayer

getPane

public JPane getPane()
Get the JPane the Panel is associated with.

Returns:
Refence to the Pane

setPane

public void setPane(AbstractPane pane)
Set the Pane the Panel is associated with. This method is called by Pane when the Pane.add method is exectued.

Specified by:
setPane in interface LayerControl
Parameters:
pane - The Pane

draw

public void draw(java.awt.Graphics g)
          throws PaneNotFoundException
Description copied from interface: LayerControl
Used internally by sgt.

Specified by:
draw in interface LayerControl
Parameters:
g - Graphics object
Throws:
PaneNotFoundException - Pane not found.

drawDraggableItems

public void drawDraggableItems(java.awt.Graphics g)
                        throws PaneNotFoundException
Description copied from interface: LayerControl
Used internally by sgt.

Specified by:
drawDraggableItems in interface LayerControl
Parameters:
g - Graphics object.
Throws:
PaneNotFoundException - Pane not found.

addData

public void addData(SGTData data,
                    Attribute attr,
                    DataGroup dataGroup,
                    Legend legend)
             throws DataTargetMismatchException
Add data to this Panel and DataGroup. legend can be null.

Parameters:
data - SGTData to be added
attr - Attribute
dataGroup - DataGroup to add data to
legend - Lenged for data
Throws:
DataTargetMismatchException

getId

public java.lang.String getId()
Get the identifier for the Panel

Specified by:
getId in interface LayerControl
Returns:
identifier/name

toString

public java.lang.String toString()
Get a String representation of the Layer.

Overrides:
toString in class java.awt.Component
Returns:
String representation