Package binky.ofc2plugin.charts.elements

Source Code of binky.ofc2plugin.charts.elements.ElementNotPie

package binky.ofc2plugin.charts.elements;

import java.util.LinkedList;
import java.util.List;

import org.json.simple.JSONObject;

import binky.ofc2plugin.charts.json.OFCNumber;

public abstract class ElementNotPie extends Element {
  private List<OFCNumber> values;

  private OnShowType onShow = OnShowType.PopUp;

  public ElementNotPie() {
    this.values = new LinkedList<OFCNumber>();
  }

  @SuppressWarnings("unchecked")
  @Override
  public JSONObject encode() {
    JSONObject me = new JSONObject();
    me.put("values", values);
   
    JSONObject onShowJson = new JSONObject();
    onShowJson.put("type", this.onShow.getDisplayName());
    onShowJson.put("casecade", "2.5");
    onShowJson.put("delay", "0");
    me.putAll(super.encode());
    return me;
  }
  public enum OnShowType {

    PopUp("pop-up"), Explode("explode"), MidSlide("mid-slide"), Drop("drop"), FadeIn(
        "fade-in"), ShrinkIn("shrink-in"), GrowUp("grow-up");

    private String displayName;

    OnShowType(String displayName) {
      this.displayName = displayName;
    }

    public String getName() {
      return name();
    }

    public String getDisplayName() {
      return displayName;
    }

  }

  public OnShowType getOnShow() {
    return onShow;
  }

  public void setOnShow(OnShowType onShow) {
    this.onShow = onShow;
  }

  public void addValue(Number value) {
    this.values.add(new OFCNumber(value));
  }

  public void addValues(List<? extends Number> values) {
    for (Number n : values) {
      this.values.add(new OFCNumber(n));
    }
  }

  public List<OFCNumber> getValues() {
    return values;
  }

}
TOP

Related Classes of binky.ofc2plugin.charts.elements.ElementNotPie

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.