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 <hengsin@gmail.com>
This commit is contained in:
parent
8f6f6dbbb3
commit
71b97d7a40
|
@ -22,6 +22,8 @@ import java.util.logging.Level;
|
||||||
import org.adempiere.webui.LayoutUtils;
|
import org.adempiere.webui.LayoutUtils;
|
||||||
import org.adempiere.webui.apps.AEnv;
|
import org.adempiere.webui.apps.AEnv;
|
||||||
import org.adempiere.webui.component.Button;
|
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.Grid;
|
||||||
import org.adempiere.webui.component.Label;
|
import org.adempiere.webui.component.Label;
|
||||||
import org.adempiere.webui.component.ListHeader;
|
import org.adempiere.webui.component.ListHeader;
|
||||||
|
@ -53,11 +55,13 @@ import org.compiere.util.DisplayType;
|
||||||
import org.compiere.util.Env;
|
import org.compiere.util.Env;
|
||||||
import org.compiere.util.Msg;
|
import org.compiere.util.Msg;
|
||||||
import org.compiere.util.Trx;
|
import org.compiere.util.Trx;
|
||||||
|
import org.compiere.util.Util;
|
||||||
import org.compiere.util.ValueNamePair;
|
import org.compiere.util.ValueNamePair;
|
||||||
import org.compiere.wf.MWFActivity;
|
import org.compiere.wf.MWFActivity;
|
||||||
import org.compiere.wf.MWFNode;
|
import org.compiere.wf.MWFNode;
|
||||||
import org.compiere.wf.MWFProcess;
|
import org.compiere.wf.MWFProcess;
|
||||||
import org.zkoss.zk.ui.Component;
|
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.Event;
|
||||||
import org.zkoss.zk.ui.event.EventListener;
|
import org.zkoss.zk.ui.event.EventListener;
|
||||||
import org.zkoss.zk.ui.event.Events;
|
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.Html;
|
||||||
import org.zkoss.zul.North;
|
import org.zkoss.zul.North;
|
||||||
import org.zkoss.zul.South;
|
import org.zkoss.zul.South;
|
||||||
|
import org.zkoss.zul.Vlayout;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Direct port from WFActivity
|
* Direct port from WFActivity
|
||||||
|
@ -81,7 +86,7 @@ public class WWFActivity extends ADForm implements EventListener<Event>
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = -8405802852868437716L;
|
private static final long serialVersionUID = -1658595186719510159L;
|
||||||
/** Window No */
|
/** Window No */
|
||||||
private int m_WindowNo = 0;
|
private int m_WindowNo = 0;
|
||||||
/** Open Activities */
|
/** Open Activities */
|
||||||
|
@ -113,14 +118,14 @@ public class WWFActivity extends ADForm implements EventListener<Event>
|
||||||
private Textbox fTextMsg = new Textbox();
|
private Textbox fTextMsg = new Textbox();
|
||||||
private Button bOK = new Button();
|
private Button bOK = new Button();
|
||||||
private WSearchEditor fForward = null; // dynInit
|
private WSearchEditor fForward = null; // dynInit
|
||||||
private Label lForward = new Label(Msg.getMsg(Env.getCtx(), "Forward"));
|
private Label lForward = new Label(Msg.getMsg(Env.getCtx(), "Forward") + " (" + Msg.translate(Env.getCtx(), "Optional") + ")");
|
||||||
private Label lOptional = new Label("(" + Msg.translate(Env.getCtx(), "Optional") + ")");
|
|
||||||
private StatusBarPanel statusBar = new StatusBarPanel();
|
private StatusBarPanel statusBar = new StatusBarPanel();
|
||||||
|
private Button bRefresh = new Button();
|
||||||
|
|
||||||
private ListModelTable model = null;
|
private ListModelTable model = null;
|
||||||
private WListbox listbox = new WListbox();
|
private WListbox listbox = new WListbox();
|
||||||
|
|
||||||
private final static String HISTORY_DIV_START_TAG = "<div style='height: 100px; border: 1px solid #7F9DB9;'>";
|
private final static String HISTORY_DIV_START_TAG = "<div style='overflow-y:scroll;height: 100px; border: 1px solid #7F9DB9;'>";
|
||||||
public WWFActivity()
|
public WWFActivity()
|
||||||
{
|
{
|
||||||
super();
|
super();
|
||||||
|
@ -136,10 +141,15 @@ public class WWFActivity extends ADForm implements EventListener<Event>
|
||||||
if (ThemeManager.isUseFontIconForImage()) {
|
if (ThemeManager.isUseFontIconForImage()) {
|
||||||
bZoom.setIconSclass("z-icon-Zoom");
|
bZoom.setIconSclass("z-icon-Zoom");
|
||||||
bOK.setIconSclass("z-icon-Ok");
|
bOK.setIconSclass("z-icon-Ok");
|
||||||
|
bRefresh.setIconSclass("z-icon-Refresh");
|
||||||
} else {
|
} else {
|
||||||
bZoom.setImage(ThemeManager.getThemeResource("images/Zoom16.png"));
|
bZoom.setImage(ThemeManager.getThemeResource("images/Zoom16.png"));
|
||||||
bOK.setImage(ThemeManager.getThemeResource("images/Ok16.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,
|
MLookup lookup = MLookupFactory.get(Env.getCtx(), m_WindowNo,
|
||||||
0, 10443, DisplayType.Search);
|
0, 10443, DisplayType.Search);
|
||||||
|
@ -150,14 +160,26 @@ public class WWFActivity extends ADForm implements EventListener<Event>
|
||||||
display(-1);
|
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()
|
private void init()
|
||||||
{
|
{
|
||||||
Grid grid = new Grid();
|
Grid grid = new Grid();
|
||||||
ZKUpdateUtil.setWidth(grid, "100%");
|
grid.setStyle("margin:0; padding:0;");
|
||||||
ZKUpdateUtil.setHeight(grid, "100%");
|
|
||||||
grid.setStyle("margin:0; padding:0; position: absolute; align: center; valign: center;");
|
|
||||||
grid.makeNoStrip();
|
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();
|
Rows rows = new Rows();
|
||||||
grid.appendChild(rows);
|
grid.appendChild(rows);
|
||||||
|
@ -169,7 +191,6 @@ public class WWFActivity extends ADForm implements EventListener<Event>
|
||||||
div.appendChild(lNode);
|
div.appendChild(lNode);
|
||||||
row.appendChild(div);
|
row.appendChild(div);
|
||||||
row.appendChild(fNode);
|
row.appendChild(fNode);
|
||||||
ZKUpdateUtil.setWidth(fNode, "100%");
|
|
||||||
ZKUpdateUtil.setHflex(fNode, "true");
|
ZKUpdateUtil.setHflex(fNode, "true");
|
||||||
fNode.setReadonly(true);
|
fNode.setReadonly(true);
|
||||||
|
|
||||||
|
@ -182,7 +203,6 @@ public class WWFActivity extends ADForm implements EventListener<Event>
|
||||||
row.appendChild(div);
|
row.appendChild(div);
|
||||||
row.appendChild(fDescription);
|
row.appendChild(fDescription);
|
||||||
fDescription.setMultiline(true);
|
fDescription.setMultiline(true);
|
||||||
ZKUpdateUtil.setWidth(fDescription, "100%");
|
|
||||||
ZKUpdateUtil.setHflex(fDescription, "true");
|
ZKUpdateUtil.setHflex(fDescription, "true");
|
||||||
fDescription.setReadonly(true);
|
fDescription.setReadonly(true);
|
||||||
|
|
||||||
|
@ -195,10 +215,8 @@ public class WWFActivity extends ADForm implements EventListener<Event>
|
||||||
row.appendChild(fHelp);
|
row.appendChild(fHelp);
|
||||||
fHelp.setMultiline(true);
|
fHelp.setMultiline(true);
|
||||||
fHelp.setRows(3);
|
fHelp.setRows(3);
|
||||||
ZKUpdateUtil.setWidth(fHelp, "100%");
|
|
||||||
ZKUpdateUtil.setHflex(fHelp, "true");
|
ZKUpdateUtil.setHflex(fHelp, "true");
|
||||||
fHelp.setReadonly(true);
|
fHelp.setReadonly(true);
|
||||||
row.appendChild(new Label());
|
|
||||||
|
|
||||||
row = new Row();
|
row = new Row();
|
||||||
rows.appendChild(row);
|
rows.appendChild(row);
|
||||||
|
@ -208,7 +226,6 @@ public class WWFActivity extends ADForm implements EventListener<Event>
|
||||||
row.appendChild(div);
|
row.appendChild(div);
|
||||||
row.appendChild(fHistory);
|
row.appendChild(fHistory);
|
||||||
ZKUpdateUtil.setHflex(fHistory, "true");
|
ZKUpdateUtil.setHflex(fHistory, "true");
|
||||||
row.appendChild(new Label());
|
|
||||||
|
|
||||||
row = new Row();
|
row = new Row();
|
||||||
rows.appendChild(row);
|
rows.appendChild(row);
|
||||||
|
@ -221,9 +238,9 @@ public class WWFActivity extends ADForm implements EventListener<Event>
|
||||||
ZKUpdateUtil.setHflex(fAnswerText, "true");
|
ZKUpdateUtil.setHflex(fAnswerText, "true");
|
||||||
hbox.appendChild(fAnswerList);
|
hbox.appendChild(fAnswerList);
|
||||||
hbox.appendChild(fAnswerButton);
|
hbox.appendChild(fAnswerButton);
|
||||||
fAnswerButton.addEventListener(Events.ON_CLICK, this);
|
hbox.appendChild(bZoom);
|
||||||
row.appendChild(hbox);
|
row.appendChild(hbox);
|
||||||
row.appendChild(bZoom);
|
fAnswerButton.addEventListener(Events.ON_CLICK, this);
|
||||||
bZoom.addEventListener(Events.ON_CLICK, this);
|
bZoom.addEventListener(Events.ON_CLICK, this);
|
||||||
|
|
||||||
row = new Row();
|
row = new Row();
|
||||||
|
@ -233,10 +250,8 @@ public class WWFActivity extends ADForm implements EventListener<Event>
|
||||||
div.appendChild(lTextMsg);
|
div.appendChild(lTextMsg);
|
||||||
row.appendChild(div);
|
row.appendChild(div);
|
||||||
row.appendChild(fTextMsg);
|
row.appendChild(fTextMsg);
|
||||||
ZKUpdateUtil.setHflex(fTextMsg, "true");
|
|
||||||
fTextMsg.setMultiline(true);
|
fTextMsg.setMultiline(true);
|
||||||
ZKUpdateUtil.setWidth(fTextMsg, "100%");
|
ZKUpdateUtil.setWidth(fTextMsg, "100%");
|
||||||
row.appendChild(new Label());
|
|
||||||
|
|
||||||
row = new Row();
|
row = new Row();
|
||||||
rows.appendChild(row);
|
rows.appendChild(row);
|
||||||
|
@ -246,15 +261,16 @@ public class WWFActivity extends ADForm implements EventListener<Event>
|
||||||
row.appendChild(div);
|
row.appendChild(div);
|
||||||
hbox = new Hbox();
|
hbox = new Hbox();
|
||||||
hbox.appendChild(fForward.getComponent());
|
hbox.appendChild(fForward.getComponent());
|
||||||
hbox.appendChild(lOptional);
|
hbox.appendChild(bOK);
|
||||||
|
hbox.appendChild(bRefresh);
|
||||||
row.appendChild(hbox);
|
row.appendChild(hbox);
|
||||||
row.appendChild(bOK);
|
|
||||||
bOK.addEventListener(Events.ON_CLICK, this);
|
bOK.addEventListener(Events.ON_CLICK, this);
|
||||||
|
bRefresh.addEventListener(Events.ON_CLICK, this);
|
||||||
|
|
||||||
Borderlayout layout = new Borderlayout();
|
Borderlayout layout = new Borderlayout();
|
||||||
ZKUpdateUtil.setWidth(layout, "100%");
|
ZKUpdateUtil.setWidth(layout, "100%");
|
||||||
ZKUpdateUtil.setHeight(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 north = new North();
|
||||||
north.appendChild(listbox);
|
north.appendChild(listbox);
|
||||||
|
@ -267,7 +283,11 @@ public class WWFActivity extends ADForm implements EventListener<Event>
|
||||||
listbox.addEventListener(Events.ON_SELECT, this);
|
listbox.addEventListener(Events.ON_SELECT, this);
|
||||||
|
|
||||||
Center center = new Center();
|
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);
|
layout.appendChild(center);
|
||||||
center.setStyle("background-color: transparent; overflow:auto");
|
center.setStyle("background-color: transparent; overflow:auto");
|
||||||
ZKUpdateUtil.setVflex(grid, "1");
|
ZKUpdateUtil.setVflex(grid, "1");
|
||||||
|
@ -279,7 +299,7 @@ public class WWFActivity extends ADForm implements EventListener<Event>
|
||||||
south.setStyle("background-color: transparent");
|
south.setStyle("background-color: transparent");
|
||||||
|
|
||||||
this.appendChild(layout);
|
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
|
public void onEvent(Event event) throws Exception
|
||||||
|
@ -291,6 +311,14 @@ public class WWFActivity extends ADForm implements EventListener<Event>
|
||||||
{
|
{
|
||||||
if (comp == bZoom)
|
if (comp == bZoom)
|
||||||
cmd_zoom();
|
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)
|
else if (comp == bOK)
|
||||||
{
|
{
|
||||||
Clients.showBusy(Msg.getMsg(Env.getCtx(), "Processing"));
|
Clients.showBusy(Msg.getMsg(Env.getCtx(), "Processing"));
|
||||||
|
|
Loading…
Reference in New Issue