001 /* 002 Copyright (C) 2001-2002 Renaud Pawlak, Laurent Martelli 003 004 This program is free software; you can redistribute it and/or modify 005 it under the terms of the GNU Lesser General Public License as 006 published by the Free Software Foundation; either version 2 of the 007 License, or (at your option) any later version. 008 009 This program is distributed in the hope that it will be useful, but 010 WITHOUT ANY WARRANTY; without even the implied warranty of 011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 012 Lesser General Public License for more details. 013 014 You should have received a copy of the GNU Lesser General Public 015 License along with this program; if not, write to the Free Software 016 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 017 USA */ 018 019 package org.objectweb.jac.aspects.gui; 020 021 import org.objectweb.jac.core.rtti.FieldItem; 022 import org.objectweb.jac.core.rtti.MethodItem; 023 024 public interface View extends ViewIdentity { 025 /** 026 * Sets the label (the identifier) of the view. 027 * 028 * @param label a string that identifies the view 029 */ 030 void setLabel(String label); 031 032 /** 033 * Gets the view's label (identifier). 034 * 035 * @return the view's label 036 */ 037 String getLabel(); 038 039 /** 040 * Sets a dynamic message to be displayed by the view when opened. 041 * 042 * @param method the method that returns a string to be dislayed 043 * @see #setDescription(String) 044 */ 045 void setMessage(MethodItem method); 046 047 /** 048 * Gets the dynamic message. 049 * 050 * @return the dynamic message 051 */ 052 MethodItem getMessage(); 053 054 /** 055 * Sets a static message to be display by the view when opened. 056 * 057 * @param description a string to be displayed as is 058 * @see #setMessage(MethodItem) 059 */ 060 void setDescription(String description); 061 062 /** 063 * Gets the description of this view. 064 * 065 * @return the description 066 */ 067 String getDescription(); 068 069 /** 070 * Sets the display context for this view. 071 * 072 * <p>The display context contains the factory that is used for 073 * this view. 074 */ 075 void setContext(DisplayContext context); 076 077 /** 078 * @return the DisplayContext of the view 079 */ 080 DisplayContext getContext(); 081 082 /** 083 * Sets the factory for this view (WEB, SWING or other supported 084 * factory). 085 */ 086 void setFactory(ViewFactory factory); 087 088 /** 089 * Gets the factory. 090 */ 091 ViewFactory getFactory(); 092 093 /** 094 * Sets the prefered width for this view. */ 095 void setWidth(int width); 096 097 /** 098 * Sets the prefered height for this view. 099 */ 100 void setHeight(int height); 101 102 /** 103 * Close this view. This should be upcalled when the view is closed 104 * in order to free resources or close other dependant views. 105 * 106 * @param commit wether to validate any value contained in editors. 107 */ 108 void close(boolean validate); 109 110 /** 111 * Tells if this view has been closed by the GUI or the user. 112 */ 113 boolean isClosed(); 114 115 /** 116 * Validate this view: its content may be saved when this method is 117 * upcalled. 118 */ 119 //void validate(); 120 121 /** 122 * Sets the view style. The style can be exploited in different 123 * maners depending on the GUI supports (e.g. with CSS for the 124 * WEB). Styles are user-defined. 125 */ 126 void setStyle(String style); 127 128 /** 129 * Gets the user-defined style for this view. 130 * 131 * @return the style, null if undefined 132 */ 133 String getStyle(); 134 135 /** 136 * Sets a border for this view. 137 */ 138 void setViewBorder(Border border); 139 140 /** 141 * Gets the border for this view. 142 * 143 * @return the border, null if undefined 144 */ 145 Border getViewBorder(); 146 147 /** 148 * Sets the parent view of this view (a composite view). 149 * 150 * @see CompositeView 151 */ 152 void setParentView(View view); 153 154 /** 155 * Gets the parent view of this view. 156 * 157 * @see CompositeView 158 */ 159 View getParentView(); 160 161 /** 162 * Gets the ancestor view whose parent is null 163 */ 164 View getRootView(); 165 166 /** 167 * Tells wether this view has a given view in its ancestors 168 * @param ancestor the ancestor 169 */ 170 boolean isDescendantOf(View ancestor); 171 172 /** 173 * Focus a field of an object's view. 174 * 175 * @param field the field to focus 176 * @param option an extra option 177 */ 178 void setFocus(FieldItem field, Object option); 179 }