br.com.jarch.faces.ui.LookupUI Maven / Gradle / Ivy
package br.com.jarch.faces.ui;
import br.com.jarch.faces.controller.IBaseFilterSelectController;
import javax.el.MethodExpression;
import javax.faces.component.FacesComponent;
import javax.faces.component.NamingContainer;
import javax.faces.component.UIInput;
import javax.faces.component.UINamingContainer;
import javax.faces.context.FacesContext;
import java.io.IOException;
@FacesComponent("br.com.jarch.faces.ui.LookupUI")
public class LookupUI extends UIInput implements NamingContainer {
private UIInput code;
private UIInput description;
private IBaseFilterSelectController> actionFilterSelect;
private String actionFilterSelectStr;
public UIInput getCode() {
return code;
}
public void setCode(UIInput code) {
this.code = code;
}
public UIInput getDescription() {
return description;
}
public void setDescription(UIInput description) {
this.description = description;
}
public IBaseFilterSelectController> getActionFilterSelect() {
return actionFilterSelect;
}
public void setActionFilterSelect(IBaseFilterSelectController> actionFilterSelect) {
this.actionFilterSelect = actionFilterSelect;
}
public String getActionFilterSelectStr() {
return actionFilterSelectStr;
}
public void setActionFilterSelectStr(String actionFilterSelectStr) {
this.actionFilterSelectStr = actionFilterSelectStr;
}
@Override
public String getFamily() {
return UINamingContainer.COMPONENT_FAMILY;
}
@Override
public void encodeBegin(FacesContext context) throws IOException {
actionFilterSelect = (IBaseFilterSelectController>) getAttributes().getOrDefault("actionFilterSelect", null);
var fieldCode = getAttributes().getOrDefault("fieldCode", null);
if (fieldCode != null && !fieldCode.toString().isEmpty() && actionFilterSelect != null)
actionFilterSelect.setFieldCodeLookup(fieldCode.toString());
var fieldDescription = getAttributes().getOrDefault("fieldDescription", null);
if (fieldDescription != null && !fieldDescription.toString().isEmpty() && actionFilterSelect != null)
actionFilterSelect.setFieldDescriptionLookup(fieldDescription.toString());
super.encodeBegin(context);
}
@Override
public void decode(FacesContext context) {
setSubmittedValue(context.getExternalContext().getRequestParameterMap().get(getClientId()));
super.decode(context);
}
public String methodAction() {
MethodExpression me = (MethodExpression) this.getAttributes().get("action");
if (me != null) {
Object result = me.invoke(FacesContext.getCurrentInstance().getELContext(), null);
if (result instanceof String) {
return (String) result;
}
}
return null;
}
public void methodListener() {
MethodExpression me = (MethodExpression) this.getAttributes().get("listener");
if (me != null) {
me.invoke(FacesContext.getCurrentInstance().getELContext(), null);
}
}
public String getIdPanelLookup() {
return "panelLookup_" + getId().replace(":", "");
}
public String getSearchLookup() {
return "executeSearchLookup" + getId().replace(":", "");
}
public String getClearCodeDescriptionLookup() {
return "clearCodeDescriptionLookup" + getId().replace(":", "");
}
public String getWidgetVarLookup() {
return "widgetVarLookup" + getId().replace(":", "");
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy