jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaFileChooserUI.java
changeset 28991 c9b7acf9062d
parent 28077 cdd7ab00a1e2
child 38387 ea8cc6a2fef2
equal deleted inserted replaced
28990:2656e19f0cd6 28991:c9b7acf9062d
     1 /*
     1 /*
     2  * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
  1096     protected class FileRenderer extends MacFCTableCellRenderer {
  1096     protected class FileRenderer extends MacFCTableCellRenderer {
  1097         public FileRenderer(final Font f) {
  1097         public FileRenderer(final Font f) {
  1098             super(f);
  1098             super(f);
  1099         }
  1099         }
  1100 
  1100 
  1101         public Component getTableCellRendererComponent(final JTable list, final Object value, final boolean isSelected, final boolean cellHasFocus, final int index, final int col) {
  1101         public Component getTableCellRendererComponent(final JTable list,
  1102             super.getTableCellRendererComponent(list, value, isSelected, false, index, col); // No focus border, thanks
  1102                                                        final Object value,
       
  1103                                                        final boolean isSelected,
       
  1104                                                        final boolean cellHasFocus,
       
  1105                                                        final int index,
       
  1106                                                        final int col) {
       
  1107             super.getTableCellRendererComponent(list, value, isSelected, false,
       
  1108                                                 index,
       
  1109                                                 col); // No focus border, thanks
  1103             final File file = (File)value;
  1110             final File file = (File)value;
  1104             final JFileChooser fc = getFileChooser();
  1111             final JFileChooser fc = getFileChooser();
  1105             setText(fc.getName(file));
  1112             setText(fc.getName(file));
  1106             setIcon(fc.getIcon(file));
  1113             setIcon(fc.getIcon(file));
  1107             setEnabled(isSelectableInList(file));
  1114             setEnabled(isSelectableInList(file));
  1113     protected class DateRenderer extends MacFCTableCellRenderer {
  1120     protected class DateRenderer extends MacFCTableCellRenderer {
  1114         public DateRenderer(final Font f) {
  1121         public DateRenderer(final Font f) {
  1115             super(f);
  1122             super(f);
  1116         }
  1123         }
  1117 
  1124 
  1118         public Component getTableCellRendererComponent(final JTable list, final Object value, final boolean isSelected, final boolean cellHasFocus, final int index, final int col) {
  1125         public Component getTableCellRendererComponent(final JTable list,
  1119             super.getTableCellRendererComponent(list, value, isSelected, false, index, col);
  1126                                                        final Object value,
       
  1127                                                        final boolean isSelected,
       
  1128                                                        final boolean cellHasFocus,
       
  1129                                                        final int index,
       
  1130                                                        final int col) {
       
  1131             super.getTableCellRendererComponent(list, value, isSelected, false,
       
  1132                                                 index, col);
  1120             final File file = (File)fFileList.getValueAt(index, 0);
  1133             final File file = (File)fFileList.getValueAt(index, 0);
  1121             setEnabled(isSelectableInList(file));
  1134             setEnabled(isSelectableInList(file));
  1122             final DateFormat formatter = DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.SHORT);
  1135             final DateFormat formatter = DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.SHORT);
  1123             final Date date = (Date)value;
  1136             final Date date = (Date)value;
  1124 
  1137 
  1130 
  1143 
  1131             return this;
  1144             return this;
  1132         }
  1145         }
  1133     }
  1146     }
  1134 
  1147 
       
  1148     @Override
  1135     public Dimension getPreferredSize(final JComponent c) {
  1149     public Dimension getPreferredSize(final JComponent c) {
  1136         return PREF_SIZE;
  1150         return new Dimension(PREF_WIDTH, PREF_HEIGHT);
  1137     }
  1151     }
  1138 
  1152 
       
  1153     @Override
  1139     public Dimension getMinimumSize(final JComponent c) {
  1154     public Dimension getMinimumSize(final JComponent c) {
  1140         return MIN_SIZE;
  1155         return new Dimension(MIN_WIDTH, MIN_HEIGHT);
  1141     }
  1156     }
  1142 
  1157 
       
  1158     @Override
  1143     public Dimension getMaximumSize(final JComponent c) {
  1159     public Dimension getMaximumSize(final JComponent c) {
  1144         return new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE);
  1160         return new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE);
  1145     }
  1161     }
  1146 
  1162 
  1147     @SuppressWarnings("serial") // anonymous class
  1163     @SuppressWarnings("serial") // anonymous class
  1817     private static final Dimension hstrut10 = new Dimension(10, 1);
  1833     private static final Dimension hstrut10 = new Dimension(10, 1);
  1818     private static final Dimension vstrut10 = new Dimension(1, 10);
  1834     private static final Dimension vstrut10 = new Dimension(1, 10);
  1819 
  1835 
  1820     private static final int PREF_WIDTH = 550;
  1836     private static final int PREF_WIDTH = 550;
  1821     private static final int PREF_HEIGHT = 400;
  1837     private static final int PREF_HEIGHT = 400;
  1822     private static final Dimension PREF_SIZE = new Dimension(PREF_WIDTH, PREF_HEIGHT);
       
  1823 
       
  1824     private static final int MIN_WIDTH = 400;
  1838     private static final int MIN_WIDTH = 400;
  1825     private static final int MIN_HEIGHT = 250;
  1839     private static final int MIN_HEIGHT = 250;
  1826     private static final Dimension MIN_SIZE = new Dimension(MIN_WIDTH, MIN_HEIGHT);
       
  1827 
       
  1828     private static final int LIST_MIN_WIDTH = 400;
  1840     private static final int LIST_MIN_WIDTH = 400;
  1829     private static final int LIST_MIN_HEIGHT = 100;
  1841     private static final int LIST_MIN_HEIGHT = 100;
  1830     private static final Dimension LIST_MIN_SIZE = new Dimension(LIST_MIN_WIDTH, LIST_MIN_HEIGHT);
  1842     private static final Dimension LIST_MIN_SIZE = new Dimension(LIST_MIN_WIDTH, LIST_MIN_HEIGHT);
  1831 
  1843 
  1832     static String fileNameLabelText = null;
  1844     static String fileNameLabelText = null;