Statistics
| Revision:

root / branches / v2_0_0_prep / applications / appgvSIG / src / org / gvsig / app / project / documents / layout / fframes / gui / dialogs / FFrameGraphicsDialog.java @ 29596

History | View | Annotate | Download (5.16 KB)

1
/*
2
 * Created on 02-ago-2004
3
 *
4
 */
5
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
6
 *
7
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
8
 *
9
 * This program is free software; you can redistribute it and/or
10
 * modify it under the terms of the GNU General Public License
11
 * as published by the Free Software Foundation; either version 2
12
 * of the License, or (at your option) any later version.
13
 *
14
 * This program is distributed in the hope that it will be useful,
15
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
 * GNU General Public License for more details.
18
 *
19
 * You should have received a copy of the GNU General Public License
20
 * along with this program; if not, write to the Free Software
21
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
22
 *
23
 * For more information, contact:
24
 *
25
 *  Generalitat Valenciana
26
 *   Conselleria d'Infraestructures i Transport
27
 *   Av. Blasco Ib??ez, 50
28
 *   46010 VALENCIA
29
 *   SPAIN
30
 *
31
 *      +34 963862235
32
 *   gvsig@gva.es
33
 *      www.gvsig.gva.es
34
 *
35
 *    or
36
 *
37
 *   IVER T.I. S.A
38
 *   Salamanca 50
39
 *   46005 Valencia
40
 *   Spain
41
 *
42
 *   +34 963163400
43
 *   dac@iver.es
44
 */
45
package org.gvsig.app.project.documents.layout.fframes.gui.dialogs;
46

    
47
import java.awt.Dimension;
48
import java.awt.event.ActionEvent;
49
import java.awt.event.ActionListener;
50
import java.awt.geom.Rectangle2D;
51

    
52
import org.gvsig.andami.PluginServices;
53
import org.gvsig.andami.ui.mdiManager.WindowInfo;
54
import org.gvsig.app.gui.styling.SymbolSelector;
55
import org.gvsig.app.project.documents.layout.fframes.FFrameGraphics;
56
import org.gvsig.app.project.documents.layout.fframes.IFFrame;
57
import org.gvsig.app.project.documents.layout.fframes.gui.JPRotation;
58
import org.gvsig.app.project.documents.layout.gui.Layout;
59
import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol;
60
import org.gvsig.gui.beans.swing.GridBagLayoutPanel;
61

    
62

    
63

    
64
/**
65
 * Di?logo de las propiedades de los gr?ficos.
66
 *
67
 * @author Vicente Caballero Navarro
68
 */
69
public class FFrameGraphicsDialog extends SymbolSelector
70
    implements IFFrameDialog {
71
    private Rectangle2D rect = new Rectangle2D.Double();
72
    private Layout m_layout = null; //  @jve:visual-info  decl-index=0 visual-constraint="393,10"
73
    private boolean isAcepted = false;
74
    private FFrameGraphics fframegraphics = null;
75
//    private javax.swing.JButton bAceptar = null;
76
//    private javax.swing.JButton bCancelar = null;
77
    private JPRotation pRotation = null;
78
    private FFrameGraphics newFFrameGraphics;
79

    
80
    public FFrameGraphicsDialog(Layout layout, FFrameGraphics fframe){
81
        super(fframe.getFSymbol(), fframe.getShapeType(), null,true);
82
        m_layout = layout;
83
        fframegraphics = fframe;
84
        initialize();
85
    }
86

    
87
   /**
88
     * This method initializes this
89
     */
90
    private void initialize() {
91
//                this.add(getBAceptar(), null);
92
//                this.add(getBCancelar(), null);
93
        this.setSize(650, 700);
94
        getPRotation().setRotation(fframegraphics.getRotation());
95
        ((GridBagLayoutPanel)getJPanelOptions()).addComponent(getPRotation());
96

    
97
        ActionListener okAction = new ActionListener() {
98
            public void actionPerformed(ActionEvent e) {
99
                newFFrameGraphics=(FFrameGraphics)fframegraphics.cloneFFrame(m_layout);
100
                newFFrameGraphics.setBoundBox(fframegraphics.getBoundBox());
101
                newFFrameGraphics.setSymbol((ISymbol)getSelectedObject());
102
                newFFrameGraphics.setRotation(getPRotation().getRotation());
103
                m_layout.getLayoutContext().updateFFrames();
104
                m_layout.getLayoutControl().refresh();
105
                isAcepted = true;
106
            }
107
        };
108
        okCancelPanel.addOkButtonActionListener(okAction);
109
     }
110

    
111
    /**
112
     * @see com.iver.mdiApp.ui.MDIManager.SingletonWindow#getWindowModel()
113
     */
114
    public Object getViewModel() {
115
        return "FPanelLegendDefault";
116
    }
117

    
118
    /**
119
     * @see com.iver.mdiApp.ui.MDIManager.IWindow#getWindowInfo()
120
     */
121
    public WindowInfo getWindowInfo() {
122
        WindowInfo m_viewinfo = new WindowInfo(WindowInfo.MODALDIALOG);
123
        m_viewinfo.setTitle(PluginServices.getText(this, "propiedades_grafico"));
124

    
125
        return m_viewinfo;
126
    }
127

    
128
    /**
129
     * @see org.gvsig.app.project.documents.layout.fframes.gui.dialogs.IFFrameDialog#setRectangle(java.awt.geom.Rectangle2D)
130
     */
131
    public void setRectangle(Rectangle2D r) {
132
        rect.setRect(r);
133
    }
134

    
135
    /**
136
     * @see org.gvsig.app.project.documents.layout.fframes.gui.dialogs.IFFrameDialog#getIsAcepted()
137
     */
138
    public boolean getIsAcepted() {
139
        return isAcepted;
140
    }
141

    
142
    /**
143
     * @see com.iver.mdiApp.ui.MDIManager.IWindow#windowActivated()
144
     */
145
    public void viewActivated() {
146
    }
147

    
148
    /**
149
     * This method initializes pRotation
150
     *
151
     * @return javax.swing.JPanel
152
     */
153
    private JPRotation getPRotation() {
154
        if (pRotation == null) {
155
            pRotation = new JPRotation();
156
            pRotation.setPreferredSize(new Dimension(120, 120));
157
        }
158
        return pRotation;
159
    }
160

    
161
    public IFFrame getFFrame() {
162
        return newFFrameGraphics;
163
    }
164
}  //  @jve:decl-index=0:visual-constraint="10,10"