1// BEGIN LICENSE BLOCK 2// Version: CMPL 1.1 3// 4// The contents of this file are subject to the Cisco-style Mozilla Public 5// License Version 1.1 (the "License"); you may not use this file except 6// in compliance with the License. You may obtain a copy of the License 7// at www.eclipse-clp.org/license. 8// 9// Software distributed under the License is distributed on an "AS IS" 10// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See 11// the License for the specific language governing rights and limitations 12// under the License. 13// 14// The Original Code is The ECLiPSe Constraint Logic Programming System. 15// The Initial Developer of the Original Code is Cisco Systems, Inc. 16// Portions created by the Initial Developer are 17// Copyright (C) 2006 Cisco Systems, Inc. All Rights Reserved. 18// 19// Contributor(s): 20// 21// END LICENSE BLOCK 22 23package com.parctechnologies.eclipse.visualisation; 24 25import com.parctechnologies.eclipse.*; 26import java.awt.Component; 27import java.beans.PropertyChangeSupport; 28import java.util.Collection; 29 30/** 31 * A Viewlet is a Java object which monitors one viewable element within a 32 * viewable. The viewlet is contained within a ContainerViewer. Each viewlet 33 * implements a number of methods which are invoked by the ContainerViewer so 34 * that the viewlet is initialised properly and reacts properly to events 35 * relating to the viewable element it is monitoring. These methods are: 36 * <ul> 37 * <li>setElementReference: the element reference is an object which the 38 * viewlet uses when composing its pre-Build or pre-Update goal. When 39 * implementing the collect...Goal methods, the elementReference should be 40 * thought of as the ECLiPSe term which is the viewable element that the 41 * viewlet is monitoring. In fact, the elementReference is a structure which is 42 * <em>replaced</em> with this term during execution of 43 * <code>viewable_element_execute/3</code> in the vc_support library. 44 * <li>collectPreBuildGoal: used to produce the goal which the viewlet needs 45 * executed in order to first initialise. 46 * <li>startBuild: used to initialise the viewlet given the results of the 47 * pre-build goal. 48 * <li>stopBuild: used to complete the initialisation process. 49 * <li>collectPreUpdateGoal: used to produce the goal which the viewlet needs 50 * executed in order to react to an update in the element it is monitoring. 51 * <li>startUpdate: used to indicate to the viewlet that an update to the 52 * element it is monitoring has started 53 * <li>stopUpdate: used to indicate that the update is complete. 54 * </ul><p> 55 * Then there are some other methods which are more related to the Viewlet's 56 * graphical user interface: 57 * <ul> 58 * <li>get/setSelected: if the viewlet is selected then the next viewlet action 59 * performed by the user will apply to it. 60 * <li>getUpdating: true if the viewlet is in an UpdateEvent 61 * <li>getDescription: gets a text description of the viewlet. 62 * <li>getPropertyChangeSupport: the propertyChangeSupport object is used to 63 * observe various properties of the viewlet. 64 * <li>getHoldsOnUpdates: true if the viewlet asks for control to be retained 65 * when the viewable element it is monitoring is updated. 66 * <li>getActions: return a Collection of ViewletAction objects which represents 67 * the set of actions which may be performed on this viewlet. 68 * <li>getComponent: get the GUI component which will represent the viewlet. 69 * </ul> 70 */ 71public interface Viewlet extends SymRefable 72{ 73 CompoundTerm collectPreBuildGoal(); 74 75 void startBuild(CompoundTerm goalResults); 76 77 void stopBuild(); 78 79 CompoundTerm collectPreUpdateGoal(UpdateEvent updateEvent); 80 81 void startUpdate(UpdateEvent updateEvent, CompoundTerm goalResults); 82 83 void stopUpdate(); 84 85 boolean getHoldsOnUpdates(); 86 87 boolean getSelected(); 88 89 void setSelected(boolean newValue); 90 91 void setElementReference(Object elementReference); 92 93 String getUpdating(); 94 95 String getDescription(); 96 97 Component getComponent(); 98 99 Collection getActions(); 100 101 PropertyChangeSupport getPropertyChangeSupport(); 102} 103 104