1 26 27 package org.objectweb.ccm.demo3.explorer; 28 29 import javax.swing.JOptionPane ; 30 31 import org.objectweb.ccm.demo3.Client; 32 import org.objectweb.ccm.demo3.ClientHome; 33 import org.objectweb.util.explorer.api.TreeView; 34 import org.objectweb.util.explorer.api.MenuItem; 35 import org.objectweb.util.explorer.api.MenuItemTreeView; 36 37 43 public class ClientCreationAction 44 implements MenuItem 45 { 46 47 53 59 65 71 public int getStatus(TreeView treeView) { 72 return MenuItem.ENABLED_STATUS; 73 } 74 75 public void actionPerformed(MenuItemTreeView e) throws Exception { 76 String name = ""; 77 while (name != null && name.equals("")) { 78 name = JOptionPane.showInputDialog("Enter the client's name:"); 79 } 80 if(name!=null){ 81 ClientHome client = (ClientHome) e.getSelectedObject(); 82 Client c = client.create(); 83 c.name(name); 84 } 85 } 86 87 } 88 | Popular Tags |