gov.noaa.pmel.sgt
Class JPane

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--javax.swing.JLayeredPane
                          |
                          +--gov.noaa.pmel.sgt.JPane
All Implemented Interfaces:
AbstractPane, javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, java.awt.print.Printable, javax.swing.Scrollable, java.io.Serializable
Direct Known Subclasses:
JGraphicLayout

public class JPane
extends javax.swing.JLayeredPane
implements AbstractPane, javax.swing.Scrollable, java.awt.print.Printable

The JPane class is extended from javax.swing.JLayeredPane and is the basis for using the gov.noaa.pmel.sgt package with swing components.

The Java scientific graphics toolkit is designed to allow a graphics client developer a great deal of flexibility and freedom. sgt is a package that greatly aids a developer in creating graphics applets. sgt is not a general purpose graphics package, but provides the tools to enable scientific graphics to be easily incorporated into JApplet.

sgt has three main components, the "pane", on which all graphics are drawn. The JPane is a fairly simple class and all drawing is done in "device" coordinates (pixels). By default, the JPane will draw on the screen, but it is designed to allow drawing in an offscreen buffer that can be printed (for applications).

The next component is the Layer. Several Layers can be associated with a single JPane. The Layer class insulates the developer from the details of device coordinates by using "physical" coordinates. Physical coordinates are a right-hand coordinate systems with an origin of (0.0, 0.0) in the lower-left-hand corner and have the same scale in both the vertical and horizontal directions. Thus, a Layer that is 5.0 units wide and 3.0 units high can be made larger and smaller on the screen by resizing the JPane, but will not be distorted. The Layer class is responsible for displaying labels, keys (color, vector, and line), and rulers. A Layer can contain a single Graph.

Finally, the Graph component transforms from user coordinates (e.g. cm/sec, time, degC, or meters) to physical coordinates. The Graph classes handle the display of axes and data. Children of the Graph class are capable of creating Cartesian, polar, and map graphics. For Cartesian graphs, several different axes (log, plain and time), transforms (linear, log, and tablelookup), and CartesianGraph (pixel, line, vector, and contour) classes are available. These classes can be combined in almost any combination.

While only one dataset may be plotted per Layer, co-plotting is supported by allowing layers to use the same transform objects. The order that the layers are plotted can be changed, allowing the developer (or user) to control what may be obscured.

Member functions, in package gov.noaa.pmel.sgt, follow the following naming convention. Member functions that have a P, U, or nothing at the end of the function name are of type double in Physical units, type double in User units, and type int in Device units, respectively. Variables that start with p, u, t, or d are coordinates of type physical, user, time, or device, respectively.

All graphics are rendered when the draw() method is invoked.

Mouse Events

Mouse events are processed by the JPane object to support object selection and zooming. Object selection is accomplished by left clicking the mouse on the desired object. JPane then fires a PropertyChangeEvent of type "objectSelected" that can be listened for by the users application. The user application then invokes the getSelectedObject() method. Zooming is accomplished in several steps.

 1) Begin a zoom operation by pressing the left button.
 2) Describe a zoom rectangle by dragging the mouse with the left
    button down.
 3) Finish the zoom operation by releasing the left mouse button.
 

When the mouse button has been release JPane fires a PropertyChangeEvent of type "zoomRectangle" that can be listened for by the users application. The user application can then obtain the zoom rectangle by invoking the getZoomBounds() method.

 ...
 //
 // register the PropertyChangeListener listener with pane
 // (assuming that application implements PropertyChangeListener)
 //
 mainPane_.addPropertyChangeListener(this);
 //
 ...
 //
 // Implement the propertyChange() method and listen for events
 //
  public void propertyChange(PropertyChangeEvent event) {
    //
    // Listen for property change events from JPane
    //
    String name = event.getPropertyName();
    if(name.equals("zoomRectangle")) {
      //
      // compute zoom rectangle in user units
      //
      Range2D xr = new Range2D();
      Range2D yr = new Range2D();
      Rectangle zm = (Rectangle)event.getNewValue();
      //
      // if rectangle size is one pixel or less return
      //
      if(zm.width <= 1 || zm.height <= 1) return;
      xr.start = graph_.getXPtoU(layer_.getXDtoP(zm.x));
      xr.end = graph_.getXPtoU(layer_.getXDtoP(zm.x + zm.width));
      if(xr.start > xr.end) {
        double temp = xr.start;
        xr.start = xr.end;
        xr.end = temp;
      }
      yr.start = graph_.getYPtoU(layer_.getYDtoP(zm.y));
      yr.end = graph_.getYPtoU(layer_.getYDtoP(zm.y + zm.height));
      if(yr.start > yr.end) {
        double temp = yr.start;
        yr.start = yr.end;
        yr.end = temp;
      }
      //
      // turn batching on so all changes will appear at the
      // same time
      //
      mainPane_.setBatch(true);
      //
      // set range for transforms
      //
      xt_.setRangeU(xr);
      yt_.setRangeU(yr);
      //
      // set range and origin for axes
      //
      Point2D.Double orig = new Point2D.Double(xr.start, yr.start);
      xbot_.setRangeU(xr);
      xbot_.setLocationU(orig);

      yleft_.setRangeU(yr);
      yleft_.setLocationU(orig);
      //
      // set clipping on all graphs
      //
      Component[] comps = mainPane_.getComponents();
      Layer ly;
      for(int i=0; i < comps.length; i++) {
        if(comps[i] instanceof Layer) {
          ly = (Layer)comps[i];
          ((CartesianGraph)ly.getGraph()).setClip(xr.start, xr.end,
                                                  yr.start, yr.end);
        }
      }
      //
      // done with sgt modifications, turn batching off
      //
      mainPane_.setBatch(false);
    } else if(name.equals("objectSelected")) {
      //
      // An sgt object has been selected.
      // If it is a PointCartesianRenderer that means the key has been
      // selected and so open a dialog to modified the PointAttribute.
      //
      if(event.getNewValue() instanceof PointCartesianRenderer) {
	  PointAttribute pattr =
	    ((PointCartesianRenderer)event.getNewValue()).getPointAttribute();
	  if(pAttrDialog_ == null) {
	    pAttrDialog_ = new PointAttributeDialog();
	  }
	  pAttrDialog_.setPointAttribute(pattr, mainPane_);
	  pAttrDialog_.setVisible(true);
      } else {
	  //
	  // Print the name of the object selected.
	  //
	  System.out.println("objectSelected = " + event.getNewValue());
      }
    }
  }
 

Since:
2.0
Version:
$Revision: 1.19 $, $Date: 2001/12/13 00:16:15 $
Author:
Donald Denbo
See Also:
Layer, Graph, Graphics, Serialized Form

Inner classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Fields inherited from class javax.swing.JLayeredPane
DEFAULT_LAYER, DRAG_LAYER, FRAME_CONTENT_LAYER, LAYER_PROPERTY, MODAL_LAYER, PALETTE_LAYER, POPUP_LAYER
 
Fields inherited from class javax.swing.JComponent
TOOL_TIP_TEXT_KEY, 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 gov.noaa.pmel.sgt.AbstractPane
BOTTOM, CENTER, LEFT, MIDDLE, RIGHT, SPECIFIED_LOCATION, TOP
 
Fields inherited from interface java.awt.print.Printable
NO_SUCH_PAGE, PAGE_EXISTS
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
JPane()
          Default constructor.
JPane(java.lang.String id, java.awt.Dimension size)
          Constructs a Pane.
 
Method Summary
 java.awt.Component add(java.awt.Component comp)
          Adds the specified component to the end of the Pane.
 java.awt.Component add(java.awt.Component comp, int index)
          Adds the specified component to the Pane at the given position.
 void add(java.awt.Component comp, java.lang.Object constraints)
          Adds the specified component to the end of this Pane.
 void add(java.awt.Component comp, java.lang.Object constraints, int index)
          Adds the specified component to the end of this Pane at the specified index.
 java.awt.Component add(java.lang.String name, java.awt.Component comp)
          Adds the specified component to this Pane.
 void addPropertyChangeListener(java.beans.PropertyChangeListener l)
          Add a PropertyChangeListener to the list.
 void draw()
          The AbstractPane and all of the attached Classes will be drawn.
 void draw(java.awt.Graphics g)
          The AbstractPane and all of the attached Classes will be drawn.
 void draw(java.awt.Graphics g, int width, int height)
          The AbstractPane and all of the attached Classes will be drawn.
 void drawPage(java.awt.Graphics g, double width, double height)
          Used by internally by sgt.
 java.awt.Rectangle getBounds()
          Get the bounding rectangle in pixels (device units).
 java.awt.Component getComponent()
          Get the Component associated with the pane.
 Layer getFirstLayer()
          Get the first Layer associated with the Pane
 java.lang.String getId()
          Get the Pane identifier.
 Layer getLayer(java.lang.String id)
          Get the Layer associated with the Pane indicated by the id.
 Layer getLayerFromDataId(java.lang.String id)
          Get the Layer associated with the Pane indicated by the data id.
 java.awt.Dimension getMaximumSize()
          If the maximum size has been set to a non-null value just returns it.
 java.awt.Dimension getMinimumSize()
          If the minimum size has been set to a non-null value just returns it.
 java.lang.Object getObjectAt(int x, int y)
          Get the current selected object at a point.
 int getPageHAlign()
          Get horizontal alignment
 java.awt.Point getPageOrigin()
          Get the printer page origin.
 java.awt.Dimension getPageSize()
          Get the printer page size.
 int getPageVAlign()
          Get vertical alignment.
 java.awt.Dimension getPreferredScrollableViewportSize()
          Returns the preferred size of the viewport for a view component.
 java.awt.Dimension getPreferredSize()
          If the preferredSize has been set to a non-null value just returns it.
 int getScrollableBlockIncrement(java.awt.Rectangle visibleRect, int orientation, int direction)
          Components that display logical rows or columns should compute the scroll increment that will completely expose one block of rows or columns, depending on the value of orientation.
 boolean getScrollableTracksViewportHeight()
          Return true if a viewport should always force the height of this Scrollable to match the height of the viewport.
 boolean getScrollableTracksViewportWidth()
          Return true if a viewport should always force the width of this Scrollable to match the width of the viewport.
 int getScrollableUnitIncrement(java.awt.Rectangle visibleRect, int orientation, int direction)
          Components that display logical rows or columns should compute the scroll increment that will completely expose one new row or column, depending on the value of orientation.
 java.lang.Object getSelectedObject()
          Return the last object selected.
static StrokeDrawer getStrokeDrawer()
          Internal method to access jdk1.1 or Java2D line drawing.
 java.awt.Rectangle getZoomBounds()
          Get the current zoom bounding box.
 void init()
          No initialization required.
 boolean isBatch()
          Is batching turned on?
 boolean isModified()
          Has the plot been modified?
 boolean isPrinter()
          Test if the current Graphics object is a printer.
 void moveLayerDown(Layer lyr)
          Move the Layer down in the stack.
 void moveLayerDown(java.lang.String id)
          Move the Layer down in the stack.
 void moveLayerUp(Layer lyr)
          Move the Layer up in the stack.
 void moveLayerUp(java.lang.String id)
          Move the Layer up in the stack.
 void paintComponent(java.awt.Graphics g)
          Override default painting by swing.
 int print(java.awt.Graphics g, java.awt.print.PageFormat pf, int pageIndex)
          Prints the page at the specified index into the specified Graphics context in the specified format.
 void processMouseEvent(java.awt.event.MouseEvent event)
          Overrides the default event methods.
 void processMouseMotionEvent(java.awt.event.MouseEvent event)
          Used internally by sgt.
 void removePropertyChangeListener(java.beans.PropertyChangeListener l)
          Remove the PropertyChangeListener from the list.
 void setBatch(boolean batch)
          Turn on/off batching of updates to the pane.
 void setBatch(boolean batch, java.lang.String msg)
          Turn on/off batching of updates to the pane.
 void setId(java.lang.String id)
          Set the Pane identifier
 void setModified(boolean mod, java.lang.String mess)
          Notify the pane that something has changed and a redraw is required.
 void setPageAlign(int vert, int horz)
          Set alignment.
 void setPageHAlign(int horz)
          Set horizontal alignment.
 void setPageOrigin(java.awt.Point p)
          Set the printer page origin.
 void setPageVAlign(int vert)
          Set vertical alignment.
 void setScrollableBlockIncrement(int horiz, int vert)
          Set the horizontal and vertical block increments.
 void setScrollableUnitIncrement(int horiz, int vert)
          Set the horizontal and vertical unit increments.
 void setSelectedObject(java.lang.Object obj)
          Primarily used internally by sgt.
 void setSize(java.awt.Dimension d)
          Set the size.
 java.lang.String toString()
          Get a String representatinof the Pane.
 
Methods inherited from class javax.swing.JLayeredPane
getAccessibleContext, getComponentCountInLayer, getComponentsInLayer, getIndexOf, getLayer, getLayer, getLayeredPaneAbove, getPosition, highestLayer, isOptimizedDrawingEnabled, lowestLayer, moveToBack, moveToFront, paint, putLayer, remove, setLayer, setLayer, setPosition
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAutoscrolls, getBorder, getBounds, getClientProperty, getConditionForKeyStroke, getDebugGraphicsOptions, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getNextFocusableComponent, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getUIClassID, getVerifyInputWhenFocusTarget, getVisibleRect, getWidth, getX, getY, grabFocus, hasFocus, hide, isDoubleBuffered, isFocusCycleRoot, isFocusTraversable, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI
 
Methods inherited from class java.awt.Container
addContainerListener, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getLayout, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, remove, removeAll, removeContainerListener, setLayout, validate
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, bounds, checkImage, checkImage, contains, createImage, createImage, dispatchEvent, enable, enableInputMethods, getBackground, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, imageUpdate, inside, isDisplayable, isEnabled, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setLocale, setLocation, setLocation, setName, setSize, show, show, size, transferFocus
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JPane

public JPane(java.lang.String id,
             java.awt.Dimension size)
Constructs a Pane.
Parameters:
id - the Pane identifier
size - the size of the Pane in pixels

JPane

public JPane()
Default constructor. The identifier is set to an empty string and the size is set to a width and height of 50 pixels. A default constructor is required to work as a component with Visual Cafe.
 import gov.noaa.pmel.sgt.JPane;
 ...
 JPane pane;
 ...
 pane = new JPane("main graph", new Dimension(400, 500));
 pane.setLayout(new StackedLayout());
 ...
 
See Also:
StackedLayout
Method Detail

draw

public void draw()
Description copied from interface: AbstractPane
The AbstractPane and all of the attached Classes will be drawn. Drawing will occur in an offscreen image and then copied to the screen. A new offscreen image is created on the first call to draw() or if the size of the pane has been changed. The offscreen image will be used as a "double" buffer when the screen requires redrawing.

Each Layer that has been added will be drawn in the order added, except if that order has been change using the moveLayerUp() or moveLayerDown() methods.

Specified by:
draw in interface AbstractPane
Following copied from interface: gov.noaa.pmel.sgt.AbstractPane
See Also:
Graphics, Layer

init

public void init()
No initialization required.
Specified by:
init in interface AbstractPane

draw

public void draw(java.awt.Graphics g)
Description copied from interface: AbstractPane
The AbstractPane and all of the attached Classes will be drawn. Drawing will occur using the supplied Graphics object.
Specified by:
draw in interface AbstractPane
Following copied from interface: gov.noaa.pmel.sgt.AbstractPane
Parameters:
g - User supplied Graphics object
See Also:
Graphics

draw

public void draw(java.awt.Graphics g,
                 int width,
                 int height)
Description copied from interface: AbstractPane
The AbstractPane and all of the attached Classes will be drawn. Drawing will occur using the supplied Graphics object. And clipping will be done to the width and height.
Specified by:
draw in interface AbstractPane
Following copied from interface: gov.noaa.pmel.sgt.AbstractPane
Parameters:
g - User supplied Graphics object
width - clipping width
height - clipping height
See Also:
Graphics

isPrinter

public boolean isPrinter()
Description copied from interface: AbstractPane
Test if the current Graphics object is a printer.
Specified by:
isPrinter in interface AbstractPane
Following copied from interface: gov.noaa.pmel.sgt.AbstractPane
Returns:
true if a printer

getStrokeDrawer

public static StrokeDrawer getStrokeDrawer()
Internal method to access jdk1.1 or Java2D line drawing.

getPageSize

public java.awt.Dimension getPageSize()
Description copied from interface: AbstractPane
Get the printer page size.
Specified by:
getPageSize in interface AbstractPane
Following copied from interface: gov.noaa.pmel.sgt.AbstractPane
Returns:
page size

paintComponent

public void paintComponent(java.awt.Graphics g)
Override default painting by swing.

add

public java.awt.Component add(java.awt.Component comp)
Adds the specified component to the end of the Pane.
Overrides:
add in class java.awt.Container
Parameters:
comp - the component to be added
Returns:
component argument

add

public java.awt.Component add(java.awt.Component comp,
                              int index)
Adds the specified component to the Pane at the given position.
Overrides:
add in class java.awt.Container
Parameters:
comp - the component to be added
index - the position at which to insert the component, or -1 to insert the component at the end.
Returns:
component argument

add

public void add(java.awt.Component comp,
                java.lang.Object constraints)
Adds the specified component to the end of this Pane. Also notifies the layout manager to add the component to this Pane's layout using the specified constraints object.
Overrides:
add in class java.awt.Container
Parameters:
comp - the component to be added
constraints - an object expressing layout constraints for this component

add

public void add(java.awt.Component comp,
                java.lang.Object constraints,
                int index)
Adds the specified component to the end of this Pane at the specified index. Also notifies the layout manager to add the component to this Pane's layout using the specified constraints object.
Overrides:
add in class java.awt.Container
Parameters:
comp - the component to be added
constraints - an object expressing layout constraints for this component
index - the position in the Pane's list at which to insert the component -1 means insert at the end.

add

public java.awt.Component add(java.lang.String name,
                              java.awt.Component comp)
Adds the specified component to this Pane. It is strongly advised to use add(Component, Object), in place of this method.
Overrides:
add in class java.awt.Container

getBounds

public java.awt.Rectangle getBounds()
Description copied from interface: AbstractPane
Get the bounding rectangle in pixels (device units).
Specified by:
getBounds in interface AbstractPane
Overrides:
getBounds in class java.awt.Component
Following copied from interface: gov.noaa.pmel.sgt.AbstractPane
Returns:
Rectangle object containing the bounding box for the pane.

getId

public java.lang.String getId()
Description copied from interface: AbstractPane
Get the Pane identifier.
Specified by:
getId in interface AbstractPane
Following copied from interface: gov.noaa.pmel.sgt.AbstractPane
Returns:
String containing the Pane identifier.

setId

public void setId(java.lang.String id)
Description copied from interface: AbstractPane
Set the Pane identifier
Specified by:
setId in interface AbstractPane

setPageAlign

public void setPageAlign(int vert,
                         int horz)
Description copied from interface: AbstractPane
Set alignment.
Specified by:
setPageAlign in interface AbstractPane
Following copied from interface: gov.noaa.pmel.sgt.AbstractPane
Parameters:
vert - vertical alignment
horz - horizontal alignment

setPageVAlign

public void setPageVAlign(int vert)
Description copied from interface: AbstractPane
Set vertical alignment. Allowed choices include TOP, MIDDLE, and BOTTOM for vert and LEFT, CENTER, and RIGHT for horz.
Specified by:
setPageVAlign in interface AbstractPane
Following copied from interface: gov.noaa.pmel.sgt.AbstractPane
Parameters:
vert - vertical alignment
See Also:
AbstractPane.TOP, AbstractPane.MIDDLE, AbstractPane.BOTTOM, AbstractPane.LEFT, AbstractPane.CENTER, AbstractPane.RIGHT

setPageHAlign

public void setPageHAlign(int horz)
Description copied from interface: AbstractPane
Set horizontal alignment. Allowed choices include TOP, MIDDLE, and BOTTOM.
Specified by:
setPageHAlign in interface AbstractPane
Following copied from interface: gov.noaa.pmel.sgt.AbstractPane
Parameters:
horz - horizontal alignment
See Also:
AbstractPane.TOP, AbstractPane.MIDDLE, AbstractPane.BOTTOM

getPageVAlign

public int getPageVAlign()
Description copied from interface: AbstractPane
Get vertical alignment. Allowed choices include LEFT, CENTER, and RIGHT.
Specified by:
getPageVAlign in interface AbstractPane
Following copied from interface: gov.noaa.pmel.sgt.AbstractPane
Returns:
vertical alignment
See Also:
AbstractPane.LEFT, AbstractPane.CENTER, AbstractPane.RIGHT

getPageHAlign

public int getPageHAlign()
Description copied from interface: AbstractPane
Get horizontal alignment
Specified by:
getPageHAlign in interface AbstractPane
Following copied from interface: gov.noaa.pmel.sgt.AbstractPane
Returns:
horizontal alignment

setPageOrigin

public void setPageOrigin(java.awt.Point p)
Description copied from interface: AbstractPane
Set the printer page origin.
Specified by:
setPageOrigin in interface AbstractPane

getPageOrigin

public java.awt.Point getPageOrigin()
Description copied from interface: AbstractPane
Get the printer page origin.
Specified by:
getPageOrigin in interface AbstractPane

setSize

public void setSize(java.awt.Dimension d)
Set the size.
Overrides:
setSize in class java.awt.Component
Following copied from class: java.awt.Component
Parameters:
d - The dimension specifying the new size of this component.
See Also:
Component.setSize(int, int), Component.setBounds(int, int, int, int)

getFirstLayer

public Layer getFirstLayer()
Description copied from interface: AbstractPane
Get the first Layer associated with the Pane
Specified by:
getFirstLayer in interface AbstractPane
Following copied from interface: gov.noaa.pmel.sgt.AbstractPane
Returns:
the first Layer object

getLayer

public Layer getLayer(java.lang.String id)
               throws LayerNotFoundException
Description copied from interface: AbstractPane
Get the Layer associated with the Pane indicated by the id.
Specified by:
getLayer in interface AbstractPane
Following copied from interface: gov.noaa.pmel.sgt.AbstractPane
Parameters:
id - identifier.
Throws:
LayerNotFoundException - The Layer indicated by the id was not found.

getLayerFromDataId

public Layer getLayerFromDataId(java.lang.String id)
                         throws LayerNotFoundException
Description copied from interface: AbstractPane
Get the Layer associated with the Pane indicated by the data id.
Specified by:
getLayerFromDataId in interface AbstractPane
Following copied from interface: gov.noaa.pmel.sgt.AbstractPane
Parameters:
id - data identifier
Throws:
LayerNotFoundException - The Layer indicated by the id was not found.
See Also:
SGTData

moveLayerUp

public void moveLayerUp(Layer lyr)
                 throws LayerNotFoundException
Move the Layer up in the stack. The order of the layers determine when they are drawn. Moving the Layer up causes the Layer to be drawn later and over earlier layers.
Parameters:
lyr - Layer object.
Throws:
LayerNotFoundException - The specified Layer was not found in the list.
See Also:
Layer

moveLayerUp

public void moveLayerUp(java.lang.String id)
                 throws LayerNotFoundException
Move the Layer up in the stack. The order of the layers determine when they are drawn. Moving the Layer up causes the Layer to be drawn later and over earlier layers.
Parameters:
id - identifier.
Throws:
LayerNotFoundException - The specified Layer was not found in the list.
See Also:
Layer

moveLayerDown

public void moveLayerDown(Layer lyr)
                   throws LayerNotFoundException
Move the Layer down in the stack. The order of the layers determine when they are drawn. Moving the Layer down causes the Layer to be drawn earlier.
Parameters:
lyr - Layer object.
Throws:
LayerNotFoundException - The specified Layer was not found in the list.
See Also:
Layer

moveLayerDown

public void moveLayerDown(java.lang.String id)
                   throws LayerNotFoundException
Move the Layer down in the stack. The order of the layers determine when they are drawn. Moving the Layer down causes the Layer to be drawn earlier.
Parameters:
id - identifier
Throws:
LayerNotFoundException - The specified Layer was not found in the list.
See Also:
Layer

getSelectedObject

public java.lang.Object getSelectedObject()
Description copied from interface: AbstractPane
Return the last object selected. Returns only objects that are part of Layers currently connected to the pane. AbstractPane tests each layer after a MOUSE_DOWN event for an object whose bounding box contains the mouse. The pane object then passes the event on to the next level.
Specified by:
getSelectedObject in interface AbstractPane

setSelectedObject

public void setSelectedObject(java.lang.Object obj)
Description copied from interface: AbstractPane
Primarily used internally by sgt. This can also be used to mark an object as selected for use in an event handler.
Specified by:
setSelectedObject in interface AbstractPane

processMouseEvent

public void processMouseEvent(java.awt.event.MouseEvent event)
Overrides the default event methods.

processMouseMotionEvent

public void processMouseMotionEvent(java.awt.event.MouseEvent event)
Used internally by sgt.

getZoomBounds

public java.awt.Rectangle getZoomBounds()
Get the current zoom bounding box.
Specified by:
getZoomBounds in interface AbstractPane
Following copied from interface: gov.noaa.pmel.sgt.AbstractPane
Returns:
zoom rectangle

getObjectAt

public java.lang.Object getObjectAt(int x,
                                    int y)
Description copied from interface: AbstractPane
Get the current selected object at a point. Used internally by sgt.
Specified by:
getObjectAt in interface AbstractPane

getComponent

public java.awt.Component getComponent()
Description copied from interface: AbstractPane
Get the Component associated with the pane.
Specified by:
getComponent in interface AbstractPane

getMaximumSize

public java.awt.Dimension getMaximumSize()
Description copied from class: javax.swing.JComponent
If the maximum size has been set to a non-null value just returns it. If the UI delegate's getMaximumSize() method returns a non null value then return that; otherwise defer to the component's layout manager.
Overrides:
getMaximumSize in class javax.swing.JComponent
Following copied from class: javax.swing.JComponent
Returns:
the value of the maximumSize property.
See Also:
JComponent.setMaximumSize(java.awt.Dimension)

getMinimumSize

public java.awt.Dimension getMinimumSize()
Description copied from class: javax.swing.JComponent
If the minimum size has been set to a non-null value just returns it. If the UI delegate's getMinimumSize() method returns a non-null value then return that; otherwise defer to the component's layout manager.
Overrides:
getMinimumSize in class javax.swing.JComponent
Following copied from class: javax.swing.JComponent
Returns:
the value of the minimumSize property
See Also:
JComponent.setMinimumSize(java.awt.Dimension)

getPreferredSize

public java.awt.Dimension getPreferredSize()
Description copied from class: javax.swing.JComponent
If the preferredSize has been set to a non-null value just returns it. If the UI delegate's getPreferredSize() method returns a non null value then return that; otherwise defer to the component's layout manager.
Overrides:
getPreferredSize in class javax.swing.JComponent
Following copied from class: javax.swing.JComponent
Returns:
the value of the preferredSize property
See Also:
JComponent.setPreferredSize(java.awt.Dimension)

toString

public java.lang.String toString()
Get a String representatinof the Pane.
Overrides:
toString in class java.awt.Component
Returns:
String representation

setBatch

public void setBatch(boolean batch,
                     java.lang.String msg)
Description copied from interface: AbstractPane
Turn on/off batching of updates to the pane. While batching is true property change events will not cause pane to redraw. When batching is turned back on if the pane has been modified it will then redraw.
Specified by:
setBatch in interface AbstractPane

setBatch

public void setBatch(boolean batch)
Description copied from interface: AbstractPane
Turn on/off batching of updates to the pane. While batching is true property change events will not cause pane to redraw. When batching is turned back on if the pane has been modified it will then redraw.
Specified by:
setBatch in interface AbstractPane

isBatch

public boolean isBatch()
Description copied from interface: AbstractPane
Is batching turned on?
Specified by:
isBatch in interface AbstractPane

setModified

public void setModified(boolean mod,
                        java.lang.String mess)
Description copied from interface: AbstractPane
Notify the pane that something has changed and a redraw is required. Used internally by sgt.
Specified by:
setModified in interface AbstractPane

isModified

public boolean isModified()
Description copied from interface: AbstractPane
Has the plot been modified?
Specified by:
isModified in interface AbstractPane

setScrollableBlockIncrement

public void setScrollableBlockIncrement(int horiz,
                                        int vert)
Set the horizontal and vertical block increments.

getScrollableBlockIncrement

public int getScrollableBlockIncrement(java.awt.Rectangle visibleRect,
                                       int orientation,
                                       int direction)
Description copied from interface: javax.swing.Scrollable
Components that display logical rows or columns should compute the scroll increment that will completely expose one block of rows or columns, depending on the value of orientation.

Scrolling containers, like JScrollPane, will use this method each time the user requests a block scroll.

Specified by:
getScrollableBlockIncrement in interface javax.swing.Scrollable
Following copied from interface: javax.swing.Scrollable
Parameters:
visibleRect - The view area visible within the viewport
orientation - Either SwingConstants.VERTICAL or SwingConstants.HORIZONTAL.
direction - Less than zero to scroll up/left, greater than zero for down/right.
Returns:
The "block" increment for scrolling in the specified direction.
See Also:
JScrollBar.setBlockIncrement(int)

setScrollableUnitIncrement

public void setScrollableUnitIncrement(int horiz,
                                       int vert)
Set the horizontal and vertical unit increments.

getScrollableUnitIncrement

public int getScrollableUnitIncrement(java.awt.Rectangle visibleRect,
                                      int orientation,
                                      int direction)
Description copied from interface: javax.swing.Scrollable
Components that display logical rows or columns should compute the scroll increment that will completely expose one new row or column, depending on the value of orientation. Ideally, components should handle a partially exposed row or column by returning the distance required to completely expose the item.

Scrolling containers, like JScrollPane, will use this method each time the user requests a unit scroll.

Specified by:
getScrollableUnitIncrement in interface javax.swing.Scrollable
Following copied from interface: javax.swing.Scrollable
Parameters:
visibleRect - The view area visible within the viewport
orientation - Either SwingConstants.VERTICAL or SwingConstants.HORIZONTAL.
direction - Less than zero to scroll up/left, greater than zero for down/right.
Returns:
The "unit" increment for scrolling in the specified direction
See Also:
JScrollBar.setUnitIncrement(int)

getPreferredScrollableViewportSize

public java.awt.Dimension getPreferredScrollableViewportSize()
Description copied from interface: javax.swing.Scrollable
Returns the preferred size of the viewport for a view component. For example the preferredSize of a JList component is the size required to acommodate all of the cells in its list however the value of preferredScrollableViewportSize is the size required for JList.getVisibleRowCount() rows. A component without any properties that would effect the viewport size should just return getPreferredSize() here.
Specified by:
getPreferredScrollableViewportSize in interface javax.swing.Scrollable
Following copied from interface: javax.swing.Scrollable
Returns:
The preferredSize of a JViewport whose view is this Scrollable.
See Also:
JComponent.getPreferredSize()

getScrollableTracksViewportHeight

public boolean getScrollableTracksViewportHeight()
Description copied from interface: javax.swing.Scrollable
Return true if a viewport should always force the height of this Scrollable to match the height of the viewport. For example a columnar text view that flowed text in left to right columns could effectively disable vertical scrolling by returning true here.

Scrolling containers, like JViewport, will use this method each time they are validated.

Specified by:
getScrollableTracksViewportHeight in interface javax.swing.Scrollable
Following copied from interface: javax.swing.Scrollable
Returns:
True if a viewport should force the Scrollables height to match its own.

getScrollableTracksViewportWidth

public boolean getScrollableTracksViewportWidth()
Description copied from interface: javax.swing.Scrollable
Return true if a viewport should always force the width of this Scrollable to match the width of the viewport. For example a noraml text view that supported line wrapping would return true here, since it would be undesirable for wrapped lines to disappear beyond the right edge of the viewport. Note that returning true for a Scrollable whose ancestor is a JScrollPane effectively disables horizontal scrolling.

Scrolling containers, like JViewport, will use this method each time they are validated.

Specified by:
getScrollableTracksViewportWidth in interface javax.swing.Scrollable
Following copied from interface: javax.swing.Scrollable
Returns:
True if a viewport should force the Scrollables width to match its own.

print

public int print(java.awt.Graphics g,
                 java.awt.print.PageFormat pf,
                 int pageIndex)
Description copied from interface: java.awt.print.Printable
Prints the page at the specified index into the specified Graphics context in the specified format. A PrinterJob calls the Printable interface to request that a page be rendered into the context specified by graphics. The format of the page to be drawn is specified by pageFormat. The zero based index of the requested page is specified by pageIndex. If the requested page does not exist then this method returns NO_SUCH_PAGE; otherwise PAGE_EXISTS is returned. The Graphics class or subclass implements the PrinterGraphics interface to provide additional information. If the Printable object aborts the print job then it throws a PrinterException.
Specified by:
print in interface java.awt.print.Printable
Following copied from interface: java.awt.print.Printable
Parameters:
graphics - the context into which the page is drawn
pageFormat - the size and orientation of the page being drawn
pageIndex - the zero based index of the page to be drawn
Returns:
PAGE_EXISTS if the page is rendered successfully or NO_SUCH_PAGE if pageIndex specifies a non-existent page.
Throws:
java.awt.print.PrinterException - thrown when the print job is terminated.

drawPage

public void drawPage(java.awt.Graphics g,
                     double width,
                     double height)
Used by internally by sgt.

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener l)
Description copied from interface: AbstractPane
Add a PropertyChangeListener to the list. Properties for Pane and JPane include "objectSelected" and "zoomRectangle".
Specified by:
addPropertyChangeListener in interface AbstractPane
Overrides:
addPropertyChangeListener in class javax.swing.JComponent
Following copied from class: javax.swing.JComponent
Parameters:
listener - the PropertyChangeListener to be added

removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener l)
Description copied from interface: AbstractPane
Remove the PropertyChangeListener from the list.
Specified by:
removePropertyChangeListener in interface AbstractPane
Overrides:
removePropertyChangeListener in class javax.swing.JComponent
Following copied from class: javax.swing.JComponent
Parameters:
listener - the PropertyChangeListener to be removed


Send comments about the Scientific Graphics toolkit to dwd@pmel.noaa.gov. For more information about Java Development in the EPIC Group see the EPIC Software Page
Generated on December 13 2001