Search in sources :

Example 1 with HtmlSelectBooleanCheckbox

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

the class ActivityBean method onSelectedProjectChanged.

/**
 * Set the projectOrganization value when the combo value changes
 *
 * @param event
 */
public void onSelectedProjectChanged(ValueChangeEvent event) {
    setSelectedProject((Project) event.getNewValue());
    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 : HtmlSelectBooleanCheckbox(javax.faces.component.html.HtmlSelectBooleanCheckbox) HtmlInputHidden(javax.faces.component.html.HtmlInputHidden)

Example 2 with HtmlSelectBooleanCheckbox

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

the class CheckboxInputControl method updateInputState.

@Override
protected void updateInputState(List<UIComponent> compList, InputInfo ii, FacesContext context, PhaseId phaseId) {
    UIComponent comp = compList.get(0);
    if (!(comp instanceof HtmlSelectBooleanCheckbox)) {
        throw new UnexpectedReturnValueException(comp.getClass().getName(), "compList.get(0)");
    }
    HtmlSelectBooleanCheckbox input = (HtmlSelectBooleanCheckbox) comp;
    // disabled
    boolean disabled = ii.isDisabled();
    input.setDisabled(disabled);
    // check phase
    if (phaseId == PhaseId.RENDER_RESPONSE) {
        // style
        addRemoveDisabledStyle(input, disabled);
        // set value
        setInputValue(input, ii);
    }
}
Also used : HtmlSelectBooleanCheckbox(javax.faces.component.html.HtmlSelectBooleanCheckbox) UnexpectedReturnValueException(org.apache.empire.exceptions.UnexpectedReturnValueException) UIComponent(javax.faces.component.UIComponent)

Example 3 with HtmlSelectBooleanCheckbox

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

the class CheckboxInputControl method createInputComponents.

@Override
protected void createInputComponents(UIComponent parent, InputInfo ii, FacesContext context, List<UIComponent> compList) {
    if (!compList.isEmpty())
        throw new InvalidArgumentException("compList", compList);
    // create
    HtmlSelectBooleanCheckbox input = InputControlManager.createComponent(context, this.inputComponentClass);
    // copy attributes
    copyAttributes(parent, ii, input);
    // add
    compList.add(input);
    // set style and value
    updateInputState(compList, ii, context, context.getCurrentPhaseId());
}
Also used : HtmlSelectBooleanCheckbox(javax.faces.component.html.HtmlSelectBooleanCheckbox) InvalidArgumentException(org.apache.empire.exceptions.InvalidArgumentException)

Example 4 with HtmlSelectBooleanCheckbox

use of javax.faces.component.html.HtmlSelectBooleanCheckbox 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

HtmlSelectBooleanCheckbox (javax.faces.component.html.HtmlSelectBooleanCheckbox)4 HtmlInputHidden (javax.faces.component.html.HtmlInputHidden)2 Project (com.autentia.tnt.businessobject.Project)1 UIComponent (javax.faces.component.UIComponent)1 HtmlSelectOneListbox (javax.faces.component.html.HtmlSelectOneListbox)1 InvalidArgumentException (org.apache.empire.exceptions.InvalidArgumentException)1 UnexpectedReturnValueException (org.apache.empire.exceptions.UnexpectedReturnValueException)1