org.richfaces.component.AbstractMenuItem Maven / Gradle / Ivy
package org.richfaces.component;
import org.richfaces.cdk.annotations.Attribute;
import org.richfaces.cdk.annotations.Facet;
import org.richfaces.cdk.annotations.JsfComponent;
import org.richfaces.cdk.annotations.JsfRenderer;
import org.richfaces.cdk.annotations.Tag;
import org.richfaces.renderkit.html.MenuItemRendererBase;
import org.richfaces.component.attribute.AjaxProps;
import org.richfaces.component.attribute.BypassProps;
import org.richfaces.component.attribute.CoreProps;
import org.richfaces.component.attribute.DisabledProps;
import org.richfaces.component.attribute.EventsKeyProps;
import org.richfaces.component.attribute.EventsMouseProps;
import org.richfaces.component.attribute.I18nProps;
/**
* The <rich:menuItem> component represents a single item in a menu control. The <rich:menuItem>
* component can be also be used as a seperate component without a parent menu component, such as on a toolbar.
*/
@JsfComponent(family = AbstractDropDownMenu.COMPONENT_FAMILY, type = AbstractMenuItem.COMPONENT_TYPE,
facets = {@Facet(name = "icon", generate = false), @Facet(name = "iconDisabled", generate = false) },
renderer = @JsfRenderer(type = MenuItemRendererBase.RENDERER_TYPE), tag = @Tag(name = "menuItem"))
public abstract class AbstractMenuItem extends AbstractActionComponent implements AjaxProps, BypassProps, CoreProps, DisabledProps, EventsKeyProps, EventsMouseProps, I18nProps {
public static final String COMPONENT_TYPE = "org.richfaces.MenuItem";
public static final String CSS_ROOT_DEFAULT = "ddm";
/**
* Determines how the menu item requests are submitted. Valid values:
*
* - server, the default setting, submits the form normally and completely refreshes the page.
* - ajax performs an Ajax form submission, and re-renders elements specified with the render attribute.
* -
* client causes the action and actionListener items to be ignored, and the behavior is fully defined by
* the nested components instead of responses from submissions
*
*
*/
@Attribute
public abstract Mode getMode();
/**
* The text label for the menu item. Alternatively, use the label facet to define content for the label
* Default is server
*/
@Attribute
public abstract Object getLabel();
/**
* The icon to be displayed with the menu item
*/
@Attribute
public abstract String getIcon();
/**
* The icon to be displayed with the menu item when it is disabled
*/
@Attribute
public abstract String getIconDisabled();
@Attribute(hidden = true)
public abstract Object getValue();
@Attribute(generate = false, hidden = true, readOnly = true)
public Object getCssRoot() {
Object cssRoot = getParent().getAttributes().get("cssRoot");
if (cssRoot == null) {
cssRoot = CSS_ROOT_DEFAULT;
}
return cssRoot;
}
public enum Facets {
icon,
iconDisabled
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy