@Override protected Map<String, Object> getRowData(final ComponentParameter cp, final Object dataObject) { final NewsAttachment attachment = (NewsAttachment) dataObject; final KVMap kv = new KVMap(); try { final AttachmentFile af = newsContext.getAttachmentService().createAttachmentFile(attachment); kv.put( "topic", new LinkElement(attachment.getTopic()) .setOnclick(JS.loc(DownloadUtils.getDownloadHref(af), true)) .setTitle(attachment.getDescription())); } catch (final IOException e) { kv.put("topic", attachment.getTopic()); } kv.put("attachsize", FileUtils.toFileSize(attachment.getAttachsize())); final Class<? extends Enum<?>> eClass = ((NewsFormAttachPage) get(cp)).getAttachmentTypeClass(); if (eClass != null) { kv.put("attachtype", eClass.getEnumConstants()[attachment.getAttachtype()]); } if (((INewsWebContext) newsContext).getLogRef() != null) { kv.put( "downloads", LinkElement.style2(attachment.getDownloads()) .setOnclick( "$Actions['NewsTabAttachPage_logWin']('beanId=" + attachment.getId() + "');")); } else { kv.put("downloads", attachment.getDownloads()); } kv.put("userId", cp.getUser(attachment.getUserId())); kv.put("createDate", attachment.getCreateDate()); kv.add(TablePagerColumn.OPE, toOpeHTML(cp, attachment)); return kv; }
public static void doWorkitemComplete( final ComponentParameter cParameter, final WorkitemBean workitem) throws IOException { final KVMap kv = new KVMap(); try { final WorkitemComplete workitemComplete = WorkitemComplete.get(workitem); // 绑定变量 final IWorkflowForm workflowForm = (IWorkflowForm) workitemComplete.getWorkflowForm(); if (workflowForm != null) { workflowForm.bindVariables(workitemComplete.getVariables()); } final IWorkitemCompleteHandler hdl = (IWorkitemCompleteHandler) cParameter.getComponentHandler(); if (!workitemComplete.isAllCompleted()) { hdl.complete(cParameter, workitemComplete); } else { // 是否有手动情况 final ActivityComplete activityComplete = workitemComplete.getActivityComplete(); final boolean transitionManual = activityComplete.isTransitionManual(); final boolean participantManual = activityComplete.isParticipantManual(); if (transitionManual || participantManual) { kv.add( "responseText", UrlForward.getResponseText( cParameter, ComponentUtils.getResourceHomePath(WorkitemCompleteBean.class) + "/jsp/workitem_complete_route.jsp")); kv.add("transitionManual", transitionManual); kv.add("participantManual", participantManual); } else { hdl.complete(cParameter, workitemComplete); } } } catch (final Throwable ex) { kv.add("exception", AjaxRequestUtils.createException(ex)); } final Writer out = cParameter.getResponseWriter(); out.write(kv.toJSON()); out.flush(); }
@Override public MenuItems getContextMenu( final ComponentParameter cParameter, final MenuBean menuBean, final MenuItem menuItem) { if (menuItem == null) { final KVMap map = new KVMap() .add( "Add", MenuItem.of( menuBean, $m("Add"), MenuItem.ICON_ADD, "$category_action(item).add();")) .add( "Edit", MenuItem.of( menuBean, $m("Edit"), MenuItem.ICON_EDIT, "$category_action(item).edit();")) .add( "Delete", MenuItem.of( menuBean, $m("Delete"), MenuItem.ICON_DELETE, "$category_action(item).del();")) .add( "Refresh", MenuItem.of( menuBean, $m("Refresh"), MenuItem.ICON_REFRESH, "$category_action(item).refresh();")) .add( "Move", MenuItem.of(menuBean, $m("Menu.move")) .addChild( MenuItem.of( menuBean, $m("Menu.up"), MenuItem.ICON_UP, "$category_action(item).move(true, false);")) .addChild( MenuItem.of( menuBean, $m("Menu.up2"), MenuItem.ICON_UP2, "$category_action(item).move(true, true);")) .addChild( MenuItem.of( menuBean, $m("Menu.down"), MenuItem.ICON_DOWN, "$category_action(item).move(false, false);")) .addChild( MenuItem.of( menuBean, $m("Menu.down2"), MenuItem.ICON_DOWN2, "$category_action(item).move(false, true);"))) .add( "Expand", MenuItem.of( menuBean, $m("Tree.expand"), MenuItem.ICON_EXPAND, "$category_action(item).expand();")) .add( "Collapse", MenuItem.of( menuBean, $m("Tree.collapse"), MenuItem.ICON_COLLAPSE, "$category_action(item).collapse();")); final MenuItems items = MenuItems.of(); for (final String k : getContextMenuKeys()) { if ("-".equals(k)) { items.add(MenuItem.sep(menuBean)); } else { items.add((MenuItem) map.get(k)); } } return items; } return null; }