| 1 | |
package ca.uhn.hl7v2.conf.spec.message; |
| 2 | |
|
| 3 | |
import java.util.ArrayList; |
| 4 | |
import java.util.List; |
| 5 | |
|
| 6 | |
import ca.uhn.hl7v2.conf.ProfileException; |
| 7 | |
|
| 8 | |
|
| 9 | |
|
| 10 | |
|
| 11 | |
|
| 12 | |
public class Field extends AbstractComponent<Field> { |
| 13 | |
|
| 14 | |
|
| 15 | 7370 | private java.beans.PropertyChangeSupport propertyChangeSupport = new java.beans.PropertyChangeSupport(this); |
| 16 | |
|
| 17 | |
|
| 18 | 7370 | private java.beans.VetoableChangeSupport vetoableChangeSupport = new java.beans.VetoableChangeSupport(this); |
| 19 | |
|
| 20 | |
private short min; |
| 21 | |
private short max; |
| 22 | |
private short itemNo; |
| 23 | |
|
| 24 | 7370 | private final List<Component> components = new ArrayList<Component>(); |
| 25 | |
|
| 26 | |
|
| 27 | 7370 | public Field() { |
| 28 | 7370 | } |
| 29 | |
|
| 30 | |
|
| 31 | |
|
| 32 | |
|
| 33 | |
public void addPropertyChangeListener(java.beans.PropertyChangeListener l) { |
| 34 | 0 | propertyChangeSupport.addPropertyChangeListener(l); |
| 35 | 0 | } |
| 36 | |
|
| 37 | |
|
| 38 | |
|
| 39 | |
|
| 40 | |
public void removePropertyChangeListener(java.beans.PropertyChangeListener l) { |
| 41 | 0 | propertyChangeSupport.removePropertyChangeListener(l); |
| 42 | 0 | } |
| 43 | |
|
| 44 | |
|
| 45 | |
|
| 46 | |
|
| 47 | |
public void addVetoableChangeListener(java.beans.VetoableChangeListener l) { |
| 48 | 0 | vetoableChangeSupport.addVetoableChangeListener(l); |
| 49 | 0 | } |
| 50 | |
|
| 51 | |
|
| 52 | |
|
| 53 | |
|
| 54 | |
public void removeVetoableChangeListener(java.beans.VetoableChangeListener l) { |
| 55 | 0 | vetoableChangeSupport.removeVetoableChangeListener(l); |
| 56 | 0 | } |
| 57 | |
|
| 58 | |
|
| 59 | |
|
| 60 | |
|
| 61 | |
public short getMin() { |
| 62 | 2650 | return this.min; |
| 63 | |
} |
| 64 | |
|
| 65 | |
|
| 66 | |
|
| 67 | |
|
| 68 | |
|
| 69 | |
|
| 70 | |
public void setMin(short min) throws ProfileException { |
| 71 | 7370 | short oldMin = this.min; |
| 72 | |
try { |
| 73 | 7370 | vetoableChangeSupport.fireVetoableChange("min", oldMin, min); |
| 74 | 0 | } catch (Exception e) { |
| 75 | 0 | throw new ProfileException(null, e); |
| 76 | 7370 | } |
| 77 | 7370 | this.min = min; |
| 78 | 7370 | propertyChangeSupport.firePropertyChange("min", oldMin, min); |
| 79 | 7370 | } |
| 80 | |
|
| 81 | |
|
| 82 | |
|
| 83 | |
|
| 84 | |
public short getMax() { |
| 85 | 2650 | return this.max; |
| 86 | |
} |
| 87 | |
|
| 88 | |
|
| 89 | |
|
| 90 | |
|
| 91 | |
|
| 92 | |
|
| 93 | |
public void setMax(short max) throws ProfileException { |
| 94 | 7370 | short oldMax = this.max; |
| 95 | |
try { |
| 96 | 7370 | vetoableChangeSupport.fireVetoableChange("max", oldMax, max); |
| 97 | 0 | } catch (Exception e) { |
| 98 | 0 | throw new ProfileException(null, e); |
| 99 | 7370 | } |
| 100 | 7370 | this.max = max; |
| 101 | 7370 | propertyChangeSupport.firePropertyChange("max", oldMax, max); |
| 102 | 7370 | } |
| 103 | |
|
| 104 | |
|
| 105 | |
|
| 106 | |
|
| 107 | |
public short getItemNo() { |
| 108 | 5 | return this.itemNo; |
| 109 | |
} |
| 110 | |
|
| 111 | |
|
| 112 | |
|
| 113 | |
|
| 114 | |
|
| 115 | |
|
| 116 | |
public void setItemNo(short itemNo) throws ProfileException { |
| 117 | 7230 | short oldItemNo = this.itemNo; |
| 118 | |
try { |
| 119 | 7230 | vetoableChangeSupport.fireVetoableChange("itemNo", new Short(oldItemNo), new Short(itemNo)); |
| 120 | 0 | } catch (Exception e) { |
| 121 | 0 | throw new ProfileException(null, e); |
| 122 | 7230 | } |
| 123 | 7230 | this.itemNo = itemNo; |
| 124 | 7230 | propertyChangeSupport.firePropertyChange("itemNo", new Short(oldItemNo), new Short(itemNo)); |
| 125 | 7230 | } |
| 126 | |
|
| 127 | |
|
| 128 | |
|
| 129 | |
|
| 130 | |
|
| 131 | |
public Component getComponent(int index) { |
| 132 | 2010 | return this.components.get(index - 1); |
| 133 | |
} |
| 134 | |
|
| 135 | |
|
| 136 | |
|
| 137 | |
|
| 138 | |
|
| 139 | |
|
| 140 | |
|
| 141 | |
public void setComponent(int index, Component component) throws ProfileException { |
| 142 | 26385 | index--; |
| 143 | 52770 | while (components.size() <= index) { |
| 144 | 26385 | components.add(null); |
| 145 | |
} |
| 146 | 26385 | Component oldComponent = this.components.get(index); |
| 147 | 26385 | this.components.set(index, component); |
| 148 | |
try { |
| 149 | 26385 | vetoableChangeSupport.fireVetoableChange("components", null, null ); |
| 150 | |
} |
| 151 | 0 | catch(java.beans.PropertyVetoException vetoException ) { |
| 152 | 0 | this.components.set(index, oldComponent); |
| 153 | 0 | throw new ProfileException(null, vetoException); |
| 154 | 26385 | } |
| 155 | 26385 | propertyChangeSupport.firePropertyChange("components", null, null ); |
| 156 | 26385 | } |
| 157 | |
|
| 158 | |
|
| 159 | |
|
| 160 | |
public int getComponents() { |
| 161 | 4295 | return this.components.size(); |
| 162 | |
} |
| 163 | |
|
| 164 | |
|
| 165 | |
public List<Component> getChildrenAsList() { |
| 166 | 0 | return (this.components); |
| 167 | |
} |
| 168 | |
|
| 169 | |
} |
| 170 | |
|
| 171 | |
|