public static String[] getPgroups(final PageParameter pp) { final String _gstr = pp.getParameter("pgroup"); if (StringUtils.hasText(_gstr)) { return StringUtils.split(Base64.decodeToString(pp.getParameter("pgroup"))); } return null; }
@Override protected String toCategoryHTML(final PageParameter pp) { final StringBuilder sb = new StringBuilder(); final Map<String, Map<String, List<ProcessModelBean>>> gmap2 = getProcessModelMap2(pp); final ProcessModelBean cur = WorkflowUtils.getProcessModel(pp); final String[] pgroups = getPgroups(pp); if (cur != null || (pgroups != null && pgroups.length == 2)) { List<ProcessModelBean> l = null; String key = null; String pgroup = null; Map<String, List<ProcessModelBean>> m2 = null; if (cur != null) { final String[] arr = StringUtils.split(cur.getModelText(), "."); key = arr.length > 1 ? arr[0] : CONST_OTHER; m2 = gmap2.get(key); pgroup = wfpmService.getProcessDocument(cur).getProcessNode().getPgroup(); if (!StringUtils.hasText(pgroup)) { pgroup = CONST_OTHER; } } else { key = pgroups[0]; m2 = gmap2.get(key); pgroup = pgroups[1]; } if (m2 != null) { l = m2.get(pgroup); } final CategoryItems items = CategoryItems.of(); if (l != null) { for (final ProcessModelBean pm : l) { final _CategoryItem item = (_CategoryItem) new _CategoryItem(pm) .setHref( uFactory.getUrl(pp, MyProcessWorksTPage.class, "modelId=" + pm.getId())); if (cur != null) { item.setSelected(cur.getId().equals(pm.getId())); } items.add(item); } } if (cur != null && (l == null || !l.contains(cur))) { items.add( new _CategoryItem(cur) .setHref(uFactory.getUrl(pp, MyProcessWorksTPage.class, "modelId=" + cur.getId())) .setSelected(true)); } sb.append("<div class='gtitle'>"); sb.append( new LinkElement($m("MyProcessWorksTPage.9")) .setHref(uFactory.getUrl(pp, getOriginalClass()))); AbstractElement<?> ele; if (cur != null) { ele = new LinkElement(pgroup) .setHref( uFactory.getUrl( pp, MyProcessWorksTPage.class, "pgroup=" + HttpUtils.encodeUrl(Base64.encodeToString(key + ";" + pgroup)))); } else { ele = new SpanElement(pgroup); } sb.append(SpanElement.NAV(3)).append(ele); sb.append("</div>"); sb.append(items); return sb.toString(); } sb.append("<div class='gtitle'>").append($m("MyProcessWorksTPage.16")).append("</div>"); sb.append("<div class='gtree'>"); for (final Map.Entry<String, Map<String, List<ProcessModelBean>>> e : gmap2.entrySet()) { final String key = e.getKey(); sb.append("<div class='gitem"); if (cur != null && cur.getModelText().startsWith(key)) { sb.append(" cur"); } sb.append("'>"); sb.append(new SpanElement(key).setClassName("glbl")); // final int size = gmap.get(key).size(); // if (size > 0) { // sb.append(new SupElement("(" + size + ")").addClassName("gsize")); // } sb.append(" <div class='psub'>"); int i = 0; for (final Map.Entry<String, List<ProcessModelBean>> e2 : e.getValue().entrySet()) { sb.append("<div class='pgroup'"); if (i++ == 0) { sb.append(" style='border-top: 0'"); } sb.append(">") .append( new SpanElement(e2.getKey()) .setOnclick( JS.loc( uFactory.getUrl( pp, MyProcessWorksTPage.class, "pgroup=" + HttpUtils.encodeUrl( Base64.encodeToString(key + ";" + e2.getKey())))))); for (final ProcessModelBean pm : e2.getValue()) { sb.append("<div class='pitem'>"); sb.append( new LinkElement(WorkflowUtils.getShortMtext(pm)) .setOnclick( JS.loc( uFactory.getUrl( pp, MyProcessWorksTPage.class, "modelId=" + pm.getId())))); sb.append("</div>"); } sb.append("</div>"); } sb.append(" </div>"); sb.append("</div>"); } sb.append("</div>"); return sb.toString(); }