|
JClass 4.5.0 API Documentation |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | 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 require 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.
JCGridLegend
,
JCMultiColLegend
,
JCLegendPopulator
,
JCLegendRenderer
,
JCLegendItem
, Serialized FormInner classes inherited from class javax.swing.JComponent |
JComponent.AccessibleJComponent |
Field Summary | |
protected int |
anchor
|
protected int |
ascent
|
static int |
BOX
|
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
|
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 List |
legendItems
|
protected JCLegendPopulator |
legendPopulator
JCLegendPopulator instance used to populate the legend |
protected JCLegendRenderer |
legendRenderer
JCLegendRenderer instance used to help draw the legend |
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 static 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 |
Constructor Summary | |
JCLegend()
Internal constructor for legend |
Method Summary | |
void |
drawLegendItem(Graphics gc,
Font useFont,
JCLegendItem thisItem)
Draws one legend item based on the size and position given in it's 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()
Override parent getGraphics(). |
JCLegendPopulator |
getLegendPopulator()
Gets the JCLegendPopulator instance used to populate this 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(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. |
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 components 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 |
setLegendPopulator(JCLegendPopulator legPop)
Sets the legend populator class which will populate the legend. |
void |
setLegendRenderer(JCLegendRenderer legRend)
Sets the legend renderer class which will help draw the 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. |
void |
updateParent(int cf)
|
Methods inherited from class java.awt.Container |
add,
add,
add,
add,
add,
addContainerListener,
addImpl,
countComponents,
deliverEvent,
doLayout,
findComponentAt,
findComponentAt,
getComponent,
getComponentAt,
getComponentAt,
getComponentCount,
getComponents,
getLayout,
insets,
invalidate,
isAncestorOf,
layout,
list,
list,
locate,
minimumSize,
paintComponents,
preferredSize,
print,
printComponents,
processContainerEvent,
processEvent,
remove,
remove,
removeAll,
removeContainerListener,
setCursor,
setLayout,
validate,
validateTree |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
Field Detail |
protected int anchor
protected int orientation
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
protected static com.klg.jclass.util.swing.TextRenderer textRend
protected List legendItems
protected Dimension ps
protected int symbolSize
protected int ascent
protected int descent
protected boolean cachedVertical
protected transient Font cachedFont
protected boolean updateParent
protected boolean changed
protected int changedFlag
protected Dimension preferredSize
protected CellRendererPane cellRendererPane
CellRendererPane
object used in rendering HTML text.protected JCLegendPopulator legendPopulator
JCLegendPopulator
instance used to populate the legendprotected JCLegendRenderer legendRenderer
JCLegendRenderer
instance used to help draw the legendConstructor Detail |
public JCLegend()
Method Detail |
public void setLegendPopulator(JCLegendPopulator legPop)
legPop
- the JCLegendPopulator
instance used to populate
this legend.public JCLegendPopulator getLegendPopulator()
JCLegendPopulator
instance used to populate this legend.JCLegendPopulator
instance used to populate this
legend.public void setLegendRenderer(JCLegendRenderer legRend)
legRend
- the JCLegendRenderer
instance used to help draw
this legend.public JCLegendRenderer getLegendRenderer()
JCLegendRenderer
instance used to help draw this
legend.public int getAnchor()
public int getOrientation()
public void setAnchor(int a)
a
- public void setOrientation(int orient)
orient
- one of VERTICAL or HORIZONTALpublic int getSymbolSize()
public void recalc()
public abstract Dimension layoutLegend(List itemList, boolean vertical, Font useFont)
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 legend.useFont
- font used for legend.com.sun.java.util.collections.List
.public void paintComponent(Graphics gc)
gc
- graphics context to use for drawingpublic void drawLegendItem(Graphics gc, Font useFont, 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 instance.public boolean isTitleItem(JCLegendItem item)
item
- the JCLegendItem in questionpublic Dimension getPreferredSize()
public void setPreferredSize(Dimension dim)
dim
- the preferred sizepublic com.klg.jclass.util.swing.TextRenderer getTextRenderer()
TextRenderer
class used to draw HTML text.public JCLegendItem pick(Point p)
p
- pick point relative to legendpublic Rectangle getDrawingArea()
JComponent.setBorder(javax.swing.border.Border)
public void getDrawingArea(Rectangle rect)
rect
- JComponent.setBorder(javax.swing.border.Border)
public CellRendererPane getCellRendererPane()
public Graphics getGraphics()
public void setGraphics(Graphics g)
g
- Graphics object to use for drawing.public boolean getChanged()
public boolean getChanged(int mask)
Changeable
for a list of valid masks).
The ChangedFlag property determines the action the object needs to
take in regards to the current change.mask
- public final boolean isChanged()
public final boolean isChanged(int mask)
mask
- public void setChanged(boolean c, int cf)
c
- cf
- public void setChanged(boolean n, int cf, boolean updateParent)
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 implementorpublic void updateParent(int cf)
cf
- public boolean isBatched()
Changeable
, so
it always returns false.
|
Copyright© 1999-2000 KL Group Inc. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |