Clover icon

Coverage Report

  1. Project Clover database Thu Nov 7 2024 10:11:34 GMT
  2. Package jalview.io

File JalviewFileChooser.java

 

Coverage histogram

../../img/srcFileCovDistChart5.png
43% of files have more coverage

Code metrics

92
227
28
3
795
569
92
0.41
8.11
9.33
3.29

Classes

Class Line # Actions
JalviewFileChooser 75 171 77
0.2952029429.5%
JalviewFileChooser.RecentlyOpened 579 23 5
0.9333333493.3%
JalviewFileChooser.recentlyOpenedCellRenderer 646 33 10
0.869565287%
 

Contributing tests

This file is covered by 61 tests. .

Source view

1    /*
2    * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3    * Copyright (C) $$Year-Rel$$ The Jalview Authors
4    *
5    * This file is part of Jalview.
6    *
7    * Jalview is free software: you can redistribute it and/or
8    * modify it under the terms of the GNU General Public License
9    * as published by the Free Software Foundation, either version 3
10    * of the License, or (at your option) any later version.
11    *
12    * Jalview is distributed in the hope that it will be useful, but
13    * WITHOUT ANY WARRANTY; without even the implied warranty
14    * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15    * PURPOSE. See the GNU General Public License for more details.
16    *
17    * You should have received a copy of the GNU General Public License
18    * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
19    * The Jalview Authors are detailed in the 'AUTHORS' file.
20    */
21    //////////////////////////////////////////////////////////////////
22    package jalview.io;
23   
24    import java.awt.Component;
25    import java.awt.Dimension;
26    import java.awt.EventQueue;
27    import java.awt.HeadlessException;
28    import java.awt.event.ActionEvent;
29    import java.awt.event.ActionListener;
30    import java.awt.event.MouseAdapter;
31    import java.awt.event.MouseEvent;
32    import java.beans.PropertyChangeEvent;
33    import java.beans.PropertyChangeListener;
34    import java.io.File;
35    import java.util.ArrayList;
36    import java.util.HashMap;
37    import java.util.List;
38    import java.util.Map;
39    import java.util.StringTokenizer;
40    import java.util.Vector;
41   
42    import javax.swing.BoxLayout;
43    import javax.swing.JCheckBox;
44    import javax.swing.JDialog;
45    import javax.swing.JFileChooser;
46    import javax.swing.JLabel;
47    import javax.swing.JList;
48    import javax.swing.JOptionPane;
49    import javax.swing.JPanel;
50    import javax.swing.JScrollPane;
51    import javax.swing.ListCellRenderer;
52    import javax.swing.SpringLayout;
53    import javax.swing.SwingConstants;
54    import javax.swing.SwingUtilities;
55    import javax.swing.border.TitledBorder;
56    import javax.swing.filechooser.FileFilter;
57    import javax.swing.plaf.basic.BasicFileChooserUI;
58   
59    import jalview.bin.Cache;
60    import jalview.gui.JvOptionPane;
61    import jalview.util.ChannelProperties;
62    import jalview.util.MessageManager;
63    import jalview.util.Platform;
64    import jalview.util.dialogrunner.DialogRunnerI;
65   
66    /**
67    * Enhanced file chooser dialog box.
68    *
69    * NOTE: bug on Windows systems when filechooser opened on directory to view
70    * files with colons in title.
71    *
72    * @author AMW
73    *
74    */
 
75    public class JalviewFileChooser extends JFileChooser
76    implements DialogRunnerI, PropertyChangeListener
77    {
78    private static final long serialVersionUID = 1L;
79   
80    private Map<Object, Runnable> callbacks = new HashMap<>();
81   
82    File selectedFile = null;
83   
84    /**
85    * backupfilesCheckBox = "Include backup files" checkbox includeBackupfiles =
86    * flag set by checkbox
87    */
88    private JCheckBox backupfilesCheckBox = null;
89   
90    protected boolean includeBackupFiles = false;
91   
92    /**
93    * Factory method to return a file chooser that offers readable alignment file
94    * formats
95    *
96    * @param directory
97    * @param selected
98    * @return
99    */
 
100  75 toggle public static JalviewFileChooser forRead(String directory,
101    String selected)
102    {
103  75 return JalviewFileChooser.forRead(directory, selected, false);
104    }
105   
 
106  75 toggle public static JalviewFileChooser forRead(String directory,
107    String selected, boolean allowBackupFiles)
108    {
109  75 List<String> extensions = new ArrayList<>();
110  75 List<String> descs = new ArrayList<>();
111  75 for (FileFormatI format : FileFormats.getInstance().getFormats())
112    {
113  1650 if (format.isReadable())
114    {
115  1425 extensions.add(format.getExtensions());
116  1425 descs.add(format.getName());
117    }
118    }
119   
120  75 return new JalviewFileChooser(directory,
121    extensions.toArray(new String[extensions.size()]),
122    descs.toArray(new String[descs.size()]), selected, true,
123    allowBackupFiles);
124    }
125   
126    /**
127    * Factory method to return a file chooser that offers writable alignment file
128    * formats
129    *
130    * @param directory
131    * @param selected
132    * @return
133    */
 
134  0 toggle public static JalviewFileChooser forWrite(String directory,
135    String selected)
136    {
137    // TODO in Java 8, forRead and forWrite can be a single method
138    // with a lambda expression parameter for isReadable/isWritable
139  0 List<String> extensions = new ArrayList<>();
140  0 List<String> descs = new ArrayList<>();
141  0 for (FileFormatI format : FileFormats.getInstance().getFormats())
142    {
143  0 if (format.isWritable())
144    {
145  0 extensions.add(format.getExtensions());
146  0 descs.add(format.getName());
147    }
148    }
149  0 return new JalviewFileChooser(directory,
150    extensions.toArray(new String[extensions.size()]),
151    descs.toArray(new String[descs.size()]), selected, false);
152    }
153   
 
154  0 toggle public JalviewFileChooser(String dir)
155    {
156  0 super(safePath(dir));
157  0 setAccessory(new RecentlyOpened());
158    }
159   
 
160  0 toggle public JalviewFileChooser(String dir, String[] suffix, String[] desc,
161    String selected)
162    {
163  0 this(dir, suffix, desc, selected, true);
164    }
165   
166    /**
167    * Constructor for a single choice of file extension and description
168    *
169    * @param extension
170    * @param desc
171    */
 
172  0 toggle public JalviewFileChooser(String extension, String desc)
173    {
174  0 this(Cache.getProperty("LAST_DIRECTORY"), new String[] { extension },
175    new String[]
176    { desc }, desc, true);
177    }
178   
 
179  0 toggle JalviewFileChooser(String dir, String[] extensions, String[] descs,
180    String selected, boolean acceptAny)
181    {
182  0 this(dir, extensions, descs, selected, acceptAny, false);
183    }
184   
 
185  75 toggle public JalviewFileChooser(String dir, String[] extensions, String[] descs,
186    String selected, boolean acceptAny, boolean allowBackupFiles)
187    {
188  75 super(safePath(dir));
189  75 if (extensions.length == descs.length)
190    {
191  75 List<String[]> formats = new ArrayList<>();
192  1500 for (int i = 0; i < extensions.length; i++)
193    {
194  1425 formats.add(new String[] { extensions[i], descs[i] });
195    }
196  75 init(formats, selected, acceptAny, allowBackupFiles);
197    }
198    else
199    {
200  0 jalview.bin.Console
201    .errPrintln("JalviewFileChooser arguments mismatch: "
202    + extensions + ", " + descs);
203    }
204    }
205   
 
206  75 toggle private static File safePath(String dir)
207    {
208  75 if (dir == null)
209    {
210  42 return null;
211    }
212   
213  33 File f = new File(dir);
214  33 if (f.getName().indexOf(':') > -1)
215    {
216  0 return null;
217    }
218  33 return f;
219    }
220   
221    /**
222    * Overridden for JalviewJS compatibility: only one thread in Javascript, so
223    * we can't wait for user choice in another thread and then perform the
224    * desired action
225    */
 
226  0 toggle @Override
227    public int showOpenDialog(Component parent)
228    {
229  0 int value = super.showOpenDialog(this);
230   
231  0 if (!Platform.isJS())
232    /**
233    * Java only
234    *
235    * @j2sIgnore
236    */
237    {
238    /*
239    * code here is not run in JalviewJS, instead
240    * propertyChange() is called for dialog action
241    */
242  0 handleResponse(value);
243    }
244  0 return value;
245    }
246   
247    /**
248    *
249    * @param formats
250    * a list of {extensions, description} for each file format
251    * @param selected
252    * @param acceptAny
253    * if true, 'any format' option is included
254    */
 
255  0 toggle void init(List<String[]> formats, String selected, boolean acceptAny)
256    {
257  0 init(formats, selected, acceptAny, false);
258    }
259   
 
260  75 toggle void init(List<String[]> formats, String selected, boolean acceptAny,
261    boolean allowBackupFiles)
262    {
263   
264  75 JalviewFileFilter chosen = null;
265   
266    // SelectAllFilter needs to be set first before adding further
267    // file filters to fix bug on Mac OSX
268  75 setAcceptAllFileFilterUsed(acceptAny);
269   
270    // add a "All known alignment files" option
271  75 List<String> allExtensions = new ArrayList<>();
272  75 for (String[] format : formats)
273    {
274  1425 String[] extensions = format[0].split(",");
275  1425 for (String ext : extensions)
276    {
277  2100 if (!allExtensions.contains(ext))
278    {
279  2100 allExtensions.add(ext);
280    }
281    }
282    }
283  75 allExtensions.sort(null);
284  75 JalviewFileFilter alljvf = new JalviewFileFilter(
285    allExtensions.toArray(new String[] {}),
286    MessageManager.getString("label.all_known_alignment_files"));
287  75 alljvf.setMultiFormat(true);
288  75 alljvf.setExtensionListInDescription(false);
289  75 addChoosableFileFilter(alljvf);
290   
291  75 if (selected == null)
292    {
293  17 chosen = alljvf;
294    }
295   
296  75 for (String[] format : formats)
297    {
298  1425 JalviewFileFilter jvf = new JalviewFileFilter(format[0], format[1]);
299  1425 if (allowBackupFiles)
300    {
301  0 jvf.setParentJFC(this);
302    }
303  1425 addChoosableFileFilter(jvf);
304  1425 if ((selected != null) && selected.equalsIgnoreCase(format[1]))
305    {
306  58 chosen = jvf;
307    }
308    }
309   
310  75 if (chosen != null)
311    {
312  75 setFileFilter(chosen);
313    }
314   
315  75 if (allowBackupFiles)
316    {
317  0 JPanel multi = new JPanel();
318  0 multi.setLayout(new BoxLayout(multi, BoxLayout.PAGE_AXIS));
319  0 if (backupfilesCheckBox == null)
320    {
321  0 try
322    {
323  0 includeBackupFiles = Boolean.parseBoolean(
324    Cache.getProperty(BackupFiles.NS + "_FC_INCLUDE"));
325    } catch (Exception e)
326    {
327  0 includeBackupFiles = false;
328    }
329  0 backupfilesCheckBox = new JCheckBox(
330    MessageManager.getString("label.include_backup_files"),
331    includeBackupFiles);
332  0 backupfilesCheckBox.setAlignmentX(Component.CENTER_ALIGNMENT);
333  0 JalviewFileChooser jfc = this;
334  0 backupfilesCheckBox.addActionListener(new ActionListener()
335    {
 
336  0 toggle @Override
337    public void actionPerformed(ActionEvent e)
338    {
339  0 includeBackupFiles = backupfilesCheckBox.isSelected();
340  0 Cache.setProperty(BackupFiles.NS + "_FC_INCLUDE",
341    String.valueOf(includeBackupFiles));
342   
343  0 FileFilter f = jfc.getFileFilter();
344    // deselect the selected file if it's no longer choosable
345  0 File selectedFile = jfc.getSelectedFile();
346  0 if (selectedFile != null && !f.accept(selectedFile))
347    {
348  0 jfc.setSelectedFile(null);
349    }
350    // fake the OK button changing (to force it to upate)
351  0 String s = jfc.getApproveButtonText();
352  0 jfc.firePropertyChange(APPROVE_BUTTON_TEXT_CHANGED_PROPERTY,
353    null, s);
354    // fake the file filter changing (its behaviour actually has)
355  0 jfc.firePropertyChange(FILE_FILTER_CHANGED_PROPERTY, null, f);
356   
357  0 jfc.rescanCurrentDirectory();
358  0 jfc.revalidate();
359  0 jfc.repaint();
360    }
361    });
362    }
363  0 multi.add(new RecentlyOpened());
364  0 multi.add(backupfilesCheckBox);
365  0 setAccessory(multi);
366    }
367    else
368    {
369    // set includeBackupFiles=false to avoid other file choosers from picking
370    // up backup files (Just In Case)
371  75 includeBackupFiles = false;
372  75 setAccessory(new RecentlyOpened());
373    }
374    }
375   
 
376  375 toggle @Override
377    public void setFileFilter(javax.swing.filechooser.FileFilter filter)
378    {
379  375 super.setFileFilter(filter);
380   
381  375 try
382    {
383  375 if (getUI() instanceof BasicFileChooserUI)
384    {
385  375 final BasicFileChooserUI fcui = (BasicFileChooserUI) getUI();
386  375 final String name = fcui.getFileName().trim();
387   
388  375 if ((name == null) || (name.length() == 0))
389    {
390  375 return;
391    }
392   
393  0 EventQueue.invokeLater(new Thread()
394    {
 
395  0 toggle @Override
396    public void run()
397    {
398  0 String currentName = fcui.getFileName();
399  0 if ((currentName == null) || (currentName.length() == 0))
400    {
401  0 fcui.setFileName(name);
402    }
403    }
404    });
405    }
406    } catch (Exception ex)
407    {
408  0 ex.printStackTrace();
409    // Some platforms do not have BasicFileChooserUI
410    }
411    }
412   
413    /**
414    * Returns the selected file format, or null if none selected
415    *
416    * @return
417    */
 
418  0 toggle public FileFormatI getSelectedFormat()
419    {
420  0 if (getFileFilter() == null)
421    {
422  0 return null;
423    }
424   
425    /*
426    * logic here depends on option description being formatted as
427    * formatName (extension, extension...)
428    * or the 'no option selected' value
429    * All Files
430    * @see JalviewFileFilter.getDescription
431    */
432  0 String format = getFileFilter().getDescription();
433  0 int parenPos = format.indexOf("(");
434  0 if (parenPos > 0)
435    {
436  0 format = format.substring(0, parenPos).trim();
437  0 try
438    {
439  0 return FileFormats.getInstance().forName(format);
440    } catch (IllegalArgumentException e)
441    {
442  0 jalview.bin.Console.errPrintln("Unexpected format: " + format);
443    }
444    }
445  0 return null;
446    }
447   
 
448  75 toggle @Override
449    public File getSelectedFile()
450    {
451  75 File f = super.getSelectedFile();
452  75 return f == null ? selectedFile : f;
453    }
454   
 
455  0 toggle @Override
456    public int showSaveDialog(Component parent) throws HeadlessException
457    {
458  0 this.setAccessory(null);
459    // Java 9,10,11 on OSX - clear selected file so name isn't auto populated
460  0 this.setSelectedFile(null);
461   
462  0 return super.showSaveDialog(parent);
463    }
464   
465    /**
466    * If doing a Save, and an existing file is chosen or entered, prompt for
467    * confirmation of overwrite. Proceed if Yes, else leave the file chooser
468    * open.
469    *
470    * @see https://stackoverflow.com/questions/8581215/jfilechooser-and-checking-for-overwrite
471    */
 
472  0 toggle @Override
473    public void approveSelection()
474    {
475  0 if (getDialogType() != SAVE_DIALOG)
476    {
477  0 super.approveSelection();
478  0 return;
479    }
480   
481  0 selectedFile = getSelectedFile();
482   
483  0 if (selectedFile == null)
484    {
485    // Workaround for Java 9,10 on OSX - no selected file, but there is a
486    // filename typed in
487  0 try
488    {
489  0 String filename = ((BasicFileChooserUI) getUI()).getFileName();
490  0 if (filename != null && filename.length() > 0)
491    {
492  0 selectedFile = new File(getCurrentDirectory(), filename);
493    }
494    } catch (Throwable x)
495    {
496  0 jalview.bin.Console.errPrintln(
497    "Unexpected exception when trying to get filename.");
498  0 x.printStackTrace();
499    }
500    // TODO: ENSURE THAT FILES SAVED WITH A ':' IN THE NAME ARE REFUSED AND
501    // THE
502    // USER PROMPTED FOR A NEW FILENAME
503    }
504   
505  0 if (selectedFile == null)
506    {
507  0 return;
508    }
509   
510  0 if (getFileFilter() instanceof JalviewFileFilter)
511    {
512  0 JalviewFileFilter jvf = (JalviewFileFilter) getFileFilter();
513   
514  0 if (!jvf.accept(selectedFile) && !jvf.isMultiFormat())
515    {
516  0 String withExtension = getSelectedFile().getName() + "."
517    + jvf.getAcceptableExtension();
518  0 selectedFile = (new File(getCurrentDirectory(), withExtension));
519  0 setSelectedFile(selectedFile);
520    }
521  0 else if (jvf.isMultiFormat() && jvf.accept(selectedFile))
522    {
523    // if a multiFormat filter is selected, with an acceptable file
524    // extension, see if we can set the format from the file extension
525  0 for (FileFilter jff : this.getChoosableFileFilters())
526    {
527  0 if (jff.accept(selectedFile))
528    {
529  0 this.setFileFilter(jff);
530    }
531    }
532    }
533    }
534   
535  0 if (selectedFile.exists())
536    {
537  0 int confirm = Cache.getDefault("CONFIRM_OVERWRITE_FILE", true)
538    ? JvOptionPane.showConfirmDialog(this,
539    MessageManager
540    .getString("label.overwrite_existing_file"),
541    MessageManager.getString("label.file_already_exists"),
542    JvOptionPane.YES_NO_OPTION)
543    : JOptionPane.YES_OPTION;
544   
545  0 if (confirm != JvOptionPane.YES_OPTION)
546    {
547  0 return;
548    }
549    }
550   
551  0 super.approveSelection();
552    }
553   
 
554  0 toggle void recentListSelectionChanged(Object selection)
555    {
556  0 setSelectedFile(null);
557  0 if (selection != null)
558    {
559  0 File file = new File((String) selection);
560  0 if (getFileFilter() instanceof JalviewFileFilter)
561    {
562  0 JalviewFileFilter jvf = (JalviewFileFilter) this.getFileFilter();
563   
564  0 if (!jvf.accept(file))
565    {
566  0 setFileFilter(getChoosableFileFilters()[0]);
567    }
568    }
569   
570  0 if (!file.isAbsolute() && file.exists())
571    {
572  0 file = file.getAbsoluteFile();
573    }
574   
575  0 setSelectedFile(file);
576    }
577    }
578   
 
579    class RecentlyOpened extends JPanel
580    {
581    private static final long serialVersionUID = 1L;
582   
583    JList<String> list;
584   
 
585  75 toggle RecentlyOpened()
586    {
587  75 setPreferredSize(new Dimension(300, 100));
588  75 String historyItems = Cache.getProperty("RECENT_FILE");
589  75 StringTokenizer st;
590  75 Vector<String> recent = new Vector<>();
591   
592  75 if (historyItems != null)
593    {
594  61 st = new StringTokenizer(historyItems, "\t");
595   
596  358 while (st.hasMoreTokens())
597    {
598  297 recent.addElement(st.nextToken());
599    }
600    }
601   
602  75 list = new JList<>(recent);
603  75 list.setCellRenderer(new recentlyOpenedCellRenderer());
604   
605  75 list.addMouseListener(new MouseAdapter()
606    {
 
607  0 toggle @Override
608    public void mousePressed(MouseEvent evt)
609    {
610  0 recentListSelectionChanged(list.getSelectedValue());
611    }
612    });
613   
614  75 TitledBorder recentlyOpenedBorder = new TitledBorder(
615    MessageManager.getString("label.recently_opened"));
616  75 recentlyOpenedBorder.setTitleFont(
617    recentlyOpenedBorder.getTitleFont().deriveFont(10f));
618  75 this.setBorder(recentlyOpenedBorder);
619   
620  75 final JScrollPane scroller = new JScrollPane(list);
621   
622  75 SpringLayout layout = new SpringLayout();
623  75 layout.putConstraint(SpringLayout.WEST, scroller, 5,
624    SpringLayout.WEST, this);
625  75 layout.putConstraint(SpringLayout.NORTH, scroller, 5,
626    SpringLayout.NORTH, this);
627   
628    // one size okay for all
629  75 scroller.setPreferredSize(new Dimension(280, 105));
630  75 this.add(scroller);
631   
632  75 SwingUtilities.invokeLater(new Runnable()
633    {
 
634  71 toggle @Override
635    public void run()
636    {
637  71 scroller.getHorizontalScrollBar()
638    .setValue(scroller.getHorizontalScrollBar().getMaximum());
639    }
640    });
641   
642    }
643   
644    }
645   
 
646    class recentlyOpenedCellRenderer extends JLabel
647    implements ListCellRenderer<String>
648    {
649    private final static int maxChars = 46;
650   
651    private final static String ellipsis = "...";
652   
 
653  297 toggle @Override
654    public Component getListCellRendererComponent(
655    JList<? extends String> list, String value, int index,
656    boolean isSelected, boolean cellHasFocus)
657    {
658  297 String filename = value.toString();
659  297 String displayFilename;
660  297 if (filename.length() > maxChars)
661    {
662  164 StringBuilder displayFileSB = new StringBuilder();
663  164 File file = new File(filename);
664  164 displayFileSB.append(file.getName());
665  164 if (file.getParent() != null)
666    {
667  164 File parent = file;
668  164 boolean spaceleft = true;
669  983 while (spaceleft && parent.getParent() != null)
670    {
671  819 parent = parent.getParentFile();
672  819 String name = parent.getName();
673  819 displayFileSB.insert(0, File.separator);
674  819 if (displayFileSB.length() + name.length() < maxChars - 1)
675    {
676  655 displayFileSB.insert(0, name);
677    }
678    else
679    {
680  164 displayFileSB.insert(0, ellipsis);
681  164 spaceleft = false;
682    }
683    }
684  164 if (spaceleft && filename.startsWith(File.separator)
685    && !(displayFileSB.charAt(0) == File.separatorChar))
686    {
687  0 displayFileSB.insert(0, File.separator);
688    }
689    }
690  164 displayFilename = displayFileSB.toString();
691    }
692    else
693    {
694  133 displayFilename = filename;
695    }
696  297 this.setText(displayFilename.toString());
697  297 this.setToolTipText(filename);
698  297 if (isSelected)
699    {
700  0 setBackground(list.getSelectionBackground());
701  0 setForeground(list.getSelectionForeground());
702    }
703    else
704    {
705  297 setBackground(list.getBackground());
706  297 setForeground(list.getForeground());
707    }
708  297 this.setHorizontalAlignment(SwingConstants.TRAILING);
709  297 this.setEnabled(list.isEnabled());
710  297 this.setFont(list.getFont().deriveFont(12f));
711  297 this.setOpaque(true);
712  297 return this;
713    }
714   
715    }
716   
717    /*
718    @Override
719    public JalviewFileChooser setResponseHandler(Object response,
720    Runnable action)
721    {
722    callbacks.put(response, new Callable<Void>()
723    {
724    @Override
725    public Void call()
726    {
727    action.run();
728    return null;
729    }
730    });
731    return this;
732    }
733    */
734   
 
735  0 toggle @Override
736    public DialogRunnerI setResponseHandler(Object response, Runnable action)
737    {
738  0 callbacks.put(response, action);
739  0 return this;
740    }
741   
 
742  0 toggle @Override
743    public void handleResponse(Object response)
744    {
745    /*
746    * this test is for NaN in Chrome
747    */
748  0 if (response != null && !response.equals(response))
749    {
750  0 return;
751    }
752  0 Runnable action = callbacks.get(response);
753  0 if (action != null)
754    {
755  0 try
756    {
757  0 action.run();
758    } catch (Exception e)
759    {
760  0 e.printStackTrace();
761    }
762    }
763    }
764   
765    /**
766    * JalviewJS signals file selection by a property change event for property
767    * "SelectedFile". This methods responds to that by running the response
768    * action for 'OK' in the dialog.
769    *
770    * @param evt
771    */
 
772  0 toggle @Override
773    public void propertyChange(PropertyChangeEvent evt)
774    {
775    // TODO other properties need runners...
776  0 switch (evt.getPropertyName())
777    {
778    /*
779    * property name here matches that used in JFileChooser.js
780    */
781  0 case "SelectedFile":
782  0 handleResponse(APPROVE_OPTION);
783  0 break;
784    }
785    }
786   
 
787  0 toggle @Override
788    protected JDialog createDialog(Component parent) throws HeadlessException
789    {
790  0 JDialog dialog = super.createDialog(parent);
791  0 dialog.setIconImages(ChannelProperties.getIconList());
792  0 return dialog;
793    }
794   
795    }