com.sun.electric.database.variable
Class MutableTextDescriptor

java.lang.Object
  extended by com.sun.electric.database.variable.MutableTextDescriptor
All Implemented Interfaces:
java.io.Serializable

public class MutableTextDescriptor
extends java.lang.Object

This class describes how variable text appears.

See Also:
Serialized Form

Nested Class Summary
static class AbstractTextDescriptor.ActiveFont
          ActiveFont is a class that describes fonts currently in use.
static class AbstractTextDescriptor.Display
          enumeration which represents text visibility .
static class AbstractTextDescriptor.DispPos
          DispPos is a typesafe enum class that describes text's display position on a Variable.
static class AbstractTextDescriptor.Position
          Position is a typesafe enum class that describes the text position of a Variable.
static class AbstractTextDescriptor.Rotation
          Rotation is a typesafe enum class that describes text's rotation in a Variable.
static class AbstractTextDescriptor.Size
          Size is a class that describes text's size on a Variable.
static class AbstractTextDescriptor.Unit
          Unit is a typesafe enum class that describes text's units on a Variable.
 
Constructor Summary
MutableTextDescriptor()
          The constructor simply creates a TextDescriptor with zero values filled-in.
MutableTextDescriptor(com.sun.electric.database.variable.AbstractTextDescriptor descriptor)
          The constructor creates copy of anotherTextDescriptor.
MutableTextDescriptor(long descriptor, int colorIndex, boolean display)
          The constructor simply creates a TextDescriptor with specified values.
 
Method Summary
 boolean equals(java.lang.Object anObject)
          Compares this text descriptor to the specified object.
static MutableTextDescriptor getAnnotationTextDescriptor()
          Method to return a displayable TextDescriptor that is a default for Variables on Annotations.
static MutableTextDescriptor getArcTextDescriptor()
          Method to return a displayable TextDescriptor that is a default for Variables on ArcInsts.
static MutableTextDescriptor getCellTextDescriptor()
          Method to return a displayable TextDescriptor that is a default for Variables on Cell Variables.
 int getColorIndex()
          Method to return the color index of the TextDescriptor.
static java.awt.Font getDefaultFont()
          Method to get a default Font to use.
static int getDefaultFontSize()
           
 AbstractTextDescriptor.Display getDisplay()
          Method to return mode how this TextDescriptor is displayable.
 AbstractTextDescriptor.DispPos getDispPart()
          Method to return the text display part of the TextDescriptor.
static MutableTextDescriptor getExportTextDescriptor()
          Method to return a displayable TextDescriptor that is a default for Variables on Exports.
 int getFace()
          Method to return the text font of the TextDescriptor.
 java.awt.Font getFont(EditWindow0 wnd, int minimalTextSize)
          Method to get a Font to use for this TextDescriptor in a given EditWindow.
static java.awt.font.GlyphVector getGlyphs(java.lang.String text, java.awt.Font font)
          Method to convert a string and descriptor to a GlyphVector.
static MutableTextDescriptor getInstanceTextDescriptor()
          Method to return a displayable TextDescriptor that is a default for Variables on Cell Instance Names.
static MutableTextDescriptor getNodeTextDescriptor()
          Method to return a displayable TextDescriptor that is a default for Variables on NodeInsts.
 AbstractTextDescriptor.Position getPos()
          Method to return the text position of the TextDescriptor.
 AbstractTextDescriptor.Rotation getRotation()
          Method to return the text rotation of the TextDescriptor.
 AbstractTextDescriptor.Size getSize()
          Method to return the text size of the text in this TextDescriptor.
 double getTrueSize(double scale)
          Method to find the true size in points for this TextDescriptor in a given scale.
 double getTrueSize(EditWindow0 wnd)
          Method to find the true size in points for this TextDescriptor in a given EditWindow0.
 AbstractTextDescriptor.Unit getUnit()
          Method to return the Unit of the TextDescriptor.
 double getXOff()
          Method to return the X offset of the text in the TextDescriptor.
 double getYOff()
          Method to return the Y offset of the text in the TextDescriptor.
 int hashCode()
          Returns a hash code for this TextDescriptor.
 boolean isAbsoluteSize()
          Returns true if this ImmutableTextDescriptor describes absolute text.
 boolean isBold()
          Method to return true if the text in the TextDescriptor is bold.
 boolean isDisplay()
          Method to return true if this TextDescriptor is displayable.
 boolean isInherit()
          Method to return true if the text in the TextDescriptor is inheritable.
 boolean isInterior()
          Method to return true if the text in the TextDescriptor is interior.
 boolean isItalic()
          Method to return true if the text in the TextDescriptor is italic.
 boolean isParam()
          Method to return true if the text in the TextDescriptor is a parameter.
 boolean isUnderline()
          Method to return true if the text in the TextDescriptor is underlined.
 long lowLevelGet()
          Low-level method to get the bits in the TextDescriptor.
 int lowLevelGet0()
          Low-level method to get the first word of the bits in the TextDescriptor.
 int lowLevelGet1()
          Low-level method to get the second word of the bits in the TextDescriptor.
 void setAbsSize(int s)
          Method to set the text size of this TextDescriptor to an absolute size (in points).
static void setAnnotationTextDescriptor(com.sun.electric.database.variable.AbstractTextDescriptor td)
          Method to set a TextDescriptor that is a default for Variables on Annotations.
static void setArcTextDescriptor(com.sun.electric.database.variable.AbstractTextDescriptor td)
          Method to set a TextDescriptor that is a default for Variables on ArcInsts.
 void setBold(boolean state)
          Method to set the text in the TextDescriptor to be bold.
 void setCBits(int descriptor0, int descriptor1)
          Set this MutableTextDescriptor to given C Electric bits.
 void setCBits(int descriptor0, int descriptor1, int cFlags)
          Set this MutableTextDescriptor to given C Electric bits.
static void setCellTextDescriptor(com.sun.electric.database.variable.AbstractTextDescriptor td)
          Method to set a TextDescriptor that is a default for Variables on Cell Variables.
 void setColorIndex(int colorIndex)
          Method to set the color index of the TextDescriptor.
 void setDisplay(AbstractTextDescriptor.Display display)
          Method to set dispalyable mode of this TextDescriptor.
 void setDisplay(boolean state)
          Method to set this TextDescriptor to be displayable.
 void setDispPart(AbstractTextDescriptor.DispPos d)
          Method to set the text display part of the TextDescriptor.
static void setExportTextDescriptor(com.sun.electric.database.variable.AbstractTextDescriptor td)
          Method to set a TextDescriptor that is a default for Variables on Exports.
 void setFace(int f)
          Method to set the text font of the TextDescriptor.
 void setInherit(boolean state)
          Method to set the text in the TextDescriptor to be inheritable.
static void setInstanceTextDescriptor(com.sun.electric.database.variable.AbstractTextDescriptor td)
          Method to set a TextDescriptor that is a default for Variables on Cell Instance Names.
 void setInterior(boolean state)
          Method to set the text in the TextDescriptor to be interior.
 void setItalic(boolean state)
          Method to set the text in the TextDescriptor to be italic.
static void setNodeTextDescriptor(com.sun.electric.database.variable.AbstractTextDescriptor td)
          Method to set a TextDescriptor that is a default for Variables on NodeInsts.
 void setOff(double xd, double yd)
          Method to set the X and Y offsets of the text in the TextDescriptor.
 void setParam(boolean state)
          Method to set the text in the TextDescriptor to be a parameter.
 void setPos(AbstractTextDescriptor.Position p)
          Method to set the text position of the TextDescriptor.
 void setRelSize(double s)
          Method to set the text size of this TextDescriptor to a relative size (in units).
 void setRotation(AbstractTextDescriptor.Rotation r)
          Method to set the text rotation of the TextDescriptor.
 void setUnderline(boolean state)
          Method to set the text in the TextDescriptor to be underlined.
 void setUnit(AbstractTextDescriptor.Unit u)
          Method to set the Unit of the TextDescriptor.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MutableTextDescriptor

public MutableTextDescriptor(com.sun.electric.database.variable.AbstractTextDescriptor descriptor)
The constructor creates copy of anotherTextDescriptor.

Parameters:
descriptor - another descriptor.

MutableTextDescriptor

public MutableTextDescriptor()
The constructor simply creates a TextDescriptor with zero values filled-in. Size is set to relative 1.0 isDisplay is true.


MutableTextDescriptor

public MutableTextDescriptor(long descriptor,
                             int colorIndex,
                             boolean display)
The constructor simply creates a TextDescriptor with specified values.

Parameters:
descriptor - the bits of the text descriptor.
colorIndex - color index of the text descriptor.
display - true if text descriptor is displayable
Method Detail

setCBits

public void setCBits(int descriptor0,
                     int descriptor1)
Set this MutableTextDescriptor to given C Electric bits.

Parameters:
descriptor0 - lower word of the text descriptor.
descriptor1 - higher word of the text descriptor.

setCBits

public void setCBits(int descriptor0,
                     int descriptor1,
                     int cFlags)
Set this MutableTextDescriptor to given C Electric bits.

Parameters:
descriptor0 - lower word of the text descriptor.
descriptor1 - higher word of the text descriptor.
cFlags - variable flags

getDisplay

public AbstractTextDescriptor.Display getDisplay()
Method to return mode how this TextDescriptor is displayable.

Returns:
Display mode how this TextDescriptor is displayable.

lowLevelGet

public long lowLevelGet()
Low-level method to get the bits in the TextDescriptor. These bits are a collection of flags that are more sensibly accessed through special methods. This general access to the bits is required because the ELIB file format stores it as a full integer. This should not normally be called by any other part of the system.

Returns:
the bits in the TextDescriptor.

getColorIndex

public int getColorIndex()
Method to return the color index of the TextDescriptor. Color indices are more general than colors, because they can handle transparent layers, C-Electric-style opaque layers, and full color values. Methods in "EGraphics" manipulate color indices.

Returns:
the color index of the TextDescriptor.

getNodeTextDescriptor

public static MutableTextDescriptor getNodeTextDescriptor()
Method to return a displayable TextDescriptor that is a default for Variables on NodeInsts.

Returns:
a new TextDescriptor that can be stored in a Variable on a NodeInsts.

getArcTextDescriptor

public static MutableTextDescriptor getArcTextDescriptor()
Method to return a displayable TextDescriptor that is a default for Variables on ArcInsts.

Returns:
a new TextDescriptor that can be stored in a Variable on a ArcInsts.

getExportTextDescriptor

public static MutableTextDescriptor getExportTextDescriptor()
Method to return a displayable TextDescriptor that is a default for Variables on Exports.

Returns:
a new TextDescriptor that can be stored in a Variable on a Exports.

getAnnotationTextDescriptor

public static MutableTextDescriptor getAnnotationTextDescriptor()
Method to return a displayable TextDescriptor that is a default for Variables on Annotations.

Returns:
a new TextDescriptor that can be stored in a Variable on a Annotations.

getInstanceTextDescriptor

public static MutableTextDescriptor getInstanceTextDescriptor()
Method to return a displayable TextDescriptor that is a default for Variables on Cell Instance Names.

Returns:
a new TextDescriptor that can be stored in a Variable on a Cell Instance Names.

getCellTextDescriptor

public static MutableTextDescriptor getCellTextDescriptor()
Method to return a displayable TextDescriptor that is a default for Variables on Cell Variables.

Returns:
a new TextDescriptor that can be stored in a Variable on a Cell Variables.

setDisplay

public void setDisplay(boolean state)
Method to set this TextDescriptor to be displayable. Displayable TextDescriptors are shown with the object.


setDisplay

public void setDisplay(AbstractTextDescriptor.Display display)
Method to set dispalyable mode of this TextDescriptor. Displayable TextDescriptors are shown with the object.

Parameters:
display - displayable mode

setColorIndex

public void setColorIndex(int colorIndex)
Method to set the color index of the TextDescriptor. Color indices are more general than colors, because they can handle transparent layers, C-Electric-style opaque layers, and full color values. Methods in "EGraphics" manipulate color indices.

Parameters:
colorIndex - the color index of the TextDescriptor.

setPos

public void setPos(AbstractTextDescriptor.Position p)
Method to set the text position of the TextDescriptor. The text position describes the "anchor point" of the text, which is the point on the text that is attached to the object and does not move.

Parameters:
p - the text position of the TextDescriptor.

setAbsSize

public void setAbsSize(int s)
Method to set the text size of this TextDescriptor to an absolute size (in points). The size must be between 1 and 63 points.

Parameters:
s - the point size of this TextDescriptor.

setRelSize

public void setRelSize(double s)
Method to set the text size of this TextDescriptor to a relative size (in units). The size must be between 0.25 and 127.75 grid units (in .25 increments).

Parameters:
s - the unit size of this TextDescriptor.

setFace

public void setFace(int f)
Method to set the text font of the TextDescriptor.

Parameters:
f - the text font of the TextDescriptor.

setRotation

public void setRotation(AbstractTextDescriptor.Rotation r)
Method to set the text rotation of the TextDescriptor. There are only 4 rotations: 0, 90 degrees, 180 degrees, and 270 degrees.

Parameters:
r - the text rotation of the TextDescriptor.

setDispPart

public void setDispPart(AbstractTextDescriptor.DispPos d)
Method to set the text display part of the TextDescriptor.

Parameters:
d - the text display part of the TextDescriptor.

setItalic

public void setItalic(boolean state)
Method to set the text in the TextDescriptor to be italic.


setBold

public void setBold(boolean state)
Method to set the text in the TextDescriptor to be bold.


setUnderline

public void setUnderline(boolean state)
Method to set the text in the TextDescriptor to be underlined.


setInterior

public void setInterior(boolean state)
Method to set the text in the TextDescriptor to be interior. Interior text is not seen at higher levels of the hierarchy.


setInherit

public void setInherit(boolean state)
Method to set the text in the TextDescriptor to be inheritable. Inheritable variables copy their contents from prototype to instance. Only Variables on NodeProto and PortProto objects can be inheritable. When a NodeInst is created, any inheritable Variables on its NodeProto are automatically created on that NodeInst.


setParam

public void setParam(boolean state)
Method to set the text in the TextDescriptor to be a parameter. Parameters are those Variables that have values on instances which are passed down the hierarchy into the contents. Parameters can only exist on NodeInst objects.


setOff

public void setOff(double xd,
                   double yd)
Method to set the X and Y offsets of the text in the TextDescriptor. The values are scaled by 4, so a value of 3 indicates a shift of 0.75 and a value of 4 shifts by 1.

Parameters:
xd - the X offset of the text in the TextDescriptor.
yd - the Y offset of the text in the TextDescriptor.

setUnit

public void setUnit(AbstractTextDescriptor.Unit u)
Method to set the Unit of the TextDescriptor. Unit describe the type of real-world unit to apply to the value. For example, if this value is in volts, the Unit tells whether the value is volts, millivolts, microvolts, etc.

Parameters:
u - the Unit of the TextDescriptor.

setNodeTextDescriptor

public static void setNodeTextDescriptor(com.sun.electric.database.variable.AbstractTextDescriptor td)
Method to set a TextDescriptor that is a default for Variables on NodeInsts.

Parameters:
td - the default TextDescriptor for Variables on NodeInsts.

setArcTextDescriptor

public static void setArcTextDescriptor(com.sun.electric.database.variable.AbstractTextDescriptor td)
Method to set a TextDescriptor that is a default for Variables on ArcInsts.

Parameters:
td - the default TextDescriptor for Variables on ArcInsts.

setExportTextDescriptor

public static void setExportTextDescriptor(com.sun.electric.database.variable.AbstractTextDescriptor td)
Method to set a TextDescriptor that is a default for Variables on Exports.

Parameters:
td - the default TextDescriptor for Variables on Exports.

setAnnotationTextDescriptor

public static void setAnnotationTextDescriptor(com.sun.electric.database.variable.AbstractTextDescriptor td)
Method to set a TextDescriptor that is a default for Variables on Annotations.

Parameters:
td - the default TextDescriptor for Variables on Annotations.

setInstanceTextDescriptor

public static void setInstanceTextDescriptor(com.sun.electric.database.variable.AbstractTextDescriptor td)
Method to set a TextDescriptor that is a default for Variables on Cell Instance Names.

Parameters:
td - the default TextDescriptor for Variables on Cell Instance Names.

setCellTextDescriptor

public static void setCellTextDescriptor(com.sun.electric.database.variable.AbstractTextDescriptor td)
Method to set a TextDescriptor that is a default for Variables on Cell Variables.

Parameters:
td - the default TextDescriptor for Variables on Cell Variables.

hashCode

public int hashCode()
Returns a hash code for this TextDescriptor.

Overrides:
hashCode in class java.lang.Object
Returns:
a hash code value for this TextDescriptor.

equals

public boolean equals(java.lang.Object anObject)
Compares this text descriptor to the specified object. The result is true if and only if the argument is not null and is a TextDescriptor object with the same fields.

Overrides:
equals in class java.lang.Object
Parameters:
anObject - the object to compare this TextDescriptor against.
Returns:
true if the TextDescriptor are equal; false otherwise.

lowLevelGet0

public int lowLevelGet0()
Low-level method to get the first word of the bits in the TextDescriptor. These bits are a collection of flags that are more sensibly accessed through special methods. This general access to the bits is required because the ELIB file format stores it as a full integer. This should not normally be called by any other part of the system.

Returns:
the first word of the bits in the TextDescriptor.

lowLevelGet1

public int lowLevelGet1()
Low-level method to get the second word of the bits in the TextDescriptor. These bits are a collection of flags that are more sensibly accessed through special methods. This general access to the bits is required because the ELIB file format stores it as a full integer. This should not normally be called by any other part of the system.

Returns:
the second word of the bits in the TextDescriptor.

isDisplay

public boolean isDisplay()
Method to return true if this TextDescriptor is displayable.

Returns:
true if this TextDescriptor is displayable.

getPos

public AbstractTextDescriptor.Position getPos()
Method to return the text position of the TextDescriptor. The text position describes the "anchor point" of the text, which is the point on the text that is attached to the object and does not move.

Returns:
the text position of the TextDescriptor.

isAbsoluteSize

public boolean isAbsoluteSize()
Returns true if this ImmutableTextDescriptor describes absolute text. Text may be either absolute text (in points) or relative text (in quarter units).

Returns:
true if this ImmutableTextDescriptor describes absolute text.

getSize

public AbstractTextDescriptor.Size getSize()
Method to return the text size of the text in this TextDescriptor. This is a Size object that can describe either absolute text (in points) or relative text (in quarter units).

Returns:
the text size of the text in this TextDescriptor.

getDefaultFontSize

public static int getDefaultFontSize()

getTrueSize

public double getTrueSize(EditWindow0 wnd)
Method to find the true size in points for this TextDescriptor in a given EditWindow0. If the TextDescriptor is already Absolute (in points) nothing needs to be done. Otherwise, the scale of the EditWindow0 is used to determine the acutal point size.

Parameters:
wnd - the EditWindow0 in which drawing will occur.
Returns:
the point size of the text described by this TextDescriptor.

getTrueSize

public double getTrueSize(double scale)
Method to find the true size in points for this TextDescriptor in a given scale. If the TextDescriptor is already Absolute (in points) nothing needs to be done. Otherwise, the scale is used to determine the acutal point size.

Parameters:
scale - scale to draw.
Returns:
the point size of the text described by this TextDescriptor.

getFace

public int getFace()
Method to return the text font of the TextDescriptor.

Returns:
the text font of the TextDescriptor.

getFont

public java.awt.Font getFont(EditWindow0 wnd,
                             int minimalTextSize)
Method to get a Font to use for this TextDescriptor in a given EditWindow.

Parameters:
wnd - the EditWindow0 in which drawing will occur.
minimalTextSize - Return null for texts smaller than this
Returns:
the Font to use (returns null if the text is too small to display).

getDefaultFont

public static java.awt.Font getDefaultFont()
Method to get a default Font to use.

Returns:
the Font to use (returns null if the text is too small to display).

getGlyphs

public static java.awt.font.GlyphVector getGlyphs(java.lang.String text,
                                                  java.awt.Font font)
Method to convert a string and descriptor to a GlyphVector.

Parameters:
text - the string to convert.
font - the Font to use.
Returns:
a GlyphVector describing the text.

getRotation

public AbstractTextDescriptor.Rotation getRotation()
Method to return the text rotation of the TextDescriptor. There are only 4 rotations: 0, 90 degrees, 180 degrees, and 270 degrees.

Returns:
the text rotation of the TextDescriptor.

getDispPart

public AbstractTextDescriptor.DispPos getDispPart()
Method to return the text display part of the TextDescriptor.

Returns:
the text display part of the TextDescriptor.

isItalic

public boolean isItalic()
Method to return true if the text in the TextDescriptor is italic.

Returns:
true if the text in the TextDescriptor is italic.

isBold

public boolean isBold()
Method to return true if the text in the TextDescriptor is bold.

Returns:
true if the text in the TextDescriptor is bold.

isUnderline

public boolean isUnderline()
Method to return true if the text in the TextDescriptor is underlined.

Returns:
true if the text in the TextDescriptor is underlined.

isInterior

public boolean isInterior()
Method to return true if the text in the TextDescriptor is interior. Interior text is not seen at higher levels of the hierarchy.

Returns:
true if the text in the TextDescriptor is interior.

isInherit

public boolean isInherit()
Method to return true if the text in the TextDescriptor is inheritable. Inheritable variables copy their contents from prototype to instance. Only Variables on NodeProto and PortProto objects can be inheritable. When a NodeInst is created, any inheritable Variables on its NodeProto are automatically created on that NodeInst.

Returns:
true if the text in the TextDescriptor is inheritable.

isParam

public boolean isParam()
Method to return true if the text in the TextDescriptor is a parameter. Parameters are those Variables that have values on instances which are passed down the hierarchy into the contents. Parameters can only exist on NodeInst objects.

Returns:
true if the text in the TextDescriptor is a parameter.

getXOff

public double getXOff()
Method to return the X offset of the text in the TextDescriptor.

Returns:
the X offset of the text in the TextDescriptor.

getYOff

public double getYOff()
Method to return the Y offset of the text in the TextDescriptor.

Returns:
the Y offset of the text in the TextDescriptor.

getUnit

public AbstractTextDescriptor.Unit getUnit()
Method to return the Unit of the TextDescriptor. Unit describes the type of real-world unit to apply to the value. For example, if this value is in volts, the Unit tells whether the value is volts, millivolts, microvolts, etc.

Returns:
the Unit of the TextDescriptor.