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 120553
Collapse All | Expand All

(-)openide/explorer/apichanges.xml (+14 lines)
Lines 46-51 Link Here
46
<apidef name="explorer">Explorer API</apidef>
46
<apidef name="explorer">Explorer API</apidef>
47
</apidefs>
47
</apidefs>
48
<changes>
48
<changes>
49
    <change id="ColumnDisplayNameWithMnemonicTTV">
50
        <api name="explorer"/>
51
        <summary>Added support for property ColumnDisplayNameWithMnemonicTTV.</summary>
52
        <version major="6" minor="12"/>
53
        <date day="30" month="10" year="2007"/>
54
        <author login="saubrecht"/>
55
        <compatibility binary="compatible" source="compatible" deprecation="no" deletion="no"/>
56
        <description>Added support for property ColumnDisplayNameWithMnemonicTTV. This
57
        property may be used to specify column names with mnemonic char using '&amp;' char.
58
        Such display name will be used in 'Change Visible Columns' dialog window.
59
        </description>
60
        <class package="org.openide.explorer.view" name="NodeTableModel"/>
61
        <issue number="113642"/>
62
    </change>
49
    <change id="setUseSubstringInQuickSearch">
63
    <change id="setUseSubstringInQuickSearch">
50
        <api name="explorer"/>
64
        <api name="explorer"/>
51
        <summary>Added method TreeView.setUseSubstringInQuickSearch(boolean).</summary>
65
        <summary>Added method TreeView.setUseSubstringInQuickSearch(boolean).</summary>
(-)openide/explorer/manifest.mf (-1 / +1 lines)
Lines 1-6 Link Here
1
Manifest-Version: 1.0
1
Manifest-Version: 1.0
2
OpenIDE-Module: org.openide.explorer
2
OpenIDE-Module: org.openide.explorer
3
OpenIDE-Module-Specification-Version: 6.11
3
OpenIDE-Module-Specification-Version: 6.12
4
OpenIDE-Module-Implementation-Version: 1
4
OpenIDE-Module-Implementation-Version: 1
5
OpenIDE-Module-Localizing-Bundle: org/openide/explorer/Bundle.properties
5
OpenIDE-Module-Localizing-Bundle: org/openide/explorer/Bundle.properties
6
AutoUpdate-Essential-Module: true
6
AutoUpdate-Essential-Module: true
(-)openide/explorer/src/org/openide/explorer/view/NodeTableModel.java (-3 / +17 lines)
Lines 52-63 Link Here
52
import java.beans.PropertyChangeListener;
52
import java.beans.PropertyChangeListener;
53
53
54
import java.util.ArrayList;
54
import java.util.ArrayList;
55
import java.util.HashMap;
56
import java.util.Iterator;
55
import java.util.Iterator;
57
import java.util.TreeMap;
56
import java.util.TreeMap;
58
57
59
import javax.swing.*;
58
import javax.swing.*;
60
import javax.swing.table.AbstractTableModel;
59
import javax.swing.table.AbstractTableModel;
60
import org.openide.awt.Mnemonics;
61
61
62
62
63
/**
63
/**
Lines 78-83 Link Here
78
    private static final String ATTR_ORDER_NUMBER = "OrderNumberTTV"; // NOI18N
78
    private static final String ATTR_ORDER_NUMBER = "OrderNumberTTV"; // NOI18N
79
    private static final String ATTR_TREE_COLUMN = "TreeColumnTTV"; // NOI18N
79
    private static final String ATTR_TREE_COLUMN = "TreeColumnTTV"; // NOI18N
80
    private static final String ATTR_MNEMONIC_CHAR = "ColumnMnemonicCharTTV"; // NOI18N
80
    private static final String ATTR_MNEMONIC_CHAR = "ColumnMnemonicCharTTV"; // NOI18N
81
    private static final String ATTR_DISPLAY_NAME_WITH_MNEMONIC = "ColumnDisplayNameWithMnemonicTTV"; // NOI18N
81
82
82
    /** all columns of model */
83
    /** all columns of model */
83
    ArrayColumn[] allPropertyColumns = new ArrayColumn[] {  };
84
    ArrayColumn[] allPropertyColumns = new ArrayColumn[] {  };
Lines 675-682 Link Here
675
676
676
        for (int i = 0; i < allPropertyColumns.length; i++) {
677
        for (int i = 0; i < allPropertyColumns.length; i++) {
677
            oldvalues[i] = isVisible(allPropertyColumns[i].getProperty());
678
            oldvalues[i] = isVisible(allPropertyColumns[i].getProperty());
678
            boxtext = allPropertyColumns[i].getProperty().getDisplayName() + ": " +
679
            boxtext = getDisplayNameWithMnemonic( allPropertyColumns[i].getProperty() ) 
679
                allPropertyColumns[i].getProperty().getShortDescription(); // NOI18N
680
                    + ": " 
681
                    + allPropertyColumns[i].getProperty().getShortDescription(); // NOI18N
680
            sort.put(boxtext, Integer.valueOf(i));
682
            sort.put(boxtext, Integer.valueOf(i));
681
        }
683
        }
682
684
Lines 688-693 Link Here
688
690
689
            int i = sort.get(boxtext).intValue();
691
            int i = sort.get(boxtext).intValue();
690
            JCheckBox b = new JCheckBox(boxtext, oldvalues[i]);
692
            JCheckBox b = new JCheckBox(boxtext, oldvalues[i]);
693
            Mnemonics.setLocalizedText(b, boxtext);
691
            makeAccessibleCheckBox(b, allPropertyColumns[i].getProperty());
694
            makeAccessibleCheckBox(b, allPropertyColumns[i].getProperty());
692
            sortpointer[j] = i;
695
            sortpointer[j] = i;
693
            panel.add(b, gridBagConstraints);
696
            panel.add(b, gridBagConstraints);
Lines 744-749 Link Here
744
        return changed;
747
        return changed;
745
    }
748
    }
746
749
750
    String getDisplayNameWithMnemonic( Property p ) {
751
        String res = null;
752
        Object displayNameWithMnemonic = p.getValue(ATTR_DISPLAY_NAME_WITH_MNEMONIC);
753
        if( null !=displayNameWithMnemonic && displayNameWithMnemonic.toString().length() > 0 ) {
754
            res = displayNameWithMnemonic.toString();
755
        } else {
756
            res = p.getDisplayName();
757
        }
758
        return res;
759
    }
760
747
    void makeAccessibleCheckBox(JCheckBox box, Property p) {
761
    void makeAccessibleCheckBox(JCheckBox box, Property p) {
748
        box.getAccessibleContext().setAccessibleName(p.getDisplayName());
762
        box.getAccessibleContext().setAccessibleName(p.getDisplayName());
749
        box.getAccessibleContext().setAccessibleDescription(p.getShortDescription());
763
        box.getAccessibleContext().setAccessibleDescription(p.getShortDescription());
(-)openide/explorer/src/org/openide/explorer/view/TreeTableView.java (+8 lines)
Lines 152-157 Link Here
152
 *            If not set, no mnemonic will be displayed.
152
 *            If not set, no mnemonic will be displayed.
153
 *        </TD>
153
 *        </TD>
154
 *    </TR>
154
 *    </TR>
155
 *    <TR>
156
 *        <TD> ColumnDisplayNameWithMnemonicTTV</TD>
157
 *        <TD> String </TD>
158
 *        <TD> When set, this parameter contains column's display name with
159
 *              '&amp;' as the mnemonic. This parameter should be preferred over
160
 *              ColumnMnemonicCharTTV.
161
 *        </TD>
162
 *    </TR>
155
 * </TABLE>
163
 * </TABLE>
156
 *
164
 *
157
 * <p>
165
 * <p>
(-)openide/explorer/test/unit/src/org/openide/explorer/view/NodeTableModelTest.java (+60 lines)
Lines 44-49 Link Here
44
import java.lang.reflect.InvocationTargetException;
44
import java.lang.reflect.InvocationTargetException;
45
import javax.swing.JCheckBox;
45
import javax.swing.JCheckBox;
46
import org.netbeans.junit.NbTestCase;
46
import org.netbeans.junit.NbTestCase;
47
import org.openide.awt.Mnemonics;
47
import org.openide.nodes.Node;
48
import org.openide.nodes.Node;
48
49
49
/*
50
/*
Lines 113-118 Link Here
113
    }
114
    }
114
    
115
    
115
116
117
    public void testGetDisplayNameWithMnemonic() {
118
        MyNodeTableModel model = new MyNodeTableModel( 0 );
119
120
        MyProperty p;
121
        JCheckBox checkBox;
122
123
        p = new MyProperty();
124
        p.setDisplayName( "displayName1" );
125
        p.setShortDescription( "shortDescription1" );
126
        p.setValue( "ColumnMnemonicCharTTV", "" );
127
128
        assertEquals( "Invalid display name:", model.getDisplayNameWithMnemonic(p), p.getDisplayName() );
129
        
130
        
131
        p = new MyProperty();
132
        p.setDisplayName( "displayName1" );
133
        p.setShortDescription( "shortDescription1" );
134
        p.setValue( "ColumnDisplayNameWithMnemonicTTV", "otherDisplayName" );
135
        p.setValue( "ColumnMnemonicCharTTV", "" );
136
        checkBox = new JCheckBox( model.getDisplayNameWithMnemonic(p) );
137
        Mnemonics.setLocalizedText(checkBox, checkBox.getText());
138
        model.makeAccessibleCheckBox( checkBox, p );
139
140
        assertEquals( "Invalid display name:", 
141
                p.getValue("ColumnDisplayNameWithMnemonicTTV"),
142
                model.getDisplayNameWithMnemonic(p) );
143
        assertEquals( "Invalid mnemonic", 0, checkBox.getMnemonic() );
144
        
145
        
146
        p = new MyProperty();
147
        p.setDisplayName( "displayName1" );
148
        p.setShortDescription( "shortDescription1" );
149
        p.setValue( "ColumnDisplayNameWithMnemonicTTV", "otherDisplayName" );
150
        p.setValue( "ColumnMnemonicCharTTV", "t" );
151
        checkBox = new JCheckBox( model.getDisplayNameWithMnemonic(p) );
152
        Mnemonics.setLocalizedText(checkBox, checkBox.getText());
153
        model.makeAccessibleCheckBox( checkBox, p );
154
155
        assertEquals( "Invalid display name:", 
156
                p.getValue("ColumnDisplayNameWithMnemonicTTV"),
157
                model.getDisplayNameWithMnemonic(p) );
158
        assertEquals( "Invalid mnemonic", 'T', checkBox.getMnemonic() );
159
        
160
        
161
        p = new MyProperty();
162
        p.setDisplayName( "displayName1" );
163
        p.setShortDescription( "shortDescription1" );
164
        p.setValue( "ColumnDisplayNameWithMnemonicTTV", "other&DisplayName" );
165
        p.setValue( "ColumnMnemonicCharTTV", "" );
166
        checkBox = new JCheckBox( model.getDisplayNameWithMnemonic(p) );
167
        Mnemonics.setLocalizedText(checkBox, checkBox.getText());
168
        model.makeAccessibleCheckBox( checkBox, p );
169
170
        assertEquals( "Invalid display name:", 
171
                p.getValue("ColumnDisplayNameWithMnemonicTTV"),
172
                model.getDisplayNameWithMnemonic(p) );
173
        assertEquals( "Invalid mnemonic", 'D', checkBox.getMnemonic() );
174
    }
175
116
    private static class MyNodeTableModel extends NodeTableModel {
176
    private static class MyNodeTableModel extends NodeTableModel {
117
        public MyNodeTableModel( int columnCount ) {
177
        public MyNodeTableModel( int columnCount ) {
118
            this.allPropertyColumns = new NodeTableModel.ArrayColumn[columnCount];
178
            this.allPropertyColumns = new NodeTableModel.ArrayColumn[columnCount];

Return to bug 120553