IDEMPIERE-3953 open special forms from process related to info windows

This commit is contained in:
Murilo Habermann Torquato 2019-04-15 17:18:28 -03:00
parent 877e198a70
commit 374e23a700
2 changed files with 65 additions and 1 deletions

View File

@ -134,10 +134,30 @@ public abstract class ADForm extends Window implements EventListener<Event>, IHe
*/
public static ADForm openForm (int adFormID)
{
return openForm(adFormID, null);
return openForm(adFormID, null, null);
}
/**
* Open a form base on it's ID
*
* @param adFormID
* @param gridTab
* @return
*/
public static ADForm openForm (int adFormID, GridTab gridTab)
{
return openForm(adFormID, gridTab, null);
}
/**
* Open a form base on it's ID and a Process Info parameters
*
* @param adFormID
* @param gridTab
* @param pi
* @return
*/
public static ADForm openForm (int adFormID, GridTab gridTab, ProcessInfo pi)
{
ADForm form;
MForm mform = new MForm(Env.getCtx(), adFormID, null);
@ -156,6 +176,7 @@ public abstract class ADForm extends Window implements EventListener<Event>, IHe
if (form != null)
{
form.gridTab = gridTab;
form.setProcessInfo(pi);
form.init(adFormID, name);
return form;
}

View File

@ -2044,6 +2044,49 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
MPInstance instance = new MPInstance(Env.getCtx(), processId, 0);
instance.saveEx();
final int pInstanceID = instance.getAD_PInstance_ID();
// devCoffee - enable use of special forms from process related with info windows
m_pi.setAD_PInstance_ID(pInstanceID);
int adFormID = m_process.getAD_Form_ID();
if (adFormID != 0 )
{
String title = m_process.getName();
if (title == null || title.length() == 0)
title = m_process.getValue();
// store in T_Selection table selected rows for Execute Process that retrieves from T_Selection in code.
DB.createT_SelectionNew(pInstanceID, getSaveKeys(getInfoColumnIDFromProcess(processId)), null);
ADForm form = ADForm.openForm(adFormID, null, m_pi);
Mode mode = form.getWindowMode();
form.setAttribute(Window.MODE_KEY, form.getWindowMode());
form.setAttribute(Window.INSERT_POSITION_KEY, Window.INSERT_NEXT);
if (mode == Mode.HIGHLIGHTED || mode == Mode.MODAL) {
form.addEventListener(DialogEvents.ON_WINDOW_CLOSE, new EventListener<Event>() {
@Override
public void onEvent(Event event) throws Exception {
;
}
});
form.doHighlighted();
form.focus();
}
else {
form.addEventListener(DialogEvents.ON_WINDOW_CLOSE, new EventListener<Event>() {
@Override
public void onEvent(Event event) throws Exception {
updateListSelected();
recordSelectedData.clear();
Clients.response(new AuEcho(InfoPanel.this, "onQueryCallback", null));
onUserQuery();
}
});
SessionManager.getAppDesktop().showWindow(form);
}
return;
}
// Execute Process
m_pi.setAD_PInstance_ID(pInstanceID);
m_pi.setAD_InfoWindow_ID(infoWindow.getAD_InfoWindow_ID());