Back to index

wims  3.65+svn20090927
ReplaceMacroQuestion.java
Go to the documentation of this file.
00001 /*
00002  * Created on 26.10.2005
00003  *
00004  */
00005 package rene.zirkel.dialogs;
00006 
00007 import java.awt.FlowLayout;
00008 import java.awt.Frame;
00009 import java.awt.Panel;
00010 
00011 import rene.gui.ButtonAction;
00012 import rene.gui.CloseDialog;
00013 import rene.gui.MyLabel;
00014 import rene.gui.MyPanel;
00015 import rene.zirkel.Zirkel;
00016 import rene.zirkel.macro.Macro;
00017 
00018 
00025 public class ReplaceMacroQuestion extends CloseDialog 
00026 {      public int Result=NO;
00027        public static int NO=0,YES=1,ALL=-1;
00028        public ReplaceMacroQuestion (Frame f, Macro m)
00029        {      super(f,Zirkel.name("macro.replace.title"),true);
00030               Panel pc=new MyPanel();
00031               FlowLayout fl=new FlowLayout();
00032               pc.setLayout(fl);
00033               fl.setAlignment(FlowLayout.CENTER);
00034               pc.add(new MyLabel(Zirkel.name("macro.replace")
00035                      +" "+m.getName()));
00036               add("Center",pc);
00037               Panel p=new MyPanel();
00038               p.setLayout(new FlowLayout(FlowLayout.RIGHT));
00039               p.add(new ButtonAction(this,Zirkel.name("yes"),"Yes"));
00040               p.add(new ButtonAction(this,Zirkel.name("no"),"No"));
00041               p.add(new ButtonAction(this,
00042                      Zirkel.name("macro.replace.all"),"All"));
00043               add("South",p);
00044               pack();
00045        }
00046        
00047        public void doAction (String o)
00048        {      if (o.equals("Yes"))
00049               {      tell(this,YES);
00050               }
00051               else if (o.equals("No"))
00052               {      tell(this,NO);
00053               }
00054               else if (o.equals("All"))
00055               {      tell(this,ALL);
00056               }
00057               else super.doAction(o);
00058        }
00059        
00060        public void tell (ReplaceMacroQuestion q, int f)
00061        {      Result=f;
00062               doclose();
00063        }
00064        
00065        public boolean isNo ()
00066        {      return Result==NO;
00067        }
00068        
00069        public boolean isAll ()
00070        {      return Result==ALL;
00071        }
00072 }
00073 
00074