Package org.apache.isis.viewer.dnd.drawing

Examples of org.apache.isis.viewer.dnd.drawing.Size


        final int maxBaseline = maxBaseline(cells);

        for (int i = 0; i < cells.length; i++) {
            totalWidth += axis.getColumnWidth(i);

            final Size s = cells[i].getRequiredSize(Size.createMax());// TODO
                                                                      // Need to
                                                                      // pass in
                                                                      // a max
                                                                      // size
                                                                      // (is 0
                                                                      // at the
                                                                      // moment)
            final int b = cells[i].getBaseline();
            final int baselineOffset = Math.max(0, maxBaseline - b);
            maxHeight = Math.max(maxHeight, s.getHeight() + baselineOffset);
        }

        return new Size(totalWidth, maxHeight);
    }
View Full Code Here


        final int maxBaseline = maxBaseline(cells);

        int x = 0;
        for (int i = 0; i < cells.length; i++) {
            final View cell = cells[i];
            final Size s = cell.getRequiredSize(Size.createMax()); // TODO Need
                                                                   // to pass in
                                                                   // a max size
                                                                   // (is 0 at
                                                                   // the
                                                                   // moment)
            s.setWidth(axis.getColumnWidth(i));
            cell.setSize(s);

            final int b = cell.getBaseline();
            final int baselineOffset = Math.max(0, maxBaseline - b);
            cell.setLocation(new Location(x, baselineOffset));

            x += s.getWidth();
        }
    }
View Full Code Here

        this.field = field;
    }

    @Override
    public Size getRequiredSize(final Size availableSpace) {
        return new Size(COLUMNS * COLUMN_WIDTH, ROWS * ROW_HEIGHT);
    }
View Full Code Here

            color = Toolkit.getColor(ColorsAndFonts.COLOR_IDENTIFIED);
        } else if (state.isObjectIdentified()) {
            color = Toolkit.getColor(ColorsAndFonts.COLOR_SECONDARY2);
        }

        final Size s = getSize();
        if (color != null) {
            if (hasFocus) {
                final int xExtent = s.getWidth() - left;
                for (int i = 0; i < left; i++) {
                    canvas.drawRectangle(i, i, xExtent - 2 * i, s.getHeight() - 2 * i, color);
                }
            } else {
                final int xExtent = s.getWidth();
                for (int i = 0; i < left; i++) {
                    canvas.drawRectangle(i, i, xExtent - 2 * i, s.getHeight() - 2 * i, color);
                }
                canvas.drawLine(xExtent - BORDER, left, xExtent - BORDER, left + s.getHeight(), color);
                canvas.drawSolidRectangle(xExtent - BORDER + 1, left, BORDER - 2, s.getHeight() - 2 * left, Toolkit.getColor(ColorsAndFonts.COLOR_SECONDARY3));
            }
        }
    }
View Full Code Here

        return ViewConstants.VPADDING + Toolkit.getText(ColorsAndFonts.TEXT_NORMAL).getAscent();
    }

    @Override
    public Size getRequiredSize(final Size availableSpace) {
        return new Size(ViewConstants.HPADDING + size + ViewConstants.HPADDING, ViewConstants.VPADDING + size + ViewConstants.VPADDING);
    }
View Full Code Here

    @Override
    public void doLayout(final Size maximumSize) {
        LOG.debug("doLayout() " + maximumSize + "  " + getSize());
        final View toolbar = getSubviews()[0];
        maximumSize.contract(getPadding());
        final Size toolbarSize = toolbar.getRequiredSize(maximumSize);
        LOG.debug("   toolbar " + toolbarSize);
        Bounds bounds = new Bounds(toolbarSize);
        toolbar.setBounds(bounds);

        final View grid = getSubviews()[1];
        final Size gridSize = getRequiredSize(Size.createMax());
        gridSize.contract(getPadding());
        gridSize.contractHeight(toolbarSize.getHeight());
        bounds = new Bounds(new Location(0, toolbarSize.getHeight()), gridSize);
        grid.setBounds(bounds);
        LOG.debug("   grid " + toolbarSize);

    }
View Full Code Here

    @Override
    public void draw(final Canvas canvas) {
        super.draw(canvas);

        final Size size = getSize();
        final int width = size.getWidth() - 1;
        final int height = size.getHeight() - 1;
        canvas.drawSolidRectangle(0, 0, width, height, Toolkit.getColor(ColorsAndFonts.COLOR_SECONDARY3));
        canvas.drawSolidRectangle(0, 0, 10, height, Toolkit.getColor(ColorsAndFonts.COLOR_SECONDARY2));
        canvas.drawLine(10, 0, 10, height - 2, Toolkit.getColor(ColorsAndFonts.COLOR_BLACK));
        canvas.drawRectangle(0, 0, width, height, Toolkit.getColor(ColorsAndFonts.COLOR_BLACK));
        canvas.drawText(getContent().title(), 14, getBaseline(), Toolkit.getColor(ColorsAndFonts.COLOR_BLACK), Toolkit.getText(ColorsAndFonts.TEXT_NORMAL));
View Full Code Here

        return 14;
    }

    @Override
    public Size getRequiredSize(final Size availableSpace) {
        return new Size(150, 20);
    }
View Full Code Here

    }

    public Size getSize() {
        final int height = style.getTextHeight();
        final int width = style.stringWidth(getTitle());
        return new Size(width, height);
    }
View Full Code Here

        }

        wrappedView.draw(canvas.createSubcanvas());

        if (color != null) {
            final Size s = getSize();
            canvas.drawRectangle(0, 0, s.getWidth() - 1, s.getHeight() - 1, color);
            canvas.drawRectangle(1, 1, s.getWidth() - 3, s.getHeight() - 3, color);
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.isis.viewer.dnd.drawing.Size

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.