Java Doc for Controller.java in  » Science » jcm1-source » edu » hws » jcm » awt » 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 » Science » jcm1 source » edu.hws.jcm.awt 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   edu.hws.jcm.awt.Controller

Controller
public class Controller implements java.io.Serializable,Computable,InputObject,AdjustmentListener,ActionListener,TextListener,ItemListener(Code)
Controllers are the focus of all the action in the JCM system. A Controller can be set to listen for changes (generally changes in user input). This is done by registering the Controller with (usally) an InputObject. For example, if a Controller, c, is to respond when the user presses return in a VariableInput, v, then v.setOnUserAction(c) should be called to arrange to have the Controller listen for such actions. VariableSliders, ExpressionInputs, MouseTrackers, Animators have a similar methods. It is also possible to set the Controller to listen for events of type AdjustmentEvent, ActionEvent, TextEvent, or ItemEvent (but this feature is left over from an older version of JCM, and I'm not sure whether it's necessary). Whenever a Controller learns of some change, it will process any InputObjects, Ties, and Computables that have been registered with it.

InputObjects and Computables have to be added to a Controller to be processed, using the Controller's add method. (If you build your inteface out of JCMPanels, then this is done automatically.) (Note that an InputObject is added to a Controller to have its value checked -- This is separate from registering the Controller to listen for changes in the InputObject. Often, you have to do both.) The gatherInputs() method in class JCMPanel can be used to do most of this registration automaticaly.

A Tie that synchronizes two or more Values, to be effective, has to be added to a Controller. See the Tie class for inforamtion about what Ties are and how they are used.

A Controller can have an associated ErrorReporter, which is used to report any errors that occur during the processing. Currently, an ErrorReporter is either a DisplayCanvas or a MessagePopup.

A Controller can be added to another Controller, which then becomes a sub-controller. Whenever the main Controller hears some action, it also notifies all its sub-controllers about the action. Furthermore, it can report errors that occur in the sub-controllers, if they don't have their own error reporters. (Usually, you will just set an error reporter for the top-level Controller.)



Field Summary
protected  Vectorcomputables
     Computable objects controlled by this controller.
protected  StringerrorMessage
     If non-null, this is an error message that has been reported and not yet cleared.
protected  ErrorReportererrorReporter
     Used for reporting errors that occur in the compute() method of this controller.
protected  Vectorinputs
     InputObjects controlled by this controller.
protected  Controllerparent
     The parent of this controller, if any.
protected  Vectorties
     Ties that have been added to this controller.

Constructor Summary
public  Controller()
     Create a Controller.

Method Summary
public  voidactionPerformed(ActionEvent evt)
     Simply calls compute when the Controller hears an ActionEvent.
public  voidadd(Object obj)
     Add an object to be controlled by this controller.
public  voidadjustmentValueChanged(AdjustmentEvent evt)
     Simply calls compute when the Controller hears an AdjustmantEvent.
public  voidcheckInput()
     Call checkInput() of each InputObject.
protected  voidclearErrorMessage()
     Clear the error message.
public synchronized  voidcompute()
     When an contoller computes, it first calls checkInput() for any InputOjects that it controls (including those in sub-controllers). It then handles any Ties.
protected  voiddoCompute()
     Compute the Computables in this controller and its sub-controllers.
protected  voiddoTies()
     Check the Ties in this controller and its sub-controllers.
public  voiderrorCleared()
     Should be called by the ErrorReporter if the ErrorReporter clears the error itself.
public  voidgatherInputs()
     Calles notifyControllerOnChange(this).
public  ErrorReportergetErrorReporter()
     Get the ErrorReporter for this Controller.
public  voiditemStateChanged(ItemEvent evt)
     Simply calls compute when the Controller hears an ItemEvent.
public  voidnotifyControllerOnChange(Controller c)
     Method required by InputObject interface; in this class, calls the same method recursively on any input objects controlled by this controller.
public  voidremove(Object obj)
     Remove the object from the controller (if present).
public  voidremoveFromParent()
     If this controller has a parent, remove it from its parent.
public  voidreportError(String message)
     Report the specified error message.
public  voidsetErrorReporter(ErrorReporter r)
     Set the ErrorReporter used to report errors that occur when the compute() method of this Controller is executed.
public  voidtextValueChanged(TextEvent evt)
     Simply calls compute when the Controller hears a TextEvent.

Field Detail
computables
protected Vector computables(Code)
Computable objects controlled by this controller. Note that Controllers are Computables, so this list can include sub-controllers.



errorMessage
protected String errorMessage(Code)
If non-null, this is an error message that has been reported and not yet cleared.



errorReporter
protected ErrorReporter errorReporter(Code)
Used for reporting errors that occur in the compute() method of this controller. If the errorReporter is null and if this controller has a parent, then the parent will report the error. If no ancestor has an errorReporter, the error message is written to standard output.



inputs
protected Vector inputs(Code)
InputObjects controlled by this controller. Note that Controllers are InputObjects, so this list can include sub-controllers.



parent
protected Controller parent(Code)
The parent of this controller, if any. This is set automatically when one controller is added to another.



ties
protected Vector ties(Code)
Ties that have been added to this controller.




Constructor Detail
Controller
public Controller()(Code)
Create a Controller.




Method Detail
actionPerformed
public void actionPerformed(ActionEvent evt)(Code)
Simply calls compute when the Controller hears an ActionEvent. This is not meant to be called directly.



add
public void add(Object obj)(Code)
Add an object to be controlled by this controller. It should be of one or more of the types InputObject, Computable, Tie. If it is a Controller, then this Controller becomes its parent.



adjustmentValueChanged
public void adjustmentValueChanged(AdjustmentEvent evt)(Code)
Simply calls compute when the Controller hears an AdjustmantEvent. This is not meant to be called directly.



checkInput
public void checkInput()(Code)
Call checkInput() of each InputObject. Can throw a JCMError. This is mostly meant to be called by Controller.compute(). Note that this will recurse though any sub-controllers of this controller, so that when comput() is called, all the InputObjects in the sub-controllers are processed before ANY Tie or Computable is processed. Similarly, the Ties and Computables in the sub-controllers are processed in separate passes.



clearErrorMessage
protected void clearErrorMessage()(Code)
Clear the error message.



compute
public synchronized void compute()(Code)
When an contoller computes, it first calls checkInput() for any InputOjects that it controls (including those in sub-controllers). It then handles any Ties. Finally, it calls the compute() method of any Computables. If an error occurs, it reports it. JCMErrors (which should represent errors on the part of the user) will generally only occur during the checkInput() phase. Internal, programmer errors can occur at any time and might leave the sytem in an unhappy state. They are reported as debugging aids for the programmer. When one occurs, a stack trace is printed to standard output.



doCompute
protected void doCompute()(Code)
Compute the Computables in this controller and its sub-controllers.



doTies
protected void doTies()(Code)
Check the Ties in this controller and its sub-controllers.



errorCleared
public void errorCleared()(Code)
Should be called by the ErrorReporter if the ErrorReporter clears the error itself. (This is only used to avoid repeatedly setting the same error message, during an animation for example.)



gatherInputs
public void gatherInputs()(Code)
Calles notifyControllerOnChange(this). That is, it sets all the InputObjects in this Controller, and in subcontrollers, to notify this Controller when they change.



getErrorReporter
public ErrorReporter getErrorReporter()(Code)
Get the ErrorReporter for this Controller. Return null if there is none.



itemStateChanged
public void itemStateChanged(ItemEvent evt)(Code)
Simply calls compute when the Controller hears an ItemEvent. This is not meant to be called directly.



notifyControllerOnChange
public void notifyControllerOnChange(Controller c)(Code)
Method required by InputObject interface; in this class, calls the same method recursively on any input objects controlled by this controller. This is meant to be called by JCMPanel.gatherInputs().



remove
public void remove(Object obj)(Code)
Remove the object from the controller (if present).



removeFromParent
public void removeFromParent()(Code)
If this controller has a parent, remove it from its parent. (Then, a call to the former parent's compute() method will not call this controller's compute().)



reportError
public void reportError(String message)(Code)
Report the specified error message.



setErrorReporter
public void setErrorReporter(ErrorReporter r)(Code)
Set the ErrorReporter used to report errors that occur when the compute() method of this Controller is executed.



textValueChanged
public void textValueChanged(TextEvent evt)(Code)
Simply calls compute when the Controller hears a TextEvent. This is not meant to be called directly.



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.