1 2 24 package org.enhydra.tool.common.wizard; 25 26 import org.enhydra.tool.common.ButtonPanel; 28 29 import java.awt.Window ; 31 import java.awt.event.ActionEvent ; 32 import java.awt.event.ActionListener ; 33 import java.lang.ref.WeakReference ; 34 35 public class TBWizardButtonListener implements ActionListener { 37 private WeakReference ref = null; 38 39 public TBWizardButtonListener(TBWizard wizard) { 40 ref = new WeakReference (wizard); 41 } 42 43 50 public void actionPerformed(ActionEvent event) { 51 String command = event.getActionCommand(); 52 if (command.equals(ButtonPanel.COMMAND_BACK)) { 53 getWizard().back(); 54 } else if (command.equals(ButtonPanel.COMMAND_NEXT)) { 55 getWizard().next(); 56 } else if (command.equals(ButtonPanel.COMMAND_FINISH)) { 57 getWizard().finish(); 58 } else if (command.equals(ButtonPanel.COMMAND_CANCEL)) { 59 getWizard().cancel(); 60 } else if (command.equals(ButtonPanel.COMMAND_HELP)) { 61 getWizard().notifyHelpListeners(event.getSource()); 62 } 63 } 64 65 66 private TBWizard getWizard() { 67 return (TBWizard) ref.get(); 68 } 69 70 } 71 | Popular Tags |