Search in sources :

Example 6 with NavigatorTarget

use of com.agiletec.aps.system.services.page.widget.NavigatorTarget in project entando-core by entando.

the class NavigatorTag method doAfterBody.

@Override
public int doAfterBody() throws JspException {
    this._index++;
    if (this._index >= _targets.size()) {
        return SKIP_BODY;
    } else {
        NavigatorTarget currentTarget = this.getCurrentTarget();
        this.pageContext.setAttribute(this.getVar(), currentTarget);
        return EVAL_BODY_AGAIN;
    }
}
Also used : NavigatorTarget(com.agiletec.aps.system.services.page.widget.NavigatorTarget)

Example 7 with NavigatorTarget

use of com.agiletec.aps.system.services.page.widget.NavigatorTarget in project entando-core by entando.

the class NavigatorTag method doStartTag.

@Override
public int doStartTag() throws JspException {
    ServletRequest request = this.pageContext.getRequest();
    try {
        this._reqCtx = (RequestContext) request.getAttribute(RequestContext.REQCTX);
        INavigatorParser navigatorParser = (INavigatorParser) ApsWebApplicationUtils.getBean(SystemConstants.NAVIGATOR_PARSER, this.pageContext);
        IPage currPage = (IPage) this._reqCtx.getExtraParam(SystemConstants.EXTRAPAR_CURRENT_PAGE);
        UserDetails currentUser = (UserDetails) this.pageContext.getSession().getAttribute(SystemConstants.SESSIONPARAM_CURRENT_USER);
        if (this._spec == null) {
            Widget currShowlet = (Widget) _reqCtx.getExtraParam((SystemConstants.EXTRAPAR_CURRENT_WIDGET));
            ApsProperties showletConfig = currShowlet.getConfig();
            String spec = (null != showletConfig) ? showletConfig.getProperty(CONFIG_PARAM_SPEC) : null;
            this._targets = navigatorParser.parseSpec(spec, currPage, currentUser);
        } else {
            this._targets = navigatorParser.parseSpec(this._spec, currPage, currentUser);
        }
        if (this._targets == null || this._targets.isEmpty()) {
            return SKIP_BODY;
        }
        this._index = 0;
        NavigatorTarget currentTarget = this.getCurrentTarget();
        this.pageContext.setAttribute(this.getVar(), currentTarget);
        return EVAL_BODY_INCLUDE;
    } catch (Throwable t) {
        _logger.error("Error during tag initialization", t);
        // ApsSystemUtils.logThrowable(t, this, "doStartTag");
        throw new JspException("Error during tag initialization ", t);
    }
}
Also used : ServletRequest(javax.servlet.ServletRequest) JspException(javax.servlet.jsp.JspException) IPage(com.agiletec.aps.system.services.page.IPage) UserDetails(com.agiletec.aps.system.services.user.UserDetails) NavigatorTarget(com.agiletec.aps.system.services.page.widget.NavigatorTarget) Widget(com.agiletec.aps.system.services.page.Widget) INavigatorParser(com.agiletec.aps.system.services.page.widget.INavigatorParser) ApsProperties(com.agiletec.aps.util.ApsProperties)

Example 8 with NavigatorTarget

use of com.agiletec.aps.system.services.page.widget.NavigatorTarget in project entando-core by entando.

the class NavigatorTag method getCurrentTarget.

private NavigatorTarget getCurrentTarget() {
    NavigatorTarget item = this._targets.get(this._index);
    item.setRequestContext(this._reqCtx);
    return item;
}
Also used : NavigatorTarget(com.agiletec.aps.system.services.page.widget.NavigatorTarget)

Aggregations

NavigatorTarget (com.agiletec.aps.system.services.page.widget.NavigatorTarget)8 RequestContext (com.agiletec.aps.system.RequestContext)5 IPage (com.agiletec.aps.system.services.page.IPage)1 Widget (com.agiletec.aps.system.services.page.Widget)1 INavigatorParser (com.agiletec.aps.system.services.page.widget.INavigatorParser)1 UserDetails (com.agiletec.aps.system.services.user.UserDetails)1 ApsProperties (com.agiletec.aps.util.ApsProperties)1 ServletRequest (javax.servlet.ServletRequest)1 JspException (javax.servlet.jsp.JspException)1