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.XMLComboButtonPanel; 22 import org.enhydra.jawe.xml.panels.XMLGroupPanel; 23 24 27 public class XMLFormalParametersRelatedComboButtonPanel extends XMLComboButtonPanel { 28 29 public XMLFormalParametersRelatedComboButtonPanel ( 30 XMLElement myOwner, 31 XMLCollection c) { 32 33 super(myOwner,c); 34 35 final JComboBox jcb=getComboBox(); 36 37 jcb.addActionListener(new ActionListener () { 38 public void actionPerformed(ActionEvent ae) { 39 XMLComplexElement choosen=(XMLComplexElement)jcb.getSelectedItem(); 40 FormalParameters formalParams=(FormalParameters)choosen.get("FormalParameters"); 41 if (formalParams==null) { Object tmp=choosen.get("Choice"); 43 tmp=((XMLChoice)tmp).getChoosen(); 44 if (tmp instanceof FormalParameters) { 45 formalParams=(FormalParameters)tmp; 46 } 47 } 48 49 XMLGroupPanel gp=(XMLGroupPanel)getParent(); 50 XMLActualParametersPanel app=(XMLActualParametersPanel) 53 ((XMLGroupPanel)gp.getComponent(2)).getComponent(0); 54 55 app.setFormalParameters(formalParams); 56 } 57 }); 58 59 } 60 61 } 62 63 | Popular Tags |