use of com.ait.lienzo.client.core.types.TextMetrics in project drools-wb by kiegroup.
the class NodeLabel method setLabel.
public void setLabel(final String label) {
final Layer scratchLayer = new Layer();
final LienzoPanel scratchPanel = new LienzoPanel(100, 100);
scratchPanel.add(scratchLayer);
text.setText(label);
final TextMetrics tm = text.measure(scratchLayer.getContext());
final double cw = tm.getWidth() + 10;
final double ch = tm.getHeight() + 10;
container.setWidth(cw);
container.setHeight(ch);
container.setLocation(new Point2D(-cw / 2, -ch / 2));
}
use of com.ait.lienzo.client.core.types.TextMetrics in project drools-wb by kiegroup.
the class BaseGuidedDecisionTreeNodeFactory method getDragProxyWidth.
private double getDragProxyWidth(final Text nodeLabel) {
final LienzoPanel panel = new LienzoPanel(100, 100);
final Layer layer = new Layer();
panel.add(layer);
final TextMetrics tm = nodeLabel.measure(layer.getContext());
return Math.max(getWidth(), tm.getWidth());
}
Aggregations