Logo Search packages:      
Sourcecode: jeuclid version File versions

void net::sourceforge::jeuclid::elements::presentation::table::Mtable::layoutStageInvariant ( final LayoutView  view,
final LayoutInfo  info,
final LayoutStage  stage,
final LayoutContext  context 
) [inline]

Layout for elements which are stage independent.

This function will layout an element which is layed out the same no matter what stage it is in. This is the case for most elements.

Notable exceptions are mo and tables.

Parameters:
view View Object for this layout.
info An info object which will be filled during layout.
stage current layout stage.
context current LayoutContext.

Reimplemented from net::sourceforge::jeuclid::elements::AbstractJEuclidElement.

Definition at line 658 of file Mtable.java.

References net::sourceforge::jeuclid::elements::AbstractJEuclidElement::applyLocalAttributesToContext(), net::sourceforge::jeuclid::layout::LayoutInfo::getAscentHeight(), net::sourceforge::jeuclid::elements::AbstractJEuclidElement::getChildrenToLayout(), net::sourceforge::jeuclid::layout::LayoutInfo::getDescentHeight(), net::sourceforge::jeuclid::layout::LayoutView::getGraphics(), net::sourceforge::jeuclid::layout::LayoutView::getInfo(), getRowspacing(), getSpaceArrayEntry(), and net::sourceforge::jeuclid::layout::LayoutInfo::moveTo().

                                         {
        // CHECKSTYLE:ON
        final Graphics2D g = view.getGraphics();
        final LayoutContext now = this.applyLocalAttributesToContext(context);
        final List<LayoutableNode> children = this.getChildrenToLayout();
        final LayoutInfo[] rowInfos = new LayoutInfo[children.size()];
        final LayoutableNode[] rowChild = new LayoutableNode[children.size()];
        float y = 0;
        int rows = 0;

        // Layout Rows vertically, calculate height of the table.
        final float vFrameSpacing = this.getFramespacingv(now);
        float height = vFrameSpacing;
        for (final LayoutableNode child : children) {
            rowChild[rows] = child;
            final LayoutInfo mtrInfo = view.getInfo(child);
            y += mtrInfo.getAscentHeight(stage);
            rowInfos[rows] = mtrInfo;
            rows++;
            mtrInfo.moveTo(0, y, stage);
            y += mtrInfo.getDescentHeight(stage);
            height = y;
            y += AttributesHelper.convertSizeToPt(this.getSpaceArrayEntry(this
                    .getRowspacing(), rows), now, AttributesHelper.PT);
        }
        height += vFrameSpacing;

        final float verticalShift = this.shiftTableVertically(stage, context,
                g, rowInfos, rows, height);

        final List<LayoutableNode>[] mtdChildren = this
                .createListOfMtdChildren(rowChild, rows);
        this.stretchAndAlignMtds(view, mtdChildren, rowInfos, rows, stage);

        final List<Float> columnwidth = this.calculateBasicColumnWidth(view,
                stage, rows, mtdChildren);

        // TODO This is where Alignment-Groups should be calculated

        final float totalWidth = this.layoutColumnsHorizontally(view, stage,
                now, rows, mtdChildren, columnwidth);

        this.setRowWidth(stage, rowInfos, rows, totalWidth);

        this.addRowLines(info, rowInfos, rows, totalWidth, stage, now);
        this.addColumnLines(info, columnwidth, verticalShift, height, now);
        this.addFrame(info, totalWidth, verticalShift, height, now);

        final float hFrameSpacing = this.getFramespacingh(now);
        final Dimension2D borderLeftTop = new Dimension2DImpl(hFrameSpacing,
                vFrameSpacing);
        final Dimension2D borderRightBottom = new Dimension2DImpl(
                hFrameSpacing, vFrameSpacing);
        ElementListSupport.fillInfoFromChildren(view, info, this, stage,
                borderLeftTop, borderRightBottom);
    }


Generated by  Doxygen 1.6.0   Back to index