Statistics
| Revision:

svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.plugin / org.gvsig.app / org.gvsig.app.mainplugin / src / main / java / org / gvsig / app / project / documents / DocumentManager.java @ 45931

History | View | Annotate | Download (5.73 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.app.project.documents;
25

    
26
import java.util.Iterator;
27

    
28
import javax.swing.ImageIcon;
29
import javax.swing.JComponent;
30

    
31
import org.gvsig.andami.ui.mdiManager.IWindow;
32
import org.gvsig.app.project.DocumentsContainer;
33
import org.gvsig.app.project.Project;
34
import org.gvsig.app.project.documents.gui.IDocumentWindow;
35
import org.gvsig.app.project.documents.gui.WindowLayout;
36
import org.gvsig.fmap.mapcontext.layers.ExtendedPropertiesSupport;
37
import org.gvsig.tools.extensionpoint.ExtensionBuilder;
38
import org.gvsig.tools.observer.WeakReferencingObservable;
39
import org.gvsig.tools.persistence.PersistenceFactory;
40
import org.gvsig.tools.util.Invocable;
41

    
42
public interface DocumentManager extends ExtensionBuilder, PersistenceFactory, WeakReferencingObservable, ExtendedPropertiesSupport {
43

    
44
        public static String NOTIFY_AFTER_CREATEDOCUMENT = "DocumentManager.CreateDocument";
45
        public static String NOTIFY_AFTER_GETMAINWINDOW = "DocumentManager.getMainWindow";
46
        public static String NOTIFY_AFTER_CREATEMAINWINDOW = "DocumentManager.createMainWindow";
47
        public static String NOTIFY_AFTER_GETPROPERTIESWINDOW = "DocumentManager.getPropertiesWindow";
48
        public static String NOTIFY_AFTER_CREATEPROPERTIESWINDOW = "DocumentManager.createPropertiesWindow";
49
        
50
        /**
51
         * Returns the type of document priority.
52
         *
53
         * @return Priority.
54
         */
55
        public int getPriority();
56

    
57
        /**
58
         * Returns tdocumenthe icon for the type of document.
59
         *
60
         * @return Image.
61
         */
62
        public ImageIcon getIcon();
63

    
64
        /**
65
         * Returns the icon for the type of document when is selected
66
         *
67
         * @return Image.
68
         */
69
        public ImageIcon getIconSelected();
70

    
71
        /**
72
         * Create a new ProjectDocument.
73
         *
74
         * @param project Opened project.
75
         *
76
         * @return ProjectDocument.
77
         */
78
        public AbstractDocument createDocument();
79

    
80
                /**
81
     * Uses a gui to be able from the characteristics that we want a
82
     * ProjectDocument
83
     * 
84
     * @return a new Document
85
     * 
86
     * @deprecated user {@link #createDocumentsByUser()} instead
87
     */
88
        public AbstractDocument createDocumentByUser();
89

    
90
    /**
91
     * Uses a gui to be able from the characteristics that we want a
92
     * ProjectDocument
93
     * 
94
     * @return the created documents
95
     */
96
    public Iterator<? extends Document> createDocumentsByUser();
97

    
98
    public Iterator<? extends Document> createDocumentsByUser(Invocable whenDocumentsLoaded);
99
    
100
        /**
101
         * Returns the title of type of document.
102
         *
103
         * @return String title for type of document
104
         */
105
        public String getTitle();
106

    
107
        /**
108
         * Returns the type name of the document factory.
109
         *
110
         * @return Name of registration
111
         */
112
        public String getTypeName();
113

    
114
        /**
115
         * Return the main window asociated to the passed document. 
116
         * If the window alreade exists return it. If not, a new
117
         * window is created.
118
         * 
119
         * @param doc
120
         * @return Window asociated to document
121
         */
122
        public IWindow getMainWindow(Document doc) ;
123
        
124
        /**
125
         * Return the main window asociated to the document.
126
         * 
127
         * @param doc, layout
128
         * @return Window asociated to document
129
         */
130
        public IWindow getMainWindow(Document doc, WindowLayout layout) ;
131
        
132
        /**
133
         * Create a new JComponent for the document or if already exists
134
         * in the specified container, return this.
135
         * 
136
         * @param container
137
         * @param doc
138
         * @return 
139
         */
140
        public JComponent getMainComponent(DocumentsContainer container, Document doc);
141
        
142
        /**
143
         * Devuelbe el JComponent que se corresponde con el documento indicado.
144
         * Si la ventana activa se corresponde con este documento, devuelbe el 
145
         * JComponent asociado a esa ventana. Si no se corresponde con la ventana
146
         * activa, pero esta es un contenedor de documentos le pide a este el componente
147
         * asociado al documento requerido y si lo encuentra lo devuelve. En 
148
         * otro caso develbe null.
149
         * @param doc
150
         * @return el JComponent asociado a doc
151
         */
152
        public JComponent getMainComponent(Document doc);
153

    
154
        public void unregisterMainComponent(DocumentsContainer container, Document document);
155
        
156
        public void registerMainComponent(DocumentsContainer container, Document document, JComponent component);
157
        
158
        /**
159
         * Return the windows properties asociated to the document.
160
         * @param doc
161
         * @return
162
         */
163
        public IWindow getPropertiesWindow(Document doc) ;
164
        
165
        /**
166
         * Return true if the name exists to another document.
167
         *
168
         * @param project
169
         * @param documentName
170
         *
171
         * @return True if the name exists.
172
         * @deprecated use instead  project.getDocument
173
         */
174
        public boolean existName(Project project, String documentName);
175
        
176
        /**
177
         * Return the class that implement the main window for this type of
178
         * documents.
179
         * 
180
         * @return the class of main window 
181
         */
182
    public Class<? extends IDocumentWindow> getMainWindowClass();
183

    
184
}