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