net.sf.nachocalendar.components
Class MonthPanel

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

public class MonthPanel
extends javax.swing.JComponent

Class for displaying a month. It allows to select a day, can be combined with another month.

Author:
Ignacio Merani
See Also:
Serialized Form

Nested Class Summary
 
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
MonthPanel()
          Default constructor, it uses default values for everything.
MonthPanel(boolean showWeekNumber)
          Full constructor for MonthPanel.
 
Method Summary
protected  void fireChangeEvent(javax.swing.event.ChangeEvent e)
          Event fired every date selection change.
 java.util.Date getDay()
          Returns the currently selected day.
protected  DayPanel[] getDaypanels()
           
static boolean[] getDefaultWorking()
           
 int getFirstDayOfWeek()
          Getter for property firstDayOfWeek.
 HeaderRenderer getHeaderRenderer()
          Getter for property headerRenderer.
 java.util.Date getMaxDate()
           
 java.util.Date getMinDate()
           
 int getMinimalDaysInFirstWeek()
           
 DataModel getModel()
          Getter for property model.
 java.util.Date getMonth()
          Returns the currently selected month.
 DayRenderer getRenderer()
          Getter for property renderer.
 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 setAntiAliased(boolean antiAliased)
           
 void setDay(java.util.Date d)
          Sets the current selected day.
protected  void setDaypanels(DayPanel[] daypanels)
           
 void setEnabled(boolean b)
          Enables or disables the component
 void setFirstDayOfWeek(int firstDayOfWeek)
          Setter for property firstDayOfWeek.
 void setHeaderRenderer(HeaderRenderer headerRenderer)
          Setter for property headerRenderer.
 void setMinimalDaysInFirstWeek(int number)
          Specifies how many days should the first week of the year contain
If not specified, i.e.
 void setModel(DataModel model)
          Setter for property model.
 void setMonth(java.util.Date d)
          Sets the current showing month.
 void setPrintMoon(boolean printMoon)
           
 void setRenderer(DayRenderer renderer)
          Setter for property renderer.
 void setWorkingdays(boolean[] workingdays)
          Setter for property workingdays.
 void showTitle(boolean show)
          Sets the showing of the title.
 
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, getAccessibleContext, 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, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, 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, updateUI
 
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, addKeyListener, 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, removeKeyListener, 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

MonthPanel

public MonthPanel()
Default constructor, it uses default values for everything.


MonthPanel

public MonthPanel(boolean showWeekNumber)
Full constructor for MonthPanel. Can be especifyed workingdays, the showing of week numbers and can be passed a shared buttongroup for using with other MonthPanels

Parameters:
showWeekNumber - true for showing week numbers
Method Detail

setDay

public void setDay(java.util.Date d)
Sets the current selected day. If the component is showing another month, the showing month is changed

Parameters:
d - new Date

setMonth

public void setMonth(java.util.Date d)
Sets the current showing month.

Parameters:
d - new Date to get the month

getMonth

public java.util.Date getMonth()
Returns the currently selected month.

Returns:
selected month

showTitle

public void showTitle(boolean show)
Sets the showing of the title.

Parameters:
show - true for showing the title

refresh

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


getDay

public java.util.Date getDay()
Returns the currently selected day.

Returns:
selected Date

fireChangeEvent

protected void fireChangeEvent(javax.swing.event.ChangeEvent e)
Event fired every date selection change.

Parameters:
e - event fired

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.

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.

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.

setMinimalDaysInFirstWeek

public void setMinimalDaysInFirstWeek(int number)
Specifies how many days should the first week of the year contain
If not specified, i.e. 0, then no changes from the defaults are done

Parameters:
number -

getMinimalDaysInFirstWeek

public int getMinimalDaysInFirstWeek()
Returns:
how many weekdays does the first week of the year have

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.

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.

getDefaultWorking

public static boolean[] getDefaultWorking()
Returns:
Returns the defaultWorking.

setEnabled

public void setEnabled(boolean b)
Enables or disables the component

Parameters:
b - true for enabling

isEnabled

public boolean isEnabled()
Getter for enabled property

Returns:
true if it's enabled

isAntiAliased

public boolean isAntiAliased()
Returns:
Returns the antiAliased.

setAntiAliased

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

getDaypanels

protected DayPanel[] getDaypanels()
Returns:
Returns the daypanels.

setDaypanels

protected void setDaypanels(DayPanel[] daypanels)
Parameters:
daypanels - The daypanels to set.

getMinDate

public java.util.Date getMinDate()

getMaxDate

public java.util.Date getMaxDate()

isPrintMoon

public boolean isPrintMoon()
Returns:
Returns the printMoon.

setPrintMoon

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