< prev index next >

## src/java.desktop/macosx/classes/com/apple/laf/AquaFileChooserUI.java

Print this page

    rev 48858 : Work in progress for JDK-6303622
    Use generic in Swing components like JComboBox
    1. Added generic return type and parameter type for JComboBox.
    2. Modified JList related classes as well.
    3. Reverted the changes made to "getSelectedValues" as suggested by Joe.
    4. Modified files that were failing on Linux and Mac as well.

    *** 1253,1268 ****
                  setSelectedItem(fDirectories.elementAt(0));

                  // dump();
              }

    !         public void setSelectedItem(final Object selectedDirectory) {
    !             this.fSelectedDirectory = (File)selectedDirectory;
                  fireContentsChanged(this, -1, -1);
              }

    !         public Object getSelectedItem() {
                  return fSelectedDirectory;
              }

              public int getSize() {
                  return fDirectories.size();
    --- 1253,1268 ----
                  setSelectedItem(fDirectories.elementAt(0));

                  // dump();
              }

    !         public void setSelectedItem(final File selectedDirectory) {
    !             this.fSelectedDirectory = selectedDirectory;
                  fireContentsChanged(this, -1, -1);
              }

    !         public File getSelectedItem() {
                  return fSelectedDirectory;
              }

              public int getSize() {
                  return fDirectories.size();
    *** 1316,1342 ****
                  String prop = e.getPropertyName();
                  if(prop == JFileChooser.CHOOSABLE_FILE_FILTER_CHANGED_PROPERTY) {
                      filters = (FileFilter[]) e.getNewValue();
                      fireContentsChanged(this, -1, -1);
                  } else if (prop == JFileChooser.FILE_FILTER_CHANGED_PROPERTY) {
    !                 setSelectedItem(e.getNewValue());
                  }
              }

    !         public void setSelectedItem(Object filter) {
                  if (filter != null && !isSelectedFileFilterInModel(filter)) {
                      oldFileFilter = filter;
    !                 getFileChooser().setFileFilter((FileFilter) filter);
                      fireContentsChanged(this, -1, -1);
                  }
              }

    !         private boolean isSelectedFileFilterInModel(Object filter) {
                  return Objects.equals(filter, oldFileFilter);
              }

    !         public Object getSelectedItem() {
                  // Ensure that the current filter is in the list.
                  // NOTE: we shouldnt' have to do this, since JFileChooser adds
                  // the filter to the choosable filters list when the filter
                  // is set. Lets be paranoid just in case someone overrides
                  // setFileFilter in JFileChooser.
    --- 1316,1342 ----
                  String prop = e.getPropertyName();
                  if(prop == JFileChooser.CHOOSABLE_FILE_FILTER_CHANGED_PROPERTY) {
                      filters = (FileFilter[]) e.getNewValue();
                      fireContentsChanged(this, -1, -1);
                  } else if (prop == JFileChooser.FILE_FILTER_CHANGED_PROPERTY) {
    !                 setSelectedItem((FileFilter)e.getNewValue());
                  }
              }

    !         public void setSelectedItem(FileFilter filter) {
                  if (filter != null && !isSelectedFileFilterInModel(filter)) {
                      oldFileFilter = filter;
    !                 getFileChooser().setFileFilter(filter);
                      fireContentsChanged(this, -1, -1);
                  }
              }

    !         private boolean isSelectedFileFilterInModel(FileFilter filter) {
                  return Objects.equals(filter, oldFileFilter);
              }

    !         public FileFilter getSelectedItem() {
                  // Ensure that the current filter is in the list.
                  // NOTE: we shouldnt' have to do this, since JFileChooser adds
                  // the filter to the choosable filters list when the filter
                  // is set. Lets be paranoid just in case someone overrides
                  // setFileFilter in JFileChooser.
    *** 1405,1415 ****
              protected DirectoryComboBoxAction() {
                  super("DirectoryComboBoxAction");
              }

              public void actionPerformed(final ActionEvent e) {
    !             getFileChooser().setCurrentDirectory((File)directoryComboBox.getSelectedItem());
              }
          }

          // Sorting Table operations
          @SuppressWarnings("serial") // Superclass is not serializable across versions
    --- 1405,1415 ----
              protected DirectoryComboBoxAction() {
                  super("DirectoryComboBoxAction");
              }

              public void actionPerformed(final ActionEvent e) {
    !             getFileChooser().setCurrentDirectory(directoryComboBox.getSelectedItem());
              }
          }

          // Sorting Table operations
          @SuppressWarnings("serial") // Superclass is not serializable across versions

< prev index next >