cc.gammasoft.date
Class DatePicker

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--cc.gammasoft.date.DatePicker
All Implemented Interfaces:
javax.swing.event.ChangeListener, java.util.EventListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public class DatePicker
extends javax.swing.JComponent
implements javax.swing.event.ChangeListener

DatePicker

Author:
levent Tinaz
See Also:
Serialized Form

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
DatePicker()
          creates a new Datepicker.
DatePicker(java.util.Calendar calendar)
          creates a new Datepicker.
DatePicker(java.text.SimpleDateFormat dateFormat)
          creates a new Datepicker.
DatePicker(java.text.SimpleDateFormat dateFormat, java.util.Calendar calendar)
          creates a new Datepicker.
 
Method Summary
 void addChangeListener(javax.swing.event.ChangeListener listener)
          Adds the specified change listener to receive state change events from this model.
 javax.swing.table.TableCellEditor getCellEditor()
          default cell editor for jtable
 javax.swing.table.TableCellRenderer getCellRenderer()
          gets default date picker cell renderer for jtables
 java.text.SimpleDateFormat getDateFormat()
          returns the date format which is being used by the view.
 cc.gammasoft.date.DateModel getDateModel()
          returns the DateModel
 javax.swing.JFormattedTextField getEditor()
          returns the editor of the picker which is JFormattedTextField
 java.awt.Color getEditorBackground()
          gets Editor background color
 java.awt.Font getEditorFont()
          gets Editor font
 java.awt.Color getEditorForeground()
          gets Editor foreground color
 cc.gammasoft.date.MonthView getMonthView()
          gets the MonthView instance of the picker.
 cc.gammasoft.date.PickerButton getPopButton()
          returns the popup button
 javax.swing.JPopupMenu getPopup()
          returns the popup
 java.lang.String getSQLDateValue()
          process a getSQLDateValue()
 java.lang.String getTimestampValue()
          process a getTimeStampValue()
 java.util.Calendar getValue()
          gets model's current value
 void removeChangeListener(javax.swing.event.ChangeListener listener)
          Removes the specified change listener so that it no longer receives change listener events from this model.
 void setDateFormat(java.text.SimpleDateFormat dateFormat)
          sets the pickers date format
 void setDateModel(cc.gammasoft.date.DateModel dateModel)
          sets DateModel
 void setEditorBackground(java.awt.Color color)
          sets editor background color.
 void setEditorFont(java.awt.Font font)
          sets editor font.
 void setEditorForeground(java.awt.Color color)
          sets editor foreground color.
 void setFont(java.awt.Font monthViewFont)
           
 void setForeground(java.awt.Color foreground)
          sets MonthView foreground color
 void setMonthNames(java.text.SimpleDateFormat dateFormat, int type)
          This method sets the month names.
 void setPopupButton(cc.gammasoft.date.PickerButton button)
          sets the picker's popup button
 void setSQLDate(java.lang.String SQLDate)
          process a setSQLDate(String SQLDate)
 void setTimestamp(java.lang.String timeStamp)
          process a setValue(String SQLDateTime)
 void setValue(java.util.Calendar calendar)
          sets current value
 void setValue(java.lang.String SQLDate)
          sets current value
 void setWeekDayNames(java.text.SimpleDateFormat dateFormat, int weekDayType)
          This method sets weekday names.
 void stateChanged(javax.swing.event.ChangeEvent e)
          state change event
 
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, setEnabled, 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, isEnabled, 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

DatePicker

public DatePicker()
creates a new Datepicker. sets the model's calendar with todays date,and uses the local format.


DatePicker

public DatePicker(java.text.SimpleDateFormat dateFormat)
creates a new Datepicker. sets the model's calendar with todays date


DatePicker

public DatePicker(java.util.Calendar calendar)
creates a new Datepicker. uses the local format.


DatePicker

public DatePicker(java.text.SimpleDateFormat dateFormat,
                  java.util.Calendar calendar)
creates a new Datepicker.

Method Detail

setDateFormat

public void setDateFormat(java.text.SimpleDateFormat dateFormat)
sets the pickers date format


getDateFormat

public java.text.SimpleDateFormat getDateFormat()
returns the date format which is being used by the view.

Returns:
SimpleDateFormat

setDateModel

public void setDateModel(cc.gammasoft.date.DateModel dateModel)
sets DateModel


getDateModel

public cc.gammasoft.date.DateModel getDateModel()
returns the DateModel

Returns:
DateModel

getEditor

public javax.swing.JFormattedTextField getEditor()
returns the editor of the picker which is JFormattedTextField

Returns:
JFormattedTextField

getPopup

public javax.swing.JPopupMenu getPopup()
returns the popup

Returns:
JPopupMenu

getPopButton

public cc.gammasoft.date.PickerButton getPopButton()
returns the popup button

Returns:
PickerButton

setPopupButton

public void setPopupButton(cc.gammasoft.date.PickerButton button)
sets the picker's popup button


stateChanged

public void stateChanged(javax.swing.event.ChangeEvent e)
state change event

Specified by:
stateChanged in interface javax.swing.event.ChangeListener

addChangeListener

public void addChangeListener(javax.swing.event.ChangeListener listener)
Adds the specified change listener to receive state change events from this model.


removeChangeListener

public void removeChangeListener(javax.swing.event.ChangeListener listener)
Removes the specified change listener so that it no longer receives change listener events from this model.

Parameters:
listener - the change listener.

getValue

public java.util.Calendar getValue()
gets model's current value

Returns:
Calendar calendar.

setValue

public void setValue(java.util.Calendar calendar)
sets current value


setValue

public void setValue(java.lang.String SQLDate)
sets current value


setSQLDate

public void setSQLDate(java.lang.String SQLDate)
process a setSQLDate(String SQLDate)


setTimestamp

public void setTimestamp(java.lang.String timeStamp)
process a setValue(String SQLDateTime)


getSQLDateValue

public java.lang.String getSQLDateValue()
process a getSQLDateValue()


getTimestampValue

public java.lang.String getTimestampValue()
process a getTimeStampValue()


setMonthNames

public void setMonthNames(java.text.SimpleDateFormat dateFormat,
                          int type)
This method sets the month names. It takes two parameters SimpleDateFormat and type. if type is SHORT_MONTH_NAME lists shortnames otherwise long names.


setWeekDayNames

public void setWeekDayNames(java.text.SimpleDateFormat dateFormat,
                            int weekDayType)
This method sets weekday names. If the type is SHORT_WEEKDAY_NAME then it displays shortnames otherwise long names.


getCellRenderer

public javax.swing.table.TableCellRenderer getCellRenderer()
gets default date picker cell renderer for jtables

Returns:
TableCellRenderer

getCellEditor

public javax.swing.table.TableCellEditor getCellEditor()
default cell editor for jtable

Returns:
TableCellEditor

setFont

public void setFont(java.awt.Font monthViewFont)
Overrides:
setFont in class javax.swing.JComponent

setForeground

public void setForeground(java.awt.Color foreground)
sets MonthView foreground color

Overrides:
setForeground in class javax.swing.JComponent

getMonthView

public cc.gammasoft.date.MonthView getMonthView()
gets the MonthView instance of the picker.

Returns:
MonthView

setEditorFont

public void setEditorFont(java.awt.Font font)
sets editor font. All properties of editor can be reached by calling getEditor(); setEditorFont,setEditorForeground,setEditorBackground are implemented for this class users convenience.


getEditorFont

public java.awt.Font getEditorFont()
gets Editor font

Returns:
Font

setEditorForeground

public void setEditorForeground(java.awt.Color color)
sets editor foreground color. All properties of editor can be reached by calling getEditor(); setEditorFont,setEditorForeground,setEditorBackground are implemented for this class users convenience.


getEditorForeground

public java.awt.Color getEditorForeground()
gets Editor foreground color

Returns:
Color

setEditorBackground

public void setEditorBackground(java.awt.Color color)
sets editor background color. All properties of editor can be reached by calling getEditor(); setEditorFont,setEditorForeground,setEditorBackground are implemented for this class users convenience.


getEditorBackground

public java.awt.Color getEditorBackground()
gets Editor background color

Returns:
Color


Gammasoft Inc All Rights Reserved.