/**
 * @author tyl
 * @Action  ini
 * 2011-3-15
 */
package cn.com.origin.autocodemanager.common.treetable;

import org.eclipse.jface.viewers.ILabelProviderListener;
import org.eclipse.jface.viewers.ITableLabelProvider;
import org.eclipse.swt.graphics.Image;
import cn.com.origin.autocodemanager.common.tree.AbstractTreeData;
import com.teamcenter.rac.kernel.TCComponent;

public class ORNewItemTreeTableLabelProvider implements ITableLabelProvider {
	public Image getColumnImage(Object element, int columnIndex) {
		if (element instanceof AbstractTreeData) {
			AbstractTreeData codeTreeData = (AbstractTreeData) element;
			if (columnIndex == 0) {
				return codeTreeData.getImage();
			}
		}
		return null;
	}

	public String getColumnText(Object element, int coumnIndex) {
		if (element instanceof AbstractTreeData) {
			AbstractTreeData codeTreeData = (AbstractTreeData) element;
			if (codeTreeData == null) {
				return "";
			}
			if (codeTreeData.getPackCodeNodeInfo() == null) {
				return "";
			}

			TCComponent component = codeTreeData.getPackCodeNodeInfo().getNodeComponent();
			if (component == null) {
				return "";
			}
			switch (coumnIndex) {
			case 0:
				return codeTreeData.getPackCodeNodeInfo().getNode_name();
			case 1:
				return codeTreeData.getPackCodeNodeInfo().getNode_value();
			case 2:
				return codeTreeData.getPackCodeNodeInfo().getNode_desc();
			}
		}
		return "";
	}

	public void addListener(ILabelProviderListener arg0) {

	}

	public void dispose() {

	}

	public boolean isLabelProperty(Object obj, String obj1) {
		return false;
	}

	public void removeListener(ILabelProviderListener arg0) {

	}

}
