public String executeTemplatePhase(int phase, String name, Object[] args, Environment env) { java.io.StringWriter s = new java.io.StringWriter(); PrintWriter out = new java.io.PrintWriter(s); ThreadLocalOut.push(out); try { TemplateServlet temp = ((TemplateServlet) env.getTemplate(name).newInstance()); switch (phase) { case 2: temp.validateInputs(name, args, env, null, null); break; case 4: temp.render(name, args, env, null, null); break; } } catch (Exception oe) { try { TemplateCall tcall = env.getWithcall(name); // 'elements' or requires arg TemplateServlet temp = ((TemplateServlet) env.getTemplate(tcall.name).newInstance()); String parent = env.getWithcall(name) == null ? null : env.getWithcall(name).parentName; switch (phase) { case 2: temp.validateInputs(parent, tcall.args, env, null, null); break; case 4: temp.render(parent, tcall.args, env, null, null); break; } } catch (Exception ie) { oe.printStackTrace(); ie.printStackTrace(); } } ThreadLocalOut.popChecked(out); return s.toString(); }
public static Environment loadTemplateMap( String keyOverwrite, org.webdsl.lang.Environment staticEnv) { staticEnv.putTemplate( keyOverwrite == null ? "root_wireframe0$l$_s_ad0String" : keyOverwrite, root_wireframe0$l$_s_ad0String_Template.class); loadLiftedTemplateMap(staticEnv); return staticEnv; }
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); }
private void handleActionsInternal() { String ident = ""; String forelementcounter = "0"; int fallbackcounter = 0; boolean inForLoop = false; int forLoopCounter = 0; ident = ""; if (inForLoop) { ident += forelementcounter; } ident += "tcall7"; ThreadLocalPage.get().enterTemplateContext("tcall7"); try { Object[] args59 = {}; Object[] args58 = {}; if (templatecalls.get(ident) == null) { templatecalls.put(ident, (TemplateServlet) env.getTemplate("main").newInstance()); } try { withcallsmapout = withcallsmap; Map<String, String> attrsmapout = TemplateCall.EmptyAttrs; ((TemplateServlet) templatecalls.get(ident)) .handleActions( args59, new Environment(env), new utils.TemplateCall("none", args58), withcallsmapout, attrsmapout, out); if (ThreadLocalPage.get().hasExecutedAction) return; } catch (NullPointerException npe) { } } catch (IllegalAccessException iae) { System.out.println("Problem in template servlet template lookup: " + iae.getMessage()); } catch (InstantiationException ie) { System.out.println("Problem in template servlet template lookup: " + ie.getMessage()); } catch (NullPointerException npe) { System.out.println("Problem in template lookup for " + "main" + ": " + npe.getMessage()); npe.printStackTrace(); } ident = ""; ThreadLocalPage.get().leaveTemplateContextChecked("tcall7"); }
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(); } }
private void initializePassOn() { env.putVariable("arg10", arg10); }