001: package com.salmonllc.xml;
002:
003: /////////////////////////
004: //$Archive: /SOFIA/SourceCode/com/salmonllc/xml/Options.java $
005: //$Author: Dan $
006: //$Revision: 10 $
007: //$Modtime: 6/11/03 4:53p $
008: /////////////////////////
009: import java.util.*;
010:
011: /**
012: * This data structure is used to store Option details which can be a part of a Dropdown, readioButtonGroup etc.
013: * This is used as a corresponding java object for the options.dtd XML schema.
014: * Creation date: (7/26/01 1:59:20 PM)
015: * @author: Administrator
016: */
017: public class Options extends java.util.Hashtable {
018: private String fieldType = "";
019: private String fieldComponent = "";
020: private String fieldTable = "";
021: private String fieldInitColumn = "";
022: private String fieldDescColumn = "";
023: private boolean fieldMandatory = false;
024:
025: /**
026: * Values constructor comment.
027: */
028: public Options() {
029: super ();
030: }
031:
032: /**
033: * Gets the component to be used by options.
034: * Creation date: (7/26/01 5:23:19 PM)
035: * @return java.lang.String
036: */
037: public java.lang.String getComponent() {
038: return fieldComponent;
039: }
040:
041: /**
042: * Gets the Table Desctiptor columne name
043: * Creation date: (7/26/01 5:29:55 PM)
044: * @return java.lang.String
045: */
046: public java.lang.String getDescColumn() {
047: return fieldDescColumn;
048: }
049:
050: /**
051: * Gets the column name from the XML file which defines the init for this option
052: * Creation date: (7/26/01 5:28:57 PM)
053: * @return java.lang.String
054: */
055: public java.lang.String getInitColumn() {
056: return fieldInitColumn;
057: }
058:
059: /**
060: * Gets the Keys mentioned in XML file.
061: * Creation date: (7/26/01 2:43:22 PM)
062: * @return int[]
063: */
064: public int[] getIntKeys() throws Exception {
065:
066: Enumeration eKeys = keys();
067: int[] iKeys = new int[size()];
068: int count = 0;
069: while (eKeys.hasMoreElements()) {
070: Object objKey = eKeys.nextElement();
071: if (objKey instanceof String) {
072: iKeys[count] = (new Integer((String) objKey))
073: .intValue();
074: count++;
075: }
076: }
077: return iKeys;
078: }
079:
080: /**
081: * Get the keys in form of strings for all options.
082: * Creation date: (7/26/01 2:43:22 PM)
083: * @return int[]
084: */
085: public String[] getStringKeys() {
086:
087: Enumeration eKeys = keys();
088: String[] sKeys = new String[size()];
089: int count = 0;
090: while (eKeys.hasMoreElements()) {
091: Object objKey = eKeys.nextElement();
092: if (objKey instanceof String) {
093: sKeys[count] = (String) objKey;
094: count++;
095: }
096: }
097: return sKeys;
098: }
099:
100: /**
101: * Gets all the String objects present in form of options
102: * Creation date: (7/26/01 2:43:22 PM)
103: * @return int[]
104: */
105: public String[] getStringObjects() {
106:
107: Enumeration eKeys = keys();
108: String[] sObjects = new String[size()];
109: int count = 0;
110: while (eKeys.hasMoreElements()) {
111: Object objKey = eKeys.nextElement();
112: if (objKey instanceof String) {
113: sObjects[count] = (String) get(objKey);
114: count++;
115: }
116: }
117: return sObjects;
118:
119: }
120:
121: /**
122: * Get the table name used for extracting options
123: * Creation date: (7/26/01 5:28:57 PM)
124: * @return java.lang.String
125: */
126: public java.lang.String getTable() {
127: return fieldTable;
128: }
129:
130: /**
131: * Get the type used by the Options
132: * Creation date: (7/26/01 2:54:31 PM)
133: * @return java.lang.String
134: */
135: public java.lang.String getType() {
136: return fieldType;
137: }
138:
139: /**
140: * Get the flag if the option selection is mandatory. if false this introduces a bank option at top
141: * Creation date: (8/10/01 1:55:28 PM)
142: * @return boolean
143: */
144: public boolean isMandatory() {
145: return fieldMandatory;
146: }
147:
148: /**
149: * Sethe the componentused by the option
150: * Creation date: (7/26/01 5:23:19 PM)
151: * @param newComponent java.lang.String
152: */
153: public void setComponent(java.lang.String newComponent) {
154: fieldComponent = newComponent;
155: }
156:
157: /**
158: * Sets the description column used by options if options are retrived from the table
159: * Creation date: (7/26/01 5:29:55 PM)
160: * @param newDescColumn java.lang.String
161: */
162: public void setDescColumn(java.lang.String newDescColumn) {
163: fieldDescColumn = newDescColumn;
164: }
165:
166: /**
167: * Sets the init column used by options if options are retrived from the table
168: * Creation date: (7/26/01 5:28:57 PM)
169: * @param newInitColumn java.lang.String
170: */
171: public void setInitColumn(java.lang.String newInitColumn) {
172: fieldInitColumn = newInitColumn;
173: }
174:
175: /**
176: * Sets the mandatory flag for options
177: * Creation date: (8/10/01 1:55:28 PM)
178: * @param newMandatory boolean
179: */
180: public void setMandatory(boolean newMandatory) {
181: fieldMandatory = newMandatory;
182: }
183:
184: /**
185: * Sets the table name for the options
186: * Creation date: (7/26/01 5:28:57 PM)
187: * @param newTable java.lang.String
188: */
189: public void setTable(java.lang.String newTable) {
190: fieldTable = newTable;
191: }
192:
193: /**
194: * Sets the type of options
195: * Creation date: (7/26/01 2:54:31 PM)
196: * @param newType java.lang.String
197: */
198: public void setType(java.lang.String newType) {
199: fieldType = newType;
200: }
201: }
|