Example usage for org.apache.wicket Component isActionAuthorized

List of usage examples for org.apache.wicket Component isActionAuthorized

Introduction

In this page you can find the example usage for org.apache.wicket Component isActionAuthorized.

Prototype

public final boolean isActionAuthorized(Action action) 

Source Link

Document

Authorizes an action for a component.

Usage

From source file:com.userweave.pages.configuration.editentitypanel.BaseFunctionEditEntityPanel.java

License:Open Source License

/**
 * Disable all annotated links with the given
 * which not match the given study state.
 *///ww  w.  ja  va  2 s .com
@Override
protected void onBeforeRender() {
    // throw enable check to authorization strategy 
    visitChildren(new IVisitor<Component, Void>() {
        public void component(final Component component, final IVisit<Void> visit) {
            // calls auth. strategy
            boolean isEnabled = component.isActionAuthorized(ENABLE);

            component.setEnabled(isEnabled);
        }
    });

    visitChildren(new DisableEventLinkVisitor(getStudyStateModel()));

    super.onBeforeRender();
}

From source file:org.eknet.wicket.commons.components.navlist.ListItemWrapper.java

License:Apache License

private boolean isChildVisible(Component component) {
    if (component instanceof MarkupContainer) {
        MarkupContainer container = (MarkupContainer) component;
        Iterator<Component> iter = container.iterator();
        if (iter.hasNext()) {
            Component child = iter.next();
            return child.isVisible() && child.isActionAuthorized(Component.RENDER);
        }/*from  ww  w .  j ava 2  s  . co m*/
    }
    return true;
}