ItEr41S25CUAltaSubcontrataItEr30S08: Implemented the autocomplete combo box for the field 'User'.
A finder for that entity had to be implemented, besides some additional methods in the Controller and the Model.
This commit is contained in:
parent
83a5a66b2e
commit
25f01cf39f
4 changed files with 35 additions and 1 deletions
|
|
@ -35,6 +35,7 @@ import org.navalplanner.web.common.OnlyOneVisible;
|
|||
import org.navalplanner.web.common.Util;
|
||||
import org.zkoss.zk.ui.Component;
|
||||
import org.zkoss.zk.ui.util.GenericForwardComposer;
|
||||
import org.zkoss.zul.Comboitem;
|
||||
import org.zkoss.zul.Window;
|
||||
|
||||
/**
|
||||
|
|
@ -125,6 +126,15 @@ public class ExternalCompanyCRUDController extends GenericForwardComposer
|
|||
return externalCompanyModel.getCompany();
|
||||
}
|
||||
|
||||
public void setCompanyUser(Comboitem selectedItem) {
|
||||
if (selectedItem != null) {
|
||||
externalCompanyModel.setCompanyUser((User) selectedItem.getValue());
|
||||
}
|
||||
else {
|
||||
externalCompanyModel.setCompanyUser(null);
|
||||
}
|
||||
}
|
||||
|
||||
private OnlyOneVisible getVisibility() {
|
||||
return (visibility == null) ? new OnlyOneVisible(createWindow,
|
||||
listWindow)
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ import org.apache.commons.lang.Validate;
|
|||
import org.navalplanner.business.common.exceptions.InstanceNotFoundException;
|
||||
import org.navalplanner.business.externalcompanies.daos.IExternalCompanyDAO;
|
||||
import org.navalplanner.business.externalcompanies.entities.ExternalCompany;
|
||||
import org.navalplanner.business.users.entities.User;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
|
|
@ -47,8 +48,13 @@ public class ExternalCompanyModel implements IExternalCompanyModel {
|
|||
private ExternalCompany externalCompany;
|
||||
|
||||
@Override
|
||||
@Transactional(readOnly = true)
|
||||
public List<ExternalCompany> getCompanies() {
|
||||
return externalCompanyDAO.list(ExternalCompany.class);
|
||||
List<ExternalCompany> list = externalCompanyDAO.list(ExternalCompany.class);
|
||||
for(ExternalCompany company : list) {
|
||||
forceLoadEntities(company);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -102,4 +108,9 @@ public class ExternalCompanyModel implements IExternalCompanyModel {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCompanyUser(User companyUser) {
|
||||
externalCompany.setCompanyUser(companyUser);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ import java.util.List;
|
|||
|
||||
import org.navalplanner.business.common.exceptions.ValidationException;
|
||||
import org.navalplanner.business.externalcompanies.entities.ExternalCompany;
|
||||
import org.navalplanner.business.users.entities.User;
|
||||
|
||||
/**
|
||||
* Model for UI operations related to {@link ExternalCompany}
|
||||
|
|
@ -67,4 +68,12 @@ public interface IExternalCompanyModel {
|
|||
* If validation fails
|
||||
*/
|
||||
void confirmSave();
|
||||
|
||||
/**
|
||||
* Changes the value of the attribute companyUser in the inner
|
||||
* {@link ExternalCompany} object.
|
||||
*
|
||||
* @param companyUser
|
||||
*/
|
||||
void setCompanyUser(User companyUser);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,6 +59,10 @@
|
|||
</row>
|
||||
<row>
|
||||
<label value="${i18n:_('User')}:" />
|
||||
<autocomplete id="user"
|
||||
onChange ="controller.setCompanyUser(self.selectedItem);"
|
||||
selectedItem="@{controller.company.companyUser}"
|
||||
autodrop="true" finder="UserFinder" />
|
||||
</row>
|
||||
<row>
|
||||
<label value="${i18n:_('Interacts with applications')}:" />
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue