23 |
23 |
*/
|
24 |
24 |
package org.gvsig.app.gui.styling;
|
25 |
25 |
|
26 |
|
import java.awt.BorderLayout;
|
27 |
|
import java.awt.FlowLayout;
|
28 |
|
import java.awt.event.ActionEvent;
|
29 |
|
import java.awt.event.ActionListener;
|
30 |
|
import java.lang.reflect.Constructor;
|
31 |
|
import java.util.ArrayList;
|
32 |
|
import java.util.Date;
|
33 |
|
import java.util.Hashtable;
|
34 |
|
import java.util.Iterator;
|
35 |
|
|
36 |
|
import javax.swing.AbstractButton;
|
37 |
|
import javax.swing.BorderFactory;
|
38 |
|
import javax.swing.BoxLayout;
|
39 |
|
import javax.swing.ButtonGroup;
|
40 |
|
import javax.swing.JComponent;
|
41 |
|
import javax.swing.JLabel;
|
42 |
|
import javax.swing.JPanel;
|
43 |
|
import javax.swing.JTextField;
|
44 |
|
|
45 |
26 |
import org.gvsig.andami.PluginServices;
|
46 |
27 |
import org.gvsig.andami.messages.NotificationManager;
|
47 |
28 |
import org.gvsig.andami.ui.mdiManager.IWindow;
|
... | ... | |
49 |
30 |
import org.gvsig.fmap.mapcontext.rendering.symbols.styles.IStyle;
|
50 |
31 |
import org.gvsig.gui.beans.AcceptCancelPanel;
|
51 |
32 |
import org.gvsig.i18n.Messages;
|
|
33 |
import org.gvsig.tools.ToolsLocator;
|
|
34 |
import org.gvsig.tools.i18n.I18nManager;
|
52 |
35 |
|
|
36 |
import javax.swing.*;
|
|
37 |
import javax.swing.border.EmptyBorder;
|
53 |
38 |
|
|
39 |
import java.awt.*;
|
|
40 |
import java.awt.event.ActionEvent;
|
|
41 |
import java.awt.event.ActionListener;
|
|
42 |
import java.lang.reflect.Constructor;
|
|
43 |
import java.util.*;
|
|
44 |
|
|
45 |
|
54 |
46 |
/**
|
55 |
47 |
* Implements the panel which is composed by a previsualization of the style for the label
|
56 |
48 |
* and the different tools that the user has to modify that style in order to improve the
|
... | ... | |
115 |
107 |
*/
|
116 |
108 |
private void initialize() {
|
117 |
109 |
this.setLayout(new BorderLayout());
|
118 |
|
this.setSize(417,284);
|
119 |
|
this.add(getPnlNorth(), java.awt.BorderLayout.NORTH);
|
120 |
|
this.add(getPnlCenter(), java.awt.BorderLayout.CENTER);
|
121 |
|
this.add(getPnlButtons(), java.awt.BorderLayout.SOUTH);
|
122 |
|
|
|
110 |
this.setSize(500,285);
|
|
111 |
this.setBorder(new EmptyBorder(5, 5, 5, 5));
|
|
112 |
|
|
113 |
this.add(getPnlNorth(), BorderLayout.NORTH);
|
|
114 |
this.add(getPnlCenter(), BorderLayout.CENTER);
|
|
115 |
this.add(getPnlButtons(), BorderLayout.SOUTH);
|
123 |
116 |
}
|
124 |
117 |
/**
|
125 |
118 |
* Sets the previewer of the style in the panel
|
... | ... | |
138 |
131 |
*/
|
139 |
132 |
private JPanel getPnlNorth() {
|
140 |
133 |
if (pnlNorth == null) {
|
141 |
|
pnlNorth = new JPanel(new FlowLayout(FlowLayout.LEADING));
|
142 |
|
lblTitle = new JLabel(Messages.getText("Nombre"));
|
143 |
|
pnlNorth.add(lblTitle);
|
144 |
|
pnlNorth.add(getTxtDesc());
|
|
134 |
lblTitle = new JLabel(Messages.getText("Nombre").concat(":"));
|
|
135 |
pnlNorth = new JPanel(new GridBagLayout());
|
|
136 |
GridBagConstraints c = new GridBagConstraints();
|
|
137 |
|
|
138 |
c.fill = GridBagConstraints.BOTH;
|
|
139 |
c.insets = new Insets(3,3,3,3);
|
|
140 |
c.gridx = 0;
|
|
141 |
c.gridy = 0;
|
|
142 |
c.weightx = 1;
|
|
143 |
pnlNorth.add(lblTitle,c);
|
|
144 |
|
|
145 |
c.gridy = 1;
|
|
146 |
pnlNorth.add(getTxtDesc(),c);
|
145 |
147 |
}
|
146 |
148 |
return pnlNorth;
|
147 |
149 |
}
|
... | ... | |
168 |
170 |
*/
|
169 |
171 |
private JPanel getPnlCenter() {
|
170 |
172 |
if (pnlCenter == null) {
|
171 |
|
pnlCenter = new JPanel(new BorderLayout());
|
|
173 |
pnlCenter = new JPanel(new GridBagLayout());
|
|
174 |
GridBagConstraints c = new GridBagConstraints();
|
|
175 |
|
172 |
176 |
JPanel aux = new JPanel();
|
173 |
177 |
aux.add(getStylePreviewer());
|
174 |
|
pnlCenter.add(getStylePreviewer(), BorderLayout.CENTER);
|
175 |
|
pnlCenter.add(getPnlTools(), BorderLayout.EAST);
|
|
178 |
|
|
179 |
c.fill = GridBagConstraints.BOTH;
|
|
180 |
c.insets = new Insets(15, 5, 5, 5);
|
|
181 |
|
|
182 |
c.gridx = 0;
|
|
183 |
c.gridy = 0;
|
|
184 |
c.weightx = 0.9;
|
|
185 |
c.weighty = 1;
|
|
186 |
pnlCenter.add(getStylePreviewer(), c);
|
|
187 |
|
|
188 |
c.fill = GridBagConstraints.HORIZONTAL;
|
|
189 |
c.anchor = GridBagConstraints.WEST;
|
|
190 |
c.gridx = 1;
|
|
191 |
c.weightx = 0.1;
|
|
192 |
c.gridwidth = 0;
|
|
193 |
pnlCenter.add(getPnlTools(), c);
|
176 |
194 |
}
|
177 |
195 |
return pnlCenter;
|
178 |
196 |
}
|
... | ... | |
205 |
223 |
public WindowInfo getWindowInfo() {
|
206 |
224 |
WindowInfo wi = new WindowInfo(WindowInfo.MODALDIALOG | WindowInfo.RESIZABLE);
|
207 |
225 |
wi.setTitle(Messages.getText("edit_style"));
|
208 |
|
wi.setWidth(getWidth()+10);
|
|
226 |
wi.setWidth(getWidth());
|
209 |
227 |
wi.setHeight(getHeight());
|
210 |
228 |
return wi;
|
211 |
229 |
}
|
... | ... | |
236 |
254 |
* @return javax.swing.JPanel
|
237 |
255 |
*/
|
238 |
256 |
private JPanel getPnlTools() {
|
|
257 |
|
|
258 |
I18nManager i18nManager = ToolsLocator.getI18nManager();
|
|
259 |
|
239 |
260 |
if (pnlTools == null) {
|
240 |
261 |
pnlTools = new JPanel();
|
241 |
262 |
pnlTools.setBorder(BorderFactory.createTitledBorder(Messages.getText("tools")));
|
242 |
|
pnlTools.setLayout(new BoxLayout(pnlTools, BoxLayout.Y_AXIS));
|
|
263 |
pnlTools.setLayout(new GridBagLayout());
|
|
264 |
GridBagConstraints c = new GridBagConstraints();
|
|
265 |
|
|
266 |
c.fill = GridBagConstraints.BOTH;
|
|
267 |
c.insets = new Insets(5,5,5,5);
|
|
268 |
|
|
269 |
JLabel lblMaxPriority = new JLabel(i18nManager.getTranslation("priority_max"));
|
|
270 |
JLabel lblIntPriority = new JLabel(i18nManager.getTranslation("priority_int"));
|
|
271 |
JLabel lblMinPriority = new JLabel(i18nManager.getTranslation("priority_min"));
|
|
272 |
JLabel lblBlockedPriority = new JLabel(i18nManager.getTranslation("priority_blocked"));
|
|
273 |
|
|
274 |
c.gridx = 1;
|
|
275 |
c.gridy = 1;
|
|
276 |
pnlTools.add(lblMaxPriority, c);
|
|
277 |
|
|
278 |
c.gridx = 1;
|
|
279 |
c.gridy = 2;
|
|
280 |
pnlTools.add(lblIntPriority, c);
|
|
281 |
|
|
282 |
c.gridx = 1;
|
|
283 |
c.gridy = 3;
|
|
284 |
pnlTools.add(lblMinPriority, c);
|
|
285 |
|
|
286 |
c.gridx = 1;
|
|
287 |
c.gridy = 4;
|
|
288 |
pnlTools.add(lblBlockedPriority, c);
|
|
289 |
|
|
290 |
c.gridx = 0;
|
|
291 |
c.gridy = 0;
|
243 |
292 |
|
244 |
293 |
ArrayList<EditorTool> availableTools = new ArrayList<EditorTool>();
|
245 |
294 |
IStyle sty = preview.getStyle();
|
... | ... | |
258 |
307 |
}
|
259 |
308 |
|
260 |
309 |
}
|
261 |
|
|
|
310 |
|
262 |
311 |
ButtonGroup group = new ButtonGroup();
|
263 |
312 |
for (Iterator<EditorTool> iterator = availableTools.iterator();
|
264 |
313 |
iterator.hasNext();) {
|
265 |
314 |
EditorTool editorTool = iterator.next();
|
266 |
315 |
AbstractButton button = editorTool.getButton();
|
267 |
316 |
button.addActionListener(this);
|
268 |
|
pnlTools.add(button);
|
|
317 |
c.gridy++;
|
|
318 |
pnlTools.add(button,c);
|
269 |
319 |
group.add(button);
|
270 |
320 |
|
271 |
321 |
tools.put(button, editorTool);
|