use of org.whole.lang.ui.figures.EntityFigure in project whole by wholeplatform.
the class CompositeEntityReferenceTextFigure method setAdjacentSize.
public void setAdjacentSize(int size) {
for (int i = compositeFigure.getChildren().size(); i < size; i++) {
EntityFigure featureRow = new EntityFigure(new TableRowLayout().withMinorAlignment(Alignment.LEADING));
featureRow.add(new EntityButton(linkListener, i));
compositeFigure.add(featureRow);
}
while (compositeFigure.getChildren().size() > size) compositeFigure.remove((IFigure) compositeFigure.getChildren().get(size));
revalidate();
repaint();
}
use of org.whole.lang.ui.figures.EntityFigure in project whole by wholeplatform.
the class AbstractConnectedFreeformRootPart method createFigure.
protected IFigure createFigure() {
// Figure figure = new FreeformLayer();
IEntityFigure figure = new EntityFigure() {
{
setLayoutManager(new EntityXYLayout());
setOpaque(false);
}
// FIXME workaround
public int getIndent() {
return getInsets().left;
}
public int getAscent() {
return getPreferredSize().height / 2;
}
public static final int MINIMUM_SIZE = 50;
public Dimension getPreferredSize(int wHint, int hHint) {
Dimension size = super.getPreferredSize(wHint, hHint);
size.width = Math.max(size.width, MINIMUM_SIZE);
size.height = Math.max(size.height, MINIMUM_SIZE);
return size;
}
};
// figure.setLayoutManager(new EntityXYLayout());
// figure.setOpaque(false);
setConnectionRouter(createConnectionRouter(figure));
return figure;
}
use of org.whole.lang.ui.figures.EntityFigure in project whole by wholeplatform.
the class SimpleEntityTreeFigure method createFeaturesOutline.
protected IFigure createFeaturesOutline(EntityDescriptor<?> ed, ActionListener linkListener) {
int featureNum = ed.childFeatureSize();
IFigure featuresOutline = new EntityFigure(new ColumnLayout().withAutoresizeWeight(1.0f).withMarginBottom(2).withMinorAlignment(isRightToLeft() ? Alignment.LEADING : Alignment.TRAILING));
featureToggles = new Toggle[featureNum];
for (int i = 0; i < featureNum; i++) {
FeatureDescriptor fd = ed.getEntityFeatureDescriptor(i);
EntityFigure feature = new EntityFigure(new RowLayout().withSpacing(3).withMajorAlignment(isRightToLeft() ? Alignment.LEADING : Alignment.TRAILING).withReversedChildren(isRightToLeft()));
feature.addLabel(fd.getName());
featureToggles[i] = createFoldingToggle(new EntityToggle(WholeImages.ROUND_EXPAND, WholeImages.ROUND_COLLAPSE), i);
feature.add(featureToggles[i]);
featuresOutline.add(feature);
}
for (int i = featureNum, size = ed.featureSize(); i < size; i++) {
FeatureDescriptor fd = ed.getEntityFeatureDescriptor(i);
EntityFigure feature = new EntityFigure(new RowLayout().withMarginLeft(3).withMarginRight(3).withMajorAlignment(isRightToLeft() ? Alignment.LEADING : Alignment.TRAILING).withReversedChildren(isRightToLeft()));
EntityLabel createLabel = feature.addLabel(fd.getName(), WholeImages.LINK);
createLabel.setTextPlacement(isRightToLeft() ? PositionConstants.EAST : PositionConstants.WEST);
createLabel.setBorder(new MarginBorder(3));
feature.add(new EntityButton(createLabel, linkListener, i));
featuresOutline.add(feature);
}
return featuresOutline;
}
use of org.whole.lang.ui.figures.EntityFigure 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.figures.EntityFigure in project whole by wholeplatform.
the class SplitPart method createFigure.
protected IFigure createFigure() {
IFigure f = new EntityFigure(new OverColumnLayout().withSpacing(4).withMinorAlignment(// CENTER).withAutoresizeWeight(1f));
Alignment.FILL));
f.setBorder(new PipeBracketsBorder(0, 1, 0, 1));
return f;
}
Aggregations