Search in sources :

Example 6 with TableLayout

use of org.whole.lang.ui.layout.TableLayout in project whole by wholeplatform.

the class TypeRulesTableFigure method paintFigure.

protected void paintFigure(Graphics g) {
    super.paintFigure(g);
    TableLayout l = getLayoutManager();
    if (l.rows() == 0)
        return;
    g.setBackgroundColor(FigureConstants.templateLanguageColor);
    int oldAlpha = g.getAlpha();
    g.setAlpha(getBackgroundAlpha());
    Rectangle tb = getTableBounds();
    Rectangle cb1 = l.getColumnBounds(2);
    g.fillRectangle(cb1.x, tb.y, cb1.width, tb.height);
    g.setAlpha(oldAlpha);
    g.setForegroundColor(ColorConstants.lightGray);
    drawRowSeparators(g);
    drawTableRowsBorder(g);
}
Also used : Rectangle(org.eclipse.draw2d.geometry.Rectangle) TableLayout(org.whole.lang.ui.layout.TableLayout)

Example 7 with TableLayout

use of org.whole.lang.ui.layout.TableLayout in project whole by wholeplatform.

the class TableFigure method drawAlternateRowsBackground.

protected void drawAlternateRowsBackground(Graphics g, int startIndex, int alpha) {
    TableLayout l = getLayoutManager();
    int rows = startIndex == -1 ? 1 : l.rows();
    int oldAlpha = g.getAlpha();
    g.setAlpha(alpha);
    if (l.hasHeaderRow())
        startIndex++;
    Rectangle tb = getTableBounds();
    for (int r = startIndex; r < rows; r += 2) if (l.isRowVisible(r)) {
        Rectangle rb = l.getRowBounds(r);
        int fh = rb.height + 1;
        int fy;
        if (r == 0) {
            fh += rb.y - tb.y;
            fy = tb.y;
        } else if (r == rows - 1) {
            fy = rb.y;
            fh = tb.bottom() - fy;
        } else
            fy = rb.y;
        g.fillRectangle(tb.x, fy, tb.width, fh);
    } else
        r -= 1;
    g.setAlpha(oldAlpha);
}
Also used : Rectangle(org.eclipse.draw2d.geometry.Rectangle) TableLayout(org.whole.lang.ui.layout.TableLayout)

Example 8 with TableLayout

use of org.whole.lang.ui.layout.TableLayout in project whole by wholeplatform.

the class TableFigure method drawRowSeparators.

protected void drawRowSeparators(Graphics g, int leftMargin, int rightMargin) {
    TableLayout l = getLayoutManager();
    int columns = l.columns();
    if (columns > 0) {
        Rectangle ca = getTableBounds();
        int firstRow = l.hasHeaderRow() ? 2 : 1;
        for (int i = firstRow; i < l.rows(); i++) {
            Rectangle r = l.getRowBounds(i);
            g.drawLine(ca.x - leftMargin, r.y, ca.right() - 1 + rightMargin, r.y);
        }
    }
}
Also used : Rectangle(org.eclipse.draw2d.geometry.Rectangle) TableLayout(org.whole.lang.ui.layout.TableLayout)

Example 9 with TableLayout

use of org.whole.lang.ui.layout.TableLayout in project whole by wholeplatform.

the class TableFigure method drawAlternateColumnsBackground.

protected void drawAlternateColumnsBackground(Graphics g, int startIndex, int alpha) {
    TableLayout l = getLayoutManager();
    if (l.rows() > 0) {
        int oldAlpha = g.getAlpha();
        g.setAlpha(alpha);
        Rectangle tb = getTableBounds();
        for (int r = startIndex; r < l.columns(); r += 2) {
            Rectangle cb = l.getColumnBounds(r);
            g.fillRectangle(cb.x, tb.y, cb.width, tb.height);
        }
        g.setAlpha(oldAlpha);
    }
}
Also used : Rectangle(org.eclipse.draw2d.geometry.Rectangle) TableLayout(org.whole.lang.ui.layout.TableLayout)

Example 10 with TableLayout

use of org.whole.lang.ui.layout.TableLayout in project whole by wholeplatform.

the class TableFigure method drawColumnSeparators.

protected void drawColumnSeparators(Graphics g, int topMargin, int bottomMargin) {
    TableLayout l = getLayoutManager();
    if (l.rows() > 0) {
        Rectangle ca = getTableBounds();
        for (int c = 1; c < l.columns(); c++) {
            Rectangle r = l.getColumnBounds(c);
            g.drawLine(r.x, ca.y - topMargin, r.x, ca.bottom() - 1 + bottomMargin);
        }
    }
}
Also used : Rectangle(org.eclipse.draw2d.geometry.Rectangle) TableLayout(org.whole.lang.ui.layout.TableLayout)

Aggregations

TableLayout (org.whole.lang.ui.layout.TableLayout)37 Rectangle (org.eclipse.draw2d.geometry.Rectangle)25 TableFigure (org.whole.lang.ui.figures.TableFigure)6 Graphics (org.eclipse.draw2d.Graphics)4 Point (org.eclipse.draw2d.geometry.Point)3 IEntityFigure (org.whole.lang.ui.figures.IEntityFigure)3 TableRowFigure (org.whole.lang.ui.figures.TableRowFigure)3 IFigure (org.eclipse.draw2d.IFigure)2 CompositeFigure (org.whole.lang.ui.figures.CompositeFigure)1 EntityFigure (org.whole.lang.ui.figures.EntityFigure)1 ITextFigure (org.whole.lang.ui.figures.ITextFigure)1 MonoLayout (org.whole.lang.ui.layout.MonoLayout)1 TableRowLayout (org.whole.lang.ui.layout.TableRowLayout)1 CompositeTableFigure (org.whole.lang.ui.notations.styledtree.figures.CompositeTableFigure)1 NodeWithCompositeBranchFigure (org.whole.lang.ui.notations.styledtree.figures.NodeWithCompositeBranchFigure)1 IFeatureStyling (org.whole.lang.ui.notations.styledtree.styling.IFeatureStyling)1