Example usage for javax.el ValueExpression ValueExpression

List of usage examples for javax.el ValueExpression ValueExpression

Introduction

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

Prototype

ValueExpression

Source Link

Usage

From source file:org.openfaces.component.table.AbstractTable.java

private ValueExpression itemSelectedExpressionForColumn(final BaseColumn column) {
    final Map<String, Object> requestMap = FacesContext.getCurrentInstance().getExternalContext()
            .getRequestMap();/*from   w w  w .ja v a  2 s  .c  o  m*/
    final String var = getVar();
    if (column instanceof SelectionColumn || column instanceof CheckboxColumn)
        return new ValueExpression() {
            public Object getValue(ELContext context) {
                boolean thisRowSelected = isRowInColumnSelected(column, requestMap, var);
                return !thisRowSelected;
            }

            public void setValue(ELContext context, Object value) {
                throw new UnsupportedOperationException();
            }

            public boolean isReadOnly(ELContext context) {
                return true;
            }

            public Class getType(ELContext context) {
                return Boolean.class;
            }

            public Class getExpectedType() {
                return Boolean.class;
            }

            public String getExpressionString() {
                return null;
            }

            public boolean equals(Object o) {
                return false;
            }

            public int hashCode() {
                return 0;
            }

            public boolean isLiteralText() {
                return false;
            }
        };
    else
        throw new IllegalArgumentException("Unknown column type: " + column.getClass().getName());
}