Lines 15-25
Link Here
|
15 |
|
15 |
|
16 |
import java.beans.*; |
16 |
import java.beans.*; |
17 |
import java.awt.Component; |
17 |
import java.awt.Component; |
|
|
18 |
import javax.swing.Action; |
18 |
import javax.swing.Scrollable; |
19 |
import javax.swing.Scrollable; |
19 |
import javax.swing.JScrollPane; |
20 |
import javax.swing.JScrollPane; |
20 |
import javax.swing.JPanel; |
21 |
import javax.swing.JPanel; |
21 |
|
22 |
|
22 |
import org.openide.explorer.ExplorerManager; |
23 |
import org.openide.explorer.ExplorerManager; |
|
|
24 |
import org.openide.explorer.ExplorerPanel; |
25 |
import org.openide.explorer.view.TreeTableView; |
23 |
import org.openide.nodes.Node; |
26 |
import org.openide.nodes.Node; |
24 |
import org.openide.util.actions.NodeAction; |
27 |
import org.openide.util.actions.NodeAction; |
25 |
import org.openide.util.actions.SystemAction; |
28 |
import org.openide.util.actions.SystemAction; |
Lines 34-42
Link Here
|
34 |
|
37 |
|
35 |
private ExplorerManager em; |
38 |
private ExplorerManager em; |
36 |
|
39 |
|
37 |
private NodeAction moveUp; |
40 |
private Action moveUp; |
38 |
private NodeAction moveDown; |
41 |
private Action moveDown; |
39 |
private NodeAction newAction; |
42 |
private Action newAction; |
40 |
private boolean showingDetails = false; |
43 |
private boolean showingDetails = false; |
41 |
private Node rootNode; |
44 |
private Node rootNode; |
42 |
private Node.Property prop; |
45 |
private Node.Property prop; |
Lines 46-52
Link Here
|
46 |
|
49 |
|
47 |
/** Creates new form IndexedEditorPanel */ |
50 |
/** Creates new form IndexedEditorPanel */ |
48 |
public IndexedEditorPanel(Node node, Node.Property[] props) { |
51 |
public IndexedEditorPanel(Node node, Node.Property[] props) { |
|
|
52 |
// XXX just hot fix (setLabelFor is in initComponents). |
53 |
treeTableView1 = new TreeTableView(); |
49 |
initComponents(); |
54 |
initComponents(); |
|
|
55 |
|
56 |
ExplorerPanel exPanel = new ExplorerPanel(getExplorerManager()); |
57 |
exPanel.add(treeTableView1); |
58 |
jPanel2.setLayout(new java.awt.BorderLayout()); |
59 |
jPanel2.add(exPanel); |
50 |
|
60 |
|
51 |
detailsPanel.setLayout(new java.awt.BorderLayout()); |
61 |
detailsPanel.setLayout(new java.awt.BorderLayout()); |
52 |
getExplorerManager().setRootContext(node); |
62 |
getExplorerManager().setRootContext(node); |
Lines 61-69
Link Here
|
61 |
|
71 |
|
62 |
node.addPropertyChangeListener(this); |
72 |
node.addPropertyChangeListener(this); |
63 |
try { |
73 |
try { |
64 |
moveUp = (NodeAction)SystemAction.get(Class.forName("org.openide.actions.MoveUpAction")); // NOI18N |
74 |
NodeAction globalMoveUp = (NodeAction)SystemAction.get(Class.forName("org.openide.actions.MoveUpAction")); // NOI18N |
65 |
moveDown = (NodeAction)SystemAction.get(Class.forName("org.openide.actions.MoveDownAction")); // NOI18N |
75 |
NodeAction globalMoveDown = (NodeAction)SystemAction.get(Class.forName("org.openide.actions.MoveDownAction")); // NOI18N |
66 |
newAction = (NodeAction)SystemAction.get(Class.forName("org.openide.actions.NewAction")); // NOI18N |
76 |
NodeAction globalNewAction = (NodeAction)SystemAction.get(Class.forName("org.openide.actions.NewAction")); // NOI18N |
|
|
77 |
// Get context aware instances. |
78 |
moveUp = globalMoveUp.createContextAwareInstance(exPanel.getLookup()); |
79 |
moveDown = globalMoveDown.createContextAwareInstance(exPanel.getLookup()); |
80 |
newAction = globalNewAction.createContextAwareInstance(exPanel.getLookup()); |
67 |
} catch (ClassNotFoundException cnfe) { |
81 |
} catch (ClassNotFoundException cnfe) { |
68 |
} |
82 |
} |
69 |
|
83 |
|
Lines 95-101
Link Here
|
95 |
private void initComponents() {//GEN-BEGIN:initComponents |
109 |
private void initComponents() {//GEN-BEGIN:initComponents |
96 |
java.awt.GridBagConstraints gridBagConstraints; |
110 |
java.awt.GridBagConstraints gridBagConstraints; |
97 |
|
111 |
|
98 |
treeTableView1 = new org.openide.explorer.view.TreeTableView(); |
|
|
99 |
jPanel1 = new javax.swing.JPanel(); |
112 |
jPanel1 = new javax.swing.JPanel(); |
100 |
newButton = new javax.swing.JButton(); |
113 |
newButton = new javax.swing.JButton(); |
101 |
deleteButton = new javax.swing.JButton(); |
114 |
deleteButton = new javax.swing.JButton(); |
Lines 103-122
Link Here
|
103 |
downButton = new javax.swing.JButton(); |
116 |
downButton = new javax.swing.JButton(); |
104 |
detailsButton = new javax.swing.JButton(); |
117 |
detailsButton = new javax.swing.JButton(); |
105 |
propertiesLabel = new javax.swing.JLabel(); |
118 |
propertiesLabel = new javax.swing.JLabel(); |
|
|
119 |
jPanel2 = new javax.swing.JPanel(); |
106 |
|
120 |
|
107 |
setLayout(new java.awt.GridBagLayout()); |
121 |
setLayout(new java.awt.GridBagLayout()); |
108 |
|
122 |
|
109 |
setBorder(new javax.swing.border.EmptyBorder(new java.awt.Insets(12, 12, 0, 12))); |
123 |
setBorder(new javax.swing.border.EmptyBorder(new java.awt.Insets(12, 12, 0, 12))); |
110 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
|
|
111 |
gridBagConstraints.gridx = 0; |
112 |
gridBagConstraints.gridy = 1; |
113 |
gridBagConstraints.gridheight = java.awt.GridBagConstraints.RELATIVE; |
114 |
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; |
115 |
gridBagConstraints.insets = new java.awt.Insets(0, 0, 11, 11); |
116 |
gridBagConstraints.weightx = 1.0; |
117 |
gridBagConstraints.weighty = 0.1; |
118 |
add(treeTableView1, gridBagConstraints); |
119 |
|
120 |
jPanel1.setLayout(new java.awt.GridLayout(5, 1, 0, 5)); |
124 |
jPanel1.setLayout(new java.awt.GridLayout(5, 1, 0, 5)); |
121 |
|
125 |
|
122 |
newButton.setText(org.openide.util.NbBundle.getBundle(IndexedEditorPanel.class).getString("CTL_New")); |
126 |
newButton.setText(org.openide.util.NbBundle.getBundle(IndexedEditorPanel.class).getString("CTL_New")); |
Lines 173-180
Link Here
|
173 |
gridBagConstraints.insets = new java.awt.Insets(0, 0, 11, 0); |
177 |
gridBagConstraints.insets = new java.awt.Insets(0, 0, 11, 0); |
174 |
add(jPanel1, gridBagConstraints); |
178 |
add(jPanel1, gridBagConstraints); |
175 |
|
179 |
|
176 |
propertiesLabel.setText(org.openide.util.NbBundle.getBundle(IndexedEditorPanel.class).getString("CTL_Properties")); |
|
|
177 |
propertiesLabel.setLabelFor(treeTableView1); |
180 |
propertiesLabel.setLabelFor(treeTableView1); |
|
|
181 |
propertiesLabel.setText(org.openide.util.NbBundle.getBundle(IndexedEditorPanel.class).getString("CTL_Properties")); |
178 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
182 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
179 |
gridBagConstraints.gridx = 0; |
183 |
gridBagConstraints.gridx = 0; |
180 |
gridBagConstraints.gridy = 0; |
184 |
gridBagConstraints.gridy = 0; |
Lines 183-188
Link Here
|
183 |
gridBagConstraints.insets = new java.awt.Insets(0, 0, 2, 11); |
187 |
gridBagConstraints.insets = new java.awt.Insets(0, 0, 2, 11); |
184 |
add(propertiesLabel, gridBagConstraints); |
188 |
add(propertiesLabel, gridBagConstraints); |
185 |
|
189 |
|
|
|
190 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
191 |
gridBagConstraints.gridx = 0; |
192 |
gridBagConstraints.gridy = 1; |
193 |
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; |
194 |
gridBagConstraints.insets = new java.awt.Insets(0, 0, 11, 11); |
195 |
gridBagConstraints.weightx = 1.0; |
196 |
add(jPanel2, gridBagConstraints); |
197 |
|
186 |
}//GEN-END:initComponents |
198 |
}//GEN-END:initComponents |
187 |
|
199 |
|
188 |
private void detailsButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_detailsButtonActionPerformed |
200 |
private void detailsButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_detailsButtonActionPerformed |
Lines 204-210
Link Here
|
204 |
PropertyDialogManager.notify(pve); |
216 |
PropertyDialogManager.notify(pve); |
205 |
} |
217 |
} |
206 |
if ((newAction != null) && (newAction.isEnabled())) { |
218 |
if ((newAction != null) && (newAction.isEnabled())) { |
207 |
newAction.performAction(); |
219 |
newAction.actionPerformed(evt); |
208 |
} |
220 |
} |
209 |
}//GEN-LAST:event_newButtonActionPerformed |
221 |
}//GEN-LAST:event_newButtonActionPerformed |
210 |
|
222 |
|
Lines 224-230
Link Here
|
224 |
private void downButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_downButtonActionPerformed |
236 |
private void downButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_downButtonActionPerformed |
225 |
Node[] sn = getExplorerManager().getSelectedNodes(); |
237 |
Node[] sn = getExplorerManager().getSelectedNodes(); |
226 |
if ((moveDown != null) && (moveDown.isEnabled())) { |
238 |
if ((moveDown != null) && (moveDown.isEnabled())) { |
227 |
moveDown.performAction(); |
239 |
moveDown.actionPerformed(evt); |
228 |
} |
240 |
} |
229 |
|
241 |
|
230 |
if ((sn == null) || (sn.length != 1) || (sn[0] == rootNode)) { |
242 |
if ((sn == null) || (sn.length != 1) || (sn[0] == rootNode)) { |
Lines 240-246
Link Here
|
240 |
private void upButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_upButtonActionPerformed |
252 |
private void upButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_upButtonActionPerformed |
241 |
Node[] sn = getExplorerManager().getSelectedNodes(); |
253 |
Node[] sn = getExplorerManager().getSelectedNodes(); |
242 |
if ((moveUp != null) && (moveUp.isEnabled())) { |
254 |
if ((moveUp != null) && (moveUp.isEnabled())) { |
243 |
moveUp.performAction(); |
255 |
moveUp.actionPerformed(evt); |
244 |
} |
256 |
} |
245 |
|
257 |
|
246 |
if ((sn == null) || (sn.length != 1) || (sn[0] == rootNode)) { |
258 |
if ((sn == null) || (sn.length != 1) || (sn[0] == rootNode)) { |
Lines 260-275
Link Here
|
260 |
} |
272 |
} |
261 |
|
273 |
|
262 |
// Variables declaration - do not modify//GEN-BEGIN:variables |
274 |
// Variables declaration - do not modify//GEN-BEGIN:variables |
263 |
private org.openide.explorer.view.TreeTableView treeTableView1; |
275 |
private javax.swing.JButton deleteButton; |
264 |
private javax.swing.JButton detailsButton; |
276 |
private javax.swing.JButton detailsButton; |
265 |
private javax.swing.JLabel propertiesLabel; |
|
|
266 |
private javax.swing.JButton newButton; |
267 |
private javax.swing.JButton downButton; |
277 |
private javax.swing.JButton downButton; |
268 |
private javax.swing.JButton deleteButton; |
|
|
269 |
private javax.swing.JPanel jPanel1; |
278 |
private javax.swing.JPanel jPanel1; |
|
|
279 |
private javax.swing.JPanel jPanel2; |
280 |
private javax.swing.JButton newButton; |
281 |
private javax.swing.JLabel propertiesLabel; |
270 |
private javax.swing.JButton upButton; |
282 |
private javax.swing.JButton upButton; |
271 |
// End of variables declaration//GEN-END:variables |
283 |
// End of variables declaration//GEN-END:variables |
272 |
|
284 |
// XXX look into constructor |
|
|
285 |
private TreeTableView treeTableView1; |
286 |
|
273 |
private void updateButtonState() { |
287 |
private void updateButtonState() { |
274 |
if (showingDetails) { |
288 |
if (showingDetails) { |
275 |
detailsButton.setText(NbBundle.getBundle(IndexedEditorPanel.class).getString("CTL_HideDetails")); |
289 |
detailsButton.setText(NbBundle.getBundle(IndexedEditorPanel.class).getString("CTL_HideDetails")); |