public PerformanceScenario getAddTextScenario()

in src/org/pushingpixels/lightbeam/panels/BigTextAreaPanel.java [116:163]


	public PerformanceScenario getAddTextScenario() {
		return new PerformanceScenario() {
			int[] perms;

			@Override
			public String getName() {
				return "Adding text to text area";
			}

			@Override
			public void setup() {
				textArea.setText("");
				textArea.select(0, 0);
				this.perms = LightBeamUtils.getPermutation(
						LightBeamUtils.dictionary.length, this
								.getIterationCount());
			}

			@Override
			public int getIterationCount() {
				return 10;
			}

			@Override
			public void runSingleIteration(int iterationNumber) {
				try {
					String wordToAdd = LightBeamUtils.dictionary[this.perms[iterationNumber]];
					StringBuffer line = new StringBuffer();
					for (int i = 0; i < 10; i++) {
						line.append(wordToAdd);
						line.append(" ");
					}
					for (int i = 0; i < 100; i++) {
						textArea.append(line.toString() + "\n");
					}

					int lastLine = textArea.getLineCount();
					int charToScrollTo = textArea
							.getLineStartOffset(lastLine - 1);
					textArea.scrollRectToVisible(textArea
							.modelToView(charToScrollTo));
					paintImmediately(0, 0, getWidth(), getHeight());
				} catch (BadLocationException ble) {
					ble.printStackTrace();
				}
			}
		};
	}