|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
org.formaria.swing.DateEdit
public class DateEdit
An edit control with a button that pops up a DateChooser. When the DateChooser is displayed it will show the date entered in the edit control. The date will also be updated when the chooser is closed. The component uses the SimpleDateFormat to specify how teh date is displayed
Copyright (c) Formaria Ltd., 2008, This software is licensed under the GNU Public License (GPL), please see license.txt for more details. If you make commercial use of this software you must purchase a commercial license from formaria.
$Revision: 1.19 $
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class javax.swing.JComponent |
|---|
javax.swing.JComponent.AccessibleJComponent |
| Nested classes/interfaces inherited from class java.awt.Container |
|---|
java.awt.Container.AccessibleAWTContainer |
| Nested classes/interfaces inherited from class java.awt.Component |
|---|
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
| Field Summary | |
|---|---|
protected javax.swing.JFormattedTextField |
dateEdit
|
protected java.text.SimpleDateFormat |
dateFormat
|
protected java.lang.String |
errorMessage
|
protected int |
errorStatus
|
protected java.text.SimpleDateFormat |
parseFormat
|
protected Button |
popupBtn
|
protected boolean |
showDayNames
|
protected StyleManager |
styleManager
|
protected java.lang.String[] |
styles
|
| 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 | |
|---|---|
DateEdit()
Create a new date edit |
|
| Method Summary | |
|---|---|
void |
actionPerformed(java.awt.event.ActionEvent e)
Respond to the button click by showing the date chooser control. |
void |
addFocusListener(java.awt.event.FocusListener fl)
Add a focus listener for the child edit controls |
java.util.Date |
getDate()
Gets the content of the date field as a date |
boolean |
getDayNames()
Get the style of the 3D elements including the navigation buttons |
java.lang.String |
getFormat()
Get the format of the edit field. |
java.lang.String |
getHeaderStyle()
Get the style of the header. |
java.lang.String |
getHighlightStyle()
Get the style of the highlighted date. |
java.lang.String |
getSelectedStyle()
Get the style of the selected date. |
java.lang.String |
getText()
Gets the content of the date field |
java.lang.String |
getThreeDStyle()
Get the style of the 3D elements including the navigation buttons |
java.lang.String |
getWeekendStyle()
Get the style of the weekend elements. |
void |
paintComponent(java.awt.Graphics g)
Render the text |
void |
removeFocusListener(java.awt.event.FocusListener fl)
Remove a focus listener for the child edit controls |
void |
resize()
Update the button size |
void |
setDate(java.util.Date d)
Sets the content of the date field as a date |
void |
setDateFormat(java.lang.String dateFormat)
Set the date format string |
void |
setDayNames(boolean show)
Set the style of the 3D elements including the navigation buttons |
void |
setEditStyle(java.lang.String styleName)
|
void |
setEnabled(boolean isEnabled)
Override the enabled state and update the child components enabled state |
void |
setErrorMessage(java.lang.String errorMsg)
Set the error message |
void |
setErrorStatus(int status)
Set the error status |
void |
setFormat(java.lang.String format)
Set the format of the edit field. |
void |
setHeaderStyle(java.lang.String styleName)
Set the style of the header. |
void |
setHighlightStyle(java.lang.String styleName)
Set the style of the highlighted date. |
void |
setParseFormat(java.lang.String format)
Set the format of the edit field data as it is parsed from the data model or when the setText method is invoked. |
void |
setSelectedStyle(java.lang.String styleName)
Set the style of the selected date. |
void |
setShowDayNames(boolean state)
Show or hide the day names |
void |
setStyle(java.lang.String newStyle)
set the style asociated with the normal elements |
void |
setText(java.lang.String s)
Sets the content of the edit field |
void |
setThreeDStyle(java.lang.String styleName)
Set the style of the 3D elements including the navigation buttons |
void |
setWeekendStyle(java.lang.String styleName)
Set the style of the weekend elements. |
| Methods inherited from class javax.swing.JComponent |
|---|
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, 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, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree |
| Methods inherited from class java.awt.Component |
|---|
action, add, addComponentListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, 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, processMouseWheelEvent, remove, removeComponentListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, 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 |
| Field Detail |
|---|
protected javax.swing.JFormattedTextField dateEdit
protected java.text.SimpleDateFormat dateFormat
protected java.text.SimpleDateFormat parseFormat
protected Button popupBtn
protected java.lang.String[] styles
protected boolean showDayNames
protected StyleManager styleManager
protected int errorStatus
protected java.lang.String errorMessage
| Constructor Detail |
|---|
public DateEdit()
| Method Detail |
|---|
public void paintComponent(java.awt.Graphics g)
paintComponent in class javax.swing.JComponentg - the graphcis contextpublic java.lang.String getText()
getText in interface TextHolderpublic java.util.Date getDate()
public void setDate(java.util.Date d)
public void setText(java.lang.String s)
setText in interface TextHolders - the new date stringpublic void setEditStyle(java.lang.String styleName)
public void setDateFormat(java.lang.String dateFormat)
dateFormat - public void setShowDayNames(boolean state)
state - true to show the day namespublic void setStyle(java.lang.String newStyle)
newStyle - the style namepublic void actionPerformed(java.awt.event.ActionEvent e)
actionPerformed in interface java.awt.event.ActionListenere - the action eventpublic void addFocusListener(java.awt.event.FocusListener fl)
addFocusListener in class java.awt.Componentfl - the focus listenerpublic void removeFocusListener(java.awt.event.FocusListener fl)
removeFocusListener in class java.awt.Componentfl - the focus listenerpublic void resize()
public void setWeekendStyle(java.lang.String styleName)
styleName - the style name for the weekend datespublic void setSelectedStyle(java.lang.String styleName)
styleName - the style name for the selected datepublic void setHighlightStyle(java.lang.String styleName)
styleName - the style name for the highlighted datepublic void setHeaderStyle(java.lang.String styleName)
styleName - the style name for the highlighted datepublic void setThreeDStyle(java.lang.String styleName)
styleName - the style name for the highlighted datepublic void setFormat(java.lang.String format)
format - the new date formatpublic void setParseFormat(java.lang.String format)
format - the incoming datepublic void setDayNames(boolean show)
styleName - the style name for the highlighted datepublic java.lang.String getWeekendStyle()
public java.lang.String getSelectedStyle()
public java.lang.String getHighlightStyle()
public java.lang.String getHeaderStyle()
public java.lang.String getThreeDStyle()
public java.lang.String getFormat()
public boolean getDayNames()
public void setEnabled(boolean isEnabled)
setEnabled in class javax.swing.JComponentisEnabled - true to enable the component(s)public void setErrorStatus(int status)
setErrorStatus in interface ErrorDisplaystatus - public void setErrorMessage(java.lang.String errorMsg)
setErrorMessage in interface ErrorDisplayerrorMsg - the message text
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||