1 10 11 package org.enhydra.jawe.xml.elements.specialpanels; 12 13 import java.awt.event.ActionEvent ; 14 import java.awt.event.ActionListener ; 15 import javax.swing.JComboBox ; 16 import org.enhydra.jawe.xml.XMLChoice; 17 import org.enhydra.jawe.xml.XMLCollection; 18 import org.enhydra.jawe.xml.XMLComplexElement; 19 import org.enhydra.jawe.xml.XMLElement; 20 import org.enhydra.jawe.xml.elements.FormalParameters; 21 import org.enhydra.jawe.xml.panels.XMLComboPanel; 22 import org.enhydra.jawe.xml.panels.XMLGroupPanel; 23 import org.enhydra.jawe.xml.panels.XMLPanel; 24 25 28 public class XMLFormalParametersRelatedComboPanel extends XMLComboPanel { 29 30 public XMLFormalParametersRelatedComboPanel ( 31 XMLElement myOwner, 32 Object [] choices, 33 boolean isComboEditable) { 34 35 super(myOwner,choices,XMLPanel.BOX_LAYOUT,false,isComboEditable); 36 37 final JComboBox jcb=getComboBox(); 38 39 jcb.addActionListener(new ActionListener () { 40 public void actionPerformed(ActionEvent ae) { 41 Object sel=jcb.getSelectedItem(); 42 FormalParameters formalParams=null; 43 if (sel instanceof XMLComplexElement) { 44 XMLComplexElement choosen=(XMLComplexElement)jcb.getSelectedItem(); 45 formalParams=(FormalParameters)choosen.get("FormalParameters"); 46 if (formalParams==null) { Object tmp=choosen.get("Choice"); 48 tmp=((XMLChoice)tmp).getChoosen(); 49 if (tmp instanceof FormalParameters) { 50 formalParams=(FormalParameters)tmp; 51 } 52 } 53 } 54 55 XMLGroupPanel gp=(XMLGroupPanel)getParent(); 56 XMLActualParametersPanel app=(XMLActualParametersPanel) 59 ((XMLGroupPanel)gp.getComponent(2)).getComponent(0); 60 app.setFormalParameters(formalParams); 61 } 62 }); 63 64 } 65 66 } 67 68 | Popular Tags |