org.tigris.gef.base
Class LayerGrid

java.lang.Object
  extended by org.tigris.gef.base.Layer
      extended by org.tigris.gef.base.LayerGrid
All Implemented Interfaces:
java.io.Serializable

public class LayerGrid
extends Layer

Paint a background drawing guide consisting of horizontal and vertical lines in a neutral color. This feature is common to many drawing applications (e.g., MacDraw). LayerGrid is in concept a Layer, just like any other so it can be composed, locked, grayed, hidden, and reordered.

See Also:
Serialized Form

Field Summary
protected  java.awt.Color _bgColor
          The color of the space between the lines or dots.
protected  java.awt.Color _color
          The color of the grid lines or dots.
protected  int _dotSize
          The size of the dots.
protected  boolean _paintBackground
          True means to fill in the image stamp or drawing area with the background color.
 
Fields inherited from class org.tigris.gef.base.Layer
_editors, _onMenu
 
Constructor Summary
LayerGrid()
          Construct a new LayerGrid and name it 'Grid'.
LayerGrid(java.awt.Color fore, java.awt.Color back, int spacing, boolean lines)
          Construct a new LayerGrid with the given foreground color, background color, line spacing, and lines/dots flag.
 
Method Summary
 void adjust()
          Eventually this will open a dialog box to let the user adjust the grid line spacing, colors, and whether liens or dots are shown.
 java.util.Collection getContents(java.util.Collection c)
          Get the figs that make up this layer.
 void paintContents(java.awt.Graphics g)
          Paint the grid lines or dots by repeatedly bitblting a precomputed 'stamp' onto the given Graphics
protected  void paintDots(java.awt.Graphics g, boolean paintBackground)
          Paint dots on the given Graphics.
 Fig presentationFor(java.lang.Object obj)
          Given an object from the net-level model (e.g., NetNode or NetPort), reply the graphical depiction of that object in this layer, if there is one.
 
Methods inherited from class org.tigris.gef.base.Layer
add, addEditor, bringForward, bringInFrontOf, bringToFront, calcDrawingArea, clone, damageAll, deleted, elements, elementsIn, getContents, getContentsEdgesOnly, getContentsNoEdges, getEditors, getGrayed, getHidden, getLocked, getName, getOnMenu, getPerspectiveType, getScale, hit, isAlwaysOnTop, nodesIn, paint, paint, paintContents, paintGrayContents, postLoad, postSave, preSave, print, refreshEditors, remove, removeAll, removeEditor, reorder, sendBackward, sendToBack, setAlwaysOnTop, setGrayed, setHidden, setLocked, setName, setOnMenu, setPerspectiveType, setScale, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_color

protected java.awt.Color _color
The color of the grid lines or dots.


_bgColor

protected java.awt.Color _bgColor
The color of the space between the lines or dots.


_paintBackground

protected boolean _paintBackground
True means to fill in the image stamp or drawing area with the background color. False means to just paint the lines or dots.


_dotSize

protected int _dotSize
The size of the dots. Dots are actually small rectangles.

Constructor Detail

LayerGrid

public LayerGrid()
Construct a new LayerGrid and name it 'Grid'.


LayerGrid

public LayerGrid(java.awt.Color fore,
                 java.awt.Color back,
                 int spacing,
                 boolean lines)
Construct a new LayerGrid with the given foreground color, background color, line spacing, and lines/dots flag.

Method Detail

getContents

public java.util.Collection getContents(java.util.Collection c)
Description copied from class: Layer
Get the figs that make up this layer.

Specified by:
getContents in class Layer
Parameters:
c - the collection in which to place the edges or null if a new collection should be created
Returns:
the figs

presentationFor

public Fig presentationFor(java.lang.Object obj)
Description copied from class: Layer
Given an object from the net-level model (e.g., NetNode or NetPort), reply the graphical depiction of that object in this layer, if there is one. Otherwise reply null.

Specified by:
presentationFor in class Layer

paintContents

public void paintContents(java.awt.Graphics g)
Paint the grid lines or dots by repeatedly bitblting a precomputed 'stamp' onto the given Graphics

Specified by:
paintContents in class Layer

paintDots

protected void paintDots(java.awt.Graphics g,
                         boolean paintBackground)
Paint dots on the given Graphics.


adjust

public void adjust()
Eventually this will open a dialog box to let the user adjust the grid line spacing, colors, and whether liens or dots are shown. For now it just cycles among 5 predefined styles.

Overrides:
adjust in class Layer
See Also:
LayerGrid