KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > fractal > gui > UserData


1 /***
2  * FractalGUI: a graphical tool to edit Fractal component configurations.
3  * Copyright (C) 2003 France Telecom R&D
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  *
19  * Contact: fractal@objectweb.org
20  *
21  * Authors: Eric Bruneton, Patrice Fauvel
22  */

23
24 package org.objectweb.fractal.gui;
25
26 public interface UserData
27 {
28   final static int CURRENT_DEPTH = 0;
29   final static int CURRENT_WIDTH = 1;
30   final static int CURRENT_HEIGHT = 2;
31   final static int CURRENT_CONFIG = 3;
32
33   final static int LAST_OPEN_DIR = 10;
34   final static int LAST_SAVE_DIR = 11;
35   final static int LAST_OPEN_CONF = 12;
36   final static int LAST_OPEN_FILE = 13;
37   final static int LAST_SAVE_FILE = 14;
38   final static int LAST_EXEC_DIR = 15;
39
40   final static int NB_DIR = 6;
41   final static int START_INDEX = 10;
42
43   final static int NO_MODIFIED = 0;
44   final static int MODIFIED = 1;
45
46   /**
47    * Open the file which contains all registered User Data. If this file doesn't
48    * exist, a new empty file is created.
49    *
50    */

51   void open ();
52
53   /**
54    * Save all registered data in the file of the user. If this file doesn't
55    * exist, a new empty file is created.
56    *
57    */

58   void save ();
59
60   /**
61    * Clean the user's data
62    */

63   void clean ();
64
65   /**
66    * set the value for a given type. The type must belong to the CURRENT_
67    * family type.
68    *
69    * @param typ is the Data type.
70    * @param v is the int value for the type.
71    */

72   void setIntData (int typ, int v) throws Exception JavaDoc;
73
74   /**
75    * get the int value for a given type. The type must belong to the CURRENT_
76    * family type.
77    * or else an Exception is thrown.
78    *
79    * @param typ is the Data type.
80    * @return the int data according to the <b>typ</b>
81    */

82   int getIntData (int typ) throws Exception JavaDoc;
83
84   /**
85    * set the value for a given type. The type must belong to the LAST_ family
86    * type.
87    *
88    * @param typ is the Data type.
89    * @param s is the String value for the type.
90    */

91   void setStringData (int typ, String JavaDoc s) throws Exception JavaDoc;
92
93   /**
94    * get the int value for a given type. The type must belong to the LAST_
95    * family type or else an Exception is thrown.
96    *
97    * @param typ is the Data type.
98    * @return the String data according to the <b>typ</b>
99    */

100   String JavaDoc getStringData (int typ) throws Exception JavaDoc;
101
102   /**
103    * Adds a new FProject to the project list. If the project already exists,
104    * nothing is done.
105    *
106    * @param id is the Data type.
107    * @return <b>true</b> if the FProject exist, <b>false</b> otherwise.
108    */

109   boolean projectExists (int id);
110
111   /**
112    * Adds a new FProject to the project list. If the project already exists,
113    * nothing is done.
114    * If thomething goes wrong an Exception is thrown.
115    *
116    * @param proj is the FProject to add.
117    */

118   void addProject (FProject proj) throws Exception JavaDoc;
119
120   /**
121    * Removes the FProject with specified <b>id</b> from the project list.
122    * If the project doesn't exist, nothing is done.
123    *
124    * @param id is the FProject id to remove.
125    */

126   void removeProject (int id);
127
128   /**
129    * Adds a new FProject to the project list. If the project already exists,
130    * nothing is done.
131    * If thomething goes wrong an Exception is thrown.
132    *
133    * @param id is the FProject identifier.
134    * @return the FProject if exists or null otherwise.
135    */

136   FProject getProject (int id);
137
138   /**
139    * Asks for a new FProject.
140    *
141    * @return the new FProject
142    */

143   FProject getNewProject ();
144
145   /* ------------------------------------------------------------- */
146
147   public interface FProject {
148
149     /**
150      * set the id for the project
151      *
152      * @param id is the Data type.
153      */

154     void setId (int id);
155
156     /**
157      * get the id of the project
158      *
159      * @return the identifier of the FRroject.
160      */

161     int getId ();
162
163     /**
164      * set the value for a given type. The type must belong to the LAST_ family
165      * type.
166      *
167      * @param typ is the Data type.
168      * @param v is the String value for the type.
169      */

170     void setStringData (int typ, String JavaDoc s) throws Exception JavaDoc;
171
172     /**
173      * get the int value for a given type. The type must belong to the LAST_
174      * family type or else an Exception is thrown.
175      *
176      * @param typ is the Data type.
177      */

178     String JavaDoc getStringData (int typ) throws Exception JavaDoc;
179   }
180 }
181
Popular Tags