Package org.apache.harmony.awt.gl

Examples of org.apache.harmony.awt.gl.MultiRectArea


        public boolean contains(final int index) {
            return contains(index, 0);
        }

        public void insertIndices(final int index, final int length, final boolean multiSelectionAllowed) {
            MultiRectArea modified = new MultiRectArea();
            Rectangle[] rects = getRectangles();
            for (int i = 0; i < rects.length; i++) {
                Rectangle rect = (Rectangle)rects[i].clone();
                if (index < rect.x) {
                    rect.x += length;
                } else if (rect.x <= index && index < rect.x + rect.width) {
                    if (multiSelectionAllowed) {
                        rect.width += length;
                    } else {
                        rect.x += length;
                    }
                }
                modified.add(rect);
            }
            clear();
            add(modified);
        }
View Full Code Here


            clear();
            add(modified);
        }

        public void removeIndices(final int index, final int length) {
            MultiRectArea modified = new MultiRectArea();
            Rectangle[] rects = getRectangles();
            for (int i = 0; i < rects.length; i++) {
                Rectangle rect = rects[i];
                int rectEnd = rect.x + rect.width - length - 1;
                if (index <= rect.x) {
                    if (rectEnd >= index) {
                        int rectBegin = rect.x - length < index ? index : rect.x - length;
                        modified.add(new Segment(rectBegin, rectEnd));
                    }
                } else if (rect.x < index && index < rect.x + rect.width) {
                    if (rectEnd < index - 1) {
                        rectEnd = index - 1;
                    }
                    modified.add(new Segment(rect.x, rectEnd));
                } else {
                    modified.add((Rectangle)rect.clone());
                }
            }
            clear();
            add(modified);
        }
View Full Code Here

            clear();
            add(modified);
        }

        public Segment getDifferenceBounds(final Selection anotherSelection) {
            MultiRectArea thisFromAnother = MultiRectArea.subtract(this, anotherSelection);
            MultiRectArea anotherFromThis = MultiRectArea.subtract(anotherSelection, this);
            MultiRectArea diff = MultiRectArea.union(thisFromAnother, anotherFromThis);
            if (diff.isEmpty()) {
                return null;
            }
            Rectangle diffBounds = diff.getBounds();
            return new Segment(diffBounds.x, diffBounds.x + diffBounds.width - 1);
        }
View Full Code Here

                                                    stringWidth + TEXT_SPACING,
                                                    stringHeight + 2*TEXT_SPACING);

                if (titleRect.intersects(g.getClipBounds())) {
                    Rectangle[] difference = SwingUtilities.computeDifference(g.getClipBounds(), titleRect);
                    MultiRectArea clipArea = new MultiRectArea(difference);
                    g.setClip(clipArea);
                }
            }
        }

View Full Code Here

            return;
        }
        if (selectedItemIndex >= 0 && getItem(selectedItemIndex) instanceof Menu) {
            ((Menu) getItem(selectedItemIndex)).hide();
        }
        MultiRectArea clip = getUpdateClip(index, selectedItemIndex);
        selectedItemIndex = index;
        Graphics gr = getGraphics(clip);
        if (gr != null) {
            paint(gr);
        }
View Full Code Here

     * @param index1 - old selected intem
     * @param index2 - new selected item
     * @return - the region to repaint
     */
    final MultiRectArea getUpdateClip(int index1, int index2) {
        MultiRectArea clip = new MultiRectArea();
        if (index1 >= 0) {
            clip.add(getItemRect(index1));
        }
        if (index2 >= 0) {
            clip.add(getItemRect(index2));
        }
        return clip;
    }
View Full Code Here

        }
        Point menuPos = menuBar.getLocation();
        Rectangle bounds = new Rectangle(menuPos.x, menuPos.y,
                                         menuBar.getWidth(),
                                         menuBar.getHeight());
        MultiRectArea menuClip = new MultiRectArea(clipArea);
        if (menuClip.getRectCount() > 0) {
            clipArea.substract(bounds);
            menuClip.translate(-menuPos.x, -menuPos.y);
            Graphics g = menuBar.getGraphics(menuClip);
            if (g != null) {
                menuBar.paint(g);
            }
        }
View Full Code Here

            if (behaviour instanceof LWBehavior) {
                if (parent == null || !parent.visible || !parent.behaviour.isDisplayable()) {
                    return;
                }
                if (repaintRegion == null) {
                    repaintRegion = new MultiRectArea(new Rectangle(x, y, width, height));
                }
                repaintRegion.intersect(new Rectangle(0, 0, this.w, this.h));
                repaintRegion.translate(this.x, this.y);
                parent.repaintRegion = repaintRegion;
                repaintRegion = null;
View Full Code Here

        }
        if (r.isEmpty()) {
            return null;
        }
        r.translate(x, y);
        MultiRectArea ret = parent.getObscuredRegion(r);
        if (ret != null) {
            ret.translate(-x, -y);
        }
        return ret;
    }
View Full Code Here

        if (ancestingWindow == null || !ComponentInternals.getComponentInternals().wasPainted(ancestingWindow)) {
            return;
        }

        Rectangle dirtyRect = new Rectangle(x, y, w, h);
        MultiRectArea previousValue = (MultiRectArea)dirtyRegions.get(c);
        if (previousValue != null) {
            previousValue.add(dirtyRect);
        } else {
            dirtyRegions.put(c, new MultiRectArea(dirtyRect));
        }

        scheduleProcessingEvent();
    }
View Full Code Here

TOP

Related Classes of org.apache.harmony.awt.gl.MultiRectArea

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.