@Override
  public void layout() {
    if (table == null) return;

    table.setBounds(0, 0, table.getPrefWidth(), table.getPrefHeight());

    if (actionRunning == false) {
      if (collapsed) currentWidth = 0;
      else currentWidth = table.getPrefWidth();
    }
  }
  @Override
  public float getPrefWidth() {
    if (table == null) return 0;

    if (actionRunning == false) {
      if (collapsed) return 0;
      else return table.getPrefWidth();
    }

    return currentWidth;
  }
  public void setCollapsed(boolean collapse, boolean withAnimation) {
    this.collapsed = collapse;
    updateTouchable();

    if (table == null) return;

    actionRunning = true;

    if (withAnimation) {
      addAction(collapseAction);
    } else {
      if (collapse) {
        currentWidth = 0;
        collapsed = true;
      } else {
        currentWidth = table.getPrefWidth();
        collapsed = false;
      }

      actionRunning = false;
      invalidateHierarchy();
    }
  }