public PerformanceScenario getLargeColumnSelectionScenario()

in src/org/pushingpixels/lightbeam/panels/TablePanel.java [372:411]


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

			@Override
			public String getName() {
				return "Selecting columns in large table";
			}

			@Override
			public void setup() {
				table.scrollRectToVisible(table.getCellRect(0, 0, true));
				table.setRowSelectionAllowed(false);
				table.setColumnSelectionAllowed(true);
				table.getColumnModel().getSelectionModel().clearSelection();
				table.getColumnModel().getSelectionModel().setSelectionMode(
						ListSelectionModel.SINGLE_INTERVAL_SELECTION);
				this.perms = LightBeamUtils.getPermutation(table
						.getColumnCount(), this.getIterationCount() * 2);
			}

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

			@Override
			public void runSingleIteration(int iterationNumber) {
				ListSelectionModel selectionModel = table.getColumnModel()
						.getSelectionModel();
				int start = perms[2 * iterationNumber];
				int end = perms[2 * iterationNumber + 1];
				int startInt = Math.min(start, end);
				int endInt = Math.max(start, end);
				selectionModel.clearSelection();
				selectionModel.addSelectionInterval(startInt, endInt);
				table.paintImmediately(table.getVisibleRect());
			}
		};
	}