Statistics
| Revision:

svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.framework / org.gvsig.andami / src / main / java / org / gvsig / andami / plugins / status / IUnsavedData.java @ 40596

History | View | Annotate | Download (3.45 KB)

1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright (C) 2007-2013 gvSIG Association.
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 3
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23
 */
24
package org.gvsig.andami.plugins.status;
25

    
26
import javax.swing.ImageIcon;
27

    
28
import org.gvsig.andami.plugins.IExtension;
29

    
30

    
31

    
32
/**
33
 * <p>This interface represents some unsaved data, associated to one extension.
34
 * There are methods to get the associated extension, to get info about these
35
 * data, to get the type of the data and a suitable icon for this type,
36
 * and a method to save the data.</p>
37
 * 
38
 * <p>It is used during the Andami termination process, to construct the
39
 * dialog of unsaved data, although it can be used at any time.</p>
40
 * 
41
 * <p>Normally, it should not be directly implemented, use the convenience
42
 * UnsavedData class.</p>
43
 * 
44
 * @see IExtensionStatus
45
 * @see UnsavedData
46
 * @see IExtension
47
 * @author Cesar Martinez Izquierdo <cesar.martinez@iver.es>
48
 */
49
public interface IUnsavedData {
50

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

    
87
        /**
88
         * Each IUnsavedData object is associated with one extension, which is
89
         * in charge of this data. This method gets the extension associated with
90
         * this object.
91
         * 
92
         * @return The extension associated with this IUnsavedData object.
93
         */
94
        public IExtension getExtension();
95
        
96
        /**
97
         * Gets an icon suitable to represent this type of data.
98
         * 
99
         * @return An icon representing this type of data, or null if no icon is
100
         * available
101
         */
102
        public String getIcon();
103
        
104
}