Statistics
| Revision:

svn-gvsig-desktop / trunk / applications / appgvSIG / src / com / iver / cit / gvsig / project / documents / layout / fframes / gui / dialogs / FFrameGraphicsDialog.java @ 23074

History | View | Annotate | Download (5.24 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 com.iver.cit.gvsig.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.gui.beans.AcceptCancelPanel;
53
import org.gvsig.gui.beans.swing.GridBagLayoutPanel;
54

    
55
import com.iver.andami.PluginServices;
56
import com.iver.andami.ui.mdiManager.WindowInfo;
57
import com.iver.cit.gvsig.fmap.core.symbols.ISymbol;
58
import com.iver.cit.gvsig.gui.styling.SymbolSelector;
59
import com.iver.cit.gvsig.project.documents.layout.fframes.FFrameGraphics;
60
import com.iver.cit.gvsig.project.documents.layout.fframes.IFFrame;
61
import com.iver.cit.gvsig.project.documents.layout.fframes.gui.JPRotation;
62
import com.iver.cit.gvsig.project.documents.layout.gui.Layout;
63

    
64

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

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

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

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

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

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

    
126
        return m_viewinfo;
127
    }
128

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

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

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

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

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