< prev index next >

src/share/classes/sun/swing/FilePane.java

Print this page
rev 1492 : 7032018: The file list in JFileChooser does not have an accessible name
Reviewed-by: rupashka, coffeys
rev 1527 : 6727662: Code improvement and warnings removing from swing packages
Summary: Removed unnecessary castings and other warnings
Reviewed-by: malenkov

*** 33,42 **** --- 33,43 ---- import java.text.DateFormat; import java.text.MessageFormat; import java.util.*; import java.util.List; + import javax.accessibility.AccessibleContext; import javax.swing.*; import javax.swing.border.*; import javax.swing.event.*; import javax.swing.filechooser.*; import javax.swing.plaf.basic.*;
*** 80,89 **** --- 81,93 ---- private int viewType = -1; private JPanel[] viewPanels = new JPanel[VIEWTYPE_COUNT]; private JPanel currentViewPanel; private String[] viewTypeActionNames; + private String filesListAccessibleName = null; + private String filesDetailsAccessibleName = null; + private JPopupMenu contextMenu; private JMenu viewMenu; private String viewMenuLabelText; private String refreshActionLabelText;
*** 447,456 **** --- 451,463 ---- kiloByteString = UIManager.getString("FileChooser.fileSizeKiloBytes", l); megaByteString = UIManager.getString("FileChooser.fileSizeMegaBytes", l); gigaByteString = UIManager.getString("FileChooser.fileSizeGigaBytes", l); fullRowSelection = UIManager.getBoolean("FileView.fullRowSelection"); + filesListAccessibleName = UIManager.getString("FileChooser.filesListAccessibleName", l); + filesDetailsAccessibleName = UIManager.getString("FileChooser.filesDetailsAccessibleName", l); + renameErrorTitleText = UIManager.getString("FileChooser.renameErrorTitleText", l); renameErrorText = UIManager.getString("FileChooser.renameErrorText", l); } /**
*** 544,555 **** } public static void addActionsToMap(ActionMap map, Action[] actions) { if (map != null && actions != null) { ! for (int i = 0; i < actions.length; i++) { ! Action a = actions[i]; String cmd = (String)a.getValue(Action.ACTION_COMMAND_KEY); if (cmd == null) { cmd = (String)a.getValue(Action.NAME); } map.put(cmd, a); --- 551,561 ---- } public static void addActionsToMap(ActionMap map, Action[] actions) { if (map != null && actions != null) { ! for (Action a : actions) { String cmd = (String)a.getValue(Action.ACTION_COMMAND_KEY); if (cmd == null) { cmd = (String)a.getValue(Action.NAME); } map.put(cmd, a);
*** 631,640 **** --- 637,649 ---- list.setBackground(listViewBackground); } if (listViewBorder != null) { scrollpane.setBorder(listViewBorder); } + + list.putClientProperty(AccessibleContext.ACCESSIBLE_NAME_PROPERTY, filesListAccessibleName); + p.add(scrollpane, BorderLayout.CENTER); return p; } /**
*** 713,729 **** columns = new ShellFolderColumnInfo[visibleColumns.size()]; visibleColumns.toArray(columns); columnMap = Arrays.copyOf(columnMap, columns.length); ! List<RowSorter.SortKey> sortKeys = (rowSorter == null) ? null : rowSorter.getSortKeys(); fireTableStructureChanged(); restoreSortKeys(sortKeys); } ! private void restoreSortKeys(List<RowSorter.SortKey> sortKeys) { if (sortKeys != null) { // check if preserved sortKeys are valid for this folder for (int i = 0; i < sortKeys.size(); i++) { RowSorter.SortKey sortKey = sortKeys.get(i); if (sortKey.getColumn() >= columns.length) { --- 722,738 ---- columns = new ShellFolderColumnInfo[visibleColumns.size()]; visibleColumns.toArray(columns); columnMap = Arrays.copyOf(columnMap, columns.length); ! List<? extends RowSorter.SortKey> sortKeys = (rowSorter == null) ? null : rowSorter.getSortKeys(); fireTableStructureChanged(); restoreSortKeys(sortKeys); } ! private void restoreSortKeys(List<? extends RowSorter.SortKey> sortKeys) { if (sortKeys != null) { // check if preserved sortKeys are valid for this folder for (int i = 0; i < sortKeys.size(); i++) { RowSorter.SortKey sortKey = sortKeys.get(i); if (sortKey.getColumn() >= columns.length) {
*** 881,891 **** rowSorter = new DetailsTableRowSorter(); } return rowSorter; } ! private class DetailsTableRowSorter extends TableRowSorter { public DetailsTableRowSorter() { setModelWrapper(new SorterModelWrapper()); } public void updateComparators(ShellFolderColumnInfo [] columns) { --- 890,900 ---- rowSorter = new DetailsTableRowSorter(); } return rowSorter; } ! private class DetailsTableRowSorter extends TableRowSorter<TableModel> { public DetailsTableRowSorter() { setModelWrapper(new SorterModelWrapper()); } public void updateComparators(ShellFolderColumnInfo [] columns) {
*** 901,912 **** public void modelStructureChanged() { super.modelStructureChanged(); updateComparators(detailsTableModel.getColumns()); } ! private class SorterModelWrapper extends ModelWrapper { ! public Object getModel() { return getDetailsTableModel(); } public int getColumnCount() { return getDetailsTableModel().getColumnCount(); --- 910,921 ---- public void modelStructureChanged() { super.modelStructureChanged(); updateComparators(detailsTableModel.getColumns()); } ! private class SorterModelWrapper extends ModelWrapper<TableModel, Integer> { ! public TableModel getModel() { return getDetailsTableModel(); } public int getColumnCount() { return getDetailsTableModel().getColumnCount();
*** 918,928 **** public Object getValueAt(int row, int column) { return FilePane.this.getModel().getElementAt(row); } ! public Object getIdentifier(int row) { return row; } } } --- 927,937 ---- public Object getValueAt(int row, int column) { return FilePane.this.getModel().getElementAt(row); } ! public Integer getIdentifier(int row) { return row; } } }
*** 1205,1214 **** --- 1214,1225 ---- } p.add(scrollpane, BorderLayout.CENTER); detailsTableModel.fireTableStructureChanged(); + detailsTable.putClientProperty(AccessibleContext.ACCESSIBLE_NAME_PROPERTY, filesDetailsAccessibleName); + return p; } // createDetailsView private class AlignableTableHeaderRenderer implements TableCellRenderer { TableCellRenderer wrappedRenderer;
*** 1708,1720 **** } private void updateViewMenu() { if (viewMenu != null) { Component[] comps = viewMenu.getMenuComponents(); ! for (int i = 0; i < comps.length; i++) { ! if (comps[i] instanceof JRadioButtonMenuItem) { ! JRadioButtonMenuItem mi = (JRadioButtonMenuItem)comps[i]; if (((ViewTypeAction)mi.getAction()).viewType == viewType) { mi.setSelected(true); } } } --- 1719,1731 ---- } private void updateViewMenu() { if (viewMenu != null) { Component[] comps = viewMenu.getMenuComponents(); ! for (Component comp : comps) { ! if (comp instanceof JRadioButtonMenuItem) { ! JRadioButtonMenuItem mi = (JRadioButtonMenuItem) comp; if (((ViewTypeAction)mi.getAction()).viewType == viewType) { mi.setSelected(true); } } }
< prev index next >