All Packages Class Hierarchy This Package Previous Next Index
Class com.sgi.sysadm.ui.FtrIcon
java.lang.Object
|
+----com.sgi.sysadm.ui.FtrIcon
- public abstract class FtrIcon
- extends Object
- implements Icon
FtrIcon is the base class for Icons generated by the
$TOOLROOT/usr/sbin/ftrjava program. ftrjava parses .ftr files and
generates java source code for rendering File Typing Rule (FTR) icons.
An .ftr file defines a file type. The Indigo Magic desktop uses
FTRs to determine the types of files and to display
appropriate icons for files. ftrjava ignores the file typing part
of an FTR and turns the icon part of the FTR into a .java file
implementing a subclass of FtrIcon.
Here is an example of a filetyping rule (Clock.ftr):
TYPE Clock
ICON {
include("iconlib/Clock.fti");
}
The ftrjava program will translate Clock.ftr into Clock.java, which
will define a class named Clock as a subclass of FtrIcon. The
Clock class will render the icon defined in Clock.fti. Clock.fti
is an icon created using the iconsmith(1) Irix program.
FtrIcon's set and get methods can be used to
provide conditional rendering:
TYPE Cluster
ICON {
if (get("CAM_STATUS").equals("ACTIVE")) {
include("iconlib/clusterok.fti");
} else if (get("CAM_STATUS").equals("INACTIVE")) {
include("iconlib/clusternotok.fti");
} else {
include("iconlib/cluster.fti");
}
}
The conditional rendering is controlled by calling set on
an instance of FtrIcon. Since ftrjava translates .ftr files to
java, any legal java code may be put into the ICON rule of a .ftr
file. Additionally, the -i and -b options to
ftrjava may be used to import a package and implement interfaces so
that static final variables from other classes can be used in .ftr
files. This may be used to avoid hard-coding strings such as in
the Cluster example above.
Only the public methods of FtrIcon are of interest to a developer
writing java code. The protected methods and variables exist to
facilitate the translation of .fti files into java code. FtrIcons
are typically rendered by JLabels.
- See Also:
- JLabel
-
iconcolor
- iconcolor is a special color which is drawn
differently depending on whether an icon is open or located.
-
opened
- true if the icon should be rendered in an opened
state.
-
outlinecolor
- color for rendering outlines.
-
shadowcolor
- color for rendering shadows.
-
FtrIcon()
-
-
bgnclosedline()
- Start drawing a series of closed lines.
-
bgnline()
- Start drawing a series of connected lines.
-
bgnoutlinepolygon()
- Start drawing an outlined polygon.
-
bgnpoint()
- Start drawing a series of points.
-
bgnpolygon()
- Start drawing a polygon.
-
color(int)
- Set the current color.
-
color(Object)
- Set the current color.
-
createIcon(String)
- Dynamically load a subclass of FtrIcon.
-
draw()
- Called to draw the icon.
-
endclosedline()
- Finish drawing a series of closed lines.
-
endline()
- Finish drawing a series of connected lines.
-
endoutlinepolygon(int)
- Finish drawing an outlined polygon.
-
endoutlinepolygon(Object)
- Finish drawing an outlined polygon.
-
endpoint()
- Finish drawing a series of points.
-
endpolygon()
- Finish drawing a polygon.
-
get(String)
- Get attribute to affect rendering.
-
getIconColor()
- Get the current icon color.
-
getIconHeight()
- Icon method that gets called to query the height of the icon.
-
getIconWidth()
- Icon method that gets called to query the width of the icon.
-
paintIcon(Component, Graphics, int, int)
- Icon method that gets called at render time.
-
set(AttrBundle)
- Interface for setting a bundle of attributes that affect
rendering.
-
set(Attribute)
- Interface for setting attributes to affect rendering.
-
set(String, String)
- Interface for setting attributes to affect rendering.
-
setDefaultIconColor()
- Set the icon color back to its default value.
-
setIconColor(Color)
- Set the icon color to iconColor.
-
setLocated(boolean)
- Set the located flag.
-
setSelected(boolean)
- Set the selected flag.
-
setSize(int, int)
- Set the size which should be used for rendering.
-
vertex(double, double)
- Add a vertex to the list of vertices for the current shape.
opened
protected boolean opened
- true if the icon should be rendered in an opened
state. This variable is only of interest to subclasses
generated by the ftrjava program.
iconcolor
protected final Object iconcolor
- iconcolor is a special color which is drawn
differently depending on whether an icon is open or located.
This variable is only of interest to subclasses generated by
the ftrjava program.
shadowcolor
protected final int shadowcolor
- color for rendering shadows. This variable is only of interest
to subclasses generated by the ftrjava program.
outlinecolor
protected final int outlinecolor
- color for rendering outlines. This variable is only of
interest to subclasses generated by the ftrjava program.
FtrIcon
public FtrIcon()
createIcon
public static FtrIcon createIcon(String className)
- Dynamically load a subclass of FtrIcon.
- Parameters:
- className - Name of the class to load.
- Returns:
- FtrIcon instance corresponding to className.
- Throws: IllegalArgumentException
- Thrown if
className is not the name of a subclass of
FtrIcon.
setSelected
public void setSelected(boolean selected)
- Set the selected flag. The selected and located flags
determine the color of the icon.
- Parameters:
- selected - true if this icon should be draw selected.
setLocated
public void setLocated(boolean located)
- Set the located flag. The selected and located flags determine
the color of the icon.
- Parameters:
- located - true if this icon should be draw located.
setSize
public void setSize(int width,
int height)
- Set the size which should be used for rendering.
- Parameters:
- width - horizontal size.
- height - vertical size.
paintIcon
public void paintIcon(Component component,
Graphics graphics,
int x,
int y)
- Icon method that gets called at render time.
- Parameters:
- component - component in which we are drawing.
- graphics - for drawing.
- x - horizontal location.
- y - vertical location.
- See Also:
- paintIcon
setIconColor
public void setIconColor(Color iconColor)
- Set the icon color to iconColor.
- Parameters:
- iconColor - New icon color.
getIconColor
public Color getIconColor()
- Get the current icon color.
- Returns:
- current icon color.
setDefaultIconColor
public void setDefaultIconColor()
- Set the icon color back to its default value.
getIconHeight
public int getIconHeight()
- Icon method that gets called to query the height of the icon.
- Returns:
- vertical size.
- See Also:
- getIconHeight
getIconWidth
public int getIconWidth()
- Icon method that gets called to query the width of the icon.
- Returns:
- horizontal size.
- See Also:
- getIconWidth
set
public void set(String key,
String value)
- Interface for setting attributes to affect rendering.
- Parameters:
- key - key of attr to set.
- value - value of attr to set.
set
public void set(Attribute attr)
- Interface for setting attributes to affect rendering.
- Parameters:
- attr - The attribute to set
set
public void set(AttrBundle bundle)
- Interface for setting a bundle of attributes that affect
rendering. Each attribute must be of type string.
- Parameters:
- bundle - An AttrBundle
get
public String get(String key)
- Get attribute to affect rendering.
- Parameters:
- key - key of attr to get.
- Returns:
- value for attr.
color
protected void color(Object color)
- Set the current color. This method is only of interest to
subclasses generated by the ftrjava program.
- Parameters:
- color - The current color. Should be set to iconcolor.
color
protected void color(int color)
- Set the current color. This method is only of interest to
subclasses generated by the ftrjava program.
- Parameters:
- color - The current color. Indexes into our colormap.
bgnpolygon
protected void bgnpolygon()
- Start drawing a polygon. This method is only of interest to
subclasses generated by the ftrjava program.
endpolygon
protected void endpolygon()
- Finish drawing a polygon. This method is only of interest to
subclasses generated by the ftrjava program.
bgnpoint
protected void bgnpoint()
- Start drawing a series of points. This method is only of interest to
subclasses generated by the ftrjava program.
endpoint
protected void endpoint()
- Finish drawing a series of points. This method is only of interest to
subclasses generated by the ftrjava program.
bgnline
protected void bgnline()
- Start drawing a series of connected lines. This method is only
of interest to subclasses generated by the ftrjava program.
endline
protected void endline()
- Finish drawing a series of connected lines. This method is
only of interest to subclasses generated by the ftrjava
program.
bgnclosedline
protected void bgnclosedline()
- Start drawing a series of closed lines. This method is only of
interest to subclasses generated by the ftrjava program.
endclosedline
protected void endclosedline()
- Finish drawing a series of closed lines. This method is only
of interest to subclasses generated by the ftrjava program.
bgnoutlinepolygon
protected void bgnoutlinepolygon()
- Start drawing an outlined polygon. This method is only of
interest to subclasses generated by the ftrjava program.
endoutlinepolygon
protected void endoutlinepolygon(int color)
- Finish drawing an outlined polygon. This method is only of
interest to subclasses generated by the ftrjava program.
- Parameters:
- color - Color for the outline.
endoutlinepolygon
protected void endoutlinepolygon(Object color)
- Finish drawing an outlined polygon. This method is only of
interest to subclasses generated by the ftrjava program.
- Parameters:
- color - Color for the polygon.
vertex
protected void vertex(double x,
double y)
- Add a vertex to the list of vertices for the current shape.
This method is only of interest to subclasses generated by the
ftrjava program.
- Parameters:
- x - horizontal coordinate.
- y - vertical coordinate.
draw
protected abstract void draw()
- Called to draw the icon. Subclass calls the bgn*
end*, and vertex methods. This method is
only of interest to subclasses generated by the ftrjava
program.
All Packages Class Hierarchy This Package Previous Next Index