net.sf.nachocalendar.components
Class DatePanel

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byjavax.swing.JPanel
                  extended bynet.sf.nachocalendar.components.DatePanel
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public class DatePanel
extends javax.swing.JPanel

Panel for selecting a day. It has custom components to change the displaying month and year

Author:
Ignacio Merani
See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Nested classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
 
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
DatePanel()
          Default constructor.
DatePanel(boolean showWeekNumbers)
          Creates a DatePanel and let specify the showing of week numbers.
 
Method Summary
 void addActionListener(java.awt.event.ActionListener listener)
          Registers ActionListener to receive events.
 void addChangeListener(javax.swing.event.ChangeListener listener)
          Registers ChangeListener to receive events.
 void addKeyListener(java.awt.event.KeyListener listener)
          Registers KeyListener to receive events.
 void addMonthChangeListener(MonthChangeListener listener)
          Registers MonthChangeListener to receive events.
 java.util.Date getDate()
          Returns the selected date.
 DateSelectionModel getDateSelectionModel()
           
 int getFirstDayOfWeek()
          Getter for property firstDayOfWeek.
 HeaderRenderer getHeaderRenderer()
          Getter for property headerRenderer.
 DataModel getModel()
          Getter for property model.
 DayRenderer getRenderer()
          Getter for property renderer.
 int getSelectionMode()
          Returns the current selection mode.
 boolean getShowToday()
          Returns the Today button visibility.
 java.lang.String getTodayCaption()
          Returns the today button text.
 java.lang.Object getValue()
          Getter for property value.
 java.lang.Object[] getValues()
          Returns a Object collection with the selected dates.
 boolean[] getWorkingDays()
          Getter for property workingDays.
 boolean isAntiAliased()
           
 boolean isEnabled()
          Getter for enabled property.
 boolean isPrintMoon()
           
 void refresh()
          Refreshes the showing of this component.
 void removeActionListener(java.awt.event.ActionListener listener)
          Removes ActionListener from the list of listeners.
 void removeChangeListener(javax.swing.event.ChangeListener listener)
          Removes ChangeListener from the list of listeners.
 void removeKeyListener(java.awt.event.KeyListener listener)
          Removes KeyListener from the list of listeners.
 void removeMonthChangeListener(MonthChangeListener listener)
          Removes MonthChangeListener from the list of listeners.
 void setAntiAliased(boolean antiAliased)
           
 void setDate(java.util.Date d)
          Sets the selected date.
 void setDateSelectionModel(DateSelectionModel dateSelectionModel)
           
 void setEnabled(boolean enabled)
          Enables or disables the component.
 void setFirstDayOfWeek(int firstDayOfWeek)
          Setter for property firstDayOfWeek.
 void setHeaderRenderer(HeaderRenderer headerRenderer)
          Setter for property headerRenderer.
 void setModel(DataModel model)
          Setter for property model.
 void setPrintMoon(boolean printMoon)
           
 void setRenderer(DayRenderer renderer)
          Setter for property renderer.
 void setSelectionMode(int mode)
          Sets the selection mode.
 void setShowToday(boolean show)
          Sets the Today button visibility.
 void setTodayCaption(java.lang.String caption)
          Sets the today button text.
 void setValue(java.lang.Object value)
          Setter for property value.
 void setValues(java.lang.Object[] values)
          Sets the selected Dates.
 void setWorkingDays(boolean[] workingDays)
          Setter for property workingDays.
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setFont, setForeground, 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, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, 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, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, 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
 

Constructor Detail

DatePanel

public DatePanel()
Default constructor. It creates a DatePanel with default values


DatePanel

public DatePanel(boolean showWeekNumbers)
Creates a DatePanel and let specify the showing of week numbers.

Parameters:
showWeekNumbers - true for showing week numbers
Method Detail

setDate

public void setDate(java.util.Date d)
Sets the selected date. If the date is in other month, the month is also changed.

Parameters:
d - new date

getDate

public java.util.Date getDate()
Returns the selected date.

Returns:
selected date

getRenderer

public DayRenderer getRenderer()
Getter for property renderer.

Returns:
Value of property renderer.

setRenderer

public void setRenderer(DayRenderer renderer)
Setter for property renderer.

Parameters:
renderer - New value of property renderer.

addChangeListener

public void addChangeListener(javax.swing.event.ChangeListener listener)
Registers ChangeListener to receive events.

Parameters:
listener - The listener to register.

removeChangeListener

public void removeChangeListener(javax.swing.event.ChangeListener listener)
Removes ChangeListener from the list of listeners.

Parameters:
listener - The listener to remove.

getModel

public DataModel getModel()
Getter for property model.

Returns:
Value of property model.

setModel

public void setModel(DataModel model)
Setter for property model.

Parameters:
model - New value of property model.

getFirstDayOfWeek

public int getFirstDayOfWeek()
Getter for property firstDayOfWeek.

Returns:
Value of property firstDayOfWeek.

setFirstDayOfWeek

public void setFirstDayOfWeek(int firstDayOfWeek)
Setter for property firstDayOfWeek.

Parameters:
firstDayOfWeek - New value of property firstDayOfWeek.

refresh

public void refresh()
Refreshes the showing of this component.


getHeaderRenderer

public HeaderRenderer getHeaderRenderer()
Getter for property headerRenderer.

Returns:
Value of property headerRenderer.

setHeaderRenderer

public void setHeaderRenderer(HeaderRenderer headerRenderer)
Setter for property headerRenderer.

Parameters:
headerRenderer - New value of property headerRenderer.

getValue

public java.lang.Object getValue()
Getter for property value.

Returns:
Value of property value.

setValue

public void setValue(java.lang.Object value)
Setter for property value.

Parameters:
value - New value of property value.

setValues

public void setValues(java.lang.Object[] values)
Sets the selected Dates.

Parameters:
values - values to set

getWorkingDays

public boolean[] getWorkingDays()
Getter for property workingDays.

Returns:
Value of property workingDays.

setWorkingDays

public void setWorkingDays(boolean[] workingDays)
Setter for property workingDays.

Parameters:
workingDays - New value of property workingDays.

addKeyListener

public void addKeyListener(java.awt.event.KeyListener listener)
Registers KeyListener to receive events.

Parameters:
listener - The listener to register.

removeKeyListener

public void removeKeyListener(java.awt.event.KeyListener listener)
Removes KeyListener from the list of listeners.

Parameters:
listener - The listener to remove.

setEnabled

public void setEnabled(boolean enabled)
Enables or disables the component.

Parameters:
enabled - true for enabling

isEnabled

public boolean isEnabled()
Getter for enabled property.

Returns:
true if it's enabled

getValues

public java.lang.Object[] getValues()
Returns a Object collection with the selected dates.

Returns:
selected dates or null

setSelectionMode

public void setSelectionMode(int mode)
Sets the selection mode.

Parameters:
mode - the new mode

getSelectionMode

public int getSelectionMode()
Returns the current selection mode.

Returns:
selection mode

addActionListener

public void addActionListener(java.awt.event.ActionListener listener)
Registers ActionListener to receive events.

Parameters:
listener - The listener to register.

removeActionListener

public void removeActionListener(java.awt.event.ActionListener listener)
Removes ActionListener from the list of listeners.

Parameters:
listener - The listener to remove.

addMonthChangeListener

public void addMonthChangeListener(MonthChangeListener listener)
Registers MonthChangeListener to receive events.

Parameters:
listener - The listener to register.

removeMonthChangeListener

public void removeMonthChangeListener(MonthChangeListener listener)
Removes MonthChangeListener from the list of listeners.

Parameters:
listener - The listener to remove.

getDateSelectionModel

public DateSelectionModel getDateSelectionModel()
Returns:
Returns the dateSelectionModel.

setDateSelectionModel

public void setDateSelectionModel(DateSelectionModel dateSelectionModel)
Parameters:
dateSelectionModel - The dateSelectionModel to set.

isAntiAliased

public boolean isAntiAliased()
Returns:
Returns the antiAliased.

setAntiAliased

public void setAntiAliased(boolean antiAliased)
Parameters:
antiAliased - The antiAliased to set.

isPrintMoon

public boolean isPrintMoon()
Returns:
Returns the printMoon.

setPrintMoon

public void setPrintMoon(boolean printMoon)
Parameters:
printMoon - The printMoon to set.

setShowToday

public void setShowToday(boolean show)
Sets the Today button visibility.

Parameters:
show -

getShowToday

public boolean getShowToday()
Returns the Today button visibility.

Returns:

setTodayCaption

public void setTodayCaption(java.lang.String caption)
Sets the today button text.

Parameters:
caption -

getTodayCaption

public java.lang.String getTodayCaption()
Returns the today button text.

Returns: