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.console.base;
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.tagging.ConceptTagMenuBranch;
0018: import org.jfolder.common.tagging.ConceptTagPreferences;
0019: import org.jfolder.common.tagging.RootConceptTagHolder;
0020: import org.jfolder.common.tagging.StudioConceptTagCreParInfoContextHolder;
0021: import org.jfolder.common.tagging.StudioConceptTagUsabilityContext;
0022: import org.jfolder.common.utils.misc.CommonSeparators;
0023: import org.jfolder.common.utils.xml.XMLHelper;
0024: import org.jfolder.common.web.template.ConsoleParameterContext;
0025: import org.jfolder.common.web.template.ConsoleTemplateContext;
0026: import org.jfolder.common.web.template.ConsoleTemplateSession;
0027: import org.jfolder.common.web.template.CreationParameterContext;
0028: import org.jfolder.common.web.template.MenuBranch;
0029: import org.jfolder.common.web.template.MenuLeaf;
0030: import org.jfolder.common.web.template.PageSetupContext;
0031: import org.jfolder.common.web.template.SubmitActionContext;
0032: import org.jfolder.common.web.template.SubmitActionParameters;
0033: import org.jfolder.console.view.base.PopUpViewHelper;
0034:
0035: //other classes
0036:
0037: public abstract class StudioPageContext extends ConsolePageContext {
0038:
0039: //
0040: public final static String MENU__CONCEPT_TAG = "MENU__CONCEPT_TAG";
0041: //
0042: public final static String MENU__STUDIO_USABILITY = "MENU__STUDIO_USABILITY";
0043: public final static String MENU__STUDIO_SELECTION = "MENU__STUDIO_SELECTION";
0044:
0045: //
0046: protected StudioPageContext(ConsolePageSession inCps) {
0047: //
0048: super (inCps);
0049: //
0050: }
0051:
0052: //
0053: protected StudioPageContext(ConsolePageContext inCpc, String inName) {
0054: //
0055: super (inCpc, inName);
0056: //
0057: }
0058:
0059: protected final void generateStudioUsabilityComponents()
0060: throws IOException {
0061: //
0062: if (isMetaMode()) {
0063: //
0064: ConsolePageSession localCps = getConsolePageSession();
0065: PageSetupContext localPsc = localCps.getPageSetupContext();
0066: //
0067: RootConceptTagHolder localRcth = getConsolePageSession()
0068: .getCurrentApplicationRootHolder();
0069: ConceptTagPreferences localCtp = localRcth.getPreferences();
0070: //
0071: //
0072: //create full concept-tag menu
0073: ConceptTagMenuBranch ctmb = localCtp.getMenuBase();
0074: // ConceptTagMenuBranch.qualifyNodes(
0075: // localCtp.getMenuBase(),
0076: // localCtp.getSetHolder(),
0077: // dtcot.getValidator());
0078: //
0079: MenuBranch studioUsabilityMb = ConsolePageHelper
0080: .constructMenu(ctmb, localCtp.getSetHolder(), this ,
0081: localCtp);
0082: //MiscHelper.println("3 = "
0083: // + (new java.util.Date()).toString());
0084: //getConsolePageSession().pushToggleLink("0_MENU");
0085: //
0086: HashMap tableAttrs = new HashMap();
0087: tableAttrs.put("width", "175");
0088: HashMap cellAttrs = new HashMap();
0089: cellAttrs.put("width", "175");
0090: HashMap cellStyles = new HashMap();
0091: cellStyles.put("font-size", "8pt");
0092: //
0093: String studioUsabilityId = getMenu(localCps,
0094: MENU__STUDIO_USABILITY, studioUsabilityMb,
0095: tableAttrs, null, cellAttrs, cellStyles,
0096: new Integer(30), ctmb);
0097: localPsc.setStudioUsabilityId(studioUsabilityId);
0098: //
0099: //create constraint selection menu
0100: //
0101: //create constraint-holder selection menu
0102: //
0103: MenuBranch studioSelectionMb = generateStudioSelectionMenu();
0104: //
0105: String studioSelectionId = getMenu(localCps,
0106: MENU__STUDIO_SELECTION, studioSelectionMb, null,
0107: null, null, null, new Integer(15), null);
0108: localPsc.setStudioSelectionId(studioSelectionId);
0109: }
0110: }
0111:
0112: //
0113: //
0114: private final static MenuBranch generateStudioSelectionMenu() {
0115:
0116: MenuBranch outValue = MenuBranch.newInstance("Root");
0117:
0118: //
0119: MenuLeaf goToMb = MenuLeaf.newInstance("Go To",
0120: "studioDirectGoTo()");
0121: outValue.add(goToMb);
0122: //
0123: MenuLeaf replaceMb = MenuLeaf.newInstance("Replace",
0124: "studioCallConstraintSacForReplace()");
0125: outValue.add(replaceMb);
0126: //
0127: MenuLeaf insertBeforeMb = MenuLeaf.newInstance("Insert Before",
0128: "studioCallConstraintSacForPrevious()");
0129: outValue.add(insertBeforeMb);
0130: //
0131: MenuLeaf insertAfterMb = MenuLeaf.newInstance("Insert After",
0132: "studioCallConstraintSacForNext()");
0133: outValue.add(insertAfterMb);
0134: //
0135: MenuLeaf deleteMb = MenuLeaf.newInstance("Delete",
0136: "studioCallConstraintSacForDelete()");
0137: outValue.add(deleteMb);
0138: //
0139: MenuLeaf copyMb = MenuLeaf.newInstance("Copy",
0140: "studioCallCopyStaticOrDynamic()");
0141: outValue.add(copyMb);
0142: //
0143: MenuLeaf pasteBeforeMb = MenuLeaf.newInstance("Paste Before",
0144: "studioCallPasteForPrevious()");
0145: outValue.add(pasteBeforeMb);
0146: //
0147: MenuLeaf pasteReplaceMb = MenuLeaf.newInstance("Paste Replace",
0148: "studioCallPasteForReplace()");
0149: outValue.add(pasteReplaceMb);
0150: //
0151: MenuLeaf pasteAfterMb = MenuLeaf.newInstance("Paste After",
0152: "studioCallPasteForNext()");
0153: outValue.add(pasteAfterMb);
0154: //
0155: MenuLeaf viewEarmarksMb = MenuLeaf.newInstance("View Earmarks",
0156: "openWebPageViewPopUp(studioEarmarkId);"
0157: + " stopEventPropogation(event);");
0158: outValue.add(viewEarmarksMb);
0159: //
0160: MenuLeaf viewErrorsMb = MenuLeaf.newInstance("View Errors",
0161: "openWebPageViewPopUp(studioErrorId);"
0162: + " stopEventPropogation(event);");
0163: outValue.add(viewErrorsMb);
0164: //
0165: MenuLeaf menuMb = MenuLeaf.newInstance("Menu",
0166: "renderMenuNode(" + "getStudioMenuId(), "
0167: + "getTrueOffsetTop(this), "
0168: + "getTrueOffsetLeft(this), "
0169: + "this.offsetWidth);"
0170: + " stopEventPropogation(event);");
0171: outValue.add(menuMb);
0172: //
0173: MenuLeaf insertFirstChildMb = MenuLeaf.newInstance(
0174: "Insert Child", "studioCallSubConstraintSacForFirst()");
0175: //"Insert First Child", "studioCallSubConstraintSacForFirst()");
0176: outValue.add(insertFirstChildMb);
0177: //
0178: MenuLeaf insertLastChildMb = MenuLeaf.newInstance(
0179: "Insert Last Child",
0180: "studioCallSubConstraintSacForLast()");
0181: outValue.add(insertLastChildMb);
0182: //
0183: //
0184: //
0185: //
0186: MenuLeaf diagHandleMb = MenuLeaf.newInstance("Diag Handle",
0187: "alert(studioConstraintParentHandle);");
0188: outValue.add(diagHandleMb);
0189: //
0190: MenuLeaf diagIndexMb = MenuLeaf.newInstance("Diag Index",
0191: "alert(studioConstraintIndex);");
0192: outValue.add(diagIndexMb);
0193: //
0194: MenuLeaf diagSelectorIndexMb = MenuLeaf.newInstance(
0195: "Diag Selector", "alert(studioParentSelectorIndex);");
0196: outValue.add(diagSelectorIndexMb);
0197: //
0198: MenuLeaf diagSacIndexMb = MenuLeaf.newInstance("Diag Sac",
0199: "alert(studioParentSacIndex);");
0200: outValue.add(diagSacIndexMb);
0201: //
0202: MenuLeaf diagCrpcIndexMb = MenuLeaf.newInstance("Diag Crpc",
0203: "alert(studioParentCrpcIndex);");
0204: outValue.add(diagCrpcIndexMb);
0205:
0206: return outValue;
0207: }
0208:
0209: //
0210: //
0211: //
0212: protected void startAndEndEnhancedStudioFunctions()
0213: throws IOException {
0214: //
0215: //
0216: //
0217: startAndEndGeneralStudioFunctions();
0218: startAndEndGoToStudioFunctions();
0219: startAndEndCopyStudioFunctions();
0220: startAndEndSelectConceptTagStudioFunctions();
0221: startAndEndSelectCompoundStudioFunctions();
0222: startAndEndIdStudioFunctions();
0223: startAndEndMenuStudioFunctions();
0224: startAndEndPopUpStudioFunctions();
0225: startAndEndMenuInitializationStudioFunctions();
0226: //
0227: //
0228: //
0229: //
0230: startAndEndStudioUsabilityFunctions();
0231: startAndEndVariableSphereFunctions();
0232: startAndEndConceptTagSelectionFunctions();
0233: startAndEndConstraintSacsFunctions();
0234: startAndEndCreationParameterFunction();
0235: startAndEndPasteStudioFunctions();
0236: //
0237: }
0238:
0239: //
0240: //
0241: //
0242: private void startAndEndPasteStudioFunctions() throws IOException {
0243: //
0244: SubmitActionContext pastePreviousSac = SubmitActionContext
0245: .newInstance(this );
0246: //
0247: pastePreviousSac.addAction(ConsoleParameterContext.FIRST_INPUT,
0248: singleQuotes(SubmitActionParameters.PASTE));
0249: pastePreviousSac.addAction(
0250: ConsoleParameterContext.SECOND_INPUT,
0251: singleQuotes(SubmitActionParameters.ADD));
0252: //
0253: pastePreviousSac.addParameter(
0254: ConsoleParameterContext.FIRST_INPUT,
0255: "studioConstraintSacHandle");
0256: pastePreviousSac.addParameter(
0257: ConsoleParameterContext.SECOND_INPUT,
0258: "studioConstraintSacIndex");
0259: //
0260: printAndIndent("function studioCallPasteForPrevious() {");
0261: simpleAndPrint("studioConstraintSacHandle = studioConstraintParentHandle;");
0262: simpleAndPrint("studioConstraintSacIndex = studioConstraintIndex;");
0263: simpleAndPrint(pastePreviousSac.submitActionCall(true));
0264: revertAndPrint("}");
0265: //
0266: //
0267: //
0268: //
0269: //
0270: //
0271: SubmitActionContext pasteReplaceSac = SubmitActionContext
0272: .newInstance(this );
0273: pasteReplaceSac.addAction(ConsoleParameterContext.FIRST_INPUT,
0274: singleQuotes(SubmitActionParameters.PASTE));
0275: pasteReplaceSac.addAction(ConsoleParameterContext.SECOND_INPUT,
0276: singleQuotes(SubmitActionParameters.REPLACE));
0277: //
0278: pasteReplaceSac.addParameter(
0279: ConsoleParameterContext.FIRST_INPUT,
0280: "studioConstraintSacHandle");
0281: pasteReplaceSac.addParameter(
0282: ConsoleParameterContext.SECOND_INPUT,
0283: "studioConstraintSacIndex");
0284: //
0285: printAndIndent("function studioCallPasteForReplace() {");
0286: simpleAndPrint("studioConstraintSacHandle = studioConstraintParentHandle;");
0287: simpleAndPrint("studioConstraintSacIndex = studioConstraintIndex;");
0288: simpleAndPrint(pasteReplaceSac.submitActionCall(true));
0289: revertAndPrint("}");
0290: //
0291: //
0292: //
0293: //
0294: //
0295: //
0296: //
0297: //
0298: SubmitActionContext pasteNextSac = SubmitActionContext
0299: .newInstance(this );
0300: //
0301: pasteNextSac.addAction(ConsoleParameterContext.FIRST_INPUT,
0302: singleQuotes(SubmitActionParameters.PASTE));
0303: pasteNextSac.addAction(ConsoleParameterContext.SECOND_INPUT,
0304: singleQuotes(SubmitActionParameters.ADD));
0305: //
0306: pasteNextSac.addParameter(ConsoleParameterContext.FIRST_INPUT,
0307: "studioConstraintSacHandle");
0308: pasteNextSac.addParameter(ConsoleParameterContext.SECOND_INPUT,
0309: "studioConstraintSacIndex");
0310: //
0311: printAndIndent("function studioCallPasteForNext() {");
0312: simpleAndPrint("studioConstraintSacHandle = studioConstraintParentHandle;");
0313: simpleAndPrint("studioConstraintSacIndex = studioConstraintIndex + 1;");
0314: simpleAndPrint(pasteNextSac.submitActionCall(true));
0315: revertAndPrint("}");
0316: //
0317: }
0318:
0319: private void startAndEndGeneralStudioFunctions() throws IOException {
0320: //
0321: ConsolePageSession localCps = getConsolePageSession();
0322: //PageSetupContext localPsc = localCps.getPageSetupContext();
0323: RootConceptTagHolder localRcth = localCps
0324: .getCurrentApplicationRootHolder();
0325: ConceptTagPreferences localCtp = localRcth.getPreferences();
0326: //
0327: printAndIndent("function studioGetHanConj() {");
0328: simpleAndPrint("return '" + localCtp.getHandleConjunction()
0329: + "';");
0330: revertAndPrint("}");
0331: }
0332:
0333: private void startAndEndGoToStudioFunctions() throws IOException {
0334: //
0335: SubmitActionContext moveSac = SubmitActionContext
0336: .newInstance(this );
0337: moveSac.addAction(ConsoleParameterContext.FIRST_INPUT,
0338: singleQuotes(SubmitActionParameters.MOVE));
0339: //
0340: moveSac.addParameter(ConsoleParameterContext.FIRST_INPUT,
0341: "inDestination");
0342: //
0343: printAndIndent("function studioDirectGoTo() {");
0344: simpleAndPrint("studioGoTo(studioConstraintParentHandle");
0345: insertAndPrint("+ studioGetHanConj() + studioConstraintIndex);");
0346: revertAndPrint("}");
0347: printAndIndent("function studioGoTo(inDestination) {");
0348: simpleAndPrint(moveSac.submitActionCall(true));
0349: //simpleAndPrint("return " + this.psc.isReplayMode() + ";");
0350: revertAndPrint("}");
0351: }
0352:
0353: private void startAndEndCopyStudioFunctions() throws IOException {
0354: //
0355: SubmitActionContext copySac = SubmitActionContext
0356: .newInstance(this );
0357: copySac.addAction(ConsoleParameterContext.FIRST_INPUT,
0358: singleQuotes(SubmitActionParameters.COPY));
0359: //
0360: copySac.addParameter(ConsoleParameterContext.FIRST_INPUT,
0361: "studioConstraintSacHandle");
0362: copySac.addParameter(ConsoleParameterContext.SECOND_INPUT,
0363: "studioConstraintSacIndex");
0364: //
0365: printAndIndent("function studioCallCopyStaticOrDynamic() {");
0366: simpleAndPrint("studioConstraintSacHandle = studioConstraintParentHandle;");
0367: simpleAndPrint("studioConstraintSacIndex = studioConstraintIndex;");
0368: simpleAndPrint(copySac.submitActionCall(true));
0369: revertAndPrint("}");
0370: }
0371:
0372: private void startAndEndSelectConceptTagStudioFunctions()
0373: throws IOException {
0374: //
0375: SubmitActionContext createConceptTagSac = SubmitActionContext
0376: .newInstance(this );
0377: //
0378: createConceptTagSac.addAction(
0379: ConsoleParameterContext.FIRST_INPUT,
0380: "studioConstraintSacAction");
0381: createConceptTagSac
0382: .addAction(
0383: ConsoleParameterContext.SECOND_INPUT,
0384: ConsoleTemplateContext
0385: .singleQuotes(SubmitActionParameters.CONCEPT_TAG));
0386: //
0387: createConceptTagSac.addParameter(
0388: ConsoleParameterContext.FIRST_INPUT,
0389: "studioConstraintSacHandle");
0390: createConceptTagSac.addParameter(
0391: ConsoleParameterContext.SECOND_INPUT,
0392: "studioConstraintSacIndex");
0393: createConceptTagSac.addParameter(
0394: ConsoleParameterContext.THIRD_INPUT, "inNs");
0395: createConceptTagSac.addParameter(
0396: ConsoleParameterContext.FOURTH_INPUT, "inName");
0397: //
0398: //
0399: simpleAndPrint("var studioSelectConceptTagSac = null;");
0400: printAndIndent("function studioSelectConceptTag("
0401: + "inNs, inName, inScpchIndex) {");
0402: simpleAndPrint("var scpchCpc = determineCreationParameter(inScpchIndex);");
0403: //
0404: String createConceptTagCall = createConceptTagSac
0405: .submitActionCall(true);
0406: //
0407: printAndIndent("if (scpchCpc != null) {");
0408: simpleAndPrint("studioSelectConceptTagSac = '"
0409: + XMLHelper.fromStringToJSCData(createConceptTagCall)
0410: + "';");
0411: simpleAndPrint("eval(scpchCpc);");
0412: revertAndPrint("}");
0413: printAndIndent("else {");
0414: simpleAndPrint(createConceptTagCall);
0415: revertAndPrint("}");
0416: revertAndPrint("}");
0417: }
0418:
0419: private void startAndEndSelectCompoundStudioFunctions()
0420: throws IOException {
0421: //
0422: SubmitActionContext createCompoundSac = SubmitActionContext
0423: .newInstance(this );
0424: //
0425: createCompoundSac.addAction(
0426: ConsoleParameterContext.FIRST_INPUT,
0427: "studioConstraintSacAction");
0428: createCompoundSac.addAction(
0429: ConsoleParameterContext.SECOND_INPUT,
0430: ConsoleTemplateContext
0431: .singleQuotes(SubmitActionParameters.COMPOUND));
0432: //
0433: createCompoundSac.addParameter(
0434: ConsoleParameterContext.FIRST_INPUT,
0435: "studioConstraintSacHandle");
0436: createCompoundSac.addParameter(
0437: ConsoleParameterContext.SECOND_INPUT,
0438: "studioConstraintSacIndex");
0439: //
0440: //
0441: simpleAndPrint("var studioSelectCompoundSac = null;");
0442: simpleAndPrint("var studioSelectCompoundScpch = 0;");
0443: printAndIndent("function studioSelectCompound() {");
0444: simpleAndPrint("var scpchCpc = determineCreationParameter(");
0445: insertAndPrint("studioSelectCompoundScpch);");
0446: //
0447: String createCompoundCall = createCompoundSac
0448: .submitActionCall(true);
0449: //
0450: printAndIndent("if (scpchCpc != null) {");
0451: simpleAndPrint("studioSelectCompoundSac = '"
0452: + XMLHelper.fromStringToJSCData(createCompoundCall)
0453: + "';");
0454: simpleAndPrint("eval(scpchCpc);");
0455: revertAndPrint("}");
0456: printAndIndent("else {");
0457: simpleAndPrint(createCompoundCall);
0458: revertAndPrint("}");
0459: revertAndPrint("}");
0460: }
0461:
0462: protected abstract String getStudioMenuId();
0463:
0464: private void startAndEndIdStudioFunctions() throws IOException {
0465: //
0466: ConsolePageSession localCps = getConsolePageSession();
0467: PageSetupContext localPsc = localCps.getPageSetupContext();
0468: //
0469: printAndIndent("function getStudioMenuId() {");
0470: if (getStudioMenuId() != null) {
0471: simpleAndPrint("return '" + getStudioMenuId() + "';");
0472: } else {
0473: simpleAndPrint("return null;");
0474: }
0475: revertAndPrint("}");
0476: //
0477: //
0478: printAndIndent("function getStudioSelectionId() {");
0479: simpleAndPrint("return '" + localPsc.getStudioSelectionId()
0480: + "';");
0481: revertAndPrint("}");
0482: //
0483: printAndIndent("function getStudioUsabilityId() {");
0484: simpleAndPrint("return '" + localPsc.getStudioUsabilityId()
0485: + "';");
0486: revertAndPrint("}");
0487: //
0488: //
0489: //
0490: //
0491: //
0492: printAndIndent("function getSubMenuId(inId, inIndex) {");
0493: simpleAndPrint("return inId + '"
0494: + CommonSeparators.TOGGLE_LINK_SEPARATOR
0495: + "' + inIndex;");
0496: revertAndPrint("}");
0497: printAndIndent("function getMenuBranchId(inId, inIndex) {");
0498: simpleAndPrint("return inId + '"
0499: + CommonSeparators.TOGGLE_LINK_SEPARATOR + "' + '"
0500: + ConsoleTemplateSession.getMenuItemPartName()
0501: + "' + '" + CommonSeparators.TOGGLE_LINK_SEPARATOR
0502: + "' + inIndex;");
0503: revertAndPrint("}");
0504: }
0505:
0506: private void startAndEndMenuStudioFunctions() throws IOException {
0507: //
0508: simpleAndPrint("//");
0509: simpleAndPrint("var studioConstraintParentHandle = null;");
0510: simpleAndPrint("var studioConstraintIndex = 0;");
0511: simpleAndPrint("//");
0512: simpleAndPrint("var studioSubConstraintName = null;");
0513: simpleAndPrint("var studioSubConstraintSize = 0;");
0514: simpleAndPrint("//");
0515: simpleAndPrint("var studioParentSelectorIndex = 0;");
0516: simpleAndPrint("var studioParentSacIndex = 0;");
0517: simpleAndPrint("var studioParentCrpcIndex = 0;");
0518: simpleAndPrint("//");
0519: simpleAndPrint("var studioChildSelectorIndex = 0;");
0520: simpleAndPrint("var studioChildSacIndex = 0;");
0521: simpleAndPrint("var studioChildCrpcIndex = 0;");
0522: simpleAndPrint("//");
0523: simpleAndPrint("var studioEarmarkId = null;");
0524: simpleAndPrint("var studioErrorId = null;");
0525: simpleAndPrint("//");
0526: printAndIndent("function studioInitParentSac() {");
0527: simpleAndPrint("studioInitSac(");
0528: insertAndPrint("studioParentSelectorIndex, studioParentSacIndex,");
0529: insertAndPrint("studioParentCrpcIndex);");
0530: simpleAndPrint("studioSelectCompoundScpch = studioParentCrpcIndex;");
0531: revertAndPrint("}");
0532: simpleAndPrint("//");
0533: printAndIndent("function studioInitChildSac() {");
0534: simpleAndPrint("studioInitSac(");
0535: insertAndPrint("studioChildSelectorIndex, studioChildSacIndex,");
0536: insertAndPrint("studioChildCrpcIndex);");
0537: simpleAndPrint("studioSelectCompoundScpch = studioChildCrpcIndex;");
0538: revertAndPrint("}");
0539: simpleAndPrint("//");
0540: printAndIndent("function studioInitSac(");
0541: simpleAndPrint("inSelectorIndex, inSacIndex, inCrpcIndex) {");
0542: simpleAndPrint("//");
0543: simpleAndPrint("estabilishConceptTagSelector(inSelectorIndex);");
0544: simpleAndPrint("estabilishConstraintSac(inSacIndex);");
0545: simpleAndPrint("estabilishCreationParameter(inCrpcIndex);");
0546: printAndIndent("if (studioConceptTagSelector != null) {");
0547: simpleAndPrint("studioMenuInitialization("
0548: + "getStudioUsabilityId(), studioConceptTagSelector);");
0549: revertAndPrint("}");
0550: revertAndPrint("}");
0551: simpleAndPrint("//");
0552: simpleAndPrint("//");
0553: printAndIndent("function openStudioSelection(");
0554: simpleAndPrint("inEvent, inSource, inBlockClear,");
0555: simpleAndPrint("inParentHandle, inIndex,");
0556: simpleAndPrint("inCtconMin, inCtconMax, inCtconCurrentSize,");
0557: simpleAndPrint("inUseCopy, inUsePaste, inEarmarkId, inErrorId,");
0558: simpleAndPrint("inDefaultConstraint, inDefaultConstraintCount,");
0559: simpleAndPrint("inChildSelectorIndex, inChildSacIndex, inChildCrpcIndex,");
0560: simpleAndPrint("inParentSelectorIndex, inParentSacIndex, inParentCrpcIndex) {");
0561: simpleAndPrint("//");
0562: simpleAndPrint("var outValue = true;");
0563: simpleAndPrint("//");
0564: simpleAndPrint("setAllowBlockOfWebPageViewPopUpClear(inBlockClear);");
0565: simpleAndPrint("//");
0566: simpleAndPrint("studioConstraintParentHandle = inParentHandle;");
0567: simpleAndPrint("studioConstraintIndex = inIndex;");
0568: simpleAndPrint("//");
0569: simpleAndPrint("studioSubConstraintName = inDefaultConstraint;");
0570: simpleAndPrint("studioSubConstraintSize = inDefaultConstraintCount;");
0571: simpleAndPrint("//");
0572: simpleAndPrint("studioChildSelectorIndex = inChildSelectorIndex;");
0573: simpleAndPrint("studioChildSacIndex = inChildSacIndex;");
0574: simpleAndPrint("studioChildCrpcIndex = inChildCrpcIndex;");
0575: simpleAndPrint("//");
0576: simpleAndPrint("studioParentSelectorIndex = inParentSelectorIndex;");
0577: simpleAndPrint("studioParentSacIndex = inParentSacIndex;");
0578: simpleAndPrint("studioParentCrpcIndex = inParentCrpcIndex;");
0579: simpleAndPrint("//");
0580: simpleAndPrint("studioEarmarkId = inEarmarkId;");
0581: simpleAndPrint("studioErrorId = inErrorId;");
0582: simpleAndPrint("//");
0583: //
0584: //
0585: simpleAndPrint("var menuCode = '';");
0586: //
0587: //
0588: //
0589: //
0590: //
0591: //simpleAndPrint("menuCode = menuCode + getMenuBranchDisplayCode("
0592: // + MENU_OPT__GO_TO + ");");
0593: //
0594: //
0595: printAndIndent("if (studioSubConstraintName == null) {");
0596: //
0597: simpleAndPrint("menuCode = menuCode + getMenuBranchDisplayCode("
0598: + PopUpViewHelper.MENU_OPT__REPLACE + ");");
0599: printAndIndent("if (inCtconMax == -1 || (inCtconCurrentSize < inCtconMax)) {");
0600: //printAndIndent("if (studioConstraintIndex > 0) {");
0601: simpleAndPrint("menuCode = menuCode + getMenuBranchDisplayCode("
0602: + PopUpViewHelper.MENU_OPT__INSERT_BEFORE + ");");
0603: //revertAndPrint("}");
0604: simpleAndPrint("menuCode = menuCode + getMenuBranchDisplayCode("
0605: + PopUpViewHelper.MENU_OPT__INSERT_AFTER + ");");
0606: revertAndPrint("}");
0607: printAndIndent("if (inCtconCurrentSize > inCtconMin) {");
0608: simpleAndPrint("menuCode = menuCode + getMenuBranchDisplayCode("
0609: + PopUpViewHelper.MENU_OPT__DELETE + ");");
0610: revertAndPrint("}");
0611: //
0612: printAndIndent("if (inUseCopy) {");
0613: simpleAndPrint("menuCode = menuCode + getMenuBranchDisplayCode("
0614: + PopUpViewHelper.MENU_OPT__COPY + ");");
0615: revertAndPrint("}");
0616: //
0617: printAndIndent("if (inUsePaste) {");
0618: simpleAndPrint("menuCode = menuCode + getMenuBranchDisplayCode("
0619: + PopUpViewHelper.MENU_OPT__PASTE_REPLACE + ");");
0620: printAndIndent("if (inCtconMax == -1 || (inCtconCurrentSize < inCtconMax)) {");
0621: simpleAndPrint("menuCode = menuCode + getMenuBranchDisplayCode("
0622: + PopUpViewHelper.MENU_OPT__PASTE_BEFORE + ");");
0623: simpleAndPrint("menuCode = menuCode + getMenuBranchDisplayCode("
0624: + PopUpViewHelper.MENU_OPT__PASTE_AFTER + ");");
0625: revertAndPrint("}");
0626: revertAndPrint("}");
0627: //
0628: //
0629: printAndIndent("if (studioEarmarkId != null) {");
0630: simpleAndPrint("menuCode = menuCode + getMenuBranchDisplayCode("
0631: + PopUpViewHelper.MENU_OPT__VIEW_EARMARKS + ");");
0632: revertAndPrint("}");
0633: printAndIndent("if (studioErrorId != null) {");
0634: simpleAndPrint("menuCode = menuCode + getMenuBranchDisplayCode("
0635: + PopUpViewHelper.MENU_OPT__VIEW_ERRORS + ");");
0636: revertAndPrint("}");
0637: //
0638: revertAndPrint("}");
0639: //
0640: //
0641: //
0642: //
0643: //
0644: //
0645: //
0646: printAndIndent("if (getStudioMenuId() != null) {");
0647: simpleAndPrint("menuCode = menuCode + getMenuBranchDisplayCode("
0648: + PopUpViewHelper.MENU_OPT__MENU + ");");
0649: revertAndPrint("}");
0650: printAndIndent("if (studioSubConstraintName != null) {");
0651: simpleAndPrint("menuCode = menuCode + getMenuBranchDisplayCode("
0652: + PopUpViewHelper.MENU_OPT__INSERT_FIRST_CHILD + ");");
0653: //simpleAndPrint("menuCode = menuCode + getMenuBranchDisplayCode("
0654: // + MENU_OPT__INSERT_LAST_CHILD + ");");
0655: revertAndPrint("}");
0656: //
0657: simpleAndPrint("menuCode = menuCode + getMenuBranchDisplayCode("
0658: + PopUpViewHelper.MENU_OPT__DIAG_HANDLE + ");");
0659: simpleAndPrint("menuCode = menuCode + getMenuBranchDisplayCode("
0660: + PopUpViewHelper.MENU_OPT__DIAG_INDEX + ");");
0661: simpleAndPrint("menuCode = menuCode + getMenuBranchDisplayCode("
0662: + PopUpViewHelper.MENU_OPT__DIAG_SELECTOR + ");");
0663: simpleAndPrint("menuCode = menuCode + getMenuBranchDisplayCode("
0664: + PopUpViewHelper.MENU_OPT__DIAG_SAC + ");");
0665: simpleAndPrint("menuCode = menuCode + getMenuBranchDisplayCode("
0666: + PopUpViewHelper.MENU_OPT__DIAG_CRPC + ");");
0667: //
0668: simpleAndPrint("studioSelectionMenuInitialization(menuCode);");
0669: //
0670: simpleAndPrint("//");
0671: simpleAndPrint("var sourceOffsetX = 0;");
0672: simpleAndPrint("var sourceOffsetY = 0;");
0673: //
0674: printAndIndent("if (isMacroActive()) {");
0675: simpleAndPrint("sourceOffsetX = getTrueOffsetLeft("
0676: + "getPageComponent(macroGoToSourceId));");
0677: simpleAndPrint("sourceOffsetY = getTrueOffsetTop("
0678: + "getPageComponent(macroGoToSourceId));");
0679: revertAndPrint("}");
0680: //
0681: printAndIndent("else if (isIE()) {");
0682: simpleAndPrint("sourceOffsetX = inEvent.screenX - window.screenLeft"
0683: + " + document.body.scrollLeft;");
0684: simpleAndPrint("sourceOffsetY = inEvent.screenY - window.screenTop"
0685: + " + document.body.scrollTop;");
0686: revertAndPrint("}");
0687: //
0688: printAndIndent("else {");
0689: simpleAndPrint("sourceOffsetX = inEvent.pageX;");
0690: simpleAndPrint("sourceOffsetY = inEvent.pageY;");
0691: revertAndPrint("}");
0692: //
0693: simpleAndPrint("var resultSourceOffSetY = sourceOffsetY - 10;");
0694: printAndIndent("if (resultSourceOffSetY < 0) {");
0695: simpleAndPrint("resultSourceOffSetY = 0;");
0696: revertAndPrint("}");
0697: simpleAndPrint("var resultSourceOffSetX = sourceOffsetX - 10;");
0698: printAndIndent("if (resultSourceOffSetX < 0) {");
0699: simpleAndPrint("resultSourceOffSetX = 0;");
0700: revertAndPrint("}");
0701: //
0702: simpleAndPrint("renderMenuNode(");
0703: insertAndPrint("getStudioSelectionId(), resultSourceOffSetY,");
0704: insertAndPrint("resultSourceOffSetX, 0);");
0705: //
0706: //
0707: simpleAndPrint("//");
0708: printAndIndent("if (!isMacroActive() || inEvent != null) {");
0709: simpleAndPrint("stopEventPropogation(inEvent);");
0710: revertAndPrint("}");
0711: //
0712: //
0713: //
0714: //
0715: //simpleAndPrint("eval(studioConstraintSac);");
0716: //simpleAndPrint("alert('inParentHandle = ' + inParentHandle);");
0717: //simpleAndPrint("alert('inIndex = ' + inIndex);");
0718: //simpleAndPrint("alert('inSelectorIndex = ' + inSelectorIndex);");
0719: //simpleAndPrint("alert('inSacIndex = ' + inSacIndex);");
0720: //simpleAndPrint("alert('inCrpcIndex = ' + inCrpcIndex);");
0721: //
0722:
0723: //
0724: //
0725: simpleAndPrint("//");
0726: simpleAndPrint("return outValue;");
0727: simpleAndPrint("//");
0728: revertAndPrint("}");
0729: }
0730:
0731: private void startAndEndPopUpStudioFunctions() throws IOException {
0732: //
0733: simpleAndPrint("var allowBlockOfWebPageViewPopUpClear = false;");
0734: printAndIndent("function setAllowBlockOfWebPageViewPopUpClear(");
0735: simpleAndPrint("inValue) {");
0736: simpleAndPrint("allowBlockOfWebPageViewPopUpClear = inValue;");
0737: revertAndPrint("}");
0738: printAndIndent("function isAllowBlockOfWebPageViewPopUpClear() {");
0739: simpleAndPrint("var outValue = allowBlockOfWebPageViewPopUpClear;");
0740: //simpleAndPrint("allowBlockOfWebPageViewPopUpClear = false;");
0741: simpleAndPrint("return outValue;");
0742: revertAndPrint("}");
0743: }
0744:
0745: private void startAndEndMenuInitializationStudioFunctions()
0746: throws IOException {
0747: //
0748: printAndIndent("function studioSelectionMenuInitialization(inCode) {");
0749: simpleAndPrint("studioMenuInitialization(getStudioSelectionId(), inCode);");
0750: revertAndPrint("}");
0751: //
0752: printAndIndent("function getMenuBranchDisplayCode(inIndex) {");
0753: simpleAndPrint("return '"
0754: + CommonSeparators.SEPARATOR__SUB_SECTION_START
0755: + "' + inIndex + '"
0756: + CommonSeparators.SEPARATOR__SUB_SECTION_END + "';");
0757: revertAndPrint("}");
0758: //
0759: printAndIndent("function studioMenuInitialization(inId, inCode) {");
0760: simpleAndPrint("resetStudioUsability(inId);");
0761: simpleAndPrint("var currentIndex = 0;");
0762: printAndIndent("while ((currentIndex = initializeStudioUsability(");
0763: simpleAndPrint("inId, inCode, currentIndex)) < inCode.length) {");
0764: revertAndPrint("}");
0765: revertAndPrint("}");
0766: //
0767: printAndIndent("function studioMenuInitializationNotUsed(inId, inCode) {");
0768: simpleAndPrint("var nextObj = null;");
0769: simpleAndPrint("var nextIndex = 0;");
0770: simpleAndPrint("var nextBranchId = getMenuBranchId(inId, nextIndex);");
0771: printAndIndent("while ((nextObj = getPageComponent(nextBranchId)) != null) {");
0772: printAndIndent("if (inCode.indexOf(getMenuBranchDisplayCode(nextIndex)) != -1) {");
0773: simpleAndPrint("openSection(nextBranchId);");
0774: revertAndPrint("}");
0775: printAndIndent("else {");
0776: simpleAndPrint("closeSection(nextBranchId);");
0777: revertAndPrint("}");
0778: simpleAndPrint("nextIndex = nextIndex + 1;");
0779: simpleAndPrint("nextBranchId = getMenuBranchId(inId, nextIndex);");
0780: revertAndPrint("}");
0781: revertAndPrint("}");
0782: }
0783:
0784: private void startAndEndStudioUsabilityFunctions()
0785: throws IOException {
0786: //
0787: printAndIndent("function resetStudioUsability(inParentId) {");
0788: printAndIndent("if (getPageComponent(inParentId) != null) {");
0789: simpleAndPrint("closeSection(inParentId);");
0790: //
0791: printAndIndent("for (var i = 0; true; i++) {");
0792: simpleAndPrint("var nextBranchId = "
0793: + PopUpViewHelper.getMenuItemPartId("inParentId", "i")
0794: + ";");
0795: //simpleAndPrint("var nextBranchId = inParentId + '"
0796: // + CommonSeparators.TOGGLE_LINK_SEPARATOR + "' + '"
0797: // + ConsoleTemplateSession.getMenuItemPartName() + "' + '"
0798: // + CommonSeparators.TOGGLE_LINK_SEPARATOR + "' + i;");
0799: simpleAndPrint("var nextSubMenuId = inParentId + '"
0800: + CommonSeparators.TOGGLE_LINK_SEPARATOR + "' + i;");
0801: //
0802: printAndIndent("if (getPageComponent(nextBranchId) != null) {");
0803: simpleAndPrint("closeSection(nextBranchId);");
0804: simpleAndPrint("resetStudioUsability(nextSubMenuId);");
0805: revertAndPrint("}");
0806: printAndIndent("else {");
0807: simpleAndPrint("break;");
0808: revertAndPrint("}");
0809: //
0810: revertAndPrint("}");
0811: //
0812: revertAndPrint("}");
0813: revertAndPrint("}");
0814: //
0815: //simpleAndPrint("var initStudioUseIndex = 0;");
0816: printAndIndent("function initializeStudioUsability(");
0817: simpleAndPrint("inId, inCode, inIndex) {");
0818: simpleAndPrint("//");
0819: simpleAndPrint("var outValue = 0;");
0820: simpleAndPrint("var subSecStartToken = '"
0821: + CommonSeparators.SEPARATOR__SUB_SECTION_START + "';");
0822: simpleAndPrint("var subSecEndToken = '"
0823: + CommonSeparators.SEPARATOR__SUB_SECTION_END + "';");
0824: simpleAndPrint("var togSep = '"
0825: + CommonSeparators.TOGGLE_LINK_SEPARATOR + "';");
0826: //
0827: //
0828: //
0829: //
0830: //
0831: //
0832: ////printAndIndent("if (inCode.length > 0) {");
0833: //////
0834: //////
0835: //////
0836: ////simpleAndPrint("inIndex = inIndex + subSecStartToken.length;");
0837: ////simpleAndPrint("var nextStartSection ="
0838: //// + " inCode.indexOf(subSecStartToken, inIndex);");
0839: ////simpleAndPrint("var nextEndSection ="
0840: //// + " inCode.indexOf(subSecEndToken, inIndex);");
0841: ////simpleAndPrint("var nextIndexEnd = nextEndSection;");
0842: ////printAndIndent("if (nextStartSection < nextEndSection");
0843: ////simpleAndPrint("&& nextStartSection != -1) {");
0844: ////simpleAndPrint("nextIndex = nextStartSection;");
0845: ////revertAndPrint("}");
0846: //////
0847: ////simpleAndPrint("var nextIndexSuffix ="
0848: //// + " inCode.substring(inIndex, nextIndexEnd);");
0849: ////simpleAndPrint("inIndex = nextIndexEnd;");
0850: //////
0851: ////simpleAndPrint("openSection(inId + togSep + '"
0852: //// + ConsoleTemplateSession.getMenuItemPartName()
0853: //// + "' + togSep + nextIndexSuffix);");
0854: ////printAndIndent("while (inCode.substring(inIndex,"
0855: //// + " inIndex + subSecStartToken.length) == subSecStartToken) {");
0856: ////simpleAndPrint("inIndex = initializeStudioUsability("
0857: //// + "inId + togSep + nextIndexSuffix, inCode, inIndex);");
0858: ////revertAndPrint("}");
0859: //////
0860: //////
0861: //////
0862: //////
0863: //////
0864: ////simpleAndPrint("inIndex = inIndex + subSecEndToken.length;");
0865: //////
0866: ////revertAndPrint("}");
0867: ////simpleAndPrint("outValue = inIndex;");
0868: ////simpleAndPrint("return outValue;");
0869: //
0870: //
0871: printAndIndent("if (inCode.length > 0) {");
0872: simpleAndPrint("inIndex = inIndex + subSecStartToken.length;");
0873: simpleAndPrint("var nextStartSection = inCode.indexOf("
0874: + "subSecStartToken, inIndex);");
0875: simpleAndPrint("var nextEndSection = inCode.indexOf("
0876: + "subSecEndToken, inIndex);");
0877: simpleAndPrint("//");
0878: printAndIndent("if (nextStartSection < nextEndSection");
0879: simpleAndPrint("&& nextStartSection != -1) {");
0880: simpleAndPrint("//");
0881: simpleAndPrint("var nextIndexSuffix = inCode.substring("
0882: + "inIndex, nextStartSection);");
0883: simpleAndPrint("inIndex = nextStartSection;");
0884: simpleAndPrint("openSection(inId + togSep + '"
0885: + ConsoleTemplateSession.getMenuItemPartName()
0886: + "' + togSep + nextIndexSuffix);");
0887: printAndIndent("while (inCode.substring("
0888: + "inIndex, inIndex + subSecStartToken.length)"
0889: + " == subSecStartToken) {");
0890: simpleAndPrint("inIndex = initializeStudioUsability("
0891: + "inId + togSep + nextIndexSuffix, inCode, inIndex);");
0892: revertAndPrint("}");
0893: simpleAndPrint("inIndex = inIndex + subSecEndToken.length;");
0894: revertAndPrint("}");
0895: printAndIndent("else {");
0896: simpleAndPrint("var nextIndexSuffix = inCode.substring("
0897: + "inIndex, nextEndSection);");
0898: simpleAndPrint("openSection(inId + togSep + '"
0899: + ConsoleTemplateSession.getMenuItemPartName()
0900: + "' + togSep + nextIndexSuffix);");
0901: simpleAndPrint("inIndex = nextEndSection + subSecEndToken.length;");
0902: revertAndPrint("}");
0903: revertAndPrint("}");
0904: simpleAndPrint("outValue = inIndex;");
0905: simpleAndPrint("return outValue;");
0906: //
0907: revertAndPrint("}");
0908: }
0909:
0910: private void startAndEndVariableSphereFunctions()
0911: throws IOException {
0912:
0913: ConsolePageSession localCps = getConsolePageSession();
0914: //
0915: StudioConceptTagUsabilityContext localSctuc = localCps
0916: .getStudioUsability();
0917: //
0918: HashMap varMap = StandardDataTypes.getDisplayNameToClass();
0919: Class nothingClass = StandardDataTypes.getNothingClass();
0920: varMap.remove(StandardDataTypes.getDisplayName(nothingClass));
0921: //
0922: ArrayList varTypes = new ArrayList(varMap.keySet());
0923: //
0924: for (int i = 0; i < varTypes.size(); i++) {
0925: simpleAndPrint("var studioVarSphere" + varTypes.get(i)
0926: + " = null;");
0927: }
0928: //
0929: //
0930: //
0931: printAndIndent("function checkVarSphere(inFocusHandle, inCandidateHandle) {");
0932: simpleAndPrint("var outValue = false;");
0933: printAndIndent("if (inFocusHandle.length <= inCandidateHandle.length) {");
0934: simpleAndPrint("var canHan = inCandidateHandle.substring(");
0935: insertAndPrint("0, inFocusHandle.length);");
0936: simpleAndPrint("outValue = (inFocusHandle == canHan);");
0937: revertAndPrint("}");
0938: simpleAndPrint("return outValue;");
0939: revertAndPrint("}");
0940: //
0941: //
0942: //
0943: printAndIndent("function checkVarSphere(");
0944: simpleAndPrint("inFocusHandle, inFocusIndex,");
0945: simpleAndPrint("inCandidateHandle, inCandidateIndex) {");
0946: simpleAndPrint("//");
0947: simpleAndPrint("var outValue = false;");
0948: printAndIndent("if (checkVarSphere(inFocusHandle, inCandidateHandle)) {");
0949: //
0950: printAndIndent("if (inFocusHandle.length < inCandidateHandle.length) {");
0951: simpleAndPrint("//");
0952: simpleAndPrint("var canIndexText = inCandidateHandle.substring(");
0953: insertAndPrint("inFocusHandle.length, inCandidateHandle.length);");
0954: //
0955: printAndIndent("if (canIndexText.indexOf(studioGetHanConj()) != -1) {");
0956: simpleAndPrint("canIndexText = canIndexText.substring(");
0957: insertAndPrint("0, canIndexText.indexOf(studioGetHanConj()));");
0958: revertAndPrint("}");
0959: simpleAndPrint("//");
0960: simpleAndPrint("outValue = (parseInt(canIndexText) >= inFocusIndex);");
0961: //
0962: revertAndPrint("}");
0963: printAndIndent("else if (inFocusHandle == inCandidateHandle");
0964: simpleAndPrint("&& inFocusIndex <= inCandidateIndex) {");
0965: simpleAndPrint("outValue = true;");
0966: revertAndPrint("}");
0967: //
0968: revertAndPrint("}");
0969: simpleAndPrint("return outValue;");
0970: revertAndPrint("}");
0971: //
0972: //
0973: //
0974: printAndIndent("function initializeVarSphere(inHandle, inIndex) {");
0975: //
0976: for (int i = 0; i < varTypes.size(); i++) {
0977: String unknownVar[] = StudioConceptTagUsabilityContext
0978: .getUnknownVariableList();
0979: simpleAndPrint("studioVarSphere" + varTypes.get(i) + " = "
0980: + CreationParameterContext.prepareItems(unknownVar)
0981: + ";");
0982: }
0983: //
0984: for (int i = (localSctuc.getVariableSphereCount() - 1); i >= 0; i--) {
0985: //
0986: StringBuffer beginSb = new StringBuffer();
0987: if (i == (localSctuc.getVariableSphereCount() - 1)) {
0988: beginSb.append("if (");
0989: } else {
0990: beginSb.append("else if (");
0991: }
0992: //
0993: if (localSctuc.isVariableSphereIndexPresent(i)) {
0994: beginSb.append("checkVarSphere('"
0995: + localSctuc.getVariableSphereConstraint(i)
0996: + "', " + localSctuc.getVariableSphereIndex(i)
0997: + ", inHandle, inIndex)) {");
0998: } else {
0999: beginSb.append("checkVarSphere('"
1000: + localSctuc.getVariableSphereConstraint(i)
1001: + "', inHandle)) {");
1002: }
1003: //
1004: printAndIndent(beginSb.toString());
1005: //
1006: //
1007: //
1008: //
1009: for (int j = 0; j < varTypes.size(); j++) {
1010: String nextVarType = ((String) varTypes.get(j));
1011: simpleAndPrint("studioVarSphere"
1012: + nextVarType
1013: + " = "
1014: + localSctuc.getVariableSphereContents(i,
1015: nextVarType) + ";");
1016: }
1017: //
1018: //
1019: //
1020: //
1021: revertAndPrint("}");
1022:
1023: }
1024: //
1025: revertAndPrint("}");
1026: //
1027: //
1028: //
1029: }
1030:
1031: private void startAndEndConceptTagSelectionFunctions()
1032: throws IOException {
1033: //
1034: ConsolePageSession localCps = getConsolePageSession();
1035: //
1036: StudioConceptTagUsabilityContext localSctuc = localCps
1037: .getStudioUsability();
1038: RootConceptTagHolder localRcth = localCps
1039: .getCurrentApplicationRootHolder();
1040: ConceptTagPreferences localCtp = localRcth.getPreferences();
1041: //
1042: simpleAndPrint("var studioConceptTagSelector = null;");
1043: printAndIndent("function estabilishConceptTagSelector(inIndex) {");
1044: simpleAndPrint("studioConceptTagSelector = null;");
1045: for (int i = 0; i < localSctuc.getConceptTagSelectorCount(); i++) {
1046: String nextSelector = localSctuc.getConceptTagSelector(i,
1047: localCtp);
1048: if (i > 0) {
1049: printAndIndent("else if (inIndex == " + i + ") {");
1050: } else {
1051: printAndIndent("if (inIndex == " + i + ") {");
1052: }
1053: simpleAndPrint("studioConceptTagSelector = '"
1054: + nextSelector + "';");
1055: revertAndPrint("}");
1056: }
1057: revertAndPrint("}");
1058: }
1059:
1060: //
1061: private void startAndEndConstraintSacsFunctions()
1062: throws IOException {
1063: //
1064: ConsolePageSession localCps = getConsolePageSession();
1065: //
1066: StudioConceptTagUsabilityContext localSctuc = localCps
1067: .getStudioUsability();
1068: //RootConceptTagHolder localRcth =
1069: // localCps.getCurrentApplicationRootHolder();
1070: //ConceptTagPreferences localCtp = localRcth.getPreferences();
1071: //
1072: //
1073: simpleAndPrint("var studioFromPage = '" + getFromPage() + "';");
1074: simpleAndPrint("var studioHandle = '" + getHandle() + "';");
1075: simpleAndPrint("var studioAliasHandle = '" + getAliasHandle()
1076: + "';");
1077: //
1078: simpleAndPrint("var studioConstraintSac = null;");
1079: printAndIndent("function estabilishConstraintSac(inIndex) {");
1080: simpleAndPrint("studioConstraintSac = '';");
1081: for (int i = 0; i < localSctuc.getConstraintSacCount(); i++) {
1082: CreationParameterContext nextConstraintSac = localSctuc
1083: .getConstraintSac(i);
1084: if (i > 0) {
1085: printAndIndent("else if (inIndex == " + i + ") {");
1086: } else {
1087: printAndIndent("if (inIndex == " + i + ") {");
1088: }
1089: String s = nextConstraintSac.createParameterCall();
1090: s = XMLHelper.fromStringToJSCData(s);
1091: simpleAndPrint("studioConstraintSac = '" + s + "';");
1092: revertAndPrint("}");
1093: }
1094: revertAndPrint("}");
1095: //
1096: //
1097: //
1098: simpleAndPrint("var studioConstraintSacHandle = null;");
1099: simpleAndPrint("var studioConstraintSacIndex = 0;");
1100: simpleAndPrint("var studioConstraintSacAction = null;");
1101: //
1102: printAndIndent("function studioCallConstraintSacForPrevious() {");
1103: simpleAndPrint("studioInitParentSac();");
1104: simpleAndPrint("studioConstraintSacHandle = studioConstraintParentHandle;");
1105: simpleAndPrint("studioConstraintSacIndex = studioConstraintIndex;");
1106: simpleAndPrint("studioConstraintSacAction = '"
1107: + SubmitActionParameters.ADD + "';");
1108: simpleAndPrint("eval(studioConstraintSac);");
1109: revertAndPrint("}");
1110: //
1111: printAndIndent("function studioCallConstraintSacForNext() {");
1112: simpleAndPrint("studioInitParentSac();");
1113: simpleAndPrint("studioConstraintSacHandle = studioConstraintParentHandle;");
1114: simpleAndPrint("studioConstraintSacIndex = studioConstraintIndex + 1;");
1115: simpleAndPrint("studioConstraintSacAction = '"
1116: + SubmitActionParameters.ADD + "';");
1117: simpleAndPrint("eval(studioConstraintSac);");
1118: revertAndPrint("}");
1119: //
1120: printAndIndent("function studioCallConstraintSacForReplace() {");
1121: simpleAndPrint("studioInitParentSac();");
1122: simpleAndPrint("studioConstraintSacHandle = studioConstraintParentHandle;");
1123: simpleAndPrint("studioConstraintSacIndex = studioConstraintIndex;");
1124: simpleAndPrint("studioConstraintSacAction = '"
1125: + SubmitActionParameters.REPLACE + "';");
1126: simpleAndPrint("eval(studioConstraintSac);");
1127: revertAndPrint("}");
1128: //
1129: printAndIndent("function studioCallSubConstraintSacForFirst() {");
1130: simpleAndPrint("studioInitChildSac();");
1131: simpleAndPrint("studioConstraintSacHandle = studioConstraintParentHandle");
1132: insertAndPrint("+ studioGetHanConj() + studioConstraintIndex");
1133: insertAndPrint("+ studioGetHanConj() + studioSubConstraintName;");
1134: simpleAndPrint("studioConstraintSacIndex = 0;");
1135: simpleAndPrint("studioConstraintSacAction = '"
1136: + SubmitActionParameters.ADD + "';");
1137: simpleAndPrint("eval(studioConstraintSac);");
1138: revertAndPrint("}");
1139: //
1140: printAndIndent("function studioCallSubConstraintSacForLast() {");
1141: simpleAndPrint("studioInitChildSac();");
1142: simpleAndPrint("studioConstraintSacHandle = studioConstraintParentHandle");
1143: insertAndPrint("+ studioGetHanConj() + studioConstraintIndex");
1144: insertAndPrint("+ studioGetHanConj() + studioSubConstraintName;");
1145: simpleAndPrint("studioConstraintSacIndex = studioSubConstraintSize;");
1146: simpleAndPrint("studioConstraintSacAction = '"
1147: + SubmitActionParameters.ADD + "';");
1148: simpleAndPrint("eval(studioConstraintSac);");
1149: revertAndPrint("}");
1150: //
1151: //
1152: //
1153: //
1154: //
1155: SubmitActionContext sacDelete = SubmitActionContext
1156: .newInstance(this );
1157: //
1158: sacDelete.addAction(ConsoleParameterContext.FIRST_INPUT,
1159: singleQuotes(SubmitActionParameters.DELETE));
1160: //
1161: sacDelete.addParameter(ConsoleParameterContext.FIRST_INPUT,
1162: "studioConstraintParentHandle");
1163: sacDelete.addParameter(ConsoleParameterContext.SECOND_INPUT,
1164: "studioConstraintIndex");
1165: //
1166: printAndIndent("function studioCallConstraintSacForDelete() {");
1167: simpleAndPrint("studioConstraintSacHandle = studioConstraintParentHandle;");
1168: simpleAndPrint("studioConstraintSacIndex = studioConstraintIndex;");
1169: simpleAndPrint(sacDelete.submitActionCall(true));
1170: revertAndPrint("}");
1171: }
1172:
1173: //
1174: private void startAndEndCreationParameterFunction()
1175: throws IOException {
1176: //
1177: ConsolePageSession localCps = getConsolePageSession();
1178: //
1179: //StudioConceptTagUsabilityContext localSctuc =
1180: // localCps.getStudioUsability();
1181: RootConceptTagHolder localRcth = localCps
1182: .getCurrentApplicationRootHolder();
1183: ConceptTagPreferences localCtp = localRcth.getPreferences();
1184: StudioConceptTagCreParInfoContextHolder localScpch = localCtp
1185: .getCreationParameters();
1186: //
1187: simpleAndPrint("var studioCreationParameter = null;");
1188: //
1189: printAndIndent("function estabilishCreationParameter(inIndex) {");
1190: simpleAndPrint("studioCreationParameter = determineCreationParameter(inIndex);");
1191: //
1192: revertAndPrint("}");
1193: //
1194: //
1195: //
1196: printAndIndent("function determineCreationParameter(inIndex) {");
1197: simpleAndPrint("var outValue = null;");
1198: //
1199: int icount = localScpch.getCreationParameterContextCount();
1200: for (int i = 0; i < icount; i++) {
1201: CreationParameterContext nextCpc = localScpch
1202: .getCreationParameterContext(i);
1203: if (i > 0) {
1204: printAndIndent("else if (inIndex == " + i + ") {");
1205: } else {
1206: printAndIndent("if (inIndex == " + i + ") {");
1207: }
1208: String s = nextCpc.createParameterCall();
1209: s = XMLHelper.fromStringToJSCData(s);
1210: simpleAndPrint("outValue = '" + s + "';");
1211: revertAndPrint("}");
1212: }
1213: //
1214: simpleAndPrint("return outValue;");
1215: //
1216: revertAndPrint("}");
1217: }
1218: //
1219: //
1220: //
1221: }
|