@SuppressWarnings("unchecked")
  public V show() {
    if (null == getPalette().getParent()) {
      throw new IllegalStateException("Palette must be attached to a layer before calling #show.");
    }
    if (!items.isEmpty()) {
      final AbstractPalette.Item[] primitives = new AbstractPalette.Item[items.size()];
      int _x = 0;
      for (final LienzoPaletteElementView paletteItemView : items) {
        final AbstractPalette.Item i = buildLienzoPaletteItem(paletteItemView);
        primitives[_x] = i;
        _x++;
      }
      double paletteStartY = 0;
      if (null != colExpButton && isExpandable()) {
        colExpButton.setX(x + getGrid().getPadding());
        colExpButton.setY(y);
        paletteStartY = colExpButton.getBoundingBox().getHeight() + getGrid().getPadding();
      }
      getPalette().setX(x);
      getPalette().setY(paletteStartY + y);
      getPalette().setRows(getGrid().getRows());
      getPalette().setColumns(getGrid().getColumns());
      getPalette().setIconSize(getGrid().getIconSize());
      getPalette().setPadding(getGrid().getPadding());
      getPalette().build(primitives);
      getPalette().setAlpha(0);
      getPalette()
          .animate(
              AnimationTweener.LINEAR,
              AnimationProperties.toPropertyList(AnimationProperty.Properties.ALPHA(1)),
              animationDuration);
      draw();

    } else {
      clear();
    }
    return (V) this;
  }
Пример #2
0
 @Override
 protected void setY(final IPrimitive<?> shape, final int y) {
   shape.setY(y);
 }