hg merge d6b2cf8369af
This commit is contained in:
commit
3152f5a094
|
@ -18,6 +18,7 @@ import java.sql.PreparedStatement;
|
|||
import java.sql.ResultSet;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.adempiere.util.Callback;
|
||||
import org.adempiere.webui.adwindow.ADWindow;
|
||||
import org.adempiere.webui.session.SessionManager;
|
||||
import org.compiere.model.GridTab;
|
||||
|
@ -57,7 +58,7 @@ import org.zkoss.zul.Menupopup;
|
|||
* @author Teo Sarca, SC ARHIPAC SERVICE SRL
|
||||
* <li>BF [ 1904928 ] Request: Related Request field not filled
|
||||
*/
|
||||
public class WRequest implements EventListener
|
||||
public class WRequest implements EventListener<Event>
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
|
@ -180,7 +181,7 @@ public class WRequest implements EventListener
|
|||
m_popup.open(invoker);
|
||||
} // getZoomTargets
|
||||
|
||||
public void onEvent(Event e) throws Exception
|
||||
public void onEvent(final Event e) throws Exception
|
||||
{
|
||||
if (e.getTarget() instanceof Menuitem)
|
||||
{
|
||||
|
@ -206,60 +207,68 @@ public class WRequest implements EventListener
|
|||
}
|
||||
|
||||
int AD_Window_ID = WINDOW_REQUESTS_ALL; // 232=all - 201=my
|
||||
ADWindow frame = SessionManager.getAppDesktop().openWindow(AD_Window_ID, query);
|
||||
if(frame == null)
|
||||
return;
|
||||
// New - set Table/Record
|
||||
if (e.getTarget() == m_new)
|
||||
{
|
||||
GridTab tab = frame.getADWindowContent().getActiveGridTab();
|
||||
tab.dataNew (false);
|
||||
tab.setValue("AD_Table_ID", new Integer(m_AD_Table_ID));
|
||||
tab.setValue("Record_ID", new Integer(m_Record_ID));
|
||||
//
|
||||
if (m_C_BPartner_ID != 0)
|
||||
tab.setValue("C_BPartner_ID", new Integer(m_C_BPartner_ID));
|
||||
//
|
||||
if (m_AD_Table_ID == MBPartner.Table_ID)
|
||||
tab.setValue("C_BPartner_ID", new Integer(m_Record_ID));
|
||||
else if (m_AD_Table_ID == MUser.Table_ID)
|
||||
tab.setValue("AD_User_ID", new Integer(m_Record_ID));
|
||||
//
|
||||
else if (m_AD_Table_ID == MProject.Table_ID)
|
||||
tab.setValue("C_Project_ID", new Integer(m_Record_ID));
|
||||
else if (m_AD_Table_ID == MAsset.Table_ID)
|
||||
tab.setValue("A_Asset_ID", new Integer(m_Record_ID));
|
||||
//
|
||||
else if (m_AD_Table_ID == MOrder.Table_ID)
|
||||
tab.setValue("C_Order_ID", new Integer(m_Record_ID));
|
||||
else if (m_AD_Table_ID == MInvoice.Table_ID)
|
||||
tab.setValue("C_Invoice_ID", new Integer(m_Record_ID));
|
||||
//
|
||||
else if (m_AD_Table_ID == MProduct.Table_ID)
|
||||
tab.setValue("M_Product_ID", new Integer(m_Record_ID));
|
||||
else if (m_AD_Table_ID == MPayment.Table_ID)
|
||||
tab.setValue("C_Payment_ID", new Integer(m_Record_ID));
|
||||
//
|
||||
else if (m_AD_Table_ID == MInOut.Table_ID)
|
||||
tab.setValue("M_InOut_ID", new Integer(m_Record_ID));
|
||||
else if (m_AD_Table_ID == MRMA.Table_ID)
|
||||
tab.setValue("M_RMA_ID", new Integer(m_Record_ID));
|
||||
//
|
||||
else if (m_AD_Table_ID == MCampaign.Table_ID)
|
||||
tab.setValue("C_Campaign_ID", new Integer(m_Record_ID));
|
||||
//
|
||||
else if (m_AD_Table_ID == MRequest.Table_ID)
|
||||
tab.setValue(MRequest.COLUMNNAME_R_RequestRelated_ID, new Integer(m_Record_ID));
|
||||
// FR [2842165] - Order Ref link from SO line creating new request
|
||||
else if (m_AD_Table_ID == MOrderLine.Table_ID) {
|
||||
MOrderLine oLine = new MOrderLine(Env.getCtx(), m_Record_ID, null);
|
||||
if (oLine != null) {
|
||||
tab.setValue(MOrderLine.COLUMNNAME_C_Order_ID, new Integer(oLine.getC_Order_ID()));
|
||||
}
|
||||
SessionManager.getAppDesktop().openWindow(AD_Window_ID, query, new Callback<ADWindow>() {
|
||||
|
||||
@Override
|
||||
public void onCallback(ADWindow result) {
|
||||
if(result == null)
|
||||
return;
|
||||
|
||||
onNew(e, result);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void onNew(Event e, ADWindow frame) {
|
||||
// New - set Table/Record
|
||||
if (e.getTarget() == m_new)
|
||||
{
|
||||
GridTab tab = frame.getADWindowContent().getActiveGridTab();
|
||||
tab.dataNew (false);
|
||||
tab.setValue("AD_Table_ID", new Integer(m_AD_Table_ID));
|
||||
tab.setValue("Record_ID", new Integer(m_Record_ID));
|
||||
//
|
||||
if (m_C_BPartner_ID != 0)
|
||||
tab.setValue("C_BPartner_ID", new Integer(m_C_BPartner_ID));
|
||||
//
|
||||
if (m_AD_Table_ID == MBPartner.Table_ID)
|
||||
tab.setValue("C_BPartner_ID", new Integer(m_Record_ID));
|
||||
else if (m_AD_Table_ID == MUser.Table_ID)
|
||||
tab.setValue("AD_User_ID", new Integer(m_Record_ID));
|
||||
//
|
||||
else if (m_AD_Table_ID == MProject.Table_ID)
|
||||
tab.setValue("C_Project_ID", new Integer(m_Record_ID));
|
||||
else if (m_AD_Table_ID == MAsset.Table_ID)
|
||||
tab.setValue("A_Asset_ID", new Integer(m_Record_ID));
|
||||
//
|
||||
else if (m_AD_Table_ID == MOrder.Table_ID)
|
||||
tab.setValue("C_Order_ID", new Integer(m_Record_ID));
|
||||
else if (m_AD_Table_ID == MInvoice.Table_ID)
|
||||
tab.setValue("C_Invoice_ID", new Integer(m_Record_ID));
|
||||
//
|
||||
else if (m_AD_Table_ID == MProduct.Table_ID)
|
||||
tab.setValue("M_Product_ID", new Integer(m_Record_ID));
|
||||
else if (m_AD_Table_ID == MPayment.Table_ID)
|
||||
tab.setValue("C_Payment_ID", new Integer(m_Record_ID));
|
||||
//
|
||||
else if (m_AD_Table_ID == MInOut.Table_ID)
|
||||
tab.setValue("M_InOut_ID", new Integer(m_Record_ID));
|
||||
else if (m_AD_Table_ID == MRMA.Table_ID)
|
||||
tab.setValue("M_RMA_ID", new Integer(m_Record_ID));
|
||||
//
|
||||
else if (m_AD_Table_ID == MCampaign.Table_ID)
|
||||
tab.setValue("C_Campaign_ID", new Integer(m_Record_ID));
|
||||
//
|
||||
else if (m_AD_Table_ID == MRequest.Table_ID)
|
||||
tab.setValue(MRequest.COLUMNNAME_R_RequestRelated_ID, new Integer(m_Record_ID));
|
||||
// FR [2842165] - Order Ref link from SO line creating new request
|
||||
else if (m_AD_Table_ID == MOrderLine.Table_ID) {
|
||||
MOrderLine oLine = new MOrderLine(Env.getCtx(), m_Record_ID, null);
|
||||
if (oLine != null) {
|
||||
tab.setValue(MOrderLine.COLUMNNAME_C_Order_ID, new Integer(oLine.getC_Order_ID()));
|
||||
}
|
||||
}
|
||||
|
||||
frame = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -273,7 +273,7 @@ public class WFPanel extends Borderlayout implements EventListener
|
|||
|
||||
private void start(MWFNode wfn) {
|
||||
if (wfn.getAD_Window_ID() > 0) {
|
||||
SessionManager.getAppDesktop().openWindow(wfn.getAD_Window_ID());
|
||||
SessionManager.getAppDesktop().openWindow(wfn.getAD_Window_ID(), null);
|
||||
} else if (wfn.getAD_Form_ID() > 0) {
|
||||
SessionManager.getAppDesktop().openForm(wfn.getAD_Form_ID());
|
||||
} else if (wfn.getAD_Process_ID() > 0) {
|
||||
|
|
|
@ -15,6 +15,7 @@ package org.adempiere.webui.dashboard;
|
|||
|
||||
import java.util.Enumeration;
|
||||
|
||||
import org.adempiere.util.Callback;
|
||||
import org.adempiere.webui.adwindow.ADWindow;
|
||||
import org.adempiere.webui.exception.ApplicationException;
|
||||
import org.adempiere.webui.panel.TreeSearchPanel;
|
||||
|
@ -285,12 +286,17 @@ public class DPFavourites extends DashboardPanel implements EventListener<Event>
|
|||
query.addRestriction("1=2");
|
||||
query.setRecordCount(0);
|
||||
|
||||
ADWindow frame = SessionManager.getAppDesktop().openWindow(menu.getAD_Window_ID(), query);
|
||||
if(frame == null)
|
||||
return;
|
||||
|
||||
GridTab tab = frame.getADWindowContent().getActiveGridTab();
|
||||
tab.dataNew(false);
|
||||
SessionManager.getAppDesktop().openWindow(menu.getAD_Window_ID(), query, new Callback<ADWindow>() {
|
||||
|
||||
@Override
|
||||
public void onCallback(ADWindow result) {
|
||||
if(result == null)
|
||||
return;
|
||||
|
||||
GridTab tab = result.getADWindowContent().getActiveGridTab();
|
||||
tab.dataNew(false);
|
||||
}
|
||||
});
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
|
|
@ -148,7 +148,7 @@ public class DPRecentItems extends DashboardPanel implements EventListener<Event
|
|||
String TableName = MTable.getTableName(Env.getCtx(), ri.getAD_Table_ID());
|
||||
MQuery query = MQuery.getEqualQuery(TableName + "_ID", ri.getRecord_ID());
|
||||
|
||||
SessionManager.getAppDesktop().openWindow(ri.getAD_Window_ID(), query);
|
||||
SessionManager.getAppDesktop().openWindow(ri.getAD_Window_ID(), query, null);
|
||||
}
|
||||
}
|
||||
if (comp instanceof Image) // Refresh button
|
||||
|
|
|
@ -64,7 +64,7 @@ public abstract class AbstractDesktop extends AbstractUIPart implements IDesktop
|
|||
|
||||
if(menu.getAction().equals(MMenu.ACTION_Window))
|
||||
{
|
||||
openWindow(menu.getAD_Window_ID());
|
||||
openWindow(menu.getAD_Window_ID(), null);
|
||||
}
|
||||
else if(menu.getAction().equals(MMenu.ACTION_Process) ||
|
||||
menu.getAction().equals(MMenu.ACTION_Report))
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
*****************************************************************************/
|
||||
package org.adempiere.webui.desktop;
|
||||
|
||||
import org.adempiere.util.Callback;
|
||||
import org.adempiere.webui.ClientInfo;
|
||||
import org.adempiere.webui.adwindow.ADWindow;
|
||||
import org.adempiere.webui.apps.ProcessDialog;
|
||||
|
@ -142,7 +143,7 @@ public interface IDesktop extends UIPart {
|
|||
* @param windowId
|
||||
* @return ADWindow
|
||||
*/
|
||||
public ADWindow openWindow(int windowId);
|
||||
public void openWindow(int windowId, Callback<ADWindow> callback);
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -150,7 +151,7 @@ public interface IDesktop extends UIPart {
|
|||
* @param query
|
||||
* @return ADWindow
|
||||
*/
|
||||
public ADWindow openWindow(int windowId, MQuery query);
|
||||
public void openWindow(int windowId, MQuery query, Callback<ADWindow> callback);
|
||||
|
||||
/**
|
||||
* Open operating system task window
|
||||
|
|
|
@ -17,6 +17,7 @@ import java.io.IOException;
|
|||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.adempiere.util.Callback;
|
||||
import org.adempiere.util.ContextRunnable;
|
||||
import org.adempiere.webui.adwindow.ADWindow;
|
||||
import org.adempiere.webui.apps.ProcessDialog;
|
||||
|
@ -120,8 +121,8 @@ public abstract class TabbedDesktop extends AbstractDesktop {
|
|||
* @param windowId
|
||||
* @return ADWindow
|
||||
*/
|
||||
public ADWindow openWindow(int windowId) {
|
||||
return openWindow(windowId, null);
|
||||
public void openWindow(int windowId, Callback<ADWindow> callback) {
|
||||
openWindow(windowId, null, callback);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -130,17 +131,15 @@ public abstract class TabbedDesktop extends AbstractDesktop {
|
|||
* @param query
|
||||
* @return ADWindow
|
||||
*/
|
||||
public ADWindow openWindow(int windowId, MQuery query) {
|
||||
public void openWindow(int windowId, MQuery query, Callback<ADWindow> callback) {
|
||||
final ADWindow adWindow = new ADWindow(Env.getCtx(), windowId, query);
|
||||
|
||||
final DesktopTabpanel tabPanel = new DesktopTabpanel();
|
||||
final Tab tab = windowContainer.addWindow(tabPanel, adWindow.getTitle(), true);
|
||||
tab.setImage(IN_PROGRESS_IMAGE);
|
||||
tab.setClosable(false);
|
||||
OpenWindowRunnable runnable = new OpenWindowRunnable(adWindow, tab, tabPanel);
|
||||
Adempiere.getThreadPoolExecutor().schedule(runnable, 100, TimeUnit.MICROSECONDS);
|
||||
|
||||
return adWindow;
|
||||
OpenWindowRunnable runnable = new OpenWindowRunnable(adWindow, tab, tabPanel, callback);
|
||||
Adempiere.getThreadPoolExecutor().schedule(runnable, 10, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -223,7 +222,7 @@ public abstract class TabbedDesktop extends AbstractDesktop {
|
|||
final Tab tab = windowContainer.insertAfter(windowContainer.getSelectedTab(), tabPanel, wnd.getTitle(), true, true);
|
||||
tab.setImage(IN_PROGRESS_IMAGE);
|
||||
tab.setClosable(false);
|
||||
OpenWindowRunnable runnable = new OpenWindowRunnable(wnd, tab, tabPanel);
|
||||
OpenWindowRunnable runnable = new OpenWindowRunnable(wnd, tab, tabPanel, null);
|
||||
Adempiere.getThreadPoolExecutor().schedule(runnable, 100, TimeUnit.MICROSECONDS);
|
||||
}
|
||||
|
||||
|
@ -234,7 +233,7 @@ public abstract class TabbedDesktop extends AbstractDesktop {
|
|||
*/
|
||||
public void showWindow(int AD_Window_ID, MQuery query)
|
||||
{
|
||||
openWindow(AD_Window_ID, query);
|
||||
openWindow(AD_Window_ID, query, null);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -338,19 +337,17 @@ public abstract class TabbedDesktop extends AbstractDesktop {
|
|||
private final ADWindow adWindow;
|
||||
private final Tab tab;
|
||||
private final DesktopTabpanel tabPanel;
|
||||
private Callback<ADWindow> callback;
|
||||
|
||||
protected OpenWindowRunnable(ADWindow adWindow, Tab tab, DesktopTabpanel tabPanel) {
|
||||
protected OpenWindowRunnable(ADWindow adWindow, Tab tab, DesktopTabpanel tabPanel, Callback<ADWindow> callback) {
|
||||
this.adWindow = adWindow;
|
||||
this.tab = tab;
|
||||
this.tabPanel = tabPanel;
|
||||
this.callback = callback;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doRun() {
|
||||
try {
|
||||
Thread.sleep(1);
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
ServerPushTemplate template = new ServerPushTemplate(windowContainer.getComponent().getDesktop());
|
||||
template.executeAsync(new IServerPushCallback() {
|
||||
@Override
|
||||
|
@ -366,6 +363,9 @@ public abstract class TabbedDesktop extends AbstractDesktop {
|
|||
} catch (IOException e) {
|
||||
}
|
||||
}
|
||||
if (callback != null) {
|
||||
callback.onCallback(adWindow);
|
||||
}
|
||||
} else {
|
||||
tab.onClose();
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@ import java.util.Collection;
|
|||
import java.util.Enumeration;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.adempiere.util.Callback;
|
||||
import org.adempiere.webui.adwindow.ADWindow;
|
||||
import org.adempiere.webui.exception.ApplicationException;
|
||||
import org.adempiere.webui.session.SessionManager;
|
||||
|
@ -297,12 +298,16 @@ public abstract class AbstractMenuPanel extends Panel implements EventListener<E
|
|||
((Popup)getParent()).close();
|
||||
}
|
||||
|
||||
ADWindow frame = SessionManager.getAppDesktop().openWindow(menu.getAD_Window_ID(), query);
|
||||
if(frame == null)
|
||||
return;
|
||||
|
||||
GridTab tab = frame.getADWindowContent().getActiveGridTab();
|
||||
tab.dataNew(false);
|
||||
SessionManager.getAppDesktop().openWindow(menu.getAD_Window_ID(), query, new Callback<ADWindow>() {
|
||||
@Override
|
||||
public void onCallback(ADWindow result) {
|
||||
if(result == null)
|
||||
return;
|
||||
|
||||
GridTab tab = result.getADWindowContent().getActiveGridTab();
|
||||
tab.dataNew(false);
|
||||
}
|
||||
});
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue