
package de.ivu.elect.presentation.stimmeingabe;

import java.io.Serializable;

import org.primefaces.event.ToggleEvent;
import org.primefaces.model.Visibility;

public class CollapsedProperty implements Serializable {

  private static final long serialVersionUID = 1L;

  public static final CollapsedProperty NULL = new CollapsedProperty(true) {

    @Override
    public boolean isCollapsed() {
      return true;
    }
  };

  private boolean collapsed = true;

  public CollapsedProperty() {
    super();
  }

  public CollapsedProperty(boolean collapsed) {
    this.collapsed = collapsed;
  }

  public boolean isCollapsed() {
    return collapsed;
  }

  public void setCollapsed(boolean collapsed) {
    this.collapsed = collapsed;
  }

  public void handleToggle(ToggleEvent event) {
    setCollapsed(Visibility.VISIBLE.equals(event.getVisibility()));
  }
}
