1 package ov;
2 
3 import javax.swing.JPanel;
4 
5 import com.sun.star.accessibility.XAccessibleContext;
6 
7 /** This is the base class for all object views that can be placed inside an
8     object view container.
9 
10     <p>When provided with a new accessible object the container will call
11     the Create method to create a new instance when certain conditions are
12     met.  It then calls SetObject to pass the object to the instance.
13     Finally it calls Update.</p>
14 
15     <p>The SetObject and Update methods may be called for a new object
16     without calling Create first.  In this way an existing instance is
17     recycled.</p>
18 */
19 abstract public class ObjectView
20     extends JPanel
21 {
22     /** This factory method creates a new instance of the (derived) class
23         when the given accessible object supports all necessary features.
24         In the ususal case this will be the support of a specific
25         accessibility interface.
26     */
27     static public ObjectView Create (
28         ObjectViewContainer aContainer,
29         XAccessibleContext xContext)
30     {
31         return null;
32     }
33 
34     public ObjectView (ObjectViewContainer aContainer)
35     {
36         maContainer = aContainer;
37         mxContext = null;
38     }
39 
40     /** Call this when you want the object to be destroyed.  Release all
41         resources when called.
42     */
43     public void Destroy ()
44     {
45     }
46 
47     /** Tell the view to display information for a new accessible object.
48         @param xObject
49             The given object may be null.  A typical behaviour in this case
50             would be to display a blank area.  But is also possible to show
51             information about the last object.
52     */
53     public void SetObject (XAccessibleContext xContext)
54     {
55         mxContext = xContext;
56         Update ();
57     }
58 
59 
60     /** This is a request of a repaint with the current state of the current
61         object.  The current object may or may not be the same as the one
62         when Update() was called the last time.
63     */
64     public void Update ()
65     {
66     }
67 
68 
69     /** Return a string that is used as a title of an enclosing frame.
70     */
71     abstract public String GetTitle ();
72 
73     /// Reference to the current object to display information about.
74     protected XAccessibleContext mxContext;
75 
76     protected ObjectViewContainer maContainer;
77 }
78