IDEMPIERE-144 Performance: Remove the use of zk event thread. Fixed InfoSchedule not showing up and misc. timeline related javascript bugs. Fixed popup dialog sometime is position off screen.
This commit is contained in:
parent
0050af3c3a
commit
2f1aa8ac91
|
@ -19,6 +19,7 @@ import org.zkoss.zk.ui.HtmlBasedComponent;
|
|||
import org.zkoss.zk.ui.util.Clients;
|
||||
import org.zkoss.zul.Borderlayout;
|
||||
import org.zkoss.zul.Div;
|
||||
import org.zkoss.zul.Window;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -72,4 +73,34 @@ public final class LayoutUtils {
|
|||
|
||||
return div;
|
||||
}
|
||||
|
||||
/**
|
||||
* open popup window overlapping the ref component
|
||||
* @param ref
|
||||
* @param window
|
||||
*/
|
||||
public static void openPopupWindow(Component ref, Window window) {
|
||||
openPopupWindow(ref, window, "overlap");
|
||||
}
|
||||
|
||||
/**
|
||||
* open popup window relative to the ref component
|
||||
* @param ref
|
||||
* @param window
|
||||
* @param position
|
||||
*/
|
||||
public static void openPopupWindow(Component ref, Window window, String position) {
|
||||
if (window.getPage() == null)
|
||||
window.setPage(ref.getPage());
|
||||
StringBuilder script = new StringBuilder();
|
||||
script.append("_idempiere_popup_window('#")
|
||||
.append(ref.getUuid())
|
||||
.append("','#")
|
||||
.append(window.getUuid())
|
||||
.append("','")
|
||||
.append(position)
|
||||
.append("');");
|
||||
window.doPopup();
|
||||
Clients.response("_openPopupWindow_", new AuScript(window, script.toString()));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -124,10 +124,12 @@ public class TimelineEventFeed extends HttpServlet {
|
|||
if (slot.getMAssignment() != null) {
|
||||
//encode assignment id as coordinate x
|
||||
String link = "<a href=\"javascript:void(0)\" onclick=\""
|
||||
+ "ad_closeBuble('" + timeLineId + "');"
|
||||
+ "zkau.send({uuid: '" + uuid + "', cmd: 'onClick', data: "
|
||||
+ "[" + slot.getMAssignment().getS_ResourceAssignment_ID() + ", 0]"
|
||||
+ ", ctl: true})\">Edit</a>";
|
||||
+ "_ad_closeBuble(jq(this));"
|
||||
+ "var widget = zk.Widget.$('" + uuid+"');"
|
||||
+ "var event = new zk.Event(widget, 'onClick', {x:"
|
||||
+ slot.getMAssignment().getS_ResourceAssignment_ID() + ",y: 0}, {toServer: true});"
|
||||
+ "zAu.send(event);"
|
||||
+ "\">Edit</a>";
|
||||
xml.append("\r\n").append(XMLs.encodeText(link));
|
||||
}
|
||||
xml.append("\r\n").append("</event>").append("\r\n");
|
||||
|
|
|
@ -7,6 +7,7 @@ import java.text.NumberFormat;
|
|||
import java.util.logging.Level;
|
||||
|
||||
import org.adempiere.util.Callback;
|
||||
import org.adempiere.webui.LayoutUtils;
|
||||
import org.adempiere.webui.apps.AEnv;
|
||||
import org.adempiere.webui.component.EditorBox;
|
||||
import org.adempiere.webui.event.ContextMenuEvent;
|
||||
|
@ -162,7 +163,8 @@ public class WAssignmentEditor extends WEditor implements ContextMenuListener {
|
|||
processNewValue(oldValue, ma);
|
||||
}
|
||||
});
|
||||
AEnv.showWindow(vad);
|
||||
vad.setTitle(null);
|
||||
LayoutUtils.openPopupWindow(this.getComponent().getTextbox(), vad);
|
||||
}
|
||||
// Start InfoSchedule directly
|
||||
else
|
||||
|
|
|
@ -20,6 +20,7 @@ package org.adempiere.webui.editor;
|
|||
import java.beans.PropertyChangeEvent;
|
||||
import java.beans.PropertyChangeListener;
|
||||
|
||||
import org.adempiere.webui.LayoutUtils;
|
||||
import org.adempiere.webui.ValuePreference;
|
||||
import org.adempiere.webui.component.Locationbox;
|
||||
import org.adempiere.webui.event.ContextMenuEvent;
|
||||
|
@ -189,10 +190,8 @@ public class WLocationEditor extends WEditor implements EventListener<Event>, Pr
|
|||
setValue(ii);
|
||||
}
|
||||
});
|
||||
getComponent().appendChild(ld);
|
||||
ld.setPosition("parent");
|
||||
ld.setTitle(null);
|
||||
ld.doPopup();
|
||||
LayoutUtils.openPopupWindow(getComponent(), ld);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@ import java.sql.ResultSet;
|
|||
import java.sql.SQLException;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.adempiere.webui.LayoutUtils;
|
||||
import org.adempiere.webui.ValuePreference;
|
||||
import org.adempiere.webui.apps.AEnv;
|
||||
import org.adempiere.webui.component.EditorBox;
|
||||
|
@ -249,10 +250,8 @@ public class WLocatorEditor extends WEditor implements EventListener<Event>, Pro
|
|||
}
|
||||
});
|
||||
// display
|
||||
getComponent().appendChild(ld);
|
||||
ld.setPosition("parent");
|
||||
ld.setTitle(null);
|
||||
ld.doPopup();
|
||||
LayoutUtils.openPopupWindow(getComponent(), ld);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -18,13 +18,13 @@ package org.adempiere.webui.panel;
|
|||
|
||||
import java.text.DateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.TimeZone;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.adempiere.webui.apps.AEnv;
|
||||
import org.adempiere.webui.LayoutUtils;
|
||||
import org.adempiere.webui.component.Panel;
|
||||
import org.adempiere.webui.component.ToolBarButton;
|
||||
import org.adempiere.webui.event.DialogEvents;
|
||||
import org.adempiere.webui.session.SessionManager;
|
||||
import org.adempiere.webui.window.InfoSchedule;
|
||||
import org.adempiere.webui.window.WAssignmentDialog;
|
||||
import org.compiere.model.MResourceAssignment;
|
||||
|
@ -127,7 +127,8 @@ public class WSchedule extends Panel implements EventListener
|
|||
hourBand.setIntervalUnit("hour");
|
||||
hourBand.setWidth("40%");
|
||||
hourBand.setIntervalPixels(40);
|
||||
hourBand.setTimeZone(TimeZone.getDefault());
|
||||
hourBand.setTimeZone(SessionManager.getAppDesktop().getClientInfo().timeZone);
|
||||
hourBand.setId("WScheduleHourBand");
|
||||
|
||||
if (dayBand != null)
|
||||
dayBand.detach();
|
||||
|
@ -137,9 +138,10 @@ public class WSchedule extends Panel implements EventListener
|
|||
dayBand.setWidth("35%");
|
||||
dayBand.setIntervalPixels(100);
|
||||
dayBand.setSyncWith(hourBand.getId());
|
||||
dayBand.setTimeZone(TimeZone.getDefault());
|
||||
dayBand.setTimeZone(SessionManager.getAppDesktop().getClientInfo().timeZone);
|
||||
// listening band scroll event
|
||||
dayBand.addEventListener("onBandScroll", this);
|
||||
dayBand.setId("WScheduleDayBand");
|
||||
|
||||
if (mthBand != null)
|
||||
mthBand.detach();
|
||||
|
@ -149,7 +151,7 @@ public class WSchedule extends Panel implements EventListener
|
|||
mthBand.setWidth("25%");
|
||||
mthBand.setIntervalPixels(150);
|
||||
mthBand.setSyncWith(dayBand.getId());
|
||||
mthBand.setTimeZone(TimeZone.getDefault());
|
||||
mthBand.setTimeZone(SessionManager.getAppDesktop().getClientInfo().timeZone);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -184,17 +186,19 @@ public class WSchedule extends Panel implements EventListener
|
|||
MouseEvent me = (MouseEvent) event;
|
||||
if (me.getX() > 0) {
|
||||
MResourceAssignment assignment = new MResourceAssignment(Env.getCtx(), me.getX(), null);
|
||||
final WAssignmentDialog wad = new WAssignmentDialog(assignment, false, infoSchedule.isCreateNew());
|
||||
wad.addEventListener(DialogEvents.ON_WINDOW_CLOSE, new EventListener<Event>() {
|
||||
final WAssignmentDialog assignmentDialog = new WAssignmentDialog(assignment, false, infoSchedule.isCreateNew());
|
||||
assignmentDialog.addEventListener(DialogEvents.ON_WINDOW_CLOSE, new EventListener<Event>() {
|
||||
@Override
|
||||
public void onEvent(Event event) throws Exception {
|
||||
if (!wad.isCancelled()) {
|
||||
_assignmentDialogResult = wad.getMResourceAssignment();
|
||||
if (!assignmentDialog.isCancelled()) {
|
||||
_assignmentDialogResult = assignmentDialog.getMResourceAssignment();
|
||||
Events.echoEvent("onAssignmentCallback", WSchedule.this, null);
|
||||
}
|
||||
}
|
||||
});
|
||||
AEnv.showWindow(wad);
|
||||
assignmentDialog.setTitle(null);
|
||||
LayoutUtils.openPopupWindow(this, assignmentDialog, "at_pointer");
|
||||
Events.postEvent(new Event(Events.ON_CLICK, assignmentDialog.getDateFrom()));
|
||||
}
|
||||
} else if (event instanceof BandScrollEvent){
|
||||
BandScrollEvent e = (BandScrollEvent) event;
|
||||
|
@ -207,5 +211,4 @@ public class WSchedule extends Panel implements EventListener
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // WSchedule
|
||||
|
|
|
@ -27,6 +27,7 @@ import java.util.GregorianCalendar;
|
|||
import java.util.logging.Level;
|
||||
|
||||
import org.adempiere.util.Callback;
|
||||
import org.adempiere.webui.LayoutUtils;
|
||||
import org.adempiere.webui.apps.AEnv;
|
||||
import org.adempiere.webui.component.Button;
|
||||
import org.adempiere.webui.component.ConfirmPanel;
|
||||
|
@ -52,6 +53,7 @@ import org.compiere.util.Env;
|
|||
import org.compiere.util.KeyNamePair;
|
||||
import org.compiere.util.Msg;
|
||||
import org.compiere.util.TimeUtil;
|
||||
import org.zkoss.zk.ui.Page;
|
||||
import org.zkoss.zk.ui.event.Event;
|
||||
import org.zkoss.zk.ui.event.EventListener;
|
||||
import org.zkoss.zk.ui.event.Events;
|
||||
|
@ -103,10 +105,17 @@ public class InfoSchedule extends Window implements EventListener
|
|||
super();
|
||||
setTitle(Msg.getMsg(Env.getCtx(), "InfoSchedule"));
|
||||
if (createNew)
|
||||
setAttribute(Window.MODE_KEY, Window.MODE_HIGHLIGHTED);
|
||||
else
|
||||
setAttribute(Window.MODE_KEY, Window.MODE_OVERLAPPED);
|
||||
{
|
||||
setAttribute(Window.MODE_KEY, Window.MODE_POPUP);
|
||||
this.setWidth("600px");
|
||||
}
|
||||
else
|
||||
{
|
||||
setAttribute(Window.MODE_KEY, Window.MODE_EMBEDDED);
|
||||
this.setWidth("100%");
|
||||
this.setHeight("100%");
|
||||
}
|
||||
|
||||
// this.setHeight("600px");
|
||||
this.setClosable(true);
|
||||
this.setBorder("normal");
|
||||
|
@ -139,6 +148,8 @@ public class InfoSchedule extends Window implements EventListener
|
|||
{
|
||||
log.log(Level.SEVERE, "InfoSchedule", ex);
|
||||
}
|
||||
AEnv.showWindow(this);
|
||||
displayCalendar();
|
||||
} // InfoSchedule
|
||||
|
||||
/**
|
||||
|
@ -174,7 +185,8 @@ public class InfoSchedule extends Window implements EventListener
|
|||
//
|
||||
private WSchedule schedulePane = new WSchedule(this);
|
||||
private StatusBarPanel statusBar = new StatusBarPanel();
|
||||
private ConfirmPanel confirmPanel = new ConfirmPanel(true);
|
||||
private ConfirmPanel confirmPanel = null;
|
||||
private Button btnNew;
|
||||
|
||||
/**
|
||||
* Static Layout
|
||||
|
@ -226,7 +238,11 @@ public class InfoSchedule extends Window implements EventListener
|
|||
schedulePane.setWidth("100%");
|
||||
schedulePane.setHeight("400px");
|
||||
Div div = new Div();
|
||||
if (m_createNew)
|
||||
{
|
||||
confirmPanel = new ConfirmPanel(true);
|
||||
div.appendChild(confirmPanel);
|
||||
}
|
||||
div.appendChild(statusBar);
|
||||
mainLayout.appendChild(div);
|
||||
|
||||
|
@ -256,9 +272,9 @@ public class InfoSchedule extends Window implements EventListener
|
|||
//
|
||||
|
||||
//
|
||||
confirmPanel.addActionListener(Events.ON_CLICK, this);
|
||||
if (createNew) {
|
||||
Button btnNew = new Button();
|
||||
confirmPanel.addActionListener(Events.ON_CLICK, this);
|
||||
btnNew = new Button();
|
||||
btnNew.setName("btnNew");
|
||||
btnNew.setId("New");
|
||||
btnNew.setSrc("/images/New24.png");
|
||||
|
@ -266,7 +282,6 @@ public class InfoSchedule extends Window implements EventListener
|
|||
confirmPanel.addComponentsLeft(btnNew);
|
||||
btnNew.addEventListener(Events.ON_CLICK, this);
|
||||
}
|
||||
displayCalendar();
|
||||
} // dynInit
|
||||
|
||||
/**
|
||||
|
@ -569,7 +584,8 @@ public class InfoSchedule extends Window implements EventListener
|
|||
mAssignmentCallback(vad.getMResourceAssignment());
|
||||
}
|
||||
});
|
||||
AEnv.showWindow(vad);
|
||||
vad.setTitle(null);
|
||||
LayoutUtils.openPopupWindow(btnNew, vad, "before_start");
|
||||
} else {
|
||||
FDialog.error(0, this, "No available time slot for the selected day.");
|
||||
}
|
||||
|
@ -588,6 +604,17 @@ public class InfoSchedule extends Window implements EventListener
|
|||
fieldDate.setValue(m_dateFrom); // Elaine 2008/12/15
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.zkoss.zk.ui.AbstractComponent#onPageAttached(org.zkoss.zk.ui.Page, org.zkoss.zk.ui.Page)
|
||||
*/
|
||||
@Override
|
||||
public void onPageAttached(Page newpage, Page oldpage) {
|
||||
super.onPageAttached(newpage, oldpage);
|
||||
if (newpage != null) {
|
||||
displayCalendar();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
SELECT o.DocumentNo, ol.Line, ol.Description
|
||||
|
|
|
@ -30,7 +30,6 @@ import java.util.logging.Level;
|
|||
|
||||
import org.adempiere.util.Callback;
|
||||
import org.adempiere.webui.LayoutUtils;
|
||||
import org.adempiere.webui.apps.AEnv;
|
||||
import org.adempiere.webui.component.Button;
|
||||
import org.adempiere.webui.component.ConfirmPanel;
|
||||
import org.adempiere.webui.component.Datebox;
|
||||
|
@ -114,6 +113,8 @@ public class WAssignmentDialog extends Window implements EventListener
|
|||
log.log(Level.SEVERE, "", e);
|
||||
}
|
||||
setDisplay(); // from mAssignment
|
||||
setWidth("600px");
|
||||
setSizable(true);
|
||||
//
|
||||
} // VAssignmentDialog
|
||||
|
||||
|
@ -377,17 +378,8 @@ public class WAssignmentDialog extends Window implements EventListener
|
|||
// Zoom - InfoResource
|
||||
else if (e.getTarget().getId().equals("Zoom"))
|
||||
{
|
||||
InfoSchedule is = new InfoSchedule (m_mAssignment, true, new Callback<MResourceAssignment>() {
|
||||
@Override
|
||||
public void onCallback(MResourceAssignment result) {
|
||||
if (result != null)
|
||||
{
|
||||
m_mAssignment = result;
|
||||
// setDisplay();
|
||||
detach();
|
||||
}
|
||||
}
|
||||
});
|
||||
setVisible(false);
|
||||
Events.echoEvent("onShowSchedule", this, null);
|
||||
}
|
||||
|
||||
// cancel - return
|
||||
|
@ -417,17 +409,40 @@ public class WAssignmentDialog extends Window implements EventListener
|
|||
}
|
||||
}
|
||||
|
||||
public void onShowSchedule()
|
||||
{
|
||||
InfoSchedule is = new InfoSchedule (m_mAssignment, true, new Callback<MResourceAssignment>() {
|
||||
@Override
|
||||
public void onCallback(MResourceAssignment result) {
|
||||
if (result != null)
|
||||
{
|
||||
m_mAssignment = result;
|
||||
// setDisplay();
|
||||
detach();
|
||||
}
|
||||
else
|
||||
{
|
||||
setVisible(true);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void getDateAndTimeFrom(Calendar date) {
|
||||
Date dateFrom = fDateFrom.getValue();
|
||||
Date timeFrom = fTimeFrom.getValue();
|
||||
date.setTime(dateFrom);
|
||||
Calendar time = new GregorianCalendar();
|
||||
time.setTime(timeFrom);
|
||||
date.set(Calendar.HOUR, time.get(Calendar.HOUR));
|
||||
date.set(Calendar.HOUR_OF_DAY, time.get(Calendar.HOUR_OF_DAY));
|
||||
date.set(Calendar.MINUTE, time.get(Calendar.MINUTE));
|
||||
}
|
||||
|
||||
public boolean isCancelled() {
|
||||
return m_cancel;
|
||||
}
|
||||
|
||||
public Datebox getDateFrom() {
|
||||
return fDateFrom;
|
||||
}
|
||||
} // VAssignmentDialog
|
||||
|
|
|
@ -10,13 +10,10 @@ function _ad_deferBDL(uuid) {
|
|||
if (cmp) { cmp.resize(); }
|
||||
}
|
||||
|
||||
function ad_closeBuble(uuid) {
|
||||
var cmp = zk.Widget.$(uuid);
|
||||
if (cmp) {
|
||||
for(var i=0;i<cmp.bandInfos.length;i++){
|
||||
cmp.instance.getBand(i).closeBubble();
|
||||
}
|
||||
}
|
||||
function _ad_closeBuble(link) {
|
||||
var parent = link.parentsUntil("simileAjax-bubble-contentContainer");
|
||||
var btn = parent.next();
|
||||
btn.click();
|
||||
}
|
||||
|
||||
function scrollToRow(uuid){
|
||||
|
@ -26,4 +23,3 @@ function scrollToRow(uuid){
|
|||
cmp.focus();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
function _idempiere_popup_window(refid, windowid, position) {
|
||||
var ref = zk.Widget.$(refid);
|
||||
var window = zk(windowid);
|
||||
window.position(ref.$n(), position);
|
||||
}
|
|
@ -37,6 +37,7 @@ Copyright (C) 2007 Ashley G Ramdass (ADempiere WebUI).
|
|||
<javascript src="/js/report.js" charset="UTF-8"/>
|
||||
<javascript src="/js/persist-min.js" charset="UTF-8"/>
|
||||
<javascript src="/js/token.js" charset="UTF-8"/>
|
||||
<javascript src="/js/window.js" charset="UTF-8"/>
|
||||
|
||||
<javascript package="jawwa.atmosphere" merge="false" />
|
||||
|
||||
|
|
|
@ -597,3 +597,7 @@ div.z-vfiletree-body td.menu-tree-cell {
|
|||
.z-panel-hl .z-panel-header {
|
||||
padding: 0 0 2px 0;
|
||||
}
|
||||
|
||||
div.simileAjax-bubble-container {
|
||||
z-index: 2800 !important;
|
||||
}
|
Loading…
Reference in New Issue