/*
* Copyright 2009 Prime Technology.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.primefaces.component.column;
import javax.faces.component.UIColumn;
import javax.faces.context.FacesContext;
import javax.el.ValueExpression;
import javax.el.MethodExpression;
import javax.faces.render.Renderer;
import java.io.IOException;
import org.primefaces.resource.ResourceHolder;
import org.primefaces.renderkit.PartialRenderer;
public class Column extends UIColumn {
public static final String COMPONENT_TYPE = "org.primefaces.component.Column";
public static final String COMPONENT_FAMILY = "org.primefaces.component";
private java.lang.Object _sortBy;
private java.lang.Boolean _resizable;
private java.lang.Boolean _filter;
private java.lang.String _selectionMode;
private java.lang.String _parser;
private java.lang.Integer _width;
public Column() {
setRendererType(null);
ResourceHolder resourceHolder = getResourceHolder();
if(resourceHolder != null) {
}
}
public String getFamily() {
return COMPONENT_FAMILY;
}
public java.lang.Object getSortBy() {
if(_sortBy != null )
return _sortBy;
ValueExpression ve = getValueExpression("sortBy");
return ve != null ? (java.lang.Object) ve.getValue(getFacesContext().getELContext()) : null;
}
public void setSortBy(java.lang.Object _sortBy) {
this._sortBy = _sortBy;
}
public boolean isResizable() {
if(_resizable != null )
return _resizable;
ValueExpression ve = getValueExpression("resizable");
return ve != null ? (java.lang.Boolean) ve.getValue(getFacesContext().getELContext()) : false;
}
public void setResizable(boolean _resizable) {
this._resizable = _resizable;
}
public boolean isFilter() {
if(_filter != null )
return _filter;
ValueExpression ve = getValueExpression("filter");
return ve != null ? (java.lang.Boolean) ve.getValue(getFacesContext().getELContext()) : false;
}
public void setFilter(boolean _filter) {
this._filter = _filter;
}
public java.lang.String getSelectionMode() {
if(_selectionMode != null )
return _selectionMode;
ValueExpression ve = getValueExpression("selectionMode");
return ve != null ? (java.lang.String) ve.getValue(getFacesContext().getELContext()) : null;
}
public void setSelectionMode(java.lang.String _selectionMode) {
this._selectionMode = _selectionMode;
}
public java.lang.String getParser() {
if(_parser != null )
return _parser;
ValueExpression ve = getValueExpression("parser");
return ve != null ? (java.lang.String) ve.getValue(getFacesContext().getELContext()) : null;
}
public void setParser(java.lang.String _parser) {
this._parser = _parser;
}
public int getWidth() {
if(_width != null )
return _width;
ValueExpression ve = getValueExpression("width");
return ve != null ? (java.lang.Integer) ve.getValue(getFacesContext().getELContext()) : java.lang.Integer.MIN_VALUE;
}
public void setWidth(int _width) {
this._width = _width;
}
public Object saveState(FacesContext context) {
Object values[] = new Object[7];
values[0] = super.saveState(context);
values[1] = _sortBy;
values[2] = _resizable;
values[3] = _filter;
values[4] = _selectionMode;
values[5] = _parser;
values[6] = _width;
return ((Object) values);
}
public void restoreState(FacesContext context, Object state) {
Object values[] = (Object[]) state;
super.restoreState(context, values[0]);
_sortBy = (Object) values[1];
_resizable = (Boolean) values[2];
_filter = (Boolean) values[3];
_selectionMode = (String) values[4];
_parser = (String) values[5];
_width = (Integer) values[6];
}
protected FacesContext getFacesContext() {
return FacesContext.getCurrentInstance();
}
protected ResourceHolder getResourceHolder() {
FacesContext facesContext = getFacesContext();
if(facesContext == null)
return null;
ValueExpression ve = facesContext.getApplication().getExpressionFactory().createValueExpression(facesContext.getELContext(), "#{primeFacesResourceHolder}", ResourceHolder.class);
return (ResourceHolder) ve.getValue(facesContext.getELContext());
}
}