Package org.apache.isis.viewer.dnd.view.text

Examples of org.apache.isis.viewer.dnd.view.text.CursorPosition


    @Override
    protected void drawHighlight(final Canvas canvas, final int maxWidth) {
        final int baseline = getBaseline();
        int top = baseline - style.getAscent();

        final CursorPosition from = selection.from();
        final CursorPosition to = selection.to();

        final String[] lines = textContent.getDisplayLines();
        final int displayFromLine = textContent.getDisplayFromLine();
        final int displayToLine = displayFromLine + lines.length;
        for (int i = displayFromLine; i <= displayToLine; i++) {
            if ((i >= from.getLine()) && (i <= to.getLine())) {
                final String line = textContent.getText(i);
                int start = 0;
                int end = style.stringWidth(line);

                if (from.getLine() == i) {
                    final int at = Math.min(from.getCharacter(), line.length());
                    start = style.stringWidth(line.substring(0, at));
                }

                if (to.getLine() == i) {
                    final int at = Math.min(to.getCharacter(), line.length());
                    end = style.stringWidth(line.substring(0, at));
                }

                canvas.drawSolidRectangle(start + (ViewConstants.HPADDING), top, end - start, getText().getLineHeight(), Toolkit.getColor(ColorsAndFonts.COLOR_TEXT_HIGHLIGHT));
            }
View Full Code Here


        this.maxLength = content.getMaximumLength();
        this.useEmptyLines = useEmptyLines;

        textContent = new TextContent(this, 1, wrapStyle, this.useEmptyLines);
        cursor = new CursorPosition(textContent, 0, 0);
        selection = new TextSelection(textContent);
        final ObjectAdapter value = getValue();
        textContent.setText(value == null ? "" : titleString(value));
        cursor.home();
        isSaved = true;
View Full Code Here

        this.maxLength = content.getMaximumLength();
        this.useEmptyLines = useEmptyLines;

        textContent = new TextContent(this, 1, wrapStyle, this.useEmptyLines);
        cursor = new CursorPosition(textContent, 0, 0);
        selection = new TextSelection(textContent);
        final ObjectAdapter value = getValue();
        textContent.setText(value == null ? "" : titleString(value));
        cursor.home();
        isSaved = true;
View Full Code Here

    @Override
    protected void drawHighlight(final Canvas canvas, final int maxWidth) {
        final int baseline = getBaseline();
        int top = baseline - style.getAscent();

        final CursorPosition from = selection.from();
        final CursorPosition to = selection.to();

        final String[] lines = textContent.getDisplayLines();
        final int displayFromLine = textContent.getDisplayFromLine();
        final int displayToLine = displayFromLine + lines.length;
        for (int i = displayFromLine; i <= displayToLine; i++) {
            if ((i >= from.getLine()) && (i <= to.getLine())) {
                final String line = textContent.getText(i);
                int start = 0;
                int end = style.stringWidth(line);

                if (from.getLine() == i) {
                    final int at = Math.min(from.getCharacter(), line.length());
                    start = style.stringWidth(line.substring(0, at));
                }

                if (to.getLine() == i) {
                    final int at = Math.min(to.getCharacter(), line.length());
                    end = style.stringWidth(line.substring(0, at));
                }

                canvas.drawSolidRectangle(start + (HPADDING), top, end - start, getText().getLineHeight(), Toolkit.getColor(ColorsAndFonts.COLOR_TEXT_HIGHLIGHT));
            }
View Full Code Here

        this.maxLength = content.getMaximumLength();
        this.useEmptyLines = useEmptyLines;

        textContent = new TextContent(this, 1, wrapStyle, this.useEmptyLines);
        cursor = new CursorPosition(textContent, 0, 0);
        selection = new TextSelection(textContent);
        final ObjectAdapter value = getValue();
        textContent.setText(value == null ? "" : titleString(value));
        cursor.home();
        isSaved = true;
View Full Code Here

    @Override
    protected void drawHighlight(final Canvas canvas, final int maxWidth) {
        final int baseline = getBaseline();
        int top = baseline - style.getAscent();

        final CursorPosition from = selection.from();
        final CursorPosition to = selection.to();

        final String[] lines = textContent.getDisplayLines();
        final int displayFromLine = textContent.getDisplayFromLine();
        final int displayToLine = displayFromLine + lines.length;
        for (int i = displayFromLine; i <= displayToLine; i++) {
            if ((i >= from.getLine()) && (i <= to.getLine())) {
                final String line = textContent.getText(i);
                int start = 0;
                int end = style.stringWidth(line);

                if (from.getLine() == i) {
                    final int at = Math.min(from.getCharacter(), line.length());
                    start = style.stringWidth(line.substring(0, at));
                }

                if (to.getLine() == i) {
                    final int at = Math.min(to.getCharacter(), line.length());
                    end = style.stringWidth(line.substring(0, at));
                }

                canvas.drawSolidRectangle(start + (HPADDING), top, end - start, getText().getLineHeight(),
                    Toolkit.getColor(ColorsAndFonts.COLOR_TEXT_HIGHLIGHT));
View Full Code Here

TOP

Related Classes of org.apache.isis.viewer.dnd.view.text.CursorPosition

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.