Java Doc for CalendarBase.java in  » IDE-Netbeans » visualweb.api.designer » com » sun » rave » web » ui » component » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » IDE Netbeans » visualweb.api.designer » com.sun.rave.web.ui.component 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


com.sun.rave.web.ui.component.HiddenFieldBase
   com.sun.rave.web.ui.component.HiddenField
      com.sun.rave.web.ui.component.FieldBase
         com.sun.rave.web.ui.component.Field
            com.sun.rave.web.ui.component.CalendarBase

All known Subclasses:   com.sun.rave.web.ui.component.Calendar,
CalendarBase
abstract public class CalendarBase extends com.sun.rave.web.ui.component.Field (Code)

Use the ui:calendar when the user needs to select a date. The calendar component displays a text field that expects a date as input, together with an icon that when clicked displays a small calendar. The user can either type directly into the textfield or select a date from the calendar display.

HTML Elements and Layout

The component renders several elements: an optional <label>, an <input type="text"> and an <img> element for the icon. They are laid out inside a HTML <table>.

The pop-up calendar is a complex component also laid out using a HTML <table>. It has child components corresponding to <ui:dropDown> and <ui:iconHyperlink> (please see these for details) and anchors <a> to represent the dates and the "close" button.

Configuring the ui:calendar tag

Use the selectedDate attribute to associate the component with a model object that represents the current value, by setting the attribute's value to an EL expression that corresponds to a property of a backing bean.

By default, the component accepts dates between the current date and four years out. The years shown in the popup calendar reflect this range. If a date outside of the range is entered into the textfield, the component indicates a validation error. To specify a different range of date, use the minDate and maxDate attributes.

To optionally specify a label for the component, use the label attribute, or specify a label facet.

Facets

  • label: use this facet to specify a custom component for the label.
  • readOnly: use this facet to specify a custom component for displaying the value of this component when it is marked as readonly. The default is a ui:staticText.

Client-side JavaScript functions

In all the functions below, <id> should be the generated id of the TextField component.

[JSOBJECT_NAME]_setDisabled(<id>, <disabled>) Enable/disable the field. Set <disabled> to true to disable the component, or false to enable it.
component_setVisible(<id>) Hide or show this component.

Examples

Example 1: Basic Popup Calendar

The component gets the options from a managed bean called CalendarBean. The value of the component selectedDate is bound to a property of the managed bean. A label for the component as a whole (label) is shown next to the component.

This example shows how to create a simple calendar.

<ui:calendar id="startDate" 
 selectedDate="#{CalendarBean.startDate}"
 label="Start Date: " />

Code for the managed bean:

CalendarBean.java

import java.io.Serializable;
import java.util.Date;
import java.util.Calendar;
import javax.faces.event.ValueChangeEvent;


public class CalendarBean {
   
    public CalendarBean() {
    }
   
    private Date startDate = null;

    public Date getStartDate() {

        return this.startDate;
    }


    public void setStartDate(Date startDate) {

        this.startDate = startDate;
    }
}

The selectAll attribute indicates that the Add All and Remove All buttons should be shown. A label for the component as a whole (label) is shown next to the component (labelOnTop is false). Labels have been specified for the list of available items and for the list of selected items. The sorted attribute indicates that the options on the list will be shown in alphabetical order.

Example 2: DateFormat Pattern and Range of Dates configured

The component gets the options from a managed bean called TravelBean. The value of the component selectedDate is bound to a property travelDateof the managed bean. A label for the component as a whole (label) is shown next to the component; the label is retrieved from a message bundle.

The component has been configured to use a pattern for date representation consisting of four digits for the year, two for the month, and two for the day, separated by dashes. This pattern, set using the dateFormatPattern attribute will be used regardless of locale. With this date format pattern, the default help string will be "YYYY-MM-DD", which is suitable for English, but not for other locales where other words are used, so a different message is retrieved for each locale (dateFormatPattern).

The component is also configured to restrict the range of dates that are valid, so that the first valid date is the day after the day the component is viewed, and the last valid date is six months from that date.

 <ui:calendar id="travelDate" 
 selectedDate="#{TravelBean.travelDate}"
 label="#{msgs.travelDate}"
 dateFormatPattern="yyyy-MM-dd"
 dateFormatPatternHelp="#{msgs.dateFormatPattern}"
 minDate="#{TravelBean.tomorrowsDate}"
 maxDate="#{TravelBean.sixMonthsFromNow}" />
 

Auto-generated component class. Do NOT modify; all changes will be lost!




Constructor Summary
public  CalendarBase()
    

Method Summary
public  StringgetDateFormatPattern()
    

The date format pattern to use (i.e.

public  StringgetDateFormatPatternHelp()
    

A message below the textfield for the date, indicating the string format to use when entering a date as text into the textfield.

If the dateFormatPattern attribute has not been set, there is no need to set this attribute, as an appropriate locale-specific help string will be shown.

However, if the default dateFormatPattern has been overridden, then you may need to override this attribute also.

public  StringgetFamily()
    

Return the identifier of the component family to which this component belongs.

public  java.util.DategetMaxDate()
    

A java.util.Date object representing the last selectable day.

public  java.util.DategetMinDate()
    

A java.util.Date object representing the first selectable day.

public  java.util.DategetSelectedDate()
    
public  java.util.TimeZonegetTimeZone()
    

The java.util.TimeZone used with this component.

public  ValueBindinggetValueBinding(String name)
    
public  voidrestoreState(FacesContext _context, Object _state)
    
public  ObjectsaveState(FacesContext _context)
    
public  voidsetDateFormatPattern(String dateFormatPattern)
    

The date format pattern to use (i.e.

public  voidsetDateFormatPatternHelp(String dateFormatPatternHelp)
    

A message below the textfield for the date, indicating the string format to use when entering a date as text into the textfield.

If the dateFormatPattern attribute has not been set, there is no need to set this attribute, as an appropriate locale-specific help string will be shown.

However, if the default dateFormatPattern has been overridden, then you may need to override this attribute also.

public  voidsetMaxDate(java.util.Date maxDate)
    

A java.util.Date object representing the last selectable day.

public  voidsetMinDate(java.util.Date minDate)
    

A java.util.Date object representing the first selectable day.

public  voidsetSelectedDate(java.util.Date selectedDate)
    
public  voidsetTimeZone(java.util.TimeZone timeZone)
    

The java.util.TimeZone used with this component.

public  voidsetValueBinding(String name, ValueBinding binding)
    


Constructor Detail
CalendarBase
public CalendarBase()(Code)

Construct a new CalendarBase.





Method Detail
getDateFormatPattern
public String getDateFormatPattern()(Code)

The date format pattern to use (i.e. yyyy-MM-dd). The component uses an instance of java.text.SimpleDateFormat and you may specify a pattern to be used by this component, with the following restriction: the format pattern must include yyyy (not yy), MM, and dd; and no other parts of time may be displayed. If a pattern is not specified, a locale-specific default is used.

If you change the date format pattern, you may also need to change the dateFormatPatternHelp attribute. See the documentation for that attribute.




getDateFormatPatternHelp
public String getDateFormatPatternHelp()(Code)

A message below the textfield for the date, indicating the string format to use when entering a date as text into the textfield.

If the dateFormatPattern attribute has not been set, there is no need to set this attribute, as an appropriate locale-specific help string will be shown.

However, if the default dateFormatPattern has been overridden, then you may need to override this attribute also. The default behavior of the component is to show the pattern but capitalize it, so for example, if the value of dateFormatPattern is yyyy-MM-dd, then the default help text will be YYYY-MM-DD. This is likely to be inadequate for languages other than English, in which you may use this attribute to provide descriptions that are appropriate for each locale.




getFamily
public String getFamily()(Code)

Return the identifier of the component family to which this component belongs. This identifier, in conjunction with the value of the rendererType property, may be used to select the appropriate Renderer for this component instance.




getMaxDate
public java.util.Date getMaxDate()(Code)

A java.util.Date object representing the last selectable day. The default value is four years after the minDate (which is evaluated first).

The value of this attribute is reflected in the years that are available for selection in the month display. In future releases of this component, web application users will also not be able to view months after this date, or select days that follow this date. At present such dates can be selected, but will not be validated when the form is submitted.




getMinDate
public java.util.Date getMinDate()(Code)

A java.util.Date object representing the first selectable day. The default value is today's date.

The value of this attribute is reflected in the years that are available for selection in the month display. In future releases of this component, web application users will also not be able to view months before this date, or select days that precede this date. At present such dates can be selected, but will not be validated when the form is submitted.




getSelectedDate
public java.util.Date getSelectedDate()(Code)

A java.util.Date object representing the currently selected calendar date.




getTimeZone
public java.util.TimeZone getTimeZone()(Code)

The java.util.TimeZone used with this component. Unless set, the default TimeZone for the locale in javax.faces.component.UIViewRoot is used.




getValueBinding
public ValueBinding getValueBinding(String name)(Code)

Return the ValueBinding stored for the specified name (if any), respecting any property aliases.


Parameters:
  name - Name of value binding to retrieve



restoreState
public void restoreState(FacesContext _context, Object _state)(Code)

Restore the state of this component.




saveState
public Object saveState(FacesContext _context)(Code)

Save the state of this component.




setDateFormatPattern
public void setDateFormatPattern(String dateFormatPattern)(Code)

The date format pattern to use (i.e. yyyy-MM-dd). The component uses an instance of java.text.SimpleDateFormat and you may specify a pattern to be used by this component, with the following restriction: the format pattern must include yyyy (not yy), MM, and dd; and no other parts of time may be displayed. If a pattern is not specified, a locale-specific default is used.

If you change the date format pattern, you may also need to change the dateFormatPatternHelp attribute. See the documentation for that attribute.


See Also:   CalendarBase.getDateFormatPattern()



setDateFormatPatternHelp
public void setDateFormatPatternHelp(String dateFormatPatternHelp)(Code)

A message below the textfield for the date, indicating the string format to use when entering a date as text into the textfield.

If the dateFormatPattern attribute has not been set, there is no need to set this attribute, as an appropriate locale-specific help string will be shown.

However, if the default dateFormatPattern has been overridden, then you may need to override this attribute also. The default behavior of the component is to show the pattern but capitalize it, so for example, if the value of dateFormatPattern is yyyy-MM-dd, then the default help text will be YYYY-MM-DD. This is likely to be inadequate for languages other than English, in which you may use this attribute to provide descriptions that are appropriate for each locale.


See Also:   CalendarBase.getDateFormatPatternHelp()



setMaxDate
public void setMaxDate(java.util.Date maxDate)(Code)

A java.util.Date object representing the last selectable day. The default value is four years after the minDate (which is evaluated first).

The value of this attribute is reflected in the years that are available for selection in the month display. In future releases of this component, web application users will also not be able to view months after this date, or select days that follow this date. At present such dates can be selected, but will not be validated when the form is submitted.


See Also:   CalendarBase.getMaxDate()



setMinDate
public void setMinDate(java.util.Date minDate)(Code)

A java.util.Date object representing the first selectable day. The default value is today's date.

The value of this attribute is reflected in the years that are available for selection in the month display. In future releases of this component, web application users will also not be able to view months before this date, or select days that precede this date. At present such dates can be selected, but will not be validated when the form is submitted.


See Also:   CalendarBase.getMinDate()



setSelectedDate
public void setSelectedDate(java.util.Date selectedDate)(Code)

A java.util.Date object representing the currently selected calendar date.


See Also:   CalendarBase.getSelectedDate()



setTimeZone
public void setTimeZone(java.util.TimeZone timeZone)(Code)

The java.util.TimeZone used with this component. Unless set, the default TimeZone for the locale in javax.faces.component.UIViewRoot is used.


See Also:   CalendarBase.getTimeZone()



setValueBinding
public void setValueBinding(String name, ValueBinding binding)(Code)

Set the ValueBinding stored for the specified name (if any), respecting any property aliases.


Parameters:
  name - Name of value binding to set
Parameters:
  binding - ValueBinding to set, or null to remove



Fields inherited from com.sun.rave.web.ui.component.Field
final public static String INPUT_ID(Code)(Java Doc)
final public static String LABEL_FACET(Code)(Java Doc)
final public static String LABEL_ID(Code)(Java Doc)
final public static String READONLY_FACET(Code)(Java Doc)
final public static String READONLY_ID(Code)(Java Doc)

Methods inherited from com.sun.rave.web.ui.component.Field
public int getColumns()(Code)(Java Doc)
public UIComponent getLabelComponent(FacesContext context, String style)(Code)(Java Doc)
public String getPrimaryElementID(FacesContext context)(Code)(Java Doc)
public UIComponent getReadOnlyComponent(FacesContext context)(Code)(Java Doc)
protected void log(String s)(Code)(Java Doc)
public void setText(Object text)(Code)(Java Doc)

Methods inherited from com.sun.rave.web.ui.component.FieldBase
public int getColumns()(Code)(Java Doc)
public String getFamily()(Code)(Java Doc)
public String getLabel()(Code)(Java Doc)
public int getLabelLevel()(Code)(Java Doc)
public int getMaxLength()(Code)(Java Doc)
public String getOnBlur()(Code)(Java Doc)
public String getOnChange()(Code)(Java Doc)
public String getOnClick()(Code)(Java Doc)
public String getOnDblClick()(Code)(Java Doc)
public String getOnFocus()(Code)(Java Doc)
public String getOnKeyDown()(Code)(Java Doc)
public String getOnKeyPress()(Code)(Java Doc)
public String getOnKeyUp()(Code)(Java Doc)
public String getOnMouseDown()(Code)(Java Doc)
public String getOnMouseMove()(Code)(Java Doc)
public String getOnMouseOut()(Code)(Java Doc)
public String getOnMouseOver()(Code)(Java Doc)
public String getOnMouseUp()(Code)(Java Doc)
public String getOnSelect()(Code)(Java Doc)
public String getStyle()(Code)(Java Doc)
public String getStyleClass()(Code)(Java Doc)
public int getTabIndex()(Code)(Java Doc)
public Object getText()(Code)(Java Doc)
public String getToolTip()(Code)(Java Doc)
public ValueBinding getValueBinding(String name)(Code)(Java Doc)
public boolean isDisabled()(Code)(Java Doc)
public boolean isReadOnly()(Code)(Java Doc)
public boolean isTrim()(Code)(Java Doc)
public boolean isVisible()(Code)(Java Doc)
public void restoreState(FacesContext _context, Object _state)(Code)(Java Doc)
public Object saveState(FacesContext _context)(Code)(Java Doc)
public void setColumns(int columns)(Code)(Java Doc)
public void setDisabled(boolean disabled)(Code)(Java Doc)
public void setLabel(String label)(Code)(Java Doc)
public void setLabelLevel(int labelLevel)(Code)(Java Doc)
public void setMaxLength(int maxLength)(Code)(Java Doc)
public void setOnBlur(String onBlur)(Code)(Java Doc)
public void setOnChange(String onChange)(Code)(Java Doc)
public void setOnClick(String onClick)(Code)(Java Doc)
public void setOnDblClick(String onDblClick)(Code)(Java Doc)
public void setOnFocus(String onFocus)(Code)(Java Doc)
public void setOnKeyDown(String onKeyDown)(Code)(Java Doc)
public void setOnKeyPress(String onKeyPress)(Code)(Java Doc)
public void setOnKeyUp(String onKeyUp)(Code)(Java Doc)
public void setOnMouseDown(String onMouseDown)(Code)(Java Doc)
public void setOnMouseMove(String onMouseMove)(Code)(Java Doc)
public void setOnMouseOut(String onMouseOut)(Code)(Java Doc)
public void setOnMouseOver(String onMouseOver)(Code)(Java Doc)
public void setOnMouseUp(String onMouseUp)(Code)(Java Doc)
public void setOnSelect(String onSelect)(Code)(Java Doc)
public void setReadOnly(boolean readOnly)(Code)(Java Doc)
public void setStyle(String style)(Code)(Java Doc)
public void setStyleClass(String styleClass)(Code)(Java Doc)
public void setTabIndex(int tabIndex)(Code)(Java Doc)
public void setText(Object text)(Code)(Java Doc)
public void setToolTip(String toolTip)(Code)(Java Doc)
public void setTrim(boolean trim)(Code)(Java Doc)
public void setValueBinding(String name, ValueBinding binding)(Code)(Java Doc)
public void setVisible(boolean visible)(Code)(Java Doc)

Methods inherited from com.sun.rave.web.ui.component.HiddenField
protected Object getConvertedValue(FacesContext context, Object newValue) throws javax.faces.convert.ConverterException(Code)(Java Doc)
public String getReadOnlyValueString(FacesContext context)(Code)(Java Doc)
public String getValueAsString(FacesContext context)(Code)(Java Doc)
protected void log(String s)(Code)(Java Doc)

Methods inherited from com.sun.rave.web.ui.component.HiddenFieldBase
public String getFamily()(Code)(Java Doc)
public Object getText()(Code)(Java Doc)
public ValueBinding getValueBinding(String name)(Code)(Java Doc)
public boolean isDisabled()(Code)(Java Doc)
public void restoreState(FacesContext _context, Object _state)(Code)(Java Doc)
public Object saveState(FacesContext _context)(Code)(Java Doc)
public void setDisabled(boolean disabled)(Code)(Java Doc)
public void setText(Object text)(Code)(Java Doc)
public void setValueBinding(String name, ValueBinding binding)(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.