protected void handleActionsInternal() {
   String ident = "";
   String forelementcounter = "0";
   int fallbackcounter = 0;
   boolean inForLoop = false;
   int forLoopCounter = 0;
   PrintWriter out = ThreadLocalOut.peek();
   ident = "";
   if (inForLoop) {
     ident += forelementcounter;
   }
   ident += "tcall499";
   ThreadLocalPage.get().enterTemplateContext("tcall499");
   try {
     Object[] args1193 = {"Name: "};
     utils.LocalTemplateArguments args21192 =
         env.getExtraLocalTemplateArguments("labelcolumnsString");
     if (args21192 != null) {
       args1193 = ArrayUtils.addAll(args1193, args21192.extraArgs);
     }
     if (templatecalls.get(ident) == null) {
       templatecalls.put(
           ident, (TemplateServlet) env.getTemplate("labelcolumnsString").newInstance());
     }
     org.webdsl.lang.Environment newenv = new Environment(env);
     newenv.putWithcall(
         "elements#labelcolumnsString",
         new utils.TemplateCall(
             "customerCustomer_ta0Customer_ta0Customer",
             getElementsContext(),
             new Object[] {arg0},
             attrs));
     Map<String, String> attrsmapout = TemplateCall.EmptyAttrs;
     ((TemplateServlet) templatecalls.get(ident))
         .handleActions("labelcolumnsString", args1193, newenv, attrsmapout, args21192);
     if (ThreadLocalPage.get().hasExecutedAction) return;
   } catch (Exception ex) {
     System.out.println("Problem occurred in template call: " + "labelcolumnsString(Name: )");
     utils.Warning.printSmallStackTrace(ex);
   }
   ident = "";
   ThreadLocalPage.get().leaveTemplateContext();
   ThreadLocalTemplate.set(this);
 }
コード例 #2
0
  private void tryInitializeTemplate(
      String calledName,
      Object[] args,
      Environment env,
      Map<String, String> attrs,
      utils.LocalTemplateArguments ltas) {
    // always set ThreadLocalTemplate
    ThreadLocalTemplate.set(this);
    // always store arguments, value might change between phases
    storeArguments(args);
    if (!initialized || ThreadLocalPage.get().hibernateCacheCleared) {
      // System.out.println("template init "+"~x_Page"+"init: "+initialized+ " hibcache:
      // "+ThreadLocalPage.get().hibernateCacheCleared);
      initialized = true;

      this.calledName = calledName;
      this.env = env;
      putLocalDefinesInEnv();
      this.request = ThreadLocalPage.get().getRequest();
      this.response = ThreadLocalPage.get().getResponse();
      if (request != null) { // calling rendertemplate within background task
        this.session = request.getSession(true);
      }
      this.hibSession = ThreadLocalPage.get().getHibSession();
      this.attrs = attrs;
      this.ltas = ltas;
      try {
        this.uniqueid =
            Encoders.encodeTemplateId(
                getTemplateClassName() /*, getStateEncodingOfArgument()*/, getTemplateContext());
        initialize();
        initializeLocalVars();
        initSubmitActions();
        initActions();
      } catch (utils.ValidationException ve) {
        ThreadLocalPage.get()
            .getValidationExceptions()
            .add(ve.setName(ThreadLocalPage.get().getValidationContext()));
        ThreadLocalPage.get().setValidated(false);
        utils.Warning.warn(
            "Validation failed in initialization of "
                + getTemplateSignature()
                + ": "
                + ve.getErrorMessage());
        skipThisTemplate = true;
      } catch (utils.MultipleValidationExceptions ve) {
        for (utils.ValidationException vex : ve.getValidationExceptions()) {
          ThreadLocalPage.get()
              .getValidationExceptions()
              .add(vex.setName(ThreadLocalPage.get().getValidationContext()));
          utils.Warning.warn(
              "Validation failed in initialization of "
                  + getTemplateSignature()
                  + ": "
                  + vex.getErrorMessage());
        }
        ThreadLocalPage.get().setValidated(false);
        skipThisTemplate = true;
      }
    }
  }
コード例 #3
0
 protected void handlePhase(int phase) {
   String ident = "";
   String forelementcounter = "0";
   int fallbackcounter = 0;
   boolean inForLoop = false;
   int forLoopCounter = 0;
   PrintWriter out = ThreadLocalOut.peek();
   switch (phase) {
     case DATABIND_PHASE:
       ident = root_wireframe0$l$_next10_;
       if (threadLocalPageCached.getParammap().get(ident) != null) {
         threadLocalPageCached.actionToBeExecutedHasDisabledValidation =
             root_next0.isValidationDisabled();
       }
       break;
     case ACTION_PHASE:
       ident = root_wireframe0$l$_next10_;
       if (threadLocalPageCached.getParammap().get(ident) != null) {
         if (isAjaxSubmitRequired(false)) {
           threadLocalPageCached.enableAjaxActionExecuted();
         }
         new root_next0().run(threadLocalPageCached, getEnv(), getElementsContext(), ident);
       }
       break;
     case RENDER_PHASE:
       if (isAjaxSubmitRequired(false)) {
         out.print(
             "<button submitid=\""
                 + root_wireframe0$l$_next10_
                 + "\" onclick='javascript:serverInvoke(\""
                 + threadLocalPageCached.getAbsoluteLocation()
                 + "/"
                 + threadLocalPageCached.getActionTarget()
                 + threadLocalPageCached.getExtraQueryAruments("?")
                 + "\",\""
                 + root_wireframe0$l$_next10_
                 + "\", ["
                 + threadLocalPageCached.getHiddenPostParamsJson()
                 + "],\""
                 + threadLocalPageCached.getFormIdent()
                 + "\", this, "
                 + "true"
                 + "); return false;'");
         {
           StringBuilder classattrs = new StringBuilder();
           StringBuilder styleattrs = new StringBuilder();
           java.util.List<String> ignore = new java.util.ArrayList<String>();
           java.util.List<String> ignorecols = new java.util.ArrayList<String>();
           utils.TemplateCall.getDynamicIgnoredAttributes(attrs, ignore);
           for (String attrcolname :
               utils.TemplateCall.getDynamicSelectedAttributeCollections(attrs)) {
             if (!ignorecols.contains(attrcolname)) {
               AttributeCollectionLookup.getAttributeCollection(
                   attrcolname, classattrs, styleattrs, ignore, ignorecols, out);
             }
           }
           utils.TemplateCall.appendWithPadding(classattrs, "float-right");
           if (!ignorecols.contains("submit")) {
             AttributeCollectionLookup.getAttributeCollection(
                 "submit", classattrs, styleattrs, ignore, ignorecols, out);
           }
           utils.TemplateCall.printClassStyleAttributes(classattrs, styleattrs, out);
         }
         out.print(">");
         if (RENDER_PHASE == phase) {
           try {
             utils.RenderUtils.printPageString("Next", out, threadLocalPageCached.isRawoutput());
           } catch (NullPointerException npe) {
             utils.Warning.warn("null reference prevented rendering of template element");
           } catch (IndexOutOfBoundsException ine) {
             utils.Warning.warn("index out of bounds prevented rendering of template element");
           }
         }
         out.print("</button>");
       } else {
         out.print("<button name=\"" + root_wireframe0$l$_next10_ + "\"");
         {
           StringBuilder classattrs = new StringBuilder();
           StringBuilder styleattrs = new StringBuilder();
           java.util.List<String> ignore = new java.util.ArrayList<String>();
           java.util.List<String> ignorecols = new java.util.ArrayList<String>();
           utils.TemplateCall.getDynamicIgnoredAttributes(attrs, ignore);
           for (String attrcolname :
               utils.TemplateCall.getDynamicSelectedAttributeCollections(attrs)) {
             if (!ignorecols.contains(attrcolname)) {
               AttributeCollectionLookup.getAttributeCollection(
                   attrcolname, classattrs, styleattrs, ignore, ignorecols, out);
             }
           }
           utils.TemplateCall.appendWithPadding(classattrs, "float-right");
           if (!ignorecols.contains("submit")) {
             AttributeCollectionLookup.getAttributeCollection(
                 "submit", classattrs, styleattrs, ignore, ignorecols, out);
           }
           utils.TemplateCall.printClassStyleAttributes(classattrs, styleattrs, out);
         }
         out.print(">");
         if (RENDER_PHASE == phase) {
           try {
             utils.RenderUtils.printPageString("Next", out, threadLocalPageCached.isRawoutput());
           } catch (NullPointerException npe) {
             utils.Warning.warn("null reference prevented rendering of template element");
           } catch (IndexOutOfBoundsException ine) {
             utils.Warning.warn("index out of bounds prevented rendering of template element");
           }
         }
         out.print("</button>");
       }
       break;
   }
 }
コード例 #4
0
 public void validateInputs(
     Object[] args,
     Environment env,
     utils.TemplateCall templateArg,
     Map<String, utils.TemplateCall> withcallsmap,
     Map<String, String> attrs) {
   if (!skipThisTemplate) {
     if (!initialized || ThreadLocalPage.get().hibernateCacheCleared) {
       initialized = true;
       this.env = env;
       env.putTemplate("body", editColor_body_Template.class);
       this.request = ThreadLocalPage.get().getRequest();
       this.response = ThreadLocalPage.get().getResponse();
       this.session = request.getSession(true);
       this.hibSession = ThreadLocalPage.get().getHibSession();
       this.templateArg = templateArg;
       this.withcallsmap = withcallsmap;
       this.attrs = attrs;
       try {
         storeArguments(args);
         this.uniqueid =
             Encoders.encodeTemplateId(
                 "editColor_Template",
                 ""
                     + (arg10 != null
                         ? arg10.getVersion() == 0 ? "_" : arg10.getId().toString()
                         : "null"),
                 ThreadLocalPage.get().getTemplateContextString());
         initialize();
         initializeLocalVars();
         initializePassOn();
         initActions();
       } catch (utils.ValidationException ve) {
         ThreadLocalPage.get()
             .getValidationExceptions()
             .add(ve.setName(ThreadLocalPage.get().getValidationContext()));
         ThreadLocalPage.get().setValidated(false);
         utils.Warning.warn(
             "Validation failed in initialization of "
                 + "editColor(arg : Color)"
                 + ": "
                 + ve.getErrorMessage());
         skipThisTemplate = true;
       } catch (utils.MultipleValidationExceptions ve) {
         for (utils.ValidationException vex : ve.getValidationExceptions()) {
           ThreadLocalPage.get()
               .getValidationExceptions()
               .add(vex.setName(ThreadLocalPage.get().getValidationContext()));
           utils.Warning.warn(
               "Validation failed in initialization of "
                   + "editColor(arg : Color)"
                   + ": "
                   + vex.getErrorMessage());
         }
         ThreadLocalPage.get().setValidated(false);
         skipThisTemplate = true;
       }
     }
     validateInputsInternal();
   }
 }