All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.richfaces.component.AbstractSelect Maven / Gradle / Ivy

The newest version!
package org.richfaces.component;

import javax.faces.component.EditableValueHolder;
import javax.faces.context.FacesContext;
import javax.faces.event.AbortProcessingException;
import javax.faces.event.ComponentSystemEvent;
import javax.faces.event.ListenerFor;
import javax.faces.event.PostAddToViewEvent;
import javax.faces.validator.Validator;

import org.richfaces.cdk.annotations.Attribute;
import org.richfaces.cdk.annotations.JsfComponent;
import org.richfaces.cdk.annotations.JsfRenderer;
import org.richfaces.cdk.annotations.Tag;
import org.richfaces.validator.SelectLabelValueValidator;

/**
 * 

* The <rich:select> component provides a drop-down list box for selecting a single value from multiple options. The * <rich:select> component can be configured as a combo-box, where it will accept typed input. The component also supports * keyboard navigation. The <rich:select> component functions similarly to the JSF UISelectOne component. *

* * @author abelevich */ @JsfComponent(type = AbstractSelect.COMPONENT_TYPE, family = AbstractSelect.COMPONENT_FAMILY, generate = "org.richfaces.component.UISelect", renderer = @JsfRenderer(type = "org.richfaces.SelectRenderer"), tag = @Tag(name = "select"), attributes = { "core-props.xml", "events-mouse-props.xml", "events-key-props.xml", "select-props.xml" }) @ListenerFor(systemEventClass = PostAddToViewEvent.class) public abstract class AbstractSelect extends AbstractSelectComponent { public static final String COMPONENT_TYPE = "org.richfaces.Select"; public static final String COMPONENT_FAMILY = "org.richfaces.Select"; /** * If "true", this component is disabled */ @Attribute public abstract boolean isDisabled(); /** *

* If "true" Allows the user to type into a text field to scroll through or filter the list *

*

* Default is "false" *

*/ @Attribute() public abstract boolean isEnableManualInput(); /** *

* If "true" as the user types to narrow the list, automatically select the first element in the list. Applicable only when * enableManualInput is "true". *

*

* Default is "true" *

*/ @Attribute(defaultValue = "true") public abstract boolean isSelectFirst(); /** *

* When "true" display a button to expand the popup list *

*

* Default is "true" *

*/ @Attribute(defaultValue = "true") public abstract boolean isShowButton(); /** * The minimum height ot the list */ @Attribute() public abstract String getMinListHeight(); /** * The maximum height of the list */ @Attribute() public abstract String getMaxListHeight(); /** * A javascript function used to filter the list of items in the select popup */ @Attribute public abstract String getClientFilterFunction(); @Attribute(hidden = true) public abstract String getActiveClass(); @Attribute(hidden = true) public abstract String getChangedClass(); @Attribute(hidden = true) public abstract String getDisabledClass(); // --------- core-props.xml @Attribute public abstract String getStyle(); @Attribute public abstract String getStyleClass(); @Attribute public abstract String getTitle(); @Override public void processEvent(ComponentSystemEvent event) throws AbortProcessingException { super.processEvent(event); if (event instanceof PostAddToViewEvent) { FacesContext facesContext = FacesContext.getCurrentInstance(); EditableValueHolder component = (EditableValueHolder) event.getComponent(); Validator validator = facesContext.getApplication().createValidator(SelectLabelValueValidator.ID); component.addValidator(validator); } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy