Search in sources :

Example 1 with HtmlSelectOneListbox

use of javax.faces.component.html.HtmlSelectOneListbox in project empire-db by apache.

the class SelectInputControl method createSelectComponent.

/* for SelectTag (when no column is available) */
public UISelectOne createSelectComponent(UIComponent parent, FacesContext context, Object formatSize) {
    Class<? extends UISelectOne> selectOneClass;
    int listSize = ObjectUtils.getInteger(formatSize, 1);
    if (listSize == -1 || listSize > 1)
        selectOneClass = this.listComponentClass;
    else
        selectOneClass = this.menuComponentClass;
    // create now
    UISelectOne selectOne = InputControlManager.createComponent(context, selectOneClass);
    // set list size
    if ((selectOne instanceof HtmlSelectOneListbox) && listSize > 1)
        ((HtmlSelectOneListbox) selectOne).setSize(listSize);
    // done
    return selectOne;
}
Also used : HtmlSelectOneListbox(javax.faces.component.html.HtmlSelectOneListbox) UISelectOne(javax.faces.component.UISelectOne)

Example 2 with HtmlSelectOneListbox

use of javax.faces.component.html.HtmlSelectOneListbox in project TNTConcept by autentia.

the class ActivityBean method onSelectedOrganizationChanged.

/**
 * Set the selectedOrganization value when the combo value changes
 *
 * @param event
 */
public void onSelectedOrganizationChanged(ValueChangeEvent event) {
    setSelectedOrganization((Organization) event.getNewValue());
    // Project
    List<Project> projectsByOrganization = ProjectManager.getDefault().getOpenProjectsByOrganization(selectedOrganization);
    if (projectsByOrganization != null && projectsByOrganization.size() != 0) {
        this.selectedProject = (Project) projectsByOrganization.get(0);
        FacesContext.getCurrentInstance().getViewRoot().getAttributes();
    } else {
        this.selectedProject = null;
    }
    HtmlSelectOneListbox projects = (HtmlSelectOneListbox) FacesUtils.getComponent("activity").findComponent("tabActivity").findComponent("projects");
    projects.setValue(selectedProject);
    if (selectedProject != null) {
        HtmlSelectBooleanCheckbox billHtml = (HtmlSelectBooleanCheckbox) FacesUtils.getComponent("activity").findComponent("tabActivity").findComponent("billable");
        billHtml.setValue(selectedProject.getBillable());
        setBillable(selectedProject.getBillable());
        HtmlInputHidden hiddenHtml = (HtmlInputHidden) FacesUtils.getComponent("activity").findComponent("tabActivity").findComponent("defaultBillable");
        hiddenHtml.setValue(selectedProject.getBillable());
        setDefaultBillable(selectedProject.getBillable());
    }
    FacesUtils.renderResponse();
}
Also used : Project(com.autentia.tnt.businessobject.Project) HtmlSelectBooleanCheckbox(javax.faces.component.html.HtmlSelectBooleanCheckbox) HtmlSelectOneListbox(javax.faces.component.html.HtmlSelectOneListbox) HtmlInputHidden(javax.faces.component.html.HtmlInputHidden)

Aggregations

HtmlSelectOneListbox (javax.faces.component.html.HtmlSelectOneListbox)2 Project (com.autentia.tnt.businessobject.Project)1 UISelectOne (javax.faces.component.UISelectOne)1 HtmlInputHidden (javax.faces.component.html.HtmlInputHidden)1 HtmlSelectBooleanCheckbox (javax.faces.component.html.HtmlSelectBooleanCheckbox)1