use of org.eclipse.jface.viewers.TableViewer 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);
}
});
}
use of org.eclipse.jface.viewers.TableViewer in project cubrid-manager by CUBRID.
the class ObjectInfoComposite method initTableColumn.
/**
* Initial Table column setting
*
* @param composite
*/
private void initTableColumn(Composite composite) {
tableColTableViewer = new TableViewer(composite, SWT.FULL_SELECTION | SWT.BORDER);
Table columnsTable = tableColTableViewer.getTable();
columnsTable.setLinesVisible(true);
columnsTable.setHeaderVisible(true);
// PK
final TableColumn pkColumn = new TableColumn(columnsTable, SWT.NONE);
pkColumn.setAlignment(SWT.CENTER);
pkColumn.setWidth(30);
pkColumn.setText(Messages.tblColumnPK);
// NAME
final TableColumn nameColumn = new TableColumn(columnsTable, SWT.NONE);
nameColumn.setWidth(90);
nameColumn.setText(Messages.tblColumnName);
// DATATYPE
final TableColumn dataTypeColumn = new TableColumn(columnsTable, SWT.NONE);
dataTypeColumn.setWidth(120);
dataTypeColumn.setText(Messages.tblColumnDataType);
// DEFAULT
final TableColumn defaultColumn = new TableColumn(columnsTable, SWT.NONE);
defaultColumn.setWidth(98);
defaultColumn.setText(Messages.tblColumnDefault);
// AUTO INCREMENT
final TableColumn autoIncrTableColumn = new TableColumn(columnsTable, SWT.NONE);
autoIncrTableColumn.setAlignment(SWT.CENTER);
autoIncrTableColumn.setWidth(100);
autoIncrTableColumn.setText(Messages.tblColumnAutoIncr);
// NOT NULL
final TableColumn notNullColumn = new TableColumn(columnsTable, SWT.NONE);
notNullColumn.setWidth(70);
notNullColumn.setText(Messages.tblColumnNotNull);
notNullColumn.setAlignment(SWT.CENTER);
// UK
final TableColumn uniqueColumn = new TableColumn(columnsTable, SWT.NONE);
uniqueColumn.setWidth(70);
uniqueColumn.setText(Messages.tblColumnUnique);
uniqueColumn.setAlignment(SWT.CENTER);
// SHARED
final TableColumn sharedColumn = new TableColumn(columnsTable, SWT.NONE);
sharedColumn.setWidth(60);
sharedColumn.setResizable(false);
sharedColumn.setText(Messages.tblColumnShared);
sharedColumn.setAlignment(SWT.CENTER);
// INHERIT
final TableColumn inheritColumn = new TableColumn(columnsTable, SWT.NONE);
inheritColumn.setAlignment(SWT.CENTER);
inheritColumn.setWidth(90);
inheritColumn.setResizable(false);
inheritColumn.setText(Messages.tblColumnInherit);
// CLASS
final TableColumn classColumn = new TableColumn(columnsTable, SWT.NONE);
classColumn.setWidth(90);
classColumn.setResizable(false);
classColumn.setText(Messages.tblColumnClass);
classColumn.setAlignment(SWT.CENTER);
}
use of org.eclipse.jface.viewers.TableViewer in project cubrid-manager by CUBRID.
the class ObjectInfoComposite method initIndexTabItem.
/**
* Initial index tab index
*
*/
private void initIndexTabItem() {
CubridDatabase database = schemaNode.getDatabase();
CTabItem indexTabItem = new CTabItem(objInfoFolder, SWT.NONE);
indexTabItem.setText(Messages.titleIndex);
indexTabItem.setShowClose(false);
Composite composite = new Composite(objInfoFolder, SWT.None);
indexTabItem.setControl(composite);
composite.setLayout(new FillLayout());
final SashForm sashForm = new SashForm(composite, SWT.VERTICAL);
sashForm.setBackground(CombinedQueryEditorComposite.BACK_COLOR);
/*Index table composite*/
Composite indexComposite = new Composite(sashForm, SWT.None);
indexComposite.setLayout(new GridLayout());
/*FK table composite*/
Composite fkComposite = new Composite(sashForm, SWT.None);
fkComposite.setLayout(new GridLayout());
/*Set the sashform*/
sashForm.setWeights(new int[] { 1, 1 });
// create index table view
final Label indexLabel = new Label(indexComposite, SWT.NONE);
indexLabel.setText(Messages.lblIndexes);
indexTableViewer = new TableViewer(indexComposite, SWT.FULL_SELECTION | SWT.MULTI | SWT.BORDER);
Table indexTable = indexTableViewer.getTable();
indexTable.setLinesVisible(true);
indexTable.setHeaderVisible(true);
indexTable.setLayoutData(CommonUITool.createGridData(GridData.FILL_BOTH, 1, 1, -1, -1));
TableColumn tblCol = new TableColumn(indexTable, SWT.NONE);
tblCol.setWidth(150);
tblCol.setText(Messages.tblColumnIndexName);
TableColumn indexNameColumn = new TableColumn(indexTable, SWT.NONE);
indexNameColumn.setWidth(78);
indexNameColumn.setText(Messages.tblColumnIndexType);
TableColumn indexTypeColumn = new TableColumn(indexTable, SWT.NONE);
indexTypeColumn.setWidth(218);
indexTypeColumn.setText(Messages.tblColumnOnColumns);
TableColumn ruleColumn = new TableColumn(indexTable, SWT.NONE);
ruleColumn.setWidth(282);
ruleColumn.setText(Messages.tblColumnIndexRule);
IndexTableViewerContentProvider indexContentProvider = new IndexTableViewerContentProvider();
IndexTableViewerLabelProvider indexLabelProvider = new IndexTableViewerLabelProvider();
indexTableViewer.setContentProvider(indexContentProvider);
indexTableViewer.setLabelProvider(indexLabelProvider);
// create the fk table viewer
final Label fkLabel = new Label(fkComposite, SWT.NONE);
fkLabel.setText(Messages.lblFK);
fkTableViewer = new TableViewer(fkComposite, SWT.FULL_SELECTION | SWT.MULTI | SWT.BORDER);
Table fkTable = fkTableViewer.getTable();
fkTable.setLayoutData(CommonUITool.createGridData(GridData.FILL_BOTH, 1, 1, -1, -1));
fkTable.setLinesVisible(true);
fkTable.setHeaderVisible(true);
TableColumn fkNameColumn = new TableColumn(fkTable, SWT.NONE);
fkNameColumn.setWidth(100);
fkNameColumn.setText(Messages.tblColumnFK);
TableColumn fkColumnName = new TableColumn(fkTable, SWT.NONE);
fkColumnName.setWidth(119);
fkColumnName.setText(Messages.tblColumnColumnName);
TableColumn fTableColumn = new TableColumn(fkTable, SWT.NONE);
fTableColumn.setWidth(93);
fTableColumn.setText(Messages.tblColumnForeignTable);
TableColumn fkColumnNameColumn = new TableColumn(fkTable, SWT.NONE);
fkColumnNameColumn.setWidth(143);
fkColumnNameColumn.setText(Messages.tblColumnForeignColumnName);
TableColumn updateRuletblColumn = new TableColumn(fkTable, SWT.NONE);
updateRuletblColumn.setWidth(84);
updateRuletblColumn.setText(Messages.tblColumnUpdateRule);
TableColumn deleteRuleColumn = new TableColumn(fkTable, SWT.NONE);
deleteRuleColumn.setWidth(86);
deleteRuleColumn.setText(Messages.tblColumnDeleteRule);
TableColumn cacheColumn = new TableColumn(fkTable, SWT.NONE);
cacheColumn.setWidth(100);
cacheColumn.setText(Messages.tblColumnCacheColumn);
fkTableViewer.setContentProvider(new FKTableViewerContentProvider());
fkTableViewer.setLabelProvider(new FKTableViewerLabelProvider(database.getDatabaseInfo()));
}
use of org.eclipse.jface.viewers.TableViewer in project cubrid-manager by CUBRID.
the class QuickBuilderDialog method createContents.
protected void createContents() {
sqlComp = CommonUITool.getActiveSQLEditorComposite();
if (sqlComp == null) {
closeThisDialog();
return;
}
CubridDatabase cubridDatabase = sqlComp.getQueryEditorPart().getSelectedDatabase();
if (CubridDatabase.hasValidDatabaseInfo(cubridDatabase)) {
databaseInfo = cubridDatabase.getDatabaseInfo();
}
boolean loadedProposal = true;
proposal = ColumnProposalAdvisor.getInstance().findProposal(databaseInfo);
if (proposal == null) {
proposal = new ColumnProposal();
if (databaseInfo != null) {
startTimerForUpdateProposal();
}
loadedProposal = false;
}
isSupportLimit = CompatibleUtil.isSupportLimit(cubridDatabase.getDatabaseInfo());
shell = new Shell(getParent(), SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);
{
GridLayout gl = new GridLayout();
gl.numColumns = 1;
shell.setLayout(gl);
}
shell.setSize(450, 300);
shell.setText(Messages.quickQueryBuilderTitle);
final Composite composite = new Composite(shell, SWT.NONE);
{
GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
composite.setLayoutData(gd);
GridLayout gl = new GridLayout();
composite.setLayout(gl);
}
final Label findWhatLabel = new Label(composite, SWT.NONE);
findWhatLabel.setText(Messages.quickQueryBuilderLabel);
inputText = new Text(composite, SWT.BORDER);
{
GridData gd = new GridData(SWT.FILL, SWT.TOP, true, false);
inputText.setLayoutData(gd);
}
inputText.setEditable(true);
inputText.addKeyListener(inputTextKeyListener);
searchView = new TableViewer(composite, SWT.BORDER);
{
GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
searchView.getTable().setLayoutData(gd);
}
searchView.setContentProvider(searchViewContentProvider);
searchView.setLabelProvider(searchViewLabelProvider);
searchView.setInput(proposal);
searchView.getTable().addKeyListener(new KeyListener() {
public void keyReleased(KeyEvent e) {
}
public void keyPressed(KeyEvent e) {
if (e.keyCode == SWT.CR) {
makeQueryAndClose(0);
}
}
});
TableColumn col1 = new TableColumn(searchView.getTable(), SWT.NONE);
col1.setWidth(200);
TableColumn col2 = new TableColumn(searchView.getTable(), SWT.NONE);
col2.setWidth(200);
if (!loadedProposal) {
updateNoticeBanner = new Label(composite, SWT.BORDER);
{
GridData gd = new GridData(SWT.FILL, SWT.BOTTOM, true, false);
updateNoticeBanner.setLayoutData(gd);
}
updateNoticeBanner.setText(Messages.quickQueryBuilderLoading);
updateNoticeBanner.setBackground(ResourceManager.getColor(255, 255, 255));
}
Composite bottomPanel = new Composite(composite, SWT.NONE);
{
GridLayout gl = new GridLayout();
gl.numColumns = 4;
bottomPanel.setLayout(gl);
GridData gd = new GridData(SWT.FILL, SWT.BOTTOM, true, false);
bottomPanel.setLayoutData(gd);
}
createButtons(bottomPanel);
}
use of org.eclipse.jface.viewers.TableViewer in project cubrid-manager by CUBRID.
the class BrokerEnvStatusView method createTable.
/**
* This method initializes table
*
*/
private void createTable() {
tableViewer = new TableViewer(composite, SWT.FULL_SELECTION);
tableViewer.getTable().setHeaderVisible(true);
tableViewer.getTable().setLinesVisible(true);
BrokerTblColumnSetHelp bcsh = BrokerTblColumnSetHelp.getInstance();
bcsh.loadSetting(BrokerTblColumnSetHelp.StatusColumn.BrokerEnvStatusColumn, BrokerEnvStatusColumn.values());
TableLayout tlayout = new TableLayout();
for (BrokerEnvStatusColumn column : BrokerEnvStatusColumn.values()) {
if (column.getValue() == -1) {
tlayout.addColumnData(new ColumnWeightData(0, 0, false));
} else {
tlayout.addColumnData(new ColumnWeightData(10, 40, true));
}
}
tableViewer.getTable().setLayout(tlayout);
tableViewer.getTable().addMouseListener(new MouseAdapter() {
public void mouseDoubleClick(MouseEvent event) {
int index = -1;
if ((index = tableViewer.getTable().getSelectionIndex()) >= 0) {
TableItem tableItem = tableViewer.getTable().getItem(index);
String brokename = tableItem.getText(0).trim();
ICubridNode input = null;
for (ICubridNode node : cubridNode.getChildren()) {
if (node.getLabel().equalsIgnoreCase(brokename)) {
input = node;
break;
}
}
LayoutManager.getInstance().setCurrentSelectedNode(input);
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
if (null == window) {
return;
}
IWorkbenchPage activePage = window.getActivePage();
IViewPart viewPart = window.getActivePage().findView(BrokerStatusView.ID);
if (null != viewPart) {
activePage.hideView(viewPart);
}
try {
activePage.showView(BrokerStatusView.ID);
} catch (PartInitException e1) {
LOGGER.error(e1.getMessage(), e1);
}
}
}
});
makeTableColumn();
tableViewer.setContentProvider(new BrokersStatusContentProvider());
ServerInfo serverInfo = cubridNode.getServer().getServerInfo();
BrokersStatusLabelProvider brokersStatusLabelProvider = new BrokersStatusLabelProvider();
brokersStatusLabelProvider.setServerInfo(serverInfo);
tableViewer.setLabelProvider(brokersStatusLabelProvider);
}
Aggregations