ItEr38S05ValidacionEProbasFuncionaisItEr37S06: Optimizing load of orders perspective. Edit part is not loaded until needed.
This commit is contained in:
parent
d0ce2f5d35
commit
4b0422eb78
2 changed files with 36 additions and 5 deletions
|
|
@ -22,7 +22,9 @@ package org.navalplanner.web.orders;
|
|||
|
||||
import static org.navalplanner.web.I18nHelper._;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.hibernate.validator.InvalidValue;
|
||||
|
|
@ -41,6 +43,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.zkoss.zk.ui.Component;
|
||||
import org.zkoss.zk.ui.Executions;
|
||||
import org.zkoss.zk.ui.util.GenericForwardComposer;
|
||||
import org.zkoss.zul.Combobox;
|
||||
import org.zkoss.zul.Comboitem;
|
||||
|
|
@ -110,8 +113,38 @@ public class OrderCRUDController extends GenericForwardComposer {
|
|||
super.doAfterCompose(comp);
|
||||
messagesForUser = new MessagesForUser(messagesContainer);
|
||||
comp.setVariable("controller", this, true);
|
||||
getVisibility().showOnly(listWindow);
|
||||
}
|
||||
|
||||
private void addEditWindowIfNeeded() {
|
||||
if (editWindow != null) {
|
||||
return;
|
||||
}
|
||||
Map<String, Object> editWindowArgs = new HashMap<String, Object>();
|
||||
editWindowArgs.put("top_id", editWindowArgs);
|
||||
Component parent = listWindow.getParent();
|
||||
listWindow.setVisible(false);
|
||||
cachedOnlyOneVisible = null;
|
||||
editWindow = (Window) Executions.createComponents(
|
||||
"/orders/_edition.zul",
|
||||
parent, editWindowArgs);
|
||||
Map<String, Object> editOrderElementArgs = new HashMap<String, Object>();
|
||||
editOrderElementArgs.put("top_id", "editOrderElement");
|
||||
Component editOrderElement = Executions.createComponents(
|
||||
"/orders/_editOrderElement.zul",
|
||||
parent, editOrderElementArgs);
|
||||
try {
|
||||
setupEditControllers();
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
Util.createBindingsFor(editWindow);
|
||||
Util.reloadBindings(editWindow);
|
||||
Util.createBindingsFor(editOrderElement);
|
||||
Util.reloadBindings(editOrderElement);
|
||||
}
|
||||
|
||||
private void setupEditControllers() throws Exception {
|
||||
Component comp = self;
|
||||
OrderElementController orderElementController = new OrderElementController();
|
||||
orderElementController.doAfterCompose(comp
|
||||
.getFellow("editOrderElement"));
|
||||
|
|
@ -196,6 +229,7 @@ public class OrderCRUDController extends GenericForwardComposer {
|
|||
|
||||
private OnlyOneVisible getVisibility() {
|
||||
if (cachedOnlyOneVisible == null) {
|
||||
addEditWindowIfNeeded();
|
||||
cachedOnlyOneVisible = new OnlyOneVisible(listWindow, editWindow);
|
||||
}
|
||||
return cachedOnlyOneVisible;
|
||||
|
|
@ -315,6 +349,7 @@ public class OrderCRUDController extends GenericForwardComposer {
|
|||
}
|
||||
|
||||
private void showEditWindow(String title) {
|
||||
addEditWindowIfNeeded();
|
||||
clearEditWindow();
|
||||
initializeTabs();
|
||||
editWindow.setTitle(title);
|
||||
|
|
|
|||
|
|
@ -19,8 +19,6 @@
|
|||
-->
|
||||
<?taglib uri="/WEB-INF/tld/i18n.tld" prefix="i18n"?>
|
||||
<?component name="list" inline="true" macroURI="_list.zul"?>
|
||||
<?component name="edition" inline="true" macroURI="_edition.zul"?>
|
||||
<?component name="orderElement" inline="true" macroURI="_editOrderElement.zul"?>
|
||||
<zk>
|
||||
<zscript><![CDATA[
|
||||
orderController = arg.get("orderController");
|
||||
|
|
@ -54,8 +52,6 @@
|
|||
<div>
|
||||
<vbox id="messagesContainer" />
|
||||
<list top_id="listWindow" />
|
||||
<edition top_id="editWindow" />
|
||||
<orderElement top_id="editOrderElement" title="${i18n:_('Edit order element')}" />
|
||||
</div>
|
||||
</center>
|
||||
</borderlayout>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue