|
JClass DesktopViews 6.3.0 API Documentation |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.awt.Component | +--java.awt.Container | +--javax.swing.JComponent | +--com.klg.jclass.util.legend.JCLegend
JCLegend
manages and renders a legend for a component. It is an
abstract class that requires a subclass to provide a specific
layout. It requires a JCLegendPopulator
instance to populate it
with legend items and a JCLegendRenderer
instance to help in
rendering the items. Each legend item is represented by a
JCLegendItem
instance.
JCLegend
is a Swing-based component and should behave
accordingly. It is not visible by default. It is also transparent by
default, meaning that the Opaque
property must be set to
true
if any background color is to be drawn.
JCGridLegend
,
JCMultiColLegend
,
JCLegendPopulator
,
JCLegendRenderer
,
JCLegendItem
,
Serialized FormNested Class Summary |
Nested classes inherited from class javax.swing.JComponent |
JComponent.AccessibleJComponent |
Nested classes inherited from class java.awt.Container |
Container.AccessibleAWTContainer |
Nested classes inherited from class java.awt.Component |
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy |
Field Summary | |
protected int |
anchor
|
protected int |
ascent
|
static int |
BOX
|
static int |
BOX_PLAIN
|
protected Font |
cachedFont
|
protected boolean |
cachedVertical
|
protected CellRendererPane |
cellRendererPane
CellRendererPane object used in rendering HTML text. |
protected boolean |
changed
Boolean representing the value of the Changed property. |
protected int |
changedFlag
A flag to record what has changed |
static int |
CUSTOM_ALL
|
static int |
CUSTOM_SYMBOL
|
protected int |
descent
|
static int |
EAST
|
static int |
EASTWEST_MASK
|
static int |
HORIZONTAL
|
static int |
IMAGE
|
static int |
IMAGE_OUTLINED
|
protected com.klg.jclass.util.ImageMapInfo |
imageMapInfo
The image map information for the JCLegend . |
protected List |
legendItems
|
protected com.klg.jclass.util.legend.JCLegendPopulator |
legendPopulator
JCLegendPopulator instance used to populate the legend. |
protected com.klg.jclass.util.legend.JCLegendRenderer |
legendRenderer
JCLegendRenderer instance used to help draw the legend. |
static int |
LINE
|
protected Locale |
locale
The locale field used for localization. |
static int |
NONE
|
static int |
NORTH
|
static int |
NORTHEAST
|
static int |
NORTHSOUTH_MASK
|
static int |
NORTHWEST
|
protected int |
orientation
|
protected Dimension |
preferredSize
The preferred size of the legend. |
protected Dimension |
ps
|
static int |
SOUTH
|
static int |
SOUTHEAST
|
static int |
SOUTHWEST
|
protected int |
symbolSize
|
protected com.klg.jclass.util.swing.TextRenderer |
textRend
|
protected boolean |
updateParent
Used to turn off updates to the parent in certain cases. |
static int |
VERTICAL
|
static int |
WEST
|
Fields inherited from class javax.swing.JComponent |
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, 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 com.klg.jclass.util.Changeable |
BASIC_CHANGE_MASK, LAYOUT, NO_CHANGE, NOTIFY_PARENT_LAYOUT, RECALC, REDRAW |
Fields inherited from interface java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
JCLegend()
Internal constructor for legend. |
Method Summary | |
protected void |
checkAnchor(int a)
|
void |
drawLegendItem(Graphics gc,
Font useFont,
com.klg.jclass.util.legend.JCLegendItem thisItem)
Draws one legend item based on the size and position given in its JCLegendItem instance. |
int |
getAnchor()
Gets the Anchor property, which determines the position of the
legend relative to the parent components primary draw area. |
CellRendererPane |
getCellRendererPane()
Gets the cell renderer pane used by this component. |
boolean |
getChanged()
Gets the value of the Changed property. |
boolean |
getChanged(int mask)
Checks the value of the ChangedFlag property for the specified
mask (see Changeable for a list of valid masks). |
Rectangle |
getDrawingArea()
Gets the bounding rectangle of the component's drawing area, (its area minus the shadows and insets). |
void |
getDrawingArea(Rectangle rect)
Gets the bounding rectangle of the component's drawing area, (its area minus the insets). |
Graphics |
getGraphics()
Overrides parent getGraphics() . |
com.klg.jclass.util.ImageMapInfo |
getImageMapInfo()
Retrieve the image map information for this JCLegend . |
List |
getLegendItems()
Returns the list of legend items being used by this legend. |
com.klg.jclass.util.legend.JCLegendPopulator |
getLegendPopulator()
Gets the JCLegendPopulator instance used to populate this
legend. |
com.klg.jclass.util.legend.JCLegendRenderer |
getLegendRenderer()
Gets the legend renderer class which is used to help draw the legend. |
int |
getOrientation()
Gets the Orientation property, which determines how the
legend information is laid out. |
Dimension |
getPreferredSize()
Calculates and returns the preferred size for the legend, or the manually set preferred size if it has been manually set. |
int |
getSymbolSize()
Gets the default symbol size being used for legend item. |
com.klg.jclass.util.swing.TextRenderer |
getTextRenderer()
Gets the TextRenderer class used to draw HTML text. |
boolean |
isBatched()
This method is not used by this implementation of Changeable , so
it always returns false . |
boolean |
isChanged()
Gets the value of the Changed property. |
boolean |
isChanged(int mask)
Checks the value of the ChangedFlag property for the specified
mask (see Changeable for a list of valid masks). |
boolean |
isTitleItem(com.klg.jclass.util.legend.JCLegendItem item)
Defers the decision on whether an item is a title item or not to the populator class. |
abstract Dimension |
layoutLegend(List itemList,
boolean vertical,
Font useFont)
To be overridden by a legend implementation. |
void |
paintComponent(Graphics gc)
Paint method for the legend. |
com.klg.jclass.util.legend.JCLegendItem |
pick(Point p)
Internal pick method. |
void |
recalc()
Recalculates extents of the legend. |
void |
setAnchor(int a)
Sets the Anchor property, which determines the position of the
legend relative to the parent component's primary draw area. |
void |
setChanged(boolean c,
int cf)
Sets the value of the Changed property and updates the
parent object. |
void |
setChanged(boolean n,
int cf,
boolean updateParent)
Sets the value of the Changed property. |
void |
setGraphics(Graphics g)
Provides a way for the legend to draw to a custom Graphics
object. |
void |
setImageMapInfo(com.klg.jclass.util.ImageMapInfo imageMapInfo)
Set the image map information for this JCLegend . |
void |
setLegendPopulator(com.klg.jclass.util.legend.JCLegendPopulator legPop)
Sets the legend populator class which will populate the legend. |
void |
setLegendRenderer(com.klg.jclass.util.legend.JCLegendRenderer legRend)
Sets the legend renderer class which will help draw the legend. |
void |
setLocale(Locale locale)
Sets the locale for legend. |
void |
setOrientation(int orient)
Sets the Orientation property, which determines how the
legend information is laid out. |
void |
setPreferredSize(Dimension dim)
Sets the preferred size manually. |
protected void |
setUpLegendVariables()
Set up and store variables used by the legend, including the font, font metrics and the list of legend items. |
void |
updateParent(int cf)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final int NORTH
public static final int SOUTH
public static final int EAST
public static final int WEST
public static final int NORTHEAST
public static final int NORTHWEST
public static final int SOUTHEAST
public static final int SOUTHWEST
public static final int NORTHSOUTH_MASK
public static final int EASTWEST_MASK
public static final int HORIZONTAL
public static final int VERTICAL
public static final int NONE
public static final int BOX
public static final int IMAGE
public static final int IMAGE_OUTLINED
public static final int CUSTOM_SYMBOL
public static final int CUSTOM_ALL
public static final int BOX_PLAIN
public static final int LINE
protected int anchor
protected int orientation
protected com.klg.jclass.util.swing.TextRenderer textRend
protected List legendItems
protected Dimension ps
protected int symbolSize
protected int ascent
protected int descent
protected com.klg.jclass.util.ImageMapInfo imageMapInfo
JCLegend
.
protected boolean cachedVertical
protected transient Font cachedFont
protected boolean updateParent
protected boolean changed
Changed
property.
protected int changedFlag
protected Dimension preferredSize
protected CellRendererPane cellRendererPane
CellRendererPane
object used in rendering HTML text.
protected com.klg.jclass.util.legend.JCLegendPopulator legendPopulator
JCLegendPopulator
instance used to populate the legend.
protected com.klg.jclass.util.legend.JCLegendRenderer legendRenderer
JCLegendRenderer
instance used to help draw the legend.
protected Locale locale
Constructor Detail |
public JCLegend()
Method Detail |
public void setLegendPopulator(com.klg.jclass.util.legend.JCLegendPopulator legPop)
legPop
- The JCLegendPopulator
instance used to populate
this legendpublic com.klg.jclass.util.legend.JCLegendPopulator getLegendPopulator()
JCLegendPopulator
instance used to populate this
legend.
JCLegendPopulator
instance used to populate this
legendpublic void setLegendRenderer(com.klg.jclass.util.legend.JCLegendRenderer legRend)
legRend
- The JCLegendRenderer
instance used to help draw
this legendpublic com.klg.jclass.util.legend.JCLegendRenderer getLegendRenderer()
JCLegendRenderer
instance used to help draw this
legendpublic int getAnchor()
Anchor
property, which determines the position of the
legend relative to the parent components primary draw area.
NORTH
, SOUTH
, EAST
,
WEST
, NORTHWEST
, SOUTHWEST
,
NORTHEAST
, or SOUTHEAST
public void setAnchor(int a)
Anchor
property, which determines the position of the
legend relative to the parent component's primary draw area.
a
- The new anchor. Must be one of NORTH
,
SOUTH
, EAST
, WEST
,
NORTHWEST
, SOUTHWEST
, NORTHEAST
, or
SOUTHEAST
protected void checkAnchor(int a)
public int getOrientation()
Orientation
property, which determines how the
legend information is laid out.
VERTICAL
or HORIZONTAL
public void setOrientation(int orient)
Orientation
property, which determines how the
legend information is laid out.
orient
- one of VERTICAL
or HORIZONTAL
public com.klg.jclass.util.ImageMapInfo getImageMapInfo()
JCLegend
.
public void setImageMapInfo(com.klg.jclass.util.ImageMapInfo imageMapInfo)
JCLegend
.
imageMapInfo
- The new image map information.public int getSymbolSize()
recalc()
). It is overridable
by users who want to provide a different symbolSize
.
public void recalc()
protected void setUpLegendVariables()
public List getLegendItems()
JCLegendItem
instances, each reflecting one item within the legend group. The first
JCLegendItem
within each group is the title of the group.public abstract Dimension layoutLegend(List itemList, boolean vertical, Font useFont)
dim
,
pos
, textPos
, and symPos
members of
each JCLegendItem
insance, returning the size of the layed out
legend.
itemList
- The legend vector. It contains a vector for each group
(data view). Each group vector contains a number of
JCLegendItem
instances, each reflecting one item within the
legend group. The first JCLegendItem
within each group is
the title of the group.vertical
- true
for vertical legend, false
for horizontal legenduseFont
- font used for legend
public void paintComponent(Graphics gc)
paintComponent
in class JComponent
gc
- graphics context to use for drawingpublic void drawLegendItem(Graphics gc, Font useFont, com.klg.jclass.util.legend.JCLegendItem thisItem)
JCLegendItem
instance. The symbol to be drawn is derived from
the legend item's draw type. A user that wants to provide different
drawing behaviour should use either the CUSTOM_SYMBOL
or
CUSTOM_ALL
draw types.
gc
- the graphics contextuseFont
- the font used for this legend.thisItem
- the legend item to draw; a JCLegendItem
instancepublic boolean isTitleItem(com.klg.jclass.util.legend.JCLegendItem item)
item
- the JCLegendItem
in question
true
if the item is a title in the legend;
false
otherwisepublic Dimension getPreferredSize()
getPreferredSize
in class JComponent
public void setPreferredSize(Dimension dim)
setPreferredSize
in class JComponent
dim
- the preferred sizepublic com.klg.jclass.util.swing.TextRenderer getTextRenderer()
TextRenderer
class used to draw HTML text.
public com.klg.jclass.util.legend.JCLegendItem pick(Point p)
p
- pick point relative to legend
JCLegendItem
instance representing the picked point.public Rectangle getDrawingArea()
JComponent.setBorder(javax.swing.border.Border)
public void getDrawingArea(Rectangle rect)
rect
- JComponent.setBorder(javax.swing.border.Border)
public CellRendererPane getCellRendererPane()
JLabel
.
public Graphics getGraphics()
getGraphics()
. If another
Graphics
object has been set to be the current one, return that.
Otherwise, call the superclass' getGraphics()
method.
getGraphics
in class JComponent
Graphics
object to use to draw this legendpublic void setGraphics(Graphics g)
Graphics
object. Call with a null to specify use of the default Graphics
object used to draw to the screen.
g
- Graphics
object to use for drawingpublic boolean getChanged()
Changed
property.
The Changed
property determines whether the object needs
to be recalculated.
getChanged
in interface Changeable
true
if the object has been changed and needs
recalculation; false
otherwisepublic boolean getChanged(int mask)
ChangedFlag
property for the specified
mask (see Changeable
for a list of valid masks).
The ChangedFlag
property determines the action the object needs
to take in regards to the current change.
getChanged
in interface Changeable
mask
-
true
if the specified mask exists in the
ChangedFlag
property; false
otherwisepublic final boolean isChanged()
Changed
property.
The Changed
property determines whether the object needs
to be recalculated.
isChanged
in interface Changeable
true
if the object has been changed and needs
recalculation; false
otherwisepublic final boolean isChanged(int mask)
ChangedFlag
property for the specified
mask (see Changeable
for a list of valid masks).
The ChangedFlag
property determines the action the object needs
to take in regards to the current change.
isChanged
in interface Changeable
mask
-
true
if the specified mask exists in the
ChangedFlag
property, false
otherwisepublic void setChanged(boolean c, int cf)
Changed
property and updates the
parent object.
The Changed
property determines whether the object needs
to be recalculated.
setChanged
in interface Changeable
c
- cf
- public void setChanged(boolean n, int cf, boolean updateParent)
Changed
property.
The Changed
property determines whether the object needs
to be recalculated.
setChanged
in interface Changeable
n
- new value for Changed
cf
- updateParent
- if true
, the parent is updated; otherwise,
the parent is not updated (the "update" semantics are up to the implementor)public void updateParent(int cf)
cf
- public boolean isBatched()
Changeable
, so
it always returns false
.
isBatched
in interface Changeable
public void setLocale(Locale locale)
setLocale
in class Component
locale
-
|
Copyright © 2004 Quest Software Inc.. All rights reserved. |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |