This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 65096
Collapse All | Expand All

(-)/Users/catlan/Desktop/ConfigureToolbarPanel.java (-25 / +48 lines)
Lines 14-19 Link Here
14
package org.netbeans.core.windows.view.ui.toolbars;
14
package org.netbeans.core.windows.view.ui.toolbars;
15
15
16
import java.awt.BorderLayout;
16
import java.awt.BorderLayout;
17
import java.awt.Color;
17
import java.awt.Cursor;
18
import java.awt.Cursor;
18
import java.awt.Dimension;
19
import java.awt.Dimension;
19
import java.awt.datatransfer.DataFlavor;
20
import java.awt.datatransfer.DataFlavor;
Lines 51-63 Link Here
51
import org.openide.util.NbBundle;
52
import org.openide.util.NbBundle;
52
import org.openide.util.datatransfer.ExTransferable;
53
import org.openide.util.datatransfer.ExTransferable;
53
import org.openide.util.datatransfer.NewType;
54
import org.openide.util.datatransfer.NewType;
55
54
/**
56
/**
55
 * Toolbar Customizer showing a tree of all available actions. Users can drag actions
57
 * Toolbar Customizer showing a tree of all available actions. Users can drag actions
56
 * to toolbars to add new toolbar buttons.
58
 * to toolbars to add new toolbar buttons.
57
 *
59
 *
58
 * @author  Stanislav Aubrecht
60
 * @author  Stanislav Aubrecht
59
 */
61
 */
60
public class ConfigureToolbarPanel extends javax.swing.JPanel implements Runnable {
62
public class ConfigureToolbarPanel extends javax.swing.JPanel implements Runnable/*, DragGestureListener*/ {
61
    
63
    
62
    private static WeakReference dialogRef; // is weak reference necessary?
64
    private static WeakReference dialogRef; // is weak reference necessary?
63
    
65
    
Lines 67-72 Link Here
67
    private ConfigureToolbarPanel() {
69
    private ConfigureToolbarPanel() {
68
        initComponents();
70
        initComponents();
69
        
71
        
72
        org.openide.awt.Mnemonics.setLocalizedText(
73
                closeButton, getBundleString("CTL_Close"));
74
	    
70
        setCursor( Cursor.getPredefinedCursor( Cursor.WAIT_CURSOR ) );
75
        setCursor( Cursor.getPredefinedCursor( Cursor.WAIT_CURSOR ) );
71
        
76
        
72
        FileSystem fs = Repository.getDefault().getDefaultFileSystem();
77
        FileSystem fs = Repository.getDefault().getDefaultFileSystem();
Lines 81-90 Link Here
81
    }
86
    }
82
    
87
    
83
    public void run() {
88
    public void run() {
84
        ActionsTree tree = new ActionsTree( root );
89
	ConfigureToolbarPanelAqua cfpa = new ConfigureToolbarPanelAqua(root);
85
        palettePanel.removeAll();
90
	
86
        palettePanel.setBorder( BorderFactory.createEmptyBorder() );
91
	palettePanel.removeAll();
87
        palettePanel.add( new JScrollPane(tree), BorderLayout.CENTER );
92
	JScrollPane sp = new JScrollPane(cfpa);
93
	sp.setBorder(null);
94
        palettePanel.add( sp, BorderLayout.CENTER );
88
        invalidate();
95
        invalidate();
89
        validate();
96
        validate();
90
        repaint();
97
        repaint();
Lines 96-115 Link Here
96
        if (dialogRef != null)
103
        if (dialogRef != null)
97
            dialog = (JDialog) dialogRef.get();
104
            dialog = (JDialog) dialogRef.get();
98
        if (dialog == null) {
105
        if (dialog == null) {
99
            JButton closeButton = new JButton();
106
	    ConfigureToolbarPanel cp = new ConfigureToolbarPanel();
100
            closeButton.addActionListener( new ActionListener() {
101
                public void actionPerformed(ActionEvent e) {
102
                    endToolbarEditMode();
103
                }
104
            });
105
            org.openide.awt.Mnemonics.setLocalizedText(
106
                closeButton, getBundleString("CTL_Close")); 
107
            DialogDescriptor dd = new DialogDescriptor(
107
            DialogDescriptor dd = new DialogDescriptor(
108
                new ConfigureToolbarPanel(),
108
                cp,
109
                getBundleString("CustomizerTitle"), 
109
                getBundleString("CustomizerTitle"), 
110
                false,
110
                false,
111
                new Object[] { closeButton },
111
                new Object[]{},
112
                closeButton,
112
                cp.closeButton,
113
                DialogDescriptor.DEFAULT_ALIGN,
113
                DialogDescriptor.DEFAULT_ALIGN,
114
                null,
114
                null,
115
                null);
115
                null);
Lines 185-216 Link Here
185
        palettePanel = new javax.swing.JPanel();
185
        palettePanel = new javax.swing.JPanel();
186
        checkSmallIcons = new javax.swing.JCheckBox();
186
        checkSmallIcons = new javax.swing.JCheckBox();
187
        btnNewToolbar = new javax.swing.JButton();
187
        btnNewToolbar = new javax.swing.JButton();
188
        closeButton = new javax.swing.JButton();
188
189
189
        setLayout(new java.awt.GridBagLayout());
190
        setLayout(new java.awt.GridBagLayout());
190
191
192
        lblHint.setFont(new java.awt.Font("Lucida Grande", 1, 13));
191
        lblHint.setLabelFor(palettePanel);
193
        lblHint.setLabelFor(palettePanel);
192
        lblHint.setText(getBundleString("CTL_TreeLabel"));
194
        lblHint.setText(getBundleString("CTL_TreeLabel"));
193
        gridBagConstraints = new java.awt.GridBagConstraints();
195
        gridBagConstraints = new java.awt.GridBagConstraints();
194
        gridBagConstraints.gridwidth = 2;
196
        gridBagConstraints.gridwidth = 3;
195
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
197
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
196
        gridBagConstraints.insets = new java.awt.Insets(10, 10, 1, 10);
198
        gridBagConstraints.insets = new java.awt.Insets(10, 10, 1, 10);
197
        add(lblHint, gridBagConstraints);
199
        add(lblHint, gridBagConstraints);
198
200
199
        palettePanel.setLayout(new java.awt.BorderLayout());
201
        palettePanel.setLayout(new java.awt.BorderLayout());
200
202
201
        palettePanel.setBorder(new javax.swing.border.EtchedBorder());
203
        palettePanel.setBorder(new LineBorder(null, null, new Color(135,135,135), null));
202
        gridBagConstraints = new java.awt.GridBagConstraints();
204
        gridBagConstraints = new java.awt.GridBagConstraints();
203
        gridBagConstraints.gridx = 0;
205
        gridBagConstraints.gridx = 0;
204
        gridBagConstraints.gridy = 1;
206
        gridBagConstraints.gridy = 1;
205
        gridBagConstraints.gridwidth = 2;
207
        gridBagConstraints.gridwidth = 3;
206
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
208
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
207
        gridBagConstraints.weightx = 1.0;
209
        gridBagConstraints.weightx = 1.0;
208
        gridBagConstraints.weighty = 1.0;
210
        gridBagConstraints.weighty = 1.0;
209
        gridBagConstraints.insets = new java.awt.Insets(1, 10, 5, 10);
211
        gridBagConstraints.insets = new java.awt.Insets(5, 0, 0, 0);
210
        add(palettePanel, gridBagConstraints);
212
        add(palettePanel, gridBagConstraints);
211
213
212
        checkSmallIcons.setText(getBundleString("CTL_SmallIcons"));
214
        checkSmallIcons.setText(getBundleString("CTL_SmallIcons"));
213
        checkSmallIcons.setBorder(new javax.swing.border.EmptyBorder(new java.awt.Insets(0, 0, 0, 0)));
215
        checkSmallIcons.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
214
        checkSmallIcons.setMargin(new java.awt.Insets(0, 0, 0, 0));
216
        checkSmallIcons.setMargin(new java.awt.Insets(0, 0, 0, 0));
215
        checkSmallIcons.setSelected( ToolbarPool.getDefault().getPreferredIconSize() == 16 );
217
        checkSmallIcons.setSelected( ToolbarPool.getDefault().getPreferredIconSize() == 16 );
216
        checkSmallIcons.addActionListener(new java.awt.event.ActionListener() {
218
        checkSmallIcons.addActionListener(new java.awt.event.ActionListener() {
Lines 222-229 Link Here
222
        gridBagConstraints = new java.awt.GridBagConstraints();
224
        gridBagConstraints = new java.awt.GridBagConstraints();
223
        gridBagConstraints.gridx = 1;
225
        gridBagConstraints.gridx = 1;
224
        gridBagConstraints.gridy = 2;
226
        gridBagConstraints.gridy = 2;
227
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
225
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
228
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
226
        gridBagConstraints.insets = new java.awt.Insets(10, 10, 0, 10);
229
        gridBagConstraints.weightx = 1.0;
230
        gridBagConstraints.insets = new java.awt.Insets(10, 10, 10, 10);
227
        add(checkSmallIcons, gridBagConstraints);
231
        add(checkSmallIcons, gridBagConstraints);
228
232
229
        btnNewToolbar.setText(getBundleString("CTL_NewToolbar"));
233
        btnNewToolbar.setText(getBundleString("CTL_NewToolbar"));
Lines 237-248 Link Here
237
        gridBagConstraints.gridx = 0;
241
        gridBagConstraints.gridx = 0;
238
        gridBagConstraints.gridy = 2;
242
        gridBagConstraints.gridy = 2;
239
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
243
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
240
        gridBagConstraints.insets = new java.awt.Insets(10, 10, 0, 10);
244
        gridBagConstraints.insets = new java.awt.Insets(10, 10, 10, 10);
241
        add(btnNewToolbar, gridBagConstraints);
245
        add(btnNewToolbar, gridBagConstraints);
242
246
247
        closeButton.setText("jButton1");
248
        closeButton.addActionListener(new java.awt.event.ActionListener() {
249
            public void actionPerformed(java.awt.event.ActionEvent evt) {
250
                closeButtonActionPerformed(evt);
251
            }
252
        });
253
254
        gridBagConstraints = new java.awt.GridBagConstraints();
255
        gridBagConstraints.gridx = 2;
256
        gridBagConstraints.gridy = 2;
257
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
258
        gridBagConstraints.insets = new java.awt.Insets(10, 10, 10, 10);
259
        add(closeButton, gridBagConstraints);
260
243
    }
261
    }
244
    // </editor-fold>//GEN-END:initComponents
262
    // </editor-fold>//GEN-END:initComponents
245
263
264
    private void closeButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_closeButtonActionPerformed
265
	endToolbarEditMode();
266
    }//GEN-LAST:event_closeButtonActionPerformed
267
246
    private void newToolbar(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_newToolbar
268
    private void newToolbar(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_newToolbar
247
        ToolbarFolderNode tf = new ToolbarFolderNode();
269
        ToolbarFolderNode tf = new ToolbarFolderNode();
248
        NewType[] newTypes = tf.getNewTypes();
270
        NewType[] newTypes = tf.getNewTypes();
Lines 270-280 Link Here
270
              tbConf.refresh();
292
              tbConf.refresh();
271
          }
293
          }
272
    }//GEN-LAST:event_switchIconSize
294
    }//GEN-LAST:event_switchIconSize
273
    
295
274
    
296
    
275
    // Variables declaration - do not modify//GEN-BEGIN:variables
297
    // Variables declaration - do not modify//GEN-BEGIN:variables
276
    private javax.swing.JButton btnNewToolbar;
298
    private javax.swing.JButton btnNewToolbar;
277
    private javax.swing.JCheckBox checkSmallIcons;
299
    private javax.swing.JCheckBox checkSmallIcons;
300
    private javax.swing.JButton closeButton;
278
    private javax.swing.JLabel lblHint;
301
    private javax.swing.JLabel lblHint;
279
    private javax.swing.JPanel palettePanel;
302
    private javax.swing.JPanel palettePanel;
280
    // End of variables declaration//GEN-END:variables
303
    // End of variables declaration//GEN-END:variables
Lines 323-329 Link Here
323
            super( original, Children.LEAF );
346
            super( original, Children.LEAF );
324
        }
347
        }
325
348
326
        public Transferable drag() throws IOException {
349
        public Transferable drag() throws IOException {    
327
            return new ExTransferable.Single( nodeDataFlavor ) {
350
            return new ExTransferable.Single( nodeDataFlavor ) {
328
                public Object getData() {
351
                public Object getData() {
329
                   return ItemActionNode.this;
352
                   return ItemActionNode.this;

Return to bug 65096