1 26 27 package org.objectweb.ccm.chat.explorer; 28 29 30 import org.objectweb.util.explorer.api.MenuItem; 31 import org.objectweb.util.explorer.api.MenuItemTreeView; 32 import org.objectweb.util.explorer.api.TreeView; 33 import org.objectweb.util.explorer.swing.gui.api.DialogAction; 34 import org.objectweb.util.explorer.swing.gui.api.DialogBox; 35 import org.objectweb.util.explorer.swing.gui.lib.DefaultDialogBox; 36 import org.objectweb.util.explorer.swing.gui.lib.LabelBox; 37 import org.objectweb.util.explorer.api.Tree; 38 39 import org.objectweb.ccm.chat.Client; 40 41 48 public class ChangeNameAttribute 49 implements MenuItem, DialogAction 50 { 51 52 58 59 protected Client client_ = null; 60 61 62 protected LabelBox nameLabel_ = null; 63 64 70 76 82 85 public int getStatus(TreeView treeView) { 86 return MenuItem.ENABLED_STATUS; 87 } 88 89 92 public void actionPerformed(MenuItemTreeView e) { 93 client_ = (Client) e.getParentObject(); 94 DialogBox dialog = new DefaultDialogBox("Change the name attribute"); 95 nameLabel_ = new LabelBox("name",client_.name()); 96 dialog.addElementBox(nameLabel_); 97 dialog.setValidateAction(this); 98 dialog.show(); 99 } 100 101 107 110 public void executeAction() throws Exception { 111 client_.name(nameLabel_.getLabel()); 112 } 113 114 } 115 | Popular Tags |