Java Doc for ConverterFactory.java in  » Swing-Library » jgoodies-data-binding » com » jgoodies » binding » 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 » Swing Library » jgoodies data binding » com.jgoodies.binding.value 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.jgoodies.binding.value.ConverterFactory

ConverterFactory
final public class ConverterFactory (Code)
A factory that vends ValueModels that convert types, for example Dates to Strings. More formally, a converting ValueModel VM1 converts the type T2 of an object being held as a value in one ValueModel VM2 into another type T1. When reading a value from VM1, instances of T2 are read from VM2 and are converted to T1. When storing a new value to VM1, the type converter will perform the inverse conversion and will convert an instance of T1 to T2.

Type converters should be used judiciously and only to bridge two ValueModels. To bind non-Strings to a text UI component you should better use a javax.swing.JFormattedTextField . They provide a more powerful means to convert strings to objects and handle many cases that arise around invalid input. See also the classes com.jgoodies.binding.adapter.Bindings and com.jgoodies.binding.adapter.BasicComponentFactory on how to bind ValueModels to formatted text fields.

The inner converter implementations have a 'public' visibility to enable reflection access.
author:
   Karsten Lentzsch
version:
   $Revision: 1.7 $
See Also:   ValueModel
See Also:   Format
See Also:   javax.swing.JFormattedTextField


Inner Class :final public static class BooleanNegator extends AbstractConverter
Inner Class :final public static class BooleanToStringConverter extends AbstractConverter
Inner Class :final public static class DoubleConverter extends AbstractConverter
Inner Class :final public static class DoubleToIntegerConverter extends AbstractConverter
Inner Class :final public static class FloatConverter extends AbstractConverter
Inner Class :final public static class FloatToIntegerConverter extends AbstractConverter
Inner Class :final public static class LongConverter extends AbstractConverter
Inner Class :final public static class IntegerConverter extends AbstractConverter
Inner Class :final public static class LongToIntegerConverter extends AbstractConverter
Inner Class :final public static class StringConverter extends AbstractConverter



Method Summary
public static  ValueModelcreateBooleanNegator(ValueModel booleanSubject)
     Creates and returns a ValueModel that negates Booleans and leaves null unchanged.

Constraints: The subject is of type Boolean.

public static  ValueModelcreateBooleanToStringConverter(ValueModel booleanSubject, String trueText, String falseText)
     Creates and returns a ValueModel that converts Booleans to the associated of the two specified strings, and vice versa.
public static  ValueModelcreateBooleanToStringConverter(ValueModel booleanSubject, String trueText, String falseText, String nullText)
     Creates and returns a ValueModel that converts Booleans to the associated of the two specified strings, and vice versa.
public static  ValueModelcreateDoubleConverter(ValueModel doubleSubject, double multiplier)
     Creates and returns a ValueModel that converts Doubles using the specified multiplier.

Examples: multiplier=100, Double(1.23) -> Double(123), multiplier=1000, Double(1.23) -> Double(1230)

Constraints: The subject is of type Double.

public static  ValueModelcreateDoubleToIntegerConverter(ValueModel doubleSubject)
     Creates and returns a ValueModel that converts Doubles to Integer, and vice versa.

Constraints: The subject is of type Double.

public static  ValueModelcreateDoubleToIntegerConverter(ValueModel doubleSubject, int multiplier)
     Creates and returns a ValueModel that converts Doubles to Integer, and vice versa.
public static  ValueModelcreateFloatConverter(ValueModel floatSubject, float multiplier)
     Creates and returns a ValueModel that converts Floats using the specified multiplier.

Examples: multiplier=100, Float(1.23) -> Float(123), multiplier=1000, Float(1.23) -> Float(1230)

Constraints: The subject is of type Float.

public static  ValueModelcreateFloatToIntegerConverter(ValueModel floatSubject)
     Creates and returns a ValueModel that converts Floats to Integer, and vice versa.

Constraints: The subject is of type Float.

public static  ValueModelcreateFloatToIntegerConverter(ValueModel floatSubject, int multiplier)
     Creates and returns a ValueModel that converts Floats to Integer, and vice versa.
public static  ValueModelcreateIntegerConverter(ValueModel integerSubject, double multiplier)
     Creates and returns a ValueModel that converts Integers using the specified multiplier.

Examples: multiplier=100, Integer(3) -> Integer(300), multiplier=1000, Integer(3) -> Integer(3000)

Constraints: The subject is of type Integer.

public static  ValueModelcreateLongConverter(ValueModel longSubject, double multiplier)
     Creates and returns a ValueModel that converts Long using the specified multiplier.

Examples: multiplier=100, Long(3) -> Long(300), multiplier=1000, Long(3) -> Long(3000)

Constraints: The subject is of type Long.

public static  ValueModelcreateLongToIntegerConverter(ValueModel longSubject)
     Creates and returns a ValueModel that converts Longs to Integer and vice versa.

Constraints: The subject is of type Long, values written to the converter are of type Integer.

public static  ValueModelcreateLongToIntegerConverter(ValueModel longSubject, int multiplier)
     Creates and returns a ValueModel that converts Longs to Integer and vice versa.

Constraints: The subject is of type Long, values written to the converter are of type Integer.

public static  ValueModelcreateStringConverter(ValueModel subject, Format format)
     Creates and returns a ValueModel that converts objects to Strings and vice versa.



Method Detail
createBooleanNegator
public static ValueModel createBooleanNegator(ValueModel booleanSubject)(Code)
Creates and returns a ValueModel that negates Booleans and leaves null unchanged.

Constraints: The subject is of type Boolean.
Parameters:
  booleanSubject - a Boolean ValueModel a ValueModel that inverts Booleans
throws:
  NullPointerException - if the subject is null




createBooleanToStringConverter
public static ValueModel createBooleanToStringConverter(ValueModel booleanSubject, String trueText, String falseText)(Code)
Creates and returns a ValueModel that converts Booleans to the associated of the two specified strings, and vice versa. Null values are mapped to an empty string. Ignores cases when setting a text.

Constraints: The subject is of type Boolean.
Parameters:
  booleanSubject - a Boolean ValueModel
Parameters:
  trueText - the text associated with Boolean.TRUE
Parameters:
  falseText - the text associated with Boolean.FALSE a ValueModel that converts boolean to the associated text
throws:
  NullPointerException - if the subject, trueText or falseTextis null
throws:
  IllegalArgumentException - if the trueText equals the falseText




createBooleanToStringConverter
public static ValueModel createBooleanToStringConverter(ValueModel booleanSubject, String trueText, String falseText, String nullText)(Code)
Creates and returns a ValueModel that converts Booleans to the associated of the two specified strings, and vice versa. Null values are mapped to the specified text. Ignores cases when setting a text.

Constraints: The subject is of type Boolean.
Parameters:
  booleanSubject - a Boolean ValueModel
Parameters:
  trueText - the text associated with Boolean.TRUE
Parameters:
  falseText - the text associated with Boolean.FALSE
Parameters:
  nullText - the text associated with null a ValueModel that converts boolean to the associated text
throws:
  NullPointerException - if the subject, trueText, falseTextor nullText is null
throws:
  IllegalArgumentException - if the trueText equals the falseText




createDoubleConverter
public static ValueModel createDoubleConverter(ValueModel doubleSubject, double multiplier)(Code)
Creates and returns a ValueModel that converts Doubles using the specified multiplier.

Examples: multiplier=100, Double(1.23) -> Double(123), multiplier=1000, Double(1.23) -> Double(1230)

Constraints: The subject is of type Double.
Parameters:
  doubleSubject - a Double ValueModel
Parameters:
  multiplier - the multiplier used for the conversion a ValueModel that converts Doubles using the specified multiplier
throws:
  NullPointerException - if the subject is null
since:
   1.0.2




createDoubleToIntegerConverter
public static ValueModel createDoubleToIntegerConverter(ValueModel doubleSubject)(Code)
Creates and returns a ValueModel that converts Doubles to Integer, and vice versa.

Constraints: The subject is of type Double.
Parameters:
  doubleSubject - a Double ValueModel a ValueModel that converts Doubles to Integer
throws:
  NullPointerException - if the subject is null




createDoubleToIntegerConverter
public static ValueModel createDoubleToIntegerConverter(ValueModel doubleSubject, int multiplier)(Code)
Creates and returns a ValueModel that converts Doubles to Integer, and vice versa. The multiplier can be used to convert Doubles to percent, permill, etc. For a percentage, set the multiplier to be 100, for a permill, set the multiplier to be 1000.

Examples: multiplier=100, Double(1.23) -> Integer(123), multiplier=1000, Double(1.23) -> Integer(1230)

Constraints: The subject is of type Double.
Parameters:
  doubleSubject - a Double ValueModel
Parameters:
  multiplier - the multiplier used to convert the Double to Integer a ValueModel that converts Doubles to Integer
throws:
  NullPointerException - if the subject is null




createFloatConverter
public static ValueModel createFloatConverter(ValueModel floatSubject, float multiplier)(Code)
Creates and returns a ValueModel that converts Floats using the specified multiplier.

Examples: multiplier=100, Float(1.23) -> Float(123), multiplier=1000, Float(1.23) -> Float(1230)

Constraints: The subject is of type Float.
Parameters:
  floatSubject - a Float ValueModel
Parameters:
  multiplier - the multiplier used for the conversion a ValueModel that converts Float using the specified multiplier
throws:
  NullPointerException - if the subject is null
since:
   1.0.2




createFloatToIntegerConverter
public static ValueModel createFloatToIntegerConverter(ValueModel floatSubject)(Code)
Creates and returns a ValueModel that converts Floats to Integer, and vice versa.

Constraints: The subject is of type Float. s
Parameters:
  floatSubject - a Float ValueModel a ValueModel that converts Floats to Integer
throws:
  NullPointerException - if the subject is null




createFloatToIntegerConverter
public static ValueModel createFloatToIntegerConverter(ValueModel floatSubject, int multiplier)(Code)
Creates and returns a ValueModel that converts Floats to Integer, and vice versa. The multiplier can be used to convert Floats to percent, permill, etc. For a percentage, set the multiplier to be 100, for a permill, set the multiplier to be 1000.

Constraints: The subject is of type Float.
Parameters:
  floatSubject - a Float ValueModel
Parameters:
  multiplier - the multiplier used to convert the Float to Integer a ValueModel that converts Floats to Integer
throws:
  NullPointerException - if the subject is null




createIntegerConverter
public static ValueModel createIntegerConverter(ValueModel integerSubject, double multiplier)(Code)
Creates and returns a ValueModel that converts Integers using the specified multiplier.

Examples: multiplier=100, Integer(3) -> Integer(300), multiplier=1000, Integer(3) -> Integer(3000)

Constraints: The subject is of type Integer.
Parameters:
  integerSubject - a Integer ValueModel
Parameters:
  multiplier - the multiplier used for the conversion a ValueModel that converts Integers using the specified multiplier
throws:
  NullPointerException - if the subject is null
since:
   1.0.2




createLongConverter
public static ValueModel createLongConverter(ValueModel longSubject, double multiplier)(Code)
Creates and returns a ValueModel that converts Long using the specified multiplier.

Examples: multiplier=100, Long(3) -> Long(300), multiplier=1000, Long(3) -> Long(3000)

Constraints: The subject is of type Long.
Parameters:
  longSubject - a Long ValueModel
Parameters:
  multiplier - the multiplier used for the conversion a ValueModel that converts Longs using the specified multiplier
throws:
  NullPointerException - if the subject is null
since:
   1.0.2




createLongToIntegerConverter
public static ValueModel createLongToIntegerConverter(ValueModel longSubject)(Code)
Creates and returns a ValueModel that converts Longs to Integer and vice versa.

Constraints: The subject is of type Long, values written to the converter are of type Integer.
Parameters:
  longSubject - a Long ValueModel a ValueModel that converts Longs to Integer
throws:
  NullPointerException - if the subject is null




createLongToIntegerConverter
public static ValueModel createLongToIntegerConverter(ValueModel longSubject, int multiplier)(Code)
Creates and returns a ValueModel that converts Longs to Integer and vice versa.

Constraints: The subject is of type Long, values written to the converter are of type Integer.
Parameters:
  longSubject - a Long ValueModel
Parameters:
  multiplier - used to multiply the Long when converting to Integer a ValueModel that converts Longs to Integer
throws:
  NullPointerException - if the subject is null




createStringConverter
public static ValueModel createStringConverter(ValueModel subject, Format format)(Code)
Creates and returns a ValueModel that converts objects to Strings and vice versa. The conversion is performed by a Format.

Constraints: The subject is of type Object; it must be formattable and parsable via the given Format.
Parameters:
  subject - the underlying ValueModel.
Parameters:
  format - the Format used to format and parse a ValueModel that converts objects to Strings and vice versa
throws:
  NullPointerException - if the subject or the formatis null




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.