1 26 package org.objectweb.openccm.explorer.DCI; 27 28 import org.objectweb.util.explorer.api.DropAction; 29 import org.objectweb.util.explorer.api.DropTreeView; 30 import org.objectweb.util.explorer.swing.gui.api.DialogAction; 31 import org.objectweb.util.explorer.swing.gui.api.DialogBox; 32 import org.objectweb.util.explorer.swing.gui.lib.DefaultDialogBox; 33 import org.objectweb.util.explorer.swing.gui.lib.LabelBox; 34 import org.omg.Components.CCMHome; 35 import org.omg.Components.HomeRegistration; 36 37 44 public class RegisterHomeAction 45 implements DropAction, DialogAction 46 { 47 48 54 protected HomeRegistration home_registration_; 55 56 protected LabelBox name_; 57 58 protected CCMHome home_ = null; 59 60 66 72 78 public void execute(DropTreeView e) throws Exception { 79 home_registration_ = (HomeRegistration)e.getSelectedObject(); 80 if(CCMHome.class.isAssignableFrom(e.getDragSourceObject().getClass())){ 81 home_ = (CCMHome)e.getDragSourceObject(); 82 String defaultName = e.getDragSourceEntry().getName().toString(); 83 DialogBox dialog = new DefaultDialogBox("Register an home"); 84 name_ = new LabelBox("Home name", defaultName); 85 dialog.addElementBox(name_); 86 dialog.setValidateAction(this); 87 dialog.show(); 88 } else { 89 throw new Exception ("CCMHome expected !"); 90 } 91 } 92 93 99 102 public void executeAction() throws Exception { 103 String component_repid = "ir3_not_started"; 105 String home_repid = "ir3_not_started"; 106 home_registration_.register_home(home_, home_repid, component_repid, name_.getLabel()); 113 } 114 115 } 116 | Popular Tags |