1 19 package org.netbeans.modules.j2ee.ddloaders.multiview; 20 21 import org.netbeans.modules.xml.multiview.SectionNode; 22 import org.netbeans.modules.xml.multiview.ToolBarMultiViewElement; 23 import org.netbeans.modules.xml.multiview.ui.SectionNodeView; 24 import org.netbeans.modules.xml.multiview.ui.SectionView; 25 import org.netbeans.modules.xml.multiview.ui.ToolBarDesignEditor; 26 27 import java.beans.PropertyChangeEvent ; 28 import java.beans.PropertyChangeListener ; 29 30 33 public abstract class EjbJarMultiviewElement extends ToolBarMultiViewElement { 34 35 private SectionView view; 36 protected ToolBarDesignEditor comp; 37 protected EjbJarMultiViewDataObject dataObject; 38 39 public EjbJarMultiviewElement(EjbJarMultiViewDataObject dataObject) { 40 super(dataObject); 41 this.dataObject = dataObject; 42 comp = new ToolBarDesignEditor(); 43 setVisualEditor(comp); 44 } 45 46 public void componentShowing() { 47 if (view == null) { 48 view = createView(); 49 if (view instanceof SectionNodeView) { 50 dataObject.getEjbJar().addPropertyChangeListener(new PropertyChangeListener () { 51 public void propertyChange(PropertyChangeEvent evt) { 52 ((SectionNodeView) view).dataModelPropertyChange(evt.getSource(), evt.getPropertyName(), 53 evt.getOldValue(), evt.getNewValue()); 54 } 55 }); 56 } 57 } 58 comp.setContentView(view); 59 if (view instanceof SectionNodeView) { 60 ((SectionNodeView) view).refreshView(); 61 } 62 view.checkValidity(); 63 super.componentShowing(); 64 Object lastActive = comp.getLastActive(); 65 final SectionNode node; 66 final SectionNodeView sectionNodeView = ((SectionNodeView) view); 67 if (lastActive instanceof SectionNode) { 68 node = (SectionNode) lastActive; 69 } else { 70 node = sectionNodeView.getRootNode(); 71 } 72 sectionNodeView.openPanel(node); 73 dataObject.checkParseable(); 74 } 75 76 protected abstract SectionView createView(); 77 78 public SectionView getSectionView() { 79 return view; 80 } 81 } 82 | Popular Tags |