use of javax.faces.component.html.HtmlSelectOneRadio in project empire-db by apache.
the class RadioInputControl method createInputComponents.
@Override
protected void createInputComponents(UIComponent parent, InputInfo ii, FacesContext context, List<UIComponent> compList) {
if (!compList.isEmpty())
throw new InvalidArgumentException("compList", compList);
// create
HtmlSelectOneRadio input = InputControlManager.createComponent(context, this.inputComponentClass);
// setValueExpressionFlag
Object value = ii.getValue(false);
input.getAttributes().put(RadioInputControl.VALUE_EXPRESSION_FLAG, (value instanceof ValueExpression));
// copy Attributes
copyAttributes(parent, ii, input);
// disabled
boolean disabled = ii.isDisabled();
input.setDisabled(disabled);
// Options
Options options = ii.getOptions();
boolean addEmpty = getEmptyEntryRequired(ii, disabled) && !options.containsNull();
String nullText = (addEmpty) ? getNullText(ii) : "";
initOptions(input, ii.getTextResolver(), options, addEmpty, nullText);
// add
compList.add(input);
// style
addRemoveDisabledStyle(input, disabled);
addRemoveInvalidStyle(input, ii.hasError());
// Set Value
setInputValue(input, ii);
}
use of javax.faces.component.html.HtmlSelectOneRadio in project empire-db by apache.
the class RadioInputControl method updateInputState.
@Override
protected void updateInputState(List<UIComponent> compList, InputInfo ii, FacesContext context, PhaseId phaseId) {
UIComponent comp = compList.get(0);
if (!(comp instanceof HtmlSelectOneRadio)) {
throw new UnexpectedReturnValueException(comp.getClass().getName(), "parent.getChildren()");
}
HtmlSelectOneRadio input = (HtmlSelectOneRadio) comp;
// disabled
boolean disabled = ii.isDisabled();
input.setDisabled(disabled);
// check phase
if (phaseId != PhaseId.APPLY_REQUEST_VALUES) {
// Options (sync)
Options options = ii.getOptions();
boolean addEmpty = getEmptyEntryRequired(ii, disabled) && !options.containsNull();
String nullText = (addEmpty) ? getNullText(ii) : "";
syncOptions(input, ii.getTextResolver(), options, addEmpty, nullText);
}
if (phaseId == PhaseId.RENDER_RESPONSE) {
// style
addRemoveDisabledStyle(input, disabled);
addRemoveInvalidStyle(input, ii.hasError());
// set value
setInputValue(input, ii);
}
}
use of javax.faces.component.html.HtmlSelectOneRadio in project TNTConcept by autentia.
the class ActivityBean method getRolesBySelectedProject.
public List<SelectItem> getRolesBySelectedProject() {
ArrayList<SelectItem> ret = new ArrayList<SelectItem>();
ProjectRoleSearch prjRolSearch = new ProjectRoleSearch();
prjRolSearch.setProject(getSelectedProject());
List<ProjectRole> refs = ProjectRoleManager.getDefault().getAllEntities(prjRolSearch, new SortCriteria("name", false));
if (refs != null) {
for (ProjectRole ref : refs) {
ret.add(new SelectItem(ref, ref.getName()));
}
// proyecto, por que sino borrariamos y creariamos una situaciĆ³n inconsistente
if (this.getRole() != null && this.getRole().getProject() != null && !this.getRole().getProject().equals(this.getSelectedProject())) {
HtmlSelectOneRadio optRole = (HtmlSelectOneRadio) FacesUtils.getComponent("activity").findComponent("tabActivity").findComponent("role");
this.setRole(refs.get(0));
optRole.setValue(this.getRole());
}
}
return ret;
}
Aggregations