Package com.ibm.richtext.textlayout.attributes

Examples of com.ibm.richtext.textlayout.attributes.AttributeMap


       
        if (index < fLTSize) {
            return fLineTable[index].isLeftToRight();
        }
        else {
            AttributeMap st = fText.paragraphStyleAt(fLTCurTextLen);
            return !TextAttribute.RUN_DIRECTION_RTL.equals(st.get(TextAttribute.RUN_DIRECTION));
        }
    }
View Full Code Here


            line.fLeftToRight = fLtrDefault;
            line.fSegments.removeAllElements();

            line.fCharLength = 0;

            AttributeMap style = text.characterStyleAt(paragraphStart);
            DefaultCharacterMetric.Metric cm = fDefaultCharMetric.getMetricForStyle(style);
            line.fAscent = cm.getAscent();
            line.fDescent = cm.getDescent();
            line.fLeading = cm.getLeading();
View Full Code Here

        private void setAll() {

            int offset = fTextPanel.getSelectionStart();
            boolean leftToRight = fTextPanel.paragraphIsLeftToRight(offset);
            AttributeMap style = fTextPanel.getText().paragraphStyleAt(offset);
            fTabRuler.set(style, false);
            fTabRuler.setFormatWidth(fTextPanel.getFormatWidth(), false);
            fTabRuler.setLeftToRight(leftToRight, true);
        }
View Full Code Here

            if (changeCode == TextPanelEvent.SELECTION_STYLES_CHANGED ||
                    changeCode == TextPanelEvent.TEXT_CHANGED) {

                int offset = fTextPanel.getSelectionStart();
                AttributeMap style = fTextPanel.getText().paragraphStyleAt(offset);
                boolean leftToRight = fTextPanel.paragraphIsLeftToRight(offset);
                fTabRuler.set(style, false);
                fTabRuler.setLeftToRight(leftToRight, true);
            }
            else if (changeCode == TextPanelEvent.FORMAT_WIDTH_CHANGED) {
View Full Code Here

    }

    protected void setChecked() {

        MTextPanel panel = getTextPanel();
        AttributeMap defaults = panel.getDefaultValues();
       
        for (int i=0; i < fKeys.length; i++) {
            Object defaultV = defaults.get(fKeys[i]);
           
            Object value = (fCharacter == CHARACTER)?
                    panel.getCharacterStyleOverSelection(fKeys[i]) :
                    panel.getParagraphStyleOverSelection(fKeys[i]);
                   
View Full Code Here

        return start + (Math.abs(rand.nextInt())%(limit-start)) ;
    }

    public void test() {

        AttributeMap bold = new AttributeMap(TextAttribute.WEIGHT,
                                             TextAttribute.WEIGHT_BOLD);
        MConstText text1 = new StyledText("Test contents. 1234\nHow about it?",
                                              AttributeMap.EMPTY_ATTRIBUTE_MAP);
        MConstText text2 = new StyledText("Another test string.", bold);
View Full Code Here

    private void insertAndCheck(MConstText src, int srcStart, int srcLimit,
                                MText target, int start, int limit) {

        // p-style after insertion
        AttributeMap after;
        if (limit == target.length() && srcLimit > srcStart) {
            after = src.paragraphStyleAt(srcLimit);
        }
        else {
            after = target.paragraphStyleAt(limit);
        }

        AttributeMap before;
        boolean srcHasPBreak = false;
        for (int i=srcStart; i < srcLimit; i++) {
            if (isParagraphBreak(src.at(i))) {
                srcHasPBreak = true;
                break;
            }
        }

        if (start > 0 && isParagraphBreak(target.at(start-1))) {
            before = target.paragraphStyleAt(start-1);
        }
        else {
            before = srcHasPBreak? src.paragraphStyleAt(srcStart) : after;
        }
        boolean stylePropogated = !before.equals(target.paragraphStyleAt(Math.max(0, start-1)));


        target.resetDamagedRange();
        target.replace(start, limit, src, srcStart, srcLimit);
        final int damageLimit = (start==limit && srcStart==srcLimit)?
                        Integer.MIN_VALUE : start + (srcLimit-srcStart);

        if (target.damagedRangeLimit() != damageLimit) {
            logln("limit: " + damageLimit + ";  target.limit: " +
                                target.damagedRangeLimit());
            errln("Damaged range limit is incorrect");
        }

        final int damageStart = (damageLimit==Integer.MIN_VALUE)? Integer.MAX_VALUE :
                (stylePropogated? target.paragraphStart(Math.max(0, start-1)) : start);
        if (target.damagedRangeStart() > damageStart) {
            logln("start: " + damageStart + ";  target.start: " +
                                target.damagedRangeStart());
            errln("Damaged range start is incorrect");
        }

        verifyParagraphCount(target);

        // check endpoints
        if (!before.equals(target.paragraphStyleAt(Math.max(start-1, 0)))) {
            errln("Incorrect paragraph style before modified range");
        }

        int lengthDelta = (srcLimit-srcStart) - (limit-start);
        int indexAfterInsert = Math.min(target.length(), limit + lengthDelta);
View Full Code Here

    public TestAttributeMap() {

        maps = AttributeSet.EMPTY_SET;
        maps = maps.addElement(AttributeMap.EMPTY_ATTRIBUTE_MAP);
        maps.addElement(new AttributeMap(TextAttribute.SUPERSCRIPT, TextAttribute.SUPERSCRIPT_SUB));
        maps.addElement(new AttributeMap(TextAttribute.SUPERSCRIPT, TextAttribute.SUPERSCRIPT_SUPER));

        for (int i=0; i < attributes.length; i++) {
            for (int j=0; j < values.length; j++) {
                maps = maps.addElement(new AttributeMap(attributes[i], values[j]));
            }
        }

        AttributeMap bigMap = new AttributeMap(new TestAttribute("4"), "value");
        for (int i=0; i < Math.min(attributes.length, values.length); i++) {
            bigMap = bigMap.addAttribute(attributes[i], values[values.length-i-1]);
        }
        maps = maps.addElement(bigMap);

        sets = AttributeSet.EMPTY_SET;
View Full Code Here

        easyTests();

        Enumeration mapIter = maps.elements();
        while (mapIter.hasMoreElements()) {

            AttributeMap testMap = (AttributeMap) mapIter.nextElement();

            _testModifiers(testMap);
            _testViews(testMap);

            Enumeration unionIter = maps.elements();
View Full Code Here

        if (gJDK11) {
            return;
        }
       
        AttributeMap originalMap = new AttributeMap(map);

        try {
            map.put(TextAttribute.WEIGHT, TextAttribute.WEIGHT_BOLD);
            errln("Put should throw UnsupportedOperationException.");
        }
        catch(UnsupportedOperationException e) {
            System.out.print("");
        }

        try {
            Object key = TextAttribute.WEIGHT;
            Iterator iter = map.keySet().iterator();
            if (iter.hasNext()) {
                key = iter.next();
            }
            map.remove(key);
            errln("Set should throw UnsupportedOperationException.");
        }
        catch(UnsupportedOperationException e) {
            System.out.print("");
        }

        try {
            map.putAll(map);
            errln("putAll should throw UnsupportedOperationException.");
        }
        catch(UnsupportedOperationException e) {
            System.out.print("");
        }

        try {
            map.clear();
            errln("clear should throw UnsupportedOperationException.");
        }
        catch(UnsupportedOperationException e) {
            System.out.print("");
        }

        if (!originalMap.equals(map)) {
            errln("Modifiers changed map.");
        }
    }
View Full Code Here

TOP

Related Classes of com.ibm.richtext.textlayout.attributes.AttributeMap

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.