/
Apathy21
/
company
Обзор
Документация
Войти
/
Apathy21
/
company
Код
Запросы
0
Задачи
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
MainService/src/main/java/org/example/vm/BranchOfficeCreationModelWindowVM.java
77 строк
2 KB
alexeev509
Skeletop company app realization
13 сен 2024, 19:21
13 сен 2024, 19:21
2a02e11
Код
Авторство
О чём код?
package org.example.vm; import org.example.Entity.Address; import org.example.Entity.BranchOffice; import org.example.Entity.Company; import org.example.service.BranchOfficeService; import org.zkoss.bind.BindUtils; import org.zkoss.bind.annotation.*; import org.zkoss.zk.ui.select.annotation.VariableResolver; import org.zkoss.zk.ui.select.annotation.Wire; import org.zkoss.zk.ui.select.annotation.WireVariable; import org.zkoss.zul.Window; import java.util.HashMap; import java.util.Map; @VariableResolver(org.zkoss.zkplus.cdi.DelegatingVariableResolver.class) public class BranchOfficeCreationModelWindowVM { @Wire("#modalDialog") private Window win; @WireVariable private BranchOfficeService branchOfficeService; private BranchOffice createdBranchOffice; private Address createdAddress; @Init public void init(@ExecutionArgParam("company") Company company) { createdBranchOffice = new BranchOffice(); createdBranchOffice.setCompany(company); createdAddress = new Address(); createdBranchOffice.setAddress(createdAddress); } @Command public void closeThis() { win.detach(); } @Command public void saveBranchOffice(@BindingParam("md") Window md) { // remove ? createdBranchOffice.setAddress(createdAddress); // branchOfficeService.save(createdBranchOffice); Map<String, Object> args = new HashMap<>(); args.put("createdBO", createdBranchOffice); BindUtils.postGlobalCommand(null, null, "refreshBranchOffices", args); md.detach(); } public BranchOffice getCreatedBranchOffice() { return createdBranchOffice; } public void setCreatedBranchOffice(BranchOffice createdBranchOffice) { this.createdBranchOffice = createdBranchOffice; } public Window getWin() { return win; } public void setWin(Window win) { this.win = win; } public Address getCreatedAddress() { return createdAddress; } public void setCreatedAddress(Address createdAddress) { this.createdAddress = createdAddress; } }