Added a 'Cancel' button to common area with modal window to ask for confirmation
FEA: ItEr75S04BugFixing
This commit is contained in:
parent
04d51d2a2a
commit
503fe6d993
4 changed files with 75 additions and 0 deletions
|
|
@ -209,6 +209,7 @@ public class OrderCRUDController extends GenericForwardComposer {
|
|||
private Button createOrderButton;
|
||||
private Button createOrderFromTemplateButton;
|
||||
private Button saveOrderAndContinueButton;
|
||||
private Button cancelEditionButton;
|
||||
|
||||
private Datebox filterStartDate;
|
||||
|
||||
|
|
@ -293,6 +294,34 @@ public class OrderCRUDController extends GenericForwardComposer {
|
|||
saveAndContinue();
|
||||
}
|
||||
});
|
||||
|
||||
cancelEditionButton.setParent(perspectiveButtonsInsertionPoint);
|
||||
cancelEditionButton.addEventListener(Events.ON_CLICK,
|
||||
new EventListener() {
|
||||
@Override
|
||||
public void onEvent(Event event) throws Exception {
|
||||
try {
|
||||
Messagebox
|
||||
.show(_("Unsaved changes will be lost. Are you sure?"),
|
||||
_("Confirm exit dialog"),
|
||||
Messagebox.OK | Messagebox.CANCEL,
|
||||
Messagebox.QUESTION,
|
||||
new org.zkoss.zk.ui.event.EventListener() {
|
||||
public void onEvent(Event evt)
|
||||
throws InterruptedException {
|
||||
if (evt.getName().equals(
|
||||
"onOK")) {
|
||||
Executions
|
||||
.sendRedirect("/planner/index.zul;company_scheduling");
|
||||
}
|
||||
}
|
||||
});
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void initEditOrderElementWindow() {
|
||||
|
|
@ -1445,6 +1474,7 @@ public class OrderCRUDController extends GenericForwardComposer {
|
|||
createOrderButton.setVisible(showCreate);
|
||||
createOrderFromTemplateButton.setVisible(showCreate);
|
||||
saveOrderAndContinueButton.setVisible(!showCreate);
|
||||
cancelEditionButton.setVisible(!showCreate);
|
||||
}
|
||||
|
||||
public void highLight(final OrderElement orderElement) {
|
||||
|
|
|
|||
|
|
@ -115,6 +115,7 @@ import org.zkoss.ganttz.adapters.PlannerConfiguration.IReloadChartListener;
|
|||
import org.zkoss.ganttz.data.GanttDiagramGraph.IGraphChangeListener;
|
||||
import org.zkoss.ganttz.extensions.ICommand;
|
||||
import org.zkoss.ganttz.extensions.ICommandOnTask;
|
||||
import org.zkoss.ganttz.extensions.IContext;
|
||||
import org.zkoss.ganttz.extensions.IContextWithPlannerTask;
|
||||
import org.zkoss.ganttz.timetracker.TimeTracker;
|
||||
import org.zkoss.ganttz.timetracker.zoom.DetailItem;
|
||||
|
|
@ -135,6 +136,7 @@ import org.zkoss.zul.Datebox;
|
|||
import org.zkoss.zul.Div;
|
||||
import org.zkoss.zul.Hbox;
|
||||
import org.zkoss.zul.Label;
|
||||
import org.zkoss.zul.Messagebox;
|
||||
import org.zkoss.zul.Progressmeter;
|
||||
import org.zkoss.zul.Tab;
|
||||
import org.zkoss.zul.Tabbox;
|
||||
|
|
@ -327,6 +329,7 @@ public class OrderPlanningModel implements IOrderPlanningModel {
|
|||
setupEditingCapabilities(configuration, writingAllowed);
|
||||
|
||||
configuration.addGlobalCommand(buildReassigningCommand());
|
||||
configuration.addGlobalCommand(buildCancelEditionCommand());
|
||||
|
||||
NullSeparatorCommandOnTask<TaskElement> separator = new NullSeparatorCommandOnTask<TaskElement>();
|
||||
|
||||
|
|
@ -1002,6 +1005,45 @@ public class OrderPlanningModel implements IOrderPlanningModel {
|
|||
return reassignCommand;
|
||||
}
|
||||
|
||||
private ICommand<TaskElement> buildCancelEditionCommand() {
|
||||
return new ICommand<TaskElement>() {
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return _("Cancel");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doAction(IContext<TaskElement> context) {
|
||||
|
||||
try {
|
||||
Messagebox
|
||||
.show("Are you sure to want to leave? Unsaved changes will be lost.",
|
||||
"Confirm exit dialog", Messagebox.OK
|
||||
| Messagebox.CANCEL,
|
||||
Messagebox.QUESTION,
|
||||
new org.zkoss.zk.ui.event.EventListener() {
|
||||
public void onEvent(Event evt)
|
||||
throws InterruptedException {
|
||||
if (evt.getName().equals("onOK")) {
|
||||
Executions
|
||||
.sendRedirect("/planner/index.zul;company_scheduling");
|
||||
}
|
||||
}
|
||||
});
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getImage() {
|
||||
return "/common/img/ico_back.png";
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
private Chart setupChart(Order orderReloaded,
|
||||
IChartFiller loadChartFiller, Timeplot chartComponent,
|
||||
Planner planner) {
|
||||
|
|
|
|||
BIN
navalplanner-webapp/src/main/webapp/common/img/ico_back.png
Normal file
BIN
navalplanner-webapp/src/main/webapp/common/img/ico_back.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 629 B |
|
|
@ -40,6 +40,9 @@
|
|||
<button id="saveOrderAndContinueButton" image="/common/img/ico_save.png" sclass="planner-icon"
|
||||
tooltiptext="${i18n:_('Save Project')}" />
|
||||
|
||||
<button id="cancelEditionButton" image="/common/img/ico_back.png" sclass="planner-icon"
|
||||
tooltiptext="${i18n:_('Cancel edition')}" />
|
||||
|
||||
<hbox id="orderFilter" visible="false"/>
|
||||
<vbox id="orderElementFilter" />
|
||||
</hbox>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue