Back to index

wims  3.65+svn20090927
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Package Attributes
rene.dialogs.SearchFileDialog Class Reference

This is a dialog to search a subtree for a specific file. More...

Inheritance diagram for rene.dialogs.SearchFileDialog:
Inheritance graph
[legend]
Collaboration diagram for rene.dialogs.SearchFileDialog:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 SearchFileDialog (Frame f, String action, String modify, boolean modifystate)
 SearchFileDialog (Frame f, String action)
void actionPerformed (ActionEvent e)
void doAction (String o)
void help ()
void search (boolean recurse)
void action ()
void enableButtons (boolean f)
void run ()
String getResult ()
void focusGained (FocusEvent e)
 Override to set the focus somewhere.
void setVisible (boolean flag)
boolean close ()
void doclose ()
 Closes the dialog.
void saveHistory ()
void setPattern (String s)
Enumeration getFiles ()
 Get an enumeration of selected files.
boolean hasMoreElements ()
Object nextElement ()
boolean isAborted ()
void deselectAll ()
boolean isModified ()
void windowActivated (WindowEvent e)
void windowClosed (WindowEvent e)
void windowClosing (WindowEvent e)
void windowDeactivated (WindowEvent e)
void windowDeiconified (WindowEvent e)
void windowIconified (WindowEvent e)
void windowOpened (WindowEvent e)
boolean escape ()
 Calls close(), when the escape key is pressed.
void showHelp ()
void itemAction (String o, boolean flag)
void keyPressed (KeyEvent e)
void keyReleased (KeyEvent e)
void keyTyped (KeyEvent e)
void center (Frame f)
void center ()
void centerOut (Frame f)
void notePosition (String name)
 Note window position in Global.
void setPosition (String name)
 Set window position and size.
void focusLost (FocusEvent e)
void noteSize (String name)
 Note window size in Global.
void setSize (String name)
 Set window size.
void setDispose (boolean flag)
 This inihibits dispose(), when the dialog is closed.
void addHelp (Panel p, String subject)
 To add a help button to children.

Static Public Member Functions

static void center (Frame f, Dialog dialog)

Public Attributes

FileList F = null
boolean Abort = true
boolean Aborted = false
String Subject = ""
ActionEvent E

Static Public Attributes

static int ListNumber = Global.getParameter("searchfile.number",10)

Package Attributes

HistoryTextField Dir
HistoryTextField Pattern
MyList L
String Result = null
Button ActionButton
Button CloseButton
Button SearchButton
Button SearchrekButton
Checkbox Mod
Thread Run
String S []
int Sn
boolean Dispose = true

Detailed Description

This is a dialog to search a subtree for a specific file.

The user can enter a directory and a file pattern containing * and ?. He can choose between immediate search and open, or search/select/open. Abort will result in an empty string. The calling routine checks the result file name with getResult().

You need to specify the following properties

searchfile.title=Search File
searchfile.directory=Directory
searchfile.pattern=Pattern
searchfile.search=Search
searchfile.searchrek=Search Subdirectories

Definition at line 89 of file SearchFileDialog.java.


Constructor & Destructor Documentation

rene.dialogs.SearchFileDialog.SearchFileDialog ( Frame  f,
String  action,
String  modify,
boolean  modifystate 
) [inline]

Definition at line 99 of file SearchFileDialog.java.

       {      super(f,Global.name("searchfile.title"),true);
              setLayout(new BorderLayout());
              Panel north=new MyPanel();
              north.setLayout(new BorderLayout());
              Panel northa=new MyPanel();
              northa.setLayout(new BorderLayout());
              Panel north1=new MyPanel();
              north1.setLayout(new GridLayout(0,2));
              north1.add(new MyLabel(Global.name("searchfile.directory")));
              north1.add(Dir=new HistoryTextField(this,"Dir",20));
              Dir.setText(".");
              north1.add(new MyLabel(Global.name("searchfile.pattern")));
              north1.add(Pattern=new HistoryTextField(this,"TextAction",20));
              northa.add("Center",north1);
              Panel north2=new MyPanel();
              north2.add(SearchButton=
                     new ButtonAction(this,Global.name("searchfile.search"),"Search"));
              north2.add(SearchrekButton=
                     new ButtonAction(this,Global.name("searchfile.searchrek"),"SearchRek"));
              northa.add("South",north2);
              north.add("North",northa);
              add("North",new Panel3D(north));
              add("Center",new Panel3D(L=new MyList(ListNumber)));
              L.addActionListener(this);
              L.setMultipleMode(true);
              Panel south=new MyPanel();
              south.setLayout(new FlowLayout(FlowLayout.RIGHT));
              if (!modify.equals(""))
              {      south.add(Mod=
                            new CheckboxAction(this,modify,""));
                     Mod.setState(modifystate);
              }
              south.add(ActionButton=
                     new ButtonAction(this,action,"Action"));
              south.add(CloseButton=
                     new ButtonAction(this,Global.name("abort"),"Close"));
              add("South",new Panel3D(south));
              pack();
              Dir.loadHistory("searchfile.dir");
              Pattern.loadHistory("searchfile.pattern");
              
              // size
              setSize("searchfiledialog");
              addKeyListener(this);
              Dir.addKeyListener(this);
              Pattern.addKeyListener(this);
       }

Here is the call graph for this function:

rene.dialogs.SearchFileDialog.SearchFileDialog ( Frame  f,
String  action 
) [inline]

Definition at line 148 of file SearchFileDialog.java.

       {      this(f,action,"",false);
       }

Here is the call graph for this function:


Member Function Documentation

Definition at line 175 of file SearchFileDialog.java.

       {      saveHistory();
              if (Run!=null && Run.isAlive()) return;   
              Run=new Thread(this);
              Run.start();
       }

Here is the call graph for this function:

Here is the caller graph for this function:

void rene.dialogs.SearchFileDialog.actionPerformed ( ActionEvent  e) [inline]

Reimplemented from rene.gui.CloseDialog.

Definition at line 151 of file SearchFileDialog.java.

       {      if (e.getSource()==L)
              {      action();
              }
              else super.actionPerformed(e);
       }

Here is the call graph for this function:

void rene.gui.CloseDialog.addHelp ( Panel  p,
String  subject 
) [inline, inherited]

To add a help button to children.

Parameters:
p
subject

Definition at line 231 of file CloseDialog.java.

       {      p.add(new MyLabel(""));
              p.add(new ButtonAction(this,Global.name("help"),"Help"));
              Subject=subject;
       }

Here is the call graph for this function:

Here is the caller graph for this function:

void rene.gui.CloseDialog.center ( Frame  f) [inline, inherited]

Reimplemented in rene.dialogs.MyFileDialog.

Definition at line 104 of file CloseDialog.java.

       {      Dimension 
                     si=f.getSize(),
                     d=getSize(),
                     dscreen=getToolkit().getScreenSize();
              Point lo=f.getLocation();
              int x=lo.x+si.width/2-d.width/2;
              int y=lo.y+si.height/2-d.height/2;
              if (x+d.width>dscreen.width) x=dscreen.width-d.width-10;
              if (x<10) x=10;
              if (y+d.height>dscreen.height) y=dscreen.height-d.height-10;
              if (y<10) y=10;
              setLocation(x,y);
       }

Here is the caller graph for this function:

static void rene.gui.CloseDialog.center ( Frame  f,
Dialog  dialog 
) [inline, static, inherited]

Definition at line 118 of file CloseDialog.java.

       {      Dimension 
                     si=f.getSize(),
                     d=dialog.getSize(),
                     dscreen=f.getToolkit().getScreenSize();
              Point lo=f.getLocation();
              int x=lo.x+si.width/2-d.width/2;
              int y=lo.y+si.height/2-d.height/2;
              if (x+d.width>dscreen.width) x=dscreen.width-d.width-10;
              if (x<10) x=10;
              if (y+d.height>dscreen.height) y=dscreen.height-d.height-10;
              if (y<10) y=10;
              dialog.setLocation(x,y);
       }
void rene.gui.CloseDialog.center ( ) [inline, inherited]

Definition at line 144 of file CloseDialog.java.

       {      Dimension d=getSize(),dscreen=getToolkit().getScreenSize();
              setLocation((dscreen.width-d.width)/2,
                     (dscreen.height-d.height)/2);
       }

Here is the caller graph for this function:

void rene.gui.CloseDialog.centerOut ( Frame  f) [inline, inherited]

Definition at line 132 of file CloseDialog.java.

       {      Dimension si=f.getSize(),d=getSize(),
                     dscreen=getToolkit().getScreenSize();
              Point lo=f.getLocation();
              int x=lo.x+si.width-getSize().width+20;
              int y=lo.y+si.height/2+40;
              if (x+d.width>dscreen.width) x=dscreen.width-d.width-10;
              if (x<10) x=10;
              if (y+d.height>dscreen.height) y=dscreen.height-d.height-10;
              if (y<10) y=10;
              setLocation(x,y);
       }
Returns:
true if the dialog is closed.

Reimplemented from rene.gui.CloseDialog.

Definition at line 214 of file SearchFileDialog.java.

       {      Abort=true;
              return true;
       }

Definition at line 255 of file SearchFileDialog.java.

       {      for (int i=L.getItemCount()-1; i>=0; i--)
              {      L.deselect(i);
              }
       }
void rene.dialogs.SearchFileDialog.doAction ( String  o) [inline]

Reimplemented from rene.gui.CloseDialog.

Definition at line 157 of file SearchFileDialog.java.

       {      Result=null;
              if (o.equals("SearchRek")) search(true);
              else if (o.equals("Search")) search(false);
              else if (o.equals("TextAction")) { L.removeAll(); action(); }
              else if (o.equals("Action")) action();
              else if (o.equals("Help")) help ();
              else if (o.equals("Close")) { Abort=true; doclose(); }
       }

Here is the call graph for this function:

Closes the dialog.

This may be used in subclasses to do some action. Then call super.doclose()

Reimplemented from rene.gui.CloseDialog.

Definition at line 218 of file SearchFileDialog.java.

       {      if (F!=null) F.stopIt();
              Dir.saveHistory("searchfile.dir");
              Pattern.saveHistory("searchfile.pattern");
              noteSize("searchfiledialog");
              super.doclose();
       }

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 181 of file SearchFileDialog.java.

       {      Pattern.setEnabled(f);
              SearchButton.setEnabled(f);
              SearchrekButton.setEnabled(f);
              ActionButton.setEnabled(f);
       }

Here is the caller graph for this function:

boolean rene.gui.CloseDialog.escape ( ) [inline, inherited]

Calls close(), when the escape key is pressed.

Returns:
true if the dialog may close.

Reimplemented in rene.zirkel.dialogs.CommentDialog.

Definition at line 55 of file CloseDialog.java.

       {      return close();
       }

Here is the call graph for this function:

Here is the caller graph for this function:

void rene.dialogs.SearchFileDialog.focusGained ( FocusEvent  e) [inline]

Override to set the focus somewhere.

Reimplemented from rene.gui.CloseDialog.

Definition at line 207 of file SearchFileDialog.java.

       {      Pattern.requestFocus();
       }
void rene.gui.CloseDialog.focusLost ( FocusEvent  e) [inline, inherited]

Definition at line 191 of file CloseDialog.java.

{}
Enumeration rene.dialogs.SearchFileDialog.getFiles ( ) [inline]

Get an enumeration of selected files.

Should check for an aborted dialog before.

Definition at line 238 of file SearchFileDialog.java.

       {      S=L.getSelectedItems();
              Sn=0;
              return this;
       }

Definition at line 206 of file SearchFileDialog.java.

{ return Result; }

Definition at line 243 of file SearchFileDialog.java.

       {      return Sn<S.length;
       }

Definition at line 166 of file SearchFileDialog.java.

{}

Here is the caller graph for this function:

Reimplemented from rene.gui.CloseDialog.

Definition at line 252 of file SearchFileDialog.java.

       {      return Abort;
       }

Definition at line 260 of file SearchFileDialog.java.

       {      return Mod.getState();
       }
void rene.gui.CloseDialog.itemAction ( String  o,
boolean  flag 
) [inline, inherited]
void rene.gui.CloseDialog.keyPressed ( KeyEvent  e) [inline, inherited]

Definition at line 82 of file CloseDialog.java.

       {      if (e.getKeyCode()==KeyEvent.VK_ESCAPE && escape()) doclose();
       }

Here is the call graph for this function:

void rene.gui.CloseDialog.keyReleased ( KeyEvent  e) [inline, inherited]

Definition at line 85 of file CloseDialog.java.

{}
void rene.gui.CloseDialog.keyTyped ( KeyEvent  e) [inline, inherited]

Definition at line 86 of file CloseDialog.java.

{}

Definition at line 246 of file SearchFileDialog.java.

       {      if (Sn>=S.length) return null;
              String s=S[Sn];
              Sn++;
              return s;
       }
void rene.gui.CloseDialog.notePosition ( String  name) [inline, inherited]

Note window position in Global.

Definition at line 153 of file CloseDialog.java.

       {      Point l=getLocation();
              Dimension d=getSize();
              Global.setParameter(name+".x",l.x);
              Global.setParameter(name+".y",l.y);
              Global.setParameter(name+".w",d.width);
              if (d.height-Global.getParameter(name+".h",0)!=19)
                     // works around a bug in Windows
                     Global.setParameter(name+".h",d.height);
              boolean maximized=false;
       }

Here is the call graph for this function:

void rene.gui.CloseDialog.noteSize ( String  name) [inline, inherited]

Note window size in Global.

Definition at line 196 of file CloseDialog.java.

       {      Dimension d=getSize();
              Global.setParameter(name+".w",d.width);
              Global.setParameter(name+".h",d.height);
       }

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 187 of file SearchFileDialog.java.

       {      Result=null;
              enableButtons(false);
              if (L.getItemCount()>0)
              {      int i=L.getSelectedIndex(); 
                     if (i>0) Result=L.getItem(i);
                     else Result=L.getItem(0);
              }
              else
              {      FileListFinder f=new FileListFinder(Dir.getText(),
                            Pattern.getText(),true);
                     F=f;
                     f.search();
                     Result=f.getResult();
              }
              enableButtons(true);
              Abort=false;
              doclose();
       }

Here is the call graph for this function:

Definition at line 225 of file SearchFileDialog.java.

Here is the call graph for this function:

Here is the caller graph for this function:

void rene.dialogs.SearchFileDialog.search ( boolean  recurse) [inline]

Definition at line 168 of file SearchFileDialog.java.

       {      saveHistory();
              if (Run!=null && Run.isAlive()) return;
              Run=new SearchFileThread(this,L,
                     Dir.getText(),Pattern.getText(),recurse);
              Run.start();
       }

Here is the call graph for this function:

Here is the caller graph for this function:

void rene.gui.CloseDialog.setDispose ( boolean  flag) [inline, inherited]

This inihibits dispose(), when the dialog is closed.

Definition at line 218 of file CloseDialog.java.

       {      Dispose=flag;
       }
void rene.dialogs.SearchFileDialog.setPattern ( String  s) [inline]

Definition at line 229 of file SearchFileDialog.java.

       {      Pattern.setText(s);
       }

Here is the call graph for this function:

void rene.gui.CloseDialog.setPosition ( String  name) [inline, inherited]

Set window position and size.

Definition at line 168 of file CloseDialog.java.

       {      Point l=getLocation();
              Dimension d=getSize();
              Dimension dscreen=getToolkit().getScreenSize();
              int x=Global.getParameter(name+".x",l.x);
              int y=Global.getParameter(name+".y",l.y);
              int w=Global.getParameter(name+".w",d.width);
              int h=Global.getParameter(name+".h",d.height);
              if (w>dscreen.width) w=dscreen.width;
              if (h>dscreen.height) h=dscreen.height;
              if (x<0) x=0;
              if (x+w>dscreen.width) x=dscreen.width-w;
              if (y<0) y=0;
              if (y+h>dscreen.height) y=dscreen.height-h;
              setLocation(x,y);
              setSize(w,h);
       }

Here is the call graph for this function:

void rene.gui.CloseDialog.setSize ( String  name) [inline, inherited]

Set window size.

Definition at line 205 of file CloseDialog.java.

       {      if (!Global.haveParameter(name+".w")) pack();
              else
              {      Dimension d=getSize();
                     int w=Global.getParameter(name+".w",d.width);
                     int h=Global.getParameter(name+".h",d.height);
                     setSize(w,h);
              }
       }

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 210 of file SearchFileDialog.java.

       {      if (flag) enableButtons(true);
              super.setVisible(flag);
       }

Here is the call graph for this function:

void rene.gui.CloseDialog.showHelp ( ) [inline, inherited]

Reimplemented in rene.zirkel.dialogs.HelpCloseDialog.

Definition at line 75 of file CloseDialog.java.

       {      InfoDialog.Subject=Subject;
              InfoDialog id=new InfoDialog(F);
       }

Here is the caller graph for this function:

void rene.gui.CloseDialog.windowActivated ( WindowEvent  e) [inline, inherited]

Definition at line 34 of file CloseDialog.java.

{}
void rene.gui.CloseDialog.windowClosed ( WindowEvent  e) [inline, inherited]

Definition at line 35 of file CloseDialog.java.

{}
void rene.gui.CloseDialog.windowClosing ( WindowEvent  e) [inline, inherited]

Definition at line 36 of file CloseDialog.java.

       {   if (close()) doclose();
       }

Here is the call graph for this function:

Here is the caller graph for this function:

void rene.gui.CloseDialog.windowDeactivated ( WindowEvent  e) [inline, inherited]

Definition at line 39 of file CloseDialog.java.

{}
void rene.gui.CloseDialog.windowDeiconified ( WindowEvent  e) [inline, inherited]

Definition at line 40 of file CloseDialog.java.

{}
void rene.gui.CloseDialog.windowIconified ( WindowEvent  e) [inline, inherited]

Definition at line 41 of file CloseDialog.java.

{}
void rene.gui.CloseDialog.windowOpened ( WindowEvent  e) [inline, inherited]

Reimplemented in rene.zirkel.dialogs.DefineMacro.

Definition at line 42 of file CloseDialog.java.

{}

Member Data Documentation

Definition at line 97 of file SearchFileDialog.java.

Definition at line 95 of file SearchFileDialog.java.

Definition at line 95 of file SearchFileDialog.java.

Definition at line 91 of file SearchFileDialog.java.

boolean rene.gui.CloseDialog.Dispose = true [package, inherited]

Definition at line 19 of file CloseDialog.java.

ActionEvent rene.gui.CloseDialog.E [inherited]

Reimplemented in rene.dialogs.FontEditor.

Definition at line 59 of file CloseDialog.java.

Reimplemented from rene.gui.CloseDialog.

Definition at line 96 of file SearchFileDialog.java.

Definition at line 92 of file SearchFileDialog.java.

int rene.dialogs.SearchFileDialog.ListNumber = Global.getParameter("searchfile.number",10) [static]

Definition at line 93 of file SearchFileDialog.java.

Definition at line 98 of file SearchFileDialog.java.

Definition at line 91 of file SearchFileDialog.java.

String rene.dialogs.SearchFileDialog.Result = null [package]

Definition at line 94 of file SearchFileDialog.java.

Definition at line 167 of file SearchFileDialog.java.

String rene.dialogs.SearchFileDialog.S[] [package]

Definition at line 232 of file SearchFileDialog.java.

Definition at line 95 of file SearchFileDialog.java.

Definition at line 95 of file SearchFileDialog.java.

Definition at line 233 of file SearchFileDialog.java.

String rene.gui.CloseDialog.Subject = "" [inherited]

Reimplemented in rene.dialogs.InfoDialog.

Definition at line 22 of file CloseDialog.java.


The documentation for this class was generated from the following file: