iterator.setIndex(start); while (iterator.getIndex() < end) { buffer.append(iterator.current()); while (it.hasNext()) { AttributedCharacterIterator.Attribute attribute = it.next(); iterator.setIndex(start); while (iterator.getIndex() < end) { Object value = iterator.getAttribute(attribute); - start, (limit > end ? end : limit) - start); iterator.setIndex(limit);
/** * If fields list is not null, find and add the fields of this format to * the fields list by iterating through its AttributedCharacterIterator * * @param format * the format to find fields for * @param arg * object to format * @param begin * the index where the string this format has formatted begins */ private void handleFormat(Format format, Object arg, int begin, List<FieldContainer> fields) { if (fields == null) { return; } AttributedCharacterIterator iterator = format.formatToCharacterIterator(arg); while (iterator.getIndex() != iterator.getEndIndex()) { int start = iterator.getRunStart(); int end = iterator.getRunLimit(); Iterator<?> it = iterator.getAttributes().keySet().iterator(); while (it.hasNext()) { AttributedCharacterIterator.Attribute attribute = (AttributedCharacterIterator.Attribute) it.next(); Object value = iterator.getAttribute(attribute); fields.add(new FieldContainer(begin + start, begin + end, attribute, value)); } iterator.setIndex(end); } }
while (measure.getPosition() < textIter.getEndIndex()) { newLineCheck.setIndex(measure.getPosition()); char ch; while ((ch = newLineCheck.next()) != CharacterIterator.DONE) {
/** * Sets the position to getBeginIndex(). * @return the character at the start index of the text. * <br><b>Specified by:</b> java.text.CharacterIterator. */ public char first() { return aci.setIndex(begin); }
/** * Sets the position to the specified position in the text and returns that character. */ public char setIndex(int position) { return reorderedACI.setIndex(position); }
/** * Sets the position to the specified position in the text and returns that character. */ public char setIndex(int position) { return reorderedACI.setIndex(position); }
/** * Sets the position to getBeginIndex(). * @return the character at the start index of the text. * <br><b>Specified by:</b> java.text.CharacterIterator. */ public char first() { return aci.setIndex(begin); }
/** * Sets the position to getBeginIndex(). * @return the character at the start index of the text. * <br><b>Specified by:</b> java.text.CharacterIterator. */ public char first() { return aci.setIndex(begin); }
/** * Sets the position to the specified position in the text and returns that character. */ public char setIndex(int position) { return reorderedACI.setIndex(position); }
private static void copyAsSuperscript( AttributedCharacterIterator iterator, int start, int limit, StringBuilder result) { int oldIndex = iterator.getIndex(); iterator.setIndex(start); while (iterator.getIndex() < limit) { int aChar = char32AtAndAdvance(iterator); int digit = UCharacter.digit(aChar); if (digit < 0) { throw new IllegalArgumentException(); } result.append(SUPERSCRIPT_DIGITS[digit]); } iterator.setIndex(oldIndex); }
protected void printAttrs(AttributedCharacterIterator aci) { aci.first(); int start = aci.getBeginIndex(); System.out.print("AttrRuns: "); while (aci.current() != CharacterIterator.DONE) { int end = aci.getRunLimit(); System.out.print(""+(end-start)+", "); aci.setIndex(end); start = end; } System.out.println(""); }
protected void printAttrs(AttributedCharacterIterator aci) { aci.first(); int start = aci.getBeginIndex(); System.out.print("AttrRuns: "); while (aci.current() != CharacterIterator.DONE) { int end = aci.getRunLimit(); System.out.print(""+(end-start)+", "); aci.setIndex(end); start = end; } System.out.println(""); }
protected void printAttrs(AttributedCharacterIterator aci) { aci.first(); int start = aci.getBeginIndex(); System.out.print("AttrRuns: "); while (aci.current() != CharacterIterator.DONE) { int end = aci.getRunLimit(); System.out.print(""+(end-start)+", "); aci.setIndex(end); start = end; } System.out.println(""); }
public TextRunBreaker(AttributedCharacterIterator aci, FontRenderContext frc) { this.aci = aci; this.frc = frc; segmentsStart = aci.getBeginIndex(); segmentsEnd = aci.getEndIndex(); int len = segmentsEnd - segmentsStart; text = new char[len]; aci.setIndex(segmentsEnd); while (len-- != 0) { // Going in backward direction is faster? Simplier checks here? text[len] = aci.previous(); } createStyleRuns(); }
/** * Stores the field indices of the years in the {@link #minPos} and {@link #maxPos} fields. */ private static void findYears(final AttributedCharacterIterator it, final RangeFormat.Field field, final FieldPosition pos) { it.setIndex(it.getRunLimit(field)); it.setIndex(it.getRunLimit(DateFormat.Field.YEAR)); pos.setBeginIndex(it.getIndex()); it.setIndex(it.getRunLimit(DateFormat.Field.YEAR)); pos.setEndIndex(it.getIndex()); }
/** * */ protected void exportStyledText(JRStyledText styledText) throws IOException { String text = styledText.getText(); int runLimit = 0; AttributedCharacterIterator iterator = styledText.getAttributedString().getIterator(); while(runLimit < styledText.length() && (runLimit = iterator.getRunLimit()) <= styledText.length()) { exportStyledTextRun(iterator.getAttributes(), text.substring(iterator.getIndex(), runLimit)); iterator.setIndex(runLimit); } }
/** * */ protected void exportStyledText(JRStyle style, JRStyledText styledText) throws IOException { String text = styledText.getText(); int runLimit = 0; AttributedCharacterIterator iterator = styledText.getAttributedString().getIterator(); while(runLimit < styledText.length() && (runLimit = iterator.getRunLimit()) <= styledText.length()) { runHelper.export(style, iterator.getAttributes(), text.substring(iterator.getIndex(), runLimit)); iterator.setIndex(runLimit); } }
/** * */ protected void exportStyledText(JRStyledText styledText) throws IOException { String text = styledText.getText(); int runLimit = 0; AttributedCharacterIterator iterator = styledText.getAttributedString().getIterator(); while(runLimit < styledText.length() && (runLimit = iterator.getRunLimit()) <= styledText.length()) { exportStyledTextRun(iterator.getAttributes(), text.substring(iterator.getIndex(), runLimit)); iterator.setIndex(runLimit); } }