1 17 18 19 20 package org.apache.fop.area.inline; 21 22 25 public class TextArea extends AbstractTextArea { 26 27 30 public TextArea() { 31 } 32 33 40 public TextArea(int stretch, int shrink, int adj) { 41 super(stretch, shrink, adj); 42 } 43 44 47 public void removeText() { 48 inlines.clear(); 49 } 50 51 57 public void addWord(String word, int offset) { 58 addWord(word, offset, null); 59 } 60 61 67 public void addWord(String word, int offset, int[] letterAdjust) { 68 WordArea wordArea = new WordArea(word, offset, letterAdjust); 69 addChildArea(wordArea); 70 wordArea.setParentArea(this); 71 } 72 73 80 public void addSpace(char space, int offset, boolean adjustable) { 81 SpaceArea spaceArea = new SpaceArea(space, offset, adjustable); 82 addChildArea(spaceArea); 83 spaceArea.setParentArea(this); 84 } 85 86 97 public String getText() { 98 StringBuffer text = new StringBuffer (); 99 InlineArea child; 100 for (int i = 0; i < inlines.size(); i ++) { 102 child = (InlineArea) inlines.get(i); 103 if (child instanceof WordArea) { 104 text.append(((WordArea) child).getWord()); 105 } else { 106 text.append(((SpaceArea) child).getSpace()); 107 } 108 } 109 return text.toString(); 110 } 111 112 } 113 114 | Popular Tags |