Revision 918 trunk/org.gvsig.app.document.layout2.app/org.gvsig.app.document.layout2.app.mainplugin/src/main/java/org/gvsig/app/project/documents/layout/fframes/gui/dialogs/FFrameViewDialog.java
FFrameViewDialog.java | ||
---|---|---|
25 | 25 |
import java.awt.GridBagLayout; |
26 | 26 |
import java.awt.Insets; |
27 | 27 |
import java.awt.event.ActionEvent; |
28 |
import java.awt.event.ActionListener; |
|
29 | 28 |
import java.awt.geom.Rectangle2D; |
30 | 29 |
|
31 | 30 |
import javax.swing.BorderFactory; |
... | ... | |
33 | 32 |
import javax.swing.JButton; |
34 | 33 |
import javax.swing.JCheckBox; |
35 | 34 |
import javax.swing.JLabel; |
36 |
import javax.swing.JList; |
|
37 | 35 |
import javax.swing.JOptionPane; |
38 | 36 |
import javax.swing.JPanel; |
39 | 37 |
import javax.swing.JRadioButton; |
... | ... | |
46 | 44 |
import org.gvsig.app.ApplicationLocator; |
47 | 45 |
import org.gvsig.app.ApplicationManager; |
48 | 46 |
import org.gvsig.app.project.ProjectManager; |
49 |
import org.gvsig.app.project.documents.layout.DefaultLayoutManager; |
|
50 | 47 |
import org.gvsig.app.project.documents.layout.FLayoutUtilities; |
51 |
import org.gvsig.app.project.documents.layout.LayoutContext; |
|
52 | 48 |
import org.gvsig.app.project.documents.layout.LayoutManager; |
53 | 49 |
import org.gvsig.app.project.documents.layout.fframes.FFrameGrid; |
54 | 50 |
import org.gvsig.app.project.documents.layout.fframes.FFrameView; |
... | ... | |
58 | 54 |
import org.gvsig.app.project.documents.layout.fframes.gui.EnvelopePanel; |
59 | 55 |
import org.gvsig.app.project.documents.layout.fframes.gui.JPRotation; |
60 | 56 |
import org.gvsig.app.project.documents.layout.gui.LayoutPanel; |
61 |
import org.gvsig.app.project.documents.layout.gui.dialogs.FConfigLayoutDialog; |
|
62 | 57 |
import org.gvsig.app.project.documents.view.DefaultViewDocument; |
63 | 58 |
import org.gvsig.app.project.documents.view.ViewDocument; |
64 | 59 |
import org.gvsig.app.project.documents.view.ViewManager; |
... | ... | |
73 | 68 |
* @author Vicente Caballero Navarro |
74 | 69 |
* @author Cesar Martinez Izquierdo |
75 | 70 |
*/ |
71 |
@SuppressWarnings("UseSpecificCatch") |
|
76 | 72 |
public class FFrameViewDialog extends AbstractFFrameDialog implements |
77 |
IFFrameDialog, SingletonWindow { |
|
73 |
IFFrameDialog, SingletonWindow {
|
|
78 | 74 |
|
79 |
private static final long serialVersionUID = -7223804566537544559L;
|
|
75 |
private static final long serialVersionUID = -7223804566537544559L; |
|
80 | 76 |
|
81 |
private final LayoutManager layoutManager; |
|
82 |
private javax.swing.JLabel lViews = null; |
|
83 |
private javax.swing.JScrollPane jScrollPane = null; |
|
84 |
private javax.swing.JList liViews = null; // @jve:visual-info decl-index=0 |
|
85 |
// visual-constraint="98,-3" |
|
86 |
private javax.swing.JCheckBox chbSyncLayers = null; |
|
87 |
private javax.swing.JButton bAceptar = null; |
|
88 |
private javax.swing.JButton bCancelar = null; |
|
89 |
private javax.swing.JLabel lCalidad = null; |
|
90 |
private javax.swing.JComboBox cbCalidad = null; |
|
91 |
private ViewDocument m_projectView = null; |
|
92 |
private Rectangle2D rect = new Rectangle2D.Double(); |
|
93 |
private FFrameView fframeview = null; |
|
94 |
private boolean isAcepted = false; |
|
95 |
private JPRotation rotation = null; |
|
96 |
private javax.swing.JButton bGrid = null; |
|
97 |
private javax.swing.JCheckBox chbShowGrid = null; |
|
98 |
private JPanel pnlFirstRow = null; |
|
99 |
private JCheckBox chbSyncExtent = null; |
|
77 |
private final LayoutManager layoutManager; |
|
78 |
private javax.swing.JLabel lViews = null; |
|
79 |
private javax.swing.JScrollPane jScrollPane = null; |
|
80 |
private javax.swing.JList liViews = null; |
|
81 |
private javax.swing.JCheckBox chbSyncLayers = null; |
|
82 |
private javax.swing.JButton bAceptar = null; |
|
83 |
private javax.swing.JButton bCancelar = null; |
|
84 |
private javax.swing.JLabel lCalidad = null; |
|
85 |
private javax.swing.JComboBox cbCalidad = null; |
|
86 |
private ViewDocument m_projectView = null; |
|
87 |
private final Rectangle2D rect = new Rectangle2D.Double(); |
|
88 |
private FFrameView fframeview = null; |
|
89 |
private boolean isAcepted = false; |
|
90 |
private JPRotation rotation = null; |
|
91 |
private javax.swing.JButton bGrid = null; |
|
92 |
private javax.swing.JCheckBox chbShowGrid = null; |
|
93 |
private JPanel pnlFirstRow = null; |
|
94 |
private JCheckBox chbSyncExtent = null; |
|
100 | 95 |
|
101 |
private WindowInfo windowInfo = null;
|
|
96 |
private WindowInfo windowInfo = null;
|
|
102 | 97 |
|
103 |
private GridBagLayoutPanel pnlSyncGroup = null;
|
|
104 |
private GridBagLayoutPanel pnlScaleTypeGroup = null;
|
|
105 |
private ButtonGroup grpScaleType = null;
|
|
106 |
private JRadioButton btnNormalScale = null;
|
|
107 |
private JRadioButton btnFixedScale = null;
|
|
108 |
private JRadioButton btnFixedExtent = null;
|
|
109 |
private JTextField fldScale = null;
|
|
110 |
private EnvelopePanel pnlExtent = null;
|
|
111 |
private JButton btConfigView = null;
|
|
112 |
private JPanel pnlScale = null;
|
|
113 |
private ViewDocument createdView = null;
|
|
98 |
private GridBagLayoutPanel pnlSyncGroup = null;
|
|
99 |
private GridBagLayoutPanel pnlScaleTypeGroup = null;
|
|
100 |
private ButtonGroup grpScaleType = null;
|
|
101 |
private JRadioButton btnNormalScale = null;
|
|
102 |
private JRadioButton btnFixedScale = null;
|
|
103 |
private JRadioButton btnFixedExtent = null;
|
|
104 |
private JTextField fldScale = null;
|
|
105 |
private EnvelopePanel pnlExtent = null;
|
|
106 |
private JButton btConfigView = null;
|
|
107 |
private JPanel pnlScale = null;
|
|
108 |
private ViewDocument createdView = null;
|
|
114 | 109 |
|
115 |
private FFrameView newFFrameView = null;
|
|
116 |
private FFrameGrid fframeGrid = null;
|
|
110 |
private FFrameView newFFrameView = null;
|
|
111 |
private FFrameGrid fframeGrid = null;
|
|
117 | 112 |
|
118 |
/** |
|
119 |
* This is the default constructor |
|
120 |
* |
|
121 |
* @param layoutPanel |
|
122 |
* Referencia al Layout. |
|
123 |
* @param fframe |
|
124 |
* Referencia al fframe vista. |
|
125 |
*/ |
|
126 |
public FFrameViewDialog(LayoutPanel layoutPanel, IFFrame frame) { |
|
127 |
super(layoutPanel, frame); |
|
128 |
fframeview = (FFrameView) frame; |
|
129 |
fframeGrid = (FFrameGrid) fframeview.getGrid(); |
|
130 |
initComponents(); |
|
131 |
layoutManager = (LayoutManager) ProjectManager.getInstance() |
|
113 |
/** |
|
114 |
* This is the default constructor |
|
115 |
* |
|
116 |
* @param layoutPanel Referencia al Layout. |
|
117 |
* @param frame |
|
118 |
*/ |
|
119 |
public FFrameViewDialog(LayoutPanel layoutPanel, IFFrame frame) { |
|
120 |
super(layoutPanel, frame); |
|
121 |
fframeview = (FFrameView) frame; |
|
122 |
fframeGrid = (FFrameGrid) fframeview.getGrid(); |
|
123 |
initComponents(); |
|
124 |
layoutManager = (LayoutManager) ProjectManager.getInstance() |
|
132 | 125 |
.getDocumentManager("project.document.layout"); |
133 |
}
|
|
126 |
} |
|
134 | 127 |
|
135 |
/**
|
|
136 |
* This method initializes this
|
|
137 |
*/
|
|
138 |
private void initComponents() {
|
|
139 |
this.setLayout(new GridBagLayout());
|
|
140 |
GridBagConstraints c = new GridBagConstraints();
|
|
141 |
Insets insets = new Insets(5, 5, 5, 5);
|
|
142 |
int row = 0;
|
|
143 |
c.gridx = 0;
|
|
144 |
c.gridy = row++;
|
|
145 |
c.insets = new Insets(0,0,0,0);
|
|
146 |
c.anchor = GridBagConstraints.LINE_START;
|
|
147 |
c.gridwidth = GridBagConstraints.REMAINDER;
|
|
148 |
add(getFirstRowPnl(), c);
|
|
149 |
c.insets = insets;
|
|
150 |
c.gridx = 0;
|
|
151 |
c.gridy = row++;
|
|
152 |
c.gridwidth = GridBagConstraints.REMAINDER;
|
|
153 |
c.fill = GridBagConstraints.HORIZONTAL;
|
|
128 |
/** |
|
129 |
* This method initializes this |
|
130 |
*/ |
|
131 |
private void initComponents() { |
|
132 |
this.setLayout(new GridBagLayout()); |
|
133 |
GridBagConstraints c = new GridBagConstraints(); |
|
134 |
Insets insets = new Insets(5, 5, 5, 5); |
|
135 |
int row = 0; |
|
136 |
c.gridx = 0; |
|
137 |
c.gridy = row++; |
|
138 |
c.insets = new Insets(0, 0, 0, 0);
|
|
139 |
c.anchor = GridBagConstraints.LINE_START; |
|
140 |
c.gridwidth = GridBagConstraints.REMAINDER; |
|
141 |
add(getFirstRowPnl(), c); |
|
142 |
c.insets = insets; |
|
143 |
c.gridx = 0; |
|
144 |
c.gridy = row++; |
|
145 |
c.gridwidth = GridBagConstraints.REMAINDER; |
|
146 |
c.fill = GridBagConstraints.HORIZONTAL; |
|
154 | 147 |
|
155 |
GridBagLayoutPanel pnl = getPnlSyncGroup();
|
|
156 |
pnl.addComponent(getChbSyncLayers(), insets);
|
|
157 |
pnl.addComponent(getChbSyncExtent(), insets);
|
|
158 |
add(pnl, c);
|
|
148 |
GridBagLayoutPanel pnl = getPnlSyncGroup(); |
|
149 |
pnl.addComponent(getChbSyncLayers(), insets); |
|
150 |
pnl.addComponent(getChbSyncExtent(), insets); |
|
151 |
add(pnl, c); |
|
159 | 152 |
|
160 |
getGrpScaleType().add(getBtnNormalScale());
|
|
161 |
getGrpScaleType().add(getBtnFixedScale());
|
|
162 |
getGrpScaleType().add(getBtnFixedExtent());
|
|
153 |
getGrpScaleType().add(getBtnNormalScale()); |
|
154 |
getGrpScaleType().add(getBtnFixedScale()); |
|
155 |
getGrpScaleType().add(getBtnFixedExtent()); |
|
163 | 156 |
|
164 |
pnl = getPnlScaleTypeGroup(); |
|
165 |
pnl.addComponent(getBtnNormalScale(), insets); |
|
166 |
pnl.addComponent(getPnlScale(), insets); // pnlScale() contains btnFixedScale |
|
167 |
pnl.addComponent(getBtnFixedExtent(), new Insets(5, 5, 0, 5)); |
|
168 |
pnl.addComponent(getPnlExtent(), GridBagConstraints.HORIZONTAL, new Insets(0, 5, 5, 5)); |
|
169 |
if (fframeview.getScaleType()==SCALE_TYPE.FIXED_SCALE) { |
|
170 |
getBtnFixedScale().setSelected(true); |
|
171 |
setScaleType(SCALE_TYPE.FIXED_SCALE); |
|
172 |
getChbSyncExtent().setEnabled(false); |
|
173 |
} |
|
174 |
else if (fframeview.getScaleType()==SCALE_TYPE.FIXED_EXTENT) { |
|
175 |
getBtnFixedExtent().setSelected(true); |
|
176 |
setScaleType(SCALE_TYPE.FIXED_EXTENT); |
|
177 |
getChbSyncExtent().setEnabled(false); |
|
178 |
} |
|
179 |
else { |
|
180 |
getBtnNormalScale().setSelected(true); |
|
181 |
setScaleType(SCALE_TYPE.NORMAL); |
|
182 |
} |
|
157 |
pnl = getPnlScaleTypeGroup(); |
|
158 |
pnl.addComponent(getBtnNormalScale(), insets); |
|
159 |
pnl.addComponent(getPnlScale(), insets); // pnlScale() contains btnFixedScale |
|
160 |
pnl.addComponent(getBtnFixedExtent(), new Insets(5, 5, 0, 5)); |
|
161 |
pnl.addComponent(getPnlExtent(), GridBagConstraints.HORIZONTAL, new Insets(0, 5, 5, 5)); |
|
162 |
if (fframeview.getScaleType() == SCALE_TYPE.FIXED_SCALE) { |
|
163 |
getBtnFixedScale().setSelected(true); |
|
164 |
setScaleType(SCALE_TYPE.FIXED_SCALE); |
|
165 |
getChbSyncExtent().setEnabled(false); |
|
166 |
} else if (fframeview.getScaleType() == SCALE_TYPE.FIXED_EXTENT) { |
|
167 |
getBtnFixedExtent().setSelected(true); |
|
168 |
setScaleType(SCALE_TYPE.FIXED_EXTENT); |
|
169 |
getChbSyncExtent().setEnabled(false); |
|
170 |
} else { |
|
171 |
getBtnNormalScale().setSelected(true); |
|
172 |
setScaleType(SCALE_TYPE.NORMAL); |
|
173 |
} |
|
183 | 174 |
|
184 |
c.gridy = row++;
|
|
185 |
add(pnl, c);
|
|
175 |
c.gridy = row++; |
|
176 |
add(pnl, c); |
|
186 | 177 |
|
187 |
c.fill = GridBagConstraints.NONE;
|
|
188 |
c.gridx = 0;
|
|
189 |
c.gridy = row++;
|
|
190 |
c.gridwidth = 1;
|
|
191 |
add(getLCalidad(), c);
|
|
192 |
c.gridx = 1;
|
|
193 |
c.gridwidth = GridBagConstraints.REMAINDER;
|
|
194 |
add(getCbCalidad(), c);
|
|
195 |
c.gridx = 0;
|
|
196 |
c.gridy = row++;
|
|
197 |
c.gridwidth = 1;
|
|
198 |
add(getChbShowGrid(), c);
|
|
199 |
c.gridx = 1;
|
|
200 |
c.gridwidth = GridBagConstraints.REMAINDER;
|
|
201 |
add(getBGrid(), c);
|
|
202 |
JPanel acceptCancelPnl = new JPanel(new GridBagLayout());
|
|
203 |
c.anchor = GridBagConstraints.LINE_START;
|
|
204 |
c.gridx = 0;
|
|
205 |
c.gridy = 0;
|
|
206 |
c.gridwidth = 1;
|
|
207 |
acceptCancelPnl.add(getbAceptar(), c);
|
|
208 |
c.gridx = 1;
|
|
209 |
acceptCancelPnl.add(getBCancelar(), c);
|
|
210 |
c.gridx = 0;
|
|
211 |
c.gridy = row++;
|
|
212 |
c.anchor = GridBagConstraints.LINE_END;
|
|
213 |
c.gridwidth = GridBagConstraints.REMAINDER;
|
|
214 |
add(acceptCancelPnl, c);
|
|
215 |
}
|
|
178 |
c.fill = GridBagConstraints.NONE; |
|
179 |
c.gridx = 0; |
|
180 |
c.gridy = row++; |
|
181 |
c.gridwidth = 1; |
|
182 |
add(getLCalidad(), c); |
|
183 |
c.gridx = 1; |
|
184 |
c.gridwidth = GridBagConstraints.REMAINDER; |
|
185 |
add(getCbCalidad(), c); |
|
186 |
c.gridx = 0; |
|
187 |
c.gridy = row++; |
|
188 |
c.gridwidth = 1; |
|
189 |
add(getChbShowGrid(), c); |
|
190 |
c.gridx = 1; |
|
191 |
c.gridwidth = GridBagConstraints.REMAINDER; |
|
192 |
add(getBGrid(), c); |
|
193 |
JPanel acceptCancelPnl = new JPanel(new GridBagLayout()); |
|
194 |
c.anchor = GridBagConstraints.LINE_START; |
|
195 |
c.gridx = 0; |
|
196 |
c.gridy = 0; |
|
197 |
c.gridwidth = 1; |
|
198 |
acceptCancelPnl.add(getbAceptar(), c); |
|
199 |
c.gridx = 1; |
|
200 |
acceptCancelPnl.add(getBCancelar(), c); |
|
201 |
c.gridx = 0; |
|
202 |
c.gridy = row++; |
|
203 |
c.anchor = GridBagConstraints.LINE_END; |
|
204 |
c.gridwidth = GridBagConstraints.REMAINDER; |
|
205 |
add(acceptCancelPnl, c); |
|
206 |
} |
|
216 | 207 |
|
217 |
public void setRectangle(Rectangle2D r) { |
|
218 |
rect.setRect(r); |
|
219 |
} |
|
208 |
@Override |
|
209 |
public void setRectangle(Rectangle2D r) { |
|
210 |
rect.setRect(r); |
|
211 |
} |
|
220 | 212 |
|
221 |
private JPanel getFirstRowPnl() { |
|
222 |
if (pnlFirstRow==null) { |
|
223 |
pnlFirstRow = new JPanel(new GridBagLayout()); |
|
224 |
GridBagConstraints c = new GridBagConstraints(); |
|
225 |
Insets insets = new Insets(5, 5, 5, 5); |
|
226 |
Insets insetsTop = new Insets(12, 5, 5, 5); |
|
227 |
c.gridx = 0; |
|
228 |
c.gridy = 0; |
|
229 |
c.insets = insetsTop; |
|
230 |
c.anchor = GridBagConstraints.PAGE_START; |
|
231 |
pnlFirstRow.add(getLViews(), c); |
|
232 |
c.gridx = 1; |
|
233 |
pnlFirstRow.add(getScrolledViewList(), c); |
|
234 |
c.insets = insets; |
|
235 |
c.gridx = 2; |
|
236 |
c.gridheight = 2; |
|
237 |
pnlFirstRow.add(getPRotation(), c); |
|
238 |
c.anchor = GridBagConstraints.LINE_END; |
|
239 |
c.gridy = 1; |
|
240 |
c.gridx = 1; |
|
241 |
c.gridheight = 1; |
|
242 |
pnlFirstRow.add(getBtnConfigView(), c); |
|
243 |
} |
|
244 |
return pnlFirstRow; |
|
213 |
private JPanel getFirstRowPnl() { |
|
214 |
if (pnlFirstRow == null) { |
|
215 |
pnlFirstRow = new JPanel(new GridBagLayout()); |
|
216 |
GridBagConstraints c = new GridBagConstraints(); |
|
217 |
Insets insets = new Insets(5, 5, 5, 5); |
|
218 |
Insets insetsTop = new Insets(12, 5, 5, 5); |
|
219 |
c.gridx = 0; |
|
220 |
c.gridy = 0; |
|
221 |
c.insets = insetsTop; |
|
222 |
c.anchor = GridBagConstraints.PAGE_START; |
|
223 |
pnlFirstRow.add(getLViews(), c); |
|
224 |
c.gridx = 1; |
|
225 |
pnlFirstRow.add(getScrolledViewList(), c); |
|
226 |
c.insets = insets; |
|
227 |
c.gridx = 2; |
|
228 |
c.gridheight = 2; |
|
229 |
pnlFirstRow.add(getPRotation(), c); |
|
230 |
c.anchor = GridBagConstraints.LINE_END; |
|
231 |
c.gridy = 1; |
|
232 |
c.gridx = 1; |
|
233 |
c.gridheight = 1; |
|
234 |
pnlFirstRow.add(getBtnConfigView(), c); |
|
245 | 235 |
} |
236 |
return pnlFirstRow; |
|
237 |
} |
|
246 | 238 |
|
239 |
private JButton getBtnConfigView() { |
|
240 |
UsabilitySwingManager manager = org.gvsig.tools.swing.api.ToolsSwingLocator.getUsabilitySwingManager(); |
|
241 |
btConfigView = manager.createJButton(Messages.getText("Configure_view")); |
|
242 |
btConfigView.addActionListener((ActionEvent e) -> { |
|
243 |
ViewDocument view = getSelectedView(); |
|
244 |
if (view != null) { |
|
245 |
IWindow propWin = view.getPropertiesWindow(); |
|
246 |
ApplicationManager manager1 = ApplicationLocator.getManager(); |
|
247 |
manager1.getUIManager().addWindow(propWin); |
|
248 |
} |
|
249 |
}); |
|
250 |
return btConfigView; |
|
251 |
} |
|
247 | 252 |
|
248 |
private JButton getBtnConfigView() { |
|
249 |
UsabilitySwingManager manager = org.gvsig.tools.swing.api.ToolsSwingLocator.getUsabilitySwingManager(); |
|
250 |
btConfigView = manager.createJButton(Messages.getText("Configure_view")); |
|
251 |
btConfigView.addActionListener(new ActionListener() { |
|
252 |
public void actionPerformed(ActionEvent e) { |
|
253 |
ViewDocument view = getSelectedView(); |
|
254 |
if (view!=null) { |
|
255 |
IWindow propWin = view.getPropertiesWindow(); |
|
256 |
ApplicationManager manager = ApplicationLocator.getManager(); |
|
257 |
manager.getUIManager().addWindow(propWin); |
|
258 |
} |
|
259 |
} |
|
260 |
}); |
|
261 |
return btConfigView; |
|
253 |
private javax.swing.JLabel getLViews() { |
|
254 |
if (lViews == null) { |
|
255 |
lViews = new javax.swing.JLabel(); |
|
256 |
lViews.setText(Messages.getText("Vista")); |
|
262 | 257 |
} |
263 | 258 |
|
264 |
/** |
|
265 |
* This method initializes lVistas |
|
266 |
* |
|
267 |
* @return javax.swing.JLabel |
|
268 |
*/ |
|
269 |
private javax.swing.JLabel getLViews() { |
|
270 |
if (lViews == null) { |
|
271 |
lViews = new javax.swing.JLabel(); |
|
272 |
lViews.setText(Messages.getText("Vista")); |
|
273 |
} |
|
259 |
return lViews; |
|
260 |
} |
|
274 | 261 |
|
275 |
return lViews; |
|
262 |
private javax.swing.JScrollPane getScrolledViewList() { |
|
263 |
if (jScrollPane == null) { |
|
264 |
jScrollPane = new javax.swing.JScrollPane(); |
|
265 |
jScrollPane.setViewportView(getViewList()); |
|
266 |
jScrollPane.setPreferredSize(new java.awt.Dimension(300, 100)); |
|
276 | 267 |
} |
268 |
return jScrollPane; |
|
269 |
} |
|
277 | 270 |
|
278 |
/** |
|
279 |
* This method initializes jScrollPane |
|
280 |
* |
|
281 |
* @return javax.swing.JScrollPane |
|
282 |
*/ |
|
283 |
private javax.swing.JScrollPane getScrolledViewList() { |
|
284 |
if (jScrollPane == null) { |
|
285 |
jScrollPane = new javax.swing.JScrollPane(); |
|
286 |
jScrollPane.setViewportView(getViewList()); |
|
287 |
jScrollPane.setPreferredSize(new java.awt.Dimension(300, 100)); |
|
288 |
} |
|
289 |
return jScrollPane; |
|
290 |
} |
|
271 |
private javax.swing.JList getViewList() { |
|
272 |
if (liViews == null) { |
|
273 |
ListViewModel listmodel = new ListViewModel(); |
|
274 |
listmodel.addCreateNewViewObj(); |
|
291 | 275 |
|
292 |
/** |
|
293 |
* This method initializes liVistas |
|
294 |
* |
|
295 |
* @return javax.swing.JList |
|
296 |
*/ |
|
297 |
private javax.swing.JList getViewList() { |
|
298 |
if (liViews == null) { |
|
299 |
ListViewModel listmodel = new ListViewModel(); |
|
300 |
listmodel.addCreateNewViewObj(); |
|
276 |
if (listmodel.addViews()) { |
|
277 |
JOptionPane.showMessageDialog( |
|
278 |
ApplicationLocator.getManager().getRootComponent(), |
|
279 |
Messages.getText("_Some_views_excluded_from_list_because_have_editing_layers"), |
|
280 |
Messages.getText("propiedades_marco_vista"), |
|
281 |
JOptionPane.WARNING_MESSAGE); |
|
282 |
} |
|
301 | 283 |
|
302 |
if (listmodel.addViews()) { |
|
303 |
JOptionPane.showMessageDialog( |
|
304 |
ApplicationLocator.getManager().getRootComponent(), |
|
305 |
Messages.getText("_Some_views_excluded_from_list_because_have_editing_layers"), |
|
306 |
Messages.getText("propiedades_marco_vista"), |
|
307 |
JOptionPane.WARNING_MESSAGE); |
|
308 |
} |
|
284 |
liViews = new javax.swing.JList(); |
|
285 |
liViews.setModel(listmodel); |
|
286 |
liViews.setSelectedIndex(0); |
|
309 | 287 |
|
310 |
liViews = new javax.swing.JList(); |
|
311 |
liViews.setModel(listmodel); |
|
312 |
// default value: create new view |
|
313 |
liViews.setSelectedIndex(0); |
|
288 |
for (int i = 1; i < liViews.getModel().getSize(); i++) { |
|
289 |
if (fframeview.getMapContext() != null) { |
|
314 | 290 |
|
315 |
for (int i = 1; i < liViews.getModel().getSize(); i++) { |
|
316 |
if (fframeview.getMapContext() != null) { |
|
291 |
DefaultViewDocument pvaux |
|
292 |
= (DefaultViewDocument) liViews.getModel().getElementAt( |
|
293 |
i); |
|
317 | 294 |
|
318 |
DefaultViewDocument pvaux = |
|
319 |
(DefaultViewDocument) liViews.getModel().getElementAt( |
|
320 |
i); |
|
321 |
|
|
322 |
if (pvaux.getMapContext() |
|
323 |
.equals(fframeview.getMapContext())) { |
|
324 |
liViews.setSelectedIndex(i); |
|
325 |
m_projectView = |
|
326 |
(DefaultViewDocument) liViews.getModel() |
|
327 |
.getElementAt(i); |
|
328 |
} |
|
329 |
} |
|
330 |
} |
|
331 |
|
|
295 |
if (pvaux.getMapContext() |
|
296 |
.equals(fframeview.getMapContext())) { |
|
297 |
liViews.setSelectedIndex(i); |
|
298 |
m_projectView |
|
299 |
= (DefaultViewDocument) liViews.getModel() |
|
300 |
.getElementAt(i); |
|
301 |
} |
|
332 | 302 |
} |
303 |
} |
|
333 | 304 |
|
334 |
return liViews; |
|
335 | 305 |
} |
336 | 306 |
|
337 |
protected ViewDocument getSelectedView() { |
|
338 |
Object selected = this.getViewList().getSelectedValue(); |
|
339 |
ViewDocument view = null; |
|
340 |
if (selected instanceof ViewDocument) { |
|
341 |
view = (ViewDocument) selected; |
|
342 |
} |
|
343 |
else if (selected==ListViewModel.CREATE_NEW_VIEW_OBJECT) { |
|
344 |
if (this.createdView==null) { |
|
345 |
view = createView(); |
|
346 |
} |
|
347 |
else { |
|
348 |
view = this.createdView; |
|
349 |
} |
|
350 |
} |
|
351 |
return view; |
|
352 |
} |
|
307 |
return liViews; |
|
308 |
} |
|
353 | 309 |
|
354 |
private ViewDocument createView() { |
|
355 |
ProjectManager projectManager = ApplicationLocator.getProjectManager(); |
|
356 |
ViewManager viewManager = (ViewManager) projectManager.getDocumentManager(ViewManager.TYPENAME); |
|
357 |
createdView = (ViewDocument) viewManager.createDocument(); |
|
358 |
ProjectManager.getInstance().getCurrentProject().addDocument(createdView); |
|
359 |
return createdView; |
|
310 |
protected ViewDocument getSelectedView() { |
|
311 |
Object selected = this.getViewList().getSelectedValue(); |
|
312 |
ViewDocument view = null; |
|
313 |
if (selected instanceof ViewDocument) { |
|
314 |
view = (ViewDocument) selected; |
|
315 |
} else if (selected == ListViewModel.CREATE_NEW_VIEW_OBJECT) { |
|
316 |
if (this.createdView == null) { |
|
317 |
view = createView(); |
|
318 |
} else { |
|
319 |
view = this.createdView; |
|
320 |
} |
|
360 | 321 |
} |
322 |
return view; |
|
323 |
} |
|
361 | 324 |
|
362 |
private void deleteView() { |
|
363 |
ProjectManager projectManager = ApplicationLocator.getProjectManager(); |
|
364 |
ProjectManager.getInstance().getCurrentProject().removeDocument(createdView); |
|
365 |
createdView = null; |
|
366 |
} |
|
325 |
private ViewDocument createView() { |
|
326 |
ProjectManager projectManager = ApplicationLocator.getProjectManager(); |
|
327 |
ViewManager viewManager = (ViewManager) projectManager.getDocumentManager(ViewManager.TYPENAME); |
|
328 |
createdView = (ViewDocument) viewManager.createDocument(); |
|
329 |
ProjectManager.getInstance().getCurrentProject().addDocument(createdView); |
|
330 |
return createdView; |
|
331 |
} |
|
367 | 332 |
|
333 |
private void deleteView() { |
|
334 |
ProjectManager projectManager = ApplicationLocator.getProjectManager(); |
|
335 |
ProjectManager.getInstance().getCurrentProject().removeDocument(createdView); |
|
336 |
createdView = null; |
|
337 |
} |
|
368 | 338 |
|
369 |
/** |
|
370 |
* This method initializes chbEnlaceVivo |
|
371 |
* |
|
372 |
* @return javax.swing.JCheckBox |
|
373 |
*/ |
|
374 |
private javax.swing.JCheckBox getChbSyncLayers() { |
|
375 |
if (chbSyncLayers == null) { |
|
376 |
chbSyncLayers = new javax.swing.JCheckBox(); |
|
377 |
chbSyncLayers.setText(Messages.getText("Synchronize_layers")); |
|
378 |
chbSyncLayers.setSelected(fframeview.getLayerSynced()); |
|
379 |
chbSyncLayers.addActionListener(new ActionListener() { |
|
380 |
|
|
381 |
public void actionPerformed(ActionEvent e) { |
|
382 |
if (chbSyncLayers.isSelected()) { |
|
383 |
JOptionPane.showMessageDialog(FFrameViewDialog.this, |
|
384 |
Messages.getText("Warning_Enabling_layer_synchronization_will_discard_any_change_not_present_in_associated_view"), |
|
385 |
Messages.getText("Warning_Layer_sync"), |
|
386 |
JOptionPane.WARNING_MESSAGE); |
|
387 |
} |
|
388 |
} |
|
389 |
|
|
390 |
}); |
|
339 |
private javax.swing.JCheckBox getChbSyncLayers() { |
|
340 |
if (chbSyncLayers == null) { |
|
341 |
chbSyncLayers = new javax.swing.JCheckBox(); |
|
342 |
chbSyncLayers.setText(Messages.getText("Synchronize_layers")); |
|
343 |
chbSyncLayers.setSelected(fframeview.getLayerSynced()); |
|
344 |
chbSyncLayers.addActionListener((ActionEvent e) -> { |
|
345 |
if (chbSyncLayers.isSelected()) { |
|
346 |
JOptionPane.showMessageDialog(FFrameViewDialog.this, |
|
347 |
Messages.getText("Warning_Enabling_layer_synchronization_will_discard_any_change_not_present_in_associated_view"), |
|
348 |
Messages.getText("Warning_Layer_sync"), |
|
349 |
JOptionPane.WARNING_MESSAGE); |
|
391 | 350 |
} |
392 |
|
|
393 |
return chbSyncLayers; |
|
351 |
}); |
|
394 | 352 |
} |
395 | 353 |
|
396 |
private javax.swing.JCheckBox getChbSyncExtent() { |
|
397 |
if (chbSyncExtent==null) { |
|
398 |
chbSyncExtent = new javax.swing.JCheckBox(); |
|
399 |
chbSyncExtent.setText(Messages.getText("Synchronize_extents")); |
|
400 |
chbSyncExtent.setSelected(fframeview.getExtentSynced()); |
|
401 |
} |
|
402 |
return chbSyncExtent; |
|
403 |
} |
|
354 |
return chbSyncLayers; |
|
355 |
} |
|
404 | 356 |
|
405 |
protected void disableChbSyncExtent() { |
|
406 |
getChbSyncExtent().setEnabled(false); |
|
407 |
getChbSyncExtent().setToolTipText(Messages.getText("Extent_cant_be_synchronized_when_using_fixed_scale_or_fixed_extent")); |
|
357 |
private javax.swing.JCheckBox getChbSyncExtent() { |
|
358 |
if (chbSyncExtent == null) { |
|
359 |
chbSyncExtent = new javax.swing.JCheckBox(); |
|
360 |
chbSyncExtent.setText(Messages.getText("Synchronize_extents")); |
|
361 |
chbSyncExtent.setSelected(fframeview.getExtentSynced()); |
|
408 | 362 |
} |
363 |
return chbSyncExtent; |
|
364 |
} |
|
409 | 365 |
|
410 |
protected void enableChbSyncExtent() {
|
|
411 |
getChbSyncExtent().setEnabled(true);
|
|
412 |
getChbSyncExtent().setToolTipText(null);
|
|
413 |
}
|
|
366 |
protected void disableChbSyncExtent() {
|
|
367 |
getChbSyncExtent().setEnabled(false);
|
|
368 |
getChbSyncExtent().setToolTipText(Messages.getText("Extent_cant_be_synchronized_when_using_fixed_scale_or_fixed_extent"));
|
|
369 |
} |
|
414 | 370 |
|
415 |
/** |
|
416 |
* This method initializes jButton |
|
417 |
* |
|
418 |
* @return javax.swing.JButton |
|
419 |
*/ |
|
420 |
private javax.swing.JButton getbAceptar() { |
|
421 |
if (bAceptar == null) { |
|
422 |
bAceptar = new javax.swing.JButton(); |
|
423 |
bAceptar.setText(Messages.getText("Aceptar")); |
|
424 |
bAceptar.addActionListener(new java.awt.event.ActionListener() { |
|
371 |
protected void enableChbSyncExtent() { |
|
372 |
getChbSyncExtent().setEnabled(true); |
|
373 |
getChbSyncExtent().setToolTipText(null); |
|
374 |
} |
|
425 | 375 |
|
426 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
|
427 |
newFFrameView = |
|
428 |
(FFrameView) layoutManager.createFrame(FFrameView.PERSISTENCE_DEFINITION_NAME); |
|
429 |
newFFrameView.setLayoutContext(fframeview.getLayoutContext()); |
|
376 |
private javax.swing.JButton getbAceptar() { |
|
377 |
if (bAceptar == null) { |
|
378 |
bAceptar = new javax.swing.JButton(); |
|
379 |
bAceptar.setText(Messages.getText("Aceptar")); |
|
380 |
bAceptar.addActionListener((java.awt.event.ActionEvent e) -> { |
|
381 |
newFFrameView = (FFrameView) layoutManager.createFrame(FFrameView.PERSISTENCE_DEFINITION_NAME); |
|
382 |
newFFrameView.setLayoutContext(fframeview.getLayoutContext()); |
|
430 | 383 |
|
431 |
ViewDocument v = getSelectedView();
|
|
432 |
if(v!=null) {
|
|
433 |
m_projectView = v;
|
|
434 |
}
|
|
435 |
newFFrameView.setView(v);
|
|
384 |
ViewDocument v = getSelectedView(); |
|
385 |
if (v != null) {
|
|
386 |
m_projectView = v; |
|
387 |
} |
|
388 |
newFFrameView.setView(v); |
|
436 | 389 |
|
437 |
newFFrameView.setBoundBox(FLayoutUtilities.toSheetRect( |
|
438 |
rect, layoutPanel.getLayoutControl().getAT())); |
|
439 |
newFFrameView.setRotation(getPRotation().getRotation()); |
|
440 |
newFFrameView.setHasToc(true); |
|
441 |
newFFrameView.setLayerSynced(getChbSyncLayers() |
|
442 |
.isSelected()); |
|
443 |
newFFrameView.setExtentSynced((getChbSyncExtent().isEnabled()&&getChbSyncExtent().isSelected())); |
|
444 |
try { |
|
445 |
if (getBtnFixedScale().isSelected()) { |
|
446 |
Double d = Double.parseDouble(getFldScale().getText()); |
|
447 |
newFFrameView.setScaleType(SCALE_TYPE.FIXED_SCALE, d); |
|
448 |
} |
|
449 |
else if (getBtnFixedExtent().isSelected()) { |
|
450 |
Envelope envelope = getPnlExtent().getEnvelope(); |
|
451 |
if (envelope!=null) { |
|
452 |
newFFrameView.setScaleType(SCALE_TYPE.FIXED_EXTENT, envelope); |
|
453 |
} |
|
454 |
else { |
|
455 |
newFFrameView.setScaleType(SCALE_TYPE.NORMAL); |
|
456 |
} |
|
457 |
} |
|
458 |
else { |
|
459 |
newFFrameView.setScaleType(SCALE_TYPE.NORMAL); |
|
460 |
} |
|
461 |
} |
|
462 |
catch (Exception ex) { |
|
463 |
newFFrameView.setScaleType(SCALE_TYPE.NORMAL); |
|
464 |
} |
|
465 |
if (createdView!=null && createdView!=getSelectedView()) { // a view was created but later de-selected |
|
466 |
deleteView(); |
|
467 |
} |
|
468 |
if (fframeGrid!=null){ |
|
469 |
// fframeGrid.setFFrameDependence(newFFrameView); |
|
470 |
newFFrameView.setGrid(fframeGrid); |
|
471 |
} |
|
472 |
if (m_projectView != null) { |
|
473 |
newFFrameView.setView(m_projectView); |
|
474 |
newFFrameView.setQuality(getCbCalidad() |
|
475 |
.getSelectedIndex()); |
|
476 |
if (newFFrameView.getGrid()!=null) { |
|
477 |
((FFrameGrid)newFFrameView.getGrid()).setFFrameDependence(newFFrameView); |
|
478 |
} |
|
479 |
newFFrameView.showGrid(getChbShowGrid() |
|
480 |
.isSelected()); |
|
481 |
newFFrameView.setBoundBox(FLayoutUtilities |
|
482 |
.toSheetRect(rect, layoutPanel |
|
483 |
.getLayoutControl().getAT())); |
|
484 |
} |
|
485 |
isAcepted = true; |
|
486 |
ApplicationLocator.getManager().getUIManager().closeWindow( |
|
487 |
FFrameViewDialog.this); |
|
488 |
notifyDialogClosed(); |
|
489 |
PluginsLocator.getMainFrame().refreshControls(); |
|
490 |
layoutPanel.getLayoutControl().setDefaultTool(); |
|
491 |
|
|
492 |
fireActionEvent(new ActionEvent(FFrameViewDialog.this, 1, "accept")); |
|
493 |
} |
|
494 |
}); |
|
390 |
newFFrameView.setBoundBox(FLayoutUtilities.toSheetRect( |
|
391 |
rect, layoutPanel.getLayoutControl().getAT()) |
|
392 |
); |
|
393 |
newFFrameView.setRotation(getPRotation().getRotation()); |
|
394 |
newFFrameView.setHasToc(true); |
|
395 |
newFFrameView.setLayerSynced(getChbSyncLayers().isSelected()); |
|
396 |
newFFrameView.setExtentSynced( |
|
397 |
getChbSyncExtent().isEnabled() && getChbSyncExtent().isSelected() |
|
398 |
); |
|
399 |
try { |
|
400 |
if (getBtnFixedScale().isSelected()) { |
|
401 |
Double d = Double.parseDouble(getFldScale().getText()); |
|
402 |
newFFrameView.setScaleType(SCALE_TYPE.FIXED_SCALE, d); |
|
403 |
} else if (getBtnFixedExtent().isSelected()) { |
|
404 |
Envelope envelope = getPnlExtent().getEnvelope(); |
|
405 |
if (envelope != null) { |
|
406 |
newFFrameView.setScaleType(SCALE_TYPE.FIXED_EXTENT, envelope); |
|
407 |
} else { |
|
408 |
newFFrameView.setScaleType(SCALE_TYPE.NORMAL); |
|
409 |
} |
|
410 |
} else { |
|
411 |
newFFrameView.setScaleType(SCALE_TYPE.NORMAL); |
|
412 |
} |
|
413 |
} catch (Exception ex) { |
|
414 |
newFFrameView.setScaleType(SCALE_TYPE.NORMAL); |
|
495 | 415 |
} |
416 |
if (createdView != null && createdView != getSelectedView()) { |
|
417 |
// a view was created but later de-selected |
|
418 |
deleteView(); |
|
419 |
} |
|
420 |
if (fframeGrid != null) { |
|
421 |
newFFrameView.setGrid(fframeGrid); |
|
422 |
} |
|
423 |
if (m_projectView != null) { |
|
424 |
newFFrameView.setView(m_projectView); |
|
425 |
newFFrameView.setQuality(getCbCalidad().getSelectedIndex()); |
|
426 |
if (newFFrameView.getGrid() != null) { |
|
427 |
((FFrameGrid) newFFrameView.getGrid()).setFFrameDependence(newFFrameView); |
|
428 |
} |
|
429 |
newFFrameView.showGrid(getChbShowGrid().isSelected()); |
|
430 |
newFFrameView.setBoundBox( |
|
431 |
FLayoutUtilities.toSheetRect( |
|
432 |
rect, |
|
433 |
layoutPanel.getLayoutControl().getAT() |
|
434 |
) |
|
435 |
); |
|
436 |
} |
|
437 |
isAcepted = true; |
|
438 |
ApplicationLocator.getManager().getUIManager().closeWindow( |
|
439 |
FFrameViewDialog.this |
|
440 |
); |
|
441 |
notifyDialogClosed(); |
|
442 |
PluginsLocator.getMainFrame().refreshControls(); |
|
443 |
layoutPanel.getLayoutControl().setDefaultTool(); |
|
496 | 444 |
|
497 |
return bAceptar; |
|
445 |
fireActionEvent(new ActionEvent(FFrameViewDialog.this, 1, "accept")); |
|
446 |
}); |
|
498 | 447 |
} |
499 | 448 |
|
500 |
/** |
|
501 |
* This method initializes bCancelar |
|
502 |
* |
|
503 |
* @return javax.swing.JButton |
|
504 |
*/ |
|
505 |
private javax.swing.JButton getBCancelar() { |
|
506 |
if (bCancelar == null) { |
|
507 |
bCancelar = new javax.swing.JButton(); |
|
508 |
bCancelar.setText(Messages.getText("Cancelar")); |
|
509 |
bCancelar.addActionListener(new java.awt.event.ActionListener() { |
|
510 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
|
511 |
if (createdView!=null) { |
|
512 |
deleteView(); |
|
513 |
} |
|
514 |
ApplicationLocator.getManager().getUIManager().closeWindow( |
|
515 |
FFrameViewDialog.this); |
|
516 |
notifyDialogClosed(); |
|
517 |
} |
|
518 |
}); |
|
519 |
} |
|
449 |
return bAceptar; |
|
450 |
} |
|
520 | 451 |
|
521 |
return bCancelar; |
|
452 |
private javax.swing.JButton getBCancelar() { |
|
453 |
if (bCancelar == null) { |
|
454 |
bCancelar = new javax.swing.JButton(); |
|
455 |
bCancelar.setText(Messages.getText("Cancelar")); |
|
456 |
bCancelar.addActionListener((java.awt.event.ActionEvent e) -> { |
|
457 |
if (createdView != null) { |
|
458 |
deleteView(); |
|
459 |
} |
|
460 |
ApplicationLocator.getManager().getUIManager().closeWindow( |
|
461 |
FFrameViewDialog.this |
|
462 |
); |
|
463 |
notifyDialogClosed(); |
|
464 |
}); |
|
522 | 465 |
} |
523 | 466 |
|
524 |
/** |
|
525 |
* This method initializes lCalidad |
|
526 |
* |
|
527 |
* @return javax.swing.JLabel |
|
528 |
*/ |
|
529 |
private javax.swing.JLabel getLCalidad() { |
|
530 |
if (lCalidad == null) { |
|
531 |
lCalidad = new javax.swing.JLabel(); |
|
532 |
lCalidad.setText(Messages.getText("calidad")); |
|
533 |
} |
|
467 |
return bCancelar; |
|
468 |
} |
|
534 | 469 |
|
535 |
return lCalidad; |
|
470 |
private javax.swing.JLabel getLCalidad() { |
|
471 |
if (lCalidad == null) { |
|
472 |
lCalidad = new javax.swing.JLabel(); |
|
473 |
lCalidad.setText(Messages.getText("calidad")); |
|
536 | 474 |
} |
537 | 475 |
|
538 |
/** |
|
539 |
* This method initializes cbCalidad |
|
540 |
* |
|
541 |
* @return javax.swing.JComboBox |
|
542 |
*/ |
|
543 |
private javax.swing.JComboBox getCbCalidad() { |
|
544 |
if (cbCalidad == null) { |
|
545 |
// String[] s={"Presentaci?n","Borrador"}; |
|
546 |
cbCalidad = new javax.swing.JComboBox(); |
|
547 |
cbCalidad.addItem(Messages.getText("presentacion")); |
|
548 |
cbCalidad.addItem(Messages.getText("borrador")); |
|
549 |
cbCalidad.setSelectedIndex(fframeview.getQuality()); |
|
550 |
} |
|
476 |
return lCalidad; |
|
477 |
} |
|
551 | 478 |
|
552 |
return cbCalidad; |
|
479 |
private javax.swing.JComboBox getCbCalidad() { |
|
480 |
if (cbCalidad == null) { |
|
481 |
// String[] s={"Presentaci?n","Borrador"}; |
|
482 |
cbCalidad = new javax.swing.JComboBox(); |
|
483 |
cbCalidad.addItem(Messages.getText("presentacion")); |
|
484 |
cbCalidad.addItem(Messages.getText("borrador")); |
|
485 |
cbCalidad.setSelectedIndex(fframeview.getQuality()); |
|
553 | 486 |
} |
554 | 487 |
|
555 |
/* |
|
556 |
* (non-Javadoc) |
|
557 |
* |
|
558 |
* @see com.iver.mdiApp.ui.MDIManager.View#getViewInfo() |
|
559 |
*/ |
|
560 |
public WindowInfo getWindowInfo() { |
|
561 |
if (windowInfo==null) { |
|
562 |
windowInfo = new WindowInfo(WindowInfo.RESIZABLE); |
|
563 |
windowInfo.setHeight(620); |
|
564 |
windowInfo.setWidth(600); |
|
565 |
windowInfo.setTitle(Messages.getText( |
|
566 |
"propiedades_marco_vista")); |
|
567 |
} |
|
568 |
return windowInfo; |
|
569 |
} |
|
488 |
return cbCalidad; |
|
489 |
} |
|
570 | 490 |
|
571 |
/** |
|
572 |
* @see org.gvsig.app.project.documents.layout.fframes.gui.dialogs.IFFrameDialog#getIsAcepted() |
|
573 |
*/ |
|
574 |
public boolean getIsAcepted() { |
|
575 |
return isAcepted; |
|
491 |
@Override |
|
492 |
public WindowInfo getWindowInfo() { |
|
493 |
if (windowInfo == null) { |
|
494 |
windowInfo = new WindowInfo(WindowInfo.RESIZABLE); |
|
495 |
windowInfo.setHeight(620); |
|
496 |
windowInfo.setWidth(600); |
|
497 |
windowInfo.setTitle(Messages.getText("propiedades_marco_vista")); |
|
576 | 498 |
} |
499 |
return windowInfo; |
|
500 |
} |
|
577 | 501 |
|
578 |
/** |
|
579 |
* This method initializes rotation |
|
580 |
* |
|
581 |
* @return javax.swing.JPanel |
|
582 |
*/ |
|
583 |
private JPRotation getPRotation() { |
|
584 |
if (rotation == null) { |
|
585 |
rotation = new JPRotation(); |
|
586 |
rotation.setRotation(fframeview.getRotation()); |
|
587 |
} |
|
588 |
return rotation; |
|
589 |
} |
|
502 |
@Override |
|
503 |
public boolean getIsAcepted() { |
|
504 |
return isAcepted; |
|
505 |
} |
|
590 | 506 |
|
591 |
public IFFrame getFFrame() { |
|
592 |
return newFFrameView; |
|
507 |
private JPRotation getPRotation() { |
|
508 |
if (rotation == null) { |
|
509 |
rotation = new JPRotation(); |
|
510 |
rotation.setRotation(fframeview.getRotation()); |
|
593 | 511 |
} |
512 |
return rotation; |
|
513 |
} |
|
594 | 514 |
|
595 |
/** |
|
596 |
* This method initializes bGrid |
|
597 |
* |
|
598 |
* @return javax.swing.JButton |
|
599 |
*/ |
|
600 |
private JButton getBGrid() { |
|
601 |
if (bGrid == null) { |
|
602 |
bGrid = new JButton(); |
|
603 |
bGrid.setText(Messages.getText("configurar")); |
|
604 |
bGrid.addActionListener(new java.awt.event.ActionListener() { |
|
515 |
@Override |
|
516 |
public IFFrame getFFrame() { |
|
517 |
return newFFrameView; |
|
518 |
} |
|
605 | 519 |
|
606 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
|
520 |
private JButton getBGrid() { |
|
521 |
if (bGrid == null) { |
|
522 |
bGrid = new JButton(); |
|
523 |
bGrid.setText(Messages.getText("configurar")); |
|
524 |
bGrid.addActionListener((java.awt.event.ActionEvent e) -> { |
|
525 |
if (fframeGrid == null) { |
|
526 |
fframeGrid = (FFrameGrid) layoutManager.createFrame( |
|
527 |
FFrameGrid.PERSISTENCE_DEFINITION_NAME |
|
528 |
); |
|
529 |
} |
|
607 | 530 |
|
608 |
if(fframeGrid == null) { |
|
609 |
fframeGrid = (FFrameGrid) layoutManager.createFrame(FFrameGrid.PERSISTENCE_DEFINITION_NAME); |
|
610 |
} |
|
531 |
FFrameGridDialog fframeGridDialog = (FFrameGridDialog) layoutManager |
|
532 |
.createFFrameDialog(fframeGrid, layoutPanel); |
|
611 | 533 |
|
612 |
FFrameGridDialog fframeGridDialog = |
|
613 |
(FFrameGridDialog)layoutManager.createFFrameDialog(fframeGrid, layoutPanel); |
|
614 |
|
|
615 |
if (fframeGridDialog != null) { |
|
616 |
fframeGridDialog.setMapContext(getSelectedView().getMapContext()); |
|
617 |
fframeGridDialog.setFrameRotation(getPRotation().getRotation()); |
|
618 |
ApplicationLocator.getManager().getUIManager().addWindow(fframeGridDialog); |
|
619 |
} |
|
620 |
fframeGrid = (FFrameGrid) fframeGridDialog.getFFrame(); |
|
621 |
} |
|
622 |
}); |
|
534 |
if (fframeGridDialog != null) { |
|
535 |
fframeGridDialog.setMapContext(getSelectedView().getMapContext()); |
|
536 |
fframeGridDialog.setFrameRotation(getPRotation().getRotation()); |
|
537 |
ApplicationLocator.getManager().getUIManager().addWindow(fframeGridDialog); |
|
623 | 538 |
} |
624 |
return bGrid; |
|
539 |
fframeGrid = (FFrameGrid) fframeGridDialog.getFFrame(); |
|
540 |
}); |
|
625 | 541 |
} |
542 |
return bGrid; |
|
543 |
} |
|
626 | 544 |
|
627 |
/** |
|
628 |
* This method initializes chbShowGrid |
|
629 |
* |
|
630 |
* @return javax.swing.JCheckBox |
|
631 |
*/ |
|
632 |
private JCheckBox getChbShowGrid() { |
|
633 |
if (chbShowGrid == null) { |
|
634 |
chbShowGrid = new JCheckBox(); |
|
635 |
chbShowGrid.setSelected(fframeview.isShowGrid()); |
|
636 |
chbShowGrid.setText(Messages.getText("Show_grid")); |
|
637 |
chbShowGrid.addActionListener(new ActionListener() { |
|
638 |
|
|
639 |
public void actionPerformed(ActionEvent e) { |
|
640 |
if (e.getSource() instanceof JCheckBox) { |
|
641 |
JCheckBox cb = (JCheckBox) e.getSource(); |
|
642 |
if (cb.isSelected()) { |
|
643 |
if (fframeGrid==null) { |
|
644 |
// ensure we have a non-null grid if the checkbox is selected |
|
645 |
FFrameGrid fframeGrid = (FFrameGrid) layoutManager.createFrame(FFrameGrid.PERSISTENCE_DEFINITION_NAME); |
|
646 |
} |
|
647 |
} |
|
648 |
} |
|
649 |
} |
|
650 |
}); |
|
545 |
private JCheckBox getChbShowGrid() { |
|
546 |
if (chbShowGrid == null) { |
|
547 |
chbShowGrid = new JCheckBox(); |
|
548 |
chbShowGrid.setSelected(fframeview.isShowGrid()); |
|
549 |
chbShowGrid.setText(Messages.getText("Show_grid")); |
|
550 |
chbShowGrid.addActionListener((ActionEvent e) -> { |
|
551 |
if (e.getSource() instanceof JCheckBox) { |
|
552 |
JCheckBox cb = (JCheckBox) e.getSource(); |
|
553 |
if (cb.isSelected()) { |
|
554 |
if (fframeGrid == null) { |
|
555 |
// ensure we have a non-null grid if the checkbox is selected |
|
556 |
FFrameGrid fframeGrid1 = (FFrameGrid) layoutManager.createFrame( |
|
557 |
FFrameGrid.PERSISTENCE_DEFINITION_NAME |
|
558 |
); |
|
559 |
} |
|
560 |
} |
|
651 | 561 |
} |
652 |
return chbShowGrid;
|
|
562 |
});
|
|
653 | 563 |
} |
564 |
return chbShowGrid; |
|
565 |
} |
|
654 | 566 |
|
655 |
private GridBagLayoutPanel getPnlSyncGroup() { |
|
656 |
if (pnlSyncGroup ==null) { |
|
657 |
pnlSyncGroup = new GridBagLayoutPanel(); |
|
658 |
pnlSyncGroup.setBorder(BorderFactory.createTitledBorder(Messages.getText("Synchronization_of_the_view_and_the_frame_view"))); |
|
659 |
} |
|
660 |
return pnlSyncGroup; |
|
567 |
private GridBagLayoutPanel getPnlSyncGroup() { |
|
568 |
if (pnlSyncGroup == null) { |
|
569 |
pnlSyncGroup = new GridBagLayoutPanel(); |
|
570 |
pnlSyncGroup.setBorder(BorderFactory.createTitledBorder(Messages.getText("Synchronization_of_the_view_and_the_frame_view"))); |
|
661 | 571 |
} |
572 |
return pnlSyncGroup; |
|
573 |
} |
|
662 | 574 |
|
663 |
private GridBagLayoutPanel getPnlScaleTypeGroup() { |
|
664 |
if (pnlScaleTypeGroup ==null) { |
|
665 |
pnlScaleTypeGroup = new GridBagLayoutPanel(); |
|
666 |
pnlScaleTypeGroup.setBorder(BorderFactory.createTitledBorder(Messages.getText("Fixed_scale_and_extent"))); |
|
667 |
} |
|
668 |
return pnlScaleTypeGroup; |
|
575 |
private GridBagLayoutPanel getPnlScaleTypeGroup() { |
|
576 |
if (pnlScaleTypeGroup == null) { |
|
577 |
pnlScaleTypeGroup = new GridBagLayoutPanel(); |
|
578 |
pnlScaleTypeGroup.setBorder(BorderFactory.createTitledBorder(Messages.getText("Fixed_scale_and_extent"))); |
|
669 | 579 |
} |
580 |
return pnlScaleTypeGroup; |
|
581 |
} |
|
670 | 582 |
|
671 |
private ButtonGroup getGrpScaleType() { |
|
672 |
if (grpScaleType==null) { |
|
673 |
grpScaleType = new ButtonGroup(); |
|
674 |
} |
|
675 |
return grpScaleType; |
|
583 |
private ButtonGroup getGrpScaleType() { |
|
584 |
if (grpScaleType == null) { |
|
585 |
grpScaleType = new ButtonGroup(); |
|
676 | 586 |
} |
587 |
return grpScaleType; |
|
588 |
} |
|
677 | 589 |
|
678 |
private JRadioButton getBtnNormalScale() { |
|
679 |
if (btnNormalScale==null) { |
|
680 |
btnNormalScale = new JRadioButton(Messages.getText("Non_fixed")); |
|
681 |
btnNormalScale.addActionListener(new ActionListener() { |
|
682 |
public void actionPerformed(ActionEvent e) { |
|
683 |
FFrameViewDialog.this.setScaleType(SCALE_TYPE.NORMAL); |
|
684 |
FFrameViewDialog.this.enableChbSyncExtent(); |
|
685 |
} |
|
686 |
}); |
|
687 |
} |
|
688 |
return btnNormalScale; |
|
590 |
private JRadioButton getBtnNormalScale() { |
|
591 |
if (btnNormalScale == null) { |
|
592 |
btnNormalScale = new JRadioButton(Messages.getText("Non_fixed")); |
|
593 |
btnNormalScale.addActionListener((ActionEvent e) -> { |
|
594 |
FFrameViewDialog.this.setScaleType(SCALE_TYPE.NORMAL); |
|
595 |
FFrameViewDialog.this.enableChbSyncExtent(); |
|
596 |
}); |
|
689 | 597 |
} |
598 |
return btnNormalScale; |
|
599 |
} |
|
690 | 600 |
|
691 |
private JRadioButton getBtnFixedScale() { |
|
692 |
if (btnFixedScale==null) { |
|
693 |
btnFixedScale = new JRadioButton(Messages.getText("Fixed_scale")); |
|
694 |
btnFixedScale.addActionListener(new ActionListener() { |
|
695 |
public void actionPerformed(ActionEvent e) { |
|
696 |
FFrameViewDialog.this.setScaleType(SCALE_TYPE.FIXED_SCALE); |
|
697 |
FFrameViewDialog.this.disableChbSyncExtent(); |
|
698 |
} |
|
699 |
}); |
|
700 |
} |
|
701 |
return btnFixedScale; |
|
601 |
private JRadioButton getBtnFixedScale() { |
|
602 |
if (btnFixedScale == null) { |
|
603 |
btnFixedScale = new JRadioButton(Messages.getText("Fixed_scale")); |
|
604 |
btnFixedScale.addActionListener((ActionEvent e) -> { |
|
605 |
FFrameViewDialog.this.setScaleType(SCALE_TYPE.FIXED_SCALE); |
|
606 |
FFrameViewDialog.this.disableChbSyncExtent(); |
|
607 |
}); |
|
702 | 608 |
} |
609 |
return btnFixedScale; |
|
610 |
} |
|
703 | 611 |
|
704 |
private JPanel getPnlScale() { |
|
705 |
if (pnlScale==null) { |
|
706 |
pnlScale = new JPanel(new GridBagLayout()); |
|
707 |
GridBagConstraints c = new GridBagConstraints(); |
|
708 |
c.insets = new Insets(0, 0, 0, 0); |
|
709 |
c.gridx = 0; |
|
710 |
pnlScale.add(getBtnFixedScale()); |
|
711 |
c.anchor = GridBagConstraints.LINE_START; |
|
712 |
c.gridx = 1; |
|
713 |
c.insets = new Insets(0, 25, 0, 5); |
|
714 |
c.anchor = GridBagConstraints.LINE_END; |
|
715 |
pnlScale.add(getLblScale(), c); |
|
716 |
c.gridx = 2; |
|
717 |
c.insets = new Insets(0, 5, 0, 5);; |
|
718 |
c.anchor = GridBagConstraints.LINE_START; |
|
719 |
pnlScale.add(getFldScale(), c); |
|
720 |
} |
|
721 |
return pnlScale; |
|
612 |
private JPanel getPnlScale() { |
|
613 |
if (pnlScale == null) { |
|
614 |
pnlScale = new JPanel(new GridBagLayout()); |
|
615 |
GridBagConstraints c = new GridBagConstraints(); |
|
616 |
c.insets = new Insets(0, 0, 0, 0); |
|
617 |
c.gridx = 0; |
|
618 |
pnlScale.add(getBtnFixedScale()); |
|
619 |
c.anchor = GridBagConstraints.LINE_START; |
|
620 |
c.gridx = 1; |
|
621 |
c.insets = new Insets(0, 25, 0, 5); |
|
622 |
c.anchor = GridBagConstraints.LINE_END; |
|
623 |
pnlScale.add(getLblScale(), c); |
|
624 |
c.gridx = 2; |
|
625 |
c.insets = new Insets(0, 5, 0, 5); |
|
626 |
c.anchor = GridBagConstraints.LINE_START; |
|
627 |
pnlScale.add(getFldScale(), c); |
|
722 | 628 |
} |
629 |
return pnlScale; |
|
630 |
} |
|
723 | 631 |
|
724 |
private JTextField getFldScale() { |
|
725 |
if (fldScale==null) { |
|
726 |
fldScale = new JTextField(8); |
|
727 |
if (fframeview!=null && |
|
728 |
fframeview.getMapContext()!=null && |
|
729 |
fframeview.getMapContext().getViewPort().getEnvelope()!=null) { |
|
730 |
fldScale.setText(Long.toString(fframeview.getMapContext().getScaleView())); |
|
731 |
} |
|
732 |
} |
|
733 |
return fldScale; |
|
632 |
private JTextField getFldScale() { |
|
633 |
if (fldScale == null) { |
|
634 |
fldScale = new JTextField(8); |
|
635 |
if (fframeview != null |
|
636 |
&& fframeview.getMapContext() != null |
|
637 |
&& fframeview.getMapContext().getViewPort().getEnvelope() != null) { |
|
638 |
fldScale.setText(Long.toString(fframeview.getMapContext().getScaleView())); |
|
639 |
} |
|
734 | 640 |
} |
641 |
return fldScale; |
|
642 |
} |
|
735 | 643 |
|
736 |
private JLabel getLblScale() {
|
|
737 |
return new JLabel(Messages.getText("1__"));
|
|
738 |
}
|
|
644 |
private JLabel getLblScale() { |
|
645 |
return new JLabel(Messages.getText("1__")); |
|
646 |
} |
|
739 | 647 |
|
740 |
private JRadioButton getBtnFixedExtent() { |
|
741 |
if (btnFixedExtent==null) { |
|
742 |
btnFixedExtent = new JRadioButton(Messages.getText("Fixed_extent")); |
|
743 |
btnFixedExtent.addActionListener(new ActionListener() { |
|
744 |
public void actionPerformed(ActionEvent e) { |
|
745 |
FFrameViewDialog.this.setScaleType(SCALE_TYPE.FIXED_EXTENT); |
|
746 |
FFrameViewDialog.this.disableChbSyncExtent(); |
|
747 |
} |
|
748 |
}); |
|
749 |
} |
|
750 |
return btnFixedExtent; |
|
648 |
private JRadioButton getBtnFixedExtent() { |
|
649 |
if (btnFixedExtent == null) { |
|
650 |
btnFixedExtent = new JRadioButton(Messages.getText("Fixed_extent")); |
|
651 |
btnFixedExtent.addActionListener((ActionEvent e) -> { |
|
652 |
FFrameViewDialog.this.setScaleType(SCALE_TYPE.FIXED_EXTENT); |
|
653 |
FFrameViewDialog.this.disableChbSyncExtent(); |
|
654 |
}); |
|
751 | 655 |
} |
656 |
return btnFixedExtent; |
|
657 |
} |
|
752 | 658 |
|
753 |
private EnvelopePanel getPnlExtent() { |
|
754 |
if (pnlExtent==null) { |
|
755 |
pnlExtent = new EnvelopePanel(); |
|
756 |
if (fframeview!=null && |
|
757 |
fframeview.getMapContext()!=null && |
|
758 |
fframeview.getMapContext().getViewPort().getEnvelope()!=null) { |
|
759 |
pnlExtent.setEnvelope(fframeview.getMapContext().getViewPort().getEnvelope()); |
|
760 |
} |
|
761 |
} |
|
762 |
return pnlExtent; |
|
659 |
private EnvelopePanel getPnlExtent() { |
|
660 |
if (pnlExtent == null) { |
|
661 |
pnlExtent = new EnvelopePanel(); |
|
662 |
if (fframeview != null |
|
663 |
&& fframeview.getMapContext() != null |
|
664 |
&& fframeview.getMapContext().getViewPort().getEnvelope() != null) { |
|
665 |
pnlExtent.setEnvelope(fframeview.getMapContext().getViewPort().getEnvelope()); |
|
666 |
} |
|
763 | 667 |
} |
668 |
return pnlExtent; |
|
669 |
} |
|
764 | 670 |
|
765 |
public Object getWindowProfile() { |
|
766 |
return WindowInfo.DIALOG_PROFILE; |
|
767 |
} |
|
671 |
@Override |
|
672 |
public Object getWindowProfile() { |
|
673 |
return WindowInfo.DIALOG_PROFILE; |
|
674 |
} |
|
768 | 675 |
|
769 |
public Object getWindowModel() { |
|
770 |
return fframeview; |
|
771 |
} |
|
676 |
@Override |
|
677 |
public Object getWindowModel() { |
|
678 |
return fframeview; |
|
679 |
} |
|
772 | 680 |
|
773 |
protected void setScaleType(SCALE_TYPE type) { |
|
774 |
if (type==SCALE_TYPE.NORMAL) { |
|
775 |
getFldScale().setEditable(false); |
|
776 |
getFldScale().setEnabled(false); |
|
777 |
getPnlExtent().setEditable(false); |
|
778 |
getPnlExtent().setEnabled(false); |
|
779 |
} |
|
780 |
else if (type==SCALE_TYPE.FIXED_SCALE) { |
|
781 |
getFldScale().setEditable(true); |
|
782 |
getFldScale().setEnabled(true); |
|
783 |
getPnlExtent().setEditable(false); |
|
784 |
getPnlExtent().setEnabled(false); |
|
785 |
} |
|
786 |
else if (type==SCALE_TYPE.FIXED_EXTENT) { |
|
787 |
getFldScale().setEditable(false); |
|
788 |
getFldScale().setEnabled(false); |
|
789 |
getPnlExtent().setEditable(true); |
|
790 |
getPnlExtent().setEnabled(true); |
|
791 |
} |
|
681 |
protected void setScaleType(SCALE_TYPE type) { |
|
682 |
if (null == type) { |
|
683 |
return; |
|
684 |
} |
|
685 |
switch (type) { |
|
686 |
case NORMAL: |
|
687 |
getFldScale().setEditable(false); |
|
688 |
getFldScale().setEnabled(false); |
|
689 |
getPnlExtent().setEditable(false); |
|
690 |
getPnlExtent().setEnabled(false); |
|
691 |
break; |
|
692 |
case FIXED_SCALE: |
|
693 |
getFldScale().setEditable(true); |
|
694 |
getFldScale().setEnabled(true); |
|
695 |
getPnlExtent().setEditable(false); |
|
696 |
getPnlExtent().setEnabled(false); |
|
697 |
break; |
|
698 |
case FIXED_EXTENT: |
|
699 |
getFldScale().setEditable(false); |
|
700 |
getFldScale().setEnabled(false); |
|
701 |
getPnlExtent().setEditable(true); |
|
702 |
getPnlExtent().setEnabled(true); |
|
703 |
break; |
|
704 |
default: |
|
705 |
break; |
|
706 |
} |
|
792 | 707 |
|
793 |
}
|
|
708 |
}
|
|
794 | 709 |
|
795 |
protected SCALE_TYPE getSelectedScaleType() { |
|
796 |
if (getBtnFixedScale().isSelected()) { |
|
797 |
return SCALE_TYPE.FIXED_SCALE; |
|
798 |
} |
|
799 |
else if (getBtnFixedExtent().isSelected()) { |
|
800 |
return SCALE_TYPE.FIXED_EXTENT; |
|
801 |
} |
|
802 |
return SCALE_TYPE.NORMAL; |
|
803 |
} |
|
710 |
protected SCALE_TYPE getSelectedScaleType() { |
|
711 |
if (getBtnFixedScale().isSelected()) { |
|
712 |
return SCALE_TYPE.FIXED_SCALE; |
|
713 |
} else if (getBtnFixedExtent().isSelected()) { |
|
714 |
return SCALE_TYPE.FIXED_EXTENT; |
|
715 |
} |
|
716 |
return SCALE_TYPE.NORMAL; |
|
717 |
} |
|
804 | 718 |
|
805 |
|
|
806 |
} // @jve:decl-index=0:visual-constraint="10,10" |
|
719 |
} |
Also available in: Unified diff