ItEr32S12CUAsignacionGrupoRecursosAPlanificacionItEr31S15: When going back to tab, it is reloaded
This commit is contained in:
parent
1371df4480
commit
89d4dced07
2 changed files with 67 additions and 19 deletions
|
|
@ -322,11 +322,17 @@ public class AdvancedAllocationController extends GenericForwardComposer {
|
|||
private TimeTrackerComponentWithoutColumns timeTrackerComponent;
|
||||
private Grid leftPane;
|
||||
private TimeTrackedTable<Row> table;
|
||||
private final IBack back;
|
||||
private final List<AllocationInput> allocationInputs;
|
||||
private IBack back;
|
||||
private List<AllocationInput> allocationInputs;
|
||||
private Component associatedComponent;
|
||||
|
||||
public AdvancedAllocationController(IBack back,
|
||||
List<AllocationInput> allocationInputs) {
|
||||
setInputData(back, allocationInputs);
|
||||
|
||||
}
|
||||
|
||||
private void setInputData(IBack back, List<AllocationInput> allocationInputs) {
|
||||
Validate.notNull(back);
|
||||
Validate.noNullElements(allocationInputs);
|
||||
Validate.isTrue(!allocationInputs.isEmpty());
|
||||
|
|
@ -334,10 +340,21 @@ public class AdvancedAllocationController extends GenericForwardComposer {
|
|||
this.allocationInputs = allocationInputs;
|
||||
}
|
||||
|
||||
public void reset(IBack back, List<AllocationInput> allocationInputs) {
|
||||
setInputData(back, allocationInputs);
|
||||
loadAndInitializeComponents();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doAfterCompose(Component comp) throws Exception {
|
||||
super.doAfterCompose(comp);
|
||||
messages = new MessagesForUser(comp.getFellow("messages"));
|
||||
this.associatedComponent = comp;
|
||||
loadAndInitializeComponents();
|
||||
}
|
||||
|
||||
private void loadAndInitializeComponents() {
|
||||
messages = new MessagesForUser(associatedComponent
|
||||
.getFellow("messages"));
|
||||
createComponents();
|
||||
insertComponentsInLayout();
|
||||
timeTrackerComponent.afterCompose();
|
||||
|
|
@ -363,8 +380,11 @@ public class AdvancedAllocationController extends GenericForwardComposer {
|
|||
}
|
||||
|
||||
private void insertComponentsInLayout() {
|
||||
insertionPointRightPanel.getChildren().clear();
|
||||
insertionPointRightPanel.appendChild(table);
|
||||
insertionPointLeftPanel.getChildren().clear();
|
||||
insertionPointLeftPanel.appendChild(leftPane);
|
||||
insertionPointTimetracker.getChildren().clear();
|
||||
insertionPointTimetracker.appendChild(timeTrackerComponent);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -113,6 +113,7 @@ public class AdvancedAllocationTabCreator {
|
|||
private final IAdHocTransactionService adHocTransactionService;
|
||||
private final IOrderDAO orderDAO;
|
||||
private final ITaskElementDAO taskElementDAO;
|
||||
private AdvancedAllocationController advancedAllocationController;
|
||||
|
||||
public static ITab create(final Mode mode,
|
||||
IAdHocTransactionService adHocTransactionService,
|
||||
|
|
@ -135,35 +136,55 @@ public class AdvancedAllocationTabCreator {
|
|||
}
|
||||
|
||||
private ITab build() {
|
||||
IComponentCreator advanceAllocationComponentCreator = new IComponentCreator() {
|
||||
@Override
|
||||
public Component create(final Component parent) {
|
||||
return adHocTransactionService
|
||||
.runOnReadOnlyTransaction(new IOnTransaction<Component>() {
|
||||
@Override
|
||||
public Component execute() {
|
||||
return createComponent(parent);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
};
|
||||
return new CreatedOnDemandTab(ADVANCED_ALLOCATION_VIEW,
|
||||
new IComponentCreator() {
|
||||
@Override
|
||||
public Component create(final Component parent) {
|
||||
return adHocTransactionService
|
||||
.runOnReadOnlyTransaction(new IOnTransaction<Component>() {
|
||||
@Override
|
||||
public Component execute() {
|
||||
return createComponent(parent);
|
||||
}
|
||||
advanceAllocationComponentCreator) {
|
||||
private boolean firstTime = true;
|
||||
@Override
|
||||
protected void afterShowAction() {
|
||||
if (firstTime) {
|
||||
firstTime = false;
|
||||
return;
|
||||
}
|
||||
adHocTransactionService
|
||||
.runOnReadOnlyTransaction(new IOnTransaction<Void>() {
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
@Override
|
||||
public Void execute() {
|
||||
resetController();
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private Component createComponent(final Component parent) {
|
||||
Order order = mode.getOrder();
|
||||
orderDAO.save(order);
|
||||
return Executions.createComponents("advance_allocation.zul", parent,
|
||||
argsWithController(order));
|
||||
}
|
||||
|
||||
private Map<String, Object> argsWithController(Order order) {
|
||||
orderDAO.save(order);
|
||||
Map<String, Object> result = new HashMap<String, Object>();
|
||||
advancedAllocationController = new AdvancedAllocationController(
|
||||
createBack(), createAllocationInputsFor(order));
|
||||
result.put("advancedAllocationController",
|
||||
new AdvancedAllocationController(createBack(),
|
||||
createAllocationInputsFor(order)));
|
||||
advancedAllocationController);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
@ -211,4 +232,11 @@ public class AdvancedAllocationTabCreator {
|
|||
.getCalculatedValue(), aggregate));
|
||||
}
|
||||
|
||||
private void resetController() {
|
||||
Order order = mode.getOrder();
|
||||
orderDAO.save(order);
|
||||
advancedAllocationController.reset(createBack(),
|
||||
createAllocationInputsFor(order));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue