Examples of AttributeUndoableEdit


Examples of javax.swing.text.DefaultStyledDocument.AttributeUndoableEdit

     * in this test.
     */
    public void testAttributeUndoableEdit() {
        Element elem = new PlainDocument().getDefaultRootElement();
        AttributeSet attrs = new SimpleAttributeSet();
        undoEdit = new AttributeUndoableEdit(elem, attrs, true);
        assertSame(elem, undoEdit.element);
        assertSame(attrs, undoEdit.newAttributes);
        assertTrue(undoEdit.isReplacing);
        assertSame(SimpleAttributeSet.EMPTY, undoEdit.copy);
    }
View Full Code Here

Examples of javax.swing.text.DefaultStyledDocument.AttributeUndoableEdit

     * <code>bidiLevel</code> attributes in this test.
     */
    public void testAttributeUndoableEditBidiElement() {
        Element elem = new PlainDocument().getBidiRootElement().getElement(0);
        AttributeSet attrs = new SimpleAttributeSet();
        undoEdit = new AttributeUndoableEdit(elem, attrs, true);
        assertSame(elem, undoEdit.element);
        assertSame(attrs, undoEdit.newAttributes);
        assertTrue(undoEdit.isReplacing);
        assertEquals(1, undoEdit.copy.getAttributeCount());
        assertTrue(undoEdit.copy.containsAttribute(StyleConstants.BidiLevel, new Integer(0)));
View Full Code Here

Examples of javax.swing.text.DefaultStyledDocument.AttributeUndoableEdit

        assertEquals(0, root.getElement(1).getAttributes().getAttributeCount());
        assertChildren(root.getElement(2), newLine, new int[] { 21, 22 },
                new AttributeSet[] { null });
        final List<?> edits = DefStyledDoc_Helpers.getEdits((DefaultDocumentEvent) event);
        assertEquals(6, edits.size());
        final AttributeUndoableEdit undo = (AttributeUndoableEdit) edits.get(1);
        assertSame(root, undo.element);
        assertTrue(undo.copy.isEqual(bold));
        assertEquals(0, undo.newAttributes.getAttributeCount());
        assertTrue(undo.isReplacing);
        assertChange(edits.get(2), root.getElement(root.getElementCount() - 1), 0, new int[] {
View Full Code Here

Examples of javax.swing.text.DefaultStyledDocument.AttributeUndoableEdit

            }
        });
        doc.setParagraphAttributes(2, 2, attrs, false);
        List<?> edits = getEdits(event);
        assertEquals(1, edits.size());
        AttributeUndoableEdit attrEdit = (AttributeUndoableEdit) edits.get(0);
        assertFalse(attrEdit.isReplacing);
        assertEquals(1, attrEdit.copy.getAttributeCount());
        assertTrue(attrEdit.copy.isDefined(AttributeSet.ResolveAttribute));
        assertEquals(attrs, attrEdit.newAttributes);
        assertSame(root.getElement(0), attrEdit.element);
View Full Code Here

Examples of javax.swing.text.DefaultStyledDocument.AttributeUndoableEdit

     * in this test.
     */
    public void testAttributeUndoableEdit() {
        Element elem = new PlainDocument().getDefaultRootElement();
        AttributeSet attrs = new SimpleAttributeSet();
        undoEdit = new AttributeUndoableEdit(elem, attrs, true);
        assertSame(elem, undoEdit.element);
        assertSame(attrs, undoEdit.newAttributes);
        assertTrue(undoEdit.isReplacing);
        assertSame(SimpleAttributeSet.EMPTY, undoEdit.copy);
    }
View Full Code Here

Examples of javax.swing.text.DefaultStyledDocument.AttributeUndoableEdit

     * <code>bidiLevel</code> attributes in this test.
     */
    public void testAttributeUndoableEditBidiElement() {
        Element elem = new PlainDocument().getBidiRootElement().getElement(0);
        AttributeSet attrs = new SimpleAttributeSet();
        undoEdit = new AttributeUndoableEdit(elem, attrs, true);
        assertSame(elem, undoEdit.element);
        assertSame(attrs, undoEdit.newAttributes);
        assertTrue(undoEdit.isReplacing);
        assertEquals(1, undoEdit.copy.getAttributeCount());
        assertTrue(undoEdit.copy.containsAttribute(StyleConstants.BidiLevel, new Integer(0)));
View Full Code Here

Examples of javax.swing.text.DefaultStyledDocument.AttributeUndoableEdit

        doc.setCharacterAttributes(2, 2, attrs, false);
        List<?> edits = getEdits(event);
        assertEquals(2, edits.size());
        assertChange(edits.get(0), root.getElement(0), 0, new int[] { 0, 2, 2, 4, 4, 6 },
                new int[] { 0, 6 });
        AttributeUndoableEdit attrEdit = (AttributeUndoableEdit) edits.get(1);
        assertFalse(attrEdit.isReplacing);
        assertEquals(SimpleAttributeSet.EMPTY, attrEdit.copy);
        assertEquals(attrs, attrEdit.newAttributes);
        assertSame(root.getElement(0).getElement(1), attrEdit.element);
        final Element leaf = root.getElement(0).getElement(1);
        assertEquals(attrs, leaf.getAttributes());
        doc.writeLock();
        try {
            attrEdit.undo();
        } finally {
            doc.writeUnlock();
        }
        assertEquals(SimpleAttributeSet.EMPTY, leaf.getAttributes());
    }
View Full Code Here

Examples of javax.swing.text.DefaultStyledDocument.AttributeUndoableEdit

            }
        });
        doc.setParagraphAttributes(2, 2, attrs, false);
        List<?> edits = getEdits(event);
        assertEquals(1, edits.size());
        AttributeUndoableEdit attrEdit = (AttributeUndoableEdit) edits.get(0);
        assertFalse(attrEdit.isReplacing);
        assertEquals(1, attrEdit.copy.getAttributeCount());
        assertTrue(attrEdit.copy.isDefined(AttributeSet.ResolveAttribute));
        assertEquals(attrs, attrEdit.newAttributes);
        assertSame(root.getElement(0), attrEdit.element);
View Full Code Here

Examples of javax.swing.text.DefaultStyledDocument.AttributeUndoableEdit

        assertEquals(0, root.getElement(1).getAttributes().getAttributeCount());
        assertChildren(root.getElement(2), newLine, new int[] { 21, 22 },
                new AttributeSet[] { null });
        final List<?> edits = DefStyledDoc_Helpers.getEdits((DefaultDocumentEvent) event);
        assertEquals(6, edits.size());
        final AttributeUndoableEdit undo = (AttributeUndoableEdit) edits.get(1);
        assertSame(root, undo.element);
        assertTrue(undo.copy.isEqual(bold));
        assertEquals(0, undo.newAttributes.getAttributeCount());
        assertTrue(undo.isReplacing);
        assertChange(edits.get(2), root.getElement(root.getElementCount() - 1), 0, new int[] {
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.