|
|||||||||
| 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
public abstract class AbstractGridHeader
Boiler plate implementation for a Header that is a JComponent. Takes care of the action listener
handling and returns a JScrollPane as the component to use.
This class is itself a JComponent which bounds is automatically laid out to match the
tracked component in the tracked dimension. Subclasses is responsible for returning a size (fixed) to use in the other,
secondary, dimension.
This component works much like a mini-dateArea.
Note that the actual paiting is done by Decorators.
All decorators will be notified of all events by a call to Decorator.processEvent(java.awt.AWTEvent)
in the overridded processEvent(java.awt.AWTEvent).
By default mouse, mouse motion and key events are enabled and will be sent to the decorators. (and processEvent(java.awt.AWTEvent))
addDecorator(com.miginfocom.calendar.decorators.GridDecorator),
getComponent(),
setCacheWithBackBuffer(boolean),
Serialized Form| 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 | |
|---|---|
protected DecoratorSupport |
decoratorSupport
A number of decorators, normally only one or two. |
protected static int |
HOR
|
protected static int |
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 | |
|---|---|
protected |
AbstractGridHeader(GridContainer gridContainer,
javax.swing.JComponent trackedComponent,
int edge)
Constructor. |
| Method Summary | |
|---|---|
void |
addDecorator(GridDecorator decorator)
Adds a decorator to the current contained grid and to any recreated grids in the tracked dateArea.A manual repaint has to be issued to paint the decorator. |
void |
addDecorators(java.util.Collection decorators)
Calls addDecorator(com.miginfocom.calendar.decorators.GridDecorator) for every element in the collection. |
void |
addGridListener(java.beans.PropertyChangeListener l)
Adds a listener that gets notified when the grid is changed or any other "major" change occurs. |
void |
addGridListener(java.beans.PropertyChangeListener l,
boolean asWeakRef)
Adds a listener that gets notified when the grid is changed or any other "major" change occurs. |
void |
addInteractionListener(InteractionListener l)
Adds a listener that listens to InteractionEvents. |
void |
addInteractionListener(InteractionListener l,
boolean asWeakRef)
Adds a listener that listens to InteractionEvents. |
void |
addNotify()
|
void |
clearBackBuffer()
If a back buffer is being used to cache the graphics contents of the header (for speed) it can be cleared with this method. |
void |
doLayout()
|
protected void |
fireInteractionOccured(InteractionEvent e)
Notifies all listeners of the the event. |
protected boolean |
fireStructureChanged(java.lang.String propName,
java.lang.Object oldValue,
java.lang.Object newValue)
Fires a structurat change event to the listeners |
java.awt.Paint |
getBackgroundPaint()
|
javax.swing.JComponent |
getComponent()
Returns this |
Decorator |
getDecorator(java.lang.Class type,
boolean inclSubClasses)
Returnes the first decorator found with the class type type, including sub types id inclSubClasses == true. |
java.util.List |
getDecorators()
Returns a cloned list with the decorators currently installed. |
int |
getEdge()
Returns what edge (E.g. |
Grid |
getGrid()
Returns the grid that this header uses for layout |
abstract HeaderGrid |
getHeaderGrid()
Returns the grid that this header uses for layout |
java.awt.Dimension |
getMaximumSize()
|
java.awt.Dimension |
getMinimumSize()
|
java.awt.Dimension |
getPreferredScrollableViewportSize()
|
int |
getPreferredSecondarySize()
Returns the preferred size in the non-tracked dimension. |
java.awt.Dimension |
getPreferredSize()
|
int |
getPrimaryDimension()
Returns the primary dimension for this header. |
int |
getPrimaryInsets()
Returns secondary dimension insests added (e.g. |
int |
getPrimDim()
Deprecated. Use getPrimaryDimension() instead. |
int |
getScrollableBlockIncrement(java.awt.Rectangle vis,
int ori,
int dir)
|
boolean |
getScrollableTracksViewportHeight()
|
boolean |
getScrollableTracksViewportWidth()
|
int |
getScrollableUnitIncrement(java.awt.Rectangle vis,
int ori,
int dir)
|
javax.swing.JScrollPane |
getScrollPane()
Returns the scroll pane that host the header. |
int |
getSecondaryInsets()
Returns secondary dimension insests added (e.g. |
javax.swing.JComponent |
getTrackedComponent()
returns the component that this header is a header for. |
void |
interactionOccured(InteractionEvent e)
Called when an interaction has occured |
boolean |
isBeforeGrid()
Returns if the the header is visually "before" the tracked grid cells (TOP & LEFT) or after (BOTTOM & RIGHT) |
boolean |
isCacheWithBackBuffer()
Return if a back buffered is being uesed to cache the contents of the header. |
void |
paint(java.awt.Graphics g)
|
protected void |
paintComponent(java.awt.Graphics g)
Paints the decorators |
void |
print(java.awt.Graphics g)
|
protected void |
processEvent(java.awt.AWTEvent e)
|
void |
propertyChange(java.beans.PropertyChangeEvent e)
|
void |
removeDecorator(GridDecorator decorator)
Removes a decorator from the current contained grid and to any recreated grids in the tracked dateArea.A manual repaint has to be issued to paint the decorator. |
void |
removeDecorators()
Removes all decorators |
void |
removeDecorators(java.util.Collection decorators)
Removes all decorators |
void |
removeGridListener(java.beans.PropertyChangeListener l)
Removes the listener, if it is in the list. |
void |
removeInteractionListener(InteractionListener l)
Removes the listener. |
void |
removeNotify()
|
void |
setBackground(java.awt.Color bg)
Propagate the background to the mandatory scroll pane. |
void |
setBackgroundPaint(java.awt.Paint p)
|
void |
setCacheWithBackBuffer(boolean cacheWithBackBuffer)
Sets if a back buffered is being uesed to cache the contents of the header. |
protected void |
setGridBoundsAndLayout(HeaderGrid grid)
Sets the size and grid offset for this header. |
void |
setPreferredSecondarySize(java.lang.Integer size)
Set the secondary dimension's preferred size. |
| 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 |
| Methods inherited from interface com.miginfocom.calendar.header.Header |
|---|
dispose |
| Field Detail |
|---|
protected static final int VER
protected static final int HOR
protected final DecoratorSupport decoratorSupport
| Constructor Detail |
|---|
protected AbstractGridHeader(GridContainer gridContainer,
javax.swing.JComponent trackedComponent,
int edge)
trackedComponent - The component that this header is a header for. When this component is added to the component herarchy it
registers itself with the tracked component and when this is removed from the component hierarchy this header will unregister itself
with that same component. This shuld make for an automatic disposal without memory leaks.| Method Detail |
|---|
public void addNotify()
addNotify in class javax.swing.JComponentpublic void removeNotify()
removeNotify in class javax.swing.JComponentpublic void paint(java.awt.Graphics g)
paint in class javax.swing.JComponentprotected void paintComponent(java.awt.Graphics g)
paintComponent in class javax.swing.JComponentg - The object to draw inpublic void setBackground(java.awt.Color bg)
setBackground in class javax.swing.JComponentbg - The new background.public void setBackgroundPaint(java.awt.Paint p)
public java.awt.Paint getBackgroundPaint()
public void print(java.awt.Graphics g)
print in class javax.swing.JComponentpublic int getPrimDim()
getPrimaryDimension() instead.
SwingConstants.HORIZONTAL
public int getPrimaryDimension()
SwingConstants.HORIZONTAL
public int getEdge()
SwingConstants.(TOP | LEFT | BOTTOM | RIGHT) the header will reside. Note that the actual placement of this component
is not done by this component, that is done by a layout manager of the parent. This value is for interpreting the date ranges in the cell rows.
public boolean isBeforeGrid()
protected void processEvent(java.awt.AWTEvent e)
processEvent in class java.awt.Containerpublic void clearBackBuffer()
public boolean isCacheWithBackBuffer()
true if so. false is default.setCacheWithBackBuffer(boolean)public void setCacheWithBackBuffer(boolean cacheWithBackBuffer)
clearBackBuffer() which will probably have to be called for every mouse event or the effects will not appear.
cacheWithBackBuffer - true turns it on. false is default.public java.awt.Dimension getPreferredSize()
getPreferredSize in class javax.swing.JComponentpublic java.awt.Dimension getMinimumSize()
getMinimumSize in class javax.swing.JComponentpublic java.awt.Dimension getMaximumSize()
getMaximumSize in class javax.swing.JComponentpublic javax.swing.JComponent getTrackedComponent()
public int getPreferredSecondarySize()
public void setPreferredSecondarySize(java.lang.Integer size)
null the grid's size will be used.
size - The size. May be nullpublic int getSecondaryInsets()
public int getPrimaryInsets()
public Grid getGrid()
getGrid in interface GridContainerpublic abstract HeaderGrid getHeaderGrid()
public javax.swing.JComponent getComponent()
this
getComponent in interface Headerthispublic javax.swing.JScrollPane getScrollPane()
Header
getScrollPane in interface Headerpublic void doLayout()
doLayout in class java.awt.Containerprotected void setGridBoundsAndLayout(HeaderGrid grid)
public java.awt.Dimension getPreferredScrollableViewportSize()
getPreferredScrollableViewportSize in interface javax.swing.Scrollablepublic boolean getScrollableTracksViewportHeight()
getScrollableTracksViewportHeight in interface javax.swing.Scrollablepublic boolean getScrollableTracksViewportWidth()
getScrollableTracksViewportWidth in interface javax.swing.Scrollable
public int getScrollableBlockIncrement(java.awt.Rectangle vis,
int ori,
int dir)
getScrollableBlockIncrement in interface javax.swing.Scrollable
public int getScrollableUnitIncrement(java.awt.Rectangle vis,
int ori,
int dir)
getScrollableUnitIncrement in interface javax.swing.Scrollablepublic void addDecorators(java.util.Collection decorators)
addDecorator(com.miginfocom.calendar.decorators.GridDecorator) for every element in the collection.
decorators - The decorators. Not null.DecoratorSupport.addDecorators(java.util.Collection)public void addDecorator(GridDecorator decorator)
dateArea.
decorator - The decorator. Insertion order is maintained and decorations will be painted in this order.DecoratorSupport.addDecorator(com.miginfocom.calendar.decorators.Decorator)public void removeDecorator(GridDecorator decorator)
dateArea.
decorator - The decorator to be removed.DecoratorSupport.removeDecorator(com.miginfocom.calendar.decorators.Decorator)public void removeDecorators()
DecoratorSupport.removeDecorators(java.util.Collection)public void removeDecorators(java.util.Collection decorators)
public java.util.List getDecorators()
null.
public Decorator getDecorator(java.lang.Class type,
boolean inclSubClasses)
type, including sub types id inclSubClasses == true.
type - The type. Not null.inclSubClasses - If sub classes of type should be removed as well.
public void addInteractionListener(InteractionListener l)
InteractionEvents. Interaction events are normally fired by the Interaction/Interactor/AbstractInteractionBroker
framework, used for instance by the AShape framework.InteractionListener and registers itself on the
interaction observable objects it creates. For instance ActivityViews.
l - The listener to add
public void addInteractionListener(InteractionListener l,
boolean asWeakRef)
InteractionEvents. Interaction events are normally fired by the Interaction/Interactor/AbstractInteractionBroker
framework, used for instance by the AShape framework.
l - The listener to addasWeakRef - 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.public void removeInteractionListener(InteractionListener l)
l - The listener to remove.protected void fireInteractionOccured(InteractionEvent e)
public void interactionOccured(InteractionEvent e)
InteractionListener
interactionOccured in interface InteractionListenere - The eventpublic void addGridListener(java.beans.PropertyChangeListener l)
GridContainer
addGridListener in interface GridContainerl - The listener. Not null
public void addGridListener(java.beans.PropertyChangeListener l,
boolean asWeakRef)
GridContainer
addGridListener in interface GridContainerl - The listener. Not nullasWeakRef - 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.public void removeGridListener(java.beans.PropertyChangeListener l)
GridContainer
removeGridListener in interface GridContainerl - The listener to remove, not null.
protected boolean fireStructureChanged(java.lang.String propName,
java.lang.Object oldValue,
java.lang.Object newValue)
public void propertyChange(java.beans.PropertyChangeEvent e)
propertyChange in interface java.beans.PropertyChangeListener
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||