# This patch file was generated by NetBeans IDE # This patch can be applied using context Tools: Apply Diff Patch action on respective folder. # It uses platform neutral UTF-8 encoding. # Above lines and this line are ignored by the patching process. Index: openide/explorer/apichanges.xml --- openide/explorer/apichanges.xml Base (1.16) +++ openide/explorer/apichanges.xml Locally Modified (Based On 1.16) @@ -46,6 +46,20 @@ Explorer API + + + Added support for property ColumnDisplayNameWithMnemonicTTV. + + + + + Added support for property ColumnDisplayNameWithMnemonicTTV. This + property may be used to specify column names with mnemonic char using '&' char. + Such display name will be used in 'Change Visible Columns' dialog window. + + + + Added method TreeView.setUseSubstringInQuickSearch(boolean). Index: openide/explorer/manifest.mf --- openide/explorer/manifest.mf Base (1.14) +++ openide/explorer/manifest.mf Locally Modified (Based On 1.14) @@ -1,6 +1,6 @@ Manifest-Version: 1.0 OpenIDE-Module: org.openide.explorer -OpenIDE-Module-Specification-Version: 6.11 +OpenIDE-Module-Specification-Version: 6.12 OpenIDE-Module-Implementation-Version: 1 OpenIDE-Module-Localizing-Bundle: org/openide/explorer/Bundle.properties AutoUpdate-Essential-Module: true Index: openide/explorer/src/org/openide/explorer/view/NodeTableModel.java --- openide/explorer/src/org/openide/explorer/view/NodeTableModel.java Base (1.7) +++ openide/explorer/src/org/openide/explorer/view/NodeTableModel.java Locally Modified (Based On 1.7) @@ -52,12 +52,12 @@ import java.beans.PropertyChangeListener; import java.util.ArrayList; -import java.util.HashMap; import java.util.Iterator; import java.util.TreeMap; import javax.swing.*; import javax.swing.table.AbstractTableModel; +import org.openide.awt.Mnemonics; /** @@ -78,6 +78,7 @@ private static final String ATTR_ORDER_NUMBER = "OrderNumberTTV"; // NOI18N private static final String ATTR_TREE_COLUMN = "TreeColumnTTV"; // NOI18N private static final String ATTR_MNEMONIC_CHAR = "ColumnMnemonicCharTTV"; // NOI18N + private static final String ATTR_DISPLAY_NAME_WITH_MNEMONIC = "ColumnDisplayNameWithMnemonicTTV"; // NOI18N /** all columns of model */ ArrayColumn[] allPropertyColumns = new ArrayColumn[] { }; @@ -675,8 +676,9 @@ for (int i = 0; i < allPropertyColumns.length; i++) { oldvalues[i] = isVisible(allPropertyColumns[i].getProperty()); - boxtext = allPropertyColumns[i].getProperty().getDisplayName() + ": " + - allPropertyColumns[i].getProperty().getShortDescription(); // NOI18N + boxtext = getDisplayNameWithMnemonic( allPropertyColumns[i].getProperty() ) + + ": " + + allPropertyColumns[i].getProperty().getShortDescription(); // NOI18N sort.put(boxtext, Integer.valueOf(i)); } @@ -688,6 +690,7 @@ int i = sort.get(boxtext).intValue(); JCheckBox b = new JCheckBox(boxtext, oldvalues[i]); + Mnemonics.setLocalizedText(b, boxtext); makeAccessibleCheckBox(b, allPropertyColumns[i].getProperty()); sortpointer[j] = i; panel.add(b, gridBagConstraints); @@ -744,6 +747,17 @@ return changed; } + String getDisplayNameWithMnemonic( Property p ) { + String res = null; + Object displayNameWithMnemonic = p.getValue(ATTR_DISPLAY_NAME_WITH_MNEMONIC); + if( null !=displayNameWithMnemonic && displayNameWithMnemonic.toString().length() > 0 ) { + res = displayNameWithMnemonic.toString(); + } else { + res = p.getDisplayName(); + } + return res; + } + void makeAccessibleCheckBox(JCheckBox box, Property p) { box.getAccessibleContext().setAccessibleName(p.getDisplayName()); box.getAccessibleContext().setAccessibleDescription(p.getShortDescription()); Index: openide/explorer/src/org/openide/explorer/view/TreeTableView.java --- openide/explorer/src/org/openide/explorer/view/TreeTableView.java Base (1.17) +++ openide/explorer/src/org/openide/explorer/view/TreeTableView.java Locally Modified (Based On 1.17) @@ -152,6 +152,14 @@ * If not set, no mnemonic will be displayed. * * + * + * ColumnDisplayNameWithMnemonicTTV + * String + * When set, this parameter contains column's display name with + * '&' as the mnemonic. This parameter should be preferred over + * ColumnMnemonicCharTTV. + * + * * * *

Index: openide/explorer/test/unit/src/org/openide/explorer/view/NodeTableModelTest.java --- openide/explorer/test/unit/src/org/openide/explorer/view/NodeTableModelTest.java Base (1.3) +++ openide/explorer/test/unit/src/org/openide/explorer/view/NodeTableModelTest.java Locally Modified (Based On 1.3) @@ -44,6 +44,7 @@ import java.lang.reflect.InvocationTargetException; import javax.swing.JCheckBox; import org.netbeans.junit.NbTestCase; +import org.openide.awt.Mnemonics; import org.openide.nodes.Node; /* @@ -113,6 +114,65 @@ } + public void testGetDisplayNameWithMnemonic() { + MyNodeTableModel model = new MyNodeTableModel( 0 ); + + MyProperty p; + JCheckBox checkBox; + + p = new MyProperty(); + p.setDisplayName( "displayName1" ); + p.setShortDescription( "shortDescription1" ); + p.setValue( "ColumnMnemonicCharTTV", "" ); + + assertEquals( "Invalid display name:", model.getDisplayNameWithMnemonic(p), p.getDisplayName() ); + + + p = new MyProperty(); + p.setDisplayName( "displayName1" ); + p.setShortDescription( "shortDescription1" ); + p.setValue( "ColumnDisplayNameWithMnemonicTTV", "otherDisplayName" ); + p.setValue( "ColumnMnemonicCharTTV", "" ); + checkBox = new JCheckBox( model.getDisplayNameWithMnemonic(p) ); + Mnemonics.setLocalizedText(checkBox, checkBox.getText()); + model.makeAccessibleCheckBox( checkBox, p ); + + assertEquals( "Invalid display name:", + p.getValue("ColumnDisplayNameWithMnemonicTTV"), + model.getDisplayNameWithMnemonic(p) ); + assertEquals( "Invalid mnemonic", 0, checkBox.getMnemonic() ); + + + p = new MyProperty(); + p.setDisplayName( "displayName1" ); + p.setShortDescription( "shortDescription1" ); + p.setValue( "ColumnDisplayNameWithMnemonicTTV", "otherDisplayName" ); + p.setValue( "ColumnMnemonicCharTTV", "t" ); + checkBox = new JCheckBox( model.getDisplayNameWithMnemonic(p) ); + Mnemonics.setLocalizedText(checkBox, checkBox.getText()); + model.makeAccessibleCheckBox( checkBox, p ); + + assertEquals( "Invalid display name:", + p.getValue("ColumnDisplayNameWithMnemonicTTV"), + model.getDisplayNameWithMnemonic(p) ); + assertEquals( "Invalid mnemonic", 'T', checkBox.getMnemonic() ); + + + p = new MyProperty(); + p.setDisplayName( "displayName1" ); + p.setShortDescription( "shortDescription1" ); + p.setValue( "ColumnDisplayNameWithMnemonicTTV", "other&DisplayName" ); + p.setValue( "ColumnMnemonicCharTTV", "" ); + checkBox = new JCheckBox( model.getDisplayNameWithMnemonic(p) ); + Mnemonics.setLocalizedText(checkBox, checkBox.getText()); + model.makeAccessibleCheckBox( checkBox, p ); + + assertEquals( "Invalid display name:", + p.getValue("ColumnDisplayNameWithMnemonicTTV"), + model.getDisplayNameWithMnemonic(p) ); + assertEquals( "Invalid mnemonic", 'D', checkBox.getMnemonic() ); + } + private static class MyNodeTableModel extends NodeTableModel { public MyNodeTableModel( int columnCount ) { this.allPropertyColumns = new NodeTableModel.ArrayColumn[columnCount];