All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cb.petal.Compartment Maven / Gradle / Ivy

/**
 * Copyright (c) 2001 Markus Dahm
 * Copyright (C) 2015-2018 BITPlan GmbH http://www.bitplan.com
 *
 * This source is part of
 * https://github.com/BITPlan/CrazyBeans
 * and the license as outlined there applies
 */
package cb.petal;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

/**
 * Represents Compartment object
 *
 * @version $Id: Compartment.java,v 1.7 2001/06/22 09:10:36 dahm Exp $
 * @author M. Dahm
 */
public class Compartment extends PetalObject {
  public Compartment(PetalNode parent, Collection params) {
    super(parent, "Compartment", params);
  }

  public Compartment() {
    super("Compartment");
  }

  public Tag getParentView() {
    return (Tag) getProperty("Parent_View");
  }

  public void setParentView(Tag o) {
    defineProperty("Parent_View", o);
  }

  public Location getLocation() {
    return (Location) getProperty("location");
  }

  public void setLocation(Location o) {
    defineProperty("location", o);
  }

  public String getIconStyle() {
    return getPropertyAsString("icon_style");
  }

  public void setIconStyle(String o) {
    defineProperty("icon_style", o);
  }

  public int getFillColor() {
    return getPropertyAsInteger("fill_color");
  }

  public void setFillColor(int o) {
    defineProperty("fill_color", o);
  }

  public int getAnchor() {
    return getPropertyAsInteger("anchor");
  }

  public void setAnchor(int o) {
    defineProperty("anchor", o);
  }

  public int getNlines() {
    return getPropertyAsInteger("nlines");
  }

  public void setNlines(int o) {
    defineProperty("nlines", o);
  }

  public int getMaxWidth() {
    return getPropertyAsInteger("max_width");
  }

  public void setMaxWidth(int o) {
    defineProperty("max_width", o);
  }

  public void accept(Visitor v) {
    v.visit(this);
  }

  /**
   * get the compartment items of this compartment
   * 
   * @return the list of strings or null if there are no compartment items
   */
  public List getCompartmentItems() {
    List citems = null;
    PetalNodeList citemNodes = (PetalNodeList) getProperty("compartmentItems");
    if (citemNodes != null) {
      citems = new ArrayList();
      for (PetalNode citemNode : citemNodes.get()) {
        StringLiteral citem = (StringLiteral) citemNode;
        citems.add(citem.getValue());
      }
    }
    return citems;
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy