1*1b0aaa91SAndrew Rist /**************************************************************
2*1b0aaa91SAndrew Rist  *
3*1b0aaa91SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*1b0aaa91SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*1b0aaa91SAndrew Rist  * distributed with this work for additional information
6*1b0aaa91SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*1b0aaa91SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*1b0aaa91SAndrew Rist  * "License"); you may not use this file except in compliance
9*1b0aaa91SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*1b0aaa91SAndrew Rist  *
11*1b0aaa91SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*1b0aaa91SAndrew Rist  *
13*1b0aaa91SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*1b0aaa91SAndrew Rist  * software distributed under the License is distributed on an
15*1b0aaa91SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*1b0aaa91SAndrew Rist  * KIND, either express or implied.  See the License for the
17*1b0aaa91SAndrew Rist  * specific language governing permissions and limitations
18*1b0aaa91SAndrew Rist  * under the License.
19*1b0aaa91SAndrew Rist  *
20*1b0aaa91SAndrew Rist  *************************************************************/
21*1b0aaa91SAndrew Rist 
22cdf0e10cSrcweir package ov;
23cdf0e10cSrcweir 
24cdf0e10cSrcweir import javax.swing.JPanel;
25cdf0e10cSrcweir 
26cdf0e10cSrcweir import com.sun.star.accessibility.XAccessibleContext;
27cdf0e10cSrcweir 
28cdf0e10cSrcweir /** This is the base class for all object views that can be placed inside an
29cdf0e10cSrcweir     object view container.
30cdf0e10cSrcweir 
31cdf0e10cSrcweir     <p>When provided with a new accessible object the container will call
32cdf0e10cSrcweir     the Create method to create a new instance when certain conditions are
33cdf0e10cSrcweir     met.  It then calls SetObject to pass the object to the instance.
34cdf0e10cSrcweir     Finally it calls Update.</p>
35cdf0e10cSrcweir 
36cdf0e10cSrcweir     <p>The SetObject and Update methods may be called for a new object
37cdf0e10cSrcweir     without calling Create first.  In this way an existing instance is
38cdf0e10cSrcweir     recycled.</p>
39cdf0e10cSrcweir */
40cdf0e10cSrcweir abstract public class ObjectView
41cdf0e10cSrcweir     extends JPanel
42cdf0e10cSrcweir {
43cdf0e10cSrcweir     /** This factory method creates a new instance of the (derived) class
44cdf0e10cSrcweir         when the given accessible object supports all necessary features.
45cdf0e10cSrcweir         In the ususal case this will be the support of a specific
46cdf0e10cSrcweir         accessibility interface.
47cdf0e10cSrcweir     */
Create( ObjectViewContainer aContainer, XAccessibleContext xContext)48cdf0e10cSrcweir     static public ObjectView Create (
49cdf0e10cSrcweir         ObjectViewContainer aContainer,
50cdf0e10cSrcweir         XAccessibleContext xContext)
51cdf0e10cSrcweir     {
52cdf0e10cSrcweir         return null;
53cdf0e10cSrcweir     }
54cdf0e10cSrcweir 
ObjectView(ObjectViewContainer aContainer)55cdf0e10cSrcweir     public ObjectView (ObjectViewContainer aContainer)
56cdf0e10cSrcweir     {
57cdf0e10cSrcweir         maContainer = aContainer;
58cdf0e10cSrcweir         mxContext = null;
59cdf0e10cSrcweir     }
60cdf0e10cSrcweir 
61cdf0e10cSrcweir     /** Call this when you want the object to be destroyed.  Release all
62cdf0e10cSrcweir         resources when called.
63cdf0e10cSrcweir     */
Destroy()64cdf0e10cSrcweir     public void Destroy ()
65cdf0e10cSrcweir     {
66cdf0e10cSrcweir     }
67cdf0e10cSrcweir 
68cdf0e10cSrcweir     /** Tell the view to display information for a new accessible object.
69cdf0e10cSrcweir         @param xObject
70cdf0e10cSrcweir             The given object may be null.  A typical behaviour in this case
71cdf0e10cSrcweir             would be to display a blank area.  But is also possible to show
72cdf0e10cSrcweir             information about the last object.
73cdf0e10cSrcweir     */
SetObject(XAccessibleContext xContext)74cdf0e10cSrcweir     public void SetObject (XAccessibleContext xContext)
75cdf0e10cSrcweir     {
76cdf0e10cSrcweir         mxContext = xContext;
77cdf0e10cSrcweir         Update ();
78cdf0e10cSrcweir     }
79cdf0e10cSrcweir 
80cdf0e10cSrcweir 
81cdf0e10cSrcweir     /** This is a request of a repaint with the current state of the current
82cdf0e10cSrcweir         object.  The current object may or may not be the same as the one
83cdf0e10cSrcweir         when Update() was called the last time.
84cdf0e10cSrcweir     */
Update()85cdf0e10cSrcweir     public void Update ()
86cdf0e10cSrcweir     {
87cdf0e10cSrcweir     }
88cdf0e10cSrcweir 
89cdf0e10cSrcweir 
90cdf0e10cSrcweir     /** Return a string that is used as a title of an enclosing frame.
91cdf0e10cSrcweir     */
GetTitle()92cdf0e10cSrcweir     abstract public String GetTitle ();
93cdf0e10cSrcweir 
94cdf0e10cSrcweir     /// Reference to the current object to display information about.
95cdf0e10cSrcweir     protected XAccessibleContext mxContext;
96cdf0e10cSrcweir 
97cdf0e10cSrcweir     protected ObjectViewContainer maContainer;
98cdf0e10cSrcweir }
99