com.klg.jclass.util.legend
Class JCGridLegend
java.lang.Object
|
+--java.awt.Component
|
+--java.awt.Container
|
+--javax.swing.JComponent
|
+--com.klg.jclass.util.legend.JCLegend
|
+--com.klg.jclass.util.legend.JCGridLegend
- Direct Known Subclasses:
- JCMultiColLegend
- public class JCGridLegend
- extends JCLegend
JCGridLegend manages and renders a grid-based legend.
It overrides JCLegend's layout methods to position legend items
in a grid, where every row has the same height and every column the same
width.
- See Also:
- Serialized Form
Fields inherited from class com.klg.jclass.util.legend.JCLegend |
anchor,
ascent,
BOX,
cachedFont,
cachedVertical,
cellRendererPane,
changed,
changedFlag,
CUSTOM_ALL,
CUSTOM_SYMBOL,
descent,
EAST,
EASTWEST_MASK,
HORIZONTAL,
IMAGE,
IMAGE_OUTLINED,
legendItems,
legendPopulator,
legendRenderer,
NONE,
NORTH,
NORTHEAST,
NORTHSOUTH_MASK,
NORTHWEST,
orientation,
preferredSize,
ps,
SOUTH,
SOUTHEAST,
SOUTHWEST,
symbolSize,
textRend,
updateParent,
VERTICAL,
WEST |
Method Summary |
Dimension |
calcLegendSize(boolean vert)
Calculates the size of the legend based on the height and width
of rows and columns. |
void |
fillSizeArrays(List itemList,
boolean vert,
Font useFont)
Cacluate the size of each row and column. |
int |
getGroupGap()
Gets the gap between the groups of items in the legend (e.g. |
int |
getInsideItemGap()
Gets the gap between the symbol and text portions of a legend item. |
int |
getItemGap()
Gets the gap between the legend items in the same group. |
int |
getMarginGap()
Gets the gap between the edge of the legend and where the items start
being layed out. |
Dimension |
layoutLegend(List itemList,
boolean vertical,
Font useFont)
Overrides JCLegend's layoutLegend() to layout the legend items in a grid,
calculating the overall size of the legend. |
void |
layoutLegendItems(List itemList,
boolean vert)
Lays out the legend items from the legend vector by calculating their
position within the legend and filling that in the JCLegendItem instances
that define the legend item. |
Point |
positionItemSymbol(boolean vertical,
JCLegendItem thisItem,
Dimension boxDim,
Point startPos)
|
Point |
positionItemText(boolean vertical,
JCLegendItem thisItem,
Dimension boxDim,
Point startPos)
|
void |
setGroupGap(int gap)
Sets the gap between the groups of items in the legend (e.g. |
void |
setInsideItemGap(int gap)
Sets the gap between the symbol and text portions of a legend item. |
void |
setItemGap(int gap)
Sets the gap between the legend items in the same group. |
void |
setMarginGap(int gap)
Sets the gap between the edge of the legend and where the items start
being layed out. |
Methods inherited from class com.klg.jclass.util.legend.JCLegend |
drawLegendItem,
getAnchor,
getCellRendererPane,
getChanged,
getChanged,
getDrawingArea,
getDrawingArea,
getGraphics,
getLegendPopulator,
getLegendRenderer,
getOrientation,
getPreferredSize,
getSymbolSize,
getTextRenderer,
isBatched,
isChanged,
isChanged,
isTitleItem,
paintComponent,
pick,
recalc,
setAnchor,
setChanged,
setChanged,
setGraphics,
setLegendPopulator,
setLegendRenderer,
setOrientation,
setPreferredSize,
updateParent |
Methods inherited from class javax.swing.JComponent |
addAncestorListener,
addNotify,
addPropertyChangeListener,
addPropertyChangeListener,
addVetoableChangeListener,
computeVisibleRect,
contains,
createToolTip,
firePropertyChange,
firePropertyChange,
firePropertyChange,
firePropertyChange,
firePropertyChange,
firePropertyChange,
firePropertyChange,
firePropertyChange,
firePropertyChange,
fireVetoableChange,
getAccessibleContext,
getActionForKeyStroke,
getAlignmentX,
getAlignmentY,
getAutoscrolls,
getBorder,
getBounds,
getClientProperty,
getComponentGraphics,
getConditionForKeyStroke,
getDebugGraphicsOptions,
getHeight,
getInsets,
getInsets,
getLocation,
getMaximumSize,
getMinimumSize,
getNextFocusableComponent,
getRegisteredKeyStrokes,
getRootPane,
getSize,
getToolTipLocation,
getToolTipText,
getToolTipText,
getTopLevelAncestor,
getUIClassID,
getVisibleRect,
getWidth,
getX,
getY,
grabFocus,
hasFocus,
isDoubleBuffered,
isFocusCycleRoot,
isFocusTraversable,
isLightweightComponent,
isManagingFocus,
isOpaque,
isOptimizedDrawingEnabled,
isPaintingTile,
isRequestFocusEnabled,
isValidateRoot,
paint,
paintBorder,
paintChildren,
paintImmediately,
paintImmediately,
paramString,
processComponentKeyEvent,
processFocusEvent,
processKeyEvent,
processMouseMotionEvent,
putClientProperty,
registerKeyboardAction,
registerKeyboardAction,
removeAncestorListener,
removeNotify,
removePropertyChangeListener,
removePropertyChangeListener,
removeVetoableChangeListener,
repaint,
repaint,
requestDefaultFocus,
requestFocus,
resetKeyboardActions,
reshape,
revalidate,
scrollRectToVisible,
setAlignmentX,
setAlignmentY,
setAutoscrolls,
setBackground,
setBorder,
setDebugGraphicsOptions,
setDoubleBuffered,
setEnabled,
setFont,
setForeground,
setMaximumSize,
setMinimumSize,
setNextFocusableComponent,
setOpaque,
setRequestFocusEnabled,
setToolTipText,
setUI,
setVisible,
unregisterKeyboardAction,
update,
updateUI |
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.awt.Component |
action,
add,
addComponentListener,
addFocusListener,
addInputMethodListener,
addKeyListener,
addMouseListener,
addMouseMotionListener,
bounds,
checkImage,
checkImage,
coalesceEvents,
contains,
createImage,
createImage,
disable,
disableEvents,
dispatchEvent,
enable,
enable,
enableEvents,
enableInputMethods,
getBackground,
getBounds,
getColorModel,
getComponentOrientation,
getCursor,
getDropTarget,
getFont,
getFontMetrics,
getForeground,
getInputContext,
getInputMethodRequests,
getLocale,
getLocation,
getLocationOnScreen,
getName,
getParent,
getPeer,
getSize,
getToolkit,
getTreeLock,
gotFocus,
handleEvent,
hide,
imageUpdate,
inside,
isDisplayable,
isEnabled,
isLightweight,
isShowing,
isValid,
isVisible,
keyDown,
keyUp,
list,
list,
list,
location,
lostFocus,
mouseDown,
mouseDrag,
mouseEnter,
mouseExit,
mouseMove,
mouseUp,
move,
nextFocus,
paintAll,
postEvent,
prepareImage,
prepareImage,
printAll,
processComponentEvent,
processInputMethodEvent,
processMouseEvent,
remove,
removeComponentListener,
removeFocusListener,
removeInputMethodListener,
removeKeyListener,
removeMouseListener,
removeMouseMotionListener,
repaint,
repaint,
repaint,
resize,
resize,
setBounds,
setBounds,
setComponentOrientation,
setDropTarget,
setLocale,
setLocation,
setLocation,
setName,
setSize,
setSize,
show,
show,
size,
toString,
transferFocus |
rowHeights
public int[] rowHeights
rowFirstLineHeights
public int[] rowFirstLineHeights
colWidths
public int[] colWidths
symWidths
public int[] symWidths
strWidths
public int[] strWidths
marginGap
protected int marginGap
itemGap
protected int itemGap
insideItemGap
protected int insideItemGap
groupGap
protected int groupGap
JCGridLegend
public JCGridLegend()
setMarginGap
public void setMarginGap(int gap)
- Sets the gap between the edge of the legend and where the items start
being layed out.
- Parameters:
gap
- the margin gap
getMarginGap
public int getMarginGap()
- Gets the gap between the edge of the legend and where the items start
being layed out.
- Returns:
- the margin gap
setItemGap
public void setItemGap(int gap)
- Sets the gap between the legend items in the same group.
- Parameters:
gap
- the item gap
getItemGap
public int getItemGap()
- Gets the gap between the legend items in the same group.
- Returns:
- the item gap
setInsideItemGap
public void setInsideItemGap(int gap)
- Sets the gap between the symbol and text portions of a legend item.
- Parameters:
gap
- the inside item gap
getInsideItemGap
public int getInsideItemGap()
- Gets the gap between the symbol and text portions of a legend item.
- Returns:
- the inside item gap
setGroupGap
public void setGroupGap(int gap)
- Sets the gap between the groups of items in the legend (e.g. the columns/
rows associated with a data view).
- Parameters:
gap
- the group gap
getGroupGap
public int getGroupGap()
- Gets the gap between the groups of items in the legend (e.g. the columns/
rows associated with a data view).
- Returns:
- the group gap
layoutLegend
public Dimension layoutLegend(List itemList,
boolean vertical,
Font useFont)
- Overrides JCLegend's layoutLegend() to layout the legend items in a grid,
calculating the overall size of the legend. This is accomplished by
filling in the dim, pos, textPos, and symPos member of each JCLegendItem
instance in the legend vector. The pickRectangle member is also filled in.
- Overrides:
- layoutLegend in class JCLegend
- Parameters:
itemList
- the legend vector. It contains a number of group
vectors. Each group vector contains the legend items (JCLegendItem
instances) for that group.vertical
- true if a vertical legend, false if a horizontal legend.useFont
- the font for the legend.- Returns:
- the size of the legend.
- Since:
- JClass 4.0K for Java 2. If you are using JClass 4.0J,
which is based on JDK 1.1, this method's parameter must be
a
com.sun.java.util.collections.List
.
fillSizeArrays
public void fillSizeArrays(List itemList,
boolean vert,
Font useFont)
- Cacluate the size of each row and column.
- Parameters:
itemList
- the legend vector of groups and item.vert
- true if a vertical legend, false if a horizontal legend.useFont
- the font for the legend.- Since:
- JClass 4.0K for Java 2. If you are using JClass 4.0J,
which is based on JDK 1.1, this method's parameter must be
a
com.sun.java.util.collections.List
.
calcLegendSize
public Dimension calcLegendSize(boolean vert)
- Calculates the size of the legend based on the height and width
of rows and columns.
- Parameters:
vert
- true if a vertical legend, false if a horizontal legend.
layoutLegendItems
public void layoutLegendItems(List itemList,
boolean vert)
- Lays out the legend items from the legend vector by calculating their
position within the legend and filling that in the JCLegendItem instances
that define the legend item.
- Parameters:
itemList
- the legend vector of groups and items.vert
- true if a vertical legend, false if a horizontal legend.- Since:
- JClass 4.0K for Java 2. If you are using JClass 4.0J,
which is based on JDK 1.1, this method's parameter must be
a
com.sun.java.util.collections.List
.
positionItemSymbol
public Point positionItemSymbol(boolean vertical,
JCLegendItem thisItem,
Dimension boxDim,
Point startPos)
positionItemText
public Point positionItemText(boolean vertical,
JCLegendItem thisItem,
Dimension boxDim,
Point startPos)