1 23 package org.enhydra.kelp.common.dods; 24 25 import org.enhydra.tool.common.ButtonPanel; 27 28 import java.awt.Window ; 30 import java.awt.event.ActionEvent ; 31 import java.awt.event.ActionListener ; 32 import java.lang.ref.WeakReference ; 33 public class DodsButtonListener implements ActionListener { 35 private WeakReference ref = null; 36 37 public DodsButtonListener(CoreDodsTool tool) { 38 ref = new WeakReference (tool); 39 } 40 41 public void actionPerformed(ActionEvent event) { 42 String command = event.getActionCommand(); 43 if (command.equals(ButtonPanel.COMMAND_GENERATE)) { 44 getTool().generate(); 45 } else if (command.equals(ButtonPanel.COMMAND_CLOSE)) { 46 getTool().closeWindow(); 47 } else if (command.equals(ButtonPanel.COMMAND_HELP)) { 48 getTool().notifyHelpListeners(event.getSource()); 49 } else if (command.equals(ButtonPanel.COMMAND_ABOUT)) { 50 getTool().showAbout(); 51 } 52 } 53 54 private CoreDodsTool getTool() { 55 return (CoreDodsTool) ref.get(); 56 } 57 58 } 59 | Popular Tags |