org.richfaces.renderkit.html.ContextMenuRendererBase Maven / Gradle / Ivy
package org.richfaces.renderkit.html;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.faces.application.ResourceDependencies;
import javax.faces.application.ResourceDependency;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import org.richfaces.component.AbstractContextMenu;
import org.richfaces.component.AbstractMenuGroup;
import org.richfaces.component.AbstractMenuItem;
import org.richfaces.component.AbstractMenuSeparator;
import org.richfaces.component.Mode;
import org.richfaces.component.Positioning;
import org.richfaces.renderkit.RenderKitUtils;
import org.richfaces.renderkit.RenderKitUtils.ScriptHashVariableWrapper;
import org.richfaces.renderkit.RendererBase;
import org.richfaces.renderkit.util.RendererUtils;
@ResourceDependencies({ @ResourceDependency(library = "javax.faces", name = "jsf.js"),
@ResourceDependency(library = "org.richfaces", name = "jquery.js"),
@ResourceDependency(library = "org.richfaces", name = "richfaces.js"),
@ResourceDependency(library = "org.richfaces", name = "richfaces-queue.reslib"),
@ResourceDependency(library = "org.richfaces", name = "richfaces-base-component.js"),
@ResourceDependency(library = "org.richfaces", name = "jquery.position.js"),
@ResourceDependency(library = "org.richfaces", name = "richfaces-event.js"),
@ResourceDependency(library = "org.richfaces", name = "popup.js"),
@ResourceDependency(library = "org.richfaces", name = "menuKeyNavigation.js"),
@ResourceDependency(library = "org.richfaces", name = "menu-base.js"),
@ResourceDependency(library = "org.richfaces", name = "menu.js"),
@ResourceDependency(library = "org.richfaces", name = "menugroup.js"),
@ResourceDependency(library = "org.richfaces", name = "menuitem.js"),
@ResourceDependency(library = "org.richfaces", name = "contextmenu.js"),
@ResourceDependency(library = "org.richfaces", name = "contextmenu.ecss", target = "head") })
public abstract class ContextMenuRendererBase extends RendererBase {
public static final String RENDERER_TYPE = "org.richfaces.ContextMenuRenderer";
public static final int DEFAULT_MIN_POPUP_WIDTH = 250;
public static final String DEFAULT_SHOWEVENT = "contextmenu";
protected static final RendererUtils RENDERER_UTILS = RendererUtils.getInstance();
@Override
public void renderChildren(FacesContext facesContext, UIComponent component) throws IOException {
AbstractContextMenu contextMenu = (AbstractContextMenu) component;
for (UIComponent child : contextMenu.getChildren()) {
if (child.isRendered()
&& (child instanceof AbstractMenuGroup || child instanceof AbstractMenuItem
|| child instanceof AbstractMenuSeparator || UIComponent.isCompositeComponent(child))) {
child.encodeAll(facesContext);
}
}
}
protected boolean isDisabled(FacesContext facesContext, UIComponent component) {
if (component instanceof AbstractContextMenu) {
return ((AbstractContextMenu) component).isDisabled();
}
return false;
}
public List
© 2015 - 2024 Weber Informatics LLC | Privacy Policy