Reloading resource load each time the tab is pressed in order to see potential changes
This commit is contained in:
parent
db3d4065b9
commit
479de8acd3
5 changed files with 37 additions and 14 deletions
|
|
@ -95,6 +95,9 @@ public class MultipleTabsPlannerController implements Composer {
|
|||
@Autowired
|
||||
private ResourceLoadController resourceLoadController;
|
||||
|
||||
@Autowired
|
||||
private ResourceLoadController resourceLoadControllerGlobal;
|
||||
|
||||
private org.zkoss.zk.ui.Component breadcrumbs;
|
||||
|
||||
public TabsConfiguration getTabs() {
|
||||
|
|
@ -117,7 +120,9 @@ public class MultipleTabsPlannerController implements Composer {
|
|||
planningTab = PlanningTabCreator.create(mode, companyPlanningController,
|
||||
orderPlanningController, breadcrumbs);
|
||||
resourceLoadTab = ResourcesLoadTabCreator.create(mode,
|
||||
resourceLoadController, upCommand(), breadcrumbs);
|
||||
resourceLoadController, upCommand(),
|
||||
resourceLoadControllerGlobal,
|
||||
breadcrumbs);
|
||||
ordersTab = OrdersTabCreator.create(mode, orderCRUDController,
|
||||
breadcrumbs, new IOrderPlanningGate() {
|
||||
|
||||
|
|
|
|||
|
|
@ -48,23 +48,31 @@ public class ResourcesLoadTabCreator {
|
|||
|
||||
public static ITab create(Mode mode,
|
||||
ResourceLoadController resourceLoadController,
|
||||
IToolbarCommand upCommand, Component breadcrumbs) {
|
||||
IToolbarCommand upCommand,
|
||||
ResourceLoadController resourceLoadControllerGlobal,
|
||||
Component breadcrumbs) {
|
||||
return new ResourcesLoadTabCreator(mode, resourceLoadController,
|
||||
upCommand, breadcrumbs)
|
||||
upCommand, resourceLoadControllerGlobal, breadcrumbs)
|
||||
.build();
|
||||
}
|
||||
|
||||
private final Mode mode;
|
||||
private final ResourceLoadController resourceLoadController;
|
||||
|
||||
private final ResourceLoadController resourceLoadControllerGlobal;
|
||||
|
||||
private final IToolbarCommand upCommand;
|
||||
private final Component breadcrumbs;
|
||||
|
||||
private ResourcesLoadTabCreator(Mode mode,
|
||||
ResourceLoadController resourceLoadController,
|
||||
IToolbarCommand upCommand, Component breadcrumbs) {
|
||||
IToolbarCommand upCommand,
|
||||
ResourceLoadController resourceLoadControllerGlobal,
|
||||
Component breadcrumbs) {
|
||||
this.mode = mode;
|
||||
this.resourceLoadController = resourceLoadController;
|
||||
this.upCommand = upCommand;
|
||||
this.resourceLoadControllerGlobal = resourceLoadControllerGlobal;
|
||||
this.breadcrumbs = breadcrumbs;
|
||||
}
|
||||
|
||||
|
|
@ -92,7 +100,6 @@ public class ResourcesLoadTabCreator {
|
|||
};
|
||||
return new CreatedOnDemandTab(ORDER_RESOURCE_LOAD_VIEW,
|
||||
componentCreator) {
|
||||
private Order currentOrder;
|
||||
|
||||
@Override
|
||||
protected void afterShowAction() {
|
||||
|
|
@ -101,11 +108,9 @@ public class ResourcesLoadTabCreator {
|
|||
breadcrumbs.appendChild(new Image(BREADCRUMBS_SEPARATOR));
|
||||
breadcrumbs.appendChild(new Label(ORDER_RESOURCE_LOAD_VIEW));
|
||||
breadcrumbs.appendChild(new Image(BREADCRUMBS_SEPARATOR));
|
||||
if (mode.isOf(ModeType.ORDER)
|
||||
&& mode.getOrder() != currentOrder) {
|
||||
currentOrder = mode.getOrder();
|
||||
resourceLoadController.filterBy(currentOrder);
|
||||
}
|
||||
Order currentOrder = mode.getOrder();
|
||||
resourceLoadController.filterBy(currentOrder);
|
||||
resourceLoadController.reload();
|
||||
breadcrumbs.appendChild(new Label(currentOrder.getName()));
|
||||
}
|
||||
};
|
||||
|
|
@ -118,14 +123,19 @@ public class ResourcesLoadTabCreator {
|
|||
@Override
|
||||
public org.zkoss.zk.ui.Component create(
|
||||
org.zkoss.zk.ui.Component parent) {
|
||||
Map<String, Object> arguments = new HashMap<String, Object>();
|
||||
arguments.put("resourceLoadController",
|
||||
resourceLoadControllerGlobal);
|
||||
return Executions.createComponents(
|
||||
"/resourceload/_resourceload.zul", parent, null);
|
||||
"/resourceload/_resourceload.zul", parent, arguments);
|
||||
}
|
||||
|
||||
};
|
||||
return new CreatedOnDemandTab(RESOURCE_LOAD_VIEW, componentCreator) {
|
||||
@Override
|
||||
protected void afterShowAction() {
|
||||
resourceLoadControllerGlobal.filterBy(null);
|
||||
resourceLoadControllerGlobal.reload();
|
||||
if (breadcrumbs.getChildren() != null) {
|
||||
breadcrumbs.getChildren().clear();
|
||||
}
|
||||
|
|
@ -134,7 +144,6 @@ public class ResourcesLoadTabCreator {
|
|||
breadcrumbs.appendChild(new Label(RESOURCE_LOAD_VIEW));
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,6 +50,8 @@ public class ResourceLoadController implements Composer {
|
|||
|
||||
private Order filterBy;
|
||||
|
||||
private org.zkoss.zk.ui.Component parent;
|
||||
|
||||
public ResourceLoadController() {
|
||||
}
|
||||
|
||||
|
|
@ -60,13 +62,19 @@ public class ResourceLoadController implements Composer {
|
|||
|
||||
@Override
|
||||
public void doAfterCompose(org.zkoss.zk.ui.Component comp) throws Exception {
|
||||
this.parent = comp;
|
||||
reload();
|
||||
}
|
||||
|
||||
public void reload() {
|
||||
if (filterBy == null) {
|
||||
resourceLoadModel.initGlobalView();
|
||||
} else {
|
||||
resourceLoadModel.initGlobalView(filterBy);
|
||||
}
|
||||
ResourcesLoadPanel resourcesLoadPanel = buildResourcesLoadPanel();
|
||||
comp.appendChild(resourcesLoadPanel);
|
||||
this.parent.getChildren().clear();
|
||||
this.parent.appendChild(resourcesLoadPanel);
|
||||
resourcesLoadPanel.afterCompose();
|
||||
addCommands(resourcesLoadPanel);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -76,6 +76,7 @@ public class ResourceLoadModel implements IResourceLoadModel {
|
|||
@Override
|
||||
@Transactional(readOnly = true)
|
||||
public void initGlobalView() {
|
||||
filterBy = null;
|
||||
loadTimeLines = calculateLoadTimelinesGroups();
|
||||
if (!loadTimeLines.isEmpty()) {
|
||||
viewInterval = LoadTimelinesGroup.getIntervalFrom(loadTimeLines);
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
<zk>
|
||||
|
||||
<zscript><![CDATA[
|
||||
rsController = resourceLoadController;
|
||||
rsController = arg.get("resourceLoadController");;
|
||||
]]>
|
||||
</zscript>
|
||||
<div apply="${rsController}" self="@{define(content)}">
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue