/*
 * Licensed Materials - Property of Perforce Software, Inc. 
 * © Copyright Perforce Software, Inc. 2014, 2021 
 * © Copyright IBM Corp. 2009, 2014
 * © Copyright ILOG 1996, 2009
 * All Rights Reserved.
 *
 * Note to U.S. Government Users Restricted Rights:
 * The Software and Documentation were developed at private expense and
 * are "Commercial Items" as that term is defined at 48 CFR 2.101,
 * consisting of "Commercial Computer Software" and
 * "Commercial Computer Software Documentation", as such terms are
 * used in 48 CFR 12.212 or 48 CFR 227.7202-1 through 227.7202-4,
 * as applicable.
 */
package thinstock.faces.component;

import javax.faces.context.FacesContext;

import ilog.views.chart.faces.dhtml.component.IlvChartDHTMLView;
import ilog.views.faces.component.IlvBasicView;
import ilog.views.faces.component.IlvViewHelper;
import ilog.views.faces.component.IlvViewHelperImpl;

/**
 * A minor chart is a chart linked to the main chart.
 */
SuppressWarnings("unchecked")
public class MinorChartView extends IlvChartDHTMLView implements IlvViewHelper {

  private IlvViewHelper delegate = new IlvViewHelperImpl(this);

  public static String getComponentType() {
    return MinorChartView.class.getName();
  }

  Override
  public String getFamily() {
    return MinorChartView.class.getName();
  }

  Override
  public IlvBasicView getView() {
    return delegate.getView();
  }

  Override
  public String getViewId() {
    return delegate.getViewId();
  }

  Override
  public void setView(IlvBasicView view) {
    delegate.setView(view);
  }

  Override
  public void setViewId(String viewId) {
    delegate.setViewId(viewId);
  }

  Override
  public void updateModel(FacesContext ctx) {
    delegate.updateModel(ctx);
  }

  Override
  public Object saveState(FacesContext context) {
    Object[] state = new Object[2];
    state[0] = super.saveState(context);
    state[1] = delegate.saveState(context);
    return state;
  }

  Override
  public void restoreState(FacesContext context, Object stateObj) {
    Object[] state = (Object[]) stateObj;
    super.restoreState(context, state[0]);
    delegate.restoreState(context, state[1]);
  }

}