From 71b97d7a404b1e451072a8f279ef6a54d28552ce Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 15 Jun 2022 11:09:43 +0200 Subject: [PATCH] IDEMPIERE-5317 Improvements for Workflow Activities (#1366) * IDEMPIERE-5317 Improvements for Workflow Activities IDEMPIERE-5317 #resolve * IDEMPIERE-5317 Improvements for Workflow Activities * tooltip text for button * minor layout tweaks * minor clean up * processing prompt for refresh Co-authored-by: hengsin --- .../adempiere/webui/apps/wf/WWFActivity.java | 74 +++++++++++++------ 1 file changed, 51 insertions(+), 23 deletions(-) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/wf/WWFActivity.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/wf/WWFActivity.java index bc5aa65e97..cd5230fdf9 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/wf/WWFActivity.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/wf/WWFActivity.java @@ -22,6 +22,8 @@ import java.util.logging.Level; import org.adempiere.webui.LayoutUtils; import org.adempiere.webui.apps.AEnv; import org.adempiere.webui.component.Button; +import org.adempiere.webui.component.Column; +import org.adempiere.webui.component.Columns; import org.adempiere.webui.component.Grid; import org.adempiere.webui.component.Label; import org.adempiere.webui.component.ListHeader; @@ -53,11 +55,13 @@ import org.compiere.util.DisplayType; import org.compiere.util.Env; import org.compiere.util.Msg; import org.compiere.util.Trx; +import org.compiere.util.Util; import org.compiere.util.ValueNamePair; import org.compiere.wf.MWFActivity; import org.compiere.wf.MWFNode; import org.compiere.wf.MWFProcess; import org.zkoss.zk.ui.Component; +import org.zkoss.zk.ui.Executions; import org.zkoss.zk.ui.event.Event; import org.zkoss.zk.ui.event.EventListener; import org.zkoss.zk.ui.event.Events; @@ -69,6 +73,7 @@ import org.zkoss.zul.Hbox; import org.zkoss.zul.Html; import org.zkoss.zul.North; import org.zkoss.zul.South; +import org.zkoss.zul.Vlayout; /** * Direct port from WFActivity @@ -81,7 +86,7 @@ public class WWFActivity extends ADForm implements EventListener /** * */ - private static final long serialVersionUID = -8405802852868437716L; + private static final long serialVersionUID = -1658595186719510159L; /** Window No */ private int m_WindowNo = 0; /** Open Activities */ @@ -113,14 +118,14 @@ public class WWFActivity extends ADForm implements EventListener private Textbox fTextMsg = new Textbox(); private Button bOK = new Button(); private WSearchEditor fForward = null; // dynInit - private Label lForward = new Label(Msg.getMsg(Env.getCtx(), "Forward")); - private Label lOptional = new Label("(" + Msg.translate(Env.getCtx(), "Optional") + ")"); + private Label lForward = new Label(Msg.getMsg(Env.getCtx(), "Forward") + " (" + Msg.translate(Env.getCtx(), "Optional") + ")"); private StatusBarPanel statusBar = new StatusBarPanel(); + private Button bRefresh = new Button(); private ListModelTable model = null; private WListbox listbox = new WListbox(); - private final static String HISTORY_DIV_START_TAG = "
"; + private final static String HISTORY_DIV_START_TAG = "
"; public WWFActivity() { super(); @@ -133,13 +138,18 @@ public class WWFActivity extends ADForm implements EventListener fAnswerList.setMold("select"); - if (ThemeManager.isUseFontIconForImage()) { + if (ThemeManager.isUseFontIconForImage()) { bZoom.setIconSclass("z-icon-Zoom"); bOK.setIconSclass("z-icon-Ok"); + bRefresh.setIconSclass("z-icon-Refresh"); } else { bZoom.setImage(ThemeManager.getThemeResource("images/Zoom16.png")); bOK.setImage(ThemeManager.getThemeResource("images/Ok16.png")); + bRefresh.setImage(ThemeManager.getThemeResource("images/Refresh16.png")); } + setTooltipText(bZoom, "Zoom"); + setTooltipText(bOK, "Ok"); + setTooltipText(bRefresh, "Refresh"); MLookup lookup = MLookupFactory.get(Env.getCtx(), m_WindowNo, 0, 10443, DisplayType.Search); @@ -150,14 +160,26 @@ public class WWFActivity extends ADForm implements EventListener display(-1); } + private void setTooltipText(Button btn, String key) { + String text = Util.cleanAmp(Msg.translate(Env.getCtx(), key)); + if (!Util.isEmpty(text, true)) + btn.setTooltiptext(text); + } + private void init() { Grid grid = new Grid(); - ZKUpdateUtil.setWidth(grid, "100%"); - ZKUpdateUtil.setHeight(grid, "100%"); - grid.setStyle("margin:0; padding:0; position: absolute; align: center; valign: center;"); + grid.setStyle("margin:0; padding:0;"); grid.makeNoStrip(); - grid.setOddRowSclass("even"); + + Columns columns = new Columns(); + grid.appendChild(columns); + Column column = new Column(); + ZKUpdateUtil.setWidth(column, "30%"); + columns.appendChild(column); + column = new Column(); + ZKUpdateUtil.setWidth(column, "70%"); + columns.appendChild(column); Rows rows = new Rows(); grid.appendChild(rows); @@ -169,7 +191,6 @@ public class WWFActivity extends ADForm implements EventListener div.appendChild(lNode); row.appendChild(div); row.appendChild(fNode); - ZKUpdateUtil.setWidth(fNode, "100%"); ZKUpdateUtil.setHflex(fNode, "true"); fNode.setReadonly(true); @@ -182,7 +203,6 @@ public class WWFActivity extends ADForm implements EventListener row.appendChild(div); row.appendChild(fDescription); fDescription.setMultiline(true); - ZKUpdateUtil.setWidth(fDescription, "100%"); ZKUpdateUtil.setHflex(fDescription, "true"); fDescription.setReadonly(true); @@ -195,10 +215,8 @@ public class WWFActivity extends ADForm implements EventListener row.appendChild(fHelp); fHelp.setMultiline(true); fHelp.setRows(3); - ZKUpdateUtil.setWidth(fHelp, "100%"); ZKUpdateUtil.setHflex(fHelp, "true"); fHelp.setReadonly(true); - row.appendChild(new Label()); row = new Row(); rows.appendChild(row); @@ -208,7 +226,6 @@ public class WWFActivity extends ADForm implements EventListener row.appendChild(div); row.appendChild(fHistory); ZKUpdateUtil.setHflex(fHistory, "true"); - row.appendChild(new Label()); row = new Row(); rows.appendChild(row); @@ -221,9 +238,9 @@ public class WWFActivity extends ADForm implements EventListener ZKUpdateUtil.setHflex(fAnswerText, "true"); hbox.appendChild(fAnswerList); hbox.appendChild(fAnswerButton); - fAnswerButton.addEventListener(Events.ON_CLICK, this); + hbox.appendChild(bZoom); row.appendChild(hbox); - row.appendChild(bZoom); + fAnswerButton.addEventListener(Events.ON_CLICK, this); bZoom.addEventListener(Events.ON_CLICK, this); row = new Row(); @@ -233,10 +250,8 @@ public class WWFActivity extends ADForm implements EventListener div.appendChild(lTextMsg); row.appendChild(div); row.appendChild(fTextMsg); - ZKUpdateUtil.setHflex(fTextMsg, "true"); fTextMsg.setMultiline(true); ZKUpdateUtil.setWidth(fTextMsg, "100%"); - row.appendChild(new Label()); row = new Row(); rows.appendChild(row); @@ -246,15 +261,16 @@ public class WWFActivity extends ADForm implements EventListener row.appendChild(div); hbox = new Hbox(); hbox.appendChild(fForward.getComponent()); - hbox.appendChild(lOptional); + hbox.appendChild(bOK); + hbox.appendChild(bRefresh); row.appendChild(hbox); - row.appendChild(bOK); bOK.addEventListener(Events.ON_CLICK, this); + bRefresh.addEventListener(Events.ON_CLICK, this); Borderlayout layout = new Borderlayout(); ZKUpdateUtil.setWidth(layout, "100%"); ZKUpdateUtil.setHeight(layout, "100%"); - layout.setStyle("background-color: transparent; position: absolute;"); + layout.setStyle("background-color: transparent; position: relative;"); North north = new North(); north.appendChild(listbox); @@ -267,7 +283,11 @@ public class WWFActivity extends ADForm implements EventListener listbox.addEventListener(Events.ON_SELECT, this); Center center = new Center(); - center.appendChild(grid); + Vlayout vlayout = new Vlayout(); + vlayout.appendChild(grid); + vlayout.setWidth("100%"); + vlayout.setHeight("99%"); + center.appendChild(vlayout); layout.appendChild(center); center.setStyle("background-color: transparent; overflow:auto"); ZKUpdateUtil.setVflex(grid, "1"); @@ -279,7 +299,7 @@ public class WWFActivity extends ADForm implements EventListener south.setStyle("background-color: transparent"); this.appendChild(layout); - this.setStyle("height: 100%; width: 100%; position: absolute;"); + this.setStyle("height: 100%; width: 100%; position: relative;"); } public void onEvent(Event event) throws Exception @@ -291,6 +311,14 @@ public class WWFActivity extends ADForm implements EventListener { if (comp == bZoom) cmd_zoom(); + else if (comp == bRefresh) + { + Clients.showBusy(Msg.getMsg(Env.getCtx(), "Processing")); + Executions.schedule(getDesktop(), e -> { + loadActivities(); + Clients.clearBusy(); + }, new Event("onRefresh")); + } else if (comp == bOK) { Clients.showBusy(Msg.getMsg(Env.getCtx(), "Processing"));