Package com.ibm.richtext.styledtext

Examples of com.ibm.richtext.styledtext.StyleModifier$AttributeAddModifier


    private void notify(int change)
    {
        if (fTextPanel != null) {

            StyleModifier modifier;

            if (change == kTrackTab) {
                TabStop newTab = fTrackTab==null? null : fTrackTab.getTabStop();
                modifier = new TabRulerModifier(fOldTab, newTab, fTextPanel.getDefaultValues());
            }
View Full Code Here


       
        fKeys = (Object[]) keys.clone();
        fCharacter = character;
       
        AttributeSet keySet = new AttributeSet(keys);
        final StyleModifier modifier = StyleModifier.createRemoveModifier(keySet);
       
        fItem.addListener(new EventListener() {
            public void eventOccurred(EventObject event) {
                MTextPanel panel = getTextPanel();
                if (panel == null) {
View Full Code Here

        }
    }

    void applyCharacterStyle() {

        StyleModifier stMod = charMods[randInt(charMods.length)];
        fListener.refuseAll();
        fListener.expectEvent(TextPanelEvent.SELECTION_STYLES_CHANGED);
        if (fTextPanel.getSelectionStart() != fTextPanel.getSelectionEnd()) {
            fListener.expectEvent(TextPanelEvent.TEXT_CHANGED);
            fListener.allowEvent(TextPanelEvent.SELECTION_RANGE_CHANGED);
View Full Code Here

        fListener.refuseAll();
        fListener.expectEvent(TextPanelEvent.SELECTION_STYLES_CHANGED);
        fListener.expectEvent(TextPanelEvent.TEXT_CHANGED);
        fListener.allowEvent(TextPanelEvent.UNDO_STATE_CHANGED);
        fListener.allowEvent(TextPanelEvent.SELECTION_RANGE_CHANGED);
        StyleModifier stMod = paraMods[randInt(paraMods.length)];
        fTextPanel.modifyParagraphStyleOnSelection(stMod);
        fListener.assertNotExpectingEvents();
        fListener.allowAll();
    }
View Full Code Here

    private static final int NOT_IN_MONKEY_TEST = -5000;
    private int testIteration = NOT_IN_MONKEY_TEST;
    private int theCase = NOT_IN_MONKEY_TEST;
   
    private static StyleModifier createMinusModifier(final Object attr) {
        return new StyleModifier() {
            public AttributeMap modifyStyle(AttributeMap style) {
                return style.removeAttribute(attr);
            }
        };
    }
View Full Code Here

            if (testItr != 0) {
                // modify styles
                text.resetDamagedRange();
                startingAt = randInt(rand, styles.length+1);
                endingAt = randInt(rand, startingAt, styles.length+1);
                StyleModifier modifier = modifiers[randInt(rand, modifiers.length)];

                if (testItr == stopAt) {
                    testItr = stopAt;
                }
                text.modifyCharacterStyles(startingAt, endingAt, modifier);

                for (int j=startingAt; j < endingAt; j++) {
                    styles[j] = modifier.modifyStyle(styles[j]);
                }
            }

            // check invariants
            AttributeMap oldStyle = null;
View Full Code Here

                                 int limit,
                                 Object key,
                                 Object value,
                                 boolean character) {

        StyleModifier modifier = new TestModifier(key, value);

        if (character) {
            text.modifyCharacterStyles(start, limit, modifier);
        }
        else {
View Full Code Here

        fCharacter = character;
       
        fOnValue = onValue;
        fItem.addListener(new EventListener() {
            public void eventOccurred(EventObject event) {
                StyleModifier modifier;
                MTextPanel panel = getTextPanel();
                if (panel == null) {
                    throw new Error("Menu item is enabled when panel is null!");
                }
                if (continuousAndCommand()) {
View Full Code Here

        MTextPanel textPanel = getTextPanel();
        if (textPanel == null) {
            throw new Error("Menu item is enabled when panel is null!");
        }
       
        StyleModifier modifier;
        if (value == null) {
            AttributeSet set = new AttributeSet(fKey);
            modifier = StyleModifier.createRemoveModifier(set);
        }
        else {
View Full Code Here

        for (int paragraphStart = 0, paragraphLimit;
                    paragraphStart < length;
                    paragraphStart = paragraphLimit) {

            paragraphLimit = styledText.paragraphLimit(paragraphStart);
            StyleModifier modifier = StyleModifier.createAddModifier(
                                             TextAttribute.FOREGROUND,
                                             COLORS[(i++)%COLORS.length]);
            styledText.modifyCharacterStyles(paragraphStart,
                                             paragraphLimit,
                                             modifier);
        }

        StyleModifier modifier = StyleModifier.createAddModifier(
                                            TextAttribute.LINE_FLUSH,
                                            TextAttribute.FLUSH_CENTER);

        styledText.modifyParagraphStyles(0, text.length(), modifier);
View Full Code Here

TOP

Related Classes of com.ibm.richtext.styledtext.StyleModifier$AttributeAddModifier

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.