use of org.eclipse.nebula.jface.gridviewer.GridTableViewer in project tdq-studio-se by Talend.
the class PatternsSelectPage method createControl.
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
*/
public void createControl(Composite parent) {
GridLayout parentGridLayout = new GridLayout();
GridData data = new GridData();
data.horizontalAlignment = GridData.FILL;
data.verticalAlignment = GridData.FILL;
data.grabExcessHorizontalSpace = true;
data.grabExcessVerticalSpace = true;
parent.setLayout(parentGridLayout);
List<ModelElement> analysisColumns = this.selectPatternsWizard.getSsIndicator().getAnalyzedColumns();
// add tableView
// MOD msjian TDQ-4631 2012-2-10: add horizontal scroll bar
GridTableViewer tableView = new GridTableViewer(parent, SWT.H_SCROLL);
// TDQ-4631~
this.table = tableView.getGrid();
this.table.setLayoutData(data);
table.setHeaderVisible(true);
table.setLinesVisible(true);
for (ModelElement element : analysisColumns) {
GridColumn tableCum = new GridColumn(table, SWT.CHECK);
String elementName = MetadataConnectionUtils.getMetadataColumnName(element);
if (elementName != null) {
tableCum.setText(elementName);
}
}
tableView.setContentProvider(new PatternSelectContentProvider());
tableView.setLabelProvider(new PatternSelectLabelProvider());
this.tableInputList = organizeTableInput();
tableView.setInput(tableInputList);
for (GridColumn tableCum : table.getColumns()) {
tableCum.pack();
}
// add data filter section.
initDataFilterSection(parent);
inItitemCheck();
this.setControl(parent);
this.setPageComplete(true);
}
use of org.eclipse.nebula.jface.gridviewer.GridTableViewer in project archi by archimatetool.
the class RelationshipsMatrixDialog method createDialogArea.
@Override
protected Control createDialogArea(Composite parent) {
// Help
PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, HELP_ID);
setTitle(Messages.RelationshipsMatrixDialog_0);
setMessage(Messages.RelationshipsMatrixDialog_1);
Composite composite = (Composite) super.createDialogArea(parent);
Composite client = new Composite(composite, SWT.NULL);
GridLayout layout = new GridLayout(2, false);
client.setLayout(layout);
client.setLayoutData(new GridData(GridData.FILL_BOTH));
GridData gd;
GridTableViewer viewer = new GridTableViewer(client);
gd = new GridData(GridData.FILL_BOTH);
gd.widthHint = 800;
gd.heightHint = 500;
viewer.getControl().setLayoutData(gd);
viewer.getGrid().setHeaderVisible(true);
viewer.getGrid().setRowHeaderVisible(true);
viewer.getGrid().setRowsResizeable(true);
viewer.getGrid().setCellSelectionEnabled(true);
// viewer.setColumnProperties(new String[] {"1", "2", "3"});
viewer.setRowHeaderLabelProvider(new CellLabelProvider() {
@Override
public void update(ViewerCell cell) {
cell.setText(ArchiLabelProvider.INSTANCE.getDefaultName((EClass) cell.getElement()));
cell.setImage(ArchiLabelProvider.INSTANCE.getImage(cell.getElement()));
}
});
GC gc = new GC(viewer.getGrid());
// $NON-NLS-1$
int columnWidth = gc.textExtent("acfginorstv").x + 8;
gc.dispose();
for (EClass eClass : getData()) {
GridColumn column = new GridColumn(viewer.getGrid(), SWT.NONE);
column.setWidth(columnWidth);
column.setImage(ArchiLabelProvider.INSTANCE.getImage(eClass));
column.setHeaderTooltip(ArchiLabelProvider.INSTANCE.getDefaultName(eClass));
}
viewer.setContentProvider(new IStructuredContentProvider() {
@Override
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
}
@Override
public void dispose() {
}
@Override
public Object[] getElements(Object inputElement) {
return getData().toArray();
}
});
viewer.setLabelProvider(new MyLabelProvider());
// hookContextMenu(viewer);
viewer.setInput(getData());
// $NON-NLS-1$
String text = "";
for (Entry<EClass, Character> entry : RelationshipsMatrix.INSTANCE.getRelationshipsValueMap().entrySet()) {
// $NON-NLS-1$ //$NON-NLS-2$
text += entry.getValue() + ": " + ArchiLabelProvider.INSTANCE.getDefaultName(entry.getKey()) + "\n";
}
Label label = new Label(client, SWT.NULL);
label.setText(text);
label.setLayoutData(new GridData(SWT.TOP, SWT.TOP, false, true));
return composite;
}
Aggregations