325 interior.add(Box.createRigidArea(vstrut10));
326
327
328 // CENTER: left, right accessory
329 JPanel centerPanel = new JPanel();
330 centerPanel.setLayout(new BoxLayout(centerPanel, BoxLayout.LINE_AXIS));
331 align(centerPanel);
332
333 // left panel - Filter & folderList
334 JPanel leftPanel = new JPanel();
335 leftPanel.setLayout(new BoxLayout(leftPanel, BoxLayout.PAGE_AXIS));
336 align(leftPanel);
337
338 // add the filter PENDING(jeff) - I18N
339 l = new JLabel(filterLabelText);
340 l.setDisplayedMnemonic(filterLabelMnemonic);
341 align(l);
342 leftPanel.add(l);
343
344 @SuppressWarnings("serial") // anonymous class
345 JComboBox tmp2 = new JComboBox<FileFilter>() {
346 public Dimension getMaximumSize() {
347 Dimension d = super.getMaximumSize();
348 d.height = getPreferredSize().height;
349 return d;
350 }
351 };
352 filterComboBox = tmp2;
353 filterComboBox.setInheritsPopupMenu(true);
354 l.setLabelFor(filterComboBox);
355 filterComboBoxModel = createFilterComboBoxModel();
356 filterComboBox.setModel(filterComboBoxModel);
357 filterComboBox.setRenderer(createFilterComboBoxRenderer());
358 fc.addPropertyChangeListener(filterComboBoxModel);
359 align(filterComboBox);
360 leftPanel.add(filterComboBox);
361
362 // leftPanel.add(Box.createRigidArea(vstrut10));
363
364 // Add the Folder List PENDING(jeff) - I18N
365 l = new JLabel(foldersLabelText);
638 } else {
639 return prefSize;
640 }
641 }
642
643 public Dimension getMinimumSize(JComponent x) {
644 return MIN_SIZE;
645 }
646
647 public Dimension getMaximumSize(JComponent x) {
648 return new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE);
649 }
650
651 protected void align(JComponent c) {
652 c.setAlignmentX(JComponent.LEFT_ALIGNMENT);
653 c.setAlignmentY(JComponent.TOP_ALIGNMENT);
654 }
655
656 @SuppressWarnings("serial") // Superclass is not serializable across versions
657 protected class FileCellRenderer extends DefaultListCellRenderer {
658 public Component getListCellRendererComponent(JList list, Object value, int index,
659 boolean isSelected, boolean cellHasFocus) {
660
661 super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
662 setText(getFileChooser().getName((File) value));
663 setInheritsPopupMenu(true);
664 return this;
665 }
666 }
667
668 @SuppressWarnings("serial") // Superclass is not serializable across versions
669 protected class DirectoryCellRenderer extends DefaultListCellRenderer {
670 public Component getListCellRendererComponent(JList list, Object value, int index,
671 boolean isSelected, boolean cellHasFocus) {
672
673 super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
674 setText(getFileChooser().getName((File) value));
675 setInheritsPopupMenu(true);
676 return this;
677 }
678 }
679
680 @SuppressWarnings("serial") // Superclass is not serializable across versions
681 protected class MotifDirectoryListModel extends AbstractListModel<File> implements ListDataListener {
682 public MotifDirectoryListModel() {
683 getModel().addListDataListener(this);
684 }
685
686 public int getSize() {
687 return getModel().getDirectories().size();
688 }
689
690 public File getElementAt(int index) {
761 //
762 // DataModel for Types Comboxbox
763 //
764 protected FilterComboBoxModel createFilterComboBoxModel() {
765 return new FilterComboBoxModel();
766 }
767
768 //
769 // Renderer for Types ComboBox
770 //
771 protected FilterComboBoxRenderer createFilterComboBoxRenderer() {
772 return new FilterComboBoxRenderer();
773 }
774
775
776 /**
777 * Render different type sizes and styles.
778 */
779 @SuppressWarnings("serial") // Superclass is not serializable across versions
780 public class FilterComboBoxRenderer extends DefaultListCellRenderer {
781 public Component getListCellRendererComponent(JList list,
782 Object value, int index, boolean isSelected,
783 boolean cellHasFocus) {
784
785 super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
786
787 if (value != null && value instanceof FileFilter) {
788 setText(((FileFilter)value).getDescription());
789 }
790
791 return this;
792 }
793 }
794
795 /**
796 * Data model for a type-face selection combo-box.
797 */
798 @SuppressWarnings("serial") // Superclass is not serializable across versions
799 protected class FilterComboBoxModel extends AbstractListModel<FileFilter> implements ComboBoxModel<FileFilter>,
800 PropertyChangeListener {
801 protected FileFilter[] filters;
|
325 interior.add(Box.createRigidArea(vstrut10));
326
327
328 // CENTER: left, right accessory
329 JPanel centerPanel = new JPanel();
330 centerPanel.setLayout(new BoxLayout(centerPanel, BoxLayout.LINE_AXIS));
331 align(centerPanel);
332
333 // left panel - Filter & folderList
334 JPanel leftPanel = new JPanel();
335 leftPanel.setLayout(new BoxLayout(leftPanel, BoxLayout.PAGE_AXIS));
336 align(leftPanel);
337
338 // add the filter PENDING(jeff) - I18N
339 l = new JLabel(filterLabelText);
340 l.setDisplayedMnemonic(filterLabelMnemonic);
341 align(l);
342 leftPanel.add(l);
343
344 @SuppressWarnings("serial") // anonymous class
345 JComboBox<FileFilter> tmp2 = new JComboBox<FileFilter>() {
346 public Dimension getMaximumSize() {
347 Dimension d = super.getMaximumSize();
348 d.height = getPreferredSize().height;
349 return d;
350 }
351 };
352 filterComboBox = tmp2;
353 filterComboBox.setInheritsPopupMenu(true);
354 l.setLabelFor(filterComboBox);
355 filterComboBoxModel = createFilterComboBoxModel();
356 filterComboBox.setModel(filterComboBoxModel);
357 filterComboBox.setRenderer(createFilterComboBoxRenderer());
358 fc.addPropertyChangeListener(filterComboBoxModel);
359 align(filterComboBox);
360 leftPanel.add(filterComboBox);
361
362 // leftPanel.add(Box.createRigidArea(vstrut10));
363
364 // Add the Folder List PENDING(jeff) - I18N
365 l = new JLabel(foldersLabelText);
638 } else {
639 return prefSize;
640 }
641 }
642
643 public Dimension getMinimumSize(JComponent x) {
644 return MIN_SIZE;
645 }
646
647 public Dimension getMaximumSize(JComponent x) {
648 return new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE);
649 }
650
651 protected void align(JComponent c) {
652 c.setAlignmentX(JComponent.LEFT_ALIGNMENT);
653 c.setAlignmentY(JComponent.TOP_ALIGNMENT);
654 }
655
656 @SuppressWarnings("serial") // Superclass is not serializable across versions
657 protected class FileCellRenderer extends DefaultListCellRenderer {
658 public Component getListCellRendererComponent(JList<?> list, Object value, int index,
659 boolean isSelected, boolean cellHasFocus) {
660
661 super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
662 setText(getFileChooser().getName((File) value));
663 setInheritsPopupMenu(true);
664 return this;
665 }
666 }
667
668 @SuppressWarnings("serial") // Superclass is not serializable across versions
669 protected class DirectoryCellRenderer extends DefaultListCellRenderer {
670 public Component getListCellRendererComponent(JList<?> list, Object value, int index,
671 boolean isSelected, boolean cellHasFocus) {
672
673 super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
674 setText(getFileChooser().getName((File) value));
675 setInheritsPopupMenu(true);
676 return this;
677 }
678 }
679
680 @SuppressWarnings("serial") // Superclass is not serializable across versions
681 protected class MotifDirectoryListModel extends AbstractListModel<File> implements ListDataListener {
682 public MotifDirectoryListModel() {
683 getModel().addListDataListener(this);
684 }
685
686 public int getSize() {
687 return getModel().getDirectories().size();
688 }
689
690 public File getElementAt(int index) {
761 //
762 // DataModel for Types Comboxbox
763 //
764 protected FilterComboBoxModel createFilterComboBoxModel() {
765 return new FilterComboBoxModel();
766 }
767
768 //
769 // Renderer for Types ComboBox
770 //
771 protected FilterComboBoxRenderer createFilterComboBoxRenderer() {
772 return new FilterComboBoxRenderer();
773 }
774
775
776 /**
777 * Render different type sizes and styles.
778 */
779 @SuppressWarnings("serial") // Superclass is not serializable across versions
780 public class FilterComboBoxRenderer extends DefaultListCellRenderer {
781 public Component getListCellRendererComponent(JList<?> list,
782 Object value, int index, boolean isSelected,
783 boolean cellHasFocus) {
784
785 super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
786
787 if (value != null && value instanceof FileFilter) {
788 setText(((FileFilter)value).getDescription());
789 }
790
791 return this;
792 }
793 }
794
795 /**
796 * Data model for a type-face selection combo-box.
797 */
798 @SuppressWarnings("serial") // Superclass is not serializable across versions
799 protected class FilterComboBoxModel extends AbstractListModel<FileFilter> implements ComboBoxModel<FileFilter>,
800 PropertyChangeListener {
801 protected FileFilter[] filters;
|