Statistics
| Revision:

svn-document-layout / trunk / org.gvsig.app.document.layout.app / org.gvsig.app.document.layout.app.mainplugin / src / main / java / org / gvsig / app / extension / PrintProperties.java @ 5

History | View | Annotate | Download (3.49 KB)

1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
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 2
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
 */
22
package org.gvsig.app.extension;
23

    
24
/**
25
 */
26
import java.awt.geom.Rectangle2D;
27

    
28
import org.gvsig.andami.PluginServices;
29
import org.gvsig.andami.plugins.Extension;
30
import org.gvsig.andami.ui.mdiManager.IWindow;
31
import org.gvsig.app.project.documents.layout.gui.LayoutPanel;
32

    
33
/**
34
 * DOCUMENT ME!
35
 * 
36
 * @author vcn
37
 */
38
public class PrintProperties extends Extension /*
39
                                                * implements
40
                                                * IPreferenceExtension
41
                                                */{
42

    
43
    private LayoutPanel l;
44
    // private static final IPreference printPropertiesPage = new
45
    // PrintPropertiesPage();
46
    // private Paper paper;
47
    Rectangle2D.Double aux = null;
48

    
49
    /**
50
     * DOCUMENT ME!
51
     * 
52
     * @param s
53
     *            DOCUMENT ME!
54
     */
55
    public void execute(String s) {
56
        l = (LayoutPanel) PluginServices.getMDIManager().getActiveWindow();
57
        l.showFConfig();
58
        // l.showPagePropertiesWindow(Print.printerJob);
59
    }
60

    
61
    /**
62
     * DOCUMENT ME!
63
     * 
64
     * @return DOCUMENT ME!
65
     */
66
    public boolean isVisible() {
67
        IWindow f = PluginServices.getMDIManager().getActiveWindow();
68

    
69
        if (f == null) {
70
            return false;
71
        }
72

    
73
        return (f instanceof LayoutPanel);
74
    }
75

    
76
    /**
77
     * @see com.iver.mdiApp.plugins.IExtension#isEnabled()
78
     */
79
    public boolean isEnabled() {
80
        LayoutPanel f =
81
            (LayoutPanel) PluginServices.getMDIManager().getActiveWindow();
82

    
83
        if (f == null || !f.getLayoutContext().isEditable()) {
84
            return false;
85
        }
86

    
87
        return true;
88
    }
89

    
90
    /**
91
     * @see org.gvsig.andami.plugins.IExtension#initialize()
92
     */
93
    public void initialize() {
94
        registerIcons();
95
    }
96

    
97
    private void registerIcons() {
98
        PluginServices.getIconTheme().registerDefault("layout-page-setup",
99
            this.getClass().getClassLoader().getResource("images/Frame.gif"));
100
        PluginServices.getIconTheme().registerDefault(
101
            "prepare-page-icon",
102
            this.getClass().getClassLoader()
103
                .getResource("images/prepare-page.png"));
104
        PluginServices.getIconTheme().registerDefault(
105
            "portrait-page-setup",
106
            this.getClass().getClassLoader()
107
                .getResource("images/portrait-page.png"));
108
        PluginServices.getIconTheme().registerDefault(
109
            "landscape-page-setup",
110
            this.getClass().getClassLoader()
111
                .getResource("images/landscape-page.png"));
112
    }
113

    
114
    // public IPreference getPreferencesPage() {
115
    // return printPropertiesPage;
116
    // }
117
}