blob: 9cca01c76fefb89c20a6af58d8f0339fc8f2fae7 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2004, 2007 Boeing.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
package org.eclipse.osee.framework.ui.skynet.widgets.xviewer.skynet.column;
import org.eclipse.nebula.widgets.xviewer.XViewerColumn;
import org.eclipse.nebula.widgets.xviewer.XViewerValueColumn;
import org.eclipse.nebula.widgets.xviewer.util.XViewerException;
import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
import org.eclipse.swt.SWT;
/**
* @author Donald G. Dunne
*/
public class XViewerHridColumn extends XViewerValueColumn {
public XViewerHridColumn(String name) {
this("framework.hrid." + name, name, 75, SWT.LEFT, true, SortDataType.String, false, "Human Readable ID");
}
public XViewerHridColumn(String id, String name, int width, int align, boolean show, SortDataType sortDataType, boolean multiColumnEditable, String description) {
super(id, name, width, align, show, sortDataType, multiColumnEditable, description);
}
/**
* XViewer uses copies of column definitions so originals that are registered are not corrupted. Classes extending
* XViewerValueColumn MUST extend this constructor so the correct sub-class is created
*
* @param col
*/
@Override
public XViewerHridColumn copy() {
return new XViewerHridColumn(getId(), getName(), getWidth(), getAlign(), isShow(), getSortDataType(),
isMultiColumnEditable(), getDescription());
}
/* (non-Javadoc)
* @see org.eclipse.osee.framework.ui.skynet.widgets.xviewer.XViewerValueColumn#getColumnText(java.lang.Object, org.eclipse.osee.framework.ui.skynet.widgets.xviewer.XViewerColumn)
*/
@Override
public String getColumnText(Object element, XViewerColumn column, int columnIndex) throws XViewerException {
if (element instanceof Artifact) {
return ((Artifact) element).getHumanReadableId();
}
return "";
}
}