Revision 46732 trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/java/org/gvsig/app/project/documents/view/legend/gui/VectorialUniqueValue.java
VectorialUniqueValue.java | ||
---|---|---|
27 | 27 |
import java.awt.Color; |
28 | 28 |
import java.awt.Component; |
29 | 29 |
import java.awt.Dimension; |
30 |
import java.awt.GridBagConstraints; |
|
31 |
import java.awt.GridBagLayout; |
|
30 | 32 |
import java.awt.GridLayout; |
31 | 33 |
import java.awt.event.ActionEvent; |
32 | 34 |
import java.awt.event.ActionListener; |
33 | 35 |
import java.util.ArrayList; |
34 | 36 |
import java.util.Random; |
37 |
import javax.swing.BorderFactory; |
|
35 | 38 |
|
36 | 39 |
import javax.swing.DefaultComboBoxModel; |
37 | 40 |
import javax.swing.ImageIcon; |
... | ... | |
40 | 43 |
import javax.swing.JLabel; |
41 | 44 |
import javax.swing.JOptionPane; |
42 | 45 |
import javax.swing.JPanel; |
46 |
import javax.swing.JTextField; |
|
47 |
import javax.swing.border.TitledBorder; |
|
43 | 48 |
|
44 | 49 |
import org.gvsig.andami.IconThemeHelper; |
45 | 50 |
import org.gvsig.andami.PluginServices; |
... | ... | |
100 | 105 |
|
101 | 106 |
private final MapContextManager mapContextManager = MapContextLocator.getMapContextManager(); |
102 | 107 |
|
108 |
private GridBagLayoutPanel legendPanel = null; |
|
109 |
private JCheckBox chkDrawSymbolInEachPrimitive; |
|
103 | 110 |
/** |
104 | 111 |
* |
105 | 112 |
*/ |
... | ... | |
108 | 115 |
initComponents(); |
109 | 116 |
} |
110 | 117 |
|
118 |
private GridBagConstraints gbc(GridBagConstraints c, int x, int y, int colspan) { |
|
119 |
c.fill = GridBagConstraints.HORIZONTAL; |
|
120 |
c.gridwidth = colspan; |
|
121 |
c.gridx = x; |
|
122 |
c.gridy = y; |
|
123 |
c.ipadx = 2; |
|
124 |
c.ipady = 2; |
|
125 |
return c; |
|
126 |
} |
|
127 |
|
|
111 | 128 |
protected void initComponents() { |
112 | 129 |
I18nManager i18n = ToolsLocator.getI18nManager(); |
113 | 130 |
JPanel pnlButtons = new JPanel(); |
114 |
|
|
131 |
pnlButtons.setLayout(new GridBagLayout()); |
|
132 |
GridBagConstraints c = new GridBagConstraints(); |
|
133 |
|
|
115 | 134 |
JButton btnAddAll = new JButton(i18n.getTranslation("Anadir_todos")); |
116 | 135 |
btnAddAll.setActionCommand("ADD_ALL_VALUES"); |
117 | 136 |
btnAddAll.addActionListener(this); |
118 |
pnlButtons.add(btnAddAll); |
|
137 |
pnlButtons.add(btnAddAll, gbc(c, 0,0,1));
|
|
119 | 138 |
|
120 | 139 |
JButton btnAdd = new JButton(i18n.getTranslation("Anadir")); |
121 | 140 |
btnAdd.setActionCommand("ADD_VALUE"); |
122 | 141 |
btnAdd.addActionListener(this); |
123 |
pnlButtons.add(btnAdd); |
|
142 |
pnlButtons.add(btnAdd, gbc(c, 1,0,1));
|
|
124 | 143 |
|
125 | 144 |
btnRemoveAll = new JButton(i18n.getTranslation("Quitar_todos")); |
126 | 145 |
btnRemoveAll.setActionCommand("REMOVE_ALL"); |
127 | 146 |
btnRemoveAll.addActionListener(this); |
128 |
pnlButtons.add(btnRemoveAll); |
|
147 |
pnlButtons.add(btnRemoveAll, gbc(c, 2,0,1));
|
|
129 | 148 |
|
130 | 149 |
btnRemove = new JButton(i18n.getTranslation("Quitar")); |
131 | 150 |
btnRemove.setActionCommand("REMOVE"); |
132 | 151 |
btnRemove.addActionListener(this); |
133 |
pnlButtons.add(btnRemove); |
|
152 |
pnlButtons.add(btnRemove, gbc(c, 3,0,1));
|
|
134 | 153 |
|
135 | 154 |
btnOpenSymbolLevelsEditor = new JButton(i18n.getTranslation("symbol_levels")); |
136 | 155 |
btnOpenSymbolLevelsEditor.addActionListener(this); |
137 | 156 |
btnOpenSymbolLevelsEditor.setActionCommand("OPEN_SYMBOL_LEVEL_EDITOR"); |
138 |
pnlButtons.add(btnOpenSymbolLevelsEditor); |
|
157 |
pnlButtons.add(btnOpenSymbolLevelsEditor, gbc(c, 4,0,1));
|
|
139 | 158 |
btnOpenSymbolLevelsEditor.setEnabled(symbolTable != null && symbolTable.getRowCount() > 0); |
140 | 159 |
|
160 |
chkDrawSymbolInEachPrimitive = new JCheckBox(i18n.getTranslation("_Draw_symbol_for_each_primitive_geometry")); |
|
161 |
chkDrawSymbolInEachPrimitive.setSelected(true); |
|
162 |
chkDrawSymbolInEachPrimitive.addActionListener(this); |
|
163 |
chkDrawSymbolInEachPrimitive.setActionCommand("DRAW_SYMBOL_FOR_EACH_PRIMITIVE"); |
|
164 |
pnlButtons.add(chkDrawSymbolInEachPrimitive, gbc(c, 0,1,5)); |
|
165 |
|
|
141 | 166 |
pnlCenter = new JPanel(); |
142 | 167 |
pnlCenter.setLayout(new BorderLayout()); |
143 | 168 |
|
... | ... | |
536 | 561 |
} |
537 | 562 |
} |
538 | 563 |
auxLegend.useDefaultSymbol(chbUseDefault.isSelected()); |
564 |
auxLegend.setDrawSymbolInEeachPrimitive(this.chkDrawSymbolInEachPrimitive.isSelected()); |
|
539 | 565 |
|
540 | 566 |
theLegend = (VectorialUniqueValueLegend) auxLegend.cloneLegend(); |
541 | 567 |
theLegend.setZSort(auxLegend.getZSort()); |
... | ... | |
680 | 706 |
public boolean isSuitableFor(FLayer layer) { |
681 | 707 |
return (layer instanceof FLyrVect); |
682 | 708 |
} |
709 |
|
|
710 |
private GridBagLayoutPanel getLegendPanel() { |
|
711 |
if (legendPanel == null) { |
|
712 |
legendPanel = new GridBagLayoutPanel(); |
|
713 |
legendPanel.setBorder(BorderFactory.createTitledBorder(null, |
|
714 |
PluginServices.getText(this, "legend"), TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, null, null)); |
|
715 |
legendPanel.addComponent(PluginServices.getText(this, "_Draw_symbol_for_each_primitive_geometry") + ":", this.chkDrawSymbolInEachPrimitive = new JCheckBox()); |
|
716 |
this.chkDrawSymbolInEachPrimitive.setSelected(true); |
|
717 |
chkDrawSymbolInEachPrimitive.addActionListener(this); |
|
718 |
} |
|
719 |
return legendPanel; |
|
720 |
} |
|
721 |
|
|
683 | 722 |
} |
Also available in: Unified diff