1 19 20 package org.netbeans.modules.j2ee.ddloaders.multiview; 21 22 import org.netbeans.modules.j2ee.dd.api.common.EnvEntry; 23 import org.netbeans.modules.j2ee.dd.api.ejb.Ejb; 24 25 28 public class EjbHelper { 29 private EjbJarMultiViewDataObject dataObject; 30 private Ejb ejb; 31 32 public EjbHelper(EjbJarMultiViewDataObject dataObject, Ejb ejb) { 33 this.dataObject = dataObject; 34 this.ejb = ejb; 35 } 36 37 public EnvEntryHelper getEnvEntryHelper(int rowIndex) { 38 return new EnvEntryHelper(ejb.getEnvEntry(rowIndex)); 39 } 40 41 public int getEnvEntryCount() { 42 return ejb.getEnvEntry().length; 43 } 44 45 public EnvEntryHelper newEnvEntry() { 46 EnvEntry entry = ejb.newEnvEntry(); 47 ejb.addEnvEntry(entry); 48 modelUpdatedFromUI(); 49 return new EnvEntryHelper(entry); 50 } 51 52 public void removeEnvEntry(int row) { 53 ejb.removeEnvEntry(ejb.getEnvEntry(row)); 54 modelUpdatedFromUI(); 55 } 56 57 private void modelUpdatedFromUI() { 58 dataObject.modelUpdatedFromUI(); 59 } 60 61 public class EnvEntryHelper { 62 private EnvEntry envEntry; 63 64 public EnvEntryHelper(EnvEntry envEntry) { 65 this.envEntry = envEntry; 66 modelUpdatedFromUI(); 67 } 68 69 public void setEnvEntryName(String value) { 70 envEntry.setEnvEntryName(value); 71 modelUpdatedFromUI(); 72 } 73 74 public void setEnvEntryType(String value) { 75 envEntry.setEnvEntryType(value); 76 modelUpdatedFromUI(); 77 } 78 79 public void setEnvEntryValue(String value) { 80 envEntry.setEnvEntryValue(value); 81 modelUpdatedFromUI(); 82 } 83 84 public void setDescription(String description) { 85 envEntry.setDescription(description); 86 modelUpdatedFromUI(); 87 } 88 89 public String getEnvEntryName() { 90 return envEntry.getEnvEntryName(); 91 } 92 93 public String getEnvEntryType() { 94 return envEntry.getEnvEntryType(); 95 } 96 97 public String getEnvEntryValue() { 98 return envEntry.getEnvEntryValue(); 99 } 100 101 public String getDefaultDescription() { 102 return envEntry.getDefaultDescription(); 103 } 104 } 105 } 106 | Popular Tags |