Java Doc for Context.java in  » Template-Engine » Tea » com » go » tea » runtime » 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 » Template Engine » Tea » com.go.tea.runtime 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


com.go.tea.runtime.Context

Context
public interface Context extends OutputReceiver(Code)
Interface establishes basic printing and formatting functions for a template runtime context.
See Also:   com.go.tea.compiler.Compiler.getRuntimeContext
author:
   Brian S O'Neill
version:
   41 , 01/04/19
See Also:   DefaultContext




Method Summary
public  voiddateFormat(String format)
     Defines a format to use when printing dates from templates.
public  voiddateFormat(String format, String timeZoneID)
     A function that sets the formatted value of dates.
Parameters:
  format - date format specification string
Parameters:
  timeZoneID - time zone ID, i.e.
public  java.util.Locale[]getAvailableLocales()
     Returns a list of all the available locales.
public  java.util.TimeZone[]getAvailableTimeZones()
     Returns a list of all the available time zones.
public  StringgetDateFormat()
     Returns the current date format specification.
public  StringgetDateFormatTimeZone()
     Returns the current date format time zone.
public  java.util.LocalegetLocale()
     Returns the current locale setting.
public  StringgetNullFormat()
     Returns the current null format specification.
public  StringgetNumberFormat()
     Returns the current number format specification.
public  StringgetNumberFormatInfinity()
     Returns the current number format for infinity.
public  StringgetNumberFormatNaN()
     Returns the current number format for NaN.
public  voidnullFormat(String format)
     A function that sets the formatted value of null object references.
public  voidnumberFormat(String format)
     A function that sets the formatted value of numbers. Defines a format to use when printing numbers from templates.
public  voidnumberFormat(String format, String infinity, String NaN)
     A function that sets the formatted value of numbers. Defines a format to use when printing numbers from templates.
public  voidprint(Object obj)
     Method that is the runtime receiver.
public  voidprint(java.util.Date date)
    
public  voidprint(Number n)
    
public  voidprint(int n)
    
public  voidprint(float n)
    
public  voidprint(long n)
    
public  voidprint(double n)
    
public  voidsetLocale(java.util.Locale locale)
     Setting the locale resets date and number formats to the default for that locale.
public  voidsetLocale(String language, String country)
     Setting the locale resets date and number formats to the default for that locale.
public  voidsetLocale(String language, String country, String variant)
     Setting the locale resets date and number formats to the default for that locale.
public  StringtoString(Object obj)
     A function that converts an object to a string, applying any applicable formatting settings.
public  StringtoString(String str)
     A function that converts a string to the null format string if it is null.
public  StringtoString(java.util.Date date)
     A function that converts a date to a string, using the current date format.
public  StringtoString(Number n)
     A function that converts a number to a string, using the current number format.
public  StringtoString(int n)
     A function that converts a number to a string, using the current number format.
public  StringtoString(float n)
     A function that converts a number to a string, using the current number format.
public  StringtoString(long n)
     A function that converts a number to a string, using the current number format.
public  StringtoString(double n)
     A function that converts a number to a string, using the current number format.



Method Detail
dateFormat
public void dateFormat(String format)(Code)
Defines a format to use when printing dates from templates. Passing null sets the format back to the default.

Time Format Syntax:

To specify the time format use a time pattern string. In this pattern, all ASCII letters are reserved as pattern letters, which are defined as the following:

 
 Symbol   Meaning                 Presentation        Example 
 ------   -------                 ------------        ------- 
 G        era designator          (Text)              AD 
 y        year                    (Number)            1996 
 M        month in year           (Text & Number)     July & 07 
 d        day in month            (Number)            10 
 h        hour in am/pm (1~12)    (Number)            12 
 H        hour in day (0~23)      (Number)            0 
 m        minute in hour          (Number)            30 
 s        second in minute        (Number)            55 
 S        millisecond             (Number)            978 
 E        day in week             (Text)              Tuesday 
 D        day in year             (Number)            189 
 F        day of week in month    (Number)            2 (2nd Wed in July)
 w        week in year            (Number)            27 
 W        week in month           (Number)            2 
 a        am/pm marker            (Text)              PM 
 k        hour in day (1~24)      (Number)            24 
 K        hour in am/pm (0~11)    (Number)            0 
 z        time zone               (Text)              Pacific Standard Time 
 '        escape for text         (Delimiter) 
 ''       single quote            (Literal)           ' 
 
The count of pattern letters determine the format.

(Text): 4 or more pattern letters--use full form, less than 4--use short or abbreviated form if one exists.

(Number): the minimum number of digits. Shorter numbers are zero-padded to this amount. Year is handled specially; that is, if the count of 'y' is 2, the Year will be truncated to 2 digits.

(Text & Number): 3 or over, use text, otherwise use number.

Any characters in the pattern that are not in the ranges of ['a'..'z'] and ['A'..'Z'] will be treated as quoted text. For instance, characters like ':', '.', ' ', '#' and '@' will appear in the resulting time text even they are not embraced within single quotes.

A pattern containing any invalid pattern letter will result in a thrown exception during formatting or parsing.

Examples:

 
 Format Pattern                         Result 
 --------------                         ------- 
 "yyyy.MM.dd G 'at' hh:mm:ss z"    ->>  1996.07.10 AD at 15:08:56 PDT 
 "EEE, MMM d, ''yy"                ->>  Wed, July 10, '96 
 "h:mm a"                          ->>  12:08 PM 
 "hh 'o''clock' a, zzzz"           ->>  12 o'clock PM, Pacific Daylight Time 
 "K:mm a, z"                       ->>  0:00 PM, PST 
 "yyyyy.MMMMM.dd GGG hh:mm aaa"    ->>  1996.July.10 AD 12:08 PM 
 

Parameters:
  format - date format specification string



dateFormat
public void dateFormat(String format, String timeZoneID)(Code)
A function that sets the formatted value of dates.
Parameters:
  format - date format specification string
Parameters:
  timeZoneID - time zone ID, i.e. "PST"



getAvailableLocales
public java.util.Locale[] getAvailableLocales()(Code)
Returns a list of all the available locales.



getAvailableTimeZones
public java.util.TimeZone[] getAvailableTimeZones()(Code)
Returns a list of all the available time zones.



getDateFormat
public String getDateFormat()(Code)
Returns the current date format specification.



getDateFormatTimeZone
public String getDateFormatTimeZone()(Code)
Returns the current date format time zone.



getLocale
public java.util.Locale getLocale()(Code)
Returns the current locale setting.



getNullFormat
public String getNullFormat()(Code)
Returns the current null format specification.



getNumberFormat
public String getNumberFormat()(Code)
Returns the current number format specification.



getNumberFormatInfinity
public String getNumberFormatInfinity()(Code)
Returns the current number format for infinity.



getNumberFormatNaN
public String getNumberFormatNaN()(Code)
Returns the current number format for NaN.



nullFormat
public void nullFormat(String format)(Code)
A function that sets the formatted value of null object references.
Parameters:
  format - string to print in place of "null".



numberFormat
public void numberFormat(String format)(Code)
A function that sets the formatted value of numbers. Defines a format to use when printing numbers from templates. Passing null sets the format back to the default. The format string is of the form "#.#".

Here are the special characters used in the parts of the format string, with notes on their usage.

 
 Symbol   Meaning 
 ------   ------- 
 0        a digit 
 #        a digit, zero shows as absent 
 .        placeholder for decimal separator. 
 ,        placeholder for grouping separator. 
 ;        separates formats. 
 -        default negative prefix. 
 %        multiply by 100 and show as percentage 
 ?        multiply by 1000 and show as per mille 
 \u00a4        currency sign; replaced by currency symbol;
          if doubled, replaced by international currency 
          symbol. If present in a pattern, the monetary
          decimal separator is used instead of the decimal 
          separator. (Unicode escape is \\u00a4) 
 X        any other characters can be used in the prefix or suffix 
 '        used to quote special characters in a prefix or suffix. 
 

Parameters:
  format - number format specification string



numberFormat
public void numberFormat(String format, String infinity, String NaN)(Code)
A function that sets the formatted value of numbers. Defines a format to use when printing numbers from templates. Passing null sets the format back to the default. The format string is of the form "#.#".

Here are the special characters used in the parts of the format string, with notes on their usage.

 
 Symbol   Meaning 
 ------   ------- 
 0        a digit 
 #        a digit, zero shows as absent 
 .        placeholder for decimal separator. 
 ,        placeholder for grouping separator. 
 ;        separates formats. 
 -        default negative prefix. 
 %        multiply by 100 and show as percentage 
 ?        multiply by 1000 and show as per mille 
 \u00a4        currency sign; replaced by currency symbol;
          if doubled, replaced by international currency 
          symbol. If present in a pattern, the monetary
          decimal separator is used instead of the decimal 
          separator. (Unicode escape is \\u00a4) 
 X        any other characters can be used in the prefix or suffix 
 '        used to quote special characters in a prefix or suffix. 
 

Parameters:
  format - number format specification string
Parameters:
  infinity - display string for infinity
Parameters:
  NaN - display string for not-a-number, resulting from zero dividedby zero.



print
public void print(Object obj) throws Exception(Code)
Method that is the runtime receiver. Implementations should call one of the toString methods when converting this object to a string.

NOTE: This method should not be called directly within a template.
See Also:   com.go.tea.compiler.Compiler.getRuntimeReceiver




print
public void print(java.util.Date date) throws Exception(Code)



print
public void print(Number n) throws Exception(Code)



print
public void print(int n) throws Exception(Code)



print
public void print(float n) throws Exception(Code)



print
public void print(long n) throws Exception(Code)



print
public void print(double n) throws Exception(Code)



setLocale
public void setLocale(java.util.Locale locale)(Code)
Setting the locale resets date and number formats to the default for that locale. Setting a locale of null resets date and number formats to the system defaults.

See getAvailableLocales to get all the available language, country and variant codes.
Parameters:
  locale - pre-constructed locale object




setLocale
public void setLocale(String language, String country)(Code)
Setting the locale resets date and number formats to the default for that locale.
Parameters:
  language - language code
Parameters:
  country - country code



setLocale
public void setLocale(String language, String country, String variant)(Code)
Setting the locale resets date and number formats to the default for that locale.
Parameters:
  language - language code
Parameters:
  country - country code
Parameters:
  variant - optional variant code



toString
public String toString(Object obj)(Code)
A function that converts an object to a string, applying any applicable formatting settings. The returned String is never null.
See Also:   com.go.tea.compiler.Compiler.getRuntimeStringConverter



toString
public String toString(String str)(Code)
A function that converts a string to the null format string if it is null. Otherwise, it is returned unchanged.
See Also:   com.go.tea.compiler.Compiler.getRuntimeStringConverter



toString
public String toString(java.util.Date date)(Code)
A function that converts a date to a string, using the current date format.
See Also:   com.go.tea.compiler.Compiler.getRuntimeStringConverter



toString
public String toString(Number n)(Code)
A function that converts a number to a string, using the current number format.
See Also:   com.go.tea.compiler.Compiler.getRuntimeStringConverter



toString
public String toString(int n)(Code)
A function that converts a number to a string, using the current number format.
See Also:   com.go.tea.compiler.Compiler.getRuntimeStringConverter



toString
public String toString(float n)(Code)
A function that converts a number to a string, using the current number format.
See Also:   com.go.tea.compiler.Compiler.getRuntimeStringConverter



toString
public String toString(long n)(Code)
A function that converts a number to a string, using the current number format.
See Also:   com.go.tea.compiler.Compiler.getRuntimeStringConverter



toString
public String toString(double n)(Code)
A function that converts a number to a string, using the current number format.
See Also:   com.go.tea.compiler.Compiler.getRuntimeStringConverter



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