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