use of org.kie.workbench.common.stunner.core.client.shape.view.HasTitle in project kie-wb-common by kiegroup.
the class CanvasInPlaceTextEditorControlImpl method setShapeEditMode.
private boolean setShapeEditMode(final boolean editMode) {
final Shape<?> shape = getShape(this.uuid);
if (null != shape) {
final HasTitle hasTitle = (HasTitle) shape.getShapeView();
final double alpha = editMode ? SHAPE_EDIT_ALPHA : 1d;
shape.getShapeView().setFillAlpha(alpha);
hasTitle.setTitleAlpha(alpha);
getCanvas().draw();
return true;
}
return false;
}
use of org.kie.workbench.common.stunner.core.client.shape.view.HasTitle in project kie-wb-common by kiegroup.
the class FontHandler method handle.
@Override
public void handle(final W element, final V view) {
if (view instanceof HasTitle) {
final HasTitle hasTitle = (HasTitle) view;
final Double alpha = alphaProvider.apply(element);
final String fontFamily = fontFamilyProvider.apply(element);
final String fontColor = fontColorProvider.apply(element);
final Double fontSize = fontSizeProvider.apply(element);
final String strokeColor = strokeColorProvider.apply(element);
final Double strokeSize = strokeSizeProvider.apply(element);
final HasTitle.Position position = positionProvider.apply(element);
final Double rotation = rotationProvider.apply(element);
if (fontFamily != null && fontFamily.trim().length() > 0) {
hasTitle.setTitleFontFamily(fontFamily);
}
if (fontColor != null && fontColor.trim().length() > 0) {
hasTitle.setTitleFontColor(fontColor);
}
if (strokeColor != null && strokeColor.trim().length() > 0) {
hasTitle.setTitleStrokeColor(strokeColor);
}
if (fontSize != null && fontSize > 0) {
hasTitle.setTitleFontSize(fontSize);
}
if (strokeSize != null && strokeSize > 0) {
hasTitle.setTitleStrokeWidth(strokeSize);
}
if (null != alpha) {
hasTitle.setTitleAlpha(alpha);
}
if (null != position) {
hasTitle.setTitlePosition(position);
}
if (null != rotation) {
hasTitle.setTitleRotation(rotation);
}
}
}
use of org.kie.workbench.common.stunner.core.client.shape.view.HasTitle in project kie-wb-common by kiegroup.
the class LienzoShapeGlyphRenderer method render.
@Override
@SuppressWarnings("unchecked")
public Group render(final ShapeGlyph glyph, final double width, final double height) {
final String definitionId = glyph.getDefinitionId();
final Supplier<ShapeFactory> factorySupplier = glyph.getFactorySupplier();
final Shape shape = factorySupplier.get().newShape(factoryManager.newDefinition(definitionId));
final ShapeView<?> view = shape.getShapeView();
final BoundingBox bb = boundingBoxProvider.apply(view);
Group group = groupProvider.apply(view);
if (null == group) {
throw new RuntimeException("Shape view [" + view.toString() + "] not supported for " + "this shape glyph builder [" + this.getClass().getName());
}
if (view instanceof HasTitle) {
final HasTitle hasTitle = (HasTitle) view;
hasTitle.setTitle(null);
}
// Create a copy of this view.
group = group.copy();
// Scale, if necessary, to the given glyph size.
final double[] scale = LienzoUtils.getScaleFactor(bb.getWidth(), bb.getHeight(), width, height);
group.setScale(scale[0], scale[1]);
return group;
}
Aggregations