Example #1
0
 @Override
 public void setFocus(boolean focus) {
   super.setFocus(focus);
   top.setVisible(focus);
   if (!focus) {
     if (topCell.hasWidget()) {
       topCell.setWidget(null);
     }
   } else {
     topCell.setWidget(top);
   }
   top.invalidateHierarchy();
   previousTime = Float.valueOf(time.getText());
 }
Example #2
0
 public boolean removeActor(Actor actor) {
   if (!super.removeActor(actor)) return false;
   Cell cell = getCell(actor);
   if (cell != null) cell.setWidget(null);
   return true;
 }
  public void layout() {
    Table table = getTable();
    float width = table.getWidth();
    float height = table.getHeight();

    super.layout(0, 0, width, height);

    java.util.List<Cell> cells = getCells();
    if (round) {
      for (int i = 0, n = cells.size(); i < n; i++) {
        Cell c = cells.get(i);
        if (c.getIgnore()) continue;
        float widgetWidth = Math.round(c.getWidgetWidth());
        float widgetHeight = Math.round(c.getWidgetHeight());
        float widgetX = Math.round(c.getWidgetX());
        float widgetY = height - Math.round(c.getWidgetY()) - widgetHeight;
        c.setWidgetX(widgetX);
        c.setWidgetY(widgetY);
        c.setWidgetWidth(widgetWidth);
        c.setWidgetHeight(widgetHeight);
        Actor actor = (Actor) c.getWidget();
        if (actor != null) {
          actor.setX(widgetX);
          actor.setY(widgetY);
          if (actor.getWidth() != widgetWidth || actor.getHeight() != widgetHeight) {
            actor.setWidth(widgetWidth);
            actor.setHeight(widgetHeight);
            if (actor instanceof Layout) ((Layout) actor).invalidate();
          }
        }
      }
    } else {
      for (int i = 0, n = cells.size(); i < n; i++) {
        Cell c = cells.get(i);
        if (c.getIgnore()) continue;
        float widgetWidth = c.getWidgetWidth();
        float widgetHeight = c.getWidgetHeight();
        float widgetX = c.getWidgetX();
        float widgetY = height - c.getWidgetY() - widgetHeight;
        c.setWidgetX(widgetX);
        c.setWidgetY(widgetY);
        c.setWidgetWidth(widgetWidth);
        c.setWidgetHeight(widgetHeight);
        Actor actor = (Actor) c.getWidget();
        if (actor != null) {
          actor.setX(widgetX);
          actor.setY(widgetY);
          if (actor.getWidth() != widgetWidth || actor.getHeight() != widgetHeight) {
            actor.setWidth(widgetWidth);
            actor.setHeight(widgetHeight);
            if (actor instanceof Layout) ((Layout) actor).invalidate();
          }
        }
      }
    }
    // Validate children separately from sizing actors to ensure actors without a cell are
    // validated.
    Array<Actor> children = table.getChildren();
    for (int i = 0, n = children.size; i < n; i++) {
      Actor child = children.get(i);
      if (child instanceof Layout) ((Layout) child).validate();
    }
  }