use of com.cubrid.common.ui.er.editor.RelationMapColumnLabelProvider in project cubrid-manager by CUBRID.
the class SetPhysicalLogicaMapDialog method createTableComposite.
private void createTableComposite(Composite composite, Group group, PhysicalLogicRelation.MapType type) {
group.setLayoutData(new GridData(GridData.FILL_BOTH));
GridLayout layout = new GridLayout();
layout.numColumns = 1;
group.setLayout(layout);
ScrolledComposite scrolledComposite = new ScrolledComposite(group, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
scrolledComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
scrolledComposite.setExpandHorizontal(true);
scrolledComposite.setExpandVertical(true);
final TableViewer tableViewer = new TableViewer(scrolledComposite, SWT.FULL_SELECTION | SWT.MULTI | SWT.BORDER);
columnDataTableView = tableViewer;
tableViewer.setColumnProperties(columnProperites);
final Table widgetTable = tableViewer.getTable();
scrolledComposite.setContent(widgetTable);
scrolledComposite.setMinSize(widgetTable.computeSize(SWT.DEFAULT, SWT.DEFAULT));
final GridData gdFkTable = new GridData(SWT.FILL, SWT.FILL, true, true, 4, 1);
widgetTable.setLayoutData(gdFkTable);
widgetTable.setLinesVisible(true);
widgetTable.setHeaderVisible(true);
//empty column
final TableColumn emptyColumn = new TableColumn(widgetTable, SWT.NONE);
emptyColumn.setWidth(0);
//flag column
final TableColumn flagColumn = new TableColumn(widgetTable, SWT.LEFT_TO_RIGHT);
flagColumn.setWidth(20);
//physical column
TableColumn tblCol = new TableColumn(widgetTable, SWT.NONE);
tblCol.setWidth(120);
tblCol.setText(Messages.tblcolumnPhysical);
//logical column
tblCol = new TableColumn(widgetTable, SWT.NONE);
tblCol.setWidth(120);
tblCol.setText(Messages.tblcolumnLogical);
attrContentProvider = new AttributeContentProvider();
attrLabelProvider = new RelationMapColumnLabelProvider(this);
tableViewer.setContentProvider(attrContentProvider);
tableViewer.setLabelProvider(attrLabelProvider);
CellEditor[] cellEditor = new CellEditor[columnProperites.length];
{
int index = 0;
//Empty
cellEditor[index++] = null;
//Flag
cellEditor[index++] = null;
//Physical
cellEditor[index++] = new TextCellEditor(widgetTable);
//Logical
cellEditor[index++] = new TextCellEditor(widgetTable);
}
tableViewer.setCellEditors(cellEditor);
tableViewer.setCellModifier(new ModelRelationCellModifier(this, type));
loadTableInput(type);
final Button delBtn = new Button(group, SWT.PUSH);
delBtn.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
delBtn.setText(Messages.btnDelItem);
delBtn.setData(type);
delBtn.setEnabled(false);
delBtn.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
deleteColumn(delBtn);
}
});
widgetTable.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
handleSelectionChangeInTable(widgetTable, delBtn);
}
});
}
Aggregations