Java Doc for ComponentValueModel.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) 


com.jgoodies.binding.value.AbstractValueModel
   com.jgoodies.binding.value.ComponentValueModel

ComponentValueModel
final public class ComponentValueModel extends AbstractValueModel (Code)
A ValueModel that provides relevant GUI state in presentation models. It provides bound properties for the frequently used JComponent state enabled,visible and JTextComponent state editable. ComponentValueModels can be used to set these properties at the presentation model layer; any ComponentValueModel property change will be reflected by components bound to that ComponentValueModel.

The ComponentValueModel is similar to the Swing Action class. If you disable an Action, all buttons and menu items bound to that Action will be disabled. If you disable a ComponentValueModel, all components bound to that ComponentValueModel will be disabled. If you set the ComponentValueModel to invisible, the component bound to it will become invisible. If you set a ComponentValueModel to non-editable, the JTextComponents bound to it will become non-editable.

Since version 1.1, PresentationModels can vend ComponentValueModels using #getComponentModel(String) and #getBufferedComponentModel(String). Multiple calls to these factory methods return the same ComponentValueModel.

The BasicComponentFactory and the Bindings class check if the ValueModel provided to create/bind a Swing component is a ComponentValueModel. If so, the ComponentValueModel properties will be synchronized with the associated Swing component properties.

It is recommended to use ComponentValueModels only for those models that are bound to view components that require GUI state changes.

Example Code:

 final class AlbumView {
 ...
 private void initComponents() {
 // No state modifications required for the name field.
 nameField = BasicComponentFactory.createTextField(
 presentationModel.getModel(Album.PROPERTYNAME_NAME));
 ...
 // Enablement shall change for the composer field
 composerField = BasicComponentFactory.createTextField(
 presentationModel.getComponentModel(Album.PROPERTYNAME_COMPOSER));
 ...
 }
 ...
 }
 public final class AlbumPresentationModel extends PresentationModel {
 ...
 private void updateComposerEnablement(boolean enabled) {
 getComponentModel(Album.PROPERTYNAME_COMPOSER).setEnabled(enabled);
 }
 ...
 }
 

As of the Binding version 2.0 the ComponentValueModel feature is implemented for text components, radio buttons, check boxes, combo boxes, and lists. JColorChoosers bound using the Bindings class will ignore ComponentValueModel state.
author:
   Karsten Lentzsch
version:
   $Revision: 1.11 $
See Also:   PresentationModel.getComponentModel(String)
See Also:   PresentationModel.getBufferedComponentModel(String)
See Also:   BasicComponentFactory
See Also:   Bindings
since:
   1.1



Field Summary
final public static  StringPROPERTYNAME_EDITABLE
     The name of the property used to synchronize this model with the editable property of JTextComponents.
final public static  StringPROPERTYNAME_ENABLED
     The name of the property used to synchronize this model with the enabled property of JComponents.
final public static  StringPROPERTYNAME_VISIBLE
     The name of the property used to synchronize this model with the visible property of JComponents.

Constructor Summary
public  ComponentValueModel(ValueModel subject)
     Constructs a ComponentValueModel for the given ValueModel.

Method Summary
public  ObjectgetValue()
     Returns this model's current subject value.
public  booleanisEditable()
     Returns if this model represents the editable or non-editable text component state.
public  booleanisEnabled()
     Returns if this model represents an enabled or disabled component state.
public  booleanisVisible()
     Returns if this model represents the visible or invisible component state.
public  voidsetEditable(boolean b)
     Sets this model state to editable or non-editable, which in turn will make all text components bound to this model editable or non-editable.
public  voidsetEnabled(boolean b)
     Enables or disabled this model, which in turn will enable or disable all Swing components bound to this model.
public  voidsetValue(Object newValue)
     Sets the given value as new subject value.
public  voidsetVisible(boolean b)
     Sets this model state to visible or invisible, which in turn will make all Swing components bound to this model visible or invisible.

Field Detail
PROPERTYNAME_EDITABLE
final public static String PROPERTYNAME_EDITABLE(Code)
The name of the property used to synchronize this model with the editable property of JTextComponents.



PROPERTYNAME_ENABLED
final public static String PROPERTYNAME_ENABLED(Code)
The name of the property used to synchronize this model with the enabled property of JComponents.



PROPERTYNAME_VISIBLE
final public static String PROPERTYNAME_VISIBLE(Code)
The name of the property used to synchronize this model with the visible property of JComponents.




Constructor Detail
ComponentValueModel
public ComponentValueModel(ValueModel subject)(Code)
Constructs a ComponentValueModel for the given ValueModel.
Parameters:
  subject - the underlying (or wrapped) ValueModel




Method Detail
getValue
public Object getValue()(Code)
Returns this model's current subject value. this model's current subject value.



isEditable
public boolean isEditable()(Code)
Returns if this model represents the editable or non-editable text component state. true for editable, false for non-editable



isEnabled
public boolean isEnabled()(Code)
Returns if this model represents an enabled or disabled component state. true for enabled, false for disabled



isVisible
public boolean isVisible()(Code)
Returns if this model represents the visible or invisible component state. true for visible, false for invisible



setEditable
public void setEditable(boolean b)(Code)
Sets this model state to editable or non-editable, which in turn will make all text components bound to this model editable or non-editable.
Parameters:
  b - true for editable, false for non-editable



setEnabled
public void setEnabled(boolean b)(Code)
Enables or disabled this model, which in turn will enable or disable all Swing components bound to this model.
Parameters:
  b - true to enable, false to disable.



setValue
public void setValue(Object newValue)(Code)
Sets the given value as new subject value.
Parameters:
  newValue - the value to set



setVisible
public void setVisible(boolean b)(Code)
Sets this model state to visible or invisible, which in turn will make all Swing components bound to this model visible or invisible.
Parameters:
  b - true for visible, false for invisible



Fields inherited from com.jgoodies.binding.value.AbstractValueModel
final public static String PROPERTYNAME_VALUE(Code)(Java Doc)

Methods inherited from com.jgoodies.binding.value.AbstractValueModel
final public void addValueChangeListener(PropertyChangeListener l)(Code)(Java Doc)
final public boolean booleanValue()(Code)(Java Doc)
final public double doubleValue()(Code)(Java Doc)
final public void fireValueChange(Object oldValue, Object newValue)(Code)(Java Doc)
final public void fireValueChange(Object oldValue, Object newValue, boolean checkIdentity)(Code)(Java Doc)
final public void fireValueChange(boolean oldValue, boolean newValue)(Code)(Java Doc)
final public void fireValueChange(int oldValue, int newValue)(Code)(Java Doc)
final public void fireValueChange(long oldValue, long newValue)(Code)(Java Doc)
final public void fireValueChange(double oldValue, double newValue)(Code)(Java Doc)
final public void fireValueChange(float oldValue, float newValue)(Code)(Java Doc)
final public float floatValue()(Code)(Java Doc)
public String getString()(Code)(Java Doc)
final public int intValue()(Code)(Java Doc)
final public long longValue()(Code)(Java Doc)
final public void removeValueChangeListener(PropertyChangeListener l)(Code)(Java Doc)
final public void setValue(boolean b)(Code)(Java Doc)
final public void setValue(double d)(Code)(Java Doc)
final public void setValue(float f)(Code)(Java Doc)
final public void setValue(int i)(Code)(Java Doc)
final public void setValue(long l)(Code)(Java Doc)
public String toString()(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.