public EasyWrap tool(String key, Class clazz) { return tool(key, clazz.getName()); }
public EasyWrap tool(String key, String classname) { ToolConfiguration tool = new ToolConfiguration(); if (key != null) { tool.setKey(key); } tool.setClassname(classname); if (this.config instanceof ToolConfiguration) { ToolboxConfiguration toolbox = (ToolboxConfiguration)getParent(); toolbox.addTool(tool); return new EasyWrap(tool, toolbox); } else if (this.config instanceof ToolboxConfiguration) { ToolboxConfiguration toolbox = (ToolboxConfiguration)getConfiguration(); toolbox.addTool(tool); return new EasyWrap(tool, toolbox); } throw new IllegalStateException("Wrapping unknown "+Configuration.class.getName()+": "+getConfiguration()); } }
config.property( "safeMode", Boolean.FALSE ); config.toolbox( Scope.REQUEST ) .tool( ContextTool.class ) .tool( LinkTool.class ) .tool( LoopTool.class ) .tool( RenderTool.class ); config.toolbox( Scope.APPLICATION ).property( "locale", locale ) .tool( AlternatorTool.class ) .tool( ClassTool.class ) .tool( ComparisonDateTool.class ).property( "format", dateFormat ) .tool( ConversionTool.class ).property( "dateFormat", dateFormat ) .tool( DisplayTool.class ) .tool( EscapeTool.class ) .tool( FieldTool.class ) .tool( MathTool.class ) .tool( NumberTool.class ) .tool( ResourceTool.class ).property( "bundles", new String[] { "site-renderer" } )
public EasyWrap<C> restrictTo(String path) { if (this.config instanceof ToolConfiguration) { ToolConfiguration tool = (ToolConfiguration)this.config; tool.setRestrictTo(path); return this; } else if (this.config instanceof ToolboxConfiguration) { ToolboxConfiguration toolbox = (ToolboxConfiguration)this.config; for (ToolConfiguration tool : toolbox.getTools()) { tool.setRestrictTo(path); } return this; } throw new IllegalStateException("Wrapping unknown "+Configuration.class.getName()+": "+getConfiguration()); }
public EasyWrap tool(String classname) { return tool(null, classname); }
public EasyWrap tool(Class clazz) { return tool(null, clazz); }
public EasyWrap<ToolboxConfiguration> toolbox(String scope) { ToolboxConfiguration toolbox = new ToolboxConfiguration(); toolbox.setScope(scope); addToolbox(toolbox); this.toolbox = new EasyWrap<ToolboxConfiguration>(toolbox, this); return this.toolbox; }
public EasyWrap<ToolConfiguration> tool(String key, String classname) { if (toolbox == null) { toolbox(ToolboxFactory.DEFAULT_SCOPE); } return toolbox.tool(key, classname); }