net.sf.nachocalendar.components
Class DayPanel

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

public class DayPanel
extends javax.swing.JComponent

Component used to display a day. It has to had a renderer to paint itself

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
DayPanel(DayRenderer renderer, int index)
          Creates a new instance of DayPanel.
 
Method Summary
 java.lang.Object getData()
          Returns the current data.
 java.util.Date getDate()
          Return the displaying date.
 int getIndex()
          Getter for property index.
 DayRenderer getRenderer()
          Getter for property renderer.
 boolean isAntiAliased()
           
 boolean isComponentEnabled()
          Getter for property componentEnabled.
 boolean isEnabled()
          Getter for property enabled.
 boolean isPrintMoon()
           
 boolean isSelected()
          Getter for property selected.
 boolean isWorking()
          Getter for property working.
 void paint(java.awt.Graphics g)
          Invoked by Swing to draw components.
 void setAntiAliased(boolean antiAliased)
           
 void setComponentEnabled(boolean componentEnabled)
          Setter for property componentEnabled.
 void setData(java.lang.Object d)
          Sets the current data.
 void setDate(java.util.Date d)
          Sets the displaying date.
 void setEnabled(boolean enabled)
          Setter for property enabled.
 void setIndex(int index)
          Setter for property index.
 void setPrintMoon(boolean printMoon)
           
 void setRenderer(DayRenderer renderer)
          Setter for property renderer.
 void setSelected(boolean selected)
          Setter for property selected.
 void setWorking(boolean working)
          Setter for property working.
 
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, 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

DayPanel

public DayPanel(DayRenderer renderer,
                int index)
Creates a new instance of DayPanel.

Parameters:
renderer - renderer used to paint
Method Detail

setDate

public void setDate(java.util.Date d)
Sets the displaying date.

Parameters:
d - new date

getDate

public java.util.Date getDate()
Return the displaying date.

Returns:
the Date

setData

public void setData(java.lang.Object d)
Sets the current data.

Parameters:
d - the data

getData

public java.lang.Object getData()
Returns the current data.

Returns:
current data

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.

isWorking

public boolean isWorking()
Getter for property working.

Returns:
Value of property working.

setWorking

public void setWorking(boolean working)
Setter for property working.

Parameters:
working - New value of property working.

paint

public void paint(java.awt.Graphics g)
Invoked by Swing to draw components. Applications should not invoke paint directly, but should instead use the repaint method to schedule the component for redrawing.

This method actually delegates the work of painting to three protected methods: paintComponent, paintBorder, and paintChildren. They're called in the order listed to ensure that children appear on top of component itself. Generally speaking, the component and its children should not paint in the insets area allocated to the border. Subclasses can just override this method, as always. A subclass that just wants to specialize the UI (look and feel) delegate's paint method should just override paintComponent.

Parameters:
g - the Graphics context in which to paint

isSelected

public boolean isSelected()
Getter for property selected.

Returns:
Value of property selected.

setSelected

public void setSelected(boolean selected)
Setter for property selected.

Parameters:
selected - New value of property selected.

getIndex

public int getIndex()
Getter for property index.

Returns:
Value of property index.

setIndex

public void setIndex(int index)
Setter for property index.

Parameters:
index - New value of property index.

isComponentEnabled

public boolean isComponentEnabled()
Getter for property componentEnabled.

Returns:
Value of property componentEnabled.

setComponentEnabled

public void setComponentEnabled(boolean componentEnabled)
Setter for property componentEnabled.

Parameters:
componentEnabled - New value of property componentEnabled.

isEnabled

public boolean isEnabled()
Getter for property enabled.

Returns:
Value of property enabled.

setEnabled

public void setEnabled(boolean enabled)
Setter for property enabled.

Parameters:
enabled - New value of property enabled.

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.