Back to index

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

This is a general class to one in a list of items (like makros, plugins or tools in the JE editor). More...

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

List of all members.

Public Member Functions

 ItemEditor (Frame f, ItemPanel p, Vector v, String name, String prompt)
 ItemEditor (Frame f, ItemPanel p, Vector v, String name, String prompt, boolean allowChanges, boolean allowReorder, boolean allowSave, String extraButton)
void init ()
void itemStateChanged (ItemEvent e)
 React on Item changes.
void select ()
 Show the currently selected item on the item panel.
void doAction (String o)
boolean isAborted ()
Vector getElements ()
int getAction ()
 Return the action, if there is one.
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 close ()
boolean escape ()
 Calls close(), when the escape key is pressed.
void actionPerformed (ActionEvent e)
void showHelp ()
void itemAction (String o, boolean flag)
void keyPressed (KeyEvent e)
void keyReleased (KeyEvent e)
void keyTyped (KeyEvent e)
void doclose ()
 Closes the dialog.
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 focusGained (FocusEvent e)
 Override to set the focus somewhere.
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

String Subject = ""
ActionEvent E

Static Public Attributes

static final int NONE = 0
 possible actions

Package Functions

void insert ()
 Insert the current element, renaming if necessary.
void define (int Selected)
 Changes an item.
void define ()
 Changes the currently selected item.
boolean find (String name)
 Find a plugin by name.
void delete ()
 Delete the current selected item.
void down ()
 Push the selected item one down.
void up ()
 Push the selected item one up.

Package Attributes

Frame F
MyList L
 An AWT list at the left.
boolean Aborted = true
 Aborted?
Vector V
 A vector of ItemEditorElement objects.
ItemPanel P
 A panel to display the element settings.
String Name
 The name of this editor.
int Displayed = -1
 The displayed item.
int Action = NONE
 save or load action
boolean Dispose = true

Static Package Attributes

static final int SAVE = 1
static final int LOAD = 2

Detailed Description

This is a general class to one in a list of items (like makros, plugins or tools in the JE editor).

Definition at line 25 of file ItemEditor.java.


Constructor & Destructor Documentation

rene.dialogs.ItemEditor.ItemEditor ( Frame  f,
ItemPanel  p,
Vector  v,
String  name,
String  prompt 
) [inline]
Parameters:
pThe item editor panel
vThe vector of item editor elements
promptThe prompt, displayed in the north

Definition at line 50 of file ItemEditor.java.

       {      this(f,p,v,name,prompt,true,true,false,"");
       }
rene.dialogs.ItemEditor.ItemEditor ( Frame  f,
ItemPanel  p,
Vector  v,
String  name,
String  prompt,
boolean  allowChanges,
boolean  allowReorder,
boolean  allowSave,
String  extraButton 
) [inline]

Definition at line 54 of file ItemEditor.java.

       {      super(f,Global.name(name+".title"),true);
              Name=name; F=f; P=p;
              setLayout(new BorderLayout());
              
              // Title String:
              Panel title=new MyPanel();
              title.add(new MyLabel(prompt));
              add("North",title);
              
              // Center panel:
              Panel center=new MyPanel();
              center.setLayout(new BorderLayout(5,5));
              
              // Element List:
              center.add("West",L=new MyList(10));
              L.addItemListener(this);
              
              // Editor Panel:
              Panel cp=new MyPanel();
              cp.setLayout(new BorderLayout());
              cp.add("North",P);
              cp.add("Center",new MyPanel());
              center.add("Center",cp);

              add("Center",new Panel3D(center));

              // Buttons:
              Panel buttons=new MyPanel();
              buttons.setLayout(new GridLayout(0,1));

              if (allowChanges)
              {      Panel buttons1=new MyPanel();
                     buttons1.add(new ButtonAction(this,
                            Global.name("itemeditor.insert"),"Insert"));
                     buttons1.add(new ButtonAction(this,
                            Global.name("itemeditor.new"),"New"));
                     buttons1.add(new ButtonAction(this,
                            Global.name("itemeditor.delete"),"Delete"));
                     buttons.add(buttons1);
              }
              
              if (allowReorder)
              {      Panel buttons2=new MyPanel();
                     buttons2.add(new ButtonAction(this,
                            Global.name("itemeditor.down"),"Down"));
                     buttons2.add(new ButtonAction(this,
                            Global.name("itemeditor.up"),"Up"));
                     buttons.add(buttons2);
              }
              
              Panel buttons3=new MyPanel();
              buttons3.setLayout(new FlowLayout(FlowLayout.RIGHT));
              buttons3.add(new ButtonAction(this,
                     Global.name("OK"),"OK"));
              buttons3.add(new ButtonAction(this,
                     Global.name("abort"),"Close"));
              buttons.add(buttons3);

              if (allowSave)
              {      Panel buttons4=new MyPanel();
                     buttons4.setLayout(new FlowLayout(FlowLayout.RIGHT));
                     buttons4.add(new ButtonAction(this,
                            Global.name("save"),"Save"));
                     buttons4.add(new ButtonAction(this,
                            Global.name("load"),"Load"));
                     if (!extraButton.equals(""))
                     {      buttons4.add(new ButtonAction(this,
                                   extraButton,"Extra"));
                     }
                     buttons.add(buttons4);
              }
              
              add("South",new Panel3D(buttons));

              V=new Vector();
              for (int i=0; i<v.size(); i++) V.addElement(v.elementAt(i));
              init();
              
              pack();
       }

Here is the call graph for this function:


Member Function Documentation

void rene.gui.CloseDialog.actionPerformed ( ActionEvent  e) [inline, inherited]
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);
       }
boolean rene.gui.CloseDialog.close ( ) [inline, inherited]
Returns:
true if the dialog is closed.

Reimplemented in rene.dialogs.SearchFileDialog.

Definition at line 47 of file CloseDialog.java.

       {      return true;
       }

Here is the caller graph for this function:

void rene.dialogs.ItemEditor.define ( int  Selected) [inline, package]

Changes an item.

Definition at line 237 of file ItemEditor.java.

       {      String name=P.getName();
              if (name.equals("")) return;
              if (!L.getItem(Selected).equals(name))
                     L.replaceItem(name,Selected);
              V.setElementAt(P.getElement(),Selected);
              P.notifyChange(V,Selected);
       }

Here is the call graph for this function:

void rene.dialogs.ItemEditor.define ( ) [inline, package]

Changes the currently selected item.

Definition at line 249 of file ItemEditor.java.

       {      int Selected=L.getSelectedIndex();
              if (Selected<0) return;
              define(Selected);
              L.select(Selected);
       }

Here is the caller graph for this function:

void rene.dialogs.ItemEditor.delete ( ) [inline, package]

Delete the current selected item.

Definition at line 272 of file ItemEditor.java.

       {      int Selected=L.getSelectedIndex();
              if (Selected<0) return;
              V.removeElementAt(Selected);
              L.remove(Selected);
              if (L.getItemCount()==0) return;
              if (Selected>=L.getItemCount()) Selected--;
              L.select(Selected);
              select();
       }

Here is the call graph for this function:

void rene.dialogs.ItemEditor.doAction ( String  o) [inline]

Reimplemented from rene.gui.CloseDialog.

Definition at line 173 of file ItemEditor.java.

       {      if (o.equals("Delete"))
              {      delete();
              }
              else if (o.equals("Insert"))
              {      insert();
              }
              else if (o.equals("New"))
              {      P.newElement();
              }
              else if (o.equals("Up"))
              {      up();
              }
              else if (o.equals("Down"))
              {      down();
              }
              else if (o.equals("OK"))
              {      noteSize(Name);
                     define();
                     Aborted=false;
                     doclose();
              }
              else if (o.equals("Help"))
              {      P.help();
              }
              else if (o.equals("Save"))
              {      define();
                     Action=SAVE;
                     Aborted=false;
                     doclose();
              }
              else if (o.equals("Load"))
              {      define();
                     Action=LOAD;
                     Aborted=false;
                     doclose();
              }
              else if (o.equals("Extra"))
              {      if (P.extra(V))
                     {      Aborted=false;
                            doclose();
                     }
              }
              else super.doAction(o);
       }

Here is the call graph for this function:

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

Closes the dialog.

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

Reimplemented in rene.dialogs.InfoDialog, rene.dialogs.SearchFileDialog, and rene.zirkel.dialogs.Replay.

Definition at line 92 of file CloseDialog.java.

       {      setVisible(false);
              // Because of a bug in Linux Java 1.4.2 etc.
              // dispose in a separate thread.
              Thread t=new Thread ()
              {      public void run ()
                     {      if (Dispose) dispose();
                     }
              };
              t.start();
       }

Here is the call graph for this function:

Here is the caller graph for this function:

void rene.dialogs.ItemEditor.down ( ) [inline, package]

Push the selected item one down.

Definition at line 286 of file ItemEditor.java.

       {      define();
              int Selected=L.getSelectedIndex();
              if (Selected<0 || Selected+1>=V.size()) return;
              ItemEditorElement 
                     now=(ItemEditorElement)V.elementAt(Selected),
                     next=(ItemEditorElement)V.elementAt(Selected+1);
              V.setElementAt(next,Selected); 
              V.setElementAt(now,Selected+1);
              L.replaceItem(next.getName(),Selected); 
              L.replaceItem(now.getName(),Selected+1);
              Selected=Selected+1;
              L.select(Selected);
              select();
       }

Here is the call graph for this function:

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:

boolean rene.dialogs.ItemEditor.find ( String  name) [inline, package]

Find a plugin by name.

Returns:
true, if it exists.

Definition at line 260 of file ItemEditor.java.

       {      int i;
              for (i=0; i<V.size(); i++)
              {      ItemEditorElement t=((ItemEditorElement)V.elementAt(i));
                     if (t.getName().equals(name)) return true;
              }
              return false;
       }

Here is the call graph for this function:

Here is the caller graph for this function:

void rene.gui.CloseDialog.focusGained ( FocusEvent  e) [inline, inherited]
void rene.gui.CloseDialog.focusLost ( FocusEvent  e) [inline, inherited]

Definition at line 191 of file CloseDialog.java.

{}

Return the action, if there is one.

Returns:
NONE,LOAD,SAVE

Definition at line 339 of file ItemEditor.java.

       {      return Action;
       }

Here is the caller graph for this function:

Returns:
The list of item elements.

Definition at line 331 of file ItemEditor.java.

       {      return V;
       }

Here is the caller graph for this function:

void rene.dialogs.ItemEditor.init ( ) [inline]
Parameters:
vA vector of item editor elements.

Definition at line 142 of file ItemEditor.java.

       {      for (int i=0; i<V.size(); i++)
              {      ItemEditorElement e=(ItemEditorElement)V.elementAt(i);
                     L.add(e.getName());
              }
              if (V.size()>0)
              {      L.select(0);
                     select();
              }
       }

Here is the call graph for this function:

Here is the caller graph for this function:

void rene.dialogs.ItemEditor.insert ( ) [inline, package]

Insert the current element, renaming if necessary.

Definition at line 222 of file ItemEditor.java.

       {      String name=P.getName();
              int Selected=L.getSelectedIndex();
              if (Selected<0) Selected=0;
              while (find(name)) name=name+"*";
              P.setName(name);
              ItemEditorElement e=P.getElement();
              L.add(e.getName(),Selected);
              L.select(Selected);
              V.insertElementAt(e,Selected);
       }

Here is the call graph for this function:

Here is the caller graph for this function:

Returns:
If aborted.

Reimplemented from rene.gui.CloseDialog.

Definition at line 324 of file ItemEditor.java.

       {      return Aborted;
       }

Here is the caller graph for this function:

void rene.gui.CloseDialog.itemAction ( String  o,
boolean  flag 
) [inline, inherited]
void rene.dialogs.ItemEditor.itemStateChanged ( ItemEvent  e) [inline]

React on Item changes.

Definition at line 156 of file ItemEditor.java.

       {      if (e.getSource()==L)
              {      if (Displayed>=0) define(Displayed);
                     select();
              }
       }

Here is the call graph for this function:

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.

{}
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:

void rene.dialogs.ItemEditor.select ( ) [inline]

Show the currently selected item on the item panel.

Definition at line 166 of file ItemEditor.java.

       {      int i=L.getSelectedIndex();
              if (i<0) return;
              P.display((ItemEditorElement)V.elementAt(i));
              Displayed=i;
       }

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.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:

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.dialogs.ItemEditor.up ( ) [inline, package]

Push the selected item one up.

Definition at line 305 of file ItemEditor.java.

       {      define();
              int Selected=L.getSelectedIndex();
              if (Selected<=0) return;
              ItemEditorElement 
                     now=(ItemEditorElement)V.elementAt(Selected),
                     prev=(ItemEditorElement)V.elementAt(Selected-1);
              V.setElementAt(prev,Selected); 
              V.setElementAt(now,Selected-1);
              L.replaceItem(prev.getName(),Selected); 
              L.replaceItem(now.getName(),Selected-1);
              Selected=Selected-1;
              L.select(Selected);
              select();
       }

Here is the call graph for this function:

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

Aborted?

Reimplemented from rene.gui.CloseDialog.

Definition at line 31 of file ItemEditor.java.

save or load action

Definition at line 43 of file ItemEditor.java.

The displayed item.

Definition at line 39 of file ItemEditor.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.

Frame rene.dialogs.ItemEditor.F [package]

Reimplemented from rene.gui.CloseDialog.

Definition at line 27 of file ItemEditor.java.

An AWT list at the left.

Definition at line 29 of file ItemEditor.java.

final int rene.dialogs.ItemEditor.LOAD = 2 [static, package]

Definition at line 41 of file ItemEditor.java.

String rene.dialogs.ItemEditor.Name [package]

The name of this editor.

Definition at line 37 of file ItemEditor.java.

final int rene.dialogs.ItemEditor.NONE = 0 [static]

possible actions

Definition at line 41 of file ItemEditor.java.

A panel to display the element settings.

Definition at line 35 of file ItemEditor.java.

final int rene.dialogs.ItemEditor.SAVE = 1 [static, package]

Definition at line 41 of file ItemEditor.java.

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

Reimplemented in rene.dialogs.InfoDialog.

Definition at line 22 of file CloseDialog.java.

Vector rene.dialogs.ItemEditor.V [package]

A vector of ItemEditorElement objects.

Definition at line 33 of file ItemEditor.java.


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