svn-gvsig-desktop / branches / v2_0_0_prep / extensions / org.gvsig.app.document.layout.app / org.gvsig.app.document.layout.app.mainplugin / src / main / java / org / gvsig / app / project / documents / layout / fframes / gui / dialogs / FFrameGraphicsDialog.java @ 36648
History | View | Annotate | Download (5.32 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.project.documents.layout.fframes.gui.dialogs; |
23 |
|
24 |
import java.awt.Dimension; |
25 |
import java.awt.event.ActionEvent; |
26 |
import java.awt.event.ActionListener; |
27 |
import java.awt.geom.Rectangle2D; |
28 |
|
29 |
import org.slf4j.Logger; |
30 |
import org.slf4j.LoggerFactory; |
31 |
|
32 |
import org.gvsig.andami.PluginServices; |
33 |
import org.gvsig.andami.ui.mdiManager.WindowInfo; |
34 |
import org.gvsig.app.gui.styling.SymbolSelector; |
35 |
import org.gvsig.app.project.documents.layout.fframes.FFrameGraphics; |
36 |
import org.gvsig.app.project.documents.layout.fframes.IFFrame; |
37 |
import org.gvsig.app.project.documents.layout.fframes.gui.JPRotation; |
38 |
import org.gvsig.app.project.documents.layout.gui.LayoutPanel; |
39 |
import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol; |
40 |
import org.gvsig.gui.beans.swing.GridBagLayoutPanel; |
41 |
|
42 |
/**
|
43 |
* Di?logo de las propiedades de los gr?ficos.
|
44 |
*
|
45 |
* @author Vicente Caballero Navarro
|
46 |
*/
|
47 |
public class FFrameGraphicsDialog extends SymbolSelector implements |
48 |
IFFrameDialog { |
49 |
|
50 |
private static final long serialVersionUID = 7473813303719944579L; |
51 |
|
52 |
private static final Logger LOG = LoggerFactory |
53 |
.getLogger(FFrameGraphicsDialog.class); |
54 |
|
55 |
private Rectangle2D rect = new Rectangle2D.Double(); |
56 |
private LayoutPanel m_layout = null; // @jve:visual-info decl-index=0 |
57 |
// visual-constraint="393,10"
|
58 |
private boolean isAcepted = false; |
59 |
private FFrameGraphics fframegraphics = null; |
60 |
// private javax.swing.JButton bAceptar = null;
|
61 |
// private javax.swing.JButton bCancelar = null;
|
62 |
private JPRotation pRotation = null; |
63 |
private FFrameGraphics newFFrameGraphics;
|
64 |
|
65 |
public FFrameGraphicsDialog(LayoutPanel layout, FFrameGraphics fframe) {
|
66 |
super(fframe.getFSymbol(), fframe.getShapeType(), null, true); |
67 |
m_layout = layout; |
68 |
fframegraphics = fframe; |
69 |
initialize(); |
70 |
} |
71 |
|
72 |
/**
|
73 |
* This method initializes this
|
74 |
*/
|
75 |
private void initialize() { |
76 |
// this.add(getBAceptar(), null);
|
77 |
// this.add(getBCancelar(), null);
|
78 |
this.setSize(650, 700); |
79 |
getPRotation().setRotation(fframegraphics.getRotation()); |
80 |
((GridBagLayoutPanel) getJPanelOptions()).addComponent(getPRotation()); |
81 |
|
82 |
ActionListener okAction = new ActionListener() { |
83 |
|
84 |
public void actionPerformed(ActionEvent e) { |
85 |
try {
|
86 |
newFFrameGraphics = (FFrameGraphics) fframegraphics.clone(); |
87 |
newFFrameGraphics.setBoundBox(fframegraphics.getBoundBox()); |
88 |
newFFrameGraphics.setSymbol((ISymbol) getSelectedObject()); |
89 |
newFFrameGraphics.setRotation(getPRotation().getRotation()); |
90 |
m_layout.getLayoutContext().updateFFrames(); |
91 |
m_layout.getLayoutControl().refresh(); |
92 |
isAcepted = true;
|
93 |
} catch (CloneNotSupportedException e1) { |
94 |
LOG.error("It is not possible clonate the object", e);
|
95 |
} |
96 |
} |
97 |
}; |
98 |
okCancelPanel.addOkButtonActionListener(okAction); |
99 |
} |
100 |
|
101 |
/**
|
102 |
* @see com.iver.mdiApp.ui.MDIManager.SingletonWindow#getWindowModel()
|
103 |
*/
|
104 |
public Object getViewModel() { |
105 |
return "FPanelLegendDefault"; |
106 |
} |
107 |
|
108 |
/**
|
109 |
* @see com.iver.mdiApp.ui.MDIManager.IWindow#getWindowInfo()
|
110 |
*/
|
111 |
public WindowInfo getWindowInfo() {
|
112 |
WindowInfo m_viewinfo = new WindowInfo(WindowInfo.MODALDIALOG);
|
113 |
m_viewinfo |
114 |
.setTitle(PluginServices.getText(this, "propiedades_grafico")); |
115 |
|
116 |
return m_viewinfo;
|
117 |
} |
118 |
|
119 |
/**
|
120 |
* @see org.gvsig.app.project.documents.layout.fframes.gui.dialogs.IFFrameDialog#setRectangle(java.awt.geom.Rectangle2D)
|
121 |
*/
|
122 |
public void setRectangle(Rectangle2D r) { |
123 |
rect.setRect(r); |
124 |
} |
125 |
|
126 |
/**
|
127 |
* @see org.gvsig.app.project.documents.layout.fframes.gui.dialogs.IFFrameDialog#getIsAcepted()
|
128 |
*/
|
129 |
public boolean getIsAcepted() { |
130 |
return isAcepted;
|
131 |
} |
132 |
|
133 |
/**
|
134 |
* @see com.iver.mdiApp.ui.MDIManager.IWindow#windowActivated()
|
135 |
*/
|
136 |
public void viewActivated() { |
137 |
} |
138 |
|
139 |
/**
|
140 |
* This method initializes pRotation
|
141 |
*
|
142 |
* @return javax.swing.JPanel
|
143 |
*/
|
144 |
private JPRotation getPRotation() {
|
145 |
if (pRotation == null) { |
146 |
pRotation = new JPRotation();
|
147 |
pRotation.setPreferredSize(new Dimension(120, 120)); |
148 |
} |
149 |
return pRotation;
|
150 |
} |
151 |
|
152 |
public IFFrame getFFrame() {
|
153 |
return newFFrameGraphics;
|
154 |
} |
155 |
} // @jve:decl-index=0:visual-constraint="10,10"
|