Inheritance: java.lang.Object
コード例 #1
0
 public static bool equal(AttributedString s1, AttributedString s2)
 {
   if (s1 == null)
   {
     return s2 == null;
   }
   else
   {
     if (s2 == null)
       return false;
     AttributedCharacterIterator iterator1 = s1.getIterator();
     AttributedCharacterIterator iterator2 = s2.getIterator();
     int num1 = (int) ((CharacterIterator) iterator1).first();
     int num2 = (int) ((CharacterIterator) iterator2).first();
     int num3 = 0;
     while (num1 != (int) ushort.MaxValue)
     {
       int runLimit1 = iterator1.getRunLimit();
       int runLimit2 = iterator2.getRunLimit();
       if (runLimit1 != runLimit2 || !Object.instancehelper_equals((object) iterator1.getAttributes(), (object) iterator2.getAttributes()))
         return false;
       for (int index = num3; index < runLimit1; ++index)
       {
         if (num1 != num2)
           return false;
         num1 = (int) ((CharacterIterator) iterator1).next();
         num2 = (int) ((CharacterIterator) iterator2).next();
       }
       num3 = runLimit1;
     }
     return num2 == (int) ushort.MaxValue;
   }
 }
コード例 #2
0
        internal LineLayout NextLine()
        {
            if (_currentPos < _currentRun && !Format.NoWrap)
            {
                return(NextTextLayoutFromMeasurer());
            }

            _charsConsumed += _currentRun;
            if (_charsConsumed >= _s.Length)
            {
                return(null);
            }

            string s;
            int    lineBreakIndex = _s.IndexOf(NewLine, _charsConsumed);

            if (lineBreakIndex >= 0)
            {
                s = _s.Substring(_charsConsumed, lineBreakIndex - _charsConsumed + NewLine.Length);
            }
            else
            {
                s = _s.Substring(_charsConsumed);
            }

            _currentRun = s.Length;
            _currentPos = 0;

            text.AttributedString aS = new text.AttributedString(s);

            // TODO: add more attribs according to StringFormat
            aS.addAttribute(font.TextAttribute.FONT, _font.NativeObject);
            if ((_font.Style & FontStyle.Underline) != FontStyle.Regular)
            {
                aS.addAttribute(font.TextAttribute.UNDERLINE, font.TextAttribute.UNDERLINE_ON);
            }
            if ((_font.Style & FontStyle.Strikeout) != FontStyle.Regular)
            {
                aS.addAttribute(font.TextAttribute.STRIKETHROUGH, font.TextAttribute.STRIKETHROUGH_ON);
            }

            text.AttributedCharacterIterator charIter = aS.getIterator();

            _measurer = new font.TextMeasurer(charIter, _frc);
            return(NextTextLayoutFromMeasurer());
        }
コード例 #3
0
		internal LineLayout NextLine() {
			if (_currentPos < _currentRun && !Format.NoWrap)
				return NextTextLayoutFromMeasurer();

			_charsConsumed += _currentRun;
			if (_charsConsumed >= _s.Length)
				return null;

			string s;
			int lineBreakIndex = _s.IndexOf(NewLine, _charsConsumed);
			if (lineBreakIndex >= 0) {
				s = _s.Substring(_charsConsumed, lineBreakIndex - _charsConsumed + NewLine.Length);
			}
			else
				s = _s.Substring(_charsConsumed);

			_currentRun = s.Length;
			_currentPos = 0;

			text.AttributedString aS = new text.AttributedString(s);
				
			// TODO: add more attribs according to StringFormat
			aS.addAttribute(font.TextAttribute.FONT, _font.NativeObject);
			if((_font.Style & FontStyle.Underline) != FontStyle.Regular)
				aS.addAttribute(font.TextAttribute.UNDERLINE, font.TextAttribute.UNDERLINE_ON);
			if((_font.Style & FontStyle.Strikeout) != FontStyle.Regular)
				aS.addAttribute(font.TextAttribute.STRIKETHROUGH, font.TextAttribute.STRIKETHROUGH_ON);

			text.AttributedCharacterIterator charIter = aS.getIterator();

			_measurer = new font.TextMeasurer(charIter, _frc);
			return NextTextLayoutFromMeasurer();
		}
コード例 #4
0
 public static void writeAttributedString(AttributedString @as, ObjectOutputStream stream)
 {
   if (stream == null)
   {
     string str = "Null 'stream' argument.";
     Throwable.__\u003CsuppressFillInStackTrace\u003E();
     throw new IllegalArgumentException(str);
   }
   else if (@as != null)
   {
     stream.writeBoolean(false);
     AttributedCharacterIterator iterator = @as.getIterator();
     StringBuffer stringBuffer = new StringBuffer();
     for (int index = (int) ((CharacterIterator) iterator).first(); index != (int) ushort.MaxValue; index = (int) ((CharacterIterator) iterator).next())
       stringBuffer = stringBuffer.append((char) index);
     stream.writeObject((object) stringBuffer.toString());
     int num = (int) ((CharacterIterator) iterator).first();
     int beginIndex = ((CharacterIterator) iterator).getBeginIndex();
     for (; num != (int) ushort.MaxValue; {
       int runLimit;
       num = (int) ((CharacterIterator) iterator).setIndex(runLimit);
     }
     )
     {
       stream.writeChar(num);
       runLimit = iterator.getRunLimit();
       stream.writeInt(runLimit - beginIndex);
       HashMap hashMap = new HashMap(iterator.getAttributes());
       stream.writeObject((object) hashMap);
     }
     stream.writeChar((int) ushort.MaxValue);
   }
   else
     stream.writeBoolean(true);
 }
コード例 #5
0
 public static AttributedString readAttributedString(ObjectInputStream stream)
 {
   if (stream == null)
   {
     string str = "Null 'stream' argument.";
     Throwable.__\u003CsuppressFillInStackTrace\u003E();
     throw new IllegalArgumentException(str);
   }
   else
   {
     AttributedString attributedString = (AttributedString) null;
     if (!stream.readBoolean())
     {
       attributedString = new AttributedString((string) stream.readObject());
       int num1 = (int) stream.readChar();
       int num2 = 0;
       for (; num1 != (int) ushort.MaxValue; num1 = (int) stream.readChar())
       {
         int num3 = stream.readInt();
         Map map = (Map) stream.readObject();
         attributedString.addAttributes(map, num2, num3);
         num2 = num3;
       }
     }
     return attributedString;
   }
 }
コード例 #6
0
 public LegendItem(string label, string description, string toolTipText, string urlText, bool shapeVisible, Shape shape, bool shapeFilled, Paint fillPaint, bool shapeOutlineVisible, Paint outlinePaint, Stroke outlineStroke, bool lineVisible, Shape line, Stroke lineStroke, Paint linePaint)
 {
   int num1 = shapeVisible ? 1 : 0;
   int num2 = shapeFilled ? 1 : 0;
   int num3 = shapeOutlineVisible ? 1 : 0;
   int num4 = lineVisible ? 1 : 0;
   base.\u002Ector();
   LegendItem legendItem = this;
   if (label == null)
   {
     string str = "Null 'label' argument.";
     Throwable.__\u003CsuppressFillInStackTrace\u003E();
     throw new IllegalArgumentException(str);
   }
   else if (fillPaint == null)
   {
     string str = "Null 'fillPaint' argument.";
     Throwable.__\u003CsuppressFillInStackTrace\u003E();
     throw new IllegalArgumentException(str);
   }
   else if (lineStroke == null)
   {
     string str = "Null 'lineStroke' argument.";
     Throwable.__\u003CsuppressFillInStackTrace\u003E();
     throw new IllegalArgumentException(str);
   }
   else if (outlinePaint == null)
   {
     string str = "Null 'outlinePaint' argument.";
     Throwable.__\u003CsuppressFillInStackTrace\u003E();
     throw new IllegalArgumentException(str);
   }
   else if (outlineStroke == null)
   {
     string str = "Null 'outlineStroke' argument.";
     Throwable.__\u003CsuppressFillInStackTrace\u003E();
     throw new IllegalArgumentException(str);
   }
   else
   {
     this.label = label;
     this.labelPaint = (Paint) null;
     this.attributedLabel = (AttributedString) null;
     this.description = description;
     this.shapeVisible = num1 != 0;
     this.shape = shape;
     this.shapeFilled = num2 != 0;
     this.fillPaint = fillPaint;
     this.fillPaintTransformer = (GradientPaintTransformer) new StandardGradientPaintTransformer();
     this.shapeOutlineVisible = num3 != 0;
     this.outlinePaint = outlinePaint;
     this.outlineStroke = outlineStroke;
     this.lineVisible = num4 != 0;
     this.line = line;
     this.lineStroke = lineStroke;
     this.linePaint = linePaint;
     this.toolTipText = toolTipText;
     this.urlText = urlText;
   }
 }
コード例 #7
0
 public LegendItem(AttributedString label, string description, string toolTipText, string urlText, Shape line, Stroke lineStroke, Paint linePaint)
   : this(label, description, toolTipText, urlText, false, LegendItem.UNUSED_SHAPE, false, (Paint) Color.black, false, (Paint) Color.black, LegendItem.UNUSED_STROKE, true, line, lineStroke, linePaint)
 {
 }
コード例 #8
0
 public LegendItem(AttributedString label, string description, string toolTipText, string urlText, Shape shape, Paint fillPaint, Stroke outlineStroke, Paint outlinePaint)
   : this(label, description, toolTipText, urlText, true, shape, true, fillPaint, true, outlinePaint, outlineStroke, false, LegendItem.UNUSED_SHAPE, LegendItem.UNUSED_STROKE, (Paint) Color.black)
 {
 }