Java Doc for FxValue.java in  » J2EE » fleXive » com » flexive » shared » value » 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 » J2EE » fleXive » com.flexive.shared.value 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.flexive.shared.value.FxValue

FxValue
abstract public class FxValue implements Serializable,Comparable<FxValue>(Code)
Abstract base class of all value objects. Common base classed is used for multilingual properties, etc.

To check if a value is empty a flag is used for each language resp. the single value. Use the setEmpty() method to explicity set a value to be empty
author:
   Markus Plesser (markus.plesser@flexive.com), UCS - unique computing solutions gmbh (http://www.ucs.at)



Field Summary
final public static  booleanDEFAULT_MULTILANGUAGE
    
protected  Map<Long, Boolean>emptyTranslations
    
protected  TsingleValue
    
protected  Map<Long, T>translations
    

Constructor Summary
protected  FxValue()
    
protected  FxValue(boolean multiLanguage, long defaultLanguage, Map<Long, T> translations)
    
protected  FxValue(long defaultLanguage, Map<Long, T> translations)
    
protected  FxValue(boolean multiLanguage, Map<Long, T> translations)
    
protected  FxValue(Map<Long, T> translations)
    
protected  FxValue(Map<Long, T[]> translations, int pos)
    
protected  FxValue(boolean multiLanguage, long defaultLanguage, T value)
    
protected  FxValue(long defaultLanguage, T value)
    
protected  FxValue(boolean multiLanguage, T value)
    
protected  FxValue(T value)
    
protected  FxValue(FxValue<T, TDerived> clone)
    

Method Summary
public  voidclearDefaultLanguage()
    
public  intcompareTo(FxValue o)
     A generic comparable implementation based on the value's string representation.
abstract public  TDerivedcopy()
     Creates a copy of the given object (useful if the actual type is unknown).
public  booleanequals(Object other)
    
abstract public  TfromString(String value)
     Evaluates the given string value to an object of type T.
public static  FxValuefromXML(String xml)
    
public  TgetBestTranslation(long lang)
     Get the translation that best fits the requested language.
public  TgetBestTranslation(FxLanguage language)
     Get the translation that best fits the requested language.
public  TgetBestTranslation(UserTicket ticket)
     Get the translation that best fits the requested users language.
public  TgetBestTranslation()
     Get the translation that best fits the current users language.
public  longgetDefaultLanguage()
    
public  TgetDefaultTranslation()
    
public  TgetErrorValue()
     Returns the value that caused FxValue.isValid to return false.
public  booleangetIsEmpty()
     Like empty(), for JSF EL, since empty cannot be used.
public  intgetMaxInputLength()
     Returns the maximum input length an input field should have for this value (or -1 for unlimited length).
public  longgetSelectedLanguage()
    
public  StringgetSqlValue()
     Format this FxValue for inclusion in a SQL statement.
public  StringgetStringValue(T value)
     Converts the given instance of T to a string that can be parsed again by FxValue.fromString(String) .
public  Long[]getTranslatedLanguages()
    
public  TgetTranslation(long lang)
    
public  TgetTranslation(FxLanguage lang)
    
abstract public  Class<T>getValueClass()
     Return the class instance of the value type.
public  StringgetXPath()
    
public  StringgetXPathName()
     Returns the name of the value from the xpath.
public  booleanhasDefaultLanguage()
    
public  inthashCode()
    
protected  booleanisAcceptsEmptyDefaultTranslations()
    
public  booleanisDefaultLanguage(long language)
    
public  booleanisEmpty()
    
public  booleanisImmutableValueType()
     Return true if T is immutable (e.g.
public  booleanisMultiLanguage()
    
public  booleanisReadOnly()
    
public  booleanisTranslationEmpty(FxLanguage lang)
    
public  booleanisTranslationEmpty(long lang)
    
public  booleanisValid()
     Returns true if this value is valid for the actual type (e.g.
public  voidremoveLanguage(long language)
    
public  voidsetDefaultLanguage(long defaultLanguage)
     Set the default language.
public  voidsetDefaultLanguage(long defaultLanguage, boolean force)
     Set the default language.
public  FxValuesetDefaultTranslation(T translation)
     Set the translation in the default language.
public  TDerivedsetEmpty()
    
public  voidsetEmpty(long language)
    
public  voidsetMaxInputLength(int maxInputLength)
     Set the maximum input length for this value (-1 for unlimited length).
public  voidsetReadOnly()
     One-time operation to flag this FxValue as read only.
public  FxValuesetSelectedLanguage(long selectedLanguage)
    
final public  TDerivedsetTranslation(long language, T value)
     Set the translation for a language or override the single language value if this value is not flagged as multi language enabled.
public  TDerivedsetTranslation(FxLanguage lang, T translation)
    
public  voidsetValue(T value)
     For multilanguage values, set the default translation.
public  TDerivedsetXPath(String XPath)
    
public  StringtoString()
    
public  StringtoXML()
    
public  booleantranslationExists(long languageId)
    

Field Detail
DEFAULT_MULTILANGUAGE
final public static boolean DEFAULT_MULTILANGUAGE(Code)



emptyTranslations
protected Map<Long, Boolean> emptyTranslations(Code)



singleValue
protected T singleValue(Code)
Data if multiLanguage is disabled



translations
protected Map<Long, T> translations(Code)
Data if multiLanguage is enabled




Constructor Detail
FxValue
protected FxValue()(Code)



FxValue
protected FxValue(boolean multiLanguage, long defaultLanguage, Map<Long, T> translations)(Code)
Constructor
Parameters:
  multiLanguage - multilanguage value?
Parameters:
  defaultLanguage - the default language
Parameters:
  translations - HashMap containing language->translation mapping



FxValue
protected FxValue(long defaultLanguage, Map<Long, T> translations)(Code)
Constructor
Parameters:
  defaultLanguage - the default language
Parameters:
  translations - HashMap containing language->translation mapping



FxValue
protected FxValue(boolean multiLanguage, Map<Long, T> translations)(Code)
Constructor
Parameters:
  multiLanguage - multilanguage value?
Parameters:
  translations - HashMap containing language->translation mapping



FxValue
protected FxValue(Map<Long, T> translations)(Code)
Constructor
Parameters:
  translations - HashMap containing language->translation mapping



FxValue
protected FxValue(Map<Long, T[]> translations, int pos)(Code)
Constructor - create value from an array of translations
Parameters:
  translations - HashMap containing language->translation mapping
Parameters:
  pos - position (index) in the array to use



FxValue
protected FxValue(boolean multiLanguage, long defaultLanguage, T value)(Code)
Constructor
Parameters:
  multiLanguage - multilanguage value?
Parameters:
  defaultLanguage - the default language
Parameters:
  value - single initializing value



FxValue
protected FxValue(long defaultLanguage, T value)(Code)
Constructor
Parameters:
  defaultLanguage - the default language
Parameters:
  value - single initializing value



FxValue
protected FxValue(boolean multiLanguage, T value)(Code)
Constructor
Parameters:
  multiLanguage - multilanguage value?
Parameters:
  value - single initializing value



FxValue
protected FxValue(T value)(Code)
Constructor
Parameters:
  value - single initializing value



FxValue
protected FxValue(FxValue<T, TDerived> clone)(Code)
Constructor
Parameters:
  clone - original FxValue to be cloned




Method Detail
clearDefaultLanguage
public void clearDefaultLanguage()(Code)
Reset the default language to the system language



compareTo
public int compareTo(FxValue o)(Code)
A generic comparable implementation based on the value's string representation.
Parameters:
  o - the other object see Comparable.compareTo.



copy
abstract public TDerived copy()(Code)
Creates a copy of the given object (useful if the actual type is unknown). a copy of the given object (useful if the actual type is unknown).



equals
public boolean equals(Object other)(Code)



fromString
abstract public T fromString(String value)(Code)
Evaluates the given string value to an object of type T.
Parameters:
  value - string value to be evaluated the value interpreted as T



fromXML
public static FxValue fromXML(String xml)(Code)
Get an FxValue from its XML representation
Parameters:
  xml - XML representation FxValue instance



getBestTranslation
public T getBestTranslation(long lang)(Code)
Get the translation that best fits the requested language. The requested language is queried and if it does not exist the default translation is returned
Parameters:
  lang - requested best-fit language best fit translation



getBestTranslation
public T getBestTranslation(FxLanguage language)(Code)
Get the translation that best fits the requested language. The requested language is queried and if it does not exist the default translation is returned
Parameters:
  language - requested best-fit language best fit translation



getBestTranslation
public T getBestTranslation(UserTicket ticket)(Code)
Get the translation that best fits the requested users language. The requested users language is queried and if it does not exist the default translation is returned
Parameters:
  ticket - UserTicket to obtain the users language best fit translation



getBestTranslation
public T getBestTranslation()(Code)
Get the translation that best fits the current users language. The user language is obtained from the FxContext thread local. best fit translation



getDefaultLanguage
public long getDefaultLanguage()(Code)
Get the default language of this value default language



getDefaultTranslation
public T getDefaultTranslation()(Code)
Get a representation of this value in the default translation T



getErrorValue
public T getErrorValue() throws IllegalStateException(Code)
Returns the value that caused FxValue.isValid to return false. If isValid() is true, a RuntimeException is thrown. the value that caused the validation via FxValue.isValid to fail
throws:
  IllegalStateException - if the instance is valid and the error value is undefined



getIsEmpty
public boolean getIsEmpty()(Code)
Like empty(), for JSF EL, since empty cannot be used. true if the value is empty



getMaxInputLength
public int getMaxInputLength()(Code)
Returns the maximum input length an input field should have for this value (or -1 for unlimited length). the maximum input length an input field should have for this value



getSelectedLanguage
public long getSelectedLanguage()(Code)
Get the language selected in user interfaces selected language



getSqlValue
public String getSqlValue()(Code)
Format this FxValue for inclusion in a SQL statement. For example, a string is wrapped in single quotes and escaped properly (' --> ''). For multilanguage values the default translation is used. If the value is empty (@link #isEmpty()), a runtime exception is thrown. the formatted value



getStringValue
public String getStringValue(T value)(Code)
Converts the given instance of T to a string that can be parsed again by FxValue.fromString(String) .
Parameters:
  value - the value to be converted a string representation of the given value that can be parsed again usingFxValue.fromString(String).



getTranslatedLanguages
public Long[] getTranslatedLanguages()(Code)
Get all languages for which translations exist languages for which translations exist



getTranslation
public T getTranslation(long lang)(Code)
Get the translation for a requested language
Parameters:
  lang - requested language translation or an empty String if it does not exist



getTranslation
public T getTranslation(FxLanguage lang)(Code)
Get a String representation of this value in the requested language or an empty String if the translation does not exist
Parameters:
  lang - requested language id T translation



getValueClass
abstract public Class<T> getValueClass()(Code)
Return the class instance of the value type. the class instance of the value type.



getXPath
public String getXPath()(Code)
Get the XPath for this value - the XPath is optional and can be an empty String if not explicitly assigned! XPath (optional! can be an empty String)



getXPathName
public String getXPathName()(Code)
Returns the name of the value from the xpath.

If the xpath is an empty string the name will also return an emptry String. the property name




hasDefaultLanguage
public boolean hasDefaultLanguage()(Code)
Is a default value set for this FxValue? default value set



hashCode
public int hashCode()(Code)



isAcceptsEmptyDefaultTranslations
protected boolean isAcceptsEmptyDefaultTranslations()(Code)



isDefaultLanguage
public boolean isDefaultLanguage(long language)(Code)
Check if the passed language is the default language
Parameters:
  language - the language to check passed language is the default language



isEmpty
public boolean isEmpty()(Code)
Is this value empty? if value is empty



isImmutableValueType
public boolean isImmutableValueType()(Code)
Return true if T is immutable (e.g. java.lang.String). This prevents cloning of the translations in copy constructors. true if T is immutable (e.g. java.lang.String)



isMultiLanguage
public boolean isMultiLanguage()(Code)
Is this value available for multiple languages? value available for multiple languages



isReadOnly
public boolean isReadOnly()(Code)
Is this value editable by the user? This always returns true except it is a FxNoAccess value or flagged as readOnly if this value editable?
See Also:   FxNoAccess



isTranslationEmpty
public boolean isTranslationEmpty(FxLanguage lang)(Code)
Check if the translation for the given language is empty
Parameters:
  lang - language to check if translation for the given language is empty



isTranslationEmpty
public boolean isTranslationEmpty(long lang)(Code)
Check if the translation for the given language is empty
Parameters:
  lang - language to check if translation for the given language is empty



isValid
public boolean isValid()(Code)
Returns true if this value is valid for the actual type (e.g. if a FxNumber property actually contains only valid numbers). true if this value is valid for the actual type



removeLanguage
public void removeLanguage(long language)(Code)
Remove the translation for the given language
Parameters:
  language - the language to remove the translation for



setDefaultLanguage
public void setDefaultLanguage(long defaultLanguage)(Code)
Set the default language. It will only be set if a translation in the requested default language exists!
Parameters:
  defaultLanguage - requested default language



setDefaultLanguage
public void setDefaultLanguage(long defaultLanguage, boolean force)(Code)
Set the default language. Will have no effect if the value is not multi language enabled
Parameters:
  defaultLanguage - requested default language
Parameters:
  force - if true, the default language will also be updated if no translation exists (for UI input)



setDefaultTranslation
public FxValue setDefaultTranslation(T translation)(Code)
Set the translation in the default language. For single-language values, sets the value.
Parameters:
  translation - the default translation this



setEmpty
public TDerived setEmpty()(Code)
Mark this FxValue as empty this



setEmpty
public void setEmpty(long language)(Code)
Mark the entry for the given language as empty
Parameters:
  language - the language to flag as empty



setMaxInputLength
public void setMaxInputLength(int maxInputLength)(Code)
Set the maximum input length for this value (-1 for unlimited length).
Parameters:
  maxInputLength - the maximum input length for this value (-1 for unlimited length).



setReadOnly
public void setReadOnly()(Code)
One-time operation to flag this FxValue as read only. This is not reversible!



setSelectedLanguage
public FxValue setSelectedLanguage(long selectedLanguage) throws FxNoAccessException(Code)
Set the user selected language
Parameters:
  selectedLanguage - selected language ID self
throws:
  FxNoAccessException - if the selected Language is not contained



setTranslation
final public TDerived setTranslation(long language, T value)(Code)
Set the translation for a language or override the single language value if this value is not flagged as multi language enabled. This method cannot be overridden since it not only accepts parameters of type T, but also of type String for web form handling.
Parameters:
  language - language to set the translation for
Parameters:
  value - translation this



setTranslation
public TDerived setTranslation(FxLanguage lang, T translation)(Code)
Set the translation for a language or override the single language value if this value is not flagged as multi language enabled
Parameters:
  lang - language to set the translation for
Parameters:
  translation - translation this



setValue
public void setValue(T value)(Code)
For multilanguage values, set the default translation. For single language values, set the value.
Parameters:
  value - the value to be stored



setXPath
public TDerived setXPath(String XPath)(Code)
Set the XPath (unless readonly)
Parameters:
  XPath - the XPath to set, will be ignored if readonly this



toString
public String toString()(Code)



toXML
public String toXML()(Code)
Convert to XML xml



translationExists
public boolean translationExists(long languageId)(Code)
Does a translation exist for the given language?
Parameters:
  languageId - language to query translation exists



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.