use of org.whole.lang.ui.layout.StackLayout in project whole by wholeplatform.
the class RootFragmentPart method createFigure.
protected IFigure createFigure() {
// Figure f = new FreeformLayer() {
IEntityFigure f = new EntityFigure() {
{
setOpaque(false);
}
@Override
public void paint(Graphics graphics) {
graphics.setAdvanced(true);
graphics.setAntialias(SWT.ON);
super.paint(graphics);
}
protected void paintFigure(Graphics graphics) {
super.paintFigure(graphics);
Rectangle r2 = ((IFigure) getChildren().get(0)).getBounds();
translateToParent(r2 = r2.getCopy());
Rectangle clipArea = graphics.getClip(new Rectangle()).expand(1, 1);
graphics.fillRectangle(clipArea);
graphics.setBackgroundColor(FigureConstants.hostLanguageColor);
graphics.fillRectangle(clipArea.intersect(r2));
graphics.setLineWidth(1);
graphics.setLineStyle(Graphics.LINE_SOLID);
graphics.setXORMode(false);
IEntity rootEntity = ((RootFragment) getModelEntity()).getRootEntity().wGetAdaptee(false);
if (rootEntity.wGetParent() instanceof RootFragment) {
clipArea = graphics.getClip(new Rectangle()).expand(1, 1);
int oldAlpha = graphics.getAlpha();
graphics.setAlpha(60);
graphics.setForegroundColor(ColorConstants.darkGray);
graphics.setLineWidth(1);
graphics.drawRectangle(r2.getTranslated(-1, -1).resize(1, 1));
graphics.setForegroundColor(ColorConstants.lightGray);
graphics.setLineWidth(5);
graphics.drawRoundRectangle(r2.getTranslated(-4, -4).resize(7, 7), 10, 10);
graphics.setAlpha(oldAlpha);
} else {
graphics.setForegroundColor(ColorConstants.lightGray);
graphics.drawRectangle(r2.x - 1, r2.y - 1, r2.width + 1, r2.height + 1);
}
}
public void validate() {
super.validate();
repaint();
}
};
f.setLayoutManager(new StackLayout().withMargin(5).withMinorAlignment(Alignment.CENTER));
f.setBackgroundColor(FigureUtilities.lighter(ColorConstants.gray));
f.setOpaque(false);
f.addLayoutListener(LayoutAnimator.getDefault());
return f;
}
use of org.whole.lang.ui.layout.StackLayout in project whole by wholeplatform.
the class ContentPaneFigure method addWithPlaceHolder.
public <F extends IEntityFigure> F addWithPlaceHolder(F child) {
IEntityFigure stackedFigure = new EntityFigure(new StackLayout());
stackedFigure.add(LabelFactory.createEmptyLabel());
stackedFigure.add(child);
add(stackedFigure);
return child;
}
Aggregations