1 19 20 package org.netbeans.modules.j2ee.ddloaders.multiview; 21 22 import java.awt.event.FocusEvent ; 23 import java.awt.event.FocusListener ; 24 import org.netbeans.modules.xml.multiview.ui.SectionNodeInnerPanel; 25 import org.netbeans.modules.xml.multiview.ui.SectionNodeView; 26 import org.netbeans.modules.xml.multiview.SectionNode; 27 import org.netbeans.modules.j2ee.dd.api.ejb.Query; 28 import org.openide.util.NbBundle; 29 30 33 public class SelectMethodsNode extends EjbSectionNode { 34 35 private EntityHelper.Queries queries; 36 37 SelectMethodsNode(SectionNodeView sectionNodeView, EntityHelper.Queries queries) { 38 super(sectionNodeView, true, queries, Utils.getBundleMessage("LBL_CmpSelects"), Utils.ICON_BASE_MISC_NODE); 39 this.queries = queries; 40 } 41 42 protected SectionNodeInnerPanel createNodeInnerPanel() { 43 final SelectMethodsTableModel model = queries.getSelectMethodsTableModel(); 44 final InnerTablePanel innerTablePanel = new InnerTablePanel(getSectionNodeView(), model) { 45 46 protected void editCell(final int row, final int column) { 47 if (!model.editRow(row)){ 48 getSectionNodeView().getErrorPanel().setError( 49 new org.netbeans.modules.xml.multiview.Error(org.netbeans.modules.xml.multiview.Error.TYPE_WARNING, 50 NbBundle.getMessage(SelectMethodsNode.class, "TXT_MethodNotFound"), getTable())); 51 } 52 } 53 54 public void dataModelPropertyChange(Object source, String propertyName, Object oldValue, Object newValue) { 55 super.dataModelPropertyChange(source, propertyName, oldValue, newValue); 56 } 57 58 59 public void focusData(Object element) { 60 if (element instanceof Query) { 61 final int row = queries.getSelectMethodRow((Query) element); 62 if (row >= 0) { 63 getTable().getSelectionModel().setSelectionInterval(row, row); 64 } 65 } 66 67 } 68 }; 69 innerTablePanel.addFocusListener(new FocusListener () { 70 public void focusGained(FocusEvent e) { 71 72 } 73 public void focusLost(FocusEvent e) { 74 innerTablePanel.getSectionView().getErrorPanel().clearError(); 75 } 76 }); 77 78 return innerTablePanel; 79 } 80 81 public SectionNode getNodeForElement(Object element) { 82 if (element instanceof Query) { 83 if (queries.getSelectMethodRow((Query) element) >= 0) { 84 return this; 85 } 86 } 87 return super.getNodeForElement(element); 88 } 89 90 } 91 | Popular Tags |