com.miginfocom.calendar.datearea
Class DateAreaContainer

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by com.miginfocom.calendar.datearea.DateAreaContainer
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.awt.print.Printable, java.io.Serializable, javax.accessibility.Accessible
Direct Known Subclasses:
DateAreaBean, ThemeDateAreaContainer

public class DateAreaContainer
extends javax.swing.JPanel
implements java.awt.print.Printable

DateAreaContainer is a special Swing container that holds a date area and a number of headers and components and possibly scroll bars.

It holds a maximum of one Header on each of the four sides and those can be stretched into any of their adjacent corners. These headers can be added with the specific method setHeader(..) where you specify the side and also if it should expand into any of the corners.

It lays out the main components (date area, four headers and four corners) in a 3x3 grid by using GridBagLayout. The coordinates in the GridBagConstraints are spaced by multiplying 10 to the coordinate (1-based). This is so that you should be able to insert any number of other components between or outside the ones handled by this container and align the properly.

The center grid cell (20, 20) will be occupied by the date area and it only spans one cell in any direction. A component or header can span any number of grid cells that makes out a rectangle. For instance a header can occupy the top row (10, 10) to (30, 10).

Additional components can be added to the container all around the 9 "handled" component spots by adding the component with a custom GridBagConstraints. Just remember that gridx 10, 20 and 30 and gridy 10, 20 and 30 are occupied (I.e. used, handled) by the container.

This container is manually handling the scroll bars, if needed, so that they can be outside the headers. These area added outside the 3x3 components handled. You can set the scroll bar policy for those as you can with a normal JScrollPane. Scrollbars are set to gridbag coordinate (40, 10) spanning 35y (standing bar) and (10, 40) spanning 35x (laying bar).

For instance to add a component between the top header and date area use:

add(component, new GridBagConstraints(20, 15, 20, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));

In short; there's special convenience methods for setting components and headers around the date area. If you really want to customize the container you can add components to the container with the normal Swing add(..) method and provide a GridBagConstraint that will put that component anywhere in alignment to the existing ones. The Header objects are a little more that normal components though and they should always be added with setHeader().

To really understand how to add your own components between and around the 3x3 (+ scroll bars) handled components you will need a thourough understanding of how GridBagLayout works.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
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.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
static java.lang.String BOTTOM_LEFT_CORNER
          A "side" constraint for layout.
static java.lang.String BOTTOM_RIGHT_CORNER
          A "side" constraint for layout.
static int CORNER_EXPAND_BOTH
          Expand header to both corners.
static int CORNER_EXPAND_BOTTOM_OR_RIGHT
          Expand header to bottom/right corners.
static int CORNER_EXPAND_NONE
          Expand header to top/left corner.
static int CORNER_EXPAND_TOP_OR_LEFT
          Expand header to top/left corner.
protected static java.lang.String[] CORNERS
           
static java.lang.String EAST
          A "side" constraint for layout.
static java.lang.String EAST_BOTTOM
          A "side" constraint for layout.
static java.lang.String EAST_FILL
          A "side" constraint for layout.
static java.lang.String EAST_TOP
          A "side" constraint for layout.
static java.lang.String NORTH
          A "side" constraint for layout.
static java.lang.String NORTH_FILL
          A "side" constraint for layout.
static java.lang.String NORTH_LEFT
          A "side" constraint for layout.
static java.lang.String NORTH_RIGHT
          A "side" constraint for layout.
protected static java.lang.String[][] SIDES
           
static java.lang.String SOUTH
          A "side" constraint for layout.
static java.lang.String SOUTH_FILL
          A "side" constraint for layout.
static java.lang.String SOUTH_LEFT
          A "side" constraint for layout.
static java.lang.String SOUTH_RIGHT
          A "side" constraint for layout.
static java.lang.String TOP_LEFT_CORNER
          A "side" constraint for layout.
static java.lang.String TOP_RIGHT_CORNER
          A "side" constraint for layout.
static java.lang.String WEST
          A "side" constraint for layout.
static java.lang.String WEST_BOTTOM
          A "side" constraint for layout.
static java.lang.String WEST_FILL
          A "side" constraint for layout.
static java.lang.String WEST_TOP
          A "side" constraint for layout.
 
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.print.Printable
NO_SUCH_PAGE, PAGE_EXISTS
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
DateAreaContainer()
          Constructs an DefaultDateArea.
DateAreaContainer(DefaultDateArea dateArea)
          Constructor.
 
Method Summary
 void addComponent(javax.swing.JComponent component, java.lang.String side)
          Add the component in the specified position.
 void addComponent(javax.swing.JComponent component, java.lang.String side, int order)
          Add the component in the specified position.
 DefaultDateArea getDateArea()
          Returns the contained date area
 javax.swing.JScrollPane getDateAreaScrollPane()
          Returns the scroll pane that the date area is installed in.
 Header getHeader(java.lang.String side)
          Returns the header.
 Header getHeader(java.lang.String side, int order)
          Returns a header.
 java.util.List getHeaders(java.lang.String side)
          Returns the headers for the side from lower to higher order (e.g.
 int getHorizontalScrollBarPolicy()
          Returns the policy for the horizontal (laying) scroll bar.
Legal values are: ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS
 java.awt.geom.Rectangle2D getPrintablePageBounds(java.awt.print.PageFormat pf)
          Returns the bounds the printable will get given the PrintSpecification and the PageFormat.
 java.awt.geom.Rectangle2D getPrintablePageBounds(java.awt.print.PageFormat pf, PrintSpecification printSpec)
          Returns the bounds the printable will get given the PrintSpecification and the PageFormat.
 java.awt.Dimension getPrintablePreferredSize()
          Returns the preferred size the this date area container wants when printed.
 PrintSpecification getPrintSpecification()
          Property: The specifiaction that outlines how this date area container should be printed.
 int getVerticalScrollBarPolicy()
          Returns the policy for the vertical (standing) scroll bar.
Legal values are: ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS
 DateRangeI getViewportViewDateRange()
          Returns the date range that is currently visible in the scroll panes viewport.
 boolean isEastOfDateArea(java.awt.Component comp)
          Return true if the component is below the date area.
 boolean isSouthOfDateArea(java.awt.Component comp)
          Return true if the component is below the date area.
protected  void moveHeader(Header header, java.lang.String newSide, int newOrder)
          Moves the header from one side to another.
 void print(java.awt.Graphics g)
          Prints the component into g.
 int print(java.awt.Graphics g, java.awt.print.PageFormat pf, int pageIndex)
          Prints this component.
 int print(java.awt.Graphics g, java.awt.print.PageFormat pf, int pageIndex, PrintSpecification printSpec)
          Prints this component.
 void scrollToShowRange(DateRangeI range, float xAlign, float yAlign)
          Scrolls the scroll pane so that the smalles bounds that cover all dates/times in range will be shown.
 void setBackground(java.awt.Color bg)
          Propagate the background to the mandatory scroll pane.
 void setHeader(Header header, java.lang.String side)
          Set the header and removed an old header so this will take it's place.
 void setHeader(Header header, java.lang.String side, int order)
          Set the header and removed an old header so this will take it's place.
 void setHorizontalScrollBarPolicy(int policy)
          Sets the policy for the horizontal (laying) scroll bar.
Legal values are: ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS
 void setLayout(java.awt.LayoutManager l)
          Overridden to not set a new layout since we depend on GridBagLayout.
 void setPrintSpecification(PrintSpecification printSpec)
          Property: The specifiaction that outlines how this date area container should be printed.
 void setScrollBarsVisibility()
          Set the visibility on the scroll bars.
 void setVerticalScrollBarPolicy(int policy)
          Sets the policy for the vertical (standing) scroll bar.
Legal values are: ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, 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
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, 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, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, 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

NORTH

public static final java.lang.String NORTH
A "side" constraint for layout. X denotes the place in the 3x3 grid.
 OXO
 OOO
 OOO
 

See Also:
Constant Field Values

NORTH_FILL

public static final java.lang.String NORTH_FILL
A "side" constraint for layout. X denotes the place in the 3x3 grid.
 XXX
 OOO
 OOO
 

See Also:
Constant Field Values

NORTH_LEFT

public static final java.lang.String NORTH_LEFT
A "side" constraint for layout. X denotes the place in the 3x3 grid.
 XXO
 OOO
 OOO
 

See Also:
Constant Field Values

NORTH_RIGHT

public static final java.lang.String NORTH_RIGHT
A "side" constraint for layout. X denotes the place in the 3x3 grid.
 OXX
 OOO
 OOO
 

See Also:
Constant Field Values

SOUTH

public static final java.lang.String SOUTH
A "side" constraint for layout. X denotes the place in the 3x3 grid.
 OOO
 OOO
 OXO
 

See Also:
Constant Field Values

SOUTH_FILL

public static final java.lang.String SOUTH_FILL
A "side" constraint for layout. X denotes the place in the 3x3 grid.
 OOO
 OOO
 XXX
 

See Also:
Constant Field Values

SOUTH_LEFT

public static final java.lang.String SOUTH_LEFT
A "side" constraint for layout. X denotes the place in the 3x3 grid.
 OOO
 OOO
 XXO
 

See Also:
Constant Field Values

SOUTH_RIGHT

public static final java.lang.String SOUTH_RIGHT
A "side" constraint for layout. X denotes the place in the 3x3 grid.
 OOO
 OOO
 OXX
 

See Also:
Constant Field Values

EAST

public static final java.lang.String EAST
A "side" constraint for layout. X denotes the place in the 3x3 grid.
 OOO
 OOX
 OOO
 

See Also:
Constant Field Values

EAST_FILL

public static final java.lang.String EAST_FILL
A "side" constraint for layout. X denotes the place in the 3x3 grid.
 OOX
 OOX
 OOX
 

See Also:
Constant Field Values

EAST_TOP

public static final java.lang.String EAST_TOP
A "side" constraint for layout. X denotes the place in the 3x3 grid.
 OOX
 OOX
 OOO
 

See Also:
Constant Field Values

EAST_BOTTOM

public static final java.lang.String EAST_BOTTOM
A "side" constraint for layout. X denotes the place in the 3x3 grid.
 OOO
 OOX
 OOX
 

See Also:
Constant Field Values

WEST

public static final java.lang.String WEST
A "side" constraint for layout. X denotes the place in the 3x3 grid.
 OOO
 XOO
 OOO
 

See Also:
Constant Field Values

WEST_FILL

public static final java.lang.String WEST_FILL
A "side" constraint for layout. X denotes the place in the 3x3 grid.
 XOO
 XOO
 XOO
 

See Also:
Constant Field Values

WEST_TOP

public static final java.lang.String WEST_TOP
A "side" constraint for layout. X denotes the place in the 3x3 grid.
 XOO
 XOO
 OOO
 

See Also:
Constant Field Values

WEST_BOTTOM

public static final java.lang.String WEST_BOTTOM
A "side" constraint for layout. X denotes the place in the 3x3 grid.
 OOO
 XOO
 XOO
 

See Also:
Constant Field Values

TOP_LEFT_CORNER

public static final java.lang.String TOP_LEFT_CORNER
A "side" constraint for layout. X denotes the place in the 3x3 grid.
 XOO
 OOO
 OOO
 

See Also:
Constant Field Values

TOP_RIGHT_CORNER

public static final java.lang.String TOP_RIGHT_CORNER
A "side" constraint for layout. X denotes the place in the 3x3 grid.
 OOX
 OOO
 OOO
 

See Also:
Constant Field Values

BOTTOM_LEFT_CORNER

public static final java.lang.String BOTTOM_LEFT_CORNER
A "side" constraint for layout. X denotes the place in the 3x3 grid.
 OOO
 OOO
 XOO
 

See Also:
Constant Field Values

BOTTOM_RIGHT_CORNER

public static final java.lang.String BOTTOM_RIGHT_CORNER
A "side" constraint for layout. X denotes the place in the 3x3 grid.
 OOO
 OOO
 OOX
 

See Also:
Constant Field Values

CORNER_EXPAND_NONE

public static final int CORNER_EXPAND_NONE
Expand header to top/left corner.

See Also:
Constant Field Values

CORNER_EXPAND_TOP_OR_LEFT

public static final int CORNER_EXPAND_TOP_OR_LEFT
Expand header to top/left corner.

See Also:
Constant Field Values

CORNER_EXPAND_BOTTOM_OR_RIGHT

public static final int CORNER_EXPAND_BOTTOM_OR_RIGHT
Expand header to bottom/right corners.

See Also:
Constant Field Values

CORNER_EXPAND_BOTH

public static final int CORNER_EXPAND_BOTH
Expand header to both corners.

See Also:
Constant Field Values

SIDES

protected static final java.lang.String[][] SIDES

CORNERS

protected static final java.lang.String[] CORNERS
Constructor Detail

DateAreaContainer

public DateAreaContainer()
Constructs an DefaultDateArea.


DateAreaContainer

public DateAreaContainer(DefaultDateArea dateArea)
Constructor.

Parameters:
dateArea - The date area to use. Not null.
Method Detail

setLayout

public final void setLayout(java.awt.LayoutManager l)
Overridden to not set a new layout since we depend on GridBagLayout.

Overrides:
setLayout in class java.awt.Container
Parameters:
l - Not used

setBackground

public void setBackground(java.awt.Color bg)
Propagate the background to the mandatory scroll pane.

Overrides:
setBackground in class javax.swing.JComponent
Parameters:
bg - The new background.

setScrollBarsVisibility

public void setScrollBarsVisibility()
Set the visibility on the scroll bars. This is done manually since the scroll bars are moved outside the normall scroll pane. The value set in setVerticalScrollBarPolicy(int) and setHorizontalScrollBarPolicy(int) is regarded.


getVerticalScrollBarPolicy

public int getVerticalScrollBarPolicy()
Returns the policy for the vertical (standing) scroll bar.
Legal values are:

Returns:
The policy for the vertical (standing) scroll bar.

setVerticalScrollBarPolicy

public void setVerticalScrollBarPolicy(int policy)
Sets the policy for the vertical (standing) scroll bar.
Legal values are:

Parameters:
policy -

getHorizontalScrollBarPolicy

public int getHorizontalScrollBarPolicy()
Returns the policy for the horizontal (laying) scroll bar.
Legal values are:

Returns:
The policy for the horizontal (laying) scroll bar.

setHorizontalScrollBarPolicy

public void setHorizontalScrollBarPolicy(int policy)
Sets the policy for the horizontal (laying) scroll bar.
Legal values are:

Parameters:
policy -

getDateArea

public DefaultDateArea getDateArea()
Returns the contained date area

Returns:
The contained date area

addComponent

public void addComponent(javax.swing.JComponent component,
                         java.lang.String side)
Add the component in the specified position. Does not remove old components that occupy the same space/side. Only header components are possible to be fetched after they've been added. Pure corner compoents for instance have to be tracked manually by the adder.

order is set to 0.

Parameters:
component - The component to add. Not null.
side - The side/corner. E.g. DateAreaContainer.TOP_LEFT_CORNER or DateAreaContainer.EAST_FILL.

addComponent

public void addComponent(javax.swing.JComponent component,
                         java.lang.String side,
                         int order)
Add the component in the specified position. Does not remove old components that occupy the same space/side. Only header components are possible to be fetched after they've been added. Pure corner components for instance have to be tracked manually by the adder.

Parameters:
component - The component to add. Not null.
side - The side/corner. E.g. DateAreaContainer.TOP_LEFT_CORNER or DateAreaContainer.EAST_FILL.
order - The order number. Lower numbers reside outside higher numbers. -9 to 9 is valid. E.g. 1 can be used to set a category header below the normal date header. Not used for corner sides such as DateAreaContainer.TOP_LEFT_CORNER.

getHeaders

public java.util.List getHeaders(java.lang.String side)
Returns the headers for the side from lower to higher order (e.g. left/top to right/bottom).

Parameters:
side - The side. One of the "sides". E.g. DateAreaContainer.NORTH.
Returns:
The headers for the side. Never null.

getHeader

public Header getHeader(java.lang.String side)
Returns the header. There can be at most 4 headers. One on each side.

order is set to 0.

Parameters:
side - The side. One of the "sides". E.g. DateAreaContainer.NORTH.
Returns:
The indicated header or null if none exist.

getHeader

public Header getHeader(java.lang.String side,
                        int order)
Returns a header. Four main header directions and the headers in that direction are divided using the order and index.

Parameters:
side - The side. One of the "sides". E.g. DateAreaContainer.NORTH. E.g. DateAreaContainer.NORTH is the same as DateAreaContainer.NORTH_FILL, only the side will matter.
order - The order number. Lower numbers reside outside higher numbers. -9 to 9 is valid. E.g. 1 can be used to set a category header below the normal date header. Not used for corner sides such as DateAreaContainer.TOP_LEFT_CORNER.
Returns:
The indicated header or null if none exist.

setHeader

public void setHeader(Header header,
                      java.lang.String side)
Set the header and removed an old header so this will take it's place. They can expand to zero, one or both of the adjacent corners. Nothing is done if the new header is same as old.

Parameters:
header - The header to set or null to only clear the current one.
side - E.g. DateAreaContainer.NORTH_FILL.

isSouthOfDateArea

public boolean isSouthOfDateArea(java.awt.Component comp)
Return true if the component is below the date area.

Parameters:
comp - The component
Returns:
true if the component is below the date area.

isEastOfDateArea

public boolean isEastOfDateArea(java.awt.Component comp)
Return true if the component is below the date area.

Parameters:
comp - The component
Returns:
true if the component is below the date area.

setHeader

public void setHeader(Header header,
                      java.lang.String side,
                      int order)
Set the header and removed an old header so this will take it's place. They can expand to zero, one or both of the adjacent corners. Nothing is done if the new header is same as old.

order is set to 0.

Parameters:
header - The header to set or null to only clear the current one.
side - E.g. DateAreaContainer.NORTH_FILL.
order - The order number. Lower numbers reside outside higher numbers. -9 to 9 is valid. E.g. 4 can be used to set a category header below the normal date header. Not used for corner sides such as DateAreaContainer.TOP_LEFT_CORNER.

moveHeader

protected void moveHeader(Header header,
                          java.lang.String newSide,
                          int newOrder)
Moves the header from one side to another. Must call header.setEdge(..) as well.

Parameters:
header - The header to move. Not null.
newSide - The new side. E.g. DateAreaContainer.NORTH_FILL.
newOrder - The new order number. Lower numbers reside outside higher numbers. -9 to 9 is valid. E.g. 1 can be used to set a category header below the normal date header. Not used for corner sides such as DateAreaContainer.TOP_LEFT_CORNER.

getDateAreaScrollPane

public javax.swing.JScrollPane getDateAreaScrollPane()
Returns the scroll pane that the date area is installed in.

Returns:
The scroll pane that the date area is installed in.
See Also:
DefaultDateArea.createScrollPane()

scrollToShowRange

public void scrollToShowRange(DateRangeI range,
                              float xAlign,
                              float yAlign)
Scrolls the scroll pane so that the smalles bounds that cover all dates/times in range will be shown. If range does not overlap the date areas date range this method returns without doing anything.

Note that if the grid hasn't been layout out to the correct size this method won't work or possition incorrectly. Use dateArea.getDateGrid().getSise() to check the size if the grid against the expected.

Parameters:
range - The range to scroll to.
xAlign - How to position the bound within the view port horizontally. 0.0f is left, 1.0f is right and 0.5f is center justified. Any values in between is also ok.
yAlign - How to position the bound within the view port vertically. 0.0f is top, 1.0f is bottom and 0.5f is center justified. Any values in between is also ok.

getViewportViewDateRange

public DateRangeI getViewportViewDateRange()
Returns the date range that is currently visible in the scroll panes viewport. If there is no scroll bars currently the date range for the date area is returned.

Returns:
The date range that is currently visible in the scroll panes viewport.

getPrintSpecification

public PrintSpecification getPrintSpecification()
Property: The specifiaction that outlines how this date area container should be printed.

Returns:
The current specification. Not null.
Since:
6.0

setPrintSpecification

public void setPrintSpecification(PrintSpecification printSpec)
Property: The specifiaction that outlines how this date area container should be printed.

Parameters:
printSpec - The new specification. If null a default specification will be created.
Since:
6.0

getPrintablePreferredSize

public java.awt.Dimension getPrintablePreferredSize()
Returns the preferred size the this date area container wants when printed. The scroll panes will be disregarded and the size of their views will be used instead. Scroll bars will be removed in the calculation.

This size is the size used when printing this component.

Returns:
The size. Never null.
Since:
6.0
See Also:
print(java.awt.Graphics, java.awt.print.PageFormat, int)

getPrintablePageBounds

public java.awt.geom.Rectangle2D getPrintablePageBounds(java.awt.print.PageFormat pf)
Returns the bounds the printable will get given the PrintSpecification and the PageFormat.

Parameters:
pf - The page format. Not null.
Returns:
The bounds. Never null.
Since:
6.0

getPrintablePageBounds

public java.awt.geom.Rectangle2D getPrintablePageBounds(java.awt.print.PageFormat pf,
                                                        PrintSpecification printSpec)
Returns the bounds the printable will get given the PrintSpecification and the PageFormat.

Parameters:
pf - The page format. Not null. Coordinates in points (1/72 of a inch).
printSpec - The print specification to use instead of the one from getPrintSpecification(). If null the print specification from getPrintSpecification() is used.
Returns:
The bounds. Never null. Coordinates in points (1/72 of a inch).
Since:
6.0

print

public void print(java.awt.Graphics g)
Prints the component into g.

Calls the print(java.awt.Graphics, java.awt.print.PageFormat, int) using a single page and the current size of the component.

Overrides:
print in class javax.swing.JComponent
Parameters:
g - The grapics object to print to.
Throws:
java.lang.RuntimeException - with a PrinterException within. The reason for the wrapping is that the super method does not have an exception in the declaration.
Since:
6.5

print

public int print(java.awt.Graphics g,
                 java.awt.print.PageFormat pf,
                 int pageIndex)
          throws java.awt.print.PrinterException
Prints this component. Uses getPrintSpecification()'s values to know how to print.

Specified by:
print in interface java.awt.print.Printable
Throws:
java.awt.print.PrinterException
Since:
6.0

print

public int print(java.awt.Graphics g,
                 java.awt.print.PageFormat pf,
                 int pageIndex,
                 PrintSpecification printSpec)
          throws java.awt.print.PrinterException
Prints this component.

Parameters:
g - the context into which the page is drawn
pf - the size and orientation of the page being drawn
pageIndex - the zero based index of the page to be drawn
printSpec - The print specification. If null the print specification from getPrintSpecification() is used.
Returns:
PAGE_EXISTS if the page is rendered successfully or NO_SUCH_PAGE if pageIndex specifies a non-existent page.
Throws:
java.awt.print.PrinterException - thrown when the print job is terminated.
Since:
6.0


Copyright © 2009 MiG InfoCom AB. All Rights Reserved.