src/solaris/classes/sun/awt/X11/XFileDialogPeer.java

Print this page


   1 /*
   2  * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   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
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


 758     /**
 759      * set filenameFilter
 760      *
 761      */
 762     public void setFilenameFilter(FilenameFilter filter) {
 763         this.filter = filter;
 764     }
 765 
 766 
 767     public void dispose() {
 768         FileDialog fd = (FileDialog)fileDialog;
 769         if (fd != null) {
 770             fd.removeAll();
 771         }
 772         super.dispose();
 773     }
 774 
 775     // 03/02/2005 b5097243 Pressing 'ESC' on a file dlg does not dispose the dlg on Xtoolkit
 776     public void setVisible(boolean b){
 777         if (fileDialog == null) {
 778             init((FileDialog)target);
 779         }
 780 
 781         if (savedDir != null || userDir != null) {
 782             setDirectory(savedDir != null ? savedDir : userDir);
 783         }
 784 
 785         if (savedFile != null) {
 786             // Actually in Motif implementation lost file value which was saved after prevously showing
 787             // Seems we shouldn't restore Motif behaviour in this case
 788             setFile(savedFile);
 789         }
 790 
 791         super.setVisible(b);
 792         if (b == true){
 793             // See 6240074 for more information
 794             XChoicePeer choicePeer = (XChoicePeer)pathChoice.getPeer();
 795             choicePeer.addXChoicePeerListener(this);
 796             KeyboardFocusManager.getCurrentKeyboardFocusManager().addKeyEventDispatcher(this);
 797         }else{
 798             // See 6240074 for more information


   1 /*
   2  * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   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
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


 758     /**
 759      * set filenameFilter
 760      *
 761      */
 762     public void setFilenameFilter(FilenameFilter filter) {
 763         this.filter = filter;
 764     }
 765 
 766 
 767     public void dispose() {
 768         FileDialog fd = (FileDialog)fileDialog;
 769         if (fd != null) {
 770             fd.removeAll();
 771         }
 772         super.dispose();
 773     }
 774 
 775     // 03/02/2005 b5097243 Pressing 'ESC' on a file dlg does not dispose the dlg on Xtoolkit
 776     public void setVisible(boolean b){
 777         if (fileDialog == null) {
 778             init(target);
 779         }
 780 
 781         if (savedDir != null || userDir != null) {
 782             setDirectory(savedDir != null ? savedDir : userDir);
 783         }
 784 
 785         if (savedFile != null) {
 786             // Actually in Motif implementation lost file value which was saved after prevously showing
 787             // Seems we shouldn't restore Motif behaviour in this case
 788             setFile(savedFile);
 789         }
 790 
 791         super.setVisible(b);
 792         if (b == true){
 793             // See 6240074 for more information
 794             XChoicePeer choicePeer = (XChoicePeer)pathChoice.getPeer();
 795             choicePeer.addXChoicePeerListener(this);
 796             KeyboardFocusManager.getCurrentKeyboardFocusManager().addKeyEventDispatcher(this);
 797         }else{
 798             // See 6240074 for more information