fi.hut.tml.xsmiles.gui.components.swing
Class SwingCalendar

java.lang.Object
  extended byfi.hut.tml.xsmiles.gui.components.general.ComponentBase
      extended byfi.hut.tml.xsmiles.gui.components.swing.SwingStylableComponent
          extended byfi.hut.tml.xsmiles.gui.components.swing.SwingCalendar
All Implemented Interfaces:
java.awt.event.ActionListener, java.util.EventListener, java.awt.event.MouseListener, java.beans.PropertyChangeListener, XCalendar, XComponent

public class SwingCalendar
extends SwingStylableComponent
implements XCalendar, java.awt.event.ActionListener, java.beans.PropertyChangeListener, java.awt.event.MouseListener

A calender control for swing

Author:
Mikko Honkala

Nested Class Summary
 class SwingCalendar.Popup
           
 
Field Summary
protected  javax.swing.JButton button
           
protected  java.util.Calendar calendar
           
protected  JCalendarEx calendarComponent
           
protected  boolean enabled
          is this componen currently enabled (editable)
protected  XChangeListener fChangeListener
          this listens for date changes in the control
protected  javax.swing.JPanel panel
           
protected  SwingCalendar.Popup popup
           
protected  javax.swing.JTextField textcomponent
           
 
Fields inherited from class fi.hut.tml.xsmiles.gui.components.swing.SwingStylableComponent
HELPKEY
 
Fields inherited from class fi.hut.tml.xsmiles.gui.components.general.ComponentBase
content, currentFont, currentZoom, defaultBGColor, defaultFont, defaultSize, fInputMode, hintText, minSize, style
 
Constructor Summary
SwingCalendar()
          A iconed swing button
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent actionEvent)
           
 void addActionListener(java.awt.event.ActionListener al)
          At the moment ALL events are delegated through a simple actionListener
 void addChangeListener(XChangeListener l)
          add a change listener
 void closeCalendar()
          closes a popup component of the calender.
 java.awt.Component createContent()
          creates the content component
protected  void dateSelected(java.util.Calendar aCalendar, boolean notifyListener)
          the user has selected a date from the calendar
 java.awt.Component getAddableComponent()
           
protected  java.awt.Component getCalendarComponent()
           
 java.util.Calendar getDate()
           
 java.awt.Color getDefaultBackgroundColor()
          the default background color for this type of component null = transparent.
protected  java.awt.Frame getParentWindow(java.awt.Component comp)
           
 java.awt.Component getSizableComponent()
           
 java.awt.Component getStylableComponent()
           
 void init()
           
 void mouseClicked(java.awt.event.MouseEvent e)
          Invoked when the mouse has been clicked on a component.
 void mouseEntered(java.awt.event.MouseEvent e)
          Invoked when the mouse enters a component.
 void mouseExited(java.awt.event.MouseEvent e)
          Invoked when the mouse exits a component.
 void mousePressed(java.awt.event.MouseEvent e)
          Invoked when a mouse button has been pressed on a component.
 void mouseReleased(java.awt.event.MouseEvent e)
          Invoked when a mouse button has been released on a component.
protected  void openCalendar()
           
 void propertyChange(java.beans.PropertyChangeEvent evt)
           
 void removeActionListener(java.awt.event.ActionListener al)
           
protected  void setBorder(javax.swing.JComponent component)
           
 void setDate(java.util.Calendar d)
          ?@param s The text is set to s
 void setEnabled(boolean b)
           
 void setVisible(boolean v)
          Set this drawing area visible.
protected  java.lang.String toDisplayValue(java.util.Calendar c)
           
 
Methods inherited from class fi.hut.tml.xsmiles.gui.components.swing.SwingStylableComponent
addHelpListener, createHint, getFormatter, isCaption, removeHelpListener, setBackground, setHintRecursively, setHintText, sizeComponent
 
Methods inherited from class fi.hut.tml.xsmiles.gui.components.general.ComponentBase
addFocusListener, addMouseListener, getComponent, getDefaultSize, getEnabled, getHeight, getMinimumSize, getPreferredSize, getSize, getStyle, getWidth, getX, getY, removeFocusListener, removeMouseListener, setBounds, setDefaultSize, setFocus, setFont, setForeground, setInputMode, setStyle, setZoom, sizeComponent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface fi.hut.tml.xsmiles.gui.components.XComponent
addFocusListener, addHelpListener, addMouseListener, getComponent, getEnabled, getHeight, getSize, getStyle, getWidth, getX, getY, removeFocusListener, removeHelpListener, removeMouseListener, setBackground, setBounds, setFocus, setForeground, setHintText, setInputMode, setStyle, setZoom
 

Field Detail

textcomponent

protected javax.swing.JTextField textcomponent

panel

protected javax.swing.JPanel panel

button

protected javax.swing.JButton button

popup

protected SwingCalendar.Popup popup

calendarComponent

protected JCalendarEx calendarComponent

calendar

protected java.util.Calendar calendar

enabled

protected boolean enabled
is this componen currently enabled (editable)


fChangeListener

protected XChangeListener fChangeListener
this listens for date changes in the control

Constructor Detail

SwingCalendar

public SwingCalendar()
A iconed swing button

Method Detail

setEnabled

public void setEnabled(boolean b)
Specified by:
setEnabled in interface XComponent
Overrides:
setEnabled in class ComponentBase
Parameters:
b - Active or not active

setVisible

public void setVisible(boolean v)
Set this drawing area visible.

Specified by:
setVisible in interface XComponent
Overrides:
setVisible in class ComponentBase
Parameters:
v - true=visible, false=invisible

init

public void init()
Overrides:
init in class SwingStylableComponent

getDefaultBackgroundColor

public java.awt.Color getDefaultBackgroundColor()
Description copied from class: ComponentBase
the default background color for this type of component null = transparent.

Overrides:
getDefaultBackgroundColor in class ComponentBase

createContent

public java.awt.Component createContent()
creates the content component


getDate

public java.util.Calendar getDate()
Specified by:
getDate in interface XCalendar

setDate

public void setDate(java.util.Calendar d)
?@param s The text is set to s

Specified by:
setDate in interface XCalendar

addActionListener

public void addActionListener(java.awt.event.ActionListener al)
Description copied from interface: XComponent
At the moment ALL events are delegated through a simple actionListener

Specified by:
addActionListener in interface XComponent
Overrides:
addActionListener in class ComponentBase

removeActionListener

public void removeActionListener(java.awt.event.ActionListener al)
Specified by:
removeActionListener in interface XComponent
Overrides:
removeActionListener in class ComponentBase

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent actionEvent)
Specified by:
actionPerformed in interface java.awt.event.ActionListener

openCalendar

protected void openCalendar()

getParentWindow

protected java.awt.Frame getParentWindow(java.awt.Component comp)

setBorder

protected void setBorder(javax.swing.JComponent component)

closeCalendar

public void closeCalendar()
Description copied from interface: XCalendar
closes a popup component of the calender. This is sort of a hack, because I could not use swing JPopup, since month popup closed it

Specified by:
closeCalendar in interface XCalendar

getCalendarComponent

protected java.awt.Component getCalendarComponent()

dateSelected

protected void dateSelected(java.util.Calendar aCalendar,
                            boolean notifyListener)
the user has selected a date from the calendar


toDisplayValue

protected java.lang.String toDisplayValue(java.util.Calendar c)

propertyChange

public void propertyChange(java.beans.PropertyChangeEvent evt)
Specified by:
propertyChange in interface java.beans.PropertyChangeListener

mousePressed

public void mousePressed(java.awt.event.MouseEvent e)
Invoked when a mouse button has been pressed on a component.

Specified by:
mousePressed in interface java.awt.event.MouseListener

mouseEntered

public void mouseEntered(java.awt.event.MouseEvent e)
Invoked when the mouse enters a component.

Specified by:
mouseEntered in interface java.awt.event.MouseListener

mouseExited

public void mouseExited(java.awt.event.MouseEvent e)
Invoked when the mouse exits a component.

Specified by:
mouseExited in interface java.awt.event.MouseListener

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent e)
Invoked when a mouse button has been released on a component.

Specified by:
mouseReleased in interface java.awt.event.MouseListener

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent e)
Invoked when the mouse has been clicked on a component.

Specified by:
mouseClicked in interface java.awt.event.MouseListener

addChangeListener

public void addChangeListener(XChangeListener l)
add a change listener

Specified by:
addChangeListener in interface XCalendar

getAddableComponent

public java.awt.Component getAddableComponent()
Overrides:
getAddableComponent in class ComponentBase

getSizableComponent

public java.awt.Component getSizableComponent()
Overrides:
getSizableComponent in class ComponentBase

getStylableComponent

public java.awt.Component getStylableComponent()
Overrides:
getStylableComponent in class ComponentBase


X-Smiles 1.2