wt.clients.calendar
Class CalendarBean

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjava.awt.Panel
              extended bywt.clients.calendar.CalendarBean
All Implemented Interfaces:
Accessible, ImageObserver, ItemSelectable, MenuContainer, Serializable

public class CalendarBean
extends Panel
implements ItemSelectable

Calendar component. Creates a graphic calendar displaying a month of dates. A combo box controls the month displayed, a numeric spin control changes the year displayed.

See Also:
Serialized Form

Nested Class Summary
(package private)  class CalendarBean.Action
          This is the Adjustment Event handling innerclass.
(package private)  class CalendarBean.Item
          This is the Adjustment Event handling innerclass.
(package private)  class CalendarBean.Mouse
          This is the Mouse Event handling innerclass.
(package private)  class CalendarBean.MouseMotion
           
 
Nested classes inherited from class java.awt.Panel
Panel.AccessibleAWTPanel
 
Nested classes inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
private  CalendarBean.Action action
           
(package private)  String actionCommand
           
(package private)  ActionListener actionListener
           
(package private)  Color backgroundColor
           
(package private)  Font bigFont
           
protected  boolean bNeedsPlatformHelp
          True if the ComboBox needs help changing state.
(package private)  Font boldFont
           
(package private)  Calendar calendar
           
private  symantec.itools.beans.PropertyChangeSupport changes
           
protected  Choice combo
          The ComboBox that displays/controls the month.
(package private)  DateFormatSymbols dfs
           
protected  int endDay
           
protected  int endDaySelectedx
          The column index of the end selected day.
protected  int endDaySelectedy
          The row index of the end selected day.
(package private)  Color headerColor
           
private  CalendarBean.Item item
           
(package private)  ItemListener itemListener
           
protected  int maxMonthx
          The column index of the last day in the month.
protected  int maxMonthy
          The row index of the last day in the month.
private  CalendarBean.Mouse mouse
           
private  CalendarBean.MouseMotion mouseMotion
           
(package private)  Color nonWorkingColor
           
(package private)  Font normalFont
           
(package private)  Graphics offgraphics
           
(package private)  Image offscreen
           
(package private)  Rectangle offscreensize
           
protected  symantec.itools.awt.util.spinner.NumericSpinner sc
          The spinner that displays/controls the year.
(package private)  Font smallFont
           
protected  int startDay
           
protected  int startDaySelectedx
          The column index of the start selected day.
protected  int startDaySelectedy
          The row index of the start selected day.
(package private)  CalendarMonth systemCalendar
           
(package private)  WTPrincipalReference systemCalendarOwner
           
(package private)  CalendarMonth userCalendar
           
(package private)  WTPrincipalReference userCalendarOwner
           
private  symantec.itools.beans.VetoableChangeSupport vetos
           
private static int WEEK_WIDTH
           
(package private)  Color workingColor
           
(package private)  TextField yearField
           
 
Fields inherited from class java.awt.Panel
 
Fields inherited from class java.awt.Container
 
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
CalendarBean()
          Creates a default calendar with today's date initialized.
CalendarBean(Date defaultdate)
          Creates a calendar with the specified date initialized.
 
Method Summary
 void addActionListener(ActionListener l)
          Adds the specified action listener to receive action events from this button.
 void addItemListener(ItemListener listener)
          Adds a listener for all item events.
 void addNotify()
          Tells this component that it has been added to a container.
 void addPropertyChangeListener(PropertyChangeListener listener)
          Adds a listener for all property change events.
 void addVetoableChangeListener(VetoableChangeListener listener)
          Adds a listener for all vetoable property change events.
static void displayException(Component component, Throwable exception)
          Displays and exception.
 String getActionCommand()
           
 int getEndDay()
           
 Dimension getMinimumSize()
          Returns the minimum dimensions to properly display this component.
 int getMonth()
           
 Dimension getPreferredSize()
          Returns the recommended dimensions to properly display this component.
 Object[] getSelectedObjects()
          Returns the selected days in an array of Integers.
 int getStartDay()
           
 int getYear()
           
 int getZoneOffset()
           
(package private)  boolean isLeapYear(int year)
           
 void paint(Graphics g)
          Paints this component using the given graphics context.
 void removeActionListener(ActionListener l)
          Removes the specified action listener so it no longer receives action events from this button.
 void removeItemListener(ItemListener listener)
          Removes a listener for all item events.
 void removeNotify()
          Tells this component that it is being removed from a container.
 void removePropertyChangeListener(PropertyChangeListener listener)
          Removes a listener for all property change events.
 void removeVetoableChangeListener(VetoableChangeListener listener)
          Removes a listener for all vetoable property change events.
 void setActionCommand(String command)
          Sets the command name of the action event fired by this button.
private  void setBusy(boolean busy)
          Set the widget as busy.
 void setLayout(LayoutManager lm)
          Takes no action.
 void setSystemCalendar(CalendarMonth system_calendar)
           
 void setSystemCalendarOwner(WTPrincipalReference system_calendar_owner)
           
 void setUserCalendar(CalendarMonth user_calendar)
           
 void setUserCalendarOwner(WTPrincipalReference user_calendar_owner)
           
 void sourceActionEvent()
          Fire an action event to the listeners
 void sourceItemEvent()
          Fire an item event to the listeners
 void update(Graphics g)
          Handles redrawing of this component on the screen.
 
Methods inherited from class java.awt.Panel
getAccessibleContext
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getListeners, getMaximumSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, paramString, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFont, 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, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, 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

calendar

Calendar calendar

dfs

DateFormatSymbols dfs

startDay

protected int startDay

endDay

protected int endDay

userCalendar

CalendarMonth userCalendar

systemCalendar

CalendarMonth systemCalendar

smallFont

Font smallFont

normalFont

Font normalFont

boldFont

Font boldFont

bigFont

Font bigFont

nonWorkingColor

Color nonWorkingColor

workingColor

Color workingColor

backgroundColor

Color backgroundColor

headerColor

Color headerColor

WEEK_WIDTH

private static final int WEEK_WIDTH
See Also:
Constant Field Values

userCalendarOwner

WTPrincipalReference userCalendarOwner

systemCalendarOwner

WTPrincipalReference systemCalendarOwner

yearField

TextField yearField

offscreen

Image offscreen

offscreensize

Rectangle offscreensize

offgraphics

Graphics offgraphics

actionCommand

String actionCommand

actionListener

ActionListener actionListener

itemListener

ItemListener itemListener

combo

protected Choice combo
The ComboBox that displays/controls the month.


bNeedsPlatformHelp

protected boolean bNeedsPlatformHelp
True if the ComboBox needs help changing state.

See Also:
combo, ComboBox.needsPlatformHelp()

sc

protected symantec.itools.awt.util.spinner.NumericSpinner sc
The spinner that displays/controls the year.


startDaySelectedx

protected int startDaySelectedx
The column index of the start selected day.


startDaySelectedy

protected int startDaySelectedy
The row index of the start selected day.


endDaySelectedx

protected int endDaySelectedx
The column index of the end selected day.


endDaySelectedy

protected int endDaySelectedy
The row index of the end selected day.


maxMonthx

protected int maxMonthx
The column index of the last day in the month.


maxMonthy

protected int maxMonthy
The row index of the last day in the month.


action

private CalendarBean.Action action

item

private CalendarBean.Item item

mouse

private CalendarBean.Mouse mouse

mouseMotion

private CalendarBean.MouseMotion mouseMotion

vetos

private symantec.itools.beans.VetoableChangeSupport vetos

changes

private symantec.itools.beans.PropertyChangeSupport changes
Constructor Detail

CalendarBean

public CalendarBean()
Creates a default calendar with today's date initialized.


CalendarBean

public CalendarBean(Date defaultdate)
Creates a calendar with the specified date initialized.

Parameters:
defaultdate - the date to be shown initially
Method Detail

setBusy

private void setBusy(boolean busy)
Set the widget as busy.


addNotify

public void addNotify()
Tells this component that it has been added to a container. This is a standard Java AWT method which gets called by the AWT when this component is added to a container. Typically, it is used to create this component's peer. It has been overridden here to hook-up event listeners.

See Also:
removeNotify()

removeNotify

public void removeNotify()
Tells this component that it is being removed from a container. This is a standard Java AWT method which gets called by the AWT when this component is removed from a container. Typically, it is used to destroy the peers of this component and all its subcomponents. It has been overridden here to unhook event listeners.

See Also:
addNotify()

update

public void update(Graphics g)
Handles redrawing of this component on the screen. This is a standard Java AWT method which gets called by the Java AWT (repaint()) to handle repainting this component on the screen. The graphics context clipping region is set to the bounding rectangle of this component and its <0,0> coordinate is this component's top-left corner. Typically this method paints the background color to clear the component's drawing space, sets graphics context to be the foreground color, and then calls paint() to draw the component. It is overridden here to reduce flicker by eliminating the uneeded clearing of the background.

Parameters:
g - the graphics context
See Also:
Component.repaint(), paint(java.awt.Graphics)

paint

public void paint(Graphics g)
Paints this component using the given graphics context. This is a standard Java AWT method which typically gets called by the AWT to handle painting this component. It paints this component using the given graphics context. The graphics context clipping region is set to the bounding rectangle of this component and its <0,0> coordinate is this component's top-left corner.

Parameters:
g - the graphics context used for painting
See Also:
Component.repaint(), update(java.awt.Graphics)

getPreferredSize

public Dimension getPreferredSize()
Returns the recommended dimensions to properly display this component. This is a standard Java AWT method which gets called to determine the recommended size of this component.

Returns:
the preferred dimensions for the calender (250 x 200 pixels).
See Also:
Container.minimumSize()

getMinimumSize

public Dimension getMinimumSize()
Returns the minimum dimensions to properly display this component. This is a standard Java AWT method which gets called to determine the minimum size of this component.

Returns:
the minimum dimensions needed for the calender (250 x 200 pixels).
See Also:
Container.preferredSize()

addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener listener)
Adds a listener for all property change events.

Parameters:
listener - the listener to add
See Also:
removePropertyChangeListener(java.beans.PropertyChangeListener)

removePropertyChangeListener

public void removePropertyChangeListener(PropertyChangeListener listener)
Removes a listener for all property change events.

Parameters:
listener - the listener to remove
See Also:
addPropertyChangeListener(java.beans.PropertyChangeListener)

addVetoableChangeListener

public void addVetoableChangeListener(VetoableChangeListener listener)
Adds a listener for all vetoable property change events.

Parameters:
listener - the listener to add
See Also:
removeVetoableChangeListener(java.beans.VetoableChangeListener)

removeVetoableChangeListener

public void removeVetoableChangeListener(VetoableChangeListener listener)
Removes a listener for all vetoable property change events.

Parameters:
listener - the listener to remove
See Also:
addVetoableChangeListener(java.beans.VetoableChangeListener)

setActionCommand

public void setActionCommand(String command)
                      throws PropertyVetoException
Sets the command name of the action event fired by this button.

Parameters:
command - The name of the action event command fired by this button
Throws:
PropertyVetoException - if the specified property value is unacceptable

getActionCommand

public String getActionCommand()
Returns:
the command name of the action event fired by this button.

addActionListener

public void addActionListener(ActionListener l)
Adds the specified action listener to receive action events from this button.

Parameters:
l - the action listener

removeActionListener

public void removeActionListener(ActionListener l)
Removes the specified action listener so it no longer receives action events from this button.

Parameters:
l - the action listener

sourceActionEvent

public void sourceActionEvent()
Fire an action event to the listeners


addItemListener

public void addItemListener(ItemListener listener)
Adds a listener for all item events.

Specified by:
addItemListener in interface ItemSelectable
Parameters:
listener - the listener to add
See Also:
removeItemListener(java.awt.event.ItemListener)

removeItemListener

public void removeItemListener(ItemListener listener)
Removes a listener for all item events.

Specified by:
removeItemListener in interface ItemSelectable
Parameters:
listener - the listener to remove
See Also:
addItemListener(java.awt.event.ItemListener)

sourceItemEvent

public void sourceItemEvent()
Fire an item event to the listeners


getSelectedObjects

public Object[] getSelectedObjects()
Returns the selected days in an array of Integers.

Specified by:
getSelectedObjects in interface ItemSelectable

setSystemCalendar

public void setSystemCalendar(CalendarMonth system_calendar)

setSystemCalendarOwner

public void setSystemCalendarOwner(WTPrincipalReference system_calendar_owner)

setUserCalendar

public void setUserCalendar(CalendarMonth user_calendar)

setUserCalendarOwner

public void setUserCalendarOwner(WTPrincipalReference user_calendar_owner)

getStartDay

public int getStartDay()

getEndDay

public int getEndDay()

getYear

public int getYear()

getMonth

public int getMonth()

getZoneOffset

public int getZoneOffset()

setLayout

public void setLayout(LayoutManager lm)
Takes no action. This is a standard Java AWT method which gets called to specify which layout manager should be used to layout the components in standard containers. Since layout managers CANNOT BE USED with this container the standard setLayout has been OVERRIDDEN for this container and does nothing.

Parameters:
lm - the layout manager to use to layout this container's components (IGNORED)
See Also:
Container.getLayout()

isLeapYear

boolean isLeapYear(int year)

displayException

public static void displayException(Component component,
                                    Throwable exception)
Displays and exception.