hg merge d6b2cf8369af
This commit is contained in:
commit
3152f5a094
|
@ -18,6 +18,7 @@ import java.sql.PreparedStatement;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
|
import org.adempiere.util.Callback;
|
||||||
import org.adempiere.webui.adwindow.ADWindow;
|
import org.adempiere.webui.adwindow.ADWindow;
|
||||||
import org.adempiere.webui.session.SessionManager;
|
import org.adempiere.webui.session.SessionManager;
|
||||||
import org.compiere.model.GridTab;
|
import org.compiere.model.GridTab;
|
||||||
|
@ -57,7 +58,7 @@ import org.zkoss.zul.Menupopup;
|
||||||
* @author Teo Sarca, SC ARHIPAC SERVICE SRL
|
* @author Teo Sarca, SC ARHIPAC SERVICE SRL
|
||||||
* <li>BF [ 1904928 ] Request: Related Request field not filled
|
* <li>BF [ 1904928 ] Request: Related Request field not filled
|
||||||
*/
|
*/
|
||||||
public class WRequest implements EventListener
|
public class WRequest implements EventListener<Event>
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
|
@ -180,7 +181,7 @@ public class WRequest implements EventListener
|
||||||
m_popup.open(invoker);
|
m_popup.open(invoker);
|
||||||
} // getZoomTargets
|
} // getZoomTargets
|
||||||
|
|
||||||
public void onEvent(Event e) throws Exception
|
public void onEvent(final Event e) throws Exception
|
||||||
{
|
{
|
||||||
if (e.getTarget() instanceof Menuitem)
|
if (e.getTarget() instanceof Menuitem)
|
||||||
{
|
{
|
||||||
|
@ -206,9 +207,20 @@ public class WRequest implements EventListener
|
||||||
}
|
}
|
||||||
|
|
||||||
int AD_Window_ID = WINDOW_REQUESTS_ALL; // 232=all - 201=my
|
int AD_Window_ID = WINDOW_REQUESTS_ALL; // 232=all - 201=my
|
||||||
ADWindow frame = SessionManager.getAppDesktop().openWindow(AD_Window_ID, query);
|
SessionManager.getAppDesktop().openWindow(AD_Window_ID, query, new Callback<ADWindow>() {
|
||||||
if(frame == null)
|
|
||||||
|
@Override
|
||||||
|
public void onCallback(ADWindow result) {
|
||||||
|
if(result == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
onNew(e, result);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void onNew(Event e, ADWindow frame) {
|
||||||
// New - set Table/Record
|
// New - set Table/Record
|
||||||
if (e.getTarget() == m_new)
|
if (e.getTarget() == m_new)
|
||||||
{
|
{
|
||||||
|
@ -258,8 +270,5 @@ public class WRequest implements EventListener
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
frame = null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -273,7 +273,7 @@ public class WFPanel extends Borderlayout implements EventListener
|
||||||
|
|
||||||
private void start(MWFNode wfn) {
|
private void start(MWFNode wfn) {
|
||||||
if (wfn.getAD_Window_ID() > 0) {
|
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) {
|
} else if (wfn.getAD_Form_ID() > 0) {
|
||||||
SessionManager.getAppDesktop().openForm(wfn.getAD_Form_ID());
|
SessionManager.getAppDesktop().openForm(wfn.getAD_Form_ID());
|
||||||
} else if (wfn.getAD_Process_ID() > 0) {
|
} else if (wfn.getAD_Process_ID() > 0) {
|
||||||
|
|
|
@ -15,6 +15,7 @@ package org.adempiere.webui.dashboard;
|
||||||
|
|
||||||
import java.util.Enumeration;
|
import java.util.Enumeration;
|
||||||
|
|
||||||
|
import org.adempiere.util.Callback;
|
||||||
import org.adempiere.webui.adwindow.ADWindow;
|
import org.adempiere.webui.adwindow.ADWindow;
|
||||||
import org.adempiere.webui.exception.ApplicationException;
|
import org.adempiere.webui.exception.ApplicationException;
|
||||||
import org.adempiere.webui.panel.TreeSearchPanel;
|
import org.adempiere.webui.panel.TreeSearchPanel;
|
||||||
|
@ -285,13 +286,18 @@ public class DPFavourites extends DashboardPanel implements EventListener<Event>
|
||||||
query.addRestriction("1=2");
|
query.addRestriction("1=2");
|
||||||
query.setRecordCount(0);
|
query.setRecordCount(0);
|
||||||
|
|
||||||
ADWindow frame = SessionManager.getAppDesktop().openWindow(menu.getAD_Window_ID(), query);
|
SessionManager.getAppDesktop().openWindow(menu.getAD_Window_ID(), query, new Callback<ADWindow>() {
|
||||||
if(frame == null)
|
|
||||||
|
@Override
|
||||||
|
public void onCallback(ADWindow result) {
|
||||||
|
if(result == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
GridTab tab = frame.getADWindowContent().getActiveGridTab();
|
GridTab tab = result.getADWindowContent().getActiveGridTab();
|
||||||
tab.dataNew(false);
|
tab.dataNew(false);
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
throw new ApplicationException(e.getMessage(), e);
|
throw new ApplicationException(e.getMessage(), e);
|
||||||
|
|
|
@ -148,7 +148,7 @@ public class DPRecentItems extends DashboardPanel implements EventListener<Event
|
||||||
String TableName = MTable.getTableName(Env.getCtx(), ri.getAD_Table_ID());
|
String TableName = MTable.getTableName(Env.getCtx(), ri.getAD_Table_ID());
|
||||||
MQuery query = MQuery.getEqualQuery(TableName + "_ID", ri.getRecord_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
|
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))
|
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) ||
|
else if(menu.getAction().equals(MMenu.ACTION_Process) ||
|
||||||
menu.getAction().equals(MMenu.ACTION_Report))
|
menu.getAction().equals(MMenu.ACTION_Report))
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
package org.adempiere.webui.desktop;
|
package org.adempiere.webui.desktop;
|
||||||
|
|
||||||
|
import org.adempiere.util.Callback;
|
||||||
import org.adempiere.webui.ClientInfo;
|
import org.adempiere.webui.ClientInfo;
|
||||||
import org.adempiere.webui.adwindow.ADWindow;
|
import org.adempiere.webui.adwindow.ADWindow;
|
||||||
import org.adempiere.webui.apps.ProcessDialog;
|
import org.adempiere.webui.apps.ProcessDialog;
|
||||||
|
@ -142,7 +143,7 @@ public interface IDesktop extends UIPart {
|
||||||
* @param windowId
|
* @param windowId
|
||||||
* @return ADWindow
|
* @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
|
* @param query
|
||||||
* @return ADWindow
|
* @return ADWindow
|
||||||
*/
|
*/
|
||||||
public ADWindow openWindow(int windowId, MQuery query);
|
public void openWindow(int windowId, MQuery query, Callback<ADWindow> callback);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Open operating system task window
|
* Open operating system task window
|
||||||
|
|
|
@ -17,6 +17,7 @@ import java.io.IOException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
import org.adempiere.util.Callback;
|
||||||
import org.adempiere.util.ContextRunnable;
|
import org.adempiere.util.ContextRunnable;
|
||||||
import org.adempiere.webui.adwindow.ADWindow;
|
import org.adempiere.webui.adwindow.ADWindow;
|
||||||
import org.adempiere.webui.apps.ProcessDialog;
|
import org.adempiere.webui.apps.ProcessDialog;
|
||||||
|
@ -120,8 +121,8 @@ public abstract class TabbedDesktop extends AbstractDesktop {
|
||||||
* @param windowId
|
* @param windowId
|
||||||
* @return ADWindow
|
* @return ADWindow
|
||||||
*/
|
*/
|
||||||
public ADWindow openWindow(int windowId) {
|
public void openWindow(int windowId, Callback<ADWindow> callback) {
|
||||||
return openWindow(windowId, null);
|
openWindow(windowId, null, callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -130,17 +131,15 @@ public abstract class TabbedDesktop extends AbstractDesktop {
|
||||||
* @param query
|
* @param query
|
||||||
* @return ADWindow
|
* @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 ADWindow adWindow = new ADWindow(Env.getCtx(), windowId, query);
|
||||||
|
|
||||||
final DesktopTabpanel tabPanel = new DesktopTabpanel();
|
final DesktopTabpanel tabPanel = new DesktopTabpanel();
|
||||||
final Tab tab = windowContainer.addWindow(tabPanel, adWindow.getTitle(), true);
|
final Tab tab = windowContainer.addWindow(tabPanel, adWindow.getTitle(), true);
|
||||||
tab.setImage(IN_PROGRESS_IMAGE);
|
tab.setImage(IN_PROGRESS_IMAGE);
|
||||||
tab.setClosable(false);
|
tab.setClosable(false);
|
||||||
OpenWindowRunnable runnable = new OpenWindowRunnable(adWindow, tab, tabPanel);
|
OpenWindowRunnable runnable = new OpenWindowRunnable(adWindow, tab, tabPanel, callback);
|
||||||
Adempiere.getThreadPoolExecutor().schedule(runnable, 100, TimeUnit.MICROSECONDS);
|
Adempiere.getThreadPoolExecutor().schedule(runnable, 10, TimeUnit.MILLISECONDS);
|
||||||
|
|
||||||
return adWindow;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -223,7 +222,7 @@ public abstract class TabbedDesktop extends AbstractDesktop {
|
||||||
final Tab tab = windowContainer.insertAfter(windowContainer.getSelectedTab(), tabPanel, wnd.getTitle(), true, true);
|
final Tab tab = windowContainer.insertAfter(windowContainer.getSelectedTab(), tabPanel, wnd.getTitle(), true, true);
|
||||||
tab.setImage(IN_PROGRESS_IMAGE);
|
tab.setImage(IN_PROGRESS_IMAGE);
|
||||||
tab.setClosable(false);
|
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);
|
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)
|
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 ADWindow adWindow;
|
||||||
private final Tab tab;
|
private final Tab tab;
|
||||||
private final DesktopTabpanel tabPanel;
|
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.adWindow = adWindow;
|
||||||
this.tab = tab;
|
this.tab = tab;
|
||||||
this.tabPanel = tabPanel;
|
this.tabPanel = tabPanel;
|
||||||
|
this.callback = callback;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void doRun() {
|
protected void doRun() {
|
||||||
try {
|
|
||||||
Thread.sleep(1);
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
}
|
|
||||||
ServerPushTemplate template = new ServerPushTemplate(windowContainer.getComponent().getDesktop());
|
ServerPushTemplate template = new ServerPushTemplate(windowContainer.getComponent().getDesktop());
|
||||||
template.executeAsync(new IServerPushCallback() {
|
template.executeAsync(new IServerPushCallback() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -366,6 +363,9 @@ public abstract class TabbedDesktop extends AbstractDesktop {
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (callback != null) {
|
||||||
|
callback.onCallback(adWindow);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
tab.onClose();
|
tab.onClose();
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,7 @@ import java.util.Collection;
|
||||||
import java.util.Enumeration;
|
import java.util.Enumeration;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
|
import org.adempiere.util.Callback;
|
||||||
import org.adempiere.webui.adwindow.ADWindow;
|
import org.adempiere.webui.adwindow.ADWindow;
|
||||||
import org.adempiere.webui.exception.ApplicationException;
|
import org.adempiere.webui.exception.ApplicationException;
|
||||||
import org.adempiere.webui.session.SessionManager;
|
import org.adempiere.webui.session.SessionManager;
|
||||||
|
@ -297,13 +298,17 @@ public abstract class AbstractMenuPanel extends Panel implements EventListener<E
|
||||||
((Popup)getParent()).close();
|
((Popup)getParent()).close();
|
||||||
}
|
}
|
||||||
|
|
||||||
ADWindow frame = SessionManager.getAppDesktop().openWindow(menu.getAD_Window_ID(), query);
|
SessionManager.getAppDesktop().openWindow(menu.getAD_Window_ID(), query, new Callback<ADWindow>() {
|
||||||
if(frame == null)
|
@Override
|
||||||
|
public void onCallback(ADWindow result) {
|
||||||
|
if(result == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
GridTab tab = frame.getADWindowContent().getActiveGridTab();
|
GridTab tab = result.getADWindowContent().getActiveGridTab();
|
||||||
tab.dataNew(false);
|
tab.dataNew(false);
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
throw new ApplicationException(e.getMessage(), e);
|
throw new ApplicationException(e.getMessage(), e);
|
||||||
|
|
Loading…
Reference in New Issue