parent
48d2c75d7b
commit
c6ebf8959b
@ -0,0 +1,24 @@
|
|||||||
|
package info.bukova.isspst.services.requirement;
|
||||||
|
|
||||||
|
import info.bukova.isspst.services.IsspstException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Pepa Rokos
|
||||||
|
*/
|
||||||
|
public class ApproveException extends IsspstException {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = -3794779381621324848L;
|
||||||
|
|
||||||
|
public ApproveException() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
public ApproveException(String message) {
|
||||||
|
super(message);
|
||||||
|
this.setReason(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,60 @@
|
|||||||
|
package info.bukova.isspst.ui.main;
|
||||||
|
|
||||||
|
import info.bukova.isspst.StringUtils;
|
||||||
|
import info.bukova.isspst.data.RequirementBase;
|
||||||
|
import info.bukova.isspst.services.requirement.ApproveException;
|
||||||
|
import info.bukova.isspst.services.requirement.RequirementBaseService;
|
||||||
|
import info.bukova.isspst.ui.ListViewModel;
|
||||||
|
import org.zkoss.bind.BindUtils;
|
||||||
|
import org.zkoss.bind.annotation.BindingParam;
|
||||||
|
import org.zkoss.bind.annotation.Command;
|
||||||
|
import org.zkoss.bind.annotation.ExecutionArgParam;
|
||||||
|
import org.zkoss.bind.annotation.Init;
|
||||||
|
import org.zkoss.zul.Messagebox;
|
||||||
|
import org.zkoss.zul.Window;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Pepa Rokos
|
||||||
|
*/
|
||||||
|
public class ApproveDialogVM {
|
||||||
|
|
||||||
|
private RequirementBaseService service;
|
||||||
|
private RequirementBase requirement;
|
||||||
|
private ListViewModel grid;
|
||||||
|
private Date approveDate;
|
||||||
|
|
||||||
|
public Date getApproveDate() {
|
||||||
|
return approveDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setApproveDate(Date approveDate) {
|
||||||
|
this.approveDate = approveDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Init
|
||||||
|
public void init(@ExecutionArgParam("service") RequirementBaseService service,
|
||||||
|
@ExecutionArgParam("requirement") RequirementBase requirement,
|
||||||
|
@ExecutionArgParam("grid") ListViewModel grid) {
|
||||||
|
this.service = service;
|
||||||
|
this.requirement = requirement;
|
||||||
|
this.grid = grid;
|
||||||
|
this.approveDate = new Date();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Command
|
||||||
|
public void approve(@BindingParam("window") Window window) {
|
||||||
|
try {
|
||||||
|
service.approve(requirement, approveDate);
|
||||||
|
BindUtils.postNotifyChange(null, null, grid, "dataBean");
|
||||||
|
BindUtils.postNotifyChange(null, null, grid, "canApprove");
|
||||||
|
BindUtils.postGlobalCommand(null, null, "reload", null);
|
||||||
|
window.detach();
|
||||||
|
} catch (ApproveException ex) {
|
||||||
|
Messagebox.show(StringUtils.localize(ex.getReason()), StringUtils.localize("Error"), Messagebox.OK,
|
||||||
|
Messagebox.ERROR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
@ -0,0 +1,29 @@
|
|||||||
|
<?page title="${labels.RequirementApproveDialog}" contentType="text/html;charset=UTF-8"?>
|
||||||
|
|
||||||
|
<zk xmlns="http://www.zkoss.org/2005/zul"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://www.zkoss.org/2005/zul http://www.zkoss.org/2005/zul/zul.xsd">
|
||||||
|
<?variable-resolver class="org.zkoss.zkplus.spring.DelegatingVariableResolver"?>
|
||||||
|
|
||||||
|
<window id="approveWin" border="normal" apply="org.zkoss.bind.BindComposer"
|
||||||
|
viewModel="@id('vm') @init('info.bukova.isspst.ui.main.ApproveDialogVM')" width="300px" closable="true">
|
||||||
|
<caption
|
||||||
|
image="/img/approve-032.png"
|
||||||
|
zclass="form-caption"
|
||||||
|
label="${labels.RequirementApproveDialog}" />
|
||||||
|
|
||||||
|
<vbox hflex="1">
|
||||||
|
<hbox>
|
||||||
|
<label value="${labels.RequirementApproveDate}"/>
|
||||||
|
<datebox value="@bind(vm.approveDate)"/>
|
||||||
|
</hbox>
|
||||||
|
<separator bar="true" hflex="1"/>
|
||||||
|
<hbox>
|
||||||
|
<button image="/img/approve-016.png" label="${labels.Confirm}" onClick="@command('approve', window=approveWin)" sclass="nicebutton"/>
|
||||||
|
<button image="~./zul/img/misc/drag-disallow.png" label="${labels.ButtonStorno}" onClick="approveWin.detach()" sclass="nicebutton"/>
|
||||||
|
</hbox>
|
||||||
|
</vbox>
|
||||||
|
|
||||||
|
</window>
|
||||||
|
|
||||||
|
</zk>
|
Loading…
Reference in New Issue