IDEMPIERE-547 Zk: Shouldn't open embedded window as overlapped window

This commit is contained in:
Heng Sin Low 2013-01-14 14:43:13 +08:00
parent f0806d82ab
commit 90d521b3a2
3 changed files with 51 additions and 22 deletions

View File

@ -132,6 +132,25 @@ public final class LayoutUtils {
Clients.response("_openPopupWindow_", new AuScript(window, script.toString()));
}
/**
* open popup window relative to the ref component
* @param ref
* @param window
* @param position
*/
public static void openEmbeddedWindow(Component ref, Window window, String position) {
StringBuilder script = new StringBuilder();
script.append("_idempiere_popup_window('#")
.append(ref.getUuid())
.append("','#")
.append(window.getUuid())
.append("','")
.append(position)
.append("');");
window.setVisible(true);
Clients.response("_openPopupWindow_", new AuScript(window, script.toString()));
}
public static void redraw(AbstractComponent component) {
StringWriter writer = new StringWriter(1024);
try {

View File

@ -668,14 +668,12 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
}
}
});
findWindow.setTitle(null);
findWindow.setBorder("none");
findWindow.setStyle("padding: 5px;");
setupEmbeddedFindwindow();
getComponent().addEventListener("onInitialQuery", new EventListener<Event>() {
@Override
public void onEvent(Event event) throws Exception {
getComponent().getParent().appendChild(findWindow);
LayoutUtils.openOverlappedWindow(getComponent(), findWindow, "overlap");
LayoutUtils.openEmbeddedWindow(getComponent(), findWindow, "overlap");
}
});
Events.echoEvent("onInitialQuery", getComponent(), null);
@ -691,6 +689,15 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
}
} // initialQuery
private void setupEmbeddedFindwindow() {
findWindow.setTitle(null);
findWindow.setBorder("none");
findWindow.setStyle("position: absolute; border-bottom: 1px solid #c5c5c5; padding: 2px; background-color: #fff;");
findWindow.setWidth("100%");
findWindow.setZindex(1000);
findWindow.setContentStyle("background-color: #fff; width: 99%; margin: auto;");
}
public String getTitle()
{
return title;
@ -1579,8 +1586,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
adTabbox.getSelectedGridTab().getAD_Table_ID(), adTabbox.getSelectedGridTab().getTableName(),
adTabbox.getSelectedGridTab().getWhereExtended(), findFields, 1, adTabbox.getSelectedGridTab().getAD_Tab_ID());
findWindow.setBorder("none");
findWindow.setStyle("padding: 5px;");
setupEmbeddedFindwindow();
if (!findWindow.initialize()) {
if (findWindow.getTotalRecords() == 0) {
FDialog.info(curWindowNo, getComponent(), "NoRecordsFound");
@ -1593,8 +1599,6 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
findWindow.addEventListener(DialogEvents.ON_WINDOW_CLOSE, new EventListener<Event>() {
@Override
public void onEvent(Event event) throws Exception {
Clients.clearBusy(getComponent().getParent());
getComponent().invalidate();
if (!findWindow.isCancel())
{
MQuery query = findWindow.getQuery();
@ -1621,9 +1625,8 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
});
}
findWindow.setTitle(null);
getComponent().getParent().appendChild(findWindow);
Clients.showBusy(getComponent().getParent(), " ");
LayoutUtils.openOverlappedWindow(toolbar, findWindow, "after_start");
getComponent().getParent().insertBefore(findWindow, getComponent().getParent().getFirstChild());
LayoutUtils.openEmbeddedWindow(toolbar, findWindow, "after_start");
}
/**

View File

@ -96,6 +96,7 @@ import org.zkoss.zul.Comboitem;
import org.zkoss.zul.Div;
import org.zkoss.zul.Hbox;
import org.zkoss.zul.South;
import org.zkoss.zul.Space;
import org.zkoss.zul.Tab;
import org.zkoss.zul.Vlayout;
@ -237,7 +238,6 @@ public class FindWindow extends Window implements EventListener<Event>, ValueCha
this.setWidth("900px");
this.setHeight("350px");
this.setTitle(Msg.getMsg(Env.getCtx(), "Find").replaceAll("&", "") + ": " + title);
this.setAttribute(Window.MODE_KEY, Window.MODE_HIGHLIGHTED);
this.setClosable(false);
this.setSizable(true);
this.setMaximizable(true);
@ -353,7 +353,11 @@ public class FindWindow extends Window implements EventListener<Event>, ValueCha
column = new Column();
column.setAlign("left");
column.setWidth("70%");
column.setWidth("50%");
columns.appendChild(column);
column = new Column();
column.setWidth("20%");
columns.appendChild(column);
contentSimple.appendChild(columns);
@ -420,7 +424,6 @@ public class FindWindow extends Window implements EventListener<Event>, ValueCha
toolBar.appendChild(btnDelete);
toolBar.setWidth("100%");
fQueryName.setStyle("margin-left: 3px; margin-right: 3px; position: relative; top: 5px;");
fQueryName.addEventListener(Events.ON_SELECT, this);
Hbox confirmPanel = new Hbox();
@ -510,7 +513,7 @@ public class FindWindow extends Window implements EventListener<Event>, ValueCha
btnSave.addEventListener(Events.ON_CLICK, this);
btnSave.setDisabled(true);
btnSave.setId("btnSave");
// LayoutUtils.addSclass("disableFilter", btnSave);
btnSave.setStyle("vertical-align: middle;");
fQueryName = new Combobox();
fQueryName.setTooltiptext(Msg.getMsg(Env.getCtx(),"QueryName"));
@ -525,32 +528,34 @@ public class FindWindow extends Window implements EventListener<Event>, ValueCha
fQueryName.addEventListener(Events.ON_SELECT, this);
Label label = new Label(Msg.getMsg(Env.getCtx(), "SavedQuery"));
label.setStyle("vertical-align: middle;");
div.appendChild(label);
div.appendChild(fQueryName);
div.appendChild(btnSave);
fQueryName.setStyle("margin-left: 3px; margin-right: 3px; position: relative;");
fQueryName.setStyle("margin-left: 3px; margin-right: 3px; position: relative; vertical-align: middle;");
msgLabel = new Label("");
msgLabel.setStyle("margin-left: 10px; margin-right: 20px;");
msgLabel.setStyle("margin-left: 10px; margin-right: 20px; vertical-align: middle;");
div.appendChild(msgLabel);
// adding history combo
prepareHistoryCombo();
Label labelHistory = new Label(Msg.getMsg(Env.getCtx(), HISTORY_LABEL));
labelHistory.setStyle("vertical-align: middle;");
div.appendChild(labelHistory);
div.appendChild(historyCombo);
historyCombo.setStyle("margin-left: 3px; margin-right: 3px; position: relative;");
historyCombo.setStyle("margin-left: 3px; margin-right: 3px; position: relative; vertical-align: middle;");
winMain = new MultiTabPart();
winMain.createPart(layout);
winMain.getComponent().setStyle("width: 99%; position: relative; margin-left: auto; margin-right: auto; margin-top: 5px;");
winMain.getComponent().setStyle("position: relative; margin-left: auto; margin-right: auto; margin-top: 3px; margin-bottom: 3px;");
winMain.getComponent().setVflex("1");
winMain.getComponent().addEventListener(Events.ON_SELECT, this);
winAdvanced = new Window();
winLookupRecord = new Window();
Tabpanel tabPanel = new Tabpanel();
tabPanel.setStyle("height: 100%; width: 100%");
tabPanel.setStyle("height: 100%; width: 99%; padding-right: 2px; margin: auto;");
tabPanel.appendChild(winLookupRecord);
tabPanel.setId("simpleSearch");
winMain.addTab(tabPanel, Msg.getMsg(Env.getCtx(), "Find").replaceAll("&", ""),false, true);
@ -958,7 +963,8 @@ public class FindWindow extends Window implements EventListener<Event>, ValueCha
// Editor
WEditor editor = null;
editor = WebEditorFactory.getEditor(mField, false);
//false will use hflex which is render 1 pixel too width on firefox
editor = WebEditorFactory.getEditor(mField, true);
editor.setMandatory(false);
editor.setReadWrite(true);
editor.dynamicDisplay();
@ -974,6 +980,7 @@ public class FindWindow extends Window implements EventListener<Event>, ValueCha
Row panel = new Row();
panel.appendChild(label);
panel.appendChild(fieldEditor);
panel.appendChild(new Space());
contentSimpleRows.appendChild(panel);
m_sEditors.add(editor);