27 |
27 |
import java.awt.FlowLayout;
|
28 |
28 |
import java.awt.GridBagConstraints;
|
29 |
29 |
import java.awt.GridBagLayout;
|
|
30 |
import java.awt.GridLayout;
|
30 |
31 |
import java.awt.Insets;
|
31 |
32 |
import java.awt.event.ActionListener;
|
32 |
33 |
import java.util.List;
|
... | ... | |
36 |
37 |
import javax.swing.JColorChooser;
|
37 |
38 |
import javax.swing.JComboBox;
|
38 |
39 |
import javax.swing.JComponent;
|
|
40 |
import javax.swing.JLabel;
|
39 |
41 |
import javax.swing.JOptionPane;
|
40 |
42 |
import javax.swing.JPanel;
|
41 |
43 |
|
... | ... | |
54 |
56 |
import org.gvsig.fmap.mapcontext.MapContext;
|
55 |
57 |
import org.gvsig.gui.beans.AcceptCancelPanel;
|
56 |
58 |
import org.gvsig.i18n.Messages;
|
57 |
|
import org.gvsig.tools.swing.api.ToolsSwingLocator;
|
58 |
59 |
|
59 |
60 |
/**
|
60 |
61 |
* Dialogo donde se muestran las propiedades de una vista
|
... | ... | |
65 |
66 |
public class ViewProperties extends JPanel implements SingletonWindow {
|
66 |
67 |
|
67 |
68 |
private static final long serialVersionUID = 5328865370833315385L;
|
|
69 |
|
|
70 |
public static final int FIXED_WIDTH = 300;
|
|
71 |
|
68 |
72 |
private javax.swing.JLabel jLabelName = null;
|
69 |
73 |
private javax.swing.JTextField txtName = null;
|
70 |
74 |
private javax.swing.JLabel jLabelDate = null;
|
... | ... | |
121 |
125 |
addRow(c, getJLabelMapUnits(), getCmbMapUnits());
|
122 |
126 |
addRow(c, getJLabelDistanceUnits(), getCmbDistanceUnits());
|
123 |
127 |
addRow(c, getJLabelAreaUnits(), getCmbDistanceArea());
|
124 |
|
addRow(c, getJLabelColor(), getJPanelColor());
|
125 |
128 |
|
|
129 |
// some extra space
|
|
130 |
addRow(c, new JLabel(" "), new JLabel(" "));
|
|
131 |
|
|
132 |
GridLayout gl = new GridLayout(1,2);
|
|
133 |
JPanel colorPanel = new JPanel(gl);
|
|
134 |
colorPanel.add(getJLabelColor());
|
|
135 |
JPanel secondHalfPanel = new JPanel(gl);
|
|
136 |
secondHalfPanel.add(getLblColor(secondHalfPanel.getBackground()));
|
|
137 |
secondHalfPanel.add(getBtnColor());
|
|
138 |
colorPanel.add(secondHalfPanel);
|
|
139 |
|
|
140 |
c.gridx = 0;
|
|
141 |
c.gridwidth = 2;
|
|
142 |
c.gridy++;
|
|
143 |
add(colorPanel, c);
|
|
144 |
c.gridwidth = 1;
|
|
145 |
|
|
146 |
/*
|
126 |
147 |
c.anchor = GridBagConstraints.WEST;
|
127 |
148 |
c.weightx = 0.0d;
|
128 |
149 |
c.gridx = 0;
|
... | ... | |
133 |
154 |
c.weightx = 1.0d;
|
134 |
155 |
c.gridx = 1;
|
135 |
156 |
add(getJPanelColor(), c);
|
|
157 |
*/
|
136 |
158 |
|
137 |
159 |
c.anchor = GridBagConstraints.WEST;
|
138 |
160 |
c.weightx = 0.0d;
|
... | ... | |
164 |
186 |
add(getOkCancelPanel(), c);
|
165 |
187 |
}
|
166 |
188 |
|
167 |
|
private JComponent getJPanelColor() {
|
168 |
|
JPanel colorPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
|
169 |
|
colorPanel.add(getLblColor());
|
170 |
|
colorPanel.add(getBtnColor());
|
171 |
189 |
|
172 |
|
return colorPanel;
|
173 |
|
}
|
174 |
190 |
|
|
191 |
|
175 |
192 |
private void addRow(GridBagConstraints c, JComponent label, JComponent text) {
|
176 |
193 |
c.anchor = GridBagConstraints.WEST;
|
177 |
194 |
c.weightx = 0.0d;
|
... | ... | |
184 |
201 |
c.gridx = 1;
|
185 |
202 |
add(text, c);
|
186 |
203 |
}
|
|
204 |
|
187 |
205 |
|
|
206 |
|
188 |
207 |
/**
|
189 |
208 |
* This method initializes jLabel
|
190 |
209 |
*
|
... | ... | |
412 |
431 |
*
|
413 |
432 |
* @return javax.swing.JLabel
|
414 |
433 |
*/
|
415 |
|
private javax.swing.JLabel getLblColor() {
|
|
434 |
private javax.swing.JLabel getLblColor(Color surround_color) {
|
416 |
435 |
if (lblColor == null) {
|
417 |
436 |
lblColor = new javax.swing.JLabel("");
|
418 |
|
lblColor.setPreferredSize(new java.awt.Dimension(30, 16));
|
|
437 |
// lblColor.setPreferredSize(new java.awt.Dimension(30, 16));
|
419 |
438 |
Color theColor = view.getMapContext().getViewPort().getBackColor();
|
420 |
439 |
backColor = theColor;
|
421 |
440 |
if (theColor == null) {
|
422 |
441 |
theColor = Color.WHITE;
|
423 |
442 |
}
|
424 |
443 |
lblColor.setBackground(theColor);
|
|
444 |
lblColor.setBorder(BorderFactory.createLineBorder(surround_color, 3));
|
425 |
445 |
lblColor.setOpaque(true);
|
426 |
446 |
}
|
427 |
447 |
|
... | ... | |
435 |
455 |
*/
|
436 |
456 |
private JButton getBtnColor() {
|
437 |
457 |
if (btnColor == null) {
|
438 |
|
btnColor =
|
439 |
|
ToolsSwingLocator.getUsabilitySwingManager().createJButton();
|
|
458 |
btnColor = new JButton();
|
|
459 |
// ToolsSwingLocator.getUsabilitySwingManager().createJButton();
|
440 |
460 |
|
441 |
461 |
btnColor.setText("...");
|
442 |
462 |
|
... | ... | |
486 |
506 |
this.validate();
|
487 |
507 |
m_viewinfo.setTitle(Messages.getText("propiedades_vista"));
|
488 |
508 |
Dimension dim = getPreferredSize();
|
489 |
|
m_viewinfo.setWidth(dim.width);
|
|
509 |
m_viewinfo.setWidth(FIXED_WIDTH);
|
490 |
510 |
m_viewinfo.setHeight(dim.height
|
491 |
511 |
+ getOkCancelPanel().getPreferredSize().height);
|
492 |
512 |
return m_viewinfo;
|