0001: /*
0002: * JFolder, Copyright 2001-2006 Gary Steinmetz
0003: *
0004: * Distributable under LGPL license.
0005: * See terms of license at gnu.org.
0006: */
0007:
0008: package org.jfolder.common.web.template;
0009:
0010: //base classes
0011: import java.io.IOException;
0012: import java.util.ArrayList;
0013: import java.util.HashMap;
0014:
0015: //project specific classes
0016: import org.jfolder.common.StandardDataTypes;
0017: import org.jfolder.common.UnexpectedSystemException;
0018: import org.jfolder.common.utils.misc.CommonSeparators;
0019: import org.jfolder.common.utils.misc.MiscHelper;
0020: import org.jfolder.common.utils.xml.XMLHelper;
0021: import org.jfolder.common.web.template.ConsoleTemplateContext;
0022: import org.jfolder.common.web.template.SubmitActionContext;
0023:
0024: //other classes
0025:
0026: public class CreationParameterContext implements
0027: ConsoleParameterContext {
0028:
0029: private final static String BUTTON__CREATE = "BUTTON__CREATE";
0030: private final static String BUTTON__CANCEL = "BUTTON__CANCEL";
0031:
0032: //protected final static String CONSOLE_CREATION_PARAMETER_IN_USE =
0033: // "CONSOLE_CREATION_PARAMETER_IN_USE";
0034: protected final static String CONSOLE_CREATION_PARAMETER_TYPE_PREFIX = "CONSOLE_CREATION_PARAMETER_TYPE_";
0035: //protected final static int MAXIMUM_CREATION_PARAMETERS = 10;
0036: protected final static String CONSOLE_CREATION_PARAMETER_COUNT = "CONSOLE_CREATION_PARAMETER_COUNT";
0037: protected final static String CONSOLE_CREATION_REPLACE_PARAMETERS = "CONSOLE_CREATION_REPLACE_PARAMETERS";
0038:
0039: protected final static String CONSOLE_CREATION_STRUCTURE_PREFIX = "CONSOLE_CREATION_STRUCTURE_";
0040: //
0041: protected final static String CONSOLE_CREATION_SUBMIT_ONE = "CONSOLE_CREATION_SUBMIT_ONE";
0042: protected final static String CONSOLE_CREATION_SUBMIT_TWO = "CONSOLE_CREATION_SUBMIT_TWO";
0043:
0044: //
0045: public final static Integer TYPE_TEXT_BOX = new Integer(1);
0046: public final static Integer TYPE_TEXT_AREA = new Integer(2);
0047: public final static Integer TYPE_INCLUSIVE_SELECT = new Integer(3);
0048: public final static Integer TYPE_EXCLUSIVE_SELECT = new Integer(4);
0049: //
0050: public final static Integer TYPE_HIDDEN_BOX = new Integer(5);
0051: public final static Integer TYPE_FILE_UPLOAD = new Integer(6);
0052: //
0053: public final static Integer TYPE_BUTTON = new Integer(7);
0054:
0055: //
0056: private String topLabel = null;
0057: private String action = null;
0058: private boolean replaceParameters = false;
0059: private boolean showSubmitTwo = false;
0060: //
0061: //private ArrayList parameters = null;
0062: private ConsoleParameterHolder parameterCph = null;
0063:
0064: //
0065: private CreationParameterContext(String inLabel, String inAction,
0066: boolean inReplaceParams, boolean inShowSubmitTwo) {
0067: //
0068: this .topLabel = inLabel;
0069: this .action = inAction;
0070: this .replaceParameters = inReplaceParams;
0071: this .showSubmitTwo = inShowSubmitTwo;
0072: //
0073: //this.parameters = new ArrayList();
0074: this .parameterCph = ConsoleParameterHolder.newInstance();
0075: }
0076:
0077: public final static CreationParameterContext newInstance(
0078: String inTopLabel, SubmitActionContext inSac,
0079: boolean inReplaceParams, boolean inShowSubmitTwo) {
0080: //
0081: return CreationParameterContext.newInstance(inTopLabel, inSac
0082: .submitActionCall(), inReplaceParams, inShowSubmitTwo,
0083: true);
0084: }
0085:
0086: public final static CreationParameterContext newInstance(
0087: String inTopLabel, String inAction,
0088: boolean inReplaceParams, boolean inShowSubmitTwo) {
0089: //
0090: return CreationParameterContext.newInstance(inTopLabel,
0091: inAction, inReplaceParams, inShowSubmitTwo, true);
0092: }
0093:
0094: public final static CreationParameterContext newInstance(
0095: String inTopLabel, SubmitActionContext inSac,
0096: boolean inReplaceParams, boolean inShowSubmitTwo,
0097: boolean inUseQuotes) {
0098: //
0099: return new CreationParameterContext(ConsoleTemplateContext
0100: .singleQuotes(inTopLabel, inUseQuotes), inSac
0101: .submitActionCall(), inReplaceParams, inShowSubmitTwo);
0102: }
0103:
0104: public final static CreationParameterContext newInstance(
0105: String inTopLabel, String inAction,
0106: boolean inReplaceParams, boolean inShowSubmitTwo,
0107: boolean inUseQuotes) {
0108: //
0109: return new CreationParameterContext(ConsoleTemplateContext
0110: .singleQuotes(inTopLabel, inUseQuotes), inAction,
0111: inReplaceParams, inShowSubmitTwo);
0112: }
0113:
0114: //
0115: public int hashCode() {
0116:
0117: int outValue = 0;
0118:
0119: outValue += MiscHelper.hashCodeOrZero(this .topLabel);
0120: outValue += MiscHelper.hashCodeOrZero(this .action);
0121: //this.replaceParameters
0122: //this.showSubmitTwo
0123: outValue += MiscHelper.hashCodeOrZero(this .parameterCph);
0124:
0125: return outValue;
0126: }
0127:
0128: public boolean equals(Object inObj) {
0129:
0130: boolean outValue = true;
0131:
0132: if (inObj instanceof CreationParameterContext) {
0133: CreationParameterContext nextCpc = ((CreationParameterContext) inObj);
0134: outValue &= MiscHelper.equalsOrNull(this .topLabel,
0135: nextCpc.topLabel);
0136: outValue &= MiscHelper.equalsOrNull(this .action,
0137: nextCpc.action);
0138: //
0139: outValue &= (this .replaceParameters == nextCpc.replaceParameters);
0140: outValue &= (this .showSubmitTwo == nextCpc.showSubmitTwo);
0141: //
0142: outValue &= MiscHelper.equalsOrNull(this .parameterCph,
0143: nextCpc.parameterCph);
0144: } else {
0145: outValue &= false;
0146: }
0147:
0148: return outValue;
0149: }
0150:
0151: //
0152: private final static ArrayList getTypes() {
0153:
0154: ArrayList outValue = new ArrayList();
0155:
0156: outValue.add(TYPE_TEXT_BOX);
0157: outValue.add(TYPE_TEXT_AREA);
0158: outValue.add(TYPE_INCLUSIVE_SELECT);
0159: outValue.add(TYPE_EXCLUSIVE_SELECT);
0160: outValue.add(TYPE_HIDDEN_BOX);
0161: outValue.add(TYPE_FILE_UPLOAD);
0162: //
0163: outValue.add(TYPE_BUTTON);
0164:
0165: return outValue;
0166: }
0167:
0168: //
0169: public String createParameterCall() throws IOException {
0170:
0171: StringBuffer outValue = new StringBuffer();
0172:
0173: outValue.append("renderConceptTagCreation(");
0174: ArrayList indexes = ConsoleParameterHolder.getIndexes();
0175: for (int i = 0; i < indexes.size(); i++) {
0176: Integer nextIndex = ((Integer) indexes.get(i));
0177: if (i < this .parameterCph.getIndexCount()) {
0178: //
0179: Object o = this .parameterCph.getInput(nextIndex);
0180: CreationParameterContextInput cpci = ((CreationParameterContextInput) o);
0181: //String s[] = ((String[]));
0182: //
0183:
0184: outValue.append(" " + cpci.getType() + ", "
0185: + cpci.getLabel() + ", " + cpci.getList()
0186: + ", " + cpci.getListLabels() + ", "
0187: + cpci.getValue() + ",");
0188: } else {
0189: outValue.append(" 0, null, null, null, null,");
0190: }
0191: }
0192: outValue.append(" " + this .parameterCph.getIndexCount() + ",");
0193: outValue.append(" " + this .topLabel + ",");
0194: outValue.append(" '"
0195: + XMLHelper.fromStringToJSCData(this .action) + "',");
0196: outValue.append(" '" + this .replaceParameters + "',");
0197: outValue.append(" " + this .showSubmitTwo);
0198: outValue.append(");");
0199:
0200: return outValue.toString();
0201: }
0202:
0203: //
0204: public void addInputAsButton(Integer inIndex, String inLabel,
0205: String inScript) {
0206: //
0207: addGenericInput(inIndex, TYPE_BUTTON, inLabel, inScript, null,
0208: null);
0209: }
0210:
0211: //
0212: public void addInputAsVariable(Integer inIndex, String inLabel,
0213: Class inClass) {
0214: //
0215: String formattedLabel = ConsoleTemplateContext
0216: .singleQuotes(XMLHelper.fromStringToJSCData(inLabel));
0217: String name = "studioVarSphere"
0218: + StandardDataTypes.getDisplayName(inClass);
0219: addUnformattedInput(inIndex, TYPE_EXCLUSIVE_SELECT,
0220: formattedLabel, null, name, name);
0221: }
0222:
0223: //
0224: public void addUnformattedInput(Integer inIndex, Integer inType,
0225: String inLabel, String inValue, String inList,
0226: String inListLabels) {
0227: //
0228: CreationParameterContextInput cpci = new CreationParameterContextInput(
0229: inType.toString(), inLabel, inValue, inList,
0230: inListLabels);
0231: this .parameterCph.addInput(inIndex, cpci);
0232: }
0233:
0234: //
0235: public void addUnformattedInput(Integer inIndex, String inType,
0236: String inLabel, String inValue, String inList,
0237: String inListLabels) {
0238: //
0239: CreationParameterContextInput cpci = new CreationParameterContextInput(
0240: inType, inLabel, inValue, inList, inListLabels);
0241: this .parameterCph.addInput(inIndex, cpci);
0242: }
0243:
0244: //
0245: private void addGenericInput(Integer inIndex, Integer inType,
0246: String inLabel, String inValue, String inList[],
0247: String inListLabels[]) {
0248: //
0249: String nextType = null;
0250: if (inType != null) {
0251: nextType = ConsoleTemplateContext.singleQuotes(inType
0252: .toString());
0253: }
0254: //
0255: if (inLabel != null) {
0256: inLabel = ConsoleTemplateContext.singleQuotes(
0257: //nextLabel);
0258: XMLHelper.fromStringToJSCData(inLabel));
0259: }
0260: //
0261: if (inValue != null) {
0262: inValue = ConsoleTemplateContext.singleQuotes(
0263: //nextText);
0264: XMLHelper.fromStringToJSCData(inValue));
0265: }
0266: //
0267: String nextOpts = null;
0268: String nextOptLabels = null;
0269: if (inList != null && inListLabels != null) {
0270: //
0271: //
0272: //
0273: nextOpts = prepareItems(inList);//"";
0274: //
0275: //
0276: nextOptLabels = prepareItems(inListLabels);//"";
0277: //
0278: //
0279: }
0280: //
0281: //
0282: CreationParameterContextInput cpci = new CreationParameterContextInput(
0283: nextType, inLabel, inValue, nextOpts, nextOptLabels);
0284: //
0285: //
0286: this .parameterCph.addInput(inIndex, cpci);
0287: }
0288:
0289: public final static String prepareItems(String inItems[]) {
0290:
0291: String outValue = "";
0292:
0293: for (int j = 0; j < inItems.length; j++) {
0294: String nextItem = inItems[j];
0295: if (nextItem.indexOf(CommonSeparators.LIST_CPC_SEPARATOR) != -1) {
0296: //
0297: throw new UnexpectedSystemException("List item '"
0298: + nextItem + "' contains reserved character '"
0299: + CommonSeparators.LIST_CPC_SEPARATOR + "'");
0300: }
0301: //
0302: if (j > 0) {
0303: outValue = outValue
0304: + CommonSeparators.LIST_CPC_SEPARATOR;
0305: }
0306: outValue = outValue + nextItem;
0307: }
0308: outValue = ConsoleTemplateContext.singleQuotes(XMLHelper
0309: .fromStringToJSCData(outValue));
0310:
0311: return outValue;
0312: }
0313:
0314: //
0315: public void addInputAsTextBox(Integer inIndex, String inLabel,
0316: String inValue) {
0317: //
0318: addGenericInput(inIndex, TYPE_TEXT_BOX, inLabel, inValue, null,
0319: null);
0320: }
0321:
0322: public void addInputAsTextArea(Integer inIndex, String inLabel,
0323: String inValue) {
0324: //
0325: addGenericInput(inIndex, TYPE_TEXT_AREA, inLabel, inValue,
0326: null, null);
0327: }
0328:
0329: public void addInputAsInclusive(Integer inIndex, String inLabel,
0330: String inList[], String inListLabels[], String inT) {
0331: //
0332: addGenericInput(inIndex, TYPE_INCLUSIVE_SELECT, inLabel, inT,
0333: inList, inListLabels);
0334: }
0335:
0336: public void addInputAsExclusive(Integer inIndex, String inLabel,
0337: String inList[], String inListLabels[]) {
0338: //
0339: addGenericInput(inIndex, TYPE_EXCLUSIVE_SELECT, inLabel, null,
0340: inList, inListLabels);
0341: }
0342:
0343: public void addInputAsHiddenBox(Integer inIndex, String inValue) {
0344: //
0345: addGenericInput(inIndex, TYPE_HIDDEN_BOX, null, inValue, null,
0346: null);
0347: }
0348:
0349: public void addInputAsFileUpload(Integer inIndex, String inLabel) {
0350: //
0351: addGenericInput(inIndex, TYPE_FILE_UPLOAD, inLabel, null, null,
0352: null);
0353: }
0354:
0355: //
0356: public final static String getBaseId() {
0357:
0358: String outValue = null;
0359:
0360: outValue = ConsoleTemplateSession
0361: .getToggleLinkFromArrayList(getBaseIdAsArrayList());
0362:
0363: return outValue;
0364: }
0365:
0366: private final static ArrayList getBaseIdAsArrayList() {
0367:
0368: ArrayList outValue = new ArrayList();
0369:
0370: outValue.add(ConsoleTemplateSession.getMainToggleSectionPart());
0371: outValue.add(ConsoleTemplateSession
0372: .getDontRecordThisBranchPart());
0373: outValue.add(ConsoleTemplateSession
0374: .getCreationOfConceptTagPart());
0375:
0376: return outValue;
0377: }
0378:
0379: private final static String getSubmitOneId() {
0380:
0381: String outValue = null;
0382:
0383: ArrayList id = getBaseIdAsArrayList();
0384: id.add(CONSOLE_CREATION_SUBMIT_ONE);
0385:
0386: outValue = ConsoleTemplateSession
0387: .getToggleLinkFromArrayList(id);
0388:
0389: return outValue;
0390: }
0391:
0392: private final static String getSubmitTwoId() {
0393:
0394: String outValue = null;
0395:
0396: ArrayList id = getBaseIdAsArrayList();
0397: id.add(CONSOLE_CREATION_SUBMIT_TWO);
0398:
0399: outValue = ConsoleTemplateSession
0400: .getToggleLinkFromArrayList(id);
0401:
0402: return outValue;
0403: }
0404:
0405: private final static String getSectionId(int inIndex, Integer inType) {
0406:
0407: String outValue = null;
0408:
0409: outValue = ConsoleTemplateSession
0410: .getToggleLinkFromArrayList(getSectionIdAsArrayList(
0411: inIndex, inType));
0412:
0413: return outValue;
0414: }
0415:
0416: private final static ArrayList getSectionIdAsArrayList(int inIndex,
0417: Integer inType) {
0418:
0419: ArrayList outValue = getBaseIdAsArrayList();
0420:
0421: outValue.add(CONSOLE_CREATION_STRUCTURE_PREFIX + inType + "_"
0422: + inIndex);
0423:
0424: return outValue;
0425: }
0426:
0427: private final static String getHandleAsJavaScript(ArrayList inList,
0428: int inIndex) {
0429:
0430: String outValue = null;
0431:
0432: int baseSize = getBaseIdAsArrayList().size();
0433: inList = ((ArrayList) inList.clone());
0434: inList.set(baseSize, CONSOLE_CREATION_STRUCTURE_PREFIX
0435: + "' + inType" + inIndex + " + '" + "_" + inIndex);
0436:
0437: outValue = ConsoleTemplateSession
0438: .getToggleLinkFromArrayList(inList);
0439:
0440: outValue = "'" + outValue + "'";
0441:
0442: return outValue;
0443: }
0444:
0445: private final static String getTopLabel() {
0446: return ConsoleTemplateSession
0447: .getToggleLinkFromArrayList(getTopLabelAsArrayList());
0448: }
0449:
0450: private final static ArrayList getTopLabelAsArrayList() {
0451: //
0452: ArrayList outValue = getBaseIdAsArrayList();
0453:
0454: outValue.add(ConsoleTemplateSession.getTextBoxPartName());
0455: outValue.add(TEXT_BOX__TOP_LABEL);
0456: //outValue = ConsoleTemplateSession.getToggleLinkFromArrayList(inList);
0457:
0458: return outValue;
0459: }
0460:
0461: /////
0462: private final static ArrayList getLabelFromTypeFileUploadAsArrayList(
0463: int inIndex) {
0464: //
0465: ArrayList outValue = getSectionIdAsArrayList(inIndex,
0466: TYPE_FILE_UPLOAD);
0467:
0468: outValue.add(ConsoleTemplateSession.getTextBoxPartName());
0469: outValue.add(FILE_UPLOAD__NEXT_TEXT_LABEL);
0470:
0471: return outValue;
0472: }
0473:
0474: //
0475: public final static String getFileUploadFromTypeFileUpload(
0476: int inIndex) {
0477: return ConsoleTemplateSession
0478: .getToggleLinkFromArrayList(getFileUploadFromTypeFileUploadAsArrayList(inIndex));
0479: }
0480:
0481: private final static ArrayList getFileUploadFromTypeFileUploadAsArrayList(
0482: int inIndex) {
0483: //
0484: ArrayList outValue = getSectionIdAsArrayList(inIndex,
0485: TYPE_FILE_UPLOAD);
0486:
0487: outValue.add(ConsoleTemplateSession.getFileUploadPartName());
0488: outValue.add(FILE_UPLOAD__NEXT_TEXT_VALUE);
0489:
0490: return outValue;
0491: }
0492:
0493: /////
0494: private final static ArrayList getLabelFromTypeButtonAsArrayList(
0495: int inIndex) {
0496: //
0497: ArrayList outValue = getSectionIdAsArrayList(inIndex,
0498: TYPE_BUTTON);
0499:
0500: outValue.add(ConsoleTemplateSession.getTextBoxPartName());
0501: outValue.add(BUTTON__NEXT_TEXT_LABEL);
0502:
0503: return outValue;
0504: }
0505:
0506: //
0507: public final static String getButtonFromTypeButton(int inIndex) {
0508: return ConsoleTemplateSession
0509: .getToggleLinkFromArrayList(getButtonFromTypeButtonAsArrayList(inIndex));
0510: }
0511:
0512: private final static ArrayList getButtonFromTypeButtonAsArrayList(
0513: int inIndex) {
0514: //
0515: ArrayList outValue = getSectionIdAsArrayList(inIndex,
0516: TYPE_BUTTON);
0517:
0518: outValue.add(ConsoleTemplateSession.getTableButtonPartName());
0519: outValue.add(BUTTON__NEXT_TEXT_VALUE);
0520:
0521: return outValue;
0522: }
0523:
0524: //
0525: public final static String getOtherFromTypeButton(int inIndex) {
0526: return ConsoleTemplateSession
0527: .getToggleLinkFromArrayList(getOtherFromTypeButtonAsArrayList(inIndex));
0528: }
0529:
0530: private final static ArrayList getOtherFromTypeButtonAsArrayList(
0531: int inIndex) {
0532: //
0533: ArrayList outValue = getSectionIdAsArrayList(inIndex,
0534: TYPE_BUTTON);
0535:
0536: outValue.add(ConsoleTemplateSession.getHiddenFieldPartName());
0537: outValue.add(BUTTON__NEXT_TEXT_OTHER_VALUE);
0538:
0539: return outValue;
0540: }
0541:
0542: /////
0543: private final static ArrayList getLabelFromTypeTextBoxAsArrayList(
0544: int inIndex) {
0545: //
0546: ArrayList outValue = getSectionIdAsArrayList(inIndex,
0547: TYPE_TEXT_BOX);
0548:
0549: outValue.add(ConsoleTemplateSession.getTextBoxPartName());
0550: outValue.add(TEXT_BOX__NEXT_TEXT_LABEL);
0551:
0552: return outValue;
0553: }
0554:
0555: //
0556: public final static String getTextBoxFromTypeTextBox(int inIndex) {
0557: return ConsoleTemplateSession
0558: .getToggleLinkFromArrayList(getTextBoxFromTypeTextBoxAsArrayList(inIndex));
0559: }
0560:
0561: private final static ArrayList getTextBoxFromTypeTextBoxAsArrayList(
0562: int inIndex) {
0563: //
0564: ArrayList outValue = getSectionIdAsArrayList(inIndex,
0565: TYPE_TEXT_BOX);
0566:
0567: outValue.add(ConsoleTemplateSession.getTextBoxPartName());
0568: outValue.add(TEXT_BOX__NEXT_TEXT_VALUE);
0569:
0570: return outValue;
0571: }
0572:
0573: /////
0574: private final static ArrayList getLabelFromTypeTextAreaAsArrayList(
0575: int inIndex) {
0576: //
0577: ArrayList outValue = getSectionIdAsArrayList(inIndex,
0578: TYPE_TEXT_AREA);
0579:
0580: outValue.add(ConsoleTemplateSession.getTextBoxPartName());
0581: outValue.add(TEXT_AREA__NEXT_TEXT_LABEL);
0582:
0583: return outValue;
0584: }
0585:
0586: //
0587: public final static String getTextAreaFromTypeTextArea(int inIndex) {
0588: return ConsoleTemplateSession
0589: .getToggleLinkFromArrayList(getTextAreaFromTypeTextAreaAsArrayList(inIndex));
0590: }
0591:
0592: private final static ArrayList getTextAreaFromTypeTextAreaAsArrayList(
0593: int inIndex) {
0594: //
0595: ArrayList outValue = getSectionIdAsArrayList(inIndex,
0596: TYPE_TEXT_AREA);
0597:
0598: outValue.add(ConsoleTemplateSession.getTextAreaPartName());
0599: outValue.add(TEXT_AREA__NEXT_TEXT_VALUE);
0600:
0601: return outValue;
0602: }
0603:
0604: /////
0605: private final static ArrayList getLabelFromTypeSelectInclusiveAsArrayList(
0606: int inIndex) {
0607: //
0608: ArrayList outValue = getSectionIdAsArrayList(inIndex,
0609: TYPE_INCLUSIVE_SELECT);
0610:
0611: outValue.add(ConsoleTemplateSession.getTextBoxPartName());
0612: outValue.add(DROP_DOWN_BOX__INCLUSIVE_LABEL);
0613:
0614: return outValue;
0615: }
0616:
0617: public final static String getDropDownBoxFromTypeSelectInclusive(
0618: int inIndex) {
0619: //
0620: return ConsoleTemplateSession
0621: .getToggleLinkFromArrayList(getDropDownBoxFromTypeSelectInclusiveAsArrayList(inIndex));
0622: }
0623:
0624: private final static ArrayList getDropDownBoxFromTypeSelectInclusiveAsArrayList(
0625: int inIndex) {
0626: //
0627: ArrayList outValue = getSectionIdAsArrayList(inIndex,
0628: TYPE_INCLUSIVE_SELECT);
0629:
0630: outValue.add(ConsoleTemplateSession.getDropDownBoxPartName());
0631: outValue.add(DROP_DOWN_BOX__INCLUSIVE_VALUE);
0632:
0633: return outValue;
0634: }
0635:
0636: public final static String getTextBoxFromTypeSelectInclusive(
0637: int inIndex) {
0638: //
0639: return ConsoleTemplateSession
0640: .getToggleLinkFromArrayList(getTextBoxFromTypeSelectInclusiveAsArrayList(inIndex));
0641: }
0642:
0643: private final static ArrayList getTextBoxFromTypeSelectInclusiveAsArrayList(
0644: int inIndex) {
0645: //
0646: ArrayList outValue = getSectionIdAsArrayList(inIndex,
0647: TYPE_INCLUSIVE_SELECT);
0648:
0649: outValue.add(ConsoleTemplateSession.getTextBoxPartName());
0650: outValue.add(DROP_DOWN_BOX__INCLUSIVE_OTHER_VALUE);
0651:
0652: return outValue;
0653: }
0654:
0655: /////
0656: private final static ArrayList getLabelFromTypeSelectExclusiveAsArrayList(
0657: int inIndex) {
0658: //
0659: ArrayList outValue = getSectionIdAsArrayList(inIndex,
0660: TYPE_EXCLUSIVE_SELECT);
0661:
0662: outValue.add(ConsoleTemplateSession.getTextBoxPartName());
0663: outValue.add(DROP_DOWN_BOX__EXCLUSIVE_LABEL);
0664:
0665: return outValue;
0666: }
0667:
0668: public final static String getDropDownBoxFromTypeSelectExclusive(
0669: int inIndex) {
0670: //
0671: return ConsoleTemplateSession
0672: .getToggleLinkFromArrayList(getDropDownBoxFromTypeSelectExclusiveAsArrayList(inIndex));
0673: }
0674:
0675: private final static ArrayList getDropDownBoxFromTypeSelectExclusiveAsArrayList(
0676: int inIndex) {
0677: //
0678: ArrayList outValue = getSectionIdAsArrayList(inIndex,
0679: TYPE_EXCLUSIVE_SELECT);
0680:
0681: outValue.add(ConsoleTemplateSession.getDropDownBoxPartName());
0682: outValue.add(DROP_DOWN_BOX__EXCLUSIVE_VALUE);
0683:
0684: return outValue;
0685: }
0686:
0687: /////
0688: public final static String getHiddenBoxFromTypeHiddenBox(int inIndex) {
0689: return ConsoleTemplateSession
0690: .getToggleLinkFromArrayList(getHiddenBoxFromTypeHiddenBoxAsArrayList(inIndex));
0691: }
0692:
0693: private final static ArrayList getHiddenBoxFromTypeHiddenBoxAsArrayList(
0694: int inIndex) {
0695: //
0696: ArrayList outValue = getSectionIdAsArrayList(inIndex,
0697: TYPE_HIDDEN_BOX);
0698:
0699: outValue.add(ConsoleTemplateSession.getHiddenFieldPartName());
0700: outValue.add(HIDDEN_BOX__NEXT_TEXT_VALUE);
0701:
0702: return outValue;
0703: }
0704:
0705: //
0706: //
0707: //
0708: public final static String getCreationSubmit(
0709: SubmitActionContext inSac, boolean inReplaceParameters,
0710: int inParameterCount) {
0711: //
0712: StringBuffer outValue = new StringBuffer();
0713:
0714: final String FORM_NAME = "document."
0715: + ConsoleTemplateParameters.ACTION_FORM + ".";
0716:
0717: //
0718: outValue.append(FORM_NAME);
0719: outValue.append(CONSOLE_CREATION_REPLACE_PARAMETERS);
0720: outValue.append(".value = '");
0721: outValue.append(inReplaceParameters);
0722: outValue.append("'; ");
0723: //
0724: outValue.append(FORM_NAME);
0725: outValue.append(CONSOLE_CREATION_PARAMETER_COUNT);
0726: outValue.append(".value = '");
0727: outValue.append(inParameterCount);
0728: outValue.append("'; ");
0729: //
0730: outValue.append(inSac.submitActionCall());
0731:
0732: return outValue.toString();
0733: }
0734:
0735: public final static String getCancelText() {
0736:
0737: StringBuffer outValue = new StringBuffer();
0738:
0739: outValue.append("closeSection('" + getBaseId() + "');");
0740: outValue.append(" exposeHeavyWeightPageComponents();");
0741:
0742: return outValue.toString();
0743: }
0744:
0745: public final static void renderConceptTagCreationFunction(
0746: ConsoleTemplateContext inCtc) throws IOException {
0747:
0748: final String FORM_NAME = "document."
0749: + ConsoleTemplateParameters.ACTION_FORM + ".";
0750:
0751: inCtc.simpleAndPrint("");
0752: inCtc
0753: .simpleAndPrint("var renderConceptTagCreationAction = null;");
0754: inCtc.simpleAndPrint("");
0755: inCtc.printAndIndent("function renderConceptTagCreation(");
0756: for (int i = 0; i < MAX_CREATION_PARAMS; i++) {
0757: inCtc.simpleAndPrint("inType" + i + ", " + "inLabel" + i
0758: + ", " + "inOptions" + i + ", " + "inOptionLabels"
0759: + i + ", " + "inText" + i + ",");
0760: }
0761: inCtc
0762: .simpleAndPrint("inParamCount, inLabel, inAction, inReplaceParam, inShowSubmitTwo");
0763: inCtc.simpleAndPrint(") {");
0764: //
0765: inCtc.simpleAndPrint("");
0766: inCtc.simpleAndPrint("var outValue = true;");
0767: inCtc.simpleAndPrint("");
0768: inCtc.simpleAndPrint("closeOpenTagMenus('');");
0769: inCtc.simpleAndPrint("hideHeavyWeightPageComponents();");
0770: inCtc.simpleAndPrint("closeWebPageViewPopUp();");
0771: //
0772: //
0773: //
0774: inCtc.simpleAndPrint("");
0775: inCtc.simpleAndPrint("renderConceptTagCreationAction =");
0776: inCtc.justIndent();
0777: inCtc.simpleAndPrint("'" + FORM_NAME
0778: + CONSOLE_CREATION_REPLACE_PARAMETERS
0779: + ".value = ' + inReplaceParam + '; "
0780: //
0781: + FORM_NAME + CONSOLE_CREATION_PARAMETER_COUNT
0782: + ".value = ' + inParamCount + '; ' + inAction;");
0783: inCtc.justRevert();
0784: inCtc.simpleAndPrint("");
0785: String topLabelId = ConsoleTemplateFunctionsContext
0786: .getPageComponent(getTopLabel(), true);
0787: inCtc.simpleAndPrint(topLabelId + ".value = inLabel;");
0788: inCtc.simpleAndPrint("");
0789: //
0790: for (int i = 0; i < MAX_CREATION_PARAMS; i++) {
0791: ArrayList types = getTypes();
0792: for (int j = 0; j < types.size(); j++) {
0793: Integer nextType = ((Integer) types.get(j));
0794: if (!nextType.equals(TYPE_HIDDEN_BOX)) {
0795: inCtc.simpleAndPrint("closeSection('"
0796: + getSectionId(i, nextType) + "');");
0797: }
0798: }
0799: //inCtc.simpleAndPrint("closeSection('');");
0800: }
0801: //
0802: inCtc.simpleAndPrint("//");
0803: //
0804: inCtc.simpleAndPrint("openSection('" + getBaseId() + "');");
0805: //
0806: inCtc.printAndIndent("if (!inShowSubmitTwo) {");
0807: inCtc
0808: .simpleAndPrint("openSection('" + getSubmitOneId()
0809: + "');");
0810: inCtc.simpleAndPrint("closeSection('" + getSubmitTwoId()
0811: + "');");
0812: inCtc.revertAndPrint("}");
0813: inCtc.printAndIndent("else {");
0814: inCtc
0815: .simpleAndPrint("openSection('" + getSubmitTwoId()
0816: + "');");
0817: inCtc.simpleAndPrint("closeSection('" + getSubmitOneId()
0818: + "');");
0819: inCtc.revertAndPrint("}");
0820: //
0821: inCtc.simpleAndPrint("");
0822: for (int i = 0; i < MAX_CREATION_PARAMS; i++) {
0823: inCtc.printAndIndent("if (inType" + i + " != 0) {");
0824: //
0825: inCtc.printAndIndent("if (inType" + i + " != "
0826: + TYPE_HIDDEN_BOX + ") {");
0827: inCtc.simpleAndPrint("openSection("
0828: + getHandleAsJavaScript(getSectionIdAsArrayList(i,
0829: new Integer(0)), i) + ");");
0830: inCtc.revertAndPrint("}");
0831: //
0832: //inCtc.simpleAndPrint(
0833: // "openSection('" + getBaseId()
0834: // + ConsoleTemplateSession.TOGGLE_LINK_SEPARATOR
0835: // + CONSOLE_CREATION_STRUCTURE_PREFIX + "' + inType" + i
0836: // + " + '" + "_" + i + "');");
0837: inCtc.revertAndPrint("}");
0838: inCtc.simpleAndPrint(FORM_NAME
0839: + CONSOLE_CREATION_PARAMETER_TYPE_PREFIX + i
0840: + ".value = inType" + i + ";");
0841: inCtc.simpleAndPrint("//");
0842: //
0843: //////////////
0844: inCtc.printAndIndent("if (inType" + i + " == "
0845: + TYPE_TEXT_BOX + ") {");
0846: //
0847: //
0848: ArrayList nextTextBoxLabelPartList = getLabelFromTypeTextBoxAsArrayList(i);
0849: String nextTextBoxLabelId = ConsoleTemplateFunctionsContext
0850: .getPageComponent(getHandleAsJavaScript(
0851: nextTextBoxLabelPartList, i), false);
0852: inCtc.simpleAndPrint(nextTextBoxLabelId
0853: + ".value = ' ' + inLabel" + i + ";");
0854: //
0855: ArrayList nextTextBoxTextBoxPartList = getTextBoxFromTypeTextBoxAsArrayList(i);
0856: String nextTextBoxTextBoxId = ConsoleTemplateFunctionsContext
0857: .getPageComponent(getHandleAsJavaScript(
0858: nextTextBoxTextBoxPartList, i), false);
0859: inCtc.simpleAndPrint(nextTextBoxTextBoxId
0860: + ".value = inText" + i + ";");
0861: //
0862: //
0863: inCtc.revertAndPrint("}");
0864: //
0865: //////////////
0866: inCtc.printAndIndent("if (inType" + i + " == "
0867: + TYPE_FILE_UPLOAD + ") {");
0868: //
0869: //
0870: ArrayList nextFileUploadLabelPartList = getLabelFromTypeFileUploadAsArrayList(i);
0871: String nextFileUploadLabelId = ConsoleTemplateFunctionsContext
0872: .getPageComponent(getHandleAsJavaScript(
0873: nextFileUploadLabelPartList, i), false);
0874: inCtc.simpleAndPrint(nextFileUploadLabelId
0875: + ".value = ' ' + inLabel" + i + ";");
0876: //
0877: //ArrayList nextTextBoxTextBoxPartList =
0878: // getTextBoxFromTypeTextBoxAsArrayList(i);
0879: //String nextTextBoxTextBoxId =
0880: // ConsoleTemplateFunctionsContext.getPageComponent(
0881: // getHandleAsJavaScript(
0882: // nextTextBoxTextBoxPartList, i), false);
0883: //inCtc.simpleAndPrint(
0884: // nextTextBoxTextBoxId + ".value = inText" + i + ";");
0885: //
0886: //
0887: inCtc.revertAndPrint("}");
0888: //
0889: //////////////
0890: inCtc.printAndIndent("if (inType" + i + " == "
0891: + TYPE_TEXT_AREA + ") {");
0892: ArrayList nextTextAreaLabelPartList = getLabelFromTypeTextAreaAsArrayList(i);
0893: String nextTextAreaLabelId = ConsoleTemplateFunctionsContext
0894: .getPageComponent(getHandleAsJavaScript(
0895: nextTextAreaLabelPartList, i), false);
0896: inCtc.simpleAndPrint(nextTextAreaLabelId
0897: + ".value = ' ' + inLabel" + i + ";");
0898: //
0899: ArrayList nextTextAreaTextAreaPartList = getTextAreaFromTypeTextAreaAsArrayList(i);
0900: String nextTextAreaTextAreaId = ConsoleTemplateFunctionsContext
0901: .getPageComponent(getHandleAsJavaScript(
0902: nextTextAreaTextAreaPartList, i), false);
0903: inCtc.simpleAndPrint(nextTextAreaTextAreaId
0904: + ".value = inText" + i + ";");
0905: //
0906: //
0907: inCtc.revertAndPrint("}");
0908: //
0909: //////////////
0910: inCtc.printAndIndent("if (inType" + i + " == "
0911: + TYPE_BUTTON + ") {");
0912: ArrayList nextButtonLabelPartList = getLabelFromTypeButtonAsArrayList(i);
0913: String nextButtonLabelId = ConsoleTemplateFunctionsContext
0914: .getPageComponent(getHandleAsJavaScript(
0915: nextButtonLabelPartList, i), false);
0916: inCtc.simpleAndPrint(nextButtonLabelId
0917: + ".value = ' ' + inLabel" + i + ";");
0918: //
0919: ArrayList nextOtherButtonPartList = getOtherFromTypeButtonAsArrayList(i);
0920: String nextOtherButtonId = ConsoleTemplateFunctionsContext
0921: .getPageComponent(getHandleAsJavaScript(
0922: nextOtherButtonPartList, i), false);
0923: inCtc.simpleAndPrint(nextOtherButtonId + ".value = inText"
0924: + i + ";");
0925: //
0926: //
0927: inCtc.revertAndPrint("}");
0928: //
0929: //////////////
0930: inCtc.printAndIndent("if (inType" + i + " == "
0931: + TYPE_HIDDEN_BOX + ") {");
0932: //ArrayList nextTextAreaLabelPartList =
0933: // getLabelFromTypeTextAreaAsArrayList(i);
0934: //String nextTextAreaLabelId =
0935: // ConsoleTemplateFunctionsContext.getPageComponent(
0936: // getHandleAsJavaScript(
0937: // nextTextAreaLabelPartList, i), false);
0938: //inCtc.simpleAndPrint(
0939: // nextTextAreaLabelId + ".value = ' ' + inLabel" + i + ";");
0940: //
0941: ArrayList nextHiddenBoxHiddenBoxPartList = getHiddenBoxFromTypeHiddenBoxAsArrayList(i);
0942: String nextHiddenBoxHiddenBoxId = ConsoleTemplateFunctionsContext
0943: .getPageComponent(getHandleAsJavaScript(
0944: nextHiddenBoxHiddenBoxPartList, i), false);
0945: inCtc.simpleAndPrint(nextHiddenBoxHiddenBoxId
0946: + ".value = inText" + i + ";");
0947: //
0948: //
0949: inCtc.revertAndPrint("}");
0950: //
0951: //////////////
0952: inCtc.printAndIndent("if (inType" + i + " == "
0953: + TYPE_INCLUSIVE_SELECT + ") {");
0954: ArrayList nextSelectInclusiveLabelPartList = getLabelFromTypeSelectInclusiveAsArrayList(i);
0955: String nextSelectInclusiveLabelId = ConsoleTemplateFunctionsContext
0956: .getPageComponent(getHandleAsJavaScript(
0957: nextSelectInclusiveLabelPartList, i), false);
0958: inCtc.simpleAndPrint(nextSelectInclusiveLabelId
0959: + ".value = ' ' + inLabel" + i + ";");
0960: //
0961: ArrayList nextSelectInclusiveDropDownPartList = getDropDownBoxFromTypeSelectInclusiveAsArrayList(i);
0962: String nextSelectInclusiveDropDownId = ConsoleTemplateFunctionsContext
0963: .getPageComponent(getHandleAsJavaScript(
0964: nextSelectInclusiveDropDownPartList, i),
0965: false);
0966: inCtc.simpleAndPrint("var inclusiveDropDownObject = "
0967: + nextSelectInclusiveDropDownId + ";");
0968: inCtc
0969: .printAndIndent("while (inclusiveDropDownObject.options.length != 0) {");
0970: inCtc
0971: .simpleAndPrint("inclusiveDropDownObject.options.remove(0);");
0972: inCtc.revertAndPrint("}");
0973: //
0974: inCtc
0975: .printAndIndent("for (var i = 0; i < getTokenCount(inOptions"
0976: + i
0977: + ", '"
0978: + CommonSeparators.LIST_CPC_SEPARATOR
0979: + "'); i++) {");
0980: inCtc.simpleAndPrint("var nextValue = '"
0981: + CommonSeparators.LIST_CPC_SEPARATOR
0982: + "' + getNthToken(inOptions" + i + ", '"
0983: + CommonSeparators.LIST_CPC_SEPARATOR + "', i);");
0984: inCtc
0985: .simpleAndPrint("var nextLabel = getNthToken(inOptionLabels"
0986: + i
0987: + ", '"
0988: + CommonSeparators.LIST_CPC_SEPARATOR
0989: + "', i);");
0990: //
0991: //
0992: //
0993: //
0994: //
0995: inCtc.printAndIndent("if (!isIE()) {");
0996: inCtc
0997: .simpleAndPrint("var nextOption = new Option('(Specify Below)', '');");
0998: inCtc
0999: .simpleAndPrint("inclusiveDropDownObject.options["
1000: + "inclusiveDropDownObject.options.length] = nextOption;");
1001: inCtc.revertAndPrint("}");
1002: inCtc.simpleAndPrint("//");
1003: //
1004: inCtc.printAndIndent("if (isIE()) {");
1005: inCtc
1006: .simpleAndPrint("var nextOption = document.createElement(\"OPTION\");");
1007: inCtc
1008: .simpleAndPrint("inclusiveDropDownObject.options.add(nextOption);");
1009: inCtc.simpleAndPrint("nextOption.innerText = nextLabel;");
1010: inCtc.simpleAndPrint("nextOption.value = nextValue;");
1011: inCtc.revertAndPrint("}");
1012: inCtc.printAndIndent("else {");
1013: inCtc
1014: .simpleAndPrint("var nextOption = new Option(nextLabel, nextValue);");
1015: inCtc
1016: .simpleAndPrint("inclusiveDropDownObject.options["
1017: + "inclusiveDropDownObject.options.length] = nextOption;");
1018: inCtc.revertAndPrint("}");
1019: inCtc.revertAndPrint("}");
1020: inCtc.simpleAndPrint("//");
1021: //
1022: inCtc.printAndIndent("if (isIE()) {");
1023: inCtc
1024: .simpleAndPrint("var nonOption = document.createElement(\"OPTION\");");
1025: inCtc
1026: .simpleAndPrint("inclusiveDropDownObject.options.add(nonOption);");
1027: inCtc
1028: .simpleAndPrint("nonOption.innerText = '(Specify Below)';");
1029: inCtc.simpleAndPrint("nonOption.value = '';");
1030: inCtc.revertAndPrint("}");
1031: //
1032: //
1033:
1034: ArrayList nextOtherSelectInclusiveAreaPartList = getTextBoxFromTypeSelectInclusiveAsArrayList(i);
1035: String nextOtherSelectInclusiveAreaId = ConsoleTemplateFunctionsContext
1036: .getPageComponent(getHandleAsJavaScript(
1037: nextOtherSelectInclusiveAreaPartList, i),
1038: false);
1039: inCtc.simpleAndPrint(nextOtherSelectInclusiveAreaId
1040: + ".value = inText" + i + ";");
1041:
1042: //
1043: //
1044: inCtc.revertAndPrint("}");
1045: //
1046: //////////////
1047: inCtc.printAndIndent("if (inType" + i + " == "
1048: + TYPE_EXCLUSIVE_SELECT + ") {");
1049: ArrayList nextSelectExclusiveLabelPartList = getLabelFromTypeSelectExclusiveAsArrayList(i);
1050: String nextSelectExclusiveLabelId = ConsoleTemplateFunctionsContext
1051: .getPageComponent(getHandleAsJavaScript(
1052: nextSelectExclusiveLabelPartList, i), false);
1053: inCtc.simpleAndPrint(nextSelectExclusiveLabelId
1054: + ".value = ' ' + inLabel" + i + ";");
1055: //
1056: //
1057: ArrayList nextSelectExclusiveDropDownPartList = getDropDownBoxFromTypeSelectExclusiveAsArrayList(i);
1058: String nextSelectExclusiveDropDownId = ConsoleTemplateFunctionsContext
1059: .getPageComponent(getHandleAsJavaScript(
1060: nextSelectExclusiveDropDownPartList, i),
1061: false);
1062: inCtc.simpleAndPrint("var exclusiveDropDownObject = "
1063: + nextSelectExclusiveDropDownId + ";");
1064: inCtc
1065: .printAndIndent("while (exclusiveDropDownObject.options.length != 0) {");
1066: inCtc
1067: .simpleAndPrint("exclusiveDropDownObject.options.remove(0);");
1068: inCtc.revertAndPrint("}");
1069: //
1070: //inCtc.simpleAndPrint(
1071: // "var nonOption = document.createElement(\"OPTION\");");
1072: //inCtc.simpleAndPrint(
1073: // "exclusiveDropDownObject.options.add(nonOption);");
1074: //inCtc.simpleAndPrint("nonOption.innerText = '(Specify Below)';");
1075: //inCtc.simpleAndPrint("nonOption.value = '';");
1076: //
1077: inCtc
1078: .printAndIndent("for (var i = 0; i < getTokenCount(inOptions"
1079: + i
1080: + ", '"
1081: + CommonSeparators.LIST_CPC_SEPARATOR
1082: + "'); i++) {");
1083: inCtc.simpleAndPrint("var nextValue = '"
1084: + CommonSeparators.LIST_CPC_SEPARATOR
1085: + "' + getNthToken(inOptions" + i + ", '"
1086: + CommonSeparators.LIST_CPC_SEPARATOR + "', i);");
1087: inCtc
1088: .simpleAndPrint("var nextLabel = getNthToken(inOptionLabels"
1089: + i
1090: + ", '"
1091: + CommonSeparators.LIST_CPC_SEPARATOR
1092: + "', i);");
1093: //
1094: inCtc.printAndIndent("if (isIE()) {");
1095: inCtc
1096: .simpleAndPrint("var nextOption = document.createElement(\"OPTION\");");
1097: inCtc
1098: .simpleAndPrint("exclusiveDropDownObject.options.add(nextOption);");
1099: inCtc.simpleAndPrint("nextOption.innerText = nextLabel;");
1100: inCtc.simpleAndPrint("nextOption.value = nextValue;");
1101: inCtc.revertAndPrint("}");
1102: inCtc.printAndIndent("else {");
1103: inCtc
1104: .simpleAndPrint("var nextOption = new Option(nextLabel, nextValue);");
1105: inCtc
1106: .simpleAndPrint("exclusiveDropDownObject.options["
1107: + "exclusiveDropDownObject.options.length] = nextOption;");
1108: inCtc.revertAndPrint("}");
1109: inCtc.revertAndPrint("}");
1110: //
1111: //
1112: inCtc.revertAndPrint("}");
1113: }
1114: //
1115: //
1116: //
1117: inCtc
1118: .simpleAndPrint("centerAndDisplay('" + getBaseId()
1119: + "');");
1120: //
1121: //
1122: inCtc.simpleAndPrint("");
1123: inCtc.simpleAndPrint("return outValue;");
1124: //
1125: inCtc.revertAndPrint("}");
1126: }
1127:
1128: //
1129: private final static String TEXT_BOX__TOP_LABEL = "TEXT_BOX__TOP_LABEL";
1130: //
1131: private final static String BUTTON__NEXT_TEXT_LABEL = "BUTTON__NEXT_TEXT_LABEL";
1132: private final static String BUTTON__NEXT_TEXT_VALUE = "BUTTON__NEXT_TEXT_VALUE";
1133: private final static String BUTTON__NEXT_TEXT_OTHER_VALUE = "BUTTON__NEXT_TEXT_OTHER_VALUE";
1134: //
1135: private final static String TEXT_BOX__NEXT_TEXT_LABEL = "TEXT_BOX__NEXT_TEXT_LABEL";
1136: private final static String TEXT_BOX__NEXT_TEXT_VALUE = "TEXT_BOX__NEXT_TEXT_VALUE";
1137: //
1138: private final static String TEXT_AREA__NEXT_TEXT_LABEL = "TEXT_AREA__NEXT_TEXT_LABEL";
1139: private final static String TEXT_AREA__NEXT_TEXT_VALUE = "TEXT_AREA__NEXT_TEXT_VALUE";
1140: //
1141: private final static String DROP_DOWN_BOX__INCLUSIVE_LABEL = "DROP_DOWN_BOX__INCLUSIVE_LABEL";
1142: private final static String DROP_DOWN_BOX__INCLUSIVE_VALUE = "DROP_DOWN_BOX__INCLUSIVE_VALUE";
1143: private final static String DROP_DOWN_BOX__INCLUSIVE_OTHER_VALUE = "DROP_DOWN_BOX__INCLUSIVE_OTHER_VALUE";
1144: //
1145: private final static String DROP_DOWN_BOX__EXCLUSIVE_LABEL = "DROP_DOWN_BOX__EXCLUSIVE_LABEL";
1146: private final static String DROP_DOWN_BOX__EXCLUSIVE_VALUE = "DROP_DOWN_BOX__EXCLUSIVE_VALUE";
1147: //
1148: private final static String HIDDEN_BOX__NEXT_TEXT_LABEL = "HIDDEN_BOX__NEXT_TEXT_LABEL";
1149: private final static String HIDDEN_BOX__NEXT_TEXT_VALUE = "HIDDEN_BOX__NEXT_TEXT_VALUE";
1150: //
1151: private final static String FILE_UPLOAD__NEXT_TEXT_LABEL = "FILE_UPLOAD__NEXT_TEXT_LABEL";
1152: private final static String FILE_UPLOAD__NEXT_TEXT_VALUE = "FILE_UPLOAD__NEXT_TEXT_VALUE";
1153:
1154: //
1155: //
1156: public final static void renderConceptTagCreationObject(
1157: ConsoleTemplateContext inCtc, ConsoleTemplateSession inCts)
1158: throws IOException {
1159:
1160: final String BACKGROUND_COLOR = "#F5F5DC";
1161:
1162: //
1163: PageSetupContext localPsc = inCts.getPageSetupContext();
1164: //
1165: HashMap topStyles = new HashMap();
1166: //topStyles.put("z-index", "100");
1167: //topStyles.put("position", "absolute");
1168: topStyles.put("style", "background-color: " + BACKGROUND_COLOR
1169: + "; z-index: "
1170: + CommonSeparators.Z_INDEX__CONCEPT_TAG_CREATION_OBJECT
1171: + "; position: absolute; border-color: #333333;");
1172: // background-color: #EEEEEE");
1173: topStyles.put("border", "1");
1174:
1175: //inCts.pushToggleLinkDontRecordThisBranch();
1176: //inCts.pushToggleLinkCreationTable();
1177: //
1178: inCtc.startEnclosingTableAndRowAndCell(topStyles, inCts
1179: .getToggleLink());
1180:
1181: //
1182: //
1183: renderLine(inCtc);
1184: //
1185: HashMap topLabelTextAttrs = new HashMap();
1186: topLabelTextAttrs.put("readonly", "true");
1187: HashMap topLabelTextStyles = ConsoleTemplateContext
1188: .getFontStyleAsStyles(14, ConsoleTemplateContext.ARIAL,
1189: ConsoleTemplateContext.BLACK);
1190: topLabelTextStyles.put("text-align", "'center'");
1191: topLabelTextStyles.put("background-color", BACKGROUND_COLOR);
1192: topLabelTextStyles.put("border-width", "0px");
1193: topLabelTextStyles.put("width",
1194: ((inCtc.getColumnWidth() * 2) - 10) + "px");
1195: //
1196: //
1197: HashMap nextLabelTextAttrs = new HashMap();
1198: nextLabelTextAttrs.put("readonly", "true");
1199: HashMap nextLabelTextStyles = ConsoleTemplateContext
1200: .getFontStyleAsStyles(13, ConsoleTemplateContext.ARIAL,
1201: ConsoleTemplateContext.BLACK);
1202: nextLabelTextStyles.put("width",
1203: ((inCtc.getColumnWidth() * 1) - 10) + "px");
1204: //nextLabelTextStyles.put("text-align", "'center'");
1205: nextLabelTextStyles.put("background-color", BACKGROUND_COLOR);
1206: nextLabelTextStyles.put("border-width", "0px");
1207:
1208: String topLabelTextBox = inCtc.createTextBox(
1209: TEXT_BOX__TOP_LABEL, "Bubba", topLabelTextAttrs,
1210: topLabelTextStyles, null, null, null);
1211: inCtc.startTable(2);
1212:
1213: inCtc.startRow();
1214: inCtc.startAndEndCell(2, topLabelTextBox,
1215: ConsoleTemplateContext.alignCenter(null));
1216: inCtc.endRow();
1217:
1218: inCtc.endTable();
1219:
1220: //
1221: for (int i = 0; i < MAX_CREATION_PARAMS; i++) {
1222:
1223: //////////////////////////////
1224: inCts.pushToggleLink(CONSOLE_CREATION_STRUCTURE_PREFIX
1225: + TYPE_TEXT_BOX + "_" + i);
1226: //
1227: inCtc.startEnclosingTableAndRowAndCell(inCts
1228: .getToggleLink());
1229: renderLine(inCtc);
1230: //
1231: HashMap nextTextBoxValueStyles = new HashMap();
1232: nextTextBoxValueStyles.put("width", ((inCtc
1233: .getColumnWidth() * 1) - 10)
1234: + "px");
1235: //
1236: String nextTextBoxLabel = inCtc.createTextBox(
1237: TEXT_BOX__NEXT_TEXT_LABEL, "BOX LABEL",
1238: nextLabelTextAttrs, nextLabelTextStyles, null,
1239: null, null);
1240: String nextTextBoxValue = inCtc.createTextBox(
1241: TEXT_BOX__NEXT_TEXT_VALUE, "Bubba", null,
1242: nextTextBoxValueStyles, null, null, null);
1243: inCtc.startTable(2);
1244: inCtc.startRow();
1245: inCtc.startAndEndCell(1, nextTextBoxLabel,
1246: ConsoleTemplateContext.alignCenter(null));
1247: inCtc.startAndEndCell(1, nextTextBoxValue,
1248: ConsoleTemplateContext.alignLeft(null));
1249: inCtc.endRow();
1250: inCtc.endTable();
1251: //
1252: inCtc.endEnclosingTableAndRowAndCell();
1253: //
1254: inCts.popToggleLink();
1255:
1256: //////////////////////////////
1257: inCts.pushToggleLink(CONSOLE_CREATION_STRUCTURE_PREFIX
1258: + TYPE_BUTTON + "_" + i);
1259: //
1260: inCtc.startEnclosingTableAndRowAndCell(inCts
1261: .getToggleLink());
1262: renderLine(inCtc);
1263: //
1264: HashMap nextButtonValueStyles = new HashMap();
1265: nextTextBoxValueStyles.put("width", ((inCtc
1266: .getColumnWidth() * 1) - 10)
1267: + "px");
1268: //
1269: String nextButtonLabel = inCtc.createTextBox(
1270: BUTTON__NEXT_TEXT_LABEL, "BUTTON LABEL",
1271: nextLabelTextAttrs, nextLabelTextStyles, null,
1272: null, null);
1273: String nextButtonOther = inCtc.createHiddenField(
1274: BUTTON__NEXT_TEXT_OTHER_VALUE, "", null);
1275: String nextButtonOtherId = inCts.getPreviousToggleLink();
1276: //String nextButtonValue = inCtc.createTextBox(
1277: // BUTTON__NEXT_TEXT_VALUE, "Bubba",
1278: // null, nextButtonValueStyles, null, null, null);
1279: inCtc.startTable(2);
1280: inCtc.startRow();
1281: inCtc.startAndEndCell(1, nextButtonLabel,
1282: ConsoleTemplateContext.alignCenter(null));
1283: inCtc.startCell(1, ConsoleTemplateContext.alignLeft(null));
1284: inCtc
1285: .createButton(
1286: BUTTON__NEXT_TEXT_VALUE,
1287: "Select",
1288: null,
1289: "eval("
1290: + ConsoleTemplateContext
1291: .getPageComponentValue(nextButtonOtherId)
1292: + ")", null, null, null, null);
1293: inCtc.simpleAndPrint(nextButtonOther);
1294: //inCtc.startAndEndCell(1, nextButtonValue, inCtc.alignLeft(null));
1295: inCtc.endCell();
1296: inCtc.endRow();
1297: inCtc.endTable();
1298: //
1299: inCtc.endEnclosingTableAndRowAndCell();
1300: //
1301: inCts.popToggleLink();
1302:
1303: //////////////////////////////
1304: inCts.pushToggleLink(CONSOLE_CREATION_STRUCTURE_PREFIX
1305: + TYPE_TEXT_AREA + "_" + i);
1306: //
1307: inCtc.startEnclosingTableAndRowAndCell(inCts
1308: .getToggleLink());
1309: renderLine(inCtc);
1310: //
1311: HashMap nextTextAreaValueStyles = new HashMap();
1312: nextTextAreaValueStyles.put("width", ((inCtc
1313: .getColumnWidth() * 1) - 10)
1314: + "px");
1315: String nextTextAreaLabel = inCtc.createTextBox(
1316: TEXT_AREA__NEXT_TEXT_LABEL, "AREA LABEL",
1317: nextLabelTextAttrs, nextLabelTextStyles, null,
1318: null, null);
1319: String nextTextAreaValue = inCtc.createTextArea(
1320: TEXT_AREA__NEXT_TEXT_VALUE, "Bubba", null,
1321: nextTextAreaValueStyles, null, null, null);
1322: inCtc.startTable(2);
1323: inCtc.startRow();
1324: inCtc.startAndEndCell(1, nextTextAreaLabel,
1325: ConsoleTemplateContext.alignCenter(null));
1326: inCtc.startAndEndCell(1, nextTextAreaValue,
1327: ConsoleTemplateContext.alignLeft(null));
1328: inCtc.endRow();
1329: inCtc.endTable();
1330: //
1331: inCtc.endEnclosingTableAndRowAndCell();
1332: //
1333: inCts.popToggleLink();
1334:
1335: //////////////////////////////
1336: inCts.pushToggleLink(CONSOLE_CREATION_STRUCTURE_PREFIX
1337: + TYPE_INCLUSIVE_SELECT + "_" + i);
1338: //
1339: inCtc.startEnclosingTableAndRowAndCell(inCts
1340: .getToggleLink());
1341: renderLine(inCtc);
1342: //
1343: HashMap nextInclusiveSelectValueStyles = new HashMap();
1344: nextInclusiveSelectValueStyles.put("width", ((inCtc
1345: .getColumnWidth() * 1) - 10)
1346: + "px");
1347: HashMap nextInclusiveSelectOtherValueStyles = new HashMap();
1348: nextInclusiveSelectOtherValueStyles.put("width", ((inCtc
1349: .getColumnWidth() * 1) - 80)
1350: + "px");
1351: //
1352: String nextInclusiveLabel = inCtc.createTextBox(
1353: DROP_DOWN_BOX__INCLUSIVE_LABEL, "INCLUSIVE LABEL",
1354: nextLabelTextAttrs, nextLabelTextStyles, null,
1355: null, null);
1356: String nextInclusiveValue = inCtc
1357: .createDropDownBox(DROP_DOWN_BOX__INCLUSIVE_VALUE,
1358: new ArrayList(), new ArrayList(), null,
1359: nextInclusiveSelectValueStyles, 0, null,
1360: null, null);
1361: String nextInclusiveId = inCts.getPreviousToggleLink();
1362: localPsc
1363: .unregisterHeavyWeightPageComponent(nextInclusiveId);
1364: String nextInclusiveOtherValue = inCtc.createTextBox(
1365: DROP_DOWN_BOX__INCLUSIVE_OTHER_VALUE, "Bubba",
1366: null, nextInclusiveSelectOtherValueStyles, null,
1367: null, null);
1368: inCtc.startTable(2);
1369: inCtc.startRow();
1370: inCtc.startAndEndCell(1, nextInclusiveLabel,
1371: ConsoleTemplateContext.alignCenter(null));
1372: inCtc.startAndEndCell(1, nextInclusiveValue,
1373: ConsoleTemplateContext.alignLeft(null));
1374: inCtc.endRow();
1375: inCtc.startRow();
1376: inCtc.startAndEndCell(1, ConsoleTemplateContext.padNbsp(1));
1377: inCtc.startAndEndCell(1, ConsoleTemplateContext.padNbsp(3)
1378: + "Other" + ConsoleTemplateContext.padNbsp(2)
1379: + nextInclusiveOtherValue, ConsoleTemplateContext
1380: .alignLeft(null));
1381: inCtc.endRow();
1382: inCtc.endTable();
1383: //
1384: inCtc.endEnclosingTableAndRowAndCell();
1385: //
1386: inCts.popToggleLink();
1387:
1388: //////////////////////////////
1389: inCts.pushToggleLink(CONSOLE_CREATION_STRUCTURE_PREFIX
1390: + TYPE_EXCLUSIVE_SELECT + "_" + i);
1391: //
1392: inCtc.startEnclosingTableAndRowAndCell(inCts
1393: .getToggleLink());
1394: renderLine(inCtc);
1395: //
1396: HashMap nextExclusiveSelectValueStyles = new HashMap();
1397: nextExclusiveSelectValueStyles.put("width", ((inCtc
1398: .getColumnWidth() * 1) - 10)
1399: + "px");
1400: //
1401: String nextExclusiveLabel = inCtc.createTextBox(
1402: DROP_DOWN_BOX__EXCLUSIVE_LABEL, "EXCLUSIVE LABEL",
1403: nextLabelTextAttrs, nextLabelTextStyles, null,
1404: null, null);
1405: String nextExclusiveValue = inCtc
1406: .createDropDownBox(DROP_DOWN_BOX__EXCLUSIVE_VALUE,
1407: new ArrayList(), new ArrayList(), null,
1408: nextExclusiveSelectValueStyles, 0, null,
1409: null, null);
1410: String nextExclusiveId = inCts.getPreviousToggleLink();
1411: localPsc
1412: .unregisterHeavyWeightPageComponent(nextExclusiveId);
1413: inCtc.startTable(2);
1414: inCtc.startRow();
1415: inCtc.startAndEndCell(1, nextExclusiveLabel,
1416: ConsoleTemplateContext.alignCenter(null));
1417: inCtc.startAndEndCell(1, nextExclusiveValue,
1418: ConsoleTemplateContext.alignLeft(null));
1419: inCtc.endRow();
1420: inCtc.endTable();
1421: //
1422: inCtc.endEnclosingTableAndRowAndCell();
1423: //
1424: inCts.popToggleLink();
1425:
1426: //////////////////////////////
1427: inCts.pushToggleLink(CONSOLE_CREATION_STRUCTURE_PREFIX
1428: + TYPE_FILE_UPLOAD + "_" + i);
1429: //
1430: inCtc.startEnclosingTableAndRowAndCell(inCts
1431: .getToggleLink());
1432: renderLine(inCtc);
1433: //
1434: //HashMap nextFileUploadValueStyles = new HashMap();
1435: //nextTextBoxValueStyles.put(
1436: // "width", ((inCtc.getColumnWidth()*1) - 10) + "px");
1437: //
1438: String nextFileUploadLabel = inCtc.createTextBox(
1439: FILE_UPLOAD__NEXT_TEXT_LABEL, "BOX LABEL",
1440: nextLabelTextAttrs, nextLabelTextStyles, null,
1441: null, null);
1442: String nextFileUploadValue = inCtc.createFileUpload(
1443: FILE_UPLOAD__NEXT_TEXT_VALUE, new Integer(3));
1444: inCtc.startTable(2);
1445: inCtc.startRow();
1446: inCtc.startAndEndCell(1, nextFileUploadLabel,
1447: ConsoleTemplateContext.alignCenter(null));
1448: inCtc.startAndEndCell(1, nextFileUploadValue,
1449: ConsoleTemplateContext.alignLeft(null));
1450: inCtc.endRow();
1451: inCtc.endTable();
1452: //
1453: inCtc.endEnclosingTableAndRowAndCell();
1454: //
1455: inCts.popToggleLink();
1456:
1457: //////////////////////////////
1458: inCts.pushToggleLink(CONSOLE_CREATION_STRUCTURE_PREFIX
1459: + TYPE_HIDDEN_BOX + "_" + i);
1460: //
1461: //inCtc.startEnclosingTableAndRowAndCell(inCts.getToggleLink());
1462: //renderLine(inCtc);
1463: //
1464: //HashMap nextHiddenBoxValueStyles = new HashMap();
1465: //nextHiddenBoxValueStyles.put(
1466: // "width", ((inCtc.getColumnWidth()*1) - 10) + "px");
1467: //
1468: //String nextHiddenBoxLabel = inCtc.createTextBox(
1469: // HIDDEN_BOX__NEXT_TEXT_LABEL, "BOX LABEL",
1470: // nextLabelTextAttrs, nextLabelTextStyles, null, null, null);
1471: String nextHiddenBoxValue = inCtc.createHiddenField(
1472: HIDDEN_BOX__NEXT_TEXT_VALUE, "Bubba", null);
1473: //inCtc.startTable(2);
1474: //inCtc.startRow();
1475: //inCtc.startAndEndCell(1, nextHiddenBoxLabel,
1476: // inCtc.alignCenter(null));
1477: inCtc.simpleAndPrint(nextHiddenBoxValue);
1478: //inCtc.startAndEndCell(1, nextHiddenBoxValue,
1479: // inCtc.alignLeft(null));
1480: //inCtc.endRow();
1481: //inCtc.endTable();
1482: //
1483: //inCtc.endEnclosingTableAndRowAndCell();
1484: //
1485: inCts.popToggleLink();
1486: }
1487:
1488: //
1489: //
1490: //
1491: renderLine(inCtc);
1492: //
1493: inCts.pushToggleLink(CONSOLE_CREATION_SUBMIT_ONE);
1494: //
1495: inCtc.startEnclosingTableAndRowAndCell(null, inCts
1496: .getToggleLink());
1497: inCtc.startTable(2);
1498: inCtc.startRow();
1499: inCtc.startCell(1, ConsoleTemplateContext.alignCenter(null));
1500: inCtc.createButton(BUTTON__CREATE, "Continue",
1501: new Integer(100),
1502: "eval(renderConceptTagCreationAction)", null, null,
1503: null, null);
1504: inCtc.endCell();
1505: inCtc.startCell(1, ConsoleTemplateContext.alignCenter(null));
1506: inCtc.createButton(BUTTON__CANCEL, "Cancel", new Integer(100),
1507: "closeSection('" + getBaseId() + "')", null, null,
1508: null, null);
1509: inCtc.endCell();
1510: inCtc.endRow();
1511: inCtc.endTable();
1512: //
1513: renderLine(inCtc);
1514: //
1515: inCtc.endEnclosingTableAndRowAndCell();
1516: //
1517: inCts.popToggleLink();
1518: //
1519: //
1520: //
1521: //
1522: inCts.pushToggleLink(CONSOLE_CREATION_SUBMIT_TWO);
1523: ////
1524: inCtc.startEnclosingTableAndRowAndCell(null, inCts
1525: .getToggleLink());
1526: inCtc.startTable(2);
1527: inCtc.startRow();
1528: inCtc.startCell(2, ConsoleTemplateContext.alignCenter(null));
1529: inCtc.createButton(BUTTON__CANCEL, "Cancel", new Integer(100),
1530: getCancelText(), null, null, null, null);
1531: inCtc.endCell();
1532: inCtc.endRow();
1533: inCtc.endTable();
1534: //
1535: renderLine(inCtc);
1536: //
1537: inCtc.endEnclosingTableAndRowAndCell();
1538: ////
1539: //
1540: inCts.popToggleLink();
1541: //
1542: //
1543: //
1544:
1545: //
1546: //
1547:
1548: inCtc.endEnclosingTableAndRowAndCell();
1549: //
1550: //inCts.popToggleLink();
1551: //inCts.popToggleLink();
1552: }
1553:
1554: private final static void renderLine(ConsoleTemplateContext inCtc)
1555: throws IOException {
1556: //
1557: inCtc.startTable(2);
1558: inCtc.startRow();
1559: inCtc.startAndEndCell(2, inCtc.createHorizontalRow(2,
1560: new Integer(10)), ConsoleTemplateContext
1561: .alignCenter(null));
1562: inCtc.endRow();
1563: inCtc.endTable();
1564: }
1565: }
|