use of com.ait.lienzo.client.core.shape.Text in project drools-wb by kiegroup.
the class GuidedDecisionTableViewImpl method makeHeaderCaption.
private Group makeHeaderCaption() {
final Group g = GWT.create(Group.class);
final double captionWidth = getHeaderCaptionWidth();
final GuidedDecisionTableTheme theme = (GuidedDecisionTableTheme) renderer.getTheme();
final Rectangle r = theme.getBaseRectangle(GuidedDecisionTableTheme.ModelColumnType.CAPTION);
r.setWidth(captionWidth);
r.setHeight(HEADER_CAPTION_HEIGHT);
final MultiPath border = theme.getBodyGridLine();
border.M(0.5, HEADER_CAPTION_HEIGHT + 0.5);
border.L(0.5, 0.5);
border.L(captionWidth + 0.5, 0.5);
border.L(captionWidth + 0.5, HEADER_CAPTION_HEIGHT + 0.5);
border.L(0.5, HEADER_CAPTION_HEIGHT + 0.5);
final Text caption = theme.getHeaderText();
caption.setText(model.getTableName());
caption.setX(captionWidth / 2);
caption.setY(HEADER_CAPTION_HEIGHT / 2);
// Clip Caption Group
final BoundingBox bb = new BoundingBox(0, 0, captionWidth + border.getStrokeWidth(), HEADER_CAPTION_HEIGHT + 0.5);
final IPathClipper clipper = getPathClipper(bb);
g.setPathClipper(clipper);
clipper.setActive(true);
g.add(r);
g.add(caption);
g.add(border);
return g;
}
use of com.ait.lienzo.client.core.shape.Text in project drools-wb by kiegroup.
the class BaseGuidedDecisionTreeNodeFactory method getDragProxy.
@Override
public ShapeDragProxy getDragProxy(final FactoryHelper helper, final ShapeDragProxyPreviewCallback dragPreviewCallback, final ShapeDragProxyCompleteCallback dragEndCallBack) {
final T shape = makeShape();
final Group group = new Group();
group.add(shape);
// Add a label to the drag proxy if needed
double dragProxyWidth = getWidth();
double dragProxyHeight = getHeight();
final String description = getNodeLabel(helper);
if (description != null) {
final Text nodeLabel = new Text(description, ShapeFactoryUtil.FONT_FAMILY_DESCRIPTION, ShapeFactoryUtil.FONT_SIZE_DESCRIPTION);
nodeLabel.setTextAlign(TextAlign.CENTER);
nodeLabel.setTextBaseLine(TextBaseLine.MIDDLE);
nodeLabel.setFillColor(Color.rgbToBrowserHexColor(0, 0, 0));
dragProxyWidth = getDragProxyWidth(nodeLabel);
dragProxyHeight = getDragProxyHeight(nodeLabel);
group.add(nodeLabel);
}
final double _dragProxyWidth = dragProxyWidth;
final double _dragProxyHeight = dragProxyHeight;
return new ShapeDragProxy() {
@Override
public Group getDragGroup() {
return group;
}
@Override
public void onDragPreview(final double x, final double y) {
dragPreviewCallback.callback(x, y);
}
@Override
public void onDragComplete(final double x, final double y) {
dragEndCallBack.callback(x, y);
}
@Override
public double getWidth() {
return _dragProxyWidth;
}
@Override
public double getHeight() {
return _dragProxyHeight;
}
};
}
use of com.ait.lienzo.client.core.shape.Text in project drools-wb by kiegroup.
the class GuidedDecisionTreeStencilPaletteBuilder method build.
public PaletteShape build(final LienzoPanel dragProxyParentPanel, final FactoryHelper helper, final ShapeFactory factory, final boolean isReadOnly) {
// If the Editor is not Read Only delegate to super class
if (!isReadOnly) {
return super.build(dragProxyParentPanel, helper, factory);
}
// Otherwise make a Read Only Stencil
final PaletteShape paletteShape = new PaletteShape();
final ShapeGlyph glyph = drawGlyph(factory, helper);
final Text description = drawDescription(factory, helper);
final Rectangle bounding = drawBoundingBox(factory, helper);
// Build Palette Shape
paletteShape.setBounding(bounding);
paletteShape.setGroup(scaleGlyph(glyph));
paletteShape.setDescription(description);
return paletteShape;
}
use of com.ait.lienzo.client.core.shape.Text in project kie-wb-common by kiegroup.
the class PrimitiveTooltip method show.
public PrimitiveTooltip show(final IPrimitive<?> _glyph, final String text, final Point2D location, final double width, final double height, final Direction direction) {
clearTimers();
final IPrimitive<?> glyph = null != _glyph ? (IPrimitive<?>) _glyph.copy() : null;
final Text descText = new Text(text).setFontSize(TEXT_SIZE).setFontStyle("").setFontFamily(TEXT_FAMILY).setStrokeWidth(TEXT_WIDTH).setStrokeColor(TEXT_COLOR).setStrokeAlpha(1);
final BoundingBox descTextBB = descText.getBoundingBox();
final double descTextBbW = descTextBB.getWidth();
final double descTextBbH = descTextBB.getHeight();
final double dw = (descTextBbW > width ? (descTextBbW + PADDING) : (width + PADDING));
final double dh = height + descTextBbH + PADDING;
final IPrimitive<?> decorator = buildDecorator(dw, dh, direction);
final double w = dw + (isWest(direction) ? TRIANGLE_SIZE * 2 : 0);
final double h = dh + (isNorth(direction) ? TRIANGLE_SIZE * 2 : 0);
;
final Group g = new Group();
g.add(decorator);
if (null != glyph) {
g.add(glyph);
}
g.add(descText);
super.show(g, w, h, location.getX(), location.getY());
double _x = (w / 2) + (isWest(direction) ? PADDING / 2 : 0);
double _y = PADDING / 2 + (isNorth(direction) ? TRIANGLE_SIZE : 0);
if (null != glyph) {
glyph.setX(_x - (width / 2));
glyph.setY(_y);
_x += width;
_y += height;
}
descText.setX(_x - (descTextBbW / 2));
descText.setY(_y + descTextBbH);
// Ensure text is on top.
descText.moveToTop();
canvasLayer.draw();
startTimers();
return this;
}
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, new BoundingBox(0, 0, 1, 1));
this.text.setWrapper(textWrapper);
this.currentTextLayout = TEXT_LAYOUT_ALIGN;
textContainer.add(text);
// Ensure path bounds are available on the selection context.
text.setFillBoundsForSelection(true);
initializeHandlers();
}
Aggregations