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


java.lang.Object
   com.jgoodies.binding.adapter.SpinnerAdapterFactory

SpinnerAdapterFactory
final public class SpinnerAdapterFactory (Code)
A factory that vends SpinnerModel implementations that are bound to a ValueModel. Can be used to bind a ValueModel to instances of JSpinner.

To keep the ValueModel and SpinnerModel synchronized, this class listens to changes in both sides and updates the other silently, i.e. without firing a duplicate change event.

Constraints: The ValueModel's type must be compatible with the type required by the referenced SpinnerModel. For example a SpinnerNumberModel requires Number values. Example:

 // General Connection
 ValueModel   levelModel   = new PropertyAdapter(settings, "level", true);
 SpinnerModel spinnerModel = new SpinnerNumberModel(9, 5, 10, 1);
 Object defaultValue       = new Integer(9);
 SpinnerAdapterFactory.connect(spinnerModel, levelModel, defaultValue);
 JSpinner levelSpinner = new JSpinner(spinnerModel);
 // Short Form
 ValueModel levelModel = new PropertyAdapter(settings, "level", true);
 SpinnerNumberModel spinnerModel =
 SpinnerAdapterFactory.createNumberAdapter(levelModel, 5, 10, 1);
 JSpinner levelSpinner = new JSpinner(spinnerModel);
 

author:
   Karsten Lentzsch
version:
   $Revision: 1.10 $
See Also:   ValueModel
See Also:   SpinnerModel
See Also:   javax.swing.JSpinner
since:
   1.1




Method Summary
public static  voidconnect(SpinnerModel spinnerModel, ValueModel valueModel, Object defaultValue)
     Connects the given ValueModel and SpinnerModel by synchronizing their values.
public static  SpinnerDateModelcreateDateAdapter(ValueModel valueModel, Date defaultDate)
     Creates and returns a SpinnerDateModel bound to the given valueModel.
public static  SpinnerDateModelcreateDateAdapter(ValueModel valueModel, Date defaultDate, Comparable<Date> start, Comparable<Date> end, int calendarField)
     Creates and returns a SpinnerDateModel that represents a sequence of dates and is bound to the given valueModel. The dates are between start and end.
public static  SpinnerNumberModelcreateNumberAdapter(ValueModel valueModel, int defaultValue, int minValue, int maxValue, int stepSize)
     Creates and returns a SpinnerNumberModel that is connected to the given ValueModel and that honors the specified minimum, maximum and step values.
public static  SpinnerNumberModelcreateNumberAdapter(ValueModel valueModel, Number defaultValue, Comparable<? extends Number> minValue, Comparable<? extends Number> maxValue, Number stepSize)
     Creates and returns a SpinnerNumberModel that is connected to the given ValueModel and that honors the specified minimum, maximum and step values.



Method Detail
connect
public static void connect(SpinnerModel spinnerModel, ValueModel valueModel, Object defaultValue)(Code)
Connects the given ValueModel and SpinnerModel by synchronizing their values.
Parameters:
  spinnerModel - the underlying SpinnerModel implementation
Parameters:
  valueModel - provides a value
Parameters:
  defaultValue - the value used if the valueModel's value is null
throws:
  NullPointerException - if the spinnerModel, valueModel or defaultValue is null



createDateAdapter
public static SpinnerDateModel createDateAdapter(ValueModel valueModel, Date defaultDate)(Code)
Creates and returns a SpinnerDateModel bound to the given valueModel. The calendarField is equal to Calendar.DAY_OF_MONTH; there are no start/end limits.
Parameters:
  valueModel - a Date typed model that holds the spinner value
Parameters:
  defaultDate - the date used if the valueModel's value is null a SpinnerDateModel bound to the givenvalueModel without start and end limits usingCalendar.DAY_OF_MONTH as calendar field
throws:
  NullPointerException - if the valueModel or defaultDate is null



createDateAdapter
public static SpinnerDateModel createDateAdapter(ValueModel valueModel, Date defaultDate, Comparable<Date> start, Comparable<Date> end, int calendarField)(Code)
Creates and returns a SpinnerDateModel that represents a sequence of dates and is bound to the given valueModel. The dates are between start and end. The nextValue and previousValue methods compute elements of the sequence by advancing or reversing the current date value by the calendarField time unit. For a precise description of what it means to increment or decrement a Calendar field, see the add method in java.util.Calendar.

The start and end parameters can be null to indicate that the range doesn't have an upper or lower bound. If value or calendarField is null, or if both start and end are specified and minimum > maximum then an IllegalArgumentException is thrown. Similarly if (minimum <= value <= maximum) is false, an IllegalArgumentException is thrown.

This method has not been tested.
Parameters:
  valueModel - a Date typed model that holds the spinner value
Parameters:
  defaultDate - the date used if the valueModel's value is null
Parameters:
  start - the first date in the sequence or null
Parameters:
  end - the last date in the sequence or null
Parameters:
  calendarField - one of

  • Calendar.ERA
  • Calendar.YEAR
  • Calendar.MONTH
  • Calendar.WEEK_OF_YEAR
  • Calendar.WEEK_OF_MONTH
  • Calendar.DAY_OF_MONTH
  • Calendar.DAY_OF_YEAR
  • Calendar.DAY_OF_WEEK
  • Calendar.DAY_OF_WEEK_IN_MONTH
  • Calendar.AM_PM
  • Calendar.HOUR
  • Calendar.HOUR_OF_DAY
  • Calendar.MINUTE
  • Calendar.SECOND
  • Calendar.MILLISECOND
a SpinnerDateModel bound to the givenvalueModel using the specified start and end datesand calendar field.
throws:
  NullPointerException - if the valueModel or defaultDate is null
throws:
  IllegalArgumentException - if calendarField isn't valid,or if the following expression isfalse: (start <= value <= end).
See Also:   java.util.Calendar
See Also:   Date



createNumberAdapter
public static SpinnerNumberModel createNumberAdapter(ValueModel valueModel, int defaultValue, int minValue, int maxValue, int stepSize)(Code)
Creates and returns a SpinnerNumberModel that is connected to the given ValueModel and that honors the specified minimum, maximum and step values.
Parameters:
  valueModel - an Integer typed model that holds the spinner value
Parameters:
  defaultValue - the number used if the valueModel's value is null
Parameters:
  minValue - the lower bound of the spinner number
Parameters:
  maxValue - the upper bound of the spinner number
Parameters:
  stepSize - used to increment and decrement the current value a SpinnerNumberModel that is connected to the givenValueModel
throws:
  NullPointerException - if the valueModel is null



createNumberAdapter
public static SpinnerNumberModel createNumberAdapter(ValueModel valueModel, Number defaultValue, Comparable<? extends Number> minValue, Comparable<? extends Number> maxValue, Number stepSize)(Code)
Creates and returns a SpinnerNumberModel that is connected to the given ValueModel and that honors the specified minimum, maximum and step values.
Parameters:
  valueModel - a Number typed model that holds the spinner value
Parameters:
  defaultValue - the number used if the valueModel's value is null
Parameters:
  minValue - the lower bound of the spinner number
Parameters:
  maxValue - the upper bound of the spinner number
Parameters:
  stepSize - used to increment and decrement the current value a SpinnerNumberModel that is connected to the givenValueModel
throws:
  NullPointerException - if the valueModel or defaultValue is 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.