Search in sources :

Example 21 with Text

use of com.ait.lienzo.client.core.shape.Text in project kie-wb-common by kiegroup.

the class EmptyStateLayer method initializeMessage.

private void initializeMessage(final String messageText) {
    message = new Text(messageText);
    message.setFontFamily(EmptyStateView.TEXT_FONT_FAMILY);
    message.setFontSize(EmptyStateView.MESSAGE_FONT_SIZE);
    message.setAlpha(EmptyStateView.TEXT_ALPHA);
    message.setFillColor(EmptyStateView.TEXT_FILL_COLOR);
    message.setStrokeColor(EmptyStateView.TEXT_STROKE_COLOR);
    message.setStrokeWidth(EmptyStateView.TEXT_STROKE_WIDTH);
    add(message);
}
Also used : Text(com.ait.lienzo.client.core.shape.Text)

Example 22 with Text

use of com.ait.lienzo.client.core.shape.Text in project kie-wb-common by kiegroup.

the class EmptyStateLayer method initializeCaption.

private void initializeCaption(final String captionText) {
    caption = new Text(captionText);
    caption.setFontFamily(EmptyStateView.TEXT_FONT_FAMILY);
    caption.setFontSize(EmptyStateView.CAPTION_FONT_SIZE);
    caption.setAlpha(EmptyStateView.TEXT_ALPHA);
    caption.setFillColor(EmptyStateView.TEXT_FILL_COLOR);
    caption.setStrokeColor(EmptyStateView.TEXT_STROKE_COLOR);
    caption.setStrokeWidth(EmptyStateView.TEXT_STROKE_WIDTH);
    add(caption);
}
Also used : Text(com.ait.lienzo.client.core.shape.Text)

Example 23 with Text

use of com.ait.lienzo.client.core.shape.Text in project kie-wb-common by kiegroup.

the class WiresTextDecorator method initialize.

private void initialize() {
    this.text = new Text("").setAlpha(TEXT_ALPHA).setFontFamily(TEXT_FONT_FAMILY).setFontSize(TEXT_FONT_SIZE).setFillColor(TEXT_FILL_COLOR).setStrokeColor(TEXT_STROKE_COLOR).setStrokeWidth(TEXT_STROKE_WIDTH).setTextAlign(TEXT_ALIGN).setDraggable(false);
    this.textWrapper = new TextBoundsWrap(text, shape.getPath().getBoundingBox());
    this.text.setWrapper(textWrapper);
    // Ensure path bounds are available on the selection context.
    text.setFillBoundsForSelection(true);
    initializeHandlers();
    setTextBoundaries(shape.getPath().getBoundingBox());
}
Also used : Text(com.ait.lienzo.client.core.shape.Text) TextBoundsWrap(com.ait.lienzo.client.core.shape.TextBoundsWrap)

Example 24 with Text

use of com.ait.lienzo.client.core.shape.Text in project drools-wb by kiegroup.

the class GuidedDecisionTreeStencilPaletteBuilder method drawDescription.

@Override
protected Text drawDescription(final ShapeFactory factory, final FactoryHelper helper) {
    String description = factory.getShapeDescription();
    if (helper instanceof TypeFactoryHelper) {
        description = ((TypeFactoryHelper) helper).getContext().getClassName();
    } else if (helper instanceof ConstraintFactoryHelper) {
        description = ((ConstraintFactoryHelper) helper).getContext().getFieldName();
    }
    final Text text = new Text(description, ShapeFactoryUtil.FONT_FAMILY_DESCRIPTION, ShapeFactoryUtil.FONT_SIZE_DESCRIPTION);
    text.setFillColor(Color.rgbToBrowserHexColor(100, 100, 100));
    text.setTextBaseLine(TextBaseLine.MIDDLE);
    text.setX(STENCIL_HEIGHT);
    text.setY(STENCIL_HEIGHT / 2);
    return text;
}
Also used : TypeFactoryHelper(org.drools.workbench.screens.guided.dtree.client.widget.factories.TypeFactoryHelper) Text(com.ait.lienzo.client.core.shape.Text) ConstraintFactoryHelper(org.drools.workbench.screens.guided.dtree.client.widget.factories.ConstraintFactoryHelper)

Example 25 with Text

use of com.ait.lienzo.client.core.shape.Text in project drools-wb by kiegroup.

the class GuidedDecisionTreeWidget method showGettingStartedHint.

private void showGettingStartedHint() {
    if (isGettingStartedHintVisible) {
        return;
    }
    if (hint == null) {
        hint = new Group();
        final Rectangle hintRectangle = new Rectangle(600, 225, 15);
        hintRectangle.setStrokeWidth(2.0);
        hintRectangle.setStrokeColor("#6495ED");
        hintRectangle.setFillColor("#AFEEEE");
        hintRectangle.setAlpha(0.75);
        final Text hintText = new Text(GuidedDecisionTreeConstants.INSTANCE.gettingStartedHint(), ShapeFactoryUtil.FONT_FAMILY_DESCRIPTION, 18);
        hintText.setTextAlign(TextAlign.CENTER);
        hintText.setTextBaseLine(TextBaseLine.MIDDLE);
        hintText.setFillColor("#6495ED");
        hintText.setX(hintRectangle.getWidth() / 2);
        hintText.setY(hintRectangle.getHeight() / 2);
        hint.setX((canvasLayer.getWidth() - hintRectangle.getWidth()) / 2);
        hint.setY((canvasLayer.getHeight() / 3) - (hintRectangle.getHeight() / 2));
        hint.add(hintRectangle);
        hint.add(hintText);
    }
    hint.animate(AnimationTweener.LINEAR, new AnimationProperties(), ANIMATION_DURATION, new IAnimationCallback() {

        @Override
        public void onStart(final IAnimation iAnimation, final IAnimationHandle iAnimationHandle) {
            hint.setAlpha(0.0);
            canvasLayer.add(hint);
            isGettingStartedHintVisible = true;
        }

        @Override
        public void onFrame(final IAnimation iAnimation, final IAnimationHandle iAnimationHandle) {
            // Lienzo's IAnimation.getPercent() passes values > 1.0
            final double pct = iAnimation.getPercent() > 1.0 ? 1.0 : iAnimation.getPercent();
            hint.setAlpha(pct);
            hint.getLayer().batch();
        }

        @Override
        public void onClose(final IAnimation iAnimation, final IAnimationHandle iAnimationHandle) {
        // Nothing to do
        }
    });
}
Also used : IAnimationHandle(com.ait.lienzo.client.core.animation.IAnimationHandle) Group(com.ait.lienzo.client.core.shape.Group) AnimationProperties(com.ait.lienzo.client.core.animation.AnimationProperties) IAnimation(com.ait.lienzo.client.core.animation.IAnimation) Rectangle(com.ait.lienzo.client.core.shape.Rectangle) Text(com.ait.lienzo.client.core.shape.Text) IAnimationCallback(com.ait.lienzo.client.core.animation.IAnimationCallback)

Aggregations

Text (com.ait.lienzo.client.core.shape.Text)26 Group (com.ait.lienzo.client.core.shape.Group)10 GridRenderer (org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.GridRenderer)6 GridRendererTheme (org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.themes.GridRendererTheme)6 Test (org.junit.Test)5 BoundingBox (com.ait.lienzo.client.core.types.BoundingBox)4 Rectangle (com.ait.lienzo.client.core.shape.Rectangle)3 TextBoundsWrap (com.ait.lienzo.client.core.shape.TextBoundsWrap)2 Field (java.lang.reflect.Field)2 GridBodyCellRenderContext (org.uberfire.ext.wires.core.grids.client.widget.context.GridBodyCellRenderContext)2 AnimationProperties (com.ait.lienzo.client.core.animation.AnimationProperties)1 IAnimation (com.ait.lienzo.client.core.animation.IAnimation)1 IAnimationCallback (com.ait.lienzo.client.core.animation.IAnimationCallback)1 IAnimationHandle (com.ait.lienzo.client.core.animation.IAnimationHandle)1 IPathClipper (com.ait.lienzo.client.core.shape.IPathClipper)1 ITextWrapper (com.ait.lienzo.client.core.shape.ITextWrapper)1 MultiPath (com.ait.lienzo.client.core.shape.MultiPath)1 Node (com.ait.lienzo.client.core.shape.Node)1 TextLineBreakWrap (com.ait.lienzo.client.core.shape.TextLineBreakWrap)1 WiresShape (com.ait.lienzo.client.core.shape.wires.WiresShape)1