1 26 27 package org.objectweb.openccm.explorer.CosTrading; 28 29 import java.awt.Component ; 30 import java.awt.event.ActionEvent ; 31 32 import javax.swing.JOptionPane ; 33 34 import org.objectweb.openccm.explorer.CosTrading.gui.AddQueryPanel; 35 import org.objectweb.util.explorer.api.MenuItem; 36 import org.objectweb.util.explorer.api.MenuItemTreeView; 37 import org.objectweb.util.explorer.api.TreeView; 38 39 45 public class AddQuery 46 implements MenuItem 47 { 48 49 55 61 67 73 76 public int getStatus(TreeView arg0){ 77 return MenuItem.ENABLED_STATUS; 78 } 79 80 83 public void actionPerformed(MenuItemTreeView e) { 84 85 Queries queries = (Queries) e.getSelectedObject(); 86 AddQueryPanel lp = new AddQueryPanel(queries); 87 88 ActionEvent ae = (ActionEvent )e.getEvent(); 89 90 int result = 91 JOptionPane.showOptionDialog( 92 (Component ) ae.getSource(), 93 lp, 94 "Create a new query", 95 JOptionPane.OK_CANCEL_OPTION, 96 JOptionPane.PLAIN_MESSAGE, 97 null, 98 null, 99 null); 100 101 if (result == 0) { 102 String label = lp.getQueryLabel(); 103 String st = lp.getServiceTypeName(); 104 String constr = lp.getConstraint(); 105 String pref = lp.getPref(); 106 107 if (st != null && st.length() > 0 && 108 constr != null && pref != null) 109 queries.addQuery(new Query(label, queries, st, constr, pref, lp.getPolicies())); 110 else 111 JOptionPane.showMessageDialog(null, "Invalid parameters !", "Error !", JOptionPane.ERROR_MESSAGE); 112 } 113 } 114 } 115 | Popular Tags |