Revision 38116
branches/v2_0_0_prep/applications/appgvSIG/src/org/gvsig/app/project/documents/view/toc/gui/TOC.java | ||
---|---|---|
24 | 24 |
|
25 | 25 |
import java.awt.BorderLayout; |
26 | 26 |
import java.awt.Dimension; |
27 |
import java.awt.Font; |
|
28 |
import java.awt.FontMetrics; |
|
27 | 29 |
import java.awt.Image; |
28 | 30 |
import java.awt.Point; |
29 | 31 |
import java.awt.Rectangle; |
... | ... | |
47 | 49 |
import javax.swing.JScrollPane; |
48 | 50 |
import javax.swing.JTree; |
49 | 51 |
import javax.swing.SwingUtilities; |
50 |
import javax.swing.UIManager; |
|
51 | 52 |
import javax.swing.event.TreeExpansionEvent; |
52 | 53 |
import javax.swing.event.TreeExpansionListener; |
53 | 54 |
import javax.swing.tree.DefaultMutableTreeNode; |
... | ... | |
152 | 153 |
TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION); |
153 | 154 |
nodeSelectionListener = new NodeSelectionListener(m_Tree); |
154 | 155 |
m_Tree.addMouseListener(nodeSelectionListener); |
155 |
m_Tree.setBackground(UIManager.getColor("Button.background")); |
|
156 |
m_Tree.setBorder(BorderFactory.createEtchedBorder()); |
|
156 |
// m_Tree.setBackground(UIManager.getColor("Button.background"));
|
|
157 |
// m_Tree.setBorder(BorderFactory.createEtchedBorder());
|
|
157 | 158 |
|
158 | 159 |
this.addComponentListener(this); |
159 | 160 |
|
... | ... | |
295 | 296 |
DefaultMutableTreeNode parentNode) { |
296 | 297 |
int width = m_Tree.getWidth(); |
297 | 298 |
if (width == 0) { |
298 |
width = 200;
|
|
299 |
width = 300;
|
|
299 | 300 |
} |
300 | 301 |
Dimension sizeLeaf = new Dimension(width, 15); |
301 |
Dimension sizeBranch = new Dimension(width, 25); |
|
302 |
// Get the tree font height |
|
303 |
Font font = m_Tree.getFont(); |
|
304 |
FontMetrics metrics = this.getFontMetrics(font); |
|
305 |
Dimension sizeBranch = new Dimension(width, metrics.getHeight() + 4); |
|
302 | 306 |
|
303 | 307 |
for (int i = theLayers.getLayersCount() - 1; i >= 0; i--) { |
304 | 308 |
FLayer lyr = theLayers.getLayer(i); |
branches/v2_0_0_prep/applications/appgvSIG/src/org/gvsig/app/project/documents/view/toc/gui/ChangeName.java | ||
---|---|---|
17 | 17 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
18 | 18 |
* MA 02110-1301, USA. |
19 | 19 |
* |
20 |
* For any additional information, do not hesitate to contact us |
|
21 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
20 | 22 |
*/ |
21 | 23 |
package org.gvsig.app.project.documents.view.toc.gui; |
22 | 24 |
|
23 |
import java.awt.FlowLayout; |
|
25 |
import java.awt.Dimension; |
|
26 |
import java.awt.GridBagConstraints; |
|
27 |
import java.awt.GridBagLayout; |
|
28 |
import java.awt.Insets; |
|
24 | 29 |
import java.awt.event.ActionListener; |
25 | 30 |
import java.awt.event.KeyEvent; |
26 | 31 |
import java.awt.event.KeyListener; |
27 | 32 |
|
33 |
import javax.swing.BorderFactory; |
|
28 | 34 |
import javax.swing.JLabel; |
29 | 35 |
import javax.swing.JPanel; |
30 | 36 |
import javax.swing.JTextField; |
... | ... | |
33 | 39 |
import org.gvsig.andami.ui.mdiManager.IWindow; |
34 | 40 |
import org.gvsig.andami.ui.mdiManager.WindowInfo; |
35 | 41 |
import org.gvsig.gui.beans.AcceptCancelPanel; |
42 |
import org.gvsig.i18n.Messages; |
|
36 | 43 |
|
37 | 44 |
/** |
38 | 45 |
* Di?logo para cambiar el nombre de una capa. |
... | ... | |
43 | 50 |
public class ChangeName extends JPanel implements IWindow { |
44 | 51 |
|
45 | 52 |
private static final long serialVersionUID = -1366865045507066336L; |
46 |
private JPanel jContentPane = null; |
|
47 | 53 |
private JLabel lblName = null; |
48 | 54 |
private JTextField txtName = null; |
49 | 55 |
private String name; |
50 |
private JPanel jPanel = null; |
|
51 |
private AcceptCancelPanel jPanel1 = null; |
|
56 |
private AcceptCancelPanel jPanelAcceptCancel = null; |
|
52 | 57 |
private boolean isAccepted = false; |
53 | 58 |
|
54 | 59 |
/** |
... | ... | |
73 | 78 |
* This method initializes this |
74 | 79 |
*/ |
75 | 80 |
private void initialize() { |
76 |
this.setLayout(null); |
|
77 |
this.add(getJContentPane(), null); |
|
78 |
this.setSize(381, 77); |
|
79 |
} |
|
81 |
setLayout(new GridBagLayout()); |
|
82 |
setBorder(BorderFactory.createEmptyBorder(4, 5, 4, 5)); |
|
80 | 83 |
|
81 |
/** |
|
82 |
* This method initializes jContentPane |
|
83 |
* |
|
84 |
* @return javax.swing.JPanel |
|
85 |
*/ |
|
86 |
private JPanel getJContentPane() { |
|
87 |
if (jContentPane == null) { |
|
88 |
jContentPane = new JPanel(); |
|
89 |
jContentPane.setLayout(null); |
|
90 |
jContentPane.setSize(385, 77); |
|
91 |
jContentPane.setLocation(0, 0); |
|
92 |
jContentPane.add(getJPanel(), null); |
|
93 |
jContentPane.add(getJPanel1(), null); |
|
94 |
} |
|
84 |
GridBagConstraints c = new GridBagConstraints(); |
|
85 |
c.insets = new Insets(2, 5, 2, 5); |
|
86 |
c.gridy = -1; |
|
95 | 87 |
|
96 |
return jContentPane; |
|
88 |
c.anchor = GridBagConstraints.WEST; |
|
89 |
c.weightx = 0.0d; |
|
90 |
c.gridx = 0; |
|
91 |
c.gridy++; |
|
92 |
add(getLblName(), c); |
|
93 |
|
|
94 |
c.fill = GridBagConstraints.HORIZONTAL; |
|
95 |
c.weightx = 1.0d; |
|
96 |
c.gridx = 1; |
|
97 |
add(getTxtName(), c); |
|
98 |
|
|
99 |
c.anchor = GridBagConstraints.EAST; |
|
100 |
c.gridx = 0; |
|
101 |
c.gridwidth = 2; |
|
102 |
c.gridy++; |
|
103 |
c.weightx = 1.0d; |
|
104 |
add(getJPanelAcceptCancel(), c); |
|
97 | 105 |
} |
98 | 106 |
|
99 | 107 |
/** |
... | ... | |
103 | 111 |
*/ |
104 | 112 |
private JLabel getLblName() { |
105 | 113 |
if (lblName == null) { |
106 |
lblName = new JLabel(); |
|
107 |
lblName.setSize(42, 20); |
|
108 |
lblName.setText(PluginServices.getText(this, "nombre")); |
|
109 |
lblName.setLocation(10, 9); |
|
114 |
lblName = new JLabel(Messages.getText("nombre")); |
|
110 | 115 |
} |
111 | 116 |
|
112 | 117 |
return lblName; |
... | ... | |
119 | 124 |
*/ |
120 | 125 |
private JTextField getTxtName() { |
121 | 126 |
if (txtName == null) { |
122 |
txtName = new JTextField(); |
|
123 |
txtName.setBounds(62, 8, 280, 20); |
|
124 |
txtName.setPreferredSize(new java.awt.Dimension(270, 20)); |
|
125 |
txtName.setText(name); |
|
127 |
txtName = new JTextField(name, 20); |
|
126 | 128 |
txtName.addKeyListener(new KeyListener() { |
127 | 129 |
|
128 | 130 |
public void keyPressed(KeyEvent e) { |
... | ... | |
132 | 134 |
if (e.getKeyCode() == KeyEvent.VK_ESCAPE) { |
133 | 135 |
cancelAction(); |
134 | 136 |
} |
135 |
|
|
136 | 137 |
} |
137 | 138 |
|
138 | 139 |
public void keyReleased(KeyEvent e) { |
139 |
// TODO Auto-generated method stub |
|
140 |
|
|
140 |
// Nothing to do |
|
141 | 141 |
} |
142 | 142 |
|
143 | 143 |
public void keyTyped(KeyEvent e) { |
144 |
// TODO Auto-generated method stub |
|
145 |
|
|
144 |
// Nothing to do |
|
146 | 145 |
} |
147 | 146 |
|
148 | 147 |
}); |
... | ... | |
160 | 159 |
getTxtName().setText(val); |
161 | 160 |
} |
162 | 161 |
|
163 |
/* |
|
164 |
* (non-Javadoc) |
|
165 |
* |
|
166 |
* @see com.iver.mdiApp.ui.MDIManager.View#getViewInfo() |
|
167 |
*/ |
|
168 | 162 |
public WindowInfo getWindowInfo() { |
169 | 163 |
WindowInfo m_viewinfo = new WindowInfo(WindowInfo.MODALDIALOG); |
170 |
m_viewinfo.setTitle(PluginServices.getText(this, "cambio_nombre")); |
|
164 |
m_viewinfo.setTitle(Messages.getText("cambio_nombre")); |
|
165 |
Dimension dim = getPreferredSize(); |
|
166 |
m_viewinfo.setWidth(dim.width); |
|
167 |
m_viewinfo.setHeight(dim.height); |
|
171 | 168 |
return m_viewinfo; |
172 | 169 |
} |
173 | 170 |
|
... | ... | |
176 | 173 |
} |
177 | 174 |
|
178 | 175 |
/** |
179 |
* This method initializes jPanel |
|
180 |
* |
|
181 |
* @return javax.swing.JPanel |
|
182 |
*/ |
|
183 |
private JPanel getJPanel() { |
|
184 |
if (jPanel == null) { |
|
185 |
jPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); |
|
186 |
jPanel.add(getLblName(), null); |
|
187 |
jPanel.add(getTxtName(), null); |
|
188 |
|
|
189 |
jPanel.setBounds(new java.awt.Rectangle(4, 3, 329, 35)); |
|
190 |
} |
|
191 |
return jPanel; |
|
192 |
} |
|
193 |
|
|
194 |
/** |
|
195 | 176 |
* This method initializes jPanel1 |
196 | 177 |
* |
197 | 178 |
* @return javax.swing.JPanel |
198 | 179 |
*/ |
199 |
private AcceptCancelPanel getJPanel1() {
|
|
200 |
if (jPanel1 == null) {
|
|
180 |
private AcceptCancelPanel getJPanelAcceptCancel() {
|
|
181 |
if (jPanelAcceptCancel == null) {
|
|
201 | 182 |
ActionListener okActionListener, cancelActionListener; |
202 | 183 |
okActionListener = new java.awt.event.ActionListener() { |
203 | 184 |
|
... | ... | |
211 | 192 |
cancelAction(); |
212 | 193 |
} |
213 | 194 |
}; |
214 |
jPanel1 =
|
|
195 |
jPanelAcceptCancel =
|
|
215 | 196 |
new AcceptCancelPanel(okActionListener, cancelActionListener); |
216 |
jPanel1.setBounds(new java.awt.Rectangle(3, 39, 374, 35)); |
|
217 | 197 |
} |
218 |
return jPanel1;
|
|
198 |
return jPanelAcceptCancel;
|
|
219 | 199 |
} |
220 | 200 |
|
221 | 201 |
public boolean isAccepted() { |
... | ... | |
240 | 220 |
} |
241 | 221 |
|
242 | 222 |
} |
243 |
|
branches/v2_0_0_prep/applications/appgvSIG/src/org/gvsig/app/project/documents/view/toc/gui/TOCRenderer.java | ||
---|---|---|
25 | 25 |
import java.awt.Color; |
26 | 26 |
import java.awt.Component; |
27 | 27 |
import java.awt.Dimension; |
28 |
import java.awt.FlowLayout; |
|
29 | 28 |
import java.awt.Font; |
30 |
import java.awt.GridBagConstraints; |
|
31 |
import java.awt.GridBagLayout; |
|
32 | 29 |
import java.awt.Rectangle; |
33 | 30 |
|
34 |
import javax.swing.BorderFactory; |
|
35 | 31 |
import javax.swing.Icon; |
36 | 32 |
import javax.swing.JCheckBox; |
37 | 33 |
import javax.swing.JLabel; |
38 | 34 |
import javax.swing.JPanel; |
39 | 35 |
import javax.swing.JTree; |
40 | 36 |
import javax.swing.SpringLayout; |
41 |
import javax.swing.UIManager; |
|
42 |
import javax.swing.border.Border; |
|
43 | 37 |
import javax.swing.tree.DefaultMutableTreeNode; |
44 | 38 |
import javax.swing.tree.TreeCellRenderer; |
45 | 39 |
|
... | ... | |
54 | 48 |
*/ |
55 | 49 |
public class TOCRenderer extends JPanel implements TreeCellRenderer { |
56 | 50 |
|
57 |
public Border bordeSeleccionado = BorderFactory.createEtchedBorder(); |
|
58 |
|
|
59 |
/* |
|
60 |
* public Border bordeSeleccionado = |
|
61 |
* BorderFactory.createBevelBorder(BevelBorder.RAISED, |
|
62 |
* SystemColor.black, SystemColor.lightGray, SystemColor.gray, |
|
63 |
* SystemColor.lightGray); |
|
64 |
*/ |
|
65 |
private Border bordeNormal = BorderFactory.createEmptyBorder(); |
|
66 |
|
|
51 |
private static final long serialVersionUID = -6733445768959238193L; |
|
67 | 52 |
private JCheckBox check; |
68 | 53 |
private JLabel label; |
69 | 54 |
|
70 |
private static final Font BIGGER_FONT = |
|
71 |
new Font("SansSerif", Font.BOLD, 12); |
|
55 |
private final Color editingColor; |
|
72 | 56 |
|
73 |
GridBagLayout gridbag = new GridBagLayout(); |
|
74 |
GridBagConstraints c = new GridBagConstraints(); |
|
75 |
|
|
76 | 57 |
/** |
77 | 58 |
* Creates a new TOCRenderer object. |
78 | 59 |
*/ |
79 | 60 |
public TOCRenderer() { |
80 |
this.setBackground(Color.lightGray); |
|
81 |
// this.setLayout(new BorderLayout()); |
|
82 |
this.setLayout(new FlowLayout(FlowLayout.LEADING, 0, 0)); |
|
61 |
this(Color.RED); |
|
62 |
} |
|
63 |
|
|
64 |
/** |
|
65 |
* Creates a new TOCRenderer object. |
|
66 |
*/ |
|
67 |
public TOCRenderer(Color editingColor) { |
|
68 |
this.editingColor = editingColor; |
|
69 |
|
|
83 | 70 |
check = new JCheckBox(); |
84 | 71 |
label = new JLabel(); |
85 | 72 |
|
86 |
/* |
|
87 |
* this.setLayout(gridbag); |
|
88 |
* |
|
89 |
* c.fill = GridBagConstraints.NONE; |
|
90 |
* c.weightx = 1.0; |
|
91 |
* c.anchor = GridBagConstraints.WEST; |
|
92 |
* // c.weightx = check.getWidth(); |
|
93 |
* gridbag.setConstraints(check,c); |
|
94 |
* this.add(check); |
|
95 |
* c.anchor = GridBagConstraints.WEST; |
|
96 |
* gridbag.setConstraints(colorPanel,c); |
|
97 |
* // c.weightx = colorPanel.getWidth(); |
|
98 |
* this.add(colorPanel); |
|
99 |
* c.gridwidth = GridBagConstraints.REMAINDER; //end row |
|
100 |
* c.fill = GridBagConstraints.HORIZONTAL; |
|
101 |
* gridbag.setConstraints(label,c); |
|
102 |
* this.add(label); |
|
103 |
*/ |
|
104 |
|
|
105 |
/* |
|
106 |
* this.setLayout(new FlowLayout(FlowLayout.LEFT)); |
|
107 |
* this.add(check); |
|
108 |
* this.add(colorPanel); |
|
109 |
* this.add(label); |
|
110 |
*/ |
|
111 |
|
|
112 |
/* |
|
113 |
* this.setLayout(new BoxLayout(this, BoxLayout.X_AXIS)); |
|
114 |
* this.add(check); |
|
115 |
* this.add(colorPanel); |
|
116 |
* this.add(label); |
|
117 |
*/ |
|
118 |
|
|
119 | 73 |
SpringLayout theLayout = new SpringLayout(); |
120 | 74 |
this.setLayout(theLayout); |
121 | 75 |
|
122 |
// int rows = 1; |
|
123 |
// int cols = 2; |
|
124 |
|
|
125 |
/* |
|
126 |
* this.setLayout(new BorderLayout()); |
|
127 |
* |
|
128 |
* this.add(check, BorderLayout.WEST); |
|
129 |
* this.add(label, BorderLayout.CENTER); |
|
130 |
*/ |
|
131 |
/* |
|
132 |
* GridBagLayout gridbag = new GridBagLayout(); |
|
133 |
* GridBagConstraints c = new GridBagConstraints(); |
|
134 |
* |
|
135 |
* this.setLayout(gridbag); |
|
136 |
* this.add(check); |
|
137 |
* c.gridwidth = GridBagConstraints.REMAINDER; |
|
138 |
* c.fill = GridBagConstraints.HORIZONTAL; |
|
139 |
* this.add(label, c); |
|
140 |
*/ |
|
141 |
|
|
142 | 76 |
// Adjust constraints for the text field so it's at |
143 | 77 |
// (<label's right edge> + 5, 5). |
144 | 78 |
this.add(check); |
... | ... | |
146 | 80 |
|
147 | 81 |
theLayout.putConstraint(SpringLayout.WEST, label, 5, SpringLayout.EAST, |
148 | 82 |
check); |
149 |
|
|
150 |
this.setBorder(bordeSeleccionado); |
|
151 |
|
|
152 |
check.setBackground(UIManager.getColor("Button.background")); |
|
153 |
label.setForeground(UIManager.getColor("Tree.textForeground")); |
|
154 |
|
|
155 | 83 |
} |
156 | 84 |
|
157 | 85 |
/** |
... | ... | |
173 | 101 |
boolean hasFocus) { |
174 | 102 |
|
175 | 103 |
DefaultMutableTreeNode n = (DefaultMutableTreeNode) value; |
176 |
String stringValue = ""; |
|
177 |
this.setBackground(UIManager.getColor("Button.background")); |
|
104 |
Color foreground = tree.getForeground(); |
|
178 | 105 |
this.label.setFont(tree.getFont()); |
179 |
// System.out.println("ancho tree=" + tree.getWidth()); |
|
180 | 106 |
|
181 | 107 |
if (n.getUserObject() instanceof ITocItem) { |
182 | 108 |
|
183 | 109 |
ITocItem item = (ITocItem) n.getUserObject(); |
184 |
stringValue = item.getLabel(); |
|
110 |
label.setText(item.getLabel()); |
|
111 |
Icon icono = item.getIcon(); |
|
112 |
if (icono != null) { |
|
113 |
label.setIcon(icono); |
|
114 |
} |
|
185 | 115 |
|
116 |
this.validate(); |
|
186 | 117 |
Dimension sizeNode = item.getSize(); // Se fija en el resize del TOC |
187 |
|
|
188 | 118 |
this.setPreferredSize(sizeNode); |
189 | 119 |
|
190 | 120 |
if (item instanceof TocItemBranch) { |
... | ... | |
196 | 126 |
check.setEnabled(false); |
197 | 127 |
} else { |
198 | 128 |
check.setEnabled(true); |
199 |
if (!lyr.isWithinScale(lyr.getMapContext().getScaleView())) |
|
129 |
if (!lyr.isWithinScale(lyr.getMapContext().getScaleView())) {
|
|
200 | 130 |
check.setEnabled(false); |
131 |
} |
|
201 | 132 |
|
202 | 133 |
if (lyr.isEditing()) { |
203 |
this.label.setForeground(Color.RED); |
|
204 |
} else |
|
205 |
this.label.setForeground(Color.BLACK); |
|
134 |
this.label.setForeground(editingColor); |
|
135 |
} else { |
|
136 |
this.label.setForeground(foreground); |
|
137 |
} |
|
206 | 138 |
} |
207 | 139 |
if (lyr.isActive()) { |
208 |
this.setBorder(bordeSeleccionado); |
|
209 |
this.label.setFont(BIGGER_FONT); |
|
210 |
} else { |
|
211 |
this.setBorder(bordeNormal); |
|
140 |
this.label.setFont(label.getFont().deriveFont(Font.BOLD)); |
|
212 | 141 |
} |
213 | 142 |
} else { |
214 | 143 |
check.setVisible(false); |
215 |
this.setBorder(bordeNormal); |
|
216 |
|
|
217 | 144 |
} |
218 |
label.setText(stringValue); |
|
219 |
Icon icono = item.getIcon(); |
|
220 |
if (icono != null) { |
|
221 |
label.setIcon(icono); |
|
222 |
// System.out.println(">>>>>Pongo etiqueta " + stringValue + |
|
223 |
// " con icono " + item.getIcon().toString()); |
|
224 |
} |
|
225 |
this.setPreferredSize(sizeNode); |
|
226 | 145 |
} |
227 |
// this.setPreferredSize(new Dimension(tree.getWidth()-60,24)); // |
|
228 |
// sizeNode); |
|
229 | 146 |
|
230 | 147 |
if (leaf) { |
231 | 148 |
// label.setIcon(UIManager.getIcon("Tree.leafIcon")); |
149 |
} else if (expanded) { |
|
150 |
// label.setIcon(UIManager.getIcon("Tree.openIcon")); |
|
151 |
} else { |
|
152 |
// label.setIcon(UIManager.getIcon("Tree.closedIcon")); |
|
153 |
} |
|
232 | 154 |
|
233 |
} else |
|
234 |
if (expanded) { |
|
235 |
// label.setIcon(UIManager.getIcon("Tree.openIcon")); |
|
236 |
} else { |
|
237 |
// label.setIcon(UIManager.getIcon("Tree.closedIcon")); |
|
238 |
} |
|
239 |
|
|
240 | 155 |
return this; |
241 | 156 |
} |
242 | 157 |
|
branches/v2_0_0_prep/applications/appgvSIG/src/org/gvsig/app/project/documents/view/toc/gui/FPopupMenu.java | ||
---|---|---|
22 | 22 |
*/ |
23 | 23 |
package org.gvsig.app.project.documents.view.toc.gui; |
24 | 24 |
|
25 |
import java.awt.Font; |
|
26 | 25 |
import java.awt.event.ActionEvent; |
27 | 26 |
import java.awt.event.ActionListener; |
28 | 27 |
import java.lang.reflect.Array; |
... | ... | |
75 | 74 |
|
76 | 75 |
public class FPopupMenu extends JPopupMenu { |
77 | 76 |
|
78 |
// private static ArrayList menuEntrys = new ArrayList();
|
|
77 |
private static final long serialVersionUID = -7420923229618207434L;
|
|
79 | 78 |
private DefaultMutableTreeNode nodo; |
80 | 79 |
protected MapContext mapContext; |
81 | 80 |
private ExtensionPoint extensionPoint; |
82 | 81 |
private FLayer[] selecteds; |
83 |
// private JMenuItem capa; |
|
84 |
// Lo de fijar la fuente es porque en linux se ve?a mal si no se fija. |
|
85 |
// TODO: Esto no funcionar? para idiomas como el chino. Hay que cambiarlo. |
|
86 |
public final static Font theFont = new Font("SansSerif", Font.PLAIN, 10); |
|
87 | 82 |
|
88 | 83 |
public static void registerExtensionPoint() { |
89 | 84 |
ExtensionPoint exPoint = |
... | ... | |
94 | 89 |
exPoint.append("FLyrVectEditProperties", "", |
95 | 90 |
new FLyrVectEditPropertiesTocMenuEntry()); |
96 | 91 |
exPoint.append("ZoomAlTema", "", new ZoomAlTemaTocMenuEntry()); |
97 |
// extensionPoints.add("View_TocActions","ZoomPixelCursor",new |
|
98 |
// ZoomPixelCursorTocMenuEntry()); |
|
99 | 92 |
exPoint.append("EliminarCapa", "", new EliminarCapaTocMenuEntry()); |
100 | 93 |
exPoint.append("VerErroresCapa", "", new ShowLayerErrorsTocMenuEntry()); |
101 | 94 |
exPoint.append("ReloadLayer", "", new ReloadLayerTocMenuEntry()); |
... | ... | |
106 | 99 |
exPoint.append("Copy", "", new CopyLayersTocMenuEntry()); |
107 | 100 |
exPoint.append("Cut", "", new CutLayersTocMenuEntry()); |
108 | 101 |
exPoint.append("Paste", "", new PasteLayersTocMenuEntry()); |
109 |
// extensionPoints.add("View_TocActions","RasterProperties",new |
|
110 |
// FLyrRasterAdjustPropertiesTocMenuEntry()); |
|
111 |
// extensionPoints.add("View_TocActions","RasterProperties",new |
|
112 |
// RasterPropertiesTocMenuEntry()); |
|
113 |
|
|
114 | 102 |
} |
115 | 103 |
|
116 |
static { |
|
117 |
/* |
|
118 |
* Cambiados |
|
119 |
* FPopupMenu.addEntry(new FSymbolChangeColorTocMenuEntry()); |
|
120 |
* FPopupMenu.addEntry(new ChangeNameTocMenuEntry()); |
|
121 |
* FPopupMenu.addEntry(new FLyrVectEditPropertiesTocMenuEntry()); |
|
122 |
* |
|
123 |
* |
|
124 |
* FPopupMenu.addEntry(new ZoomAlTemaTocMenuEntry()); |
|
125 |
* FPopupMenu.addEntry(new ZoomPixelCursorTocMenuEntry()); |
|
126 |
* |
|
127 |
* |
|
128 |
* FPopupMenu.addEntry(new EliminarCapaTocMenuEntry()); |
|
129 |
* FPopupMenu.addEntry(new ReloadLayerTocMenuEntry()); |
|
130 |
* |
|
131 |
* FPopupMenu.addEntry(new LayersGroupTocMenuEntry()); |
|
132 |
* FPopupMenu.addEntry(new LayersUngroupTocMenuEntry()); |
|
133 |
* |
|
134 |
* |
|
135 |
* FPopupMenu.addEntry(new FirstLayerTocMenuEntry()); |
|
136 |
*/ |
|
137 |
// FPopupMenu.addEntry(new FLyrRasterAdjustPropertiesTocMenuEntry()); |
|
138 |
} |
|
139 |
|
|
140 | 104 |
/** |
141 | 105 |
* Creates a new FPopupMenu object. |
142 | 106 |
* |
... | ... | |
154 | 118 |
this.mapContext = mc; |
155 | 119 |
this.nodo = node; |
156 | 120 |
|
157 |
// salir = new MenuItem("Salir"); |
|
158 | 121 |
this.extensionPoint = |
159 | 122 |
ToolsLocator.getExtensionPointManager().get("View_TocActions"); |
160 | 123 |
this.selecteds = this.mapContext.getLayers().getActives(); |
... | ... | |
164 | 127 |
return; |
165 | 128 |
} |
166 | 129 |
this.createMenuElements(actions); |
167 |
|
|
168 |
// this.loadOldStileOptions(); |
|
169 |
|
|
170 | 130 |
} |
171 | 131 |
|
172 | 132 |
public MapContext getMapContext() { |
... | ... | |
187 | 147 |
private IContextMenuAction[] getActionList() { |
188 | 148 |
ArrayList<IContextMenuAction> actionArrayList = |
189 | 149 |
new ArrayList<IContextMenuAction>(); |
150 |
@SuppressWarnings("unchecked") |
|
190 | 151 |
Iterator<Extension> iter = this.extensionPoint.iterator(); |
191 | 152 |
AbstractTocContextMenuAction action; |
192 | 153 |
boolean contains = false; |
... | ... | |
254 | 215 |
for (int i = 0; i < actions.length; i++) { |
255 | 216 |
IContextMenuAction action = actions[i]; |
256 | 217 |
MenuItem item = new MenuItem(action.getText(), action); |
257 |
item.setFont(theFont); |
|
258 | 218 |
item.setEnabled(action.isEnabled(this.getNodeUserObject(), |
259 | 219 |
this.selecteds)); |
260 | 220 |
if (!action.getGroup().equals(group)) { |
... | ... | |
270 | 230 |
|
271 | 231 |
public class MenuItem extends JMenuItem implements ActionListener { |
272 | 232 |
|
273 |
/** |
|
274 |
* |
|
275 |
*/ |
|
276 | 233 |
private static final long serialVersionUID = 6858724610206253411L; |
277 | 234 |
private IContextMenuAction action; |
278 | 235 |
|
... | ... | |
292 | 249 |
} |
293 | 250 |
} |
294 | 251 |
|
295 |
// private void loadOldStileOptions() { |
|
296 |
// boolean first = true; |
|
297 |
// Iterator iter = this.extensionPoint.keySet().iterator(); |
|
298 |
// AbstractTocContextMenuAction action; |
|
299 |
// while (iter.hasNext()) { |
|
300 |
// action = null; |
|
301 |
// try { |
|
302 |
// action = |
|
303 |
// (AbstractTocContextMenuAction)this.extensionPoint.create((String)iter.next()); |
|
304 |
// } catch (InstantiationException e) { |
|
305 |
// // TODO Auto-generated catch block |
|
306 |
// e.printStackTrace(); |
|
307 |
// } catch (IllegalAccessException e) { |
|
308 |
// // TODO Auto-generated catch block |
|
309 |
// e.printStackTrace(); |
|
310 |
// } |
|
311 |
// if (action != null && (action instanceof OldTocContextMenuAction)) { |
|
312 |
// if (first) { |
|
313 |
// this.addSeparator(); |
|
314 |
// first = false; |
|
315 |
// } |
|
316 |
// action.setMapContext(this.mapContext); |
|
317 |
// ((OldTocContextMenuAction)action).initializeElement(this); |
|
318 |
// } |
|
319 |
// } |
|
320 |
// //comprobamos si el ultimo elemento es un seprardor |
|
321 |
// if (this.getComponentCount()>0 && |
|
322 |
// this.getComponent(this.getComponentCount()-1) instanceof Separator) { |
|
323 |
// //Si lo es lo eliminamos |
|
324 |
// this.remove(this.getComponentCount()-1); |
|
325 |
// } |
|
326 |
// |
|
327 |
// |
|
328 |
// } |
|
329 |
|
|
330 | 252 |
} |
Also available in: Unified diff