/* MonkeyTalk - a cross-platform functional testing tool Copyright (C) 2012 Gorilla Logic, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ package com.gorillalogic.monkeyconsole.tableview.labelproviders; import java.util.List; import org.eclipse.jface.viewers.ILabelProviderListener; import org.eclipse.jface.viewers.ITableLabelProvider; import org.eclipse.swt.graphics.Image; import com.gorillalogic.monkeyconsole.tableview.TableRow; /** * This class provides the labels for the person table */ class CommandLabelProvider implements ITableLabelProvider { List<TableRow> commands = null; public CommandLabelProvider(List<TableRow> commands){ this.commands = commands; } /** * Returns the image * * @param element * the element * @param columnIndex * the column index * @return Image */ public Image getColumnImage(Object element, int columnIndex) { return null; } /** * Returns the column text * * @param element * the element * @param columnIndex * the column index * @return String */ public String getColumnText(Object element, int columnIndex) { TableRow command = (TableRow) element; switch (columnIndex) { case 0: if (commands != null) { int index = commands.indexOf(element); return "" + (index + 1); } case 1: return command.getComponentType(); case 2: return command.getMonkeyId(); case 3: return command.getAction(); case 4: return command.getArgsAsString(); case 5: return "" + command.getTimeout(); case 6: return "" + command.getThinktime(); } return null; } /** * Adds a listener * * @param listener * the listener */ public void addListener(ILabelProviderListener listener) { // Ignore it } /** * Disposes any created resources */ public void dispose() { // Nothing to dispose } /** * Returns whether altering this property on this element will affect the * label * * @param element * the element * @param property * the property * @return boolean */ public boolean isLabelProperty(Object element, String property) { return false; } /** * Removes a listener * * @param listener * the listener */ public void removeListener(ILabelProviderListener listener) { // Ignore } }