public Object evaluate(Object obj) { if(obj == null){ return ""; } return SimpleTemplateUtils.replace(template, (String)obj); } }
public static String replace(String template, String value) { return replace(template, "0", value); }
public static String getOnSumbmitForm(String formName) { String capitalizedFormName = StringUtils.capitalize(formName); return SimpleTemplateUtils.replace(ON_FORM_SUBMIT, "FORMNAME", capitalizedFormName); }
public static String replace(String template, String key, String value) { Map<String, String> map = new HashMap<String, String>(); map.put(key, value); return replace(template, map); }
public static String getLinkButton(String value, String url) { Map<String, String> map = new HashMap<String, String>(); map.put("value", value); map.put("url", url); return SimpleTemplateUtils.replace(FUNC_LINKBUTTON, map); }
public static String getOnChangeCalendar(String elemName, boolean nullOption) { Map<String, String> map = new HashMap<String, String>(); map.put("elemName", elemName); map.put("nullOption", String.valueOf(nullOption)); return SimpleTemplateUtils.replace(ONCHNAGECALENDAR, map); }
public static String getRemoveStringArrayFunction(int row, int column) { Map<String, String> map = new HashMap<String, String>(); map.put("ROW", String.valueOf(row)); map.put("COLUMN", String.valueOf(column)); return SimpleTemplateUtils.replace(FUNC_REMOVESTRINGARRY, map); }
public static String getBooleanAttributeFunction(int row, int column, boolean isCheckType) { Map<String, String> map = new HashMap<String, String>(); map.put("ROW", String.valueOf(row)); map.put("COLUMN", String.valueOf(column)); map.put("ISCHECKTYPE", String.valueOf(isCheckType)); return SimpleTemplateUtils.replace(FUNC_BOOLEAN_ATTRIBUTE, map); }
public static String getAddStringArrayFunction(int row, int column, int defaultInputSize) { Map<String, String> map = new HashMap<String, String>(); map.put("ROW", String.valueOf(row)); map.put("COLUMN", String.valueOf(column)); map.put("DEFAULT_INPUT_SIZE", String.valueOf(defaultInputSize)); return SimpleTemplateUtils.replace(FUNC_ADDSTRINGARRY, map); }
public static String getDeleteConfirmationFunc(String page, boolean needEncode) { if (needEncode) { page = CharUtils.urlEncode(page); } return SimpleTemplateUtils.replace(FUNC_DELETECONFIRMATION, page); }
public String getPath(Long id) { return doCreatePath(SimpleTemplateUtils.replace(path, "id", "" + id)); }
private static String getScript(String name, String latitude, String longitude, String comment) { StringBuffer buf = new StringBuffer(); String template = null; if ("gmap2".equals(name)) { template = getJavascriptTemplate("gmap2Load"); } else { template = getJavascriptTemplate("gmapLoad"); } Map<String, String> map = new HashMap<String, String>(); map.put("mapid", "map"); map.put("lon", longitude); map.put("lat", latitude); map.put("msg", comment); buf.append(SimpleTemplateUtils.replace(template, map)); if ("gmap2".equals(name)) { buf.append("addInitFunction(gmap2Load);"); } else { buf.append("addInitFunction(gmapLoad);"); } return buf.toString(); }
public String doHTMLView(CmsRequest request, CmsResponse response, PluginRequest prequest) throws PluginException { String[] args = prequest.getArgs(); int num = DEFAULT_NUM; if (existArg(args, 0)) { num = Integer.parseInt(args[0]); } WikiContext context = getConfiguration().getWikiContext(); HtmlBuffer buf = new HtmlBuffer(); buf.appendHeading(2, SimpleTemplateUtils.replace( getMessage("recent.modified"), String.valueOf(num))); try { List resourceList = context.getRecentList(request, num); if (resourceList.size() > 0) { buf.appendStartTag("ul"); for (Iterator i = resourceList.iterator(); i.hasNext();) { Resource resource = (Resource) i.next(); printLink(buf, context, resource, request); } buf.endTag(); } } catch (Exception e) { throw new PluginException(e); } return buf.toString(); }
protected String getNoPageMessage(CmsRequest request, String pagepath, String entityName, String id) { HtmlBuffer buf = new HtmlBuffer(); buf.appendStartTag("blockquote"); if (existPageOrFolder(request, pagepath)) { // Maybe Folder exist String message = getMessage("message.existfolder"); message = SimpleTemplateUtils.replace(message, pagepath); buf.appendBody(message); } else { Map map = new HashMap(); map.put(Constants.PARAM_PAGENAME, pagepath); if (id != null) { // TODO // bindEntityId(map, entityName, id); } String message = getMessage("message.nopage"); message = SimpleTemplateUtils.replace(message, pagepath); buf.appendBody(message); // buf.appendAnchor("./createNamedPage.do", "Yes", map); buf .appendAnchor(request.getContextPath() + "/" + request.getSiteName() + "/createNamedPage.do", "Yes", map); } buf.endTag(); return buf.toString(); }