001: /*
002: * JFolder, Copyright 2001-2006 Gary Steinmetz
003: *
004: * Distributable under LGPL license.
005: * See terms of license at gnu.org.
006: */
007:
008: package org.jfolder.console.web.admin.macro.execute;
009:
010: //base classes
011: import java.io.IOException;
012: import java.util.ArrayList;
013: import javax.servlet.ServletException;
014:
015: //project specific classes
016: import org.jfolder.common.tagging.ConceptRollupTag;
017: import org.jfolder.common.tagging.ConceptTagCharacteristic;
018: import org.jfolder.common.tagging.ConceptTagConstraintOrTemplate;
019: import org.jfolder.common.tagging.RootConceptTagHolder;
020: import org.jfolder.common.utils.misc.CommonSeparators;
021: import org.jfolder.common.utils.web.ParameterSet;
022: import org.jfolder.common.web.template.ConsoleTemplateContext;
023: import org.jfolder.common.web.template.ConsoleTemplateFunctionsContext;
024: import org.jfolder.common.web.template.ConsoleTemplateSession;
025: import org.jfolder.common.web.template.CreationParameterContext;
026: import org.jfolder.common.web.template.MenuItem;
027: import org.jfolder.common.web.template.SubmitActionContext;
028: import org.jfolder.common.web.template.SubmitActionParameters;
029: import org.jfolder.console.base.BaseConsoleServlet;
030: import org.jfolder.console.base.ConsolePageContext;
031: import org.jfolder.console.base.ConsolePageParameters;
032: import org.jfolder.console.base.ConsolePageSession;
033: import org.jfolder.console.base.NamesForParentCpc;
034: import org.jfolder.console.base.context.BasePanelessRcthEditConsolePageContext;
035: import org.jfolder.console.base.context.BasePanelessRcthTreeConsolePageContext;
036: import org.jfolder.console.macro.ConsoleMacro;
037: import org.jfolder.console.macro.ConsoleMacroTagHelper;
038: import org.jfolder.console.macro.v1.AssignStaticValueConsoleMacroTag;
039: import org.jfolder.console.macro.v1.ChangeFormValueConsoleMacroTag;
040: import org.jfolder.console.macro.v1.CreationParameterConsoleMacroTag;
041: import org.jfolder.console.macro.v1.GoToAndChangeValueConsoleMacroTag;
042: import org.jfolder.console.macro.v1.GoToConsoleMacroTag;
043: import org.jfolder.console.macro.v1.OpenSectionIfClosedConsoleMacroTag;
044: import org.jfolder.console.macro.v1.RootV1ConsoleMacroTag;
045: import org.jfolder.console.macro.v1.SelectMenuItemConsoleMacroTag;
046: import org.jfolder.console.macro.v1.SimpleClickConsoleMacroTag;
047: import org.jfolder.console.macro.v1.SubmitActionConsoleMacroTag;
048: import org.jfolder.console.web.base.ConsoleScreenContext;
049: import org.jfolder.security.model.UserHolder;
050:
051: //other classes
052:
053: public class PetStoreActivityGoToWithinRcth extends
054: CommonPetStoreActivity {
055:
056: //
057: private PetStoreActivityGoToWithinRcth() {
058: }
059:
060: //
061: //
062: private final static String getHandleBase(String inStudioHandle) {
063: return "(main),(left-right?0-0-L?0-0-R),(up-down?2-0-U?2-0-D),"
064: + "(pane-rcth-edit),(paneless-rcth-edit),[TAG_BASE],"
065: + inStudioHandle;
066: }
067:
068: public final static void goTo(String inFromHandle,
069: String inSourcePage, String inDestinationPage,
070: String inTreeState, RootV1ConsoleMacroTag inRv1cmt,
071: String inCptHandle, String inStudioHandle,
072: String inMinStudioHandle) {
073: //
074: ConceptTagCharacteristic currentActionCtchar = null;
075: String fromHandle = null;
076: String sourPage = null;
077: String destPage = null;
078: String treeState = null;
079: ////////////
080: fromHandle = inFromHandle;
081: sourPage = inSourcePage;
082: destPage = inDestinationPage;
083: treeState = inTreeState;
084: //
085: currentActionCtchar = inRv1cmt.generateNextPage(fromHandle,
086: fromHandle, sourPage, destPage);
087: //
088: ArrayList minBranch = ConsoleTemplateSession
089: .getToggleLinkFromString(inMinStudioHandle);
090: int minBranchLength = minBranch.size();
091: //
092: ArrayList branch = ConsoleTemplateSession
093: .getToggleLinkFromString(inStudioHandle);
094: //
095: for (int i = minBranchLength; i < branch.size(); i++) {
096: ArrayList nextBranch = new ArrayList(branch.subList(0, i));
097: String nextBranchHandle = ConsoleTemplateSession
098: .getToggleLinkFromArrayList(nextBranch);
099: //
100: String nextSourceHandle = getBranchSectionHandle(nextBranchHandle);
101: String nextTargetHandle = nextSourceHandle
102: + ",[STATIC_IMAGE],STATIC_IMAGE__TREE_BRANCH";
103: //
104: OpenSectionIfClosedConsoleMacroTag.newInstance(
105: currentActionCtchar, nextSourceHandle,
106: nextTargetHandle, nextTargetHandle,
107: BasePanelessRcthTreeConsolePageContext.OPEN_GIF);
108: }
109: //
110: GoToConsoleMacroTag
111: .newInstance(
112: currentActionCtchar,
113: getBranchSectionHandle(inStudioHandle)
114: + ",[STATIC_IMAGE],STATIC_IMAGE__TREE_BRANCH_ICON");
115: SimpleClickConsoleMacroTag.newInstance(currentActionCtchar);
116: //
117: SubmitActionContext goToSac = SubmitActionContext.newInstance(
118: sourPage, fromHandle, fromHandle);
119: BasePanelessRcthTreeConsolePageContext.initializeGoToSac(
120: goToSac, false, inCptHandle);
121: SubmitActionConsoleMacroTag.newInstance(currentActionCtchar,
122: goToSac);
123: }
124:
125: //
126: private final static String getBranchSectionHandle(String inHandle) {
127: return "(main),(left-right?0-0-L?0-0-R),(pane-rcth-tree)"
128: + ",(paneless-rcth-tree),[TREE_BASE]," + inHandle;
129: }
130: //
131: }
|