use of org.eclipse.jface.viewers.TableViewerColumn in project translationstudio8 by heartsome.
the class PreMachineTranslationDialog method createTableViewerColumn.
/**
* 设置TableViewer 列属性
* @param viewer
* @param title
* 列标题
* @param bound
* 列宽
* @param colNumber
* 列序号
* @return {@link TableViewerColumn};
*/
private TableViewerColumn createTableViewerColumn(TableViewer viewer, String title, int bound, final int colNumber) {
final TableViewerColumn viewerColumn = new TableViewerColumn(viewer, SWT.NONE | SWT.Resize);
final TableColumn column = viewerColumn.getColumn();
column.setText(title);
column.setWidth(bound);
column.setResizable(true);
column.setMoveable(true);
return viewerColumn;
}
use of org.eclipse.jface.viewers.TableViewerColumn in project translationstudio8 by heartsome.
the class LockRepeatedSegmentResultDialog method createTableViewerColumn.
/**
* 设置TableViewer 列属性
* @param viewer
* @param title
* 列标题
* @param bound
* 列宽
* @param colNumber
* 列序号
* @return {@link TableViewerColumn};
*/
private TableViewerColumn createTableViewerColumn(TableViewer viewer, String title, int bound, final int colNumber) {
final TableViewerColumn viewerColumn = new TableViewerColumn(viewer, SWT.NONE | SWT.Resize);
final TableColumn column = viewerColumn.getColumn();
column.setText(title);
column.setWidth(bound);
column.setResizable(true);
column.setMoveable(true);
return viewerColumn;
}
use of org.eclipse.jface.viewers.TableViewerColumn in project ACS by ACS-Community.
the class ArchivingListPart method postConstruct.
@PostConstruct
public void postConstruct(Composite parent, IEventBroker eventBroker) {
try {
em = EventModel.getInstance();
} catch (Throwable thr) {
thr.printStackTrace();
IStatus someStatus = statusReporter.newStatus(IStatus.ERROR, "Connection with NCs failed.", thr);
statusReporter.report(someStatus, StatusReporter.SHOW);
throw new RuntimeException(thr);
}
logger = em.getLogger();
GridLayout gridLayout = new GridLayout();
gridLayout.marginHeight = 0;
gridLayout.marginWidth = 0;
gridLayout.verticalSpacing = 0;
parent.setLayout(gridLayout);
// buildCustomToolBar(parent);
viewer = new TableViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
Table table = viewer.getTable();
table.setHeaderVisible(true);
table.setLinesVisible(true);
/*
* "Time "+timeStamp+" "+m_channelName+" "+component+" "+count+"
* "+channelEventCount+" " +" "+evtTypeName+"
* "+evtCounter.get(evtTypeName)
*/
TableViewerColumn tvcol = new TableViewerColumn(viewer, SWT.NONE, 0);
tvcol.setLabelProvider(new TimeStampLabelProvider());
TableColumn col = tvcol.getColumn();
col.setText("Timestamp");
col.setWidth(190);
col.setAlignment(SWT.LEFT);
tvcol = new TableViewerColumn(viewer, SWT.NONE, 1);
tvcol.setLabelProvider(new EventSourceLabelProvider());
col = tvcol.getColumn();
col.setText("Device");
col.setWidth(100);
col.setAlignment(SWT.LEFT);
tvcol = new TableViewerColumn(viewer, SWT.NONE, 2);
tvcol.setLabelProvider(new BaciParameterLabelProvider());
col = tvcol.getColumn();
col.setText("Property");
col.setWidth(100);
col.setAlignment(SWT.LEFT);
tvcol = new TableViewerColumn(viewer, SWT.NONE, 3);
tvcol.setLabelProvider(new BaciPropertyValueLabelProvider());
col = tvcol.getColumn();
col.setText("Value");
col.setWidth(100);
col.setAlignment(SWT.LEFT);
GridDataFactory.fillDefaults().grab(true, true).applyTo(viewer.getTable());
viewer.setContentProvider(new ArchivingListContentProvider(em));
viewer.setInput(new Object());
pel = new PopulateEventList(logger, viewer, new StatusLineWriter(eventBroker), em.getArchQueue(), "Monitor points");
eventListThread = pel.getThreadForEventList();
eventListThread.start();
}
use of org.eclipse.jface.viewers.TableViewerColumn in project ACS by ACS-Community.
the class EventListPart method postConstruct.
/**
*/
@PostConstruct
public void postConstruct(Composite parent, final IEclipseContext context, IEventBroker eventBroker, EMenuService menuService) {
try {
em = EventModel.getInstance();
} catch (Throwable thr) {
thr.printStackTrace();
IStatus someStatus = statusReporter.newStatus(IStatus.ERROR, "Connection with NCs failed.", thr);
statusReporter.report(someStatus, StatusReporter.SHOW);
throw new RuntimeException(thr);
}
logger = em.getLogger();
GridLayout gridLayout = new GridLayout();
gridLayout.marginHeight = 0;
gridLayout.marginWidth = 0;
gridLayout.verticalSpacing = 0;
parent.setLayout(gridLayout);
// TODO: We currently have the filter text control in the regular view toolbar.
// The e3 eventGUI had a "custom tool bar" inserted here.
// We should decide which way it's better.
viewer = new TableViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION);
Table table = viewer.getTable();
table.setHeaderVisible(true);
table.setLinesVisible(true);
/*
* "Time "+timeStamp+" "+m_channelName+" "+component+" "+count+"
* "+channelEventCount+" " +" "+evtTypeName+"
* "+evtCounter.get(evtTypeName)
*/
TableViewerColumn tvcol = new TableViewerColumn(viewer, SWT.NONE, 0);
tvcol.setLabelProvider(new TimeStampLabelProvider());
TableColumn col = tvcol.getColumn();
col.setText("Timestamp");
col.setWidth(180);
col.setAlignment(SWT.LEFT);
tvcol = new TableViewerColumn(viewer, SWT.NONE, 1);
tvcol.setLabelProvider(new EventSourceLabelProvider());
col = tvcol.getColumn();
col.setText("Event source");
col.setWidth(150);
col.setAlignment(SWT.LEFT);
tvcol = new TableViewerColumn(viewer, SWT.NONE, 2);
tvcol.setLabelProvider(new CountLabelProvider());
col = tvcol.getColumn();
col.setText("# Events in channel");
col.setWidth(50);
col.setAlignment(SWT.LEFT);
tvcol = new TableViewerColumn(viewer, SWT.NONE, 3);
tvcol.setLabelProvider(new EventTypeLabelProvider());
col = tvcol.getColumn();
col.setText("Event type");
col.setWidth(150);
col.setAlignment(SWT.LEFT);
tvcol = new TableViewerColumn(viewer, SWT.NONE, 4);
tvcol.setLabelProvider(new EventTypeCountLabelProvider());
col = tvcol.getColumn();
col.setText("# Events this type");
col.setWidth(50);
col.setAlignment(SWT.LEFT);
GridDataFactory.fillDefaults().grab(true, true).applyTo(viewer.getTable());
viewer.setContentProvider(new EventListViewContentProvider(em));
// Attach a selection listener to our event list that will post the selected event for the event details list
viewer.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent event) {
IStructuredSelection selection = (IStructuredSelection) event.getSelection();
if (selection.size() == 1) {
selectionService.setSelection(selection.getFirstElement());
}
}
});
viewer.setInput(new Object());
hookContextMenu(menuService);
pel = new PopulateEventList(logger, viewer, new StatusLineWriter(eventBroker), em.getEventQueue(), "NC Events");
eventListThread = pel.getThreadForEventList();
eventListThread.start();
}
use of org.eclipse.jface.viewers.TableViewerColumn in project translationstudio8 by heartsome.
the class ReverseConversionWizardPage method createFilesGroup.
/**
* 创建文件列表区域
* @param contents
* ;
*/
private Composite createFilesGroup(Composite contents) {
Composite filesComposite = new Composite(contents, SWT.NONE);
filesComposite.setLayout(new GridLayout(1, false));
filesComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
filesTable = new Table(filesComposite, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI | SWT.FULL_SELECTION);
GridData tableData = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.FILL_BOTH);
tableData.heightHint = 100;
filesTable.setLayoutData(tableData);
filesTable.setLinesVisible(true);
filesTable.setHeaderVisible(true);
filesTable.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
TableItem[] selected = filesTable.getSelection();
if (selected.length == 0) {
return;
}
//$NON-NLS-1$
String strTgtEnc = "";
for (int i = 0; i < selected.length; i++) {
String curTgtEnc = selected[i].getText(2);
if (i == 0) {
strTgtEnc = curTgtEnc;
} else {
if (!strTgtEnc.equals(curTgtEnc)) {
//$NON-NLS-1$
strTgtEnc = "";
break;
}
}
}
if (!"".equals(strTgtEnc)) {
//$NON-NLS-1$
tgtEncCombo.setText(strTgtEnc);
} else {
tgtEncCombo.deselectAll();
}
}
});
tableViewer = new TableViewer(filesTable);
lineNumberColumn = new TableViewerColumn(tableViewer, SWT.NONE).getColumn();
lineNumberColumn.setText(Messages.getString("wizard.ReverseConversionWizardPage.lineNumberColumn"));
xliffColumn = new TableViewerColumn(tableViewer, SWT.NONE).getColumn();
//$NON-NLS-1$
xliffColumn.setText(Messages.getString("wizard.ReverseConversionWizardPage.xliffColumn"));
tgtEncColumn = new TableViewerColumn(tableViewer, SWT.NONE).getColumn();
//$NON-NLS-1$
tgtEncColumn.setText(Messages.getString("wizard.ReverseConversionWizardPage.tgtEncColumn"));
targetColumn = new TableViewerColumn(tableViewer, SWT.NONE).getColumn();
//$NON-NLS-1$
targetColumn.setText(Messages.getString("wizard.ReverseConversionWizardPage.targetColumn"));
IValueProperty[] valueProperties = BeanProperties.values(ConversionConfigBean.class, new String[] { "index", "source", "targetEncoding", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
"target" });
ViewerSupport.bind(tableViewer, new WritableList(conversionConfigBeans, ConversionConfigBean.class), valueProperties);
filesComposite.addPaintListener(new PaintListener() {
public void paintControl(PaintEvent arg0) {
int width = filesTable.getClientArea().width;
lineNumberColumn.setWidth(width * 1 / 10);
targetColumn.setWidth(width * 4 / 10);
tgtEncColumn.setWidth(width * 1 / 10);
xliffColumn.setWidth(width * 4 / 10);
}
});
return filesComposite;
}
Aggregations