use of org.netxms.client.mt.MappingTableEntry in project netxms by netxms.
the class MappingTableEntryComparator method compare.
/* (non-Javadoc)
* @see org.eclipse.jface.viewers.ViewerComparator#compare(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
*/
@Override
public int compare(Viewer viewer, Object e1, Object e2) {
int result;
MappingTableEntry me1 = (MappingTableEntry) e1;
MappingTableEntry me2 = (MappingTableEntry) e2;
switch(// $NON-NLS-1$
(Integer) ((SortableTableViewer) viewer).getTable().getSortColumn().getData("ID")) {
case MappingTableEditor.COLUMN_KEY:
result = me1.getKey().compareToIgnoreCase(me2.getKey());
break;
case MappingTableEditor.COLUMN_VALUE:
result = me1.getValue().compareToIgnoreCase(me2.getValue());
break;
case MappingTableEditor.COLUMN_DESCRIPTION:
result = me1.getDescription().compareToIgnoreCase(me2.getDescription());
break;
default:
result = 0;
break;
}
return (((SortableTableViewer) viewer).getTable().getSortDirection() == SWT.UP) ? result : -result;
}
use of org.netxms.client.mt.MappingTableEntry in project netxms by netxms.
the class MappingTableEditor method addNewRow.
/**
* Add new row
*/
private void addNewRow() {
if (mappingTable == null)
return;
// $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
MappingTableEntry e = new MappingTableEntry("", "", "");
mappingTable.getData().add(e);
viewer.setInput(mappingTable.getData().toArray());
viewer.setSelection(new StructuredSelection(e));
setModified(true);
viewer.editElement(e, COLUMN_KEY);
}
Aggregations