home *** CD-ROM | disk | FTP | other *** search
- package com.sun.java.swing.preview;
-
- import com.sun.java.accessibility.Accessible;
- import com.sun.java.accessibility.AccessibleContext;
- import com.sun.java.swing.Action;
- import com.sun.java.swing.DefaultListSelectionModel;
- import com.sun.java.swing.JComponent;
- import com.sun.java.swing.ListSelectionModel;
- import com.sun.java.swing.SwingConstants;
- import com.sun.java.swing.UIManager;
- import com.sun.java.swing.plaf.DirectoryPaneUI;
- import java.awt.event.ActionEvent;
- import java.awt.event.ActionListener;
- import java.io.File;
- import java.util.Enumeration;
- import java.util.Vector;
-
- public class JDirectoryPane extends JComponent implements SwingConstants, Accessible {
- protected DirectoryModel directoryModel;
- protected ListSelectionModel listSelectionModel;
- protected transient Redirector redirector;
- protected transient SelListener selListener;
- protected String command;
- protected String doubleClickCommand;
- protected String doubleClickContainerCommand;
- GoUpAction goUpAction;
- DefaultActionListener defaultActionListener;
- // $FF: synthetic field
- static Class class$java$awt$event$ActionListener;
-
- public JDirectoryPane() {
- this((File)null);
- }
-
- public JDirectoryPane(String var1) {
- this(var1 == null ? null : new File(var1));
- }
-
- public JDirectoryPane(File var1) {
- this.doubleClickCommand = "doubleClick";
- this.doubleClickContainerCommand = "doubleClickContainer";
- this.goUpAction = new GoUpAction(this);
- this.defaultActionListener = new DefaultActionListener(this);
- this.setModel(this.createDirectoryModel(var1));
- this.setSelectionModel(this.createSelectionModel());
- this.addActionListener(this.getDefaultActionListener());
- this.updateUI();
- }
-
- protected DirectoryModel createDirectoryModel(File var1) {
- return new DirectoryModel(var1);
- }
-
- protected ListSelectionModel createSelectionModel() {
- return new DefaultListSelectionModel();
- }
-
- public Action getGoUpAction() {
- return this.goUpAction;
- }
-
- public ActionListener getDefaultActionListener() {
- return this.defaultActionListener;
- }
-
- public void performDoubleClick() {
- TypedFile var1 = this.getSelectedFile();
- if (var1.getType().isContainer()) {
- this.fireActionPerformed(this.getDoubleClickContainerCommand());
- } else {
- this.fireActionPerformed(this.getDoubleClickCommand());
- }
- }
-
- public TypedFile getSelectedFile() {
- int var1 = this.getListSelectionModel().getLeadSelectionIndex();
- return var1 >= 0 ? (TypedFile)this.getModel().getTypedFiles().elementAt(var1) : null;
- }
-
- public Vector getSelectedFiles() {
- ListSelectionModel var1 = this.getListSelectionModel();
- int var2 = var1.getAnchorSelectionIndex();
- int var3 = var1.getLeadSelectionIndex();
- Vector var4 = new Vector();
- if (var2 >= 0 && var3 >= 0) {
- Vector var5 = this.getModel().getTypedFiles();
- int var6 = Math.max(var2, var3);
-
- for(int var7 = Math.min(var2, var3); var7 <= var6; ++var7) {
- var4.addElement(var5.elementAt(var7));
- }
- }
-
- return var4;
- }
-
- public boolean isSelectionEmpty() {
- return this.getListSelectionModel().isSelectionEmpty();
- }
-
- public void clearSelection() {
- this.getListSelectionModel().clearSelection();
- }
-
- public File getCurrentDirectory() {
- return this.directoryModel.getCurrentDirectory();
- }
-
- public void setCurrentDirectory(File var1) {
- this.directoryModel.setCurrentDirectory(var1);
- }
-
- public TypedFile getTypedFile(String var1, String var2) {
- return this.directoryModel.getTypedFile(var1, var2);
- }
-
- public TypedFile getTypedFile(String var1) {
- return this.directoryModel.getTypedFile(var1);
- }
-
- public Vector getTypedFiles() {
- return this.directoryModel.getTypedFiles();
- }
-
- public Vector getTypedFilesForDirectory(File var1) {
- return this.directoryModel.getTypedFilesForDirectory(var1);
- }
-
- public boolean canGoUp() {
- return this.directoryModel.canGoUp();
- }
-
- public void goUp() {
- this.directoryModel.goUp();
- }
-
- public void setHiddenRule(FileType var1) {
- this.directoryModel.setHiddenRule(var1);
- }
-
- public FileType getHiddenRule() {
- return this.directoryModel.getHiddenRule();
- }
-
- public void addKnownFileType(FileType var1) {
- this.directoryModel.addKnownFileType(var1);
- }
-
- public Enumeration enumerateKnownFileTypes() {
- return this.directoryModel.enumerateKnownFileTypes();
- }
-
- public Vector getKnownFileTypes() {
- return this.directoryModel.getKnownFileTypes();
- }
-
- public boolean isKnownFileType(FileType var1) {
- return this.directoryModel.isKnownFileType(var1);
- }
-
- public void setKnownFileTypes(FileType[] var1) {
- this.directoryModel.setKnownFileTypes(var1);
- }
-
- public DirectoryPaneUI getUI() {
- return (DirectoryPaneUI)super.ui;
- }
-
- public void setUI(DirectoryPaneUI var1) {
- super.setUI(var1);
- }
-
- public void updateUI() {
- this.setUI((DirectoryPaneUI)UIManager.getUI(this));
- }
-
- public String getUIClassID() {
- return "DirectoryPaneUI";
- }
-
- public DirectoryModel getModel() {
- return this.directoryModel;
- }
-
- protected void setModel(DirectoryModel var1) {
- DirectoryModel var2 = this.getModel();
- if (var2 != null) {
- var2.removePropertyChangeListener(this.redirector);
- this.redirector = null;
- }
-
- this.directoryModel = var1;
- if (var1 != null) {
- this.redirector = this.createRedirector();
- var1.addPropertyChangeListener(this.redirector);
- }
-
- }
-
- public ListSelectionModel getListSelectionModel() {
- return this.listSelectionModel;
- }
-
- protected void setSelectionModel(ListSelectionModel var1) {
- ListSelectionModel var2 = this.getListSelectionModel();
- if (var2 != null) {
- var2.removeListSelectionListener(this.selListener);
- this.selListener = null;
- }
-
- this.listSelectionModel = var1;
- if (var1 != null) {
- this.selListener = this.createSelectionListener();
- var1.addListSelectionListener(this.selListener);
- }
-
- }
-
- protected Redirector createRedirector() {
- return new Redirector(this);
- }
-
- protected SelListener createSelectionListener() {
- return new SelListener(this);
- }
-
- public synchronized void addActionListener(ActionListener var1) {
- super.listenerList.add(class$java$awt$event$ActionListener != null ? class$java$awt$event$ActionListener : (class$java$awt$event$ActionListener = class$("java.awt.event.ActionListener")), var1);
- }
-
- public synchronized void removeActionListener(ActionListener var1) {
- super.listenerList.remove(class$java$awt$event$ActionListener != null ? class$java$awt$event$ActionListener : (class$java$awt$event$ActionListener = class$("java.awt.event.ActionListener")), var1);
- }
-
- protected void fireActionPerformed(String var1) {
- Object[] var2 = super.listenerList.getListenerList();
- ActionEvent var3 = null;
-
- for(int var4 = var2.length - 2; var4 >= 0; var4 -= 2) {
- if (var2[var4] == (class$java$awt$event$ActionListener != null ? class$java$awt$event$ActionListener : (class$java$awt$event$ActionListener = class$("java.awt.event.ActionListener")))) {
- if (var3 == null) {
- var3 = new ActionEvent(this, 1001, var1);
- }
-
- ((ActionListener)var2[var4 + 1]).actionPerformed(var3);
- }
- }
-
- }
-
- public void setActionCommand(String var1) {
- String var2 = this.command;
- this.command = var1;
- ((JComponent)this).firePropertyChange("actionCommand", var2, var1);
- }
-
- public String getActionCommand() {
- return this.command;
- }
-
- public void setDoubleClickCommand(String var1) {
- String var2 = this.doubleClickCommand;
- this.doubleClickCommand = var1;
- ((JComponent)this).firePropertyChange("doubleClickCommand", var2, var1);
- }
-
- public String getDoubleClickCommand() {
- return this.doubleClickCommand;
- }
-
- public void setDoubleClickContainerCommand(String var1) {
- String var2 = this.doubleClickContainerCommand;
- this.doubleClickContainerCommand = var1;
- ((JComponent)this).firePropertyChange("doubleClickContainerCommand", var2, var1);
- }
-
- public String getDoubleClickContainerCommand() {
- return this.doubleClickContainerCommand;
- }
-
- public AccessibleContext getAccessibleContext() {
- if (super.accessibleContext == null) {
- super.accessibleContext = new AccessibleJDirectoryPane(this);
- }
-
- return super.accessibleContext;
- }
-
- // $FF: synthetic method
- static Class class$(String var0) {
- try {
- return Class.forName(var0);
- } catch (ClassNotFoundException var2) {
- throw new NoClassDefFoundError(((Throwable)var2).getMessage());
- }
- }
- }
-