Package org.primefaces.component.media

Source Code of org.primefaces.component.media.Media

/*
* 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.media;

import javax.faces.component.UIComponentBase;
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 Media extends UIComponentBase {


  public static final String COMPONENT_TYPE = "org.primefaces.component.Media";
  public static final String COMPONENT_FAMILY = "org.primefaces.component";
  private static final String DEFAULT_RENDERER = "org.primefaces.component.MediaRenderer";

  private java.lang.String _value;
  private java.lang.String _player;
  private java.lang.String _width;
  private java.lang.String _height;
  private java.lang.String _style;
  private java.lang.String _styleClass;

  public Media() {
    setRendererType(DEFAULT_RENDERER);
    ResourceHolder resourceHolder = getResourceHolder();
    if(resourceHolder != null) {
    }
  }

  public String getFamily() {
    return COMPONENT_FAMILY;
  }

  public java.lang.String getValue() {
    if(_value != null )
      return _value;

    ValueExpression ve = getValueExpression("value");
    return ve != null ? (java.lang.String) ve.getValue(getFacesContext().getELContext())  : null;
  }
  public void setValue(java.lang.String _value) {
    this._value = _value;
  }

  public java.lang.String getPlayer() {
    if(_player != null )
      return _player;

    ValueExpression ve = getValueExpression("player");
    return ve != null ? (java.lang.String) ve.getValue(getFacesContext().getELContext())  : null;
  }
  public void setPlayer(java.lang.String _player) {
    this._player = _player;
  }

  public java.lang.String getWidth() {
    if(_width != null )
      return _width;

    ValueExpression ve = getValueExpression("width");
    return ve != null ? (java.lang.String) ve.getValue(getFacesContext().getELContext())  : null;
  }
  public void setWidth(java.lang.String _width) {
    this._width = _width;
  }

  public java.lang.String getHeight() {
    if(_height != null )
      return _height;

    ValueExpression ve = getValueExpression("height");
    return ve != null ? (java.lang.String) ve.getValue(getFacesContext().getELContext())  : null;
  }
  public void setHeight(java.lang.String _height) {
    this._height = _height;
  }

  public java.lang.String getStyle() {
    if(_style != null )
      return _style;

    ValueExpression ve = getValueExpression("style");
    return ve != null ? (java.lang.String) ve.getValue(getFacesContext().getELContext())  : null;
  }
  public void setStyle(java.lang.String _style) {
    this._style = _style;
  }

  public java.lang.String getStyleClass() {
    if(_styleClass != null )
      return _styleClass;

    ValueExpression ve = getValueExpression("styleClass");
    return ve != null ? (java.lang.String) ve.getValue(getFacesContext().getELContext())  : null;
  }
  public void setStyleClass(java.lang.String _styleClass) {
    this._styleClass = _styleClass;
  }

  public Object saveState(FacesContext context) {
    Object values[] = new Object[7];
    values[0] = super.saveState(context);
    values[1] = _value;
    values[2] = _player;
    values[3] = _width;
    values[4] = _height;
    values[5] = _style;
    values[6] = _styleClass;
    return ((Object) values);
  }
  public void restoreState(FacesContext context, Object state) {
    Object values[] = (Object[]) state;
    super.restoreState(context, values[0]);
    _value = (String) values[1];
    _player = (String) values[2];
    _width = (String) values[3];
    _height = (String) values[4];
    _style = (String) values[5];
    _styleClass = (String) 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());
  }
}
TOP

Related Classes of org.primefaces.component.media.Media

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.