1 19 24 25 package org.netbeans.modules.j2ee.sun.share.configbean.customizers.webservice; 26 27 import java.util.ResourceBundle ; 28 29 import java.beans.Customizer ; 30 import java.beans.PropertyVetoException ; 31 32 import javax.swing.JPanel ; 33 import javax.swing.text.BadLocationException ; 34 import javax.swing.text.Document ; 35 import javax.swing.event.DocumentEvent ; 36 import javax.swing.event.DocumentListener ; 37 38 import org.netbeans.modules.j2ee.sun.share.configbean.ServiceRef; 39 import org.netbeans.modules.j2ee.sun.share.configbean.ErrorMessageDB; 40 import org.netbeans.modules.j2ee.sun.share.configbean.ValidationError; 41 import org.netbeans.modules.j2ee.sun.share.configbean.customizers.common.CustomizerErrorPanel; 42 import org.netbeans.modules.j2ee.sun.share.configbean.customizers.common.CustomizerTitlePanel; 43 import org.netbeans.modules.j2ee.sun.share.configbean.customizers.common.BaseCustomizer; 44 45 46 50 public class ServiceRefCustomizer extends BaseCustomizer { 51 52 static final ResourceBundle bundle = ResourceBundle.getBundle( 53 "org.netbeans.modules.j2ee.sun.share.configbean.customizers.webservice.Bundle"); 55 57 private ServiceRef theBean; 58 59 60 private ServiceRefGeneralPanel generalPanel; 61 private ServiceRefPortInfoPanel portInfoPanel; 62 63 64 public ServiceRefCustomizer() { 65 initComponents(); 66 initUserComponents(); 67 } 68 69 public ServiceRef getBean() { 70 return theBean; 71 } 72 73 78 private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; 80 81 serviceRefTabbedPanel = new javax.swing.JTabbedPane (); 82 83 setLayout(new java.awt.GridBagLayout ()); 84 85 serviceRefTabbedPanel.setTabPlacement(javax.swing.JTabbedPane.BOTTOM); 86 gridBagConstraints = new java.awt.GridBagConstraints (); 87 gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; 88 gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; 89 gridBagConstraints.weightx = 1.0; 90 gridBagConstraints.weighty = 1.0; 91 add(serviceRefTabbedPanel, gridBagConstraints); 92 93 } 95 private javax.swing.JTabbedPane serviceRefTabbedPanel; 97 99 private void initUserComponents() { 100 addTitlePanel(bundle.getString("TITLE_ServiceRef")); 102 getAccessibleContext().setAccessibleName(bundle.getString("ACSN_ServiceRef")); getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_ServiceRef")); 105 generalPanel = new ServiceRefGeneralPanel(this); 107 serviceRefTabbedPanel.addTab(bundle.getString("TAB_General"), generalPanel); 109 portInfoPanel = new ServiceRefPortInfoPanel(this); 111 serviceRefTabbedPanel.addTab(bundle.getString("TAB_PortInfo"), portInfoPanel); 113 addErrorPanel(); 115 } 116 117 protected void initFields() { 118 generalPanel.initFields(theBean); 119 portInfoPanel.initFields(theBean); 120 } 121 122 public void partitionStateChanged(ErrorMessageDB.PartitionState oldState, ErrorMessageDB.PartitionState newState) { 123 if(newState.getPartition() == getPartition()) { 124 showErrors(); 125 } 126 127 if(oldState.hasMessages() != newState.hasMessages()) { 128 serviceRefTabbedPanel.setIconAt(newState.getPartition().getTabIndex(), newState.hasMessages() ? panelErrorIcon : null); 129 } 130 } 131 132 protected void addListeners() { 133 super.addListeners(); 134 generalPanel.addListeners(theBean); 135 portInfoPanel.addListeners(theBean); 136 } 137 138 protected void removeListeners() { 139 super.removeListeners(); 140 generalPanel.removeListeners(theBean); 141 portInfoPanel.removeListeners(theBean); 142 } 143 144 protected boolean setBean(Object bean) { 145 boolean result = super.setBean(bean); 146 147 if(bean instanceof ServiceRef) { 148 theBean = (ServiceRef) bean; 149 result = true; 150 } else { 151 assert (result == false) : 153 "ServiceRefCustomizer was passed wrong bean type in setBean(Object bean)"; 155 theBean = null; 156 result = false; 157 } 158 159 return result; 160 } 161 162 public String getHelpId() { 163 String result = "AS_CFG_ServiceRefGeneral"; 165 switch(serviceRefTabbedPanel.getSelectedIndex()) { 167 case 1: 168 result = "AS_CFG_ServiceRefPortInfo"; break; 170 } 171 172 return result; 173 } 174 175 180 public ValidationError.Partition getPartition() { 181 switch(serviceRefTabbedPanel.getSelectedIndex()) { 182 case 1: 183 return ValidationError.PARTITION_SERVICEREF_PORTINFO; 184 default: 185 return ValidationError.PARTITION_SERVICEREF_GENERAL; 186 } 187 } 188 } 189 | Popular Tags |