Example usage for javax.el ValueExpression getValue

List of usage examples for javax.el ValueExpression getValue

Introduction

In this page you can find the example usage for javax.el ValueExpression getValue.

Prototype

public abstract Object getValue(ELContext context);

Source Link

Usage

From source file:org.nuxeo.ecm.platform.ui.web.component.document.RestDocumentLink.java

public String getTabs() {
    if (tabs != null) {
        return tabs;
    }//from   w ww  . j av a  2 s . co m
    ValueExpression ve = getValueExpression("tabs");
    if (ve != null) {
        try {
            return (String) ve.getValue(getFacesContext().getELContext());
        } catch (ELException e) {
            throw new FacesException(e);
        }
    } else {
        return null;
    }
}

From source file:org.nuxeo.ecm.platform.ui.web.component.document.RestDocumentLink.java

public String getSubTab() {
    if (subTab != null) {
        return subTab;
    }// w  w  w  .j ava  2s . com
    ValueExpression ve = getValueExpression("subTab");
    if (ve != null) {
        try {
            return (String) ve.getValue(getFacesContext().getELContext());
        } catch (ELException e) {
            throw new FacesException(e);
        }
    } else {
        return null;
    }
}

From source file:org.nuxeo.ecm.platform.ui.web.component.document.RestDocumentLink.java

public String getPattern() {
    if (pattern != null) {
        return pattern;
    }//from   ww w  .  j  a v a2  s. c o m
    ValueExpression ve = getValueExpression("pattern");
    if (ve != null) {
        try {
            return (String) ve.getValue(getFacesContext().getELContext());
        } catch (ELException e) {
            throw new FacesException(e);
        }
    } else {
        return null;
    }
}

From source file:org.nuxeo.ecm.platform.ui.web.component.document.RestDocumentLink.java

/**
 * @since 7.3/* w  w w .j av a 2 s .  c  o m*/
 */
public String getBaseURL() {
    if (baseURL != null) {
        return baseURL;
    }
    ValueExpression ve = getValueExpression("baseURL");
    if (ve != null) {
        try {
            return (String) ve.getValue(getFacesContext().getELContext());
        } catch (ELException e) {
            throw new FacesException(e);
        }
    } else {
        return null;
    }
}

From source file:org.nuxeo.ecm.platform.ui.web.component.document.RestDocumentLink.java

public String getRepositoryName() {
    if (repositoryName != null) {
        return repositoryName;
    }//from www. ja  va 2s  . c  o  m
    ValueExpression ve = getValueExpression("repositoryName");
    if (ve != null) {
        try {
            return (String) ve.getValue(getFacesContext().getELContext());
        } catch (ELException e) {
            throw new FacesException(e);
        }
    } else {
        return null;
    }
}

From source file:org.nuxeo.ecm.platform.ui.web.component.document.RestDocumentLink.java

public DocumentModel getDocument() {
    if (document != null) {
        return document;
    }//  ww  w.jav  a2 s .  co  m
    ValueExpression ve = getValueExpression("document");
    if (ve != null) {
        try {
            return (DocumentModel) ve.getValue(getFacesContext().getELContext());
        } catch (ELException e) {
            throw new FacesException(e);
        }
    } else {
        return null;
    }
}

From source file:org.nuxeo.ecm.platform.ui.web.component.document.RestDocumentLink.java

public DocumentRef getDocumentIdRef() {
    if (documentIdRef != null) {
        return documentIdRef;
    }/*from w  w  w. j a  va2s . com*/
    ValueExpression ve = getValueExpression("documentId");
    if (ve != null) {
        try {
            String id = (String) ve.getValue(getFacesContext().getELContext());
            if (id != null) {
                return new IdRef(id);
            } else {
                return null;
            }
        } catch (ELException e) {
            throw new FacesException(e);
        }
    } else {
        return null;
    }
}

From source file:org.nuxeo.ecm.platform.ui.web.component.document.RestDocumentLink.java

public DocumentRef getDocumentPathRef() {
    if (documentPathRef != null) {
        return documentPathRef;
    }/* w  ww .j av  a 2  s  .  c o m*/
    ValueExpression ve = getValueExpression("documentPath");
    if (ve != null) {
        try {
            String id = (String) ve.getValue(getFacesContext().getELContext());
            if (id != null) {
                return new IdRef(id);
            } else {
                return null;
            }
        } catch (ELException e) {
            throw new FacesException(e);
        }
    } else {
        return null;
    }
}

From source file:org.richfaces.component.UIDatascroller.java

public int getPage() {
    Map<String, Object> attributes = getDataTable().getAttributes();
    Integer state = (Integer) attributes.get(SCROLLER_STATE_ATTRIBUTE);
    if (state != null) {
        return state;
    }/*from  ww  w.jav  a 2  s  .  c o  m*/

    if (this.page != null) {
        return page;
    }

    ValueExpression ve = getValueExpression("page");
    if (ve != null) {
        try {
            Integer pageObject = (Integer) ve.getValue(getFacesContext().getELContext());

            if (pageObject != null) {
                return pageObject;
            } else {
                return 1;
            }
        } catch (ELException e) {
            throw new FacesException(e);
        }
    } else {
        return 1;
    }
}

From source file:org.nuxeo.ecm.platform.ui.web.tag.handler.SetTagHandler.java

public FaceletHandler applyOptimized(FaceletContext ctx, UIComponent parent, BlockingVariableMapper vm,
        String varStr) throws IOException {

    // handle variable expression
    boolean cacheValue = false;
    if (cache != null) {
        cacheValue = cache.getBoolean(ctx);
    }// w ww  .  j  a  v  a2 s.  c o m
    boolean resolveTwiceBool = false;
    if (resolveTwice != null) {
        resolveTwiceBool = resolveTwice.getBoolean(ctx);
    }

    ValueExpression ve;
    if (cacheValue) {
        // resolve value and put it as is in variable mapper
        Object res = value.getObject(ctx);
        if (resolveTwiceBool && res instanceof String && ComponentTagUtils.isValueReference((String) res)) {
            ve = ctx.getExpressionFactory().createValueExpression(ctx, (String) res, Object.class);
            res = ve.getValue(ctx);
        }
        ve = ctx.getExpressionFactory().createValueExpression(res, Object.class);
    } else {
        ve = value.getValueExpression(ctx, Object.class);
        if (resolveTwiceBool) {
            boolean localBool = false;
            if (local != null) {
                localBool = local.getBoolean(ctx);
            }
            if (localBool) {
                ve = new MetaValueExpression(ve);
            } else {
                ve = new MetaValueExpression(ve, ctx.getFunctionMapper(), vm);
            }
        }
    }

    vm.setVariable(varStr, ve);

    if (blockPatterns != null) {
        String blockedValue = blockPatterns.getValue(ctx);
        if (!StringUtils.isEmpty(blockedValue)) {
            // split on "," character
            vm.setBlockedPatterns(resolveBlockPatterns(blockedValue));
        }
    }

    FaceletHandler nextHandler = this.nextHandler;
    if (nextHandler instanceof SetTagHandler) {
        // try merging with next handler
        SetTagHandler next = (SetTagHandler) nextHandler;
        if (next.isAcceptingMerge(ctx)) {
            nextHandler = next.applyOptimized(ctx, parent, vm);
        }
    }

    return nextHandler;
}