Statistics
| Revision:

svn-gvsig-desktop / trunk / examples / extNewDocumentExample / src / com / iver / cit / gvsig / project / documents / thedocument / TheDocument.java @ 10626

History | View | Annotate | Download (3.09 KB)

1
package com.iver.cit.gvsig.project.documents.thedocument;
2

    
3
import com.iver.andami.ui.mdiManager.IWindow;
4
import com.iver.cit.gvsig.fmap.layers.XMLException;
5
import com.iver.cit.gvsig.project.Project;
6
import com.iver.cit.gvsig.project.documents.ProjectDocument;
7
import com.iver.cit.gvsig.project.documents.exceptions.OpenException;
8
import com.iver.cit.gvsig.project.documents.exceptions.SaveException;
9
import com.iver.cit.gvsig.project.documents.thedocument.gui.DocumentGUI;
10
import com.iver.cit.gvsig.project.documents.thedocument.gui.DocumentProperties;
11
import com.iver.utiles.XMLEntity;
12

    
13

    
14
/**
15
 * New document.
16
 *
17
 * @author Vicente Caballero Navarro
18
 */
19
public class TheDocument extends ProjectDocument {
20
    /**
21
     * Returns the XMEntity with all the characteristics that want to store in the project.
22
     *
23
     * @return XMLEntity
24
     * @throws SaveException
25
     * @throws XMLException
26
     *
27
     * @throws DriverException
28
     */
29
    public XMLEntity getXMLEntity() throws SaveException {
30
        XMLEntity xml = super.getXMLEntity();
31

    
32
        return xml;
33
    }
34

    
35
    /**
36
     * @throws OpenException
37
     * @see com.iver.cit.gvsig.project.documents.ProjectDocument#setXMLEntity(com.iver.utiles.XMLEntity)
38
     */
39
    public void setXMLEntity(XMLEntity xml, Project p)
40
        throws OpenException {
41
        try {
42
            for (int i = 0; i < xml.getChildrenCount(); i++) {
43
                XMLEntity child = xml.getChild(i);
44
                if (child.contains("className") &&
45
                        child.getStringProperty("className").equals("com.iver.cit.gvsig.gui.layout.Layout") &&
46
                        child.contains("name") &&
47
                        child.getStringProperty("name").equals("layout")) {
48
                }
49
            }
50
        } catch (Exception e) {
51
            throw new OpenException(e, this.getClass().getName());
52
        }
53
    }
54

    
55
    /**
56
     * @see com.iver.cit.gvsig.project.documents.ProjectDocument#setXMLEntity(com.iver.utiles.XMLEntity)
57
     */
58
    public void setXMLEntity03(XMLEntity xml, Project p) {
59
    }
60
    /**
61
     * Creates the gui that we want in which we can introduce our document as model.
62
     */
63
    public IWindow createWindow() {
64
        DocumentGUI gui = new DocumentGUI();
65
        gui.setModel(this);
66

    
67
        return gui;
68
    }
69

    
70
    /**
71
     * Creates the gui that we want in which we can modify the properties of our document.
72
     */
73
    public IWindow getProperties() {
74
        DocumentProperties dp = new DocumentProperties(this);
75

    
76
        return dp;
77
    }
78
    /**
79
     * Code to apply when a document is removed.
80
     */
81
    public void afterRemove() {
82
    }
83
    /**
84
     * Code to apply when a document is added.
85
     */
86
    public void afterAdd() {
87
    }
88

    
89
        public void exportToXML(XMLEntity root, Project project) throws SaveException {
90
                // TODO Auto-generated method stub
91

    
92
        }
93

    
94
        public void importFromXML(XMLEntity root, XMLEntity typeRoot, int elementIndex, Project project, boolean removeDocumentsFromRoot) throws XMLException, OpenException {
95
                // TODO Auto-generated method stub
96

    
97
        }
98

    
99
        public boolean isModified() {
100
                return false;
101
        }
102

    
103
        public void setModified(boolean modified) {
104

    
105
        }
106

    
107
}