Java Doc for FacesUtil.java in  » ERP-CRM-Financial » sakai » org » sakaiproject » tool » gradebook » jsf » 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 » ERP CRM Financial » sakai » org.sakaiproject.tool.gradebook.jsf 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.sakaiproject.tool.gradebook.jsf.FacesUtil

FacesUtil
public class FacesUtil (Code)
A noninstantiable utility class, because every JSF project needs one.


Field Summary
public static  intMAXIMUM_MEANINGFUL_DECIMAL_PLACES
     Before display, scores are rounded at this number of decimal places and later truncated to (hopefully) a shorter number.


Method Summary
public static  voidaddErrorMessage(String message)
     Methods to centralize our approach to messages, since we may have to adapt the default Faces implementation.
public static  voidaddMessage(String message)
    
public static  voidaddRedirectSafeMessage(String message)
     We want to use standard faces messaging for intra-page messages, such as validation checking, but we want to use the custom messaging approach for inter-page messaging.
public static  voidaddUniqueErrorMessage(String message)
    
public static  voidclearAllInputs(UIComponent component)
     JSF 1.1 provides no way to cleanly discard input fields from a table when we know we won't use them.
final public static  StringgetActionUrl(String action)
     Because POST arguments aren't carried over redirects, the easiest way to get bookmarkable URLs is to use "h:outputLink" rather than "h:commandLink" or "h:commandButton", and to add query string parameters via "f:param".
final public static  MapgetEventParameterMap(FacesEvent event)
     If the JSF h:commandLink component includes f:param children, those name-value pairs are put into the request parameter map for later use by the action handler.
public static  StringgetLocalizedString(FacesContext context, String key)
     Gets a localized message string based on the locale determined by the FacesContext.
public static  StringgetLocalizedString(String key)
     Gets a localized message string based on the locale determined by the FacesContext.
public static  StringgetLocalizedString(String key, String[] params)
     Gets a localized message string based on the locale determined by the FacesContext.
public static  doublegetRoundDown(double rawValue, int maxDecimalPlaces)
     All Faces number formatting options round instead of truncating.
final public static  ObjectresolveVariable(String name)
     To cut down on configuration noise, allow access to request-scoped beans from session-scoped beans, and so on, this method lets the caller try to find anything anywhere that Faces can look for it.

Field Detail
MAXIMUM_MEANINGFUL_DECIMAL_PLACES
public static int MAXIMUM_MEANINGFUL_DECIMAL_PLACES(Code)
Before display, scores are rounded at this number of decimal places and later truncated to (hopefully) a shorter number.





Method Detail
addErrorMessage
public static void addErrorMessage(String message)(Code)
Methods to centralize our approach to messages, since we may have to adapt the default Faces implementation.



addMessage
public static void addMessage(String message)(Code)



addRedirectSafeMessage
public static void addRedirectSafeMessage(String message)(Code)
We want to use standard faces messaging for intra-page messages, such as validation checking, but we want to use the custom messaging approach for inter-page messaging. So, for now we're going to add the inter-page messages to the custom MessagingBean.
Parameters:
  message -



addUniqueErrorMessage
public static void addUniqueErrorMessage(String message)(Code)



clearAllInputs
public static void clearAllInputs(UIComponent component)(Code)
JSF 1.1 provides no way to cleanly discard input fields from a table when we know we won't use them. Ideally in such circumstances we'd specify an "immediate" action handler (to skip unnecessary validation checks and model updates), and then overwrite any existing values. However, JSF absolutely insists on keeping any existing input components as they are if validation and updating hasn't been done. When the table is re-rendered, all of the readonly portions of the columns will be refreshed from the backing bean, but the input fields will keep their now-incorrect values.

The easiest practical way to deal with this limitation is to avoid "immediate" actions when a table contains input fields, avoid side-effects from the bogus model updates, and stick the user with the inconvenience of unnecessary validation errors.

The only other solution we've found is to have the backing bean bind to the data table component (which just means storing a transient pointer to the UIData or HtmlDataTable when it's passed to the bean's "setTheDataTable" method), and then to have the action handler call this method to walk the table, look for UIInputs on each row, and perform the necessary magic on each to force reloading from the data model.

Usage:

 private transient HtmlDataTable dataTable;
 public HtmlDataTable getDataTable() {
 return dataTable;
 }
 public void setDataTable(HtmlDataTable dataTable) {
 this.dataTable = dataTable;
 }
 public void processImmediateIdSwitch(ActionEvent event) {
 // ... modify the current ID ...
 FacesUtil.clearAllInputs(dataTable);
 }
 



getActionUrl
final public static String getActionUrl(String action)(Code)
Because POST arguments aren't carried over redirects, the easiest way to get bookmarkable URLs is to use "h:outputLink" rather than "h:commandLink" or "h:commandButton", and to add query string parameters via "f:param". However, if the value of the output link is something like "editAsg.jsf", we've introduced untestable assumptions about the local naming and navigation configurations. This method will safely return the output link value corresponding to the specified "from-outcome" view ID.



getEventParameterMap
final public static Map getEventParameterMap(FacesEvent event)(Code)
If the JSF h:commandLink component includes f:param children, those name-value pairs are put into the request parameter map for later use by the action handler. Unfortunately, the same isn't done for h:commandButton. This is a workaround to let arguments be associated with a button. Because action listeners are guaranteed to be executed before action methods, an action listener can use this method to update any context the action method might need.



getLocalizedString
public static String getLocalizedString(FacesContext context, String key)(Code)
Gets a localized message string based on the locale determined by the FacesContext.
Parameters:
  key - The key to look up the localized string



getLocalizedString
public static String getLocalizedString(String key)(Code)
Gets a localized message string based on the locale determined by the FacesContext. Useful for adding localized FacesMessages from a backing bean.
Parameters:
  key - The key to look up the localized string



getLocalizedString
public static String getLocalizedString(String key, String[] params)(Code)
Gets a localized message string based on the locale determined by the FacesContext. Useful for adding localized FacesMessages from a backing bean.
Parameters:
  key - The key to look up the localized string
Parameters:
  params - The array of strings to use in replacing the placeholdersin the localized string



getRoundDown
public static double getRoundDown(double rawValue, int maxDecimalPlaces)(Code)
All Faces number formatting options round instead of truncating. For the Gradebook, virtually no displayed numbers are ever supposed to round up. This method moves the specified raw value into a higher-resolution BigDecimal, rounding away noise at MAXIMUM_MEANINGFUL_DECIMAL_PLACES. It then rounds down to reach the specified maximum number of decimal places and returns the equivalent double for further formatting. This is all necessary because we don't store scores as BigDecimal and because Java / JSF lacks a DecimalFormat class which uses "floor" instead of "round" when trimming decimal places.



resolveVariable
final public static Object resolveVariable(String name)(Code)
To cut down on configuration noise, allow access to request-scoped beans from session-scoped beans, and so on, this method lets the caller try to find anything anywhere that Faces can look for it. WARNING: If what you're looking for is a managed bean and it isn't found, it will be created as a result of this call.



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(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.