Examples of ElementChange


Examples of javax.swing.event.DocumentEvent.ElementChange

            updateMetrics();
            preferenceChanged(null, true, true);
            return;
        }

        final ElementChange change = event.getChange(getElement());

        if (event.getType() == EventType.INSERT) {
            updateDamageOnInsert(event, change, shape);
        } else {
            updateDamageOnRemove(event, change, shape);
View Full Code Here

Examples of javax.swing.event.DocumentEvent.ElementChange

                if (changes == null) {
                    changes = new HashMap<Element, ElementChange>();

                    for (UndoableEdit edit : edits) {
                        if (edit instanceof ElementChange) {
                            ElementChange change = (ElementChange)edit;
                            changes.put(change.getElement(), change);
                        }
                    }
                } else {
                    if (anEdit instanceof ElementChange) {
                        ElementChange change = (ElementChange)anEdit;
                        changes.put(change.getElement(), change);
                    }
                }
            }

            return result;
View Full Code Here

Examples of javax.swing.event.DocumentEvent.ElementChange

                return changes.get(element);
            }

            for (UndoableEdit edit : edits) {
                if (edit instanceof ElementChange) {
                    ElementChange change = (ElementChange)edit;
                    if (change.getElement() == element) {
                        return change;
                    }
                }
            }
            return null;
View Full Code Here

Examples of javax.swing.event.DocumentEvent.ElementChange

                            final ViewFactory factory) {
        if (getViewCount() == 0) {
            return;
        }

        ElementChange change = event.getChange(getElement());
        if (change != null && !updateChildren(change, event, factory)) {
            // updateChildren returned false, then forwardUpdate and
            // updateLayout must be passed null as change despite
            // change is not null
            change = null;
View Full Code Here

Examples of javax.swing.event.DocumentEvent.ElementChange

        assertEquals(1, edits.size());
        assertChange(edits.get(0), paragraph, 0, new int[] { 0, 5, 5, 9, 9, 15 }, new int[] {
                0, 2, 2, 5, 5, 9, 9, 12, 12, 15 });
        // Merge of two changes is performed by copying elements which
        // lie between split ones
        ElementChange change = (ElementChange) edits.get(0);
        assertSame(change.getChildrenRemoved()[1], // bold [5, 9]
                change.getChildrenAdded()[2]);
        assertChildren(paragraph, new int[] { 0, 2, 2, 5, 5, 9, 9, 12, 12, 15, 15, 16 },
                new AttributeSet[] { null, null, bold, italic, italic, null });
    }
View Full Code Here

Examples of javax.swing.event.DocumentEvent.ElementChange

        assertFalse(edit.addEdit((UndoableEdit) getEdits(edit).get(1)));
        edit.undo();
        edit.redo();
        // Do the check
        for (int i = 0; i < parent.length; i++) {
            ElementChange change = edit.getChange(parent[i]);
            assertSame("Objects are not same at " + i, child[i], change);
            assertTrue("Undo didn't get called at " + i, child[i].undone);
            assertTrue("Redo didn't get called at " + i, child[i].redone);
        }
        assertEquals(16, getEdits(edit).size());
View Full Code Here

Examples of javax.swing.event.DocumentEvent.ElementChange

            }
        }
        ;
        doc = new UndoPlainDocument();
        doc.insertString(0, "test", null);
        ElementChange change = insert.getChange(((UndoPlainDocument) doc).altRoot);
        assertNotNull(change);
        assertEquals(0, change.getChildrenAdded().length);
        assertEquals(0, change.getChildrenRemoved().length);
        // Additional assertions are in one of undo methods()
        insert.undo();
        assertTrue(((UndoPlainDocument) doc).undone);
        assertFalse(((UndoPlainDocument) doc).redone);
        // Additional assertions are in one of redo methods()
View Full Code Here

Examples of javax.swing.event.DocumentEvent.ElementChange

        if (!isHarmony()) {
            return;
        }
        doc.insertString(startOffset + 1, PlainViewI18N_LineViewTest.LTR, null);
        view.insertUpdate(insertEvent, shape, null);
        ElementChange change = insertEvent.getChange(bidi);
        assertNotNull(change);
        assertEquals(3, change.getChildrenRemoved().length);
        assertEquals(6, change.getChildrenAdded().length);
        assertEquals(6, view.getViewCount());
    }
View Full Code Here

Examples of javax.swing.event.DocumentEvent.ElementChange

            return;
        }
        doc.insertString(startOffset + PlainViewI18N_LineViewTest.RTLLength + 1,
                PlainViewI18N_LineViewTest.RTL, null);
        view.insertUpdate(insertEvent, shape, null);
        ElementChange change = insertEvent.getChange(bidi);
        assertNotNull(change);
        assertEquals(3, change.getChildrenRemoved().length);
        assertEquals(6, change.getChildrenAdded().length);
        assertEquals(6, view.getViewCount());
    }
View Full Code Here

Examples of javax.swing.event.DocumentEvent.ElementChange

        if (!isHarmony()) {
            return;
        }
        doc.remove(startOffset + 1, 2);
        view.removeUpdate(removeEvent, shape, null);
        ElementChange change = removeEvent.getChange(bidi);
        assertNotNull(change);
        assertEquals(3, change.getChildrenRemoved().length);
        assertEquals(4, change.getChildrenAdded().length);
        assertEquals(4, view.getViewCount());
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.