Statistics
| Revision:

svn-gvsig-desktop / trunk / frameworks / _fwAndami / src / com / iver / andami / plugins / status / IUnsavedData.java @ 12697

History | View | Annotate | Download (3.67 KB)

1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
*
3
* Copyright (C) 2007 IVER T.I. and Generalitat Valenciana.
4
*
5
* This program is free software; you can redistribute it and/or
6
* modify it under the terms of the GNU General Public License
7
* as published by the Free Software Foundation; either version 2
8
* of the License, or (at your option) any later version.
9
*
10
* This program 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
13
* GNU General Public License for more details.
14
*
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
*
19
* For more information, contact:
20
*
21
*  Generalitat Valenciana
22
*   Conselleria d'Infraestructures i Transport
23
*   Av. Blasco Ib??ez, 50
24
*   46010 VALENCIA
25
*   SPAIN
26
*
27
*      +34 963862235
28
*   gvsig@gva.es
29
*      www.gvsig.gva.es
30
*
31
*    or
32
*
33
*   IVER T.I. S.A
34
*   Salamanca 50
35
*   46005 Valencia
36
*   Spain
37
*
38
*   +34 963163400
39
*   dac@iver.es
40
*/
41
package com.iver.andami.plugins.status;
42

    
43
import javax.swing.ImageIcon;
44

    
45
import com.iver.andami.plugins.IExtension;
46

    
47

    
48
/**
49
 * <p>This interface represents some unsaved data, associated to one extension.
50
 * There are methods to get the associated extension, to get info about these
51
 * data, to get the type of the data and a suitable icon for this type,
52
 * and a method to save the data.</p>
53
 * 
54
 * <p>It is used during the Andami termination process, to construct the
55
 * dialog of unsaved data, although it can be used at any time.</p>
56
 * 
57
 * <p>Normally, it should not be directly implemented, use the convenience
58
 * UnsavedData class.</p>
59
 * 
60
 * @see IExtensionStatus
61
 * @see UnsavedData
62
 * @see IExtension
63
 * @author Cesar Martinez Izquierdo <cesar.martinez@iver.es>
64
 */
65
public interface IUnsavedData {
66

    
67
        /**
68
         * Gets the resource name of this unsaved data. Normally, this will be
69
         * a file path, but it may be different for certain type of unsaved data
70
         * (for example, database connections).
71
         * 
72
         * @return The resource name of this unsaved data
73
         */
74
        public String getResourceName();
75
        
76
        /**
77
         * <p>Gets a description of this unsaved data. This would be combined with the
78
         * resource name to show a coherent information to the user.</p>
79
         * 
80
         * <p>Examples of descriptions:
81
         * <ul><li>Modified SHP Layer</li>
82
         * <li>Modified gvSIG project</li>
83
         * </ul>
84
         * 
85
         * @return A description for this unsaved data, probably containing the type
86
         * of data and the kind of modification.
87
         */
88
        public String getDescription();
89
        
90
        /**
91
         * <p>Save the existing changes for this resource (for example, save the layer
92
         * to disk or to the database, etc). The resource should not be closed at this
93
         * point (files, database connections, etc should no be closed), as they may
94
         * be still needed by other extensions. Resources should be closed at
95
         * {@link IExtension#terminate()}.</p>
96
         * 
97
         * @return true if the data was correctly saved, false if it was not saved
98
         * (there are many reasons for this: there was an error, the user cancelled
99
         * the process, etc).
100
         */
101
        public boolean saveData();
102

    
103
        /**
104
         * Each IUnsavedData object is associated with one extension, which is
105
         * in charge of this data. This method gets the extension associated with
106
         * this object.
107
         * 
108
         * @return The extension associated with this IUnsavedData object.
109
         */
110
        public IExtension getExtension();
111
        
112
        /**
113
         * Gets an icon suitable to represent this type of data.
114
         * 
115
         * @return An icon representing this type of data, or null if no icon is
116
         * available
117
         */
118
        public ImageIcon getIcon();
119
        
120
}