|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
com.miginfocom.calendar.header.AbstractGridHeader
com.miginfocom.calendar.header.DateGridHeader
public class DateGridHeader
A generic header that can show date/time labels and grid lines horizontally or vertically. Maps positions in the primary dimension
to a Grid object.
You will have to add decorators to draw, for instance, the labels.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class javax.swing.JComponent |
|---|
javax.swing.JComponent.AccessibleJComponent |
| Nested classes/interfaces inherited from class java.awt.Container |
|---|
java.awt.Container.AccessibleAWTContainer |
| Nested classes/interfaces inherited from class java.awt.Component |
|---|
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
| Field Summary | |
|---|---|
static AtFixed |
DEF_FIXED
|
static int |
DEFAULT_ROW_SIZE
|
protected GridLineSpecification |
gridLineSpec
The sizes/paint or the grid lines. |
protected int[] |
rangeTypes
The range types that goes with eachdate format above. |
protected AtRefNumber[] |
sizes
The sizes in the secondary dimension. |
protected DateGrid |
trackedGrid
The grid that this header tracks and paints the labels for. |
| Fields inherited from class com.miginfocom.calendar.header.AbstractGridHeader |
|---|
decoratorSupport, HOR, VER |
| 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 java.awt.image.ImageObserver |
|---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
| Constructor Summary | |
|---|---|
DateGridHeader(DateArea dateArea,
GridLineSpecification gridLineSpec,
int[] rangeTypes,
AtRefNumber[] sizes,
int edge)
Constructor. |
|
DateGridHeader(DateArea dateArea,
int gridLineSize,
java.awt.Paint gridLinePaint,
int[] rangeTypes,
AtRefNumber[] sizes,
int edge)
Constructor for many rows but s simple grid line specification. |
|
DateGridHeader(DateArea dateArea,
int gridLineSize,
java.awt.Paint gridLinePaint,
int rangeType,
AtRefNumber size,
int edge)
Constructor for only one row. |
|
| Method Summary | |
|---|---|
void |
addDateChangeListener(DateChangeListener l)
Adds a listener that is notified of all changes to the date in the header. |
void |
addDateChangeListener(DateChangeListener l,
boolean asWeakRef)
Adds a listener that is notified of all changes to the date in the header. |
protected void |
checkGrid()
Creates (or re-creates) the grid that is used to track the grid in the labeled date area if the grid in the date area has changed. |
void |
dispose()
Manually releases any resources allocated. |
protected void |
fireDateChangeEvent(DateChangeEvent e)
Fires a change event to all registerd listeners. |
DateCellRange |
getCellRange(int x,
int y,
boolean lenient)
Returns the DateCellRange that the point hits. |
DateHeaderGrid |
getDateHeaderGrid()
Returns the grid that this header uses for layout |
HeaderGrid |
getHeaderGrid()
Returns the grid that this header uses for layout |
DateCellRange |
getMouseOverRange()
|
DateCellRange |
getPressedRange()
|
ImmutableDateRange |
getSelectedDateRange()
|
DateArea |
getTrackedDateArea()
Returns the date area that is tracked. |
boolean |
isMouseOverEffectsEnabled()
Returns if mouse over-type effects are enabled. |
void |
mouseClicked(java.awt.event.MouseEvent e)
|
void |
mouseDragged(java.awt.event.MouseEvent e)
|
void |
mouseEntered(java.awt.event.MouseEvent e)
|
void |
mouseExited(java.awt.event.MouseEvent e)
|
void |
mouseMoved(java.awt.event.MouseEvent e)
|
void |
mousePressed(java.awt.event.MouseEvent e)
|
void |
mouseReleased(java.awt.event.MouseEvent e)
|
void |
removeDateChangeListener(DateChangeListener l)
Removes a listener |
void |
revalidateGrid()
Invalidates the grid and revalidate the header. |
void |
setGridLineSpecification(GridLineSpecification gridLineSpec)
Sets how thick and with paint to draw the separators between labels. |
void |
setMouseOverEffectsEnabled(boolean b)
Sets if mouse over-type effects are to be enabled. |
void |
setRangeTypes(int[] rangeTypes)
Sets the types of ranges in the different rows. |
void |
setSizes(AtRefNumber[] sizes)
Sets the sizes, relative or absolute, of the individualt rows in the header. |
| Methods inherited from class javax.swing.JComponent |
|---|
addAncestorListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, paintImmediately, paintImmediately, paramString, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI |
| Methods inherited from class java.awt.Container |
|---|
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree |
| Methods inherited from class java.awt.Component |
|---|
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final int DEFAULT_ROW_SIZE
public static final AtFixed DEF_FIXED
protected AtRefNumber[] sizes
protected int[] rangeTypes
dateFormats.length == rangeTypes.length)
protected transient DateGrid trackedGrid
protected GridLineSpecification gridLineSpec
| Constructor Detail |
|---|
public DateGridHeader(DateArea dateArea,
int gridLineSize,
java.awt.Paint gridLinePaint,
int rangeType,
AtRefNumber size,
int edge)
dateArea - The date area to show the label for. Not null.gridLineSize - The thickness of the grid lines.gridLinePaint - The paint to paint the grid lines with.rangeType - The type of the range in the row. E.g. DateRangeI.RANGE_TYPE_DAY.edge - On what side of the grid the label will be. E.g. SwingConstants.TOP .
public DateGridHeader(DateArea dateArea,
int gridLineSize,
java.awt.Paint gridLinePaint,
int[] rangeTypes,
AtRefNumber[] sizes,
int edge)
dateArea - The date area to show the label for. Not null.gridLineSize - The thickness of the grid lines.gridLinePaint - The paint to paint the grid lines with.rangeTypes - The types of ranges in the different rows. The length of this arrays will be the number of rows (in the secondary dimension) for this header.sizes - The sizes, relative or absolute, of the individualt rows in the header. If null or length is less than rangeTypes
DEFAULT_ROW_SIZE will be used.edge - On what side of the grid the label will be. E.g. SwingConstants.TOP .
public DateGridHeader(DateArea dateArea,
GridLineSpecification gridLineSpec,
int[] rangeTypes,
AtRefNumber[] sizes,
int edge)
dateArea - The date area to show the label for. Not null.gridLineSpec - The specification for the grid lines in the primary and secondary dimensins. Not null.rangeTypes - The types of ranges in the different rows. The length of this arrays will be the number of rows (in the secondary dimension) for this header.sizes - The sizes, relative or absolute, of the individualt rows in the header. If null or length is less than rangeTypes
DEFAULT_ROW_SIZE will be used.edge - On what side of the grid the label will be. E.g. SwingConstants.TOP.| Method Detail |
|---|
public void dispose()
Header
dispose in interface Headerpublic DateArea getTrackedDateArea()
null.public boolean isMouseOverEffectsEnabled()
true if enabled. false is default.public void setMouseOverEffectsEnabled(boolean b)
b - true if enabled. false is default.public void setGridLineSpecification(GridLineSpecification gridLineSpec)
null no grid lines are painted and they will have size 0.
Won't revalidate or repaint the header, that has to be done manually.
gridLineSpec - The spec, can be null.public void setRangeTypes(int[] rangeTypes)
rangeTypes - The types of ranges. Not null.public void setSizes(AtRefNumber[] sizes)
null or lenght is less than rangeTypes
DEFAULT_ROW_SIZE will be used.
sizes - The sizes, can be null.public HeaderGrid getHeaderGrid()
getHeaderGrid in class AbstractGridHeaderpublic DateHeaderGrid getDateHeaderGrid()
public void revalidateGrid()
protected void checkGrid()
public DateCellRange getCellRange(int x,
int y,
boolean lenient)
DateCellRange that the point hits. Gets the cell under the point and expandes in both directions
to nearby cells that are merged. The user object
x - X. Can be outside component.y - Y. Can be outside component.lenient - If true the method will always return a DateCellRange even if outside bounds.
DateCellRange that the point hitspublic void addDateChangeListener(DateChangeListener l)
Note that mouse effects must be enabled. See setMouseOverEffectsEnabled(boolean)
l - The listener
public void addDateChangeListener(DateChangeListener l,
boolean asWeakRef)
asWeakRef - If the listener should be added wrapped in a WeakReference. This defers memory leak problems since
the garbage collector can collect the listener if it is only referenced from this list.
Note that mouse effects must be enabled. See setMouseOverEffectsEnabled(boolean)
l - The listenerpublic void removeDateChangeListener(DateChangeListener l)
l - the listenerprotected void fireDateChangeEvent(DateChangeEvent e)
public DateCellRange getMouseOverRange()
public DateCellRange getPressedRange()
public ImmutableDateRange getSelectedDateRange()
public void mouseDragged(java.awt.event.MouseEvent e)
mouseDragged in interface java.awt.event.MouseMotionListenerpublic void mouseMoved(java.awt.event.MouseEvent e)
mouseMoved in interface java.awt.event.MouseMotionListenerpublic void mousePressed(java.awt.event.MouseEvent e)
mousePressed in interface java.awt.event.MouseListenerpublic void mouseReleased(java.awt.event.MouseEvent e)
mouseReleased in interface java.awt.event.MouseListenerpublic void mouseExited(java.awt.event.MouseEvent e)
mouseExited in interface java.awt.event.MouseListenerpublic void mouseEntered(java.awt.event.MouseEvent e)
mouseEntered in interface java.awt.event.MouseListenerpublic void mouseClicked(java.awt.event.MouseEvent e)
mouseClicked in interface java.awt.event.MouseListener
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||