Java Doc for ComponentHandler.java in  » Swing-Library » Hitch » com » silvermindsoftware » hitch » handlers » component » 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 » Hitch » com.silvermindsoftware.hitch.handlers.component 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


com.silvermindsoftware.hitch.handlers.component.ComponentHandler

ComponentHandler
public interface ComponentHandler (Code)




Method Summary
public  MethodgetComponentGetter(ComponentType component)
     This is the name of the method that retrieves the value from the component.
public  MethodgetComponentSetter(ComponentType component)
     This is the name of the method that sets the value on the component.
public  booleangetDefaultReadOnly()
     This method provides the default read only state for this component.
public  booleanisPopulateHandleable(ComponentType component, ModelType modelPropertyValue)
     This method should check for certain conditions that determine whether population should even occur for this component.
public  booleanisUpdateHandleable(ComponentType component)
     This method should check for certain conditions that determine whether an update of the model should even occur from this component.
public  voidpostProcessPopulate(ComponentType component)
     This method handles post processing of a populate.
public  voidpostProcessUpdate(ComponentType component)
     This method handles post processing of an update.
public  UITypepreProcessPopulate(ComponentType component, ModelType modelPropertyValue)
    

Right up front let's make it clear that you should not use this method for performing type conversion

This method is meant to massage existing data into a state that can be converted.

public  ModelTypepreProcessUpdate(ComponentType component, UIType modelPropertyValue)
    

Right up front let's make it clear that you should not use this method for performing type conversion

Just like @see #preProcessPopulate the preProcessUpdate method is meant to massage data into a state that can be converted.




Method Detail
getComponentGetter
public Method getComponentGetter(ComponentType component)(Code)
This is the name of the method that retrieves the value from the component. The method name should be spelled out completely. For example if the component is JTextField this method would return "getText". If the occasion ever requires it you may pass different values back from this method @see #getComponentSetter for example.
Parameters:
  component -



getComponentSetter
public Method getComponentSetter(ComponentType component)(Code)
This is the name of the method that sets the value on the component. The method name should be spelled out completely. For example if the component is JTextField this method would return "setText". If the occasion ever requires it you may pass different values back from this method @see JComboBoxComponentHandler#getSetterName.

Example from JComboBoxComponentHandler

 public class JComboBoxComponentHandler
 extends AbstractComponentHandler
 implements ComponentHandler
 {
 ...
 protected String getSetterName() {
 if (compareProperties != null && compareProperties.length > 0) {
 return "setSelectedIndex";
 } else {
 return "setSelectedItem";
 }
 ...
 }
 

Parameters:
  component -



getDefaultReadOnly
public boolean getDefaultReadOnly()(Code)
This method provides the default read only state for this component. For example, the JLabel is generally used as a read only component so its default is set to true.

 public class JLabelComponentHandler extends TextComponentHandler {
 public boolean getDefaultReadOnly() {
 return true;
 }
 }
 



isPopulateHandleable
public boolean isPopulateHandleable(ComponentType component, ModelType modelPropertyValue)(Code)
This method should check for certain conditions that determine whether population should even occur for this component.

Example from JListComponentHandler:

 public class JListComponentHandler
 extends AbstractComponentHandler
 implements ComponentHandler {
 ...
 public boolean isPopulateHandleable(JList component, Object modelPropertyValue) {
 return modelPropertyValue != null;
 }
 ...
 }
 

Parameters:
  component -
Parameters:
  modelPropertyValue -



isUpdateHandleable
public boolean isUpdateHandleable(ComponentType component)(Code)
This method should check for certain conditions that determine whether an update of the model should even occur from this component. There is currently no scenario in hitch where this is required. It was added as a counterpart to #isPopulateHandleable in the anticipation that it may be useful for developers who create custom component handlers.
Parameters:
  component -



postProcessPopulate
public void postProcessPopulate(ComponentType component)(Code)
This method handles post processing of a populate. There is currently no scenario in hitch where this is required. It was added as a counterpart to #preProcessPopulate in the anticipation that it may be useful for developers who create custom component handlers.
Parameters:
  component -



postProcessUpdate
public void postProcessUpdate(ComponentType component)(Code)
This method handles post processing of an update. There is currently no scenario in hitch where this is required. It was added as a counterpart to #preProcessUpdate in the anticipation that it may be useful for developers who create custom component handlers.
Parameters:
  component -



preProcessPopulate
public UIType preProcessPopulate(ComponentType component, ModelType modelPropertyValue)(Code)

Right up front let's make it clear that you should not use this method for performing type conversion

This method is meant to massage existing data into a state that can be converted. Let's take a look at the TextComponentHandler. You can see that the TextComponentHandler examines if the modelPropertyValue is null and if it is alters it's representation to an empty String. The reason for this is that JTextField will display a null as 'null' and that is undesireable. It would not be appropriate to deal with this in a TypeHandler. For a more complex example you can take a look at the @see JComboBoxComponentHandler#preProcessPopulate which is a very involved implementation.

TextComponent Handler Example

 public class TextComponentHandler
 extends AbstractComponentHandler
 implements ComponentHandler
 {
 ...
 public Object preProcessPopulate(JComponent component, Object modelPropertyValue) {
 return modelPropertyValue == null ? "" : modelPropertyValue;
 }
 ...
 }
 

Parameters:
  component -
Parameters:
  modelPropertyValue -



preProcessUpdate
public ModelType preProcessUpdate(ComponentType component, UIType modelPropertyValue)(Code)

Right up front let's make it clear that you should not use this method for performing type conversion

Just like @see #preProcessPopulate the preProcessUpdate method is meant to massage data into a state that can be converted.

Following is an example of preProcessUpdate as used in the JListComponentHandler
 public class JListComponentHandler
 extends AbstractComponentHandler
 implements ComponentHandler {
 ...
 public Object preProcessUpdate(JList component, Object formFieldValue) {
 // if a single selection return a single object
 if (component.getSelectionMode() == ListSelectionModel.SINGLE_SELECTION) {
 Object[] selectedValues = (Object[]) formFieldValue;
 if (selectedValues.length == 0) {
 return null;
 } else {
 return selectedValues[0];
 }
 } else {
 //otherwise return an array
 return formFieldValue;
 }
 }
 ...
 }
 

Parameters:
  component -
Parameters:
  modelPropertyValue -



www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.