1.1 --- a/encoder.custom.aip/src/org/netbeans/modules/encoder/custom/aip/Bundle.properties Thu Jul 31 10:44:09 2008 +0530
1.2 +++ b/encoder.custom.aip/src/org/netbeans/modules/encoder/custom/aip/Bundle.properties Thu Jul 31 14:14:17 2008 -0700
1.3 @@ -24,6 +24,15 @@
1.4 TAG_Order_any=any
1.5 TAG_Order_mixed=mixed
1.6
1.7 +TAG_FixedLengthType_regular=regular
1.8 +TAG_FixedLengthType_encoded=encoded
1.9 +TAG_FixedLengthType_undetermined=determined by regex match
1.10 +TAG_FixedLengthType_reversed=deducted from end
1.11 +
1.12 +TAG_UndefDataPolicy_map=map
1.13 +TAG_UndefDataPolicy_skip=skip
1.14 +TAG_UndefDataPolicy_prohibit=prohibit
1.15 +
1.16 TAG_DelimKind_escape=escape
1.17 TAG_DelimKind_normal=normal
1.18 TAG_DelimKind_repeat=repeat
1.19 @@ -55,6 +64,12 @@
1.20 encoding_node.exp.no_such_mthd=No such method exception
1.21
1.22 encoding_node.lbl.length=Length
1.23 +encoding_node.lbl.length_from_end=Length From End
1.24 +encoding_node.lbl.length_encoded=Encoded Field Length
1.25 +encoding_node.lbl.offset=Offset
1.26 +encoding_node.lbl.offset_encoded=Encoded Field Offset
1.27 +encoding_node.lbl.position=Position
1.28 +encoding_node.lbl.position_encoded=Encoded Field Position
1.29 encoding_node.lbl.delimiter=Delimiter
1.30 encoding_node.lbl.order=Order
1.31 encoding_node.lbl.match=Match
1.32 @@ -69,10 +84,21 @@
1.33 encoding_node.lbl.top=Top
1.34 encoding_node.lbl.delim_list=Delimiter List
1.35 encoding_node.lbl.node_type=Node Type
1.36 +encoding_node.lbl.fixed_length_type=Fixed Length Type
1.37 encoding_node.lbl.encoding_style_short=Encoding Style
1.38 encoding_node.lbl.encoding_style=Encoding Style
1.39 encoding_node.lbl.begin_delimiter=Begin Delimiter
1.40 encoding_node.lbl.begin_delimiter_detached=Begin Delimiter Detached
1.41 +encoding_node.lbl.undefined_data_policy=Undefined Data Policy
1.42 +encoding_node.lbl.n_of_n_min_n=NofN minN
1.43 +encoding_node.lbl.n_of_n_max_n=NofN maxN
1.44 +encoding_node.lbl.min_occ=MinOcc
1.45 +encoding_node.lbl.max_occ=MaxOcc
1.46 +encoding_node.lbl.scvngr_chars=Scavenger Chars
1.47 +encoding_node.lbl.scvngr_emit_1st=Output Scavenger 1st Char
1.48 +
1.49 +encoding_node.value.default_match=Specify Regex Here!
1.50 +encoding_node.value.unbounded=unbounded
1.51
1.52 delim_tree_tab.lbl.length_short=Length
1.53 delim_tree_tab.lbl.length=Length for embedded delimiter
2.1 --- a/encoder.custom.aip/src/org/netbeans/modules/encoder/custom/aip/EncodingNode.java Thu Jul 31 10:44:09 2008 +0530
2.2 +++ b/encoder.custom.aip/src/org/netbeans/modules/encoder/custom/aip/EncodingNode.java Thu Jul 31 14:14:17 2008 -0700
2.3 @@ -52,6 +52,7 @@
2.4 mChangeSheetPropNames.add("xmlType"); //NOI18N
2.5 mChangeSheetPropNames.add("typeDef"); //NOI18N
2.6 mChangeSheetPropNames.add("top"); //NOI18N
2.7 + mChangeSheetPropNames.add("fixedLengthType"); //NOI18N
2.8 }
2.9
2.10 private final EncodingOption mEncodingOption;
2.11 @@ -123,174 +124,280 @@
2.12 _bundle.getString("encoding_node.lbl.encoding_style_short")));
2.13
2.14 //The Node Type Property
2.15 - PropertySupport.Reflection<String> nodeTypeProp =
2.16 - new PropertySupport.Reflection<String>(mEncodingOption,
2.17 - String.class, "nodeType"); //NOI18N
2.18 - nodeTypeProp.setName("nodeType"); //NOI18N
2.19 - nodeTypeProp.setDisplayName(_bundle.getString("encoding_node.lbl.node_type"));
2.20 - nodeTypeProp.setPropertyEditorClass(NodeTypePropertyEditor.class);
2.21 - propSet.put(nodeTypeProp);
2.22 + {
2.23 + PropertySupport.Reflection<String> prop =
2.24 + new PropertySupport.Reflection<String>(mEncodingOption,
2.25 + String.class, "nodeType"); //NOI18N
2.26 + prop.setName("nodeType"); //NOI18N
2.27 + prop.setDisplayName(_bundle.getString("encoding_node.lbl.node_type"));
2.28 + prop.setPropertyEditorClass(NodeTypePropertyEditor.class);
2.29 + propSet.put(prop);
2.30 + }
2.31
2.32 + if (NodeProperties.NodeType.FIXED_LENGTH.equals(mEncodingOption.xgetNodeType())) {
2.33 +
2.34 + PropertySupport.Reflection<String> prop =
2.35 + new PropertySupport.Reflection<String>(mEncodingOption,
2.36 + String.class, "fixedLengthType"); //NOI18N
2.37 + prop.setName("fixedLengthType"); //NOI18N
2.38 + prop.setDisplayName(_bundle.getString("encoding_node.lbl.fixed_length_type"));
2.39 + prop.setPropertyEditorClass(FixedLengthTypePropertyEditor.class);
2.40 + propSet.put(prop);
2.41 +
2.42 + if (mEncodingOption.isUndeterminedFixedLengthType()) {
2.43 + // do not show "length", "offset" or "position" fields
2.44 + } else if (mEncodingOption.isReversedFixedLengthType()) {
2.45 + PropertySupport.Reflection<Integer> prop1 =
2.46 + new PropertySupport.Reflection<Integer>(mEncodingOption,
2.47 + int.class, "length"); //NOI18N
2.48 + prop1.setName("lengthFromEnd"); //NOI18N
2.49 + prop1.setDisplayName(_bundle.getString("encoding_node.lbl.length_from_end"));
2.50 + propSet.put(prop1);
2.51 + } else if (mEncodingOption.isEncodedFixedLengthType()) {
2.52 + PropertySupport.Reflection<Integer> prop1 =
2.53 + new PropertySupport.Reflection<Integer>(mEncodingOption,
2.54 + int.class, "length"); //NOI18N
2.55 + prop1.setName("lengthEncoded"); //NOI18N
2.56 + prop1.setDisplayName(_bundle.getString("encoding_node.lbl.length_encoded"));
2.57 + propSet.put(prop1);
2.58 +
2.59 + PropertySupport.Reflection<String> prop2 =
2.60 + new PropertySupport.Reflection<String>(mEncodingOption,
2.61 + String.class, "offset"); //NOI18N
2.62 + prop2.setName("offsetEncoded"); //NOI18N
2.63 + prop2.setDisplayName(_bundle.getString("encoding_node.lbl.offset_encoded"));
2.64 + propSet.put(prop2);
2.65 +
2.66 + PropertySupport.Reflection<String> prop3 =
2.67 + new PropertySupport.Reflection<String>(mEncodingOption,
2.68 + String.class, "position"); //NOI18N
2.69 + prop3.setName("positionEncoded"); //NOI18N
2.70 + prop3.setDisplayName(_bundle.getString("encoding_node.lbl.position_encoded"));
2.71 + propSet.put(prop3);
2.72 + } else {
2.73 + PropertySupport.Reflection<Integer> prop1 =
2.74 + new PropertySupport.Reflection<Integer>(mEncodingOption,
2.75 + int.class, "length"); //NOI18N
2.76 + prop1.setName("length"); //NOI18N
2.77 + prop1.setDisplayName(_bundle.getString("encoding_node.lbl.length"));
2.78 + propSet.put(prop1);
2.79 +
2.80 + PropertySupport.Reflection<String> prop2 =
2.81 + new PropertySupport.Reflection<String>(mEncodingOption,
2.82 + String.class, "offset"); //NOI18N
2.83 + prop2.setName("offset"); //NOI18N
2.84 + prop2.setDisplayName(_bundle.getString("encoding_node.lbl.offset"));
2.85 + propSet.put(prop2);
2.86 + }
2.87 + }
2.88 +
2.89 if (!NodeProperties.NodeType.TRANSIENT.equals(mEncodingOption.xgetNodeType())) {
2.90 - PropertySupport.Reflection delimSetProp =
2.91 + PropertySupport.Reflection prop =
2.92 new DelimiterSetProperty(mEncodingOption,
2.93 DelimiterSet.class, "delimiterSet"); //NOI18N
2.94 - delimSetProp.setName("delimiterSet"); //NOI18N
2.95 - delimSetProp.setDisplayName(_bundle.getString("encoding_node.lbl.delim_list"));
2.96 - propSet.put(delimSetProp);
2.97 + prop.setName("delimiterSet"); //NOI18N
2.98 + prop.setDisplayName(_bundle.getString("encoding_node.lbl.delim_list"));
2.99 + propSet.put(prop);
2.100 }
2.101
2.102 if (mEncodingOption.testIsGlobal()) {
2.103 - //The Top Property
2.104 - PropertySupport.Reflection<Boolean> topProp =
2.105 + //The Top Property checkbox
2.106 + PropertySupport.Reflection<Boolean> prop =
2.107 new PropertySupport.Reflection<Boolean>(mEncodingOption,
2.108 boolean.class, "top"); //NOI18N
2.109 - topProp.setName("top"); //NOI18N
2.110 - topProp.setDisplayName(_bundle.getString("encoding_node.lbl.top"));
2.111 - propSet.put(topProp);
2.112 + prop.setName("top"); //NOI18N
2.113 + prop.setDisplayName(_bundle.getString("encoding_node.lbl.top"));
2.114 + propSet.put(prop);
2.115 }
2.116
2.117 if (mEncodingOption.testIsGlobal() && mEncodingOption.isTop()) {
2.118 //The Input Character Set Property
2.119 - PropertySupport.Reflection<String> inputCharsetProp =
2.120 + PropertySupport.Reflection<String> prop =
2.121 new PropertySupport.Reflection<String>(mEncodingOption,
2.122 String.class, "inputCharset"); //NOI18N
2.123 - inputCharsetProp.setName("inputCharset"); //NOI18N
2.124 - inputCharsetProp.setDisplayName(_bundle.getString("encoding_node.lbl.input_charset"));
2.125 - propSet.put(inputCharsetProp);
2.126 + prop.setName("inputCharset"); //NOI18N
2.127 + prop.setDisplayName(_bundle.getString("encoding_node.lbl.input_charset"));
2.128 + propSet.put(prop);
2.129
2.130 //The Output Character Set Property
2.131 - PropertySupport.Reflection<String> outputCharsetProp =
2.132 + PropertySupport.Reflection<String> prop2 =
2.133 new PropertySupport.Reflection<String>(mEncodingOption,
2.134 String.class, "outputCharset"); //NOI18N
2.135 - outputCharsetProp.setName("outputCharset"); //NOI18N
2.136 - outputCharsetProp.setDisplayName(_bundle.getString("encoding_node.lbl.output_charset"));
2.137 - propSet.put(outputCharsetProp);
2.138 + prop2.setName("outputCharset"); //NOI18N
2.139 + prop2.setDisplayName(_bundle.getString("encoding_node.lbl.output_charset"));
2.140 + propSet.put(prop2);
2.141 }
2.142
2.143 if (mEncodingOption.testIsGlobal() && mEncodingOption.isTop()
2.144 || NodeProperties.NodeType.FIXED_LENGTH.equals(
2.145 mEncodingOption.xgetNodeType())) {
2.146 //The Parsing Character Set Property
2.147 - PropertySupport.Reflection<String> parsingCharsetProp =
2.148 + PropertySupport.Reflection<String> prop =
2.149 new PropertySupport.Reflection<String>(mEncodingOption,
2.150 String.class, "parsingCharset"); //NOI18N
2.151 - parsingCharsetProp.setName("parsingCharset"); //NOI18N
2.152 - parsingCharsetProp.setDisplayName(_bundle.getString("encoding_node.lbl.parsing_charset"));
2.153 - propSet.put(parsingCharsetProp);
2.154 + prop.setName("parsingCharset"); //NOI18N
2.155 + prop.setDisplayName(_bundle.getString("encoding_node.lbl.parsing_charset"));
2.156 + propSet.put(prop);
2.157
2.158 //The Serializing Character Set Property
2.159 - PropertySupport.Reflection<String> serializingCharsetProp =
2.160 + PropertySupport.Reflection<String> prop2 =
2.161 new PropertySupport.Reflection<String>(mEncodingOption,
2.162 String.class, "serializingCharset"); //NOI18N
2.163 - serializingCharsetProp.setName("serializingCharset"); //NOI18N
2.164 - serializingCharsetProp.setDisplayName(_bundle.getString("encoding_node.lbl.serial_charset"));
2.165 - propSet.put(serializingCharsetProp);
2.166 + prop2.setName("serializingCharset"); //NOI18N
2.167 + prop2.setDisplayName(_bundle.getString("encoding_node.lbl.serial_charset"));
2.168 + propSet.put(prop2);
2.169 }
2.170
2.171 if (!NodeProperties.NodeType.GROUP.equals(mEncodingOption.xgetNodeType())
2.172 && mEncodingOption.testIsSimple()
2.173 && !NodeProperties.NodeType.TRANSIENT.equals(mEncodingOption.xgetNodeType())) {
2.174 - PropertySupport.Reflection<String> alignmentProp =
2.175 + PropertySupport.Reflection<String> prop =
2.176 new PropertySupport.Reflection<String>(mEncodingOption,
2.177 String.class, "alignment"); //NOI18N
2.178 - alignmentProp.setName("alignment"); //NOI18N
2.179 - alignmentProp.setDisplayName(_bundle.getString("encoding_node.lbl.alignment"));
2.180 - alignmentProp.setPropertyEditorClass(AlignmentPropertyEditor.class);
2.181 - propSet.put(alignmentProp);
2.182 + prop.setName("alignment"); //NOI18N
2.183 + prop.setDisplayName(_bundle.getString("encoding_node.lbl.alignment"));
2.184 + prop.setPropertyEditorClass(AlignmentPropertyEditor.class);
2.185 + propSet.put(prop);
2.186
2.187 - PropertySupport.Reflection<String> matchProp =
2.188 + PropertySupport.Reflection<String> prop2 =
2.189 new PropertySupport.Reflection<String>(mEncodingOption,
2.190 String.class, "match"); //NOI18N
2.191 - matchProp.setName("match"); //NOI18N
2.192 - matchProp.setDisplayName(_bundle.getString("encoding_node.lbl.match"));
2.193 - propSet.put(matchProp);
2.194 + prop2.setName("match"); //NOI18N
2.195 + prop2.setDisplayName(_bundle.getString("encoding_node.lbl.match"));
2.196 + propSet.put(prop2);
2.197
2.198 //The NoMatch (boolean) Property
2.199 - PropertySupport.Reflection<Boolean> noMatchProp =
2.200 + PropertySupport.Reflection<Boolean> prop3 =
2.201 new PropertySupport.Reflection<Boolean>(mEncodingOption,
2.202 boolean.class, "noMatch"); //NOI18N
2.203 - noMatchProp.setName("noMatch"); //NOI18N
2.204 - noMatchProp.setDisplayName(_bundle.getString("encoding_node.lbl.no_match"));
2.205 - propSet.put(noMatchProp);
2.206 + prop3.setName("noMatch"); //NOI18N
2.207 + prop3.setDisplayName(_bundle.getString("encoding_node.lbl.no_match"));
2.208 + propSet.put(prop3);
2.209 }
2.210
2.211 if (!NodeProperties.NodeType.TRANSIENT.equals(mEncodingOption.xgetNodeType())
2.212 && !mEncodingOption.testIsSimple() && !mEncodingOption.testIsChoice()) {
2.213 - PropertySupport.Reflection<String> orderProp =
2.214 + PropertySupport.Reflection<String> prop =
2.215 new PropertySupport.Reflection<String>(mEncodingOption,
2.216 String.class, "order"); //NOI18N
2.217 - orderProp.setName("order"); //NOI18N
2.218 - orderProp.setDisplayName(_bundle.getString("encoding_node.lbl.order"));
2.219 - orderProp.setPropertyEditorClass(OrderPropertyEditor.class);
2.220 - propSet.put(orderProp);
2.221 + prop.setName("order"); //NOI18N
2.222 + prop.setDisplayName(_bundle.getString("encoding_node.lbl.order"));
2.223 + prop.setPropertyEditorClass(OrderPropertyEditor.class);
2.224 + propSet.put(prop);
2.225 }
2.226
2.227 + if (!NodeProperties.NodeType.TRANSIENT.equals(mEncodingOption.xgetNodeType())
2.228 + && !mEncodingOption.testIsSimple()) {
2.229 + PropertySupport.Reflection<String> prop1 =
2.230 + new PropertySupport.Reflection<String>(mEncodingOption,
2.231 + String.class, "nOfNminN"); //NOI18N
2.232 + prop1.setName("nOfNminN"); //NOI18N
2.233 + prop1.setDisplayName(_bundle.getString("encoding_node.lbl.n_of_n_min_n"));
2.234 + propSet.put(prop1);
2.235 +
2.236 + PropertySupport.Reflection<String> prop2 =
2.237 + new PropertySupport.Reflection<String>(mEncodingOption,
2.238 + String.class, "nOfNmaxN"); //NOI18N
2.239 + prop2.setName("nOfNmaxN"); //NOI18N
2.240 + prop2.setDisplayName(_bundle.getString("encoding_node.lbl.n_of_n_max_n"));
2.241 + propSet.put(prop2);
2.242 + }
2.243 +
2.244 + if (!NodeProperties.NodeType.TRANSIENT.equals(mEncodingOption.xgetNodeType())
2.245 + && !mEncodingOption.testIsGlobal()) {
2.246 + PropertySupport.Reflection<String> prop1 =
2.247 + new PropertySupport.Reflection<String>(mEncodingOption,
2.248 + String.class, "minOcc"); //NOI18N
2.249 + prop1.setName("minOcc"); //NOI18N
2.250 + prop1.setDisplayName(_bundle.getString("encoding_node.lbl.min_occ"));
2.251 + propSet.put(prop1);
2.252 +
2.253 + PropertySupport.Reflection<String> prop2 =
2.254 + new PropertySupport.Reflection<String>(mEncodingOption,
2.255 + String.class, "maxOcc"); //NOI18N
2.256 + prop2.setName("maxOcc"); //NOI18N
2.257 + prop2.setDisplayName(_bundle.getString("encoding_node.lbl.max_occ"));
2.258 + propSet.put(prop2);
2.259 +
2.260 + PropertySupport.Reflection<String> prop3 =
2.261 + new PropertySupport.Reflection<String>(mEncodingOption,
2.262 + String.class, "scvngrChars"); //NOI18N
2.263 + prop3.setName("scvngrChars"); //NOI18N
2.264 + prop3.setDisplayName(_bundle.getString("encoding_node.lbl.scvngr_chars"));
2.265 + propSet.put(prop3);
2.266 +
2.267 + PropertySupport.Reflection<Boolean> prop4 =
2.268 + new PropertySupport.Reflection<Boolean>(mEncodingOption,
2.269 + boolean.class, "scvngrEmit1st"); //NOI18N
2.270 + prop4.setName("scvngrEmit1st"); //NOI18N
2.271 + prop4.setDisplayName(_bundle.getString("encoding_node.lbl.scvngr_emit_1st"));
2.272 + propSet.put(prop4);
2.273 + }
2.274 +
2.275 if (NodeProperties.NodeType.DELIMITED.equals(mEncodingOption.xgetNodeType())
2.276 || NodeProperties.NodeType.ARRAY.equals(mEncodingOption.xgetNodeType())) {
2.277 - PropertySupport.Reflection<String> delimiterProp =
2.278 + PropertySupport.Reflection<String> prop =
2.279 new ReadOnlyDelimiterProperty<String>(mEncodingOption,
2.280 String.class, "getDelimiter"); //NOI18N
2.281 - delimiterProp.setName("delimiter"); //NOI18N
2.282 - delimiterProp.setDisplayName(_bundle.getString("encoding_node.lbl.delimiter"));
2.283 - propSet.put(delimiterProp);
2.284 + prop.setName("delimiter"); //NOI18N
2.285 + prop.setDisplayName(_bundle.getString("encoding_node.lbl.delimiter"));
2.286 + propSet.put(prop);
2.287 }
2.288
2.289 if (NodeProperties.NodeType.FIXED_LENGTH.equals(mEncodingOption.xgetNodeType())) {
2.290 - PropertySupport.Reflection<Integer> lengthProp =
2.291 - new PropertySupport.Reflection<Integer>(mEncodingOption,
2.292 - int.class, "length"); //NOI18N
2.293 - lengthProp.setName("length"); //NOI18N
2.294 - lengthProp.setDisplayName(_bundle.getString("encoding_node.lbl.length"));
2.295 - propSet.put(lengthProp);
2.296 - }
2.297 -
2.298 - if (NodeProperties.NodeType.FIXED_LENGTH.equals(mEncodingOption.xgetNodeType())) {
2.299 - PropertySupport.Reflection<String> beginDelimiterProp =
2.300 + PropertySupport.Reflection<String> prop =
2.301 new PropertySupport.Reflection<String>(mEncodingOption,
2.302 String.class, "beginDelimiter"); //NOI18N
2.303 - beginDelimiterProp.setName("beginDelimiter"); //NOI18N
2.304 - beginDelimiterProp.setDisplayName(_bundle.getString("encoding_node.lbl.begin_delimiter"));
2.305 - propSet.put(beginDelimiterProp);
2.306 + prop.setName("beginDelimiter"); //NOI18N
2.307 + prop.setDisplayName(_bundle.getString("encoding_node.lbl.begin_delimiter"));
2.308 + propSet.put(prop);
2.309 }
2.310
2.311 if (NodeProperties.NodeType.FIXED_LENGTH.equals(mEncodingOption.xgetNodeType())) {
2.312 - PropertySupport.Reflection<Boolean> beginDelimiterDetachedProp =
2.313 + PropertySupport.Reflection<Boolean> prop =
2.314 new PropertySupport.Reflection<Boolean>(mEncodingOption,
2.315 boolean.class, "beginDelimiterDetached"); //NOI18N
2.316 - beginDelimiterDetachedProp.setName("beginDelimiterDetached"); //NOI18N
2.317 - beginDelimiterDetachedProp.setDisplayName(_bundle.getString("encoding_node.lbl.begin_delimiter_detached"));
2.318 - propSet.put(beginDelimiterDetachedProp);
2.319 + prop.setName("beginDelimiterDetached"); //NOI18N
2.320 + prop.setDisplayName(_bundle.getString("encoding_node.lbl.begin_delimiter_detached"));
2.321 + propSet.put(prop);
2.322 }
2.323
2.324 if (NodeProperties.NodeType.DELIMITED.equals(mEncodingOption.xgetNodeType())
2.325 || NodeProperties.NodeType.ARRAY.equals(mEncodingOption.xgetNodeType())) {
2.326 - PropertySupport.Reflection<String> delimiterProp =
2.327 + PropertySupport.Reflection<String> prop =
2.328 new ReadOnlyDelimiterProperty<String>(mEncodingOption,
2.329 String.class, "getDelimiter"); //NOI18N
2.330 - delimiterProp.setName("delimiter"); //NOI18N
2.331 - delimiterProp.setDisplayName(_bundle.getString("encoding_node.lbl.delimiter"));
2.332 - propSet.put(delimiterProp);
2.333 + prop.setName("delimiter"); //NOI18N
2.334 + prop.setDisplayName(_bundle.getString("encoding_node.lbl.delimiter"));
2.335 + propSet.put(prop);
2.336 }
2.337
2.338 if (mEncodingOption.testIsGlobal() && mEncodingOption.isTop()) {
2.339 //The Escape Sequence Property
2.340 - PropertySupport.Reflection<String> escapeSequenceProp =
2.341 + PropertySupport.Reflection<String> prop =
2.342 new PropertySupport.Reflection<String>(mEncodingOption,
2.343 String.class, "escapeSequence"); //NOI18N
2.344 - escapeSequenceProp.setName("escapeSequence"); //NOI18N
2.345 - escapeSequenceProp.setDisplayName(_bundle.getString("encoding_node.lbl.escape_sequence"));
2.346 - propSet.put(escapeSequenceProp);
2.347 + prop.setName("escapeSequence"); //NOI18N
2.348 + prop.setDisplayName(_bundle.getString("encoding_node.lbl.escape_sequence"));
2.349 + propSet.put(prop);
2.350 }
2.351
2.352 if (mEncodingOption.testIsGlobal() && mEncodingOption.isTop()) {
2.353 //The Fine Inherit Property
2.354 - PropertySupport.Reflection<Boolean> fineInheritProp =
2.355 + PropertySupport.Reflection<Boolean> prop =
2.356 new PropertySupport.Reflection<Boolean>(mEncodingOption,
2.357 boolean.class, "fineInherit"); //NOI18N
2.358 - fineInheritProp.setName("fineInherit"); //NOI18N
2.359 - fineInheritProp.setDisplayName(_bundle.getString("encoding_node.lbl.fine_inherit"));
2.360 - propSet.put(fineInheritProp);
2.361 + prop.setName("fineInherit"); //NOI18N
2.362 + prop.setDisplayName(_bundle.getString("encoding_node.lbl.fine_inherit"));
2.363 + propSet.put(prop);
2.364 +
2.365 + PropertySupport.Reflection<String> prop2 =
2.366 + new PropertySupport.Reflection<String>(mEncodingOption,
2.367 + String.class, "undefDataPolicy"); //NOI18N
2.368 + prop2.setName("undefDataPolicy"); //NOI18N
2.369 + prop2.setDisplayName(_bundle.getString("encoding_node.lbl.undefined_data_policy"));
2.370 + prop2.setPropertyEditorClass(UndefDataPolicyPropertyEditor.class);
2.371 + propSet.put(prop2);
2.372 }
2.373 } catch (NoSuchMethodException e) {
2.374 throw new RuntimeException(_bundle.getString("encoding_node.exp.no_such_mthd"), e);
3.1 --- a/encoder.custom.aip/src/org/netbeans/modules/encoder/custom/aip/EncodingOption.java Thu Jul 31 10:44:09 2008 +0530
3.2 +++ b/encoder.custom.aip/src/org/netbeans/modules/encoder/custom/aip/EncodingOption.java Thu Jul 31 14:14:17 2008 -0700
3.3 @@ -25,6 +25,8 @@
3.4 import com.sun.encoder.custom.appinfo.DelimiterSet;
3.5 import com.sun.encoder.custom.appinfo.NodeProperties;
3.6 import com.sun.encoder.custom.appinfo.NodeProperties.DelimOfFixed;
3.7 +import com.sun.encoder.custom.appinfo.NodeProperties.NOfN;
3.8 +import com.sun.encoder.custom.appinfo.NodeProperties.Scvngr;
3.9 import com.sun.encoder.runtime.provider.Misc;
3.10 import java.beans.PropertyChangeEvent;
3.11 import java.beans.PropertyChangeListener;
3.12 @@ -77,6 +79,10 @@
3.13 public static final String NODE_TYPE_PREFIX = "nodeType"; //NOI18N
3.14 public static final String ALIGNMENT_PREFIX = "align"; //NOI18N
3.15 public static final String ORDER_PREFIX = "order"; //NOI18N
3.16 + public static final String UNDEFINED_DATA_POLICY_PREFIX = "undefDataPolicy"; //NOI18N
3.17 + public static final String FIXED_LENGTH_TYPE_PREFIX = "fixedLengthType"; //NOI18N
3.18 + private static final String EMP = ""; //NOI18N
3.19 + private static final String UDS = "_"; //NOI18N
3.20
3.21 private static final CustomEncoding mDefaultCustomEncoding =
3.22 CustomEncoding.Factory.newInstance();
3.23 @@ -88,19 +94,21 @@
3.24 private static List<String> mNodeTypeTagList = new ArrayList<String>();
3.25 private static List<String> mAlignmentTagList = new ArrayList<String>();
3.26 private static List<String> mOrderTagList = new ArrayList<String>();
3.27 + private static List<String> mFixedLengthTypeTagList = new ArrayList<String>();
3.28 + private static List<String> mUndefDataPolicyTagList = new ArrayList<String>();
3.29
3.30 static {
3.31 //Populate the localized text map and the tag list for the node type property
3.32 - mReverseTextMap.put(NODE_TYPE_PREFIX + "_" + _bundle.getString("TAG_NodeType_group"), "group"); //NOI18N
3.33 - mReverseTextMap.put(NODE_TYPE_PREFIX + "_" + _bundle.getString("TAG_NodeType_array"), "array"); //NOI18N
3.34 - mReverseTextMap.put(NODE_TYPE_PREFIX + "_" + _bundle.getString("TAG_NodeType_delimited"), "delimited"); //NOI18N
3.35 - mReverseTextMap.put(NODE_TYPE_PREFIX + "_" + _bundle.getString("TAG_NodeType_fixedLength"), "fixedLength"); //NOI18N
3.36 - mReverseTextMap.put(NODE_TYPE_PREFIX + "_" + _bundle.getString("TAG_NodeType_transient"), "transient"); //NOI18N
3.37 - mTextMap.put(NODE_TYPE_PREFIX + "_" + "group", _bundle.getString("TAG_NodeType_group")); //NOI18N
3.38 - mTextMap.put(NODE_TYPE_PREFIX + "_" + "array", _bundle.getString("TAG_NodeType_array")); //NOI18N
3.39 - mTextMap.put(NODE_TYPE_PREFIX + "_" + "delimited", _bundle.getString("TAG_NodeType_delimited")); //NOI18N
3.40 - mTextMap.put(NODE_TYPE_PREFIX + "_" + "fixedLength", _bundle.getString("TAG_NodeType_fixedLength")); //NOI18N
3.41 - mTextMap.put(NODE_TYPE_PREFIX + "_" + "transient", _bundle.getString("TAG_NodeType_transient")); //NOI18N
3.42 + mReverseTextMap.put(NODE_TYPE_PREFIX + UDS + _bundle.getString("TAG_NodeType_group"), "group"); //NOI18N
3.43 + mReverseTextMap.put(NODE_TYPE_PREFIX + UDS + _bundle.getString("TAG_NodeType_array"), "array"); //NOI18N
3.44 + mReverseTextMap.put(NODE_TYPE_PREFIX + UDS + _bundle.getString("TAG_NodeType_delimited"), "delimited"); //NOI18N
3.45 + mReverseTextMap.put(NODE_TYPE_PREFIX + UDS + _bundle.getString("TAG_NodeType_fixedLength"), "fixedLength"); //NOI18N
3.46 + mReverseTextMap.put(NODE_TYPE_PREFIX + UDS + _bundle.getString("TAG_NodeType_transient"), "transient"); //NOI18N
3.47 + mTextMap.put(NODE_TYPE_PREFIX + UDS + "group", _bundle.getString("TAG_NodeType_group")); //NOI18N
3.48 + mTextMap.put(NODE_TYPE_PREFIX + UDS + "array", _bundle.getString("TAG_NodeType_array")); //NOI18N
3.49 + mTextMap.put(NODE_TYPE_PREFIX + UDS + "delimited", _bundle.getString("TAG_NodeType_delimited")); //NOI18N
3.50 + mTextMap.put(NODE_TYPE_PREFIX + UDS + "fixedLength", _bundle.getString("TAG_NodeType_fixedLength")); //NOI18N
3.51 + mTextMap.put(NODE_TYPE_PREFIX + UDS + "transient", _bundle.getString("TAG_NodeType_transient")); //NOI18N
3.52 mNodeTypeTagList.add(_bundle.getString("TAG_NodeType_group"));
3.53 mNodeTypeTagList.add(_bundle.getString("TAG_NodeType_array"));
3.54 mNodeTypeTagList.add(_bundle.getString("TAG_NodeType_delimited"));
3.55 @@ -109,22 +117,22 @@
3.56 mNodeTypeTagList = Collections.unmodifiableList(mNodeTypeTagList);
3.57
3.58 //Populate the localized text map and the tag list for the alignment property
3.59 - mReverseTextMap.put(ALIGNMENT_PREFIX + "_" + _bundle.getString("TAG_Alignment_blind"), "blind"); //NOI18N
3.60 - mReverseTextMap.put(ALIGNMENT_PREFIX + "_" + _bundle.getString("TAG_Alignment_exact"), "exact"); //NOI18N
3.61 - mReverseTextMap.put(ALIGNMENT_PREFIX + "_" + _bundle.getString("TAG_Alignment_begin"), "begin"); //NOI18N
3.62 - mReverseTextMap.put(ALIGNMENT_PREFIX + "_" + _bundle.getString("TAG_Alignment_final"), "final"); //NOI18N
3.63 - mReverseTextMap.put(ALIGNMENT_PREFIX + "_" + _bundle.getString("TAG_Alignment_inter"), "inter"); //NOI18N
3.64 - mReverseTextMap.put(ALIGNMENT_PREFIX + "_" + _bundle.getString("TAG_Alignment_super"), "super"); //NOI18N
3.65 - mReverseTextMap.put(ALIGNMENT_PREFIX + "_" + _bundle.getString("TAG_Alignment_oneof"), "oneof"); //NOI18N
3.66 - mReverseTextMap.put(ALIGNMENT_PREFIX + "_" + _bundle.getString("TAG_Alignment_regex"), "regex"); //NOI18N
3.67 - mTextMap.put(ALIGNMENT_PREFIX + "_" + "blind", _bundle.getString("TAG_Alignment_blind")); //NOI18N
3.68 - mTextMap.put(ALIGNMENT_PREFIX + "_" + "exact", _bundle.getString("TAG_Alignment_exact")); //NOI18N
3.69 - mTextMap.put(ALIGNMENT_PREFIX + "_" + "begin", _bundle.getString("TAG_Alignment_begin")); //NOI18N
3.70 - mTextMap.put(ALIGNMENT_PREFIX + "_" + "final", _bundle.getString("TAG_Alignment_final")); //NOI18N
3.71 - mTextMap.put(ALIGNMENT_PREFIX + "_" + "inter", _bundle.getString("TAG_Alignment_inter")); //NOI18N
3.72 - mTextMap.put(ALIGNMENT_PREFIX + "_" + "super", _bundle.getString("TAG_Alignment_super")); //NOI18N
3.73 - mTextMap.put(ALIGNMENT_PREFIX + "_" + "oneof", _bundle.getString("TAG_Alignment_oneof")); //NOI18N
3.74 - mTextMap.put(ALIGNMENT_PREFIX + "_" + "regex", _bundle.getString("TAG_Alignment_regex")); //NOI18N
3.75 + mReverseTextMap.put(ALIGNMENT_PREFIX + UDS + _bundle.getString("TAG_Alignment_blind"), "blind"); //NOI18N
3.76 + mReverseTextMap.put(ALIGNMENT_PREFIX + UDS + _bundle.getString("TAG_Alignment_exact"), "exact"); //NOI18N
3.77 + mReverseTextMap.put(ALIGNMENT_PREFIX + UDS + _bundle.getString("TAG_Alignment_begin"), "begin"); //NOI18N
3.78 + mReverseTextMap.put(ALIGNMENT_PREFIX + UDS + _bundle.getString("TAG_Alignment_final"), "final"); //NOI18N
3.79 + mReverseTextMap.put(ALIGNMENT_PREFIX + UDS + _bundle.getString("TAG_Alignment_inter"), "inter"); //NOI18N
3.80 + mReverseTextMap.put(ALIGNMENT_PREFIX + UDS + _bundle.getString("TAG_Alignment_super"), "super"); //NOI18N
3.81 + mReverseTextMap.put(ALIGNMENT_PREFIX + UDS + _bundle.getString("TAG_Alignment_oneof"), "oneof"); //NOI18N
3.82 + mReverseTextMap.put(ALIGNMENT_PREFIX + UDS + _bundle.getString("TAG_Alignment_regex"), "regex"); //NOI18N
3.83 + mTextMap.put(ALIGNMENT_PREFIX + UDS + "blind", _bundle.getString("TAG_Alignment_blind")); //NOI18N
3.84 + mTextMap.put(ALIGNMENT_PREFIX + UDS + "exact", _bundle.getString("TAG_Alignment_exact")); //NOI18N
3.85 + mTextMap.put(ALIGNMENT_PREFIX + UDS + "begin", _bundle.getString("TAG_Alignment_begin")); //NOI18N
3.86 + mTextMap.put(ALIGNMENT_PREFIX + UDS + "final", _bundle.getString("TAG_Alignment_final")); //NOI18N
3.87 + mTextMap.put(ALIGNMENT_PREFIX + UDS + "inter", _bundle.getString("TAG_Alignment_inter")); //NOI18N
3.88 + mTextMap.put(ALIGNMENT_PREFIX + UDS + "super", _bundle.getString("TAG_Alignment_super")); //NOI18N
3.89 + mTextMap.put(ALIGNMENT_PREFIX + UDS + "oneof", _bundle.getString("TAG_Alignment_oneof")); //NOI18N
3.90 + mTextMap.put(ALIGNMENT_PREFIX + UDS + "regex", _bundle.getString("TAG_Alignment_regex")); //NOI18N
3.91 mAlignmentTagList.add(_bundle.getString("TAG_Alignment_blind"));
3.92 mAlignmentTagList.add(_bundle.getString("TAG_Alignment_exact"));
3.93 mAlignmentTagList.add(_bundle.getString("TAG_Alignment_begin"));
3.94 @@ -136,17 +144,43 @@
3.95 mAlignmentTagList = Collections.unmodifiableList(mAlignmentTagList);
3.96
3.97 //Populate the localized text map and the tag list for the order property
3.98 - mReverseTextMap.put(ORDER_PREFIX + "_" + _bundle.getString("TAG_Order_sequence"), "sequence"); //NOI18N
3.99 - mReverseTextMap.put(ORDER_PREFIX + "_" + _bundle.getString("TAG_Order_any"), "any"); //NOI18N
3.100 - mReverseTextMap.put(ORDER_PREFIX + "_" + _bundle.getString("TAG_Order_mixed"), "mixed"); //NOI18N
3.101 - mTextMap.put(ORDER_PREFIX + "_" + "sequence", _bundle.getString("TAG_Order_sequence")); //NOI18N
3.102 - mTextMap.put(ORDER_PREFIX + "_" + "any", _bundle.getString("TAG_Order_any")); //NOI18N
3.103 - mTextMap.put(ORDER_PREFIX + "_" + "mixed", _bundle.getString("TAG_Order_mixed")); //NOI18N
3.104 + mReverseTextMap.put(ORDER_PREFIX + UDS + _bundle.getString("TAG_Order_sequence"), "sequence"); //NOI18N
3.105 + mReverseTextMap.put(ORDER_PREFIX + UDS + _bundle.getString("TAG_Order_any"), "any"); //NOI18N
3.106 + mReverseTextMap.put(ORDER_PREFIX + UDS + _bundle.getString("TAG_Order_mixed"), "mixed"); //NOI18N
3.107 + mTextMap.put(ORDER_PREFIX + UDS + "sequence", _bundle.getString("TAG_Order_sequence")); //NOI18N
3.108 + mTextMap.put(ORDER_PREFIX + UDS + "any", _bundle.getString("TAG_Order_any")); //NOI18N
3.109 + mTextMap.put(ORDER_PREFIX + UDS + "mixed", _bundle.getString("TAG_Order_mixed")); //NOI18N
3.110 mOrderTagList.add(_bundle.getString("TAG_Order_sequence"));
3.111 mOrderTagList.add(_bundle.getString("TAG_Order_any"));
3.112 mOrderTagList.add(_bundle.getString("TAG_Order_mixed"));
3.113 mOrderTagList = Collections.unmodifiableList(mOrderTagList);
3.114
3.115 + //Populate the localized text map and the tag list for the fixedLengthType property
3.116 + mReverseTextMap.put(FIXED_LENGTH_TYPE_PREFIX + UDS + _bundle.getString("TAG_FixedLengthType_regular"), "regular"); //NOI18N
3.117 + mReverseTextMap.put(FIXED_LENGTH_TYPE_PREFIX + UDS + _bundle.getString("TAG_FixedLengthType_encoded"), "encoded"); //NOI18N
3.118 + mReverseTextMap.put(FIXED_LENGTH_TYPE_PREFIX + UDS + _bundle.getString("TAG_FixedLengthType_undetermined"), "undetermined"); //NOI18N
3.119 + mReverseTextMap.put(FIXED_LENGTH_TYPE_PREFIX + UDS + _bundle.getString("TAG_FixedLengthType_reversed"), "reversed"); //NOI18N
3.120 + mTextMap.put(FIXED_LENGTH_TYPE_PREFIX + UDS + "regular", _bundle.getString("TAG_FixedLengthType_regular")); //NOI18N
3.121 + mTextMap.put(FIXED_LENGTH_TYPE_PREFIX + UDS + "encoded", _bundle.getString("TAG_FixedLengthType_encoded")); //NOI18N
3.122 + mTextMap.put(FIXED_LENGTH_TYPE_PREFIX + UDS + "undetermined", _bundle.getString("TAG_FixedLengthType_undetermined")); //NOI18N
3.123 + mTextMap.put(FIXED_LENGTH_TYPE_PREFIX + UDS + "reversed", _bundle.getString("TAG_FixedLengthType_reversed")); //NOI18N
3.124 + mFixedLengthTypeTagList.add(_bundle.getString("TAG_FixedLengthType_regular"));
3.125 + mFixedLengthTypeTagList.add(_bundle.getString("TAG_FixedLengthType_encoded"));
3.126 + mFixedLengthTypeTagList.add(_bundle.getString("TAG_FixedLengthType_undetermined"));
3.127 + mFixedLengthTypeTagList.add(_bundle.getString("TAG_FixedLengthType_reversed"));
3.128 + mFixedLengthTypeTagList = Collections.unmodifiableList(mFixedLengthTypeTagList);
3.129 +
3.130 + //Populate the localized text map and the tag list for the undefDataPolicy property
3.131 + mReverseTextMap.put(UNDEFINED_DATA_POLICY_PREFIX + UDS + _bundle.getString("TAG_UndefDataPolicy_map"), "map"); //NOI18N
3.132 + mReverseTextMap.put(UNDEFINED_DATA_POLICY_PREFIX + UDS + _bundle.getString("TAG_UndefDataPolicy_skip"), "skip"); //NOI18N
3.133 + mReverseTextMap.put(UNDEFINED_DATA_POLICY_PREFIX + UDS + _bundle.getString("TAG_UndefDataPolicy_prohibit"), "prohibit"); //NOI18N
3.134 + mTextMap.put(UNDEFINED_DATA_POLICY_PREFIX + UDS + "map", _bundle.getString("TAG_UndefDataPolicy_map")); //NOI18N
3.135 + mTextMap.put(UNDEFINED_DATA_POLICY_PREFIX + UDS + "skip", _bundle.getString("TAG_UndefDataPolicy_skip")); //NOI18N
3.136 + mTextMap.put(UNDEFINED_DATA_POLICY_PREFIX + UDS + "prohibit", _bundle.getString("TAG_UndefDataPolicy_prohibit")); //NOI18N
3.137 + mUndefDataPolicyTagList.add(_bundle.getString("TAG_UndefDataPolicy_map"));
3.138 + mUndefDataPolicyTagList.add(_bundle.getString("TAG_UndefDataPolicy_skip"));
3.139 + mUndefDataPolicyTagList.add(_bundle.getString("TAG_UndefDataPolicy_prohibit"));
3.140 +
3.141 //Populate the default NodeProperties
3.142 mDefaultCustomEncoding.addNewNodeProperties();
3.143 mDefaultCustomEncoding.getNodeProperties().setNodeType(
3.144 @@ -157,38 +191,56 @@
3.145 private final List<PropertyChangeListener> propChangeListeners =
3.146 Collections.synchronizedList(new LinkedList<PropertyChangeListener>());
3.147
3.148 - /* Component path from which the encoding options are read */
3.149 + /**
3.150 + * Component path from which the encoding options are read
3.151 + */
3.152 private final SchemaComponent[] mComponentPath;
3.153
3.154 /* Bean property variables */
3.155 - private String mNodeType = mTextMap.get(NODE_TYPE_PREFIX + "_" + NodeProperties.NodeType.DELIMITED); //NOI18N
3.156 + private String mNodeType = mTextMap.get(NODE_TYPE_PREFIX + UDS + NodeProperties.NodeType.DELIMITED);
3.157 private boolean mTop = false;
3.158 - private String mInputCharset = ""; //NOI18N
3.159 - private String mParsingCharset = ""; //NOI18N
3.160 - private String mSerializingCharset = ""; //NOI18N
3.161 - private String mOutputCharset = ""; //NOI18N
3.162 + private String mInputCharset = EMP;
3.163 + private String mParsingCharset = EMP;
3.164 + private String mSerializingCharset = EMP;
3.165 + private String mOutputCharset = EMP;
3.166 private DelimiterSet mDelimiterSet = null;
3.167 - private String mOrder = mTextMap.get(ORDER_PREFIX + "_" + NodeProperties.Order.SEQUENCE); //NOI18N
3.168 - private String mMatch = ""; //NOI18N
3.169 + private String mOrder = mTextMap.get(ORDER_PREFIX + UDS + NodeProperties.Order.SEQUENCE);
3.170 + private String mNOfNminN = EMP;
3.171 + private String mNOfNmaxN = EMP;
3.172 + private String mMatch = EMP;
3.173 private boolean mNoMatch = false;
3.174 - private String mAlignment = mTextMap.get(ALIGNMENT_PREFIX + "_" + NodeProperties.Alignment.BLIND); //NOI18N
3.175 + private String mAlignment = mTextMap.get(ALIGNMENT_PREFIX + UDS + NodeProperties.Alignment.BLIND);
3.176 + private String mMinOcc = EMP;
3.177 + private String mMaxOcc = EMP;
3.178 + private String mScvngrChars = EMP;
3.179 + private boolean mScvngrEmit1st = false;
3.180 +
3.181 + // for a fixedLength field
3.182 + private String mFixedLengthType = mTextMap.get(FIXED_LENGTH_TYPE_PREFIX + UDS + "regular"); //NOI18N
3.183 private int mLength = 0;
3.184 - private String mBeginDelimiter = ""; //NOI18N
3.185 - private boolean mBeginDelimiterDetached = true;
3.186 - private String mEscapeSequence = ""; //NOI18N
3.187 + private String mOffset = EMP;
3.188 + private String mPosition = EMP;
3.189 + private String mBeginDelimiter = EMP;
3.190 + private boolean mBeginDelimiterDetached = false;
3.191 + // global
3.192 + private String mEscapeSequence = EMP;
3.193 private boolean mFineInherit = false;
3.194 + private String mUndefDataPolicy = mTextMap.get(UNDEFINED_DATA_POLICY_PREFIX + UDS + NodeProperties.UndefDataPolicy.PROHIBIT);
3.195
3.196 private CustomEncoding mCustomEncoding = null;
3.197 private AppInfo mAppInfo = null;
3.198 private PropertyChangeListener mSchemaPropChangeListener;
3.199
3.200 - /** Creates a new instance of EncodingOption */
3.201 + /**
3.202 + * Creates a new instance of EncodingOption
3.203 + * @param path - a list of SchemaComponent
3.204 + */
3.205 private EncodingOption(List<SchemaComponent> path) {
3.206 if (path == null) {
3.207 - throw new NullPointerException(_bundle.getString("encoding_opt.exp.no_component_path"));
3.208 + throw new NullPointerException(_bundle.getString("encoding_opt.exp.no_component_path")); //NOI18N
3.209 }
3.210 if (path.size() < 1) {
3.211 - throw new IllegalArgumentException(_bundle.getString("encoding_opt.exp.illegal_comp_path"));
3.212 + throw new IllegalArgumentException(_bundle.getString("encoding_opt.exp.illegal_comp_path")); //NOI18N
3.213 }
3.214 mComponentPath = path.toArray(new SchemaComponent[0]);
3.215 }
3.216 @@ -229,6 +281,14 @@
3.217 return mOrderTagList;
3.218 }
3.219
3.220 + public static List<String> fixedLengthTypeTagList() {
3.221 + return mFixedLengthTypeTagList;
3.222 + }
3.223 +
3.224 + public static List<String> undefDataPolicyTagList() {
3.225 + return mUndefDataPolicyTagList;
3.226 + }
3.227 +
3.228 public String getAlignment() {
3.229 return mAlignment;
3.230 }
3.231 @@ -238,7 +298,7 @@
3.232 mAlignment = alignment;
3.233 NodeProperties.Alignment.Enum enumAlignment =
3.234 NodeProperties.Alignment.Enum.forString(
3.235 - mReverseTextMap.get(ALIGNMENT_PREFIX + "_" + mAlignment)); //NOI18N
3.236 + mReverseTextMap.get(ALIGNMENT_PREFIX + UDS + mAlignment));
3.237 firePropertyChange("alignment", old, mAlignment); //NOI18N
3.238 mCustomEncoding.getNodeProperties().setAlignment(enumAlignment);
3.239 commitToAppInfo();
3.240 @@ -247,7 +307,7 @@
3.241 public String getDelimiter() {
3.242 String delim = computeDelimiter();
3.243 if (delim == null) {
3.244 - delim = _bundle.getString("encoding_opt.lbl.delim_not_set");
3.245 + delim = _bundle.getString("encoding_opt.lbl.delim_not_set"); //NOI18N
3.246 }
3.247 return delim;
3.248 }
3.249 @@ -293,13 +353,233 @@
3.250 }
3.251
3.252 public void setLength(int length) {
3.253 + if (length < 0) {
3.254 + length *= -1;
3.255 + }
3.256 Integer old = Integer.valueOf(mLength);
3.257 mLength = length;
3.258 - mCustomEncoding.getNodeProperties().setLength(mLength);
3.259 + if (isReversedFixedLengthType()) {
3.260 + mCustomEncoding.getNodeProperties().setLength(mLength * (-1));
3.261 + } else {
3.262 + mCustomEncoding.getNodeProperties().setLength(mLength);
3.263 + }
3.264 commitToAppInfo();
3.265 firePropertyChange("length", old, Integer.valueOf(mLength)); //NOI18N
3.266 }
3.267
3.268 + public String getOffset() {
3.269 + return mOffset;
3.270 + }
3.271 +
3.272 + public void setOffset(String offset) {
3.273 + if (offset == null || offset.length() == 0) {
3.274 + mCustomEncoding.getNodeProperties().unsetOffset();
3.275 + } else {
3.276 + long l = 0;
3.277 + try {
3.278 + l = Long.parseLong(offset);
3.279 + } catch (NumberFormatException e) {
3.280 + // do nothing
3.281 + }
3.282 + if (l < 0) {
3.283 + // change to positive number instead
3.284 + l *= -1;
3.285 + }
3.286 + offset = Long.toString(l);
3.287 + mCustomEncoding.getNodeProperties().setOffset(l);
3.288 + }
3.289 + String old = mOffset;
3.290 + mOffset = offset;
3.291 + commitToAppInfo();
3.292 + firePropertyChange("offset", old, mOffset); //NOI18N
3.293 + }
3.294 +
3.295 + public String getPosition() {
3.296 + return mPosition;
3.297 + }
3.298 +
3.299 + public void setPosition(String position) {
3.300 + if (position == null || position.length() == 0) {
3.301 + mCustomEncoding.getNodeProperties().unsetPosition();
3.302 + } else {
3.303 + long l = 0;
3.304 + try {
3.305 + l = Long.parseLong(position);
3.306 + } catch (NumberFormatException e) {
3.307 + // do nothing
3.308 + }
3.309 + if (l < 0) {
3.310 + // change to positive number instead
3.311 + l *= -1;
3.312 + }
3.313 + position = Long.toString(l);
3.314 + mCustomEncoding.getNodeProperties().setPosition(l);
3.315 + }
3.316 + String old = mPosition;
3.317 + mPosition = position;
3.318 + commitToAppInfo();
3.319 + firePropertyChange("position", old, mPosition); //NOI18N
3.320 + }
3.321 +
3.322 + public String getNOfNminN() {
3.323 + return mNOfNminN;
3.324 + }
3.325 +
3.326 + public void setNOfNminN(String nOfNminN) {
3.327 + if (nOfNminN == null || nOfNminN.length() == 0) {
3.328 + if (mCustomEncoding.getNodeProperties().isSetNOfN()) {
3.329 + mCustomEncoding.getNodeProperties().getNOfN().unsetMinN();
3.330 + }
3.331 + } else {
3.332 + int l = 0;
3.333 + try {
3.334 + l = Integer.parseInt(nOfNminN);
3.335 + } catch (NumberFormatException e) {
3.336 + // do nothing
3.337 + }
3.338 + if (l < 0) {
3.339 + // change to positive number instead
3.340 + l *= -1;
3.341 + }
3.342 + nOfNminN = Integer.toString(l);
3.343 + if (!mCustomEncoding.getNodeProperties().isSetNOfN()) {
3.344 + mCustomEncoding.getNodeProperties().addNewNOfN();
3.345 + }
3.346 + mCustomEncoding.getNodeProperties().getNOfN().setMinN(l);
3.347 + }
3.348 + String old = mNOfNminN;
3.349 + mNOfNminN = nOfNminN;
3.350 + commitToAppInfo();
3.351 + firePropertyChange("nOfNminN", old, mNOfNminN); //NOI18N
3.352 + }
3.353 +
3.354 + public String getNOfNmaxN() {
3.355 + return mNOfNmaxN;
3.356 + }
3.357 +
3.358 + public void setNOfNmaxN(String nOfNmaxN) {
3.359 + if (nOfNmaxN == null || nOfNmaxN.length() == 0) {
3.360 + if (mCustomEncoding.getNodeProperties().isSetNOfN()) {
3.361 + mCustomEncoding.getNodeProperties().getNOfN().unsetMaxN();
3.362 + }
3.363 + } else {
3.364 + int l = 1;
3.365 + try {
3.366 + l = Integer.parseInt(nOfNmaxN);
3.367 + } catch (NumberFormatException e) {
3.368 + // do nothing
3.369 + }
3.370 + if (l < 0) {
3.371 + // change to positive number instead
3.372 + l *= -1;
3.373 + }
3.374 + nOfNmaxN = Integer.toString(l);
3.375 + if (!mCustomEncoding.getNodeProperties().isSetNOfN()) {
3.376 + mCustomEncoding.getNodeProperties().addNewNOfN();
3.377 + }
3.378 + mCustomEncoding.getNodeProperties().getNOfN().setMaxN(l);
3.379 + }
3.380 + String old = mNOfNmaxN;
3.381 + mNOfNmaxN = nOfNmaxN;
3.382 + commitToAppInfo();
3.383 + firePropertyChange("nOfNmaxN", old, mNOfNmaxN); //NOI18N
3.384 + }
3.385 +
3.386 + public String getMinOcc() {
3.387 + return mMinOcc;
3.388 + }
3.389 +
3.390 + public void setMinOcc(String minOcc) {
3.391 + if (minOcc == null || minOcc.length() == 0) {
3.392 + mCustomEncoding.getNodeProperties().unsetMinOcc();
3.393 + } else {
3.394 + long l = 0;
3.395 + try {
3.396 + l = Long.parseLong(minOcc);
3.397 + } catch (NumberFormatException e) {
3.398 + // do nothing
3.399 + }
3.400 + if (l < 0) {
3.401 + // change to positive number instead
3.402 + l *= -1;
3.403 + }
3.404 + minOcc = Long.toString(l);
3.405 + mCustomEncoding.getNodeProperties().setMinOcc(l);
3.406 + }
3.407 + String old = mMinOcc;
3.408 + mMinOcc = minOcc;
3.409 + commitToAppInfo();
3.410 + firePropertyChange("minOcc", old, mMinOcc); //NOI18N
3.411 + }
3.412 +
3.413 + public String getMaxOcc() {
3.414 + return mMaxOcc;
3.415 + }
3.416 +
3.417 + public void setMaxOcc(String maxOcc) {
3.418 + if (maxOcc == null || maxOcc.length() == 0
3.419 + || _bundle.getString("encoding_node.value.unbounded").equalsIgnoreCase(maxOcc)) { //NOI18N
3.420 + mCustomEncoding.getNodeProperties().unsetMaxOcc();
3.421 + } else {
3.422 + long l = 0;
3.423 + try {
3.424 + l = Long.parseLong(maxOcc);
3.425 + } catch (NumberFormatException e) {
3.426 + // do nothing
3.427 + }
3.428 + if (l < 0) {
3.429 + // change to positive number instead
3.430 + l *= -1;
3.431 + }
3.432 + maxOcc = Long.toString(l);
3.433 + mCustomEncoding.getNodeProperties().setMaxOcc(l);
3.434 + }
3.435 + String old = mMaxOcc;
3.436 + mMaxOcc = maxOcc;
3.437 + commitToAppInfo();
3.438 + firePropertyChange("maxOcc", old, mMaxOcc); //NOI18N
3.439 + }
3.440 +
3.441 + public String getScvngrChars() {
3.442 + return mScvngrChars;
3.443 + }
3.444 +
3.445 + public void setScvngrChars(String scvngrChars) {
3.446 + String old = mScvngrChars;
3.447 + mScvngrChars = scvngrChars;
3.448 + if (mScvngrChars == null || mScvngrChars.length() == 0) {
3.449 + mCustomEncoding.getNodeProperties().unsetScvngr();
3.450 + } else {
3.451 + if (!mCustomEncoding.getNodeProperties().isSetScvngr()) {
3.452 + mCustomEncoding.getNodeProperties().addNewScvngr();
3.453 + }
3.454 + mCustomEncoding.getNodeProperties().getScvngr().setChars(scvngrChars);
3.455 + }
3.456 + commitToAppInfo();
3.457 + firePropertyChange("scvngrChars", old, mScvngrChars); //NOI18N
3.458 + }
3.459 +
3.460 + public boolean isScvngrEmit1st() {
3.461 + return mScvngrEmit1st;
3.462 + }
3.463 +
3.464 + public void setScvngrEmit1st(boolean scvngrEmit1st) {
3.465 + if (!mCustomEncoding.getNodeProperties().isSetScvngr()
3.466 + || mCustomEncoding.getNodeProperties().getScvngr().getChars() == null
3.467 + || mCustomEncoding.getNodeProperties().getScvngr().getChars().length() == 0) {
3.468 + // do nothing so that as if user can not
3.469 + // check the "Output First Scavenger Character" because the
3.470 + // "Scavenger Characters" field is not set to any value yet.
3.471 + mScvngrEmit1st = false;
3.472 + return;
3.473 + }
3.474 + boolean old = mScvngrEmit1st;
3.475 + mScvngrEmit1st = scvngrEmit1st;
3.476 + mCustomEncoding.getNodeProperties().getScvngr().setEmit1St(mScvngrEmit1st);
3.477 + commitToAppInfo();
3.478 + firePropertyChange("scvngrEmit1st", old, mScvngrEmit1st); //NOI18N
3.479 + }
3.480 +
3.481 public String getBeginDelimiter() {
3.482 return mBeginDelimiter;
3.483 }
3.484 @@ -322,7 +602,7 @@
3.485 firePropertyChange("beginDelimiter", old, mBeginDelimiter); //NOI18N
3.486 }
3.487
3.488 - public boolean getBeginDelimiterDetached() {
3.489 + public boolean isBeginDelimiterDetached() {
3.490 return mBeginDelimiterDetached;
3.491 }
3.492
3.493 @@ -330,7 +610,8 @@
3.494 if (!mCustomEncoding.getNodeProperties().isSetDelimOfFixed()) {
3.495 // do nothing so that as if user can not
3.496 // check the "Begin Delimiter Detached" because the
3.497 - // "Begin Delimiter" field is not set any value yet.
3.498 + // "Begin Delimiter" field is not set to any value yet.
3.499 + mBeginDelimiterDetached = false;
3.500 return;
3.501 }
3.502 boolean old = mBeginDelimiterDetached;
3.503 @@ -394,6 +675,88 @@
3.504 firePropertyChange("fineInherit", old, Boolean.valueOf(mFineInherit)); //NOI18N
3.505 }
3.506
3.507 + public String getFixedLengthType() {
3.508 + return mFixedLengthType;
3.509 + }
3.510 +
3.511 + public void setFixedLengthType(String fixedLengthType) {
3.512 + String old = mFixedLengthType;
3.513 + mFixedLengthType = fixedLengthType;
3.514 + String type = mReverseTextMap.get(FIXED_LENGTH_TYPE_PREFIX + UDS + mFixedLengthType);
3.515 + String regexAlignment = mTextMap.get(ALIGNMENT_PREFIX + UDS + NodeProperties.Alignment.REGEX);
3.516 + String dummyMatch = _bundle.getString("encoding_node.value.default_match"); //NOI18N
3.517 + if ("regular".equals(type)) { //NOI18N
3.518 + // regular fixed length: only length and offset fields make sense
3.519 + if (mCustomEncoding.getNodeProperties().isSetPosition()) {
3.520 + mCustomEncoding.getNodeProperties().unsetPosition();
3.521 + }
3.522 + if (regexAlignment.equals(getAlignment()) && dummyMatch.equals(getMatch())) {
3.523 + setAlignment(mTextMap.get(ALIGNMENT_PREFIX + UDS + NodeProperties.Alignment.BLIND));
3.524 + setMatch(EMP);
3.525 + }
3.526 + } else if ("reversed".equals(type)) { //NOI18N
3.527 + // this means the length is deducted from the end of data
3.528 + // Only length field makes sense
3.529 + if (mCustomEncoding.getNodeProperties().isSetPosition()) {
3.530 + mCustomEncoding.getNodeProperties().unsetPosition();
3.531 + }
3.532 + if (mCustomEncoding.getNodeProperties().isSetOffset()) {
3.533 + mCustomEncoding.getNodeProperties().unsetOffset();
3.534 + }
3.535 + if (regexAlignment.equals(getAlignment()) && dummyMatch.equals(getMatch())) {
3.536 + setAlignment(mTextMap.get(ALIGNMENT_PREFIX + UDS + NodeProperties.Alignment.BLIND));
3.537 + setMatch(EMP);
3.538 + }
3.539 + } else if ("undetermined".equals(type)) { //NOI18N
3.540 + // this means this fixed length field is determined by a regular
3.541 + // expression match at runtime
3.542 + mLength = 0;
3.543 + mCustomEncoding.getNodeProperties().setLength(mLength);
3.544 + if (mCustomEncoding.getNodeProperties().isSetPosition()) {
3.545 + mCustomEncoding.getNodeProperties().unsetPosition();
3.546 + }
3.547 + if (mCustomEncoding.getNodeProperties().isSetOffset()) {
3.548 + mCustomEncoding.getNodeProperties().unsetOffset();
3.549 + }
3.550 + if (!regexAlignment.equals(getAlignment())) {
3.551 + setAlignment(regexAlignment);
3.552 + if (getMatch() == null || getMatch().length() == 0) {
3.553 + setMatch(dummyMatch);
3.554 + }
3.555 + }
3.556 + } else {
3.557 + if (regexAlignment.equals(getAlignment()) && dummyMatch.equals(getMatch())) {
3.558 + setAlignment(mTextMap.get(ALIGNMENT_PREFIX + UDS + NodeProperties.Alignment.BLIND));
3.559 + setMatch(EMP);
3.560 + }
3.561 + }
3.562 + firePropertyChange("fixedLengthType", old, mFixedLengthType); //NOI18N
3.563 + commitToAppInfo();
3.564 + }
3.565 +
3.566 + public String getUndefDataPolicy() {
3.567 + return mUndefDataPolicy;
3.568 + }
3.569 +
3.570 + public void setUndefDataPolicy(String undefDataPolicy) {
3.571 + if (undefDataPolicy == null || undefDataPolicy.length() == 0) {
3.572 + // do nothing
3.573 + return;
3.574 + }
3.575 + String old = undefDataPolicy;
3.576 + mUndefDataPolicy = undefDataPolicy;
3.577 + String policy = mReverseTextMap.get(UNDEFINED_DATA_POLICY_PREFIX + UDS + mUndefDataPolicy);
3.578 + if ("prohibit".equals(policy)) {
3.579 + mCustomEncoding.getNodeProperties().unsetUndefDataPolicy();
3.580 + } else {
3.581 + NodeProperties.UndefDataPolicy.Enum enumUndefDataPolicy =
3.582 + NodeProperties.UndefDataPolicy.Enum.forString(policy);
3.583 + mCustomEncoding.getNodeProperties().setUndefDataPolicy(enumUndefDataPolicy);
3.584 + }
3.585 + firePropertyChange("undefDataPolicy", old, mUndefDataPolicy); //NOI18N
3.586 + commitToAppInfo();
3.587 + }
3.588 +
3.589 public String getNodeType() {
3.590 return mNodeType;
3.591 }
3.592 @@ -403,7 +766,7 @@
3.593 mNodeType = nodeType;
3.594 NodeProperties.NodeType.Enum enumNodeType =
3.595 NodeProperties.NodeType.Enum.forString(
3.596 - mReverseTextMap.get(NODE_TYPE_PREFIX + "_" + mNodeType)); //NOI18N
3.597 + mReverseTextMap.get(NODE_TYPE_PREFIX + UDS + mNodeType));
3.598 mCustomEncoding.getNodeProperties().setNodeType(enumNodeType);
3.599 if (!NodeProperties.NodeType.FIXED_LENGTH.equals(enumNodeType)) {
3.600 if (mCustomEncoding.getNodeProperties().isSetLength()) {
3.601 @@ -412,11 +775,11 @@
3.602 }
3.603 if (!mTop) {
3.604 if (mCustomEncoding.getNodeProperties().isSetParsingCharset()) {
3.605 - mParsingCharset = "";
3.606 + mParsingCharset = EMP;
3.607 mCustomEncoding.getNodeProperties().unsetParsingCharset();
3.608 }
3.609 if (mCustomEncoding.getNodeProperties().isSetSerializingCharset()) {
3.610 - mSerializingCharset = "";
3.611 + mSerializingCharset = EMP;
3.612 mCustomEncoding.getNodeProperties().unsetSerializingCharset();
3.613 }
3.614 }
3.615 @@ -425,11 +788,11 @@
3.616 || NodeProperties.NodeType.TRANSIENT.equals(enumNodeType)
3.617 || !testIsSimple()) {
3.618 if (mCustomEncoding.getNodeProperties().isSetAlignment()) {
3.619 - mAlignment = mTextMap.get(ALIGNMENT_PREFIX + "_" + NodeProperties.Alignment.BLIND); //NOI18N
3.620 + mAlignment = mTextMap.get(ALIGNMENT_PREFIX + UDS + NodeProperties.Alignment.BLIND);
3.621 mCustomEncoding.getNodeProperties().unsetAlignment();
3.622 }
3.623 if (mCustomEncoding.getNodeProperties().isSetMatch()) {
3.624 - mMatch = "";
3.625 + mMatch = EMP;
3.626 mCustomEncoding.getNodeProperties().unsetMatch();
3.627 }
3.628 }
3.629 @@ -468,7 +831,7 @@
3.630 mOrder = order;
3.631 NodeProperties.Order.Enum enumOrder =
3.632 NodeProperties.Order.Enum.forString(
3.633 - mReverseTextMap.get(ORDER_PREFIX + "_" + mOrder)); //NOI18N
3.634 + mReverseTextMap.get(ORDER_PREFIX + UDS + mOrder));
3.635 firePropertyChange("order", old, mOrder); //NOI18N
3.636 mCustomEncoding.getNodeProperties().setOrder(enumOrder);
3.637 commitToAppInfo();
3.638 @@ -538,21 +901,21 @@
3.639 mCustomEncoding.setTop(mTop);
3.640 if (!mTop) {
3.641 if (mCustomEncoding.getNodeProperties().isSetInputCharset()) {
3.642 - mInputCharset = "";
3.643 + mInputCharset = EMP;
3.644 mCustomEncoding.getNodeProperties().unsetInputCharset();
3.645 }
3.646 if (mCustomEncoding.getNodeProperties().isSetOutputCharset()) {
3.647 - mOutputCharset = "";
3.648 + mOutputCharset = EMP;
3.649 mCustomEncoding.getNodeProperties().unsetOutputCharset();
3.650 }
3.651 if (!NodeProperties.NodeType.FIXED_LENGTH.equals(
3.652 mCustomEncoding.getNodeProperties().getNodeType())) {
3.653 if (mCustomEncoding.getNodeProperties().isSetParsingCharset()) {
3.654 - mParsingCharset = "";
3.655 + mParsingCharset = EMP;
3.656 mCustomEncoding.getNodeProperties().unsetParsingCharset();
3.657 }
3.658 if (mCustomEncoding.getNodeProperties().isSetSerializingCharset()) {
3.659 - mSerializingCharset = "";
3.660 + mSerializingCharset = EMP;
3.661 mCustomEncoding.getNodeProperties().unsetSerializingCharset();
3.662 }
3.663 }
3.664 @@ -561,8 +924,11 @@
3.665 firePropertyChange("top", old, Boolean.valueOf(mTop)); //NOI18N
3.666 }
3.667
3.668 + /**
3.669 + * Test if current "encoding" node belongs to an XSD global element.
3.670 + * @return true if current "encoding" node belongs to an XSD global element.
3.671 + */
3.672 public boolean testIsGlobal() {
3.673 - int count = 0;
3.674 for (int i = 0; i < mComponentPath.length; i++) {
3.675 if (mComponentPath[i] instanceof ElementReference) {
3.676 return false;
3.677 @@ -571,6 +937,10 @@
3.678 return annotation().getParent() instanceof GlobalElement;
3.679 }
3.680
3.681 + /**
3.682 + * Test if current "encoding" node belongs to a leaf node.
3.683 + * @return true if current "encoding" node belongs to a leaf node.
3.684 + */
3.685 public boolean testIsSimple() {
3.686 if (!(annotation().getParent() instanceof Element)) {
3.687 return false;
3.688 @@ -578,6 +948,10 @@
3.689 return SchemaUtility.isSimpleContent((Element) annotation().getParent());
3.690 }
3.691
3.692 + /**
3.693 + * Test if current "encoding" node belongs to a choice node.
3.694 + * @return true if current "encoding" node belongs to a choice node.
3.695 + */
3.696 public boolean testIsChoice() {
3.697 if (!(annotation().getParent() instanceof Element)) {
3.698 return false;
3.699 @@ -589,6 +963,27 @@
3.700 return mCustomEncoding.getNodeProperties().getNodeType();
3.701 }
3.702
3.703 + public boolean isReversedFixedLengthType() {
3.704 + if (mTextMap.get(FIXED_LENGTH_TYPE_PREFIX + UDS + "reversed").equals(getFixedLengthType())) { //NOI18N)
3.705 + return true;
3.706 + }
3.707 + return false;
3.708 + }
3.709 +
3.710 + public boolean isEncodedFixedLengthType() {
3.711 + if (mTextMap.get(FIXED_LENGTH_TYPE_PREFIX + UDS + "encoded").equals(getFixedLengthType())) { //NOI18N)
3.712 + return true;
3.713 + }
3.714 + return false;
3.715 + }
3.716 +
3.717 + public boolean isUndeterminedFixedLengthType() {
3.718 + if (mTextMap.get(FIXED_LENGTH_TYPE_PREFIX + UDS + "undetermined").equals(getFixedLengthType())) { //NOI18N)
3.719 + return true;
3.720 + }
3.721 + return false;
3.722 + }
3.723 +
3.724 public void addPropertyChangeListener(PropertyChangeListener listener) {
3.725 propChangeListeners.add(listener);
3.726 }
3.727 @@ -660,7 +1055,7 @@
3.728 Delimiter[] delimiters;
3.729 // get all delimiters at this delimiter level
3.730 delimiters = delimLevel.getDelimiterArray();
3.731 - delim = ""; //NOI18N
3.732 + delim = EMP;
3.733 for (int i = 0; i < delimiters.length; i++) {
3.734 if (!delimiters[i].isSetBytes() || !delimiters[i].getBytes().isSetConstant()) {
3.735 // skip non-constant delimiter(s)
3.736 @@ -719,7 +1114,7 @@
3.737 try {
3.738 customEncoding = fetchCustomEncoding(anno, null);
3.739 } catch (InvalidAppInfoException ex) {
3.740 - return _bundle.getString("encoding_opt.lbl.error_retrieving_delim");
3.741 + return _bundle.getString("encoding_opt.lbl.error_retrieving_delim"); //NOI18N
3.742 }
3.743 if (customEncoding == null || !customEncoding.isSetNodeProperties()) {
3.744 level++;
3.745 @@ -740,7 +1135,7 @@
3.746 }
3.747 delimLevel = customEncoding.getNodeProperties().getDelimiterSet().getLevelArray(level);
3.748 delimiters = delimLevel.getDelimiterArray();
3.749 - delim = ""; //NOI18N
3.750 + delim = EMP;
3.751 for (int j = 0; j < delimiters.length; j++) {
3.752 if (!delimiters[j].isSetBytes()) {
3.753 continue;
3.754 @@ -751,7 +1146,7 @@
3.755 }
3.756 delim += (
3.757 "{" //NOI18N
3.758 - + _bundle.getString("encoding_opt.lbl.embedded")
3.759 + + _bundle.getString("encoding_opt.lbl.embedded") //NOI18N
3.760 + delimiters[j].getBytes().getEmbedded().getOffset()
3.761 + "," //NOI18N
3.762 + delimiters[j].getBytes().getEmbedded().getLength()
3.763 @@ -772,6 +1167,7 @@
3.764 }
3.765
3.766 private Annotation annotation() {
3.767 + // annotation is stored as last element
3.768 return (Annotation) mComponentPath[mComponentPath.length - 1];
3.769 }
3.770
3.771 @@ -792,7 +1188,7 @@
3.772 SchemaComponent comp = mComponentPath[mComponentPath.length - 1];
3.773 if (!(comp instanceof Annotation)) {
3.774 throw new IllegalArgumentException(
3.775 - _bundle.getString("encoding_opt.exp.must_be_annotation"));
3.776 + _bundle.getString("encoding_opt.exp.must_be_annotation")); //NOI18N
3.777 }
3.778 AppInfo[] appinfoReturned = new AppInfo[1];
3.779 CustomEncoding customEncoding =
3.780 @@ -815,16 +1211,39 @@
3.781 } else {
3.782 mAppInfo = appinfoReturned[0];
3.783 }
3.784 - mNodeType = mTextMap.get(NODE_TYPE_PREFIX + "_" //NOI18N
3.785 + mNodeType = mTextMap.get(NODE_TYPE_PREFIX + UDS
3.786 + customEncoding.getNodeProperties().getNodeType().toString());
3.787 if (customEncoding.getNodeProperties().isSetAlignment()) {
3.788 - mAlignment = mTextMap.get(ALIGNMENT_PREFIX + "_" //NOI18N
3.789 + mAlignment = mTextMap.get(ALIGNMENT_PREFIX + UDS
3.790 + customEncoding.getNodeProperties().getAlignment().toString());
3.791 }
3.792 if (customEncoding.getNodeProperties().isSetOrder()) {
3.793 - mOrder = mTextMap.get(ORDER_PREFIX + "_" //NOI18N
3.794 + mOrder = mTextMap.get(ORDER_PREFIX + UDS
3.795 + customEncoding.getNodeProperties().getOrder().toString());
3.796 }
3.797 + if (customEncoding.getNodeProperties().isSetNOfN()) {
3.798 + NOfN nOfN = customEncoding.getNodeProperties().getNOfN();
3.799 + if (nOfN.isSetMinN()) {
3.800 + mNOfNminN = Integer.toString(nOfN.getMinN());
3.801 + }
3.802 + if (nOfN.isSetMaxN()) {
3.803 + mNOfNmaxN = Integer.toString(nOfN.getMaxN());
3.804 + }
3.805 + }
3.806 + if (customEncoding.getNodeProperties().isSetMinOcc()) {
3.807 + mMinOcc = Long.toString(customEncoding.getNodeProperties().getMinOcc());
3.808 + }
3.809 + if (customEncoding.getNodeProperties().isSetMaxOcc()) {
3.810 + mMaxOcc = Long.toString(customEncoding.getNodeProperties().getMaxOcc());
3.811 + }
3.812 + if (customEncoding.getNodeProperties().isSetScvngr()) {
3.813 + Scvngr scvngr = customEncoding.getNodeProperties().getScvngr();
3.814 + mScvngrChars = scvngr.getChars();
3.815 + if (scvngr.isSetEmit1St()) {
3.816 + mScvngrEmit1st = scvngr.getEmit1St();
3.817 + }
3.818 + }
3.819 +
3.820 if (customEncoding.isSetTop()) {
3.821 mTop = customEncoding.getTop();
3.822 }
3.823 @@ -857,6 +1276,24 @@
3.824 if (customEncoding.getNodeProperties().isSetLength()) {
3.825 mLength = customEncoding.getNodeProperties().getLength();
3.826 }
3.827 + if (customEncoding.getNodeProperties().isSetOffset()) {
3.828 + mOffset = Long.toString(customEncoding.getNodeProperties().getOffset());
3.829 + }
3.830 + if (customEncoding.getNodeProperties().isSetPosition()) {
3.831 + mPosition = Long.toString(customEncoding.getNodeProperties().getPosition());
3.832 + }
3.833 + if (customEncoding.getNodeProperties().isSetLength()) {
3.834 + mLength = customEncoding.getNodeProperties().getLength();
3.835 + }
3.836 + if (customEncoding.getNodeProperties().isSetLength() && mLength == 0) {
3.837 + mFixedLengthType = mTextMap.get(FIXED_LENGTH_TYPE_PREFIX + UDS + "undetermined"); //NOI18N
3.838 + } else if (customEncoding.getNodeProperties().isSetPosition()) { // && mPosition >= 0
3.839 + mFixedLengthType = mTextMap.get(FIXED_LENGTH_TYPE_PREFIX + UDS + "encoded"); //NOI18N
3.840 + } else if (customEncoding.getNodeProperties().isSetLength() && mLength < 0) {
3.841 + mFixedLengthType = mTextMap.get(FIXED_LENGTH_TYPE_PREFIX + UDS + "reversed"); //NOI18N
3.842 + mLength = mLength * (-1);
3.843 + }
3.844 +
3.845 if (customEncoding.getNodeProperties().isSetDelimOfFixed()) {
3.846 DelimOfFixed delimOfFixed = customEncoding.getNodeProperties().getDelimOfFixed();
3.847 mBeginDelimiter = delimOfFixed.getBeginBytes();
3.848 @@ -876,6 +1313,11 @@
3.849 if (customEncoding.getNodeProperties().isSetFineInherit()) {
3.850 mFineInherit = customEncoding.getNodeProperties().getFineInherit();
3.851 }
3.852 + //Populates the UndefDataPolicy field
3.853 + if (customEncoding.getNodeProperties().isSetUndefDataPolicy()) {
3.854 + mUndefDataPolicy = mTextMap.get(UNDEFINED_DATA_POLICY_PREFIX + UDS
3.855 + + customEncoding.getNodeProperties().getUndefDataPolicy().toString());
3.856 + }
3.857
3.858 // I guess that following lines will cause recursive loop when
3.859 // the AppInfo is removed from the text editing pane.
3.860 @@ -885,7 +1327,7 @@
3.861
3.862 if (!(((Annotation) comp).getParent() instanceof Element)) {
3.863 throw new IllegalArgumentException(
3.864 - _bundle.getString("encoding_opt.exp.anno_must_under_elem"));
3.865 + _bundle.getString("encoding_opt.exp.anno_must_under_elem")); //NOI18N
3.866 }
3.867 if (hookUpListener) {
3.868 Element elem = (Element) ((Annotation) comp).getParent();
3.869 @@ -1045,7 +1487,7 @@
3.870 cursor = xmlObject.newCursor();
3.871 StringBuffer buff = new StringBuffer();
3.872 if (!cursor.toFirstChild()) {
3.873 - return ""; //NOI18N
3.874 + return EMP;
3.875 }
3.876 buff.append(cursor.xmlText());
3.877 while (cursor.toNextSibling()) {
4.1 --- a/encoder.custom.aip/src/org/netbeans/modules/encoder/custom/aip/IntegerInplaceEditor.java Thu Jul 31 10:44:09 2008 +0530
4.2 +++ b/encoder.custom.aip/src/org/netbeans/modules/encoder/custom/aip/IntegerInplaceEditor.java Thu Jul 31 14:14:17 2008 -0700
4.3 @@ -48,6 +48,7 @@
4.4 mMaxInclusive = new BigInteger(new Integer(maxInclusive).toString());
4.5 }
4.6
4.7 + @Override
4.8 public Object getValue() {
4.9 int value;
4.10 try {
5.1 --- a/encoder.ui.basic/src/org/netbeans/modules/encoder/ui/basic/SchemaUtility.java Thu Jul 31 10:44:09 2008 +0530
5.2 +++ b/encoder.ui.basic/src/org/netbeans/modules/encoder/ui/basic/SchemaUtility.java Thu Jul 31 14:14:17 2008 -0700
5.3 @@ -64,6 +64,7 @@
5.4
5.5 private static final ResourceBundle _bundle =
5.6 ResourceBundle.getBundle("org/netbeans/modules/encoder/ui/basic/Bundle"); //NOI18N
5.7 +
5.8 /**
5.9 * Tests if the element is of simple type or a complex type with
5.10 * simple content.
5.11 @@ -177,6 +178,11 @@
5.12 return null;
5.13 }
5.14
5.15 + /**
5.16 + * Checks if the given element is of Any type.
5.17 + * @param elem an Element instance.
5.18 + * @return true if the given element is of Any type, or false otherwise.
5.19 + */
5.20 public static boolean isOfAnyType(Element elem) {
5.21 if (!(elem instanceof TypeContainer)) {
5.22 return false;