org.das2.graph
Class DasDevicePosition

java.lang.Object
  extended by org.das2.graph.DasDevicePosition
All Implemented Interfaces:
java.io.Serializable, Editable
Direct Known Subclasses:
DasColumn, DasRow

public abstract class DasDevicePosition
extends java.lang.Object
implements Editable, java.io.Serializable

See Also:
Serialized Form

Field Summary
protected  DasCanvas canvas
           
protected  javax.swing.event.EventListenerList listenerList
           
protected  DasDevicePosition parent
           
 
Constructor Summary
protected DasDevicePosition(DasCanvas canvas, boolean isWidth, DasDevicePosition parent, double minimum, double maximum, double emMinimum, double emMaximum, int ptMinimum, int ptMaximum)
           
  DasDevicePosition(DasCanvas parent, double minimum, double maximum, boolean width)
           
 
Method Summary
 void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
           
 void addPropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
           
 void addpwUpdateListener(DasUpdateListener l)
           
 boolean contains(int x)
          returns true if ( getDMinimum() <= x ) && ( x <= getDMaximum() );
protected  void firePropertyChange(java.lang.String propertyName, boolean oldValue, boolean newValue)
           
protected  void firePropertyChange(java.lang.String propertyName, double oldValue, double newValue)
           
protected  void firePropertyChange(java.lang.String propertyName, float oldValue, float newValue)
           
protected  void firePropertyChange(java.lang.String propertyName, int oldValue, int newValue)
           
protected  void firePropertyChange(java.lang.String propertyName, long oldValue, long newValue)
           
protected  void firePropertyChange(java.lang.String propertyName, java.lang.Object oldValue, java.lang.Object newValue)
           
protected  void fireUpdate()
           
static java.lang.String formatLayoutStr(DasDevicePosition pos, boolean min)
           
protected  DasCanvas getCanvas()
           
 java.lang.String getDasName()
           
protected  int getDeviceSize()
           
 int getDMaximum()
          returns the pixel position of the maximum of the Row/Column.
 int getDMiddle()
          returns pixel position (device position) of the the middle of the row or column
 int getDMinimum()
          returns the pixel position of the minimum of the Row/Column.
 double getEmMaximum()
           
 double getEmMinimum()
          return the em offset that controls the position of the top/left boundry.
 int getEmSize()
          returns the em size for the canvas.
 double getMaximum()
           
 double getMinimum()
          return the normal position control of the top/left.
 DasCanvas getParent()
           
 DasDevicePosition getParentDevicePosition()
           
 int getPtMaximum()
          return the points offset that controls the position of the bottom/right boundry.
 int getPtMinimum()
          return the points offset that controls the position of the top/left boundry.
 boolean isValueIsAdjusting()
           
protected  MutatorLock mutatorLock()
           
static double[] parseFormatStr(java.lang.String s)
          parse position strings like "100%-5em+4pt" into npos, emoffset, pt_offset.
static void parseLayoutStr(DasDevicePosition pos, java.lang.String spec)
           
 void removePropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
           
 void removepwUpdateListener(DasUpdateListener l)
           
 void setDasName(java.lang.String name)
           
 void setDMaximum(int maximum)
          set the new pixel position of the bottom/right boundry.
 void setDMinimum(int minimum)
          set the new pixel position of the top/left boundry.
 void setDPosition(int minimum, int maximum)
           
 void setEmMaximum(double emMaximum)
           
 void setEmMinimum(double emMinimum)
           
 void setMaximum(double maximum)
           
 void setMinimum(double minimum)
           
 void setParent(DasCanvas parent)
           
 void setPtMaximum(int ptMaximum)
           
 void setPtMinimum(int ptMinimum)
           
static java.awt.Rectangle toRectangle(DasRow row, DasColumn column)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

canvas

protected transient DasCanvas canvas

parent

protected transient DasDevicePosition parent

listenerList

protected javax.swing.event.EventListenerList listenerList
Constructor Detail

DasDevicePosition

protected DasDevicePosition(DasCanvas canvas,
                            boolean isWidth,
                            DasDevicePosition parent,
                            double minimum,
                            double maximum,
                            double emMinimum,
                            double emMaximum,
                            int ptMinimum,
                            int ptMaximum)

DasDevicePosition

public DasDevicePosition(DasCanvas parent,
                         double minimum,
                         double maximum,
                         boolean width)
Method Detail

parseFormatStr

public static double[] parseFormatStr(java.lang.String s)
                               throws java.text.ParseException
parse position strings like "100%-5em+4pt" into npos, emoffset, pt_offset. Note px is acceptable, but pt is proper. Ems are rounded to the nearest hundredth. Percents are returned as normal (0-1) and rounded to the nearest thousandth.

Throws:
java.text.ParseException

parseLayoutStr

public static void parseLayoutStr(DasDevicePosition pos,
                                  java.lang.String spec)
                           throws java.text.ParseException
Throws:
java.text.ParseException

formatLayoutStr

public static java.lang.String formatLayoutStr(DasDevicePosition pos,
                                               boolean min)

getCanvas

protected DasCanvas getCanvas()

setDasName

public void setDasName(java.lang.String name)
                throws DasNameException
Throws:
DasNameException

getDasName

public java.lang.String getDasName()

getEmSize

public int getEmSize()
returns the em size for the canvas. We define the em size as the height of the font.

Returns:
the em height in points.

getDMinimum

public int getDMinimum()
returns the pixel position of the minimum of the Row/Column. This is the left side of a column and the top of a row.

Returns:
the pixel position (pixel=point for now)

getDMaximum

public int getDMaximum()
returns the pixel position of the maximum of the Row/Column. This is the right side of a column and the bottom of a row.

Returns:
the pixel position (pixel=point for now)

getMinimum

public double getMinimum()
return the normal position control of the top/left.

Returns:

getMaximum

public double getMaximum()

setDPosition

public void setDPosition(int minimum,
                         int maximum)

setMaximum

public void setMaximum(double maximum)

setDMaximum

public void setDMaximum(int maximum)
set the new pixel position of the bottom/right boundry. em and pt offsets are not modified, and the normal position is recalculated.

Parameters:
maximum -

setMinimum

public void setMinimum(double minimum)

setDMinimum

public void setDMinimum(int minimum)
set the new pixel position of the top/left boundry. em and pt offsets are not modified, and the normal position is recalculated.

Parameters:
minimum -

getParent

public DasCanvas getParent()

setParent

public void setParent(DasCanvas parent)

mutatorLock

protected MutatorLock mutatorLock()

addpwUpdateListener

public void addpwUpdateListener(DasUpdateListener l)

removepwUpdateListener

public void removepwUpdateListener(DasUpdateListener l)

fireUpdate

protected void fireUpdate()

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)

addPropertyChangeListener

public void addPropertyChangeListener(java.lang.String propertyName,
                                      java.beans.PropertyChangeListener listener)

removePropertyChangeListener

public void removePropertyChangeListener(java.lang.String propertyName,
                                         java.beans.PropertyChangeListener listener)

firePropertyChange

protected void firePropertyChange(java.lang.String propertyName,
                                  boolean oldValue,
                                  boolean newValue)

firePropertyChange

protected void firePropertyChange(java.lang.String propertyName,
                                  int oldValue,
                                  int newValue)

firePropertyChange

protected void firePropertyChange(java.lang.String propertyName,
                                  long oldValue,
                                  long newValue)

firePropertyChange

protected void firePropertyChange(java.lang.String propertyName,
                                  float oldValue,
                                  float newValue)

firePropertyChange

protected void firePropertyChange(java.lang.String propertyName,
                                  double oldValue,
                                  double newValue)

firePropertyChange

protected void firePropertyChange(java.lang.String propertyName,
                                  java.lang.Object oldValue,
                                  java.lang.Object newValue)

getDeviceSize

protected int getDeviceSize()

toRectangle

public static java.awt.Rectangle toRectangle(DasRow row,
                                             DasColumn column)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

contains

public boolean contains(int x)
returns true if ( getDMinimum() <= x ) && ( x <= getDMaximum() );

Parameters:
x - the pixel position
Returns:

getDMiddle

public int getDMiddle()
returns pixel position (device position) of the the middle of the row or column

Returns:

getEmMinimum

public double getEmMinimum()
return the em offset that controls the position of the top/left boundry.

Returns:

setEmMinimum

public void setEmMinimum(double emMinimum)

getEmMaximum

public double getEmMaximum()

setEmMaximum

public void setEmMaximum(double emMaximum)

getPtMinimum

public int getPtMinimum()
return the points offset that controls the position of the top/left boundry.

Returns:

setPtMinimum

public void setPtMinimum(int ptMinimum)

getPtMaximum

public int getPtMaximum()
return the points offset that controls the position of the bottom/right boundry.

Returns:

setPtMaximum

public void setPtMaximum(int ptMaximum)

getParentDevicePosition

public DasDevicePosition getParentDevicePosition()

isValueIsAdjusting

public boolean isValueIsAdjusting()