Пример #1
0
        /**
         * Constructs an {@code AttributedString} from an {@code
         * AttributedCharacterIterator}, which represents attributed text.
         *
         * @param iterator
         *            the {@code AttributedCharacterIterator} that contains the text
         *            for this attributed string.
         */
        public AttributedString(AttributedCharacterIterator iterator)
        {
            if (iterator.getBeginIndex() > iterator.getEndIndex()) {
                // text.0A=Invalid substring range
                throw new java.lang.IllegalArgumentException("Invalid substring range"); //$NON-NLS-1$
            }
            StringBuilder buffer = new StringBuilder();
            for (int i = iterator.getBeginIndex(); i < iterator.getEndIndex(); i++) {
                buffer.Append(iterator.current());
                iterator.next();
            }
            text = buffer.ToString();
            java.util.Set<AttributedCharacterIteratorNS.Attribute> attributes = iterator
                    .getAllAttributeKeys();
            if (attributes == null) {
                return;
            }
            attributeMap = new java.util.HashMap<AttributedCharacterIteratorNS.Attribute, java.util.List<IAC_Range>>();//(attributes.size() * 4 / 3) + 1);

            java.util.Iterator<AttributedCharacterIteratorNS.Attribute> it = attributes.iterator();
            while (it.hasNext()) {
                AttributedCharacterIteratorNS.Attribute attribute = it.next();
                iterator.setIndex(0);
                while (iterator.current() != CharacterIteratorConstants.DONE) {
                    int start = iterator.getRunStart(attribute);
                    int limit = iterator.getRunLimit(attribute);
                    System.Object value = iterator.getAttribute(attribute);
                    if (value != null) {
                        addAttribute(attribute, value, start, limit);
                    }
                    iterator.setIndex(limit);
                }
            }
        }
Пример #2
0
 public AttributedString(AttributedCharacterIterator arg0)
     : base(ProxyCtor.I)
 {
     Instance.CallConstructor("(Ljava/text/AttributedCharacterIterator;)V", arg0);
 }
Пример #3
0
 public AttributedString(AttributedCharacterIterator arg0, int arg1, int arg2, ObjectArray<AttributedCharacterIterator_.Attribute> arg3)
     : base(ProxyCtor.I)
 {
     Instance.CallConstructor("(Ljava/text/AttributedCharacterIterator;II[Ljava/text/AttributedCharacterIterator/Attribute;)V", arg0, arg1, arg2, arg3);
 }
Пример #4
0
		/// <summary>
		/// Renders the text of the specified iterator, using the
		/// <code>Graphics2D</code> context's current <code>Paint</code>.
		/// </summary>
		abstract public override void drawString(AttributedCharacterIterator @iterator, int @x, int @y);
Пример #5
0
		/// <summary>
		/// Renders the text of the specified iterator, using the
		/// <code>Graphics2D</code> context's current <code>Paint</code>.
		/// </summary>
		abstract public void drawString(AttributedCharacterIterator @iterator, float @x, float @y);
Пример #6
0
 /**
  * Renders the text of the specified iterator, using the
  * <code>Graphics2D</code> context's current <code>Paint</code>. The
  * iterator must specify a font
  * for each character. The baseline of the
  * first character is at position (<i>x</i>,&nbsp;<i>y</i>) in the
  * User Space.
  * The rendering attributes applied include the <code>Clip</code>,
  * <code>Transform</code>, <code>Paint</code>, and
  * <code>Composite</code> attributes.
  * For characters in script systems such as Hebrew and Arabic,
  * the glyphs can be rendered from right to left, in which case the
  * coordinate supplied is the location of the leftmost character
  * on the baseline.
  * @param iterator the iterator whose text is to be rendered
  * @param x the x coordinate where the iterator's text is to be
  * rendered
  * @param y the y coordinate where the iterator's text is to be
  * rendered
  * @see #setPaint
  * @see java.awt.Graphics#setColor
  * @see #setTransform
  * @see #setComposite
  * @see #setClip
  */
 public void DrawString(AttributedCharacterIterator iterator, float x, float y) {
     log.log(POILogger.WARN, "Not implemented");
 }
Пример #7
0
 /**
  * Draws the text given by the specified iterator, using this
  * graphics context's current color. The iterator has to specify a font
  * for each character. The baseline of the
  * first character is at position (<i>x</i>,&nbsp;<i>y</i>) in this
  * graphics context's coordinate system.
  * @param       iterator the iterator whose text is to be Drawn
  * @param       x        the <i>x</i> coordinate.
  * @param       y        the <i>y</i> coordinate.
  * @see         java.awt.Graphics#drawBytes
  * @see         java.awt.Graphics#drawChars
  */
 public void DrawString(AttributedCharacterIterator iterator,
                        int x, int y){
     DrawString(iterator, (float)x, (float)y);
 }
		/// <summary>
		/// Constructs an <code>InputMethodEvent</code> with the specified
		/// source component, type, time, text, caret, and visiblePosition.
		/// </summary>
		public InputMethodEvent(Component @source, int @id, long @when, AttributedCharacterIterator @text, int @committedCharacterCount, TextHitInfo @caret, TextHitInfo @visiblePosition)
		{
		}
Пример #9
0
        private AttributedString(AttributedCharacterIterator iterator, int start,
                int end, java.util.Set<AttributedCharacterIteratorNS.Attribute> attributes)
        {
            if (start < iterator.getBeginIndex() || end > iterator.getEndIndex()
                    || start > end) {
                throw new java.lang.IllegalArgumentException();
            }

            if (attributes == null) {
                return;
            }

            StringBuilder buffer = new StringBuilder();
            iterator.setIndex(start);
            while (iterator.getIndex() < end) {
                buffer.Append(iterator.current());
                iterator.next();
            }
            text = buffer.ToString();
            attributeMap = new java.util.HashMap<AttributedCharacterIteratorNS.Attribute, java.util.List<IAC_Range>>();//(attributes.size() * 4 / 3) + 1);

            java.util.Iterator<AttributedCharacterIteratorNS.Attribute> it = attributes.iterator();
            while (it.hasNext()) {
                AttributedCharacterIteratorNS.Attribute attribute = it.next();
                iterator.setIndex(start);
                while (iterator.getIndex() < end) {
                    System.Object value = iterator.getAttribute(attribute);
                    int runStart = iterator.getRunStart(attribute);
                    int limit = iterator.getRunLimit(attribute);
                    if ((value is java.lang.annotation.Annotation && runStart >= start && limit <= end)
                            || (value != null && !(value is java.lang.annotation.Annotation))) {
                        addAttribute(attribute, value, (runStart < start ? start
                                : runStart)
                                - start, (limit > end ? end : limit) - start);
                    }
                    iterator.setIndex(limit);
                }
            }
        }
Пример #10
0
 /**
  * Constructs an {@code AttributedString} from a range of the text contained
  * in the specified {@code AttributedCharacterIterator}, starting at {@code
  * start}, ending at {@code end} and it will copy the attributes defined in
  * the specified set. If the set is {@code null} then all attributes are
  * copied.
  *
  * @param iterator
  *            the {@code AttributedCharacterIterator} that contains the text
  *            for this attributed string.
  * @param start
  *            the start index of the range of the copied text.
  * @param end
  *            the end index of the range of the copied text.
  * @param attributes
  *            the set of attributes that will be copied, or all if it is
  *            {@code null}.
  * @throws IllegalArgumentException
  *             if {@code start} is less than first index of
  *             {@code iterator}, {@code end} is greater than the last index +
  *             1 in {@code iterator} or if {@code start > end}.
  */
 public AttributedString(AttributedCharacterIterator iterator, int start,
         int end, AttributedCharacterIteratorNS.Attribute[] attributes)
     : this(iterator, start, end, new java.util.HashSet<AttributedCharacterIteratorNS.Attribute>(java.util.Arrays<System.Object>.asList(attributes)))
 {
 }
Пример #11
0
 /**
  * Constructs an {@code AttributedString} from a range of the text contained
  * in the specified {@code AttributedCharacterIterator}, starting at {@code
  * start} and ending at {@code end}. All attributes will be copied to this
  * attributed string.
  *
  * @param iterator
  *            the {@code AttributedCharacterIterator} that contains the text
  *            for this attributed string.
  * @param start
  *            the start index of the range of the copied text.
  * @param end
  *            the end index of the range of the copied text.
  * @throws IllegalArgumentException
  *             if {@code start} is less than first index of
  *             {@code iterator}, {@code end} is greater than the last
  *             index + 1 in {@code iterator} or if {@code start > end}.
  */
 public AttributedString(AttributedCharacterIterator iterator, int start,
         int end)
     : this(iterator, start, end, iterator.getAllAttributeKeys())
 {
 }