use of org.whole.lang.ui.layout.TableLayout in project whole by wholeplatform.
the class EntityOutlineRightFigure method paintConnections.
@SuppressWarnings("unchecked")
protected void paintConnections(Graphics graphics) {
graphics.setForegroundColor(FigureConstants.contentLighterColor);
Point rootPoint = getFoldingToggle(0).getBounds().getBottom();
Object childrenFigure = getContentPane(1).getChildren().get(0);
Point[] childrenPoints = null;
if (childrenFigure instanceof TableFigure) {
TableFigure tableFigure = (TableFigure) childrenFigure;
TableLayout layoutManager = tableFigure.getLayoutManager();
int childrenSize = layoutManager.rows();
childrenPoints = new Point[childrenSize];
if (childrenSize == 0)
return;
for (int i = 0; i < childrenSize; i++) {
IFigure row = layoutManager.getRow(i);
List<IFigure> rowChildren = row.getChildren();
if (row instanceof TableRowFigure && !rowChildren.isEmpty()) {
childrenPoints[i] = row.getBounds().getLeft().translate(-8, 0);
childrenPoints[i].y = ((TableRowLayout) row.getLayoutManager()).getBaseline(0);
} else if (row instanceof IEntityFigure) {
childrenPoints[i] = row.getBounds().getTopLeft().translate(-4, ((IEntityFigure) row).getAscent());
} else
childrenPoints[i] = row.getBounds().getLeft().translate(-4, 0);
}
} else {
IFigure childFigure = (IFigure) childrenFigure;
List<IFigure> children = childFigure.getChildren();
int childrenSize = children.size();
if (childrenSize == 0 || childFigure instanceof ITextFigure) {
childrenPoints = new Point[1];
if (childFigure instanceof IEntityFigure)
childrenPoints[0] = childFigure.getBounds().getTopLeft().translate(-4, ((IEntityFigure) childFigure).getAscent());
else
childrenPoints[0] = childFigure.getBounds().getLeft().translate(-4, 0);
} else {
childrenPoints = new Point[childrenSize];
for (int i = 0; i < childrenSize; i++) {
childFigure = children.get(i);
if (childFigure instanceof IEntityFigure)
childrenPoints[i] = childFigure.getBounds().getTopLeft().translate(-6, ((IEntityFigure) childFigure).getAscent());
else
childrenPoints[i] = childFigure.getBounds().getLeft().translate(-6, 0);
}
}
}
graphics.setForegroundColor(ColorConstants.lightGray);
graphics.setLineStyle(SWT.LINE_CUSTOM);
graphics.setLineDash(new int[] { 1, 1 });
DrawUtils.drawOutline(graphics, rootPoint, childrenPoints);
graphics.setLineStyle(SWT.LINE_SOLID);
graphics.setLineDash((int[]) null);
}
use of org.whole.lang.ui.layout.TableLayout in project whole by wholeplatform.
the class SimpleEntityOutlineFigure method createTableFigure.
protected TableFigure createTableFigure(int columns) {
return new TableFigure(new TableLayout(columns).withColumnSpacing(10).withRowSpacing(2).withMargin(0, 24, 0, 0)) {
protected void paintFigure(Graphics g) {
super.paintFigure(g);
TableLayout l = getLayoutManager();
if (l.rows() == 0)
return;
g.setBackgroundColor(ColorConstants.lightGray);
drawAlternateColumnsBackground(g, 0);
g.setForegroundColor(ColorConstants.lightGray);
drawColumnSeparators(g);
}
};
}
use of org.whole.lang.ui.layout.TableLayout in project whole by wholeplatform.
the class AndChooseTableFigure method paintFigure.
protected void paintFigure(Graphics g) {
super.paintFigure(g);
TableLayout l = getLayoutManager();
if (l.rows() == 0)
return;
g.setForegroundColor(ColorConstants.lightGray);
drawRowSeparators(g, LMARGIN, 0);
}
use of org.whole.lang.ui.layout.TableLayout in project whole by wholeplatform.
the class BindingsTableFigure method paintFigure.
protected void paintFigure(Graphics g) {
super.paintFigure(g);
TableLayout l = getLayoutManager();
if (l.rows() == 0)
return;
g.setBackgroundColor(ColorConstants.lightGray);
drawAlternateColumnsBackground(g, 0);
g.setForegroundColor(ColorConstants.lightGray);
drawColumnSeparators(g);
}
use of org.whole.lang.ui.layout.TableLayout in project whole by wholeplatform.
the class TupleTableFigure method paintFigure.
protected void paintFigure(Graphics g) {
super.paintFigure(g);
TableLayout l = getLayoutManager();
if (l.rows() == 0)
return;
String separator = ",";
g.setForegroundColor(ColorConstants.gray);
int spacing = getLayoutManager().getSpacing();
int fontAscent = FigureUtilities.getFontMetrics(getFont()).getHeight() / 2;
int xOffset = FigureUtilities.getTextWidth(separator, getFont()) / 2;
int yOffset = spacing / 2 + fontAscent + 1;
int x = getClientArea().getCenter().x - xOffset;
int firstRow = l.hasHeaderRow() ? 2 : 1;
for (int i = firstRow; i < l.rows(); i++) {
Rectangle r = l.getRowBounds(i);
g.drawString(separator, x, r.y - yOffset);
}
}
Aggregations