- port to webui
This commit is contained in:
parent
9743b9ba00
commit
18f7930c24
|
|
@ -1,19 +1,38 @@
|
||||||
|
/******************************************************************************
|
||||||
|
* Copyright (C) 2008 Low Heng Sin *
|
||||||
|
* Copyright (C) 2008 Idalica Corporation *
|
||||||
|
* This program is free software; you can redistribute it and/or modify it *
|
||||||
|
* under the terms version 2 of the GNU General Public License as published *
|
||||||
|
* by the Free Software Foundation. This program is distributed in the hope *
|
||||||
|
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
|
||||||
|
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||||
|
* See the GNU General Public License for more details. *
|
||||||
|
* You should have received a copy of the GNU General Public License along *
|
||||||
|
* with this program; if not, write to the Free Software Foundation, Inc., *
|
||||||
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
|
||||||
|
*****************************************************************************/
|
||||||
package org.adempiere.webui.apps.wf;
|
package org.adempiere.webui.apps.wf;
|
||||||
|
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
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.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.ListItem;
|
import org.adempiere.webui.component.ListItem;
|
||||||
|
import org.adempiere.webui.component.ListModelTable;
|
||||||
import org.adempiere.webui.component.Listbox;
|
import org.adempiere.webui.component.Listbox;
|
||||||
import org.adempiere.webui.component.Row;
|
import org.adempiere.webui.component.Row;
|
||||||
import org.adempiere.webui.component.Rows;
|
import org.adempiere.webui.component.Rows;
|
||||||
import org.adempiere.webui.component.Textbox;
|
import org.adempiere.webui.component.Textbox;
|
||||||
|
import org.adempiere.webui.component.WListItemRenderer;
|
||||||
|
import org.adempiere.webui.component.WListbox;
|
||||||
import org.adempiere.webui.component.Window;
|
import org.adempiere.webui.component.Window;
|
||||||
import org.adempiere.webui.editor.WSearchEditor;
|
import org.adempiere.webui.editor.WSearchEditor;
|
||||||
import org.adempiere.webui.panel.ADForm;
|
import org.adempiere.webui.panel.ADForm;
|
||||||
|
|
@ -24,6 +43,7 @@ import org.compiere.model.MLookup;
|
||||||
import org.compiere.model.MLookupFactory;
|
import org.compiere.model.MLookupFactory;
|
||||||
import org.compiere.model.MQuery;
|
import org.compiere.model.MQuery;
|
||||||
import org.compiere.model.MRefList;
|
import org.compiere.model.MRefList;
|
||||||
|
import org.compiere.model.MSysConfig;
|
||||||
import org.compiere.util.CLogger;
|
import org.compiere.util.CLogger;
|
||||||
import org.compiere.util.DB;
|
import org.compiere.util.DB;
|
||||||
import org.compiere.util.DisplayType;
|
import org.compiere.util.DisplayType;
|
||||||
|
|
@ -37,12 +57,20 @@ import org.zkoss.zk.ui.Component;
|
||||||
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;
|
||||||
|
import org.zkoss.zk.ui.util.Clients;
|
||||||
import org.zkoss.zkex.zul.Borderlayout;
|
import org.zkoss.zkex.zul.Borderlayout;
|
||||||
import org.zkoss.zkex.zul.Center;
|
import org.zkoss.zkex.zul.Center;
|
||||||
|
import org.zkoss.zkex.zul.North;
|
||||||
import org.zkoss.zkex.zul.South;
|
import org.zkoss.zkex.zul.South;
|
||||||
import org.zkoss.zul.Div;
|
import org.zkoss.zul.Div;
|
||||||
import org.zkoss.zul.Hbox;
|
import org.zkoss.zul.Hbox;
|
||||||
|
import org.zkoss.zul.Html;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Direct port from WFActivity
|
||||||
|
* @author hengsin
|
||||||
|
*
|
||||||
|
*/
|
||||||
public class WWFActivity extends ADForm implements EventListener
|
public class WWFActivity extends ADForm implements EventListener
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
|
@ -51,10 +79,6 @@ public class WWFActivity extends ADForm implements EventListener
|
||||||
private static final long serialVersionUID = -653381810053334001L;
|
private static final long serialVersionUID = -653381810053334001L;
|
||||||
/** Window No */
|
/** Window No */
|
||||||
private int m_WindowNo = 0;
|
private int m_WindowNo = 0;
|
||||||
/** FormFrame */
|
|
||||||
// private FormFrame m_frame = null;
|
|
||||||
/** Menu */
|
|
||||||
// private AMenu m_menu = null;
|
|
||||||
/** Open Activities */
|
/** Open Activities */
|
||||||
private MWFActivity[] m_activities = null;
|
private MWFActivity[] m_activities = null;
|
||||||
/** Current Activity */
|
/** Current Activity */
|
||||||
|
|
@ -67,8 +91,6 @@ public class WWFActivity extends ADForm implements EventListener
|
||||||
private static CLogger log = CLogger.getCLogger(WWFActivity.class);
|
private static CLogger log = CLogger.getCLogger(WWFActivity.class);
|
||||||
|
|
||||||
//
|
//
|
||||||
// private Panel centerPanel = new Panel();
|
|
||||||
// private GridBagLayout centerLayout = new GridBagLayout();
|
|
||||||
private Label lNode = new Label(Msg.translate(Env.getCtx(), "AD_WF_Node_ID"));
|
private Label lNode = new Label(Msg.translate(Env.getCtx(), "AD_WF_Node_ID"));
|
||||||
private Textbox fNode = new Textbox();
|
private Textbox fNode = new Textbox();
|
||||||
private Label lDesctiption = new Label(Msg.translate(Env.getCtx(), "Description"));
|
private Label lDesctiption = new Label(Msg.translate(Env.getCtx(), "Description"));
|
||||||
|
|
@ -76,23 +98,24 @@ public class WWFActivity extends ADForm implements EventListener
|
||||||
private Label lHelp = new Label(Msg.translate(Env.getCtx(), "Help"));
|
private Label lHelp = new Label(Msg.translate(Env.getCtx(), "Help"));
|
||||||
private Textbox fHelp = new Textbox();
|
private Textbox fHelp = new Textbox();
|
||||||
private Label lHistory = new Label(Msg.translate(Env.getCtx(), "History"));
|
private Label lHistory = new Label(Msg.translate(Env.getCtx(), "History"));
|
||||||
private Textbox fHistory = new Textbox();
|
private Html fHistory = new Html();
|
||||||
private Label lAnswer = new Label(Msg.getMsg(Env.getCtx(), "Answer"));
|
private Label lAnswer = new Label(Msg.getMsg(Env.getCtx(), "Answer"));
|
||||||
// private Panel answers = new Panel(new FlowLayout(FlowLayout.LEADING));
|
|
||||||
private Textbox fAnswerText = new Textbox();
|
private Textbox fAnswerText = new Textbox();
|
||||||
private Listbox fAnswerList = new Listbox();
|
private Listbox fAnswerList = new Listbox();
|
||||||
private Button fAnswerButton = new Button();
|
private Button fAnswerButton = new Button();
|
||||||
private Button bPrevious = new Button();//AEnv.getButton("Previous");
|
private Button bZoom = new Button();
|
||||||
private Button bNext = new Button();//AEnv.getButton("Next");
|
|
||||||
private Button bZoom = new Button();//AEnv.getButton("Zoom");
|
|
||||||
private Label lTextMsg = new Label(Msg.getMsg(Env.getCtx(), "Messages"));
|
private Label lTextMsg = new Label(Msg.getMsg(Env.getCtx(), "Messages"));
|
||||||
private Textbox fTextMsg = new Textbox();
|
private Textbox fTextMsg = new Textbox();
|
||||||
private Button bOK = new Button();//ConfirmPanel.createOKButton(true);
|
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"));
|
||||||
private Label lOptional = new Label("(" + 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 ListModelTable model = null;
|
||||||
|
private WListbox listbox = new WListbox();
|
||||||
|
|
||||||
|
private final static String HISTORY_DIV_START_TAG = "<div style='width: 100%; height: 100px; border: 1px solid #7F9DB9;'>";
|
||||||
public WWFActivity()
|
public WWFActivity()
|
||||||
{
|
{
|
||||||
super();
|
super();
|
||||||
|
|
@ -104,8 +127,6 @@ public class WWFActivity extends ADForm implements EventListener
|
||||||
|
|
||||||
fAnswerList.setMold("select");
|
fAnswerList.setMold("select");
|
||||||
|
|
||||||
bPrevious.setImage("/images/Previous16.png");
|
|
||||||
bNext.setImage("/images/Next16.png");
|
|
||||||
bZoom.setImage("/images/Zoom16.png");
|
bZoom.setImage("/images/Zoom16.png");
|
||||||
bOK.setImage("/images/Ok24.png");
|
bOK.setImage("/images/Ok24.png");
|
||||||
|
|
||||||
|
|
@ -115,7 +136,7 @@ public class WWFActivity extends ADForm implements EventListener
|
||||||
Env.getCtx(), "AD_User_ID"), "", true, false, true);
|
Env.getCtx(), "AD_User_ID"), "", true, false, true);
|
||||||
|
|
||||||
init();
|
init();
|
||||||
display();
|
display(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void init()
|
private void init()
|
||||||
|
|
@ -138,8 +159,7 @@ public class WWFActivity extends ADForm implements EventListener
|
||||||
row.appendChild(div);
|
row.appendChild(div);
|
||||||
row.appendChild(fNode);
|
row.appendChild(fNode);
|
||||||
fNode.setWidth("100%");
|
fNode.setWidth("100%");
|
||||||
row.appendChild(bPrevious);
|
fNode.setReadonly(true);
|
||||||
bPrevious.addEventListener(Events.ON_CLICK, this);
|
|
||||||
|
|
||||||
row = new Row();
|
row = new Row();
|
||||||
rows.appendChild(row);
|
rows.appendChild(row);
|
||||||
|
|
@ -151,8 +171,7 @@ public class WWFActivity extends ADForm implements EventListener
|
||||||
row.appendChild(fDescription);
|
row.appendChild(fDescription);
|
||||||
fDescription.setMultiline(true);
|
fDescription.setMultiline(true);
|
||||||
fDescription.setWidth("100%");
|
fDescription.setWidth("100%");
|
||||||
row.appendChild(bNext);
|
fDescription.setReadonly(true);
|
||||||
bNext.addEventListener(Events.ON_CLICK, this);
|
|
||||||
|
|
||||||
row = new Row();
|
row = new Row();
|
||||||
rows.appendChild(row);
|
rows.appendChild(row);
|
||||||
|
|
@ -163,6 +182,8 @@ public class WWFActivity extends ADForm implements EventListener
|
||||||
row.appendChild(fHelp);
|
row.appendChild(fHelp);
|
||||||
fHelp.setMultiline(true);
|
fHelp.setMultiline(true);
|
||||||
fHelp.setWidth("100%");
|
fHelp.setWidth("100%");
|
||||||
|
fHelp.setReadonly(true);
|
||||||
|
fHelp.setRows(3);
|
||||||
row.appendChild(new Label());
|
row.appendChild(new Label());
|
||||||
|
|
||||||
row = new Row();
|
row = new Row();
|
||||||
|
|
@ -172,9 +193,6 @@ public class WWFActivity extends ADForm implements EventListener
|
||||||
div.appendChild(lHistory);
|
div.appendChild(lHistory);
|
||||||
row.appendChild(div);
|
row.appendChild(div);
|
||||||
row.appendChild(fHistory);
|
row.appendChild(fHistory);
|
||||||
fHistory.setRows(10);
|
|
||||||
fHistory.setMultiline(true);
|
|
||||||
fHistory.setWidth("100%");
|
|
||||||
row.appendChild(new Label());
|
row.appendChild(new Label());
|
||||||
|
|
||||||
row = new Row();
|
row = new Row();
|
||||||
|
|
@ -221,10 +239,19 @@ public class WWFActivity extends ADForm implements EventListener
|
||||||
layout.setHeight("100%");
|
layout.setHeight("100%");
|
||||||
layout.setStyle("background-color: transparent; position: absolute;");
|
layout.setStyle("background-color: transparent; position: absolute;");
|
||||||
|
|
||||||
|
North north = new North();
|
||||||
|
north.appendChild(listbox);
|
||||||
|
north.setSplittable(true);
|
||||||
|
north.setFlex(true);
|
||||||
|
layout.appendChild(north);
|
||||||
|
north.setStyle("background-color: transparent");
|
||||||
|
listbox.addEventListener(Events.ON_SELECT, this);
|
||||||
|
|
||||||
Center center = new Center();
|
Center center = new Center();
|
||||||
center.appendChild(grid);
|
center.appendChild(grid);
|
||||||
layout.appendChild(center);
|
layout.appendChild(center);
|
||||||
center.setStyle("background-color: transparent");
|
center.setStyle("background-color: transparent");
|
||||||
|
center.setFlex(true);
|
||||||
|
|
||||||
South south = new South();
|
South south = new South();
|
||||||
south.appendChild(statusBar);
|
south.appendChild(statusBar);
|
||||||
|
|
@ -232,34 +259,31 @@ public class WWFActivity extends ADForm implements EventListener
|
||||||
south.setStyle("background-color: transparent");
|
south.setStyle("background-color: transparent");
|
||||||
|
|
||||||
this.appendChild(layout);
|
this.appendChild(layout);
|
||||||
|
this.setStyle("height: 100%; width: 100%; position: absolute;");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onEvent(Event event) throws Exception
|
public void onEvent(Event event) throws Exception
|
||||||
{
|
{
|
||||||
// this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
|
||||||
|
|
||||||
Component comp = event.getTarget();
|
Component comp = event.getTarget();
|
||||||
String eventName = event.getName();
|
String eventName = event.getName();
|
||||||
|
|
||||||
if(eventName.equals(Events.ON_CLICK))
|
if(eventName.equals(Events.ON_CLICK))
|
||||||
{
|
{
|
||||||
if(comp == bNext || comp == bPrevious)
|
if (comp == bZoom)
|
||||||
{
|
|
||||||
if (comp == bNext)
|
|
||||||
m_index++;
|
|
||||||
else
|
|
||||||
m_index--;
|
|
||||||
display();
|
|
||||||
}
|
|
||||||
else if (comp == bZoom)
|
|
||||||
cmd_zoom();
|
cmd_zoom();
|
||||||
else if (comp == bOK)
|
else if (comp == bOK)
|
||||||
cmd_OK();
|
{
|
||||||
|
Clients.showBusy(Msg.getMsg(Env.getCtx(), "Processing"), true);
|
||||||
|
Events.echoEvent("onOK", this, null);
|
||||||
|
}
|
||||||
else if (comp == fAnswerButton)
|
else if (comp == fAnswerButton)
|
||||||
cmd_button();
|
cmd_button();
|
||||||
|
} else if (Events.ON_SELECT.equals(eventName) && comp == listbox)
|
||||||
|
{
|
||||||
|
m_index = listbox.getSelectedIndex();
|
||||||
|
if (m_index >= 0)
|
||||||
|
display(m_index);
|
||||||
}
|
}
|
||||||
|
|
||||||
// this.setCursor(Cursor.getDefaultCursor());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -321,6 +345,11 @@ public class WWFActivity extends ADForm implements EventListener
|
||||||
public int loadActivities()
|
public int loadActivities()
|
||||||
{
|
{
|
||||||
long start = System.currentTimeMillis();
|
long start = System.currentTimeMillis();
|
||||||
|
|
||||||
|
int MAX_ACTIVITIES_IN_LIST = MSysConfig.getIntValue("MAX_ACTIVITIES_IN_LIST", 200, Env.getAD_Client_ID(Env.getCtx()));
|
||||||
|
|
||||||
|
model = new ListModelTable();
|
||||||
|
|
||||||
ArrayList<MWFActivity> list = new ArrayList<MWFActivity>();
|
ArrayList<MWFActivity> list = new ArrayList<MWFActivity>();
|
||||||
String sql = "SELECT * FROM AD_WF_Activity a "
|
String sql = "SELECT * FROM AD_WF_Activity a "
|
||||||
+ "WHERE a.Processed='N' AND a.WFState='OS' AND ("
|
+ "WHERE a.Processed='N' AND a.WFState='OS' AND ("
|
||||||
|
|
@ -350,8 +379,14 @@ public class WWFActivity extends ADForm implements EventListener
|
||||||
rs = pstmt.executeQuery ();
|
rs = pstmt.executeQuery ();
|
||||||
while (rs.next ())
|
while (rs.next ())
|
||||||
{
|
{
|
||||||
list.add (new MWFActivity(Env.getCtx(), rs, null));
|
MWFActivity activity = new MWFActivity(Env.getCtx(), rs, null);
|
||||||
if (list.size() > 200) // HARDCODED
|
list.add (activity);
|
||||||
|
List<Object> rowData = new ArrayList<Object>();
|
||||||
|
rowData.add(activity.getPriority());
|
||||||
|
rowData.add(activity.getNodeName());
|
||||||
|
rowData.add(activity.getSummary());
|
||||||
|
model.add(rowData);
|
||||||
|
if (list.size() > MAX_ACTIVITIES_IN_LIST && MAX_ACTIVITIES_IN_LIST > 0)
|
||||||
{
|
{
|
||||||
log.warning("More then 200 Activities - ignored");
|
log.warning("More then 200 Activities - ignored");
|
||||||
break;
|
break;
|
||||||
|
|
@ -373,55 +408,75 @@ public class WWFActivity extends ADForm implements EventListener
|
||||||
log.fine("#" + m_activities.length
|
log.fine("#" + m_activities.length
|
||||||
+ "(" + (System.currentTimeMillis()-start) + "ms)");
|
+ "(" + (System.currentTimeMillis()-start) + "ms)");
|
||||||
m_index = 0;
|
m_index = 0;
|
||||||
|
|
||||||
|
String[] columns = new String[]{Msg.translate(Env.getCtx(), "Priority"),
|
||||||
|
Msg.translate(Env.getCtx(), "AD_WF_Node_ID"),
|
||||||
|
Msg.translate(Env.getCtx(), "Summary")};
|
||||||
|
|
||||||
|
WListItemRenderer renderer = new WListItemRenderer(Arrays.asList(columns));
|
||||||
|
ListHeader header = new ListHeader();
|
||||||
|
header.setWidth("30px");
|
||||||
|
renderer.setListHeader(0, header);
|
||||||
|
renderer.addTableValueChangeListener(listbox);
|
||||||
|
model.setNoColumns(columns.length);
|
||||||
|
listbox.setModel(model);
|
||||||
|
listbox.setItemRenderer(renderer);
|
||||||
|
listbox.repaint();
|
||||||
|
listbox.setFixedLayout(true);
|
||||||
|
|
||||||
return m_activities.length;
|
return m_activities.length;
|
||||||
} // loadActivities
|
} // loadActivities
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Display.
|
* Reset Display
|
||||||
* Fill Editors
|
* @param selIndex select index
|
||||||
|
* @return selected activity
|
||||||
*/
|
*/
|
||||||
public void display ()
|
private MWFActivity resetDisplay(int selIndex)
|
||||||
{
|
{
|
||||||
log.fine("Index=" + m_index);
|
|
||||||
//
|
|
||||||
fTextMsg.setValue ("");
|
|
||||||
fAnswerText.setVisible(false);
|
fAnswerText.setVisible(false);
|
||||||
fAnswerList.setVisible(false);
|
fAnswerList.setVisible(false);
|
||||||
fAnswerButton.setImage("/images/mWindow.png");
|
|
||||||
fAnswerButton.setVisible(false);
|
fAnswerButton.setVisible(false);
|
||||||
fTextMsg.setReadonly(m_activities.length == 0);
|
fAnswerButton.setImage("/images/mWindow.png");
|
||||||
// fTextMsg.setReadWrite(m_activities.length != 0);
|
fTextMsg.setReadonly(!(selIndex >= 0));
|
||||||
bZoom.setEnabled(m_activities.length != 0);
|
bZoom.setEnabled(selIndex >= 0);
|
||||||
bOK.setEnabled(m_activities.length != 0);
|
bOK.setEnabled(selIndex >= 0);
|
||||||
fForward.setValue(null);
|
fForward.setValue(null);
|
||||||
fForward.setReadWrite(m_activities.length != 0);
|
fForward.setReadWrite(selIndex >= 0);
|
||||||
// fForward.setEnabled(m_activities.length != 0);
|
//
|
||||||
statusBar.setStatusDB(String.valueOf(m_index) + "/" + m_activities.length);
|
statusBar.setStatusDB(String.valueOf(selIndex+1) + "/" + m_activities.length);
|
||||||
m_activity = null;
|
m_activity = null;
|
||||||
|
m_column = null;
|
||||||
if (m_activities.length > 0)
|
if (m_activities.length > 0)
|
||||||
{
|
{
|
||||||
if (m_index+1 > m_activities.length)
|
if (selIndex >= 0 && selIndex < m_activities.length)
|
||||||
{
|
m_activity = m_activities[selIndex];
|
||||||
log.log(Level.SEVERE, "Index (" + m_index
|
|
||||||
+ ") greater then activity length=" + m_activities.length);
|
|
||||||
m_index = 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
m_activity = m_activities[m_index];
|
|
||||||
}
|
}
|
||||||
// Nothing to show
|
// Nothing to show
|
||||||
if (m_activity == null)
|
if (m_activity == null)
|
||||||
{
|
{
|
||||||
fNode.setText ("");
|
fNode.setText ("");
|
||||||
fDescription.setValue ("");
|
fDescription.setText ("");
|
||||||
fHelp.setValue ("");
|
fHelp.setText ("");
|
||||||
fHistory.setValue ("");
|
fHistory.setContent(HISTORY_DIV_START_TAG + " </div>");
|
||||||
statusBar.setStatusDB("0/0");
|
statusBar.setStatusDB("0/0");
|
||||||
statusBar.setStatusLine(Msg.getMsg(Env.getCtx(), "WFNoActivities"));
|
statusBar.setStatusLine(Msg.getMsg(Env.getCtx(), "WFNoActivities"));
|
||||||
bNext.setEnabled(false);
|
}
|
||||||
bPrevious.setEnabled(false);
|
return m_activity;
|
||||||
// if (m_menu != null)
|
} // resetDisplay
|
||||||
// m_menu.updateActivities(0);
|
|
||||||
|
/**
|
||||||
|
* Display.
|
||||||
|
* Fill Editors
|
||||||
|
*/
|
||||||
|
public void display (int index)
|
||||||
|
{
|
||||||
|
log.fine("Index=" + index);
|
||||||
|
//
|
||||||
|
m_activity = resetDisplay(index);
|
||||||
|
// Nothing to show
|
||||||
|
if (m_activity == null)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Display Activity
|
// Display Activity
|
||||||
|
|
@ -429,7 +484,7 @@ public class WWFActivity extends ADForm implements EventListener
|
||||||
fDescription.setValue (m_activity.getNodeDescription());
|
fDescription.setValue (m_activity.getNodeDescription());
|
||||||
fHelp.setValue (m_activity.getNodeHelp());
|
fHelp.setValue (m_activity.getNodeHelp());
|
||||||
//
|
//
|
||||||
fHistory.setValue (m_activity.getHistoryHTML());
|
fHistory.setContent (HISTORY_DIV_START_TAG+m_activity.getHistoryHTML()+"</div>");
|
||||||
|
|
||||||
// User Actions
|
// User Actions
|
||||||
MWFNode node = m_activity.getNode();
|
MWFNode node = m_activity.getNode();
|
||||||
|
|
@ -447,7 +502,6 @@ public class WWFActivity extends ADForm implements EventListener
|
||||||
{
|
{
|
||||||
fAnswerList.appendItem(values[i].getName(), values[i].getValue());
|
fAnswerList.appendItem(values[i].getName(), values[i].getValue());
|
||||||
}
|
}
|
||||||
// fAnswerList.setModel(new DefaultComboBoxModel(values));
|
|
||||||
fAnswerList.setVisible(true);
|
fAnswerList.setVisible(true);
|
||||||
}
|
}
|
||||||
else if (dt == DisplayType.List)
|
else if (dt == DisplayType.List)
|
||||||
|
|
@ -457,7 +511,6 @@ public class WWFActivity extends ADForm implements EventListener
|
||||||
{
|
{
|
||||||
fAnswerList.appendItem(values[i].getName(), values[i].getValue());
|
fAnswerList.appendItem(values[i].getName(), values[i].getValue());
|
||||||
}
|
}
|
||||||
// fAnswerList.setModel(new DefaultComboBoxModel(values));
|
|
||||||
fAnswerList.setVisible(true);
|
fAnswerList.setVisible(true);
|
||||||
}
|
}
|
||||||
else // other display types come here
|
else // other display types come here
|
||||||
|
|
@ -475,67 +528,14 @@ public class WWFActivity extends ADForm implements EventListener
|
||||||
fAnswerButton.setTooltiptext(node.getDescription());
|
fAnswerButton.setTooltiptext(node.getDescription());
|
||||||
fAnswerButton.setVisible(true);
|
fAnswerButton.setVisible(true);
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
else if (MWFNode.ACTION_UserWorkbench.equals(node.getAction()))
|
|
||||||
log.log(Level.SEVERE, "Workflow Action not implemented yet");*/
|
|
||||||
else
|
else
|
||||||
log.log(Level.SEVERE, "Unknown Node Action: " + node.getAction());
|
log.log(Level.SEVERE, "Unknown Node Action: " + node.getAction());
|
||||||
//
|
|
||||||
// globalqss - comment following lines to solve the
|
|
||||||
// Bug [ 1711626 ] Workflow tab just allow to navigate first two activities
|
|
||||||
// if (m_menu != null)
|
|
||||||
// {
|
|
||||||
// m_menu.updateActivities(m_activities.length);
|
|
||||||
// }
|
|
||||||
// End
|
|
||||||
if (m_index+1 >= m_activities.length)
|
|
||||||
{
|
|
||||||
m_index = m_activities.length - 1;
|
|
||||||
bNext.setEnabled(false);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
bNext.setEnabled(true);
|
|
||||||
// Start
|
|
||||||
if (m_index <= 0)
|
|
||||||
{
|
|
||||||
m_index = 0;
|
|
||||||
bPrevious.setEnabled(false);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
bPrevious.setEnabled(true);
|
|
||||||
statusBar.setStatusDB((m_index+1) + "/" + m_activities.length);
|
statusBar.setStatusDB((m_index+1) + "/" + m_activities.length);
|
||||||
statusBar.setStatusLine(Msg.getMsg(Env.getCtx(), "WFActivities"));
|
statusBar.setStatusLine(Msg.getMsg(Env.getCtx(), "WFActivities"));
|
||||||
} // display
|
} // display
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Action Listener
|
|
||||||
* @param e event
|
|
||||||
* @see java.awt.event.ActionListener#actionPerformed(ActionEvent)
|
|
||||||
*/
|
|
||||||
/* public void actionPerformed (ActionEvent e)
|
|
||||||
{
|
|
||||||
this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
|
||||||
//
|
|
||||||
if (e.getSource() == bNext || e.getSource() == bPrevious)
|
|
||||||
{
|
|
||||||
if (e.getSource() == bNext)
|
|
||||||
m_index++;
|
|
||||||
else
|
|
||||||
m_index--;
|
|
||||||
display();
|
|
||||||
}
|
|
||||||
else if (e.getSource() == bZoom)
|
|
||||||
cmd_zoom();
|
|
||||||
else if (e.getSource() == bOK)
|
|
||||||
cmd_OK();
|
|
||||||
else if (e.getSource() == fAnswerButton)
|
|
||||||
cmd_button();
|
|
||||||
//
|
|
||||||
this.setCursor(Cursor.getDefaultCursor());
|
|
||||||
} // actionPerformed
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Zoom
|
* Zoom
|
||||||
*/
|
*/
|
||||||
|
|
@ -569,12 +569,6 @@ public class WWFActivity extends ADForm implements EventListener
|
||||||
+ " - " + query + " (IsSOTrx=" + IsSOTrx + ")");
|
+ " - " + query + " (IsSOTrx=" + IsSOTrx + ")");
|
||||||
|
|
||||||
AEnv.zoom(AD_Window_ID, query);
|
AEnv.zoom(AD_Window_ID, query);
|
||||||
// AWindow frame = new AWindow();
|
|
||||||
// if (!frame.initWindow(AD_Window_ID, query))
|
|
||||||
// return;
|
|
||||||
// AEnv.addToWindowManager(frame);
|
|
||||||
// AEnv.showCenterScreen(frame);
|
|
||||||
// frame = null;
|
|
||||||
}
|
}
|
||||||
else if (MWFNode.ACTION_UserForm.equals(node.getAction()))
|
else if (MWFNode.ACTION_UserForm.equals(node.getAction()))
|
||||||
{
|
{
|
||||||
|
|
@ -582,17 +576,7 @@ public class WWFActivity extends ADForm implements EventListener
|
||||||
|
|
||||||
Window form = ADForm.openForm(AD_Form_ID);
|
Window form = ADForm.openForm(AD_Form_ID);
|
||||||
AEnv.showWindow(form);
|
AEnv.showWindow(form);
|
||||||
// FormFrame ff = new FormFrame();
|
|
||||||
// ff.openForm(AD_Form_ID);
|
|
||||||
// ff.pack();
|
|
||||||
// AEnv.addToWindowManager(ff);
|
|
||||||
// AEnv.showCenterScreen(ff);
|
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
else if (MWFNode.ACTION_UserWorkbench.equals(node.getAction()))
|
|
||||||
{
|
|
||||||
|
|
||||||
}*/
|
|
||||||
else
|
else
|
||||||
log.log(Level.SEVERE, "No User Action:" + node.getAction());
|
log.log(Level.SEVERE, "No User Action:" + node.getAction());
|
||||||
} // cmd_button
|
} // cmd_button
|
||||||
|
|
@ -601,11 +585,14 @@ public class WWFActivity extends ADForm implements EventListener
|
||||||
/**
|
/**
|
||||||
* Save
|
* Save
|
||||||
*/
|
*/
|
||||||
private void cmd_OK()
|
public void onOK()
|
||||||
{
|
{
|
||||||
log.config("Activity=" + m_activity);
|
log.config("Activity=" + m_activity);
|
||||||
if (m_activity == null)
|
if (m_activity == null)
|
||||||
|
{
|
||||||
|
Clients.showBusy(null, false);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
int AD_User_ID = Env.getAD_User_ID(Env.getCtx());
|
int AD_User_ID = Env.getAD_User_ID(Env.getCtx());
|
||||||
String textMsg = fTextMsg.getValue();
|
String textMsg = fTextMsg.getValue();
|
||||||
//
|
//
|
||||||
|
|
@ -614,7 +601,9 @@ public class WWFActivity extends ADForm implements EventListener
|
||||||
Object forward = null;//fForward.getValue();
|
Object forward = null;//fForward.getValue();
|
||||||
|
|
||||||
// ensure activity is ran within a transaction - [ 1953628 ]
|
// ensure activity is ran within a transaction - [ 1953628 ]
|
||||||
Trx trx = Trx.get(Trx.createTrxName("FWFA"), true);
|
Trx trx = null;
|
||||||
|
try {
|
||||||
|
trx = Trx.get(Trx.createTrxName("FWFA"), true);
|
||||||
m_activity.set_TrxName(trx.getTrxName());
|
m_activity.set_TrxName(trx.getTrxName());
|
||||||
|
|
||||||
if (forward != null)
|
if (forward != null)
|
||||||
|
|
@ -692,10 +681,16 @@ public class WWFActivity extends ADForm implements EventListener
|
||||||
}
|
}
|
||||||
|
|
||||||
trx.commit();
|
trx.commit();
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
Clients.showBusy(null, false);
|
||||||
|
if (trx != null)
|
||||||
trx.close();
|
trx.close();
|
||||||
|
}
|
||||||
|
|
||||||
// Next
|
// Next
|
||||||
loadActivities();
|
loadActivities();
|
||||||
display();
|
display(-1);
|
||||||
} // cmd_OK
|
} // onOK
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue