Back to index

wims  3.65+svn20090927
Public Member Functions | Package Attributes
rene.zirkel.macro.MacroMenu Class Reference
Collaboration diagram for rene.zirkel.macro.MacroMenu:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 MacroMenu (Menu o, String name, MacroMenu father)
MacroItem add (Macro m, String name)
 Add a macro this menu.
boolean remove (MacroItem item)
boolean replace (MacroItem item, MacroItem newitem)
String getName ()
boolean isEmpty ()
Vector getV ()
boolean hasSubmenus ()
String getFullName ()
MacroMenu findWithFullName (String name)

Package Attributes

Vector V
Menu FatherMenu
String Name
MacroMenu Father

Detailed Description

Definition at line 11 of file MacroMenu.java.


Constructor & Destructor Documentation

rene.zirkel.macro.MacroMenu.MacroMenu ( Menu  o,
String  name,
MacroMenu  father 
) [inline]

Definition at line 17 of file MacroMenu.java.

       {      V=new Vector();
              FatherMenu=o;
              Name=name;
              Father=father;
       }

Here is the caller graph for this function:


Member Function Documentation

MacroItem rene.zirkel.macro.MacroMenu.add ( Macro  m,
String  name 
) [inline]

Add a macro this menu.

This is a recursive function! Macros may have a macro path with them.

Parameters:
mMacro to add
nameName for the macro (inclusive path)
Returns:
MyMenuItem for the macro

Definition at line 31 of file MacroMenu.java.

       {      String s=name;
              int n=s.indexOf("/");
              if (n<0)
              {      MyMenuItem item;
                     if (FatherMenu==null)
                            item=null;
                     else 
                     {      if (m.isProtected())
                                   item=new MyMenuItem("- "+name+" -");
                            else 
                                   item=new MyMenuItem(name);
                            FatherMenu.add(item);
                     }
                     MacroItem mi=new MacroItem(m,item);
                     mi.Name=name;
                     V.addElement(mi);
                     return mi;
              }
              String menu=s.substring(0,n);
              s=s.substring(n+1);
              Enumeration e=V.elements();
              while (e.hasMoreElements())
              {      Object o=e.nextElement();
                     if (o instanceof MacroMenu 
                            && ((MacroMenu)o).getName().equals(menu))
                     {      return ((MacroMenu)o).add(m,s);
                     }
              }
              MyMenu mm;
              if (FatherMenu==null)
                     mm=null;
              else
              {      mm=new MyMenu(menu);
                     FatherMenu.add(mm);
              }
              MacroMenu macm=new MacroMenu(mm,menu,this);
              V.addElement(macm);
              return macm.add(m,s);
       }

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 149 of file MacroMenu.java.

       {      int n=name.indexOf("/");
              if (n<0)
              {      if (name.equals(Name)) return this;
                     else return null;
              }
              if(!name.substring(0,n).equals(Name)) return null;      
              name=name.substring(n+1);
              Enumeration e=V.elements();
              while (e.hasMoreElements())
              {      Object o=e.nextElement();
                     if (o instanceof MacroMenu)
                     {      MacroMenu m=(MacroMenu)o;
                            MacroMenu res=m.findWithFullName(name);
                            if (res!=null) return res;
                     }
              }
              return null;
       }

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 139 of file MacroMenu.java.

       {      String s=Name;
              MacroMenu m=this;
              while (m.Father!=null)
              {      m=m.Father;
                     s=m.Name+"/"+s;
              }
              return s;
       }

Here is the caller graph for this function:

Definition at line 118 of file MacroMenu.java.

       {      return Name;
       }

Here is the caller graph for this function:

Vector rene.zirkel.macro.MacroMenu.getV ( ) [inline]

Definition at line 126 of file MacroMenu.java.

       {      return V;
       }

Here is the caller graph for this function:

Definition at line 130 of file MacroMenu.java.

       {      Enumeration e=V.elements();
              while (e.hasMoreElements())
              {      Object o=e.nextElement();
                     if (o instanceof MacroMenu) return true;
              }
              return false;
       }

Definition at line 122 of file MacroMenu.java.

       {      return V.size()==0;
       }

Here is the caller graph for this function:

Definition at line 72 of file MacroMenu.java.

       {      Enumeration e=V.elements();
              while (e.hasMoreElements())
              {      Object o=e.nextElement();
                     if (o instanceof MacroMenu)
                     {      boolean res=((MacroMenu)o).remove(item);
                            if (res)
                            {      if (((MacroMenu)o).isEmpty())
                                   {      V.removeElement(o);
                                          if (FatherMenu!=null)
                                                 FatherMenu.remove(((MacroMenu)o).FatherMenu);
                                   }
                                   return true;
                            }
                     }
                     else
                     {      if (((MacroItem)o).M==item.M)
                            {      V.removeElement(o);
                                   if (FatherMenu!=null)
                                          FatherMenu.remove(item.I);
                                   return true;
                            }
                     }
              }
              return false;
       }

Here is the call graph for this function:

Definition at line 99 of file MacroMenu.java.

       {      Enumeration e=V.elements();
              while (e.hasMoreElements())
              {      Object o=e.nextElement();
                     if (o instanceof MacroMenu)
                     {      boolean res=((MacroMenu)o).replace(item,newitem);
                            if (res) break;
                     }
                     else
                     {      if (((MacroItem)o).M==item.M)
                            {      ((MacroItem)o).M=newitem.M;
                                   return true;
                            }
                     }
              }
              return false;
       }

Here is the call graph for this function:


Member Data Documentation

Definition at line 15 of file MacroMenu.java.

Definition at line 13 of file MacroMenu.java.

Definition at line 14 of file MacroMenu.java.

Definition at line 12 of file MacroMenu.java.


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