private void animate( final IPrimitive<?> primitive, final String fillColor, final double fillAlpha, final double strokeAlpha) { primitive.animate( AnimationTweener.LINEAR, AnimationProperties.toPropertyList( AnimationProperty.Properties.FILL_COLOR(fillColor), AnimationProperty.Properties.FILL_ALPHA(fillAlpha), AnimationProperty.Properties.STROKE_ALPHA(strokeAlpha)), 200); }
@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; }
protected void init(final double chartWidth, final double chartHeight) { // Title & Legend & tooltip. final Text chartTitle = getXYChart().getChartTitle(); final ChartLegend legend = getXYChart().getChartLegend(); final XYChartTooltip tooltip = getXYChart().getChartTooltip(); if (legend != null) legend.removeFromParent(); if (tooltip != null) tooltip.removeFromParent(); // Bar children. final List<Text> categoriesAxisTitles = getXYChart().getCategoriesAxisTitle(); final List<Text> valuesAxisTitles = getXYChart().getValuesAxisTitle(); final List<XYChartLabel> seriesLabels = getXYChart().getSeriesLabels(); final List<Line> valuesAxisIntervals = getXYChart().getValuesAxisIntervals(); final List<XYChartLabel> valuesLabels = getXYChart().getValuesLabels(); // Title. if (chartTitle != null) { destroyTitle(chartTitle); } // Categories axis title. if (categoriesAxisTitles != null && !categoriesAxisTitles.isEmpty()) { for (Text t : categoriesAxisTitles) { destroyTitle(t); } } // Values axis title. if (valuesAxisTitles != null && !valuesAxisTitles.isEmpty()) { for (Text t : valuesAxisTitles) { destroyTitle(t); } } // Categories labels. if (seriesLabels != null) { for (XYChartLabel label : seriesLabels) { destroyCategoriesAxisLabel(label); } } // Values labels. if (valuesLabels != null) { for (XYChartLabel label : valuesLabels) { destroyValuesAxisLabel(label); } } // Create the nodes' animations. final double yClearPos = chartHeight; final double xClearPos = ChartDirection.POSITIVE.equals(getXYChart().getDirection()) ? 0 : chartWidth; // Apply animation values axis intervals. if (valuesAxisIntervals != null) { for (final Line line : valuesAxisIntervals) { if (line != null) { final double clearDiff = isVertical() ? (yClearPos - line.getPoints().get(1).getY()) : (xClearPos - line.getPoints().get(1).getX()); if (isVertical()) add(line, buildAnimationProperties(null, clearDiff)); else add(line, buildAnimationProperties(clearDiff, null)); } } } AnimationProperties animationProperties2 = new AnimationProperties(); animationProperties2.push(AnimationProperty.Properties.Y(yClearPos)); animationProperties2.push(AnimationProperty.Properties.HEIGHT(0d)); // Apply animation to values. clearValues(chartWidth, chartHeight); // Create axis titles' animations. if (!getXYChart().getCategoriesAxisTitle().isEmpty()) add( (Node<?>) getXYChart().getCategoriesAxisTitle().get(0), buildAnimationProperties(null, null, 0d, 0d)); if (!getXYChart().getValuesAxisTitle().isEmpty()) add( (Node<?>) getXYChart().getValuesAxisTitle().get(0), buildAnimationProperties(null, null, 0d, 0d)); }