use of org.eclipse.swt.widgets.TableColumn 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.swt.widgets.TableColumn 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.swt.widgets.TableColumn 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.swt.widgets.TableColumn in project cubrid-manager by CUBRID.
the class FilterChooserDialog method createComposite.
/**
*
* Create the composite
*
* @param parent Composite
*/
private void createComposite(Composite parent) {
Composite composite = new Composite(parent, SWT.NONE);
composite.setLayoutData(new GridData(GridData.FILL_BOTH));
GridLayout layout = new GridLayout();
layout.numColumns = 3;
composite.setLayout(layout);
Label infoLabel = new Label(composite, SWT.NONE);
infoLabel.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 3, 1, -1, -1));
infoLabel.setText(Messages.lblFilterChooser);
String[] columnNames = new String[] { Messages.colColumn };
tv = (CheckboxTableViewer) CommonUITool.createCheckBoxTableViewer(composite, null, columnNames, CommonUITool.createGridData(GridData.FILL_BOTH, 3, 1, 300, 200));
tv.addCheckStateListener(new ICheckStateListener() {
public void checkStateChanged(CheckStateChangedEvent event) {
if (!event.getChecked() && selectAllBtn.getSelection()) {
selectAllBtn.setSelection(false);
}
if (colInfoList != null && colInfoList.size() == tv.getCheckedElements().length) {
selectAllBtn.setSelection(true);
}
}
});
final List<Map<String, Object>> colNameList = new ArrayList<Map<String, Object>>();
for (int i = 0; i < colInfoList.size(); i++) {
ColumnInfo colInfo = colInfoList.get(i);
Map<String, Object> map = new HashMap<String, Object>();
map.put("0", colInfo.getName());
map.put("1", colInfo);
colNameList.add(map);
}
tv.setInput(colNameList);
tv.getTable().setFocus();
selectAllBtn = new Button(composite, SWT.CHECK);
{
selectAllBtn.setText(Messages.btnSelectAll);
GridData gridData = new GridData();
gridData.grabExcessHorizontalSpace = true;
gridData.horizontalIndent = 0;
gridData.horizontalSpan = 3;
selectAllBtn.setLayoutData(gridData);
}
selectAllBtn.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
boolean selection = selectAllBtn.getSelection();
tv.setAllChecked(selection);
}
});
for (TableItem item : tv.getTable().getItems()) {
@SuppressWarnings("unchecked") Map<String, Object> map = (Map<String, Object>) item.getData();
if (map != null && selectedColInfoList.contains(map.get("1"))) {
item.setChecked(true);
}
}
TableColumn[] tblCols = tv.getTable().getColumns();
for (TableColumn tblCol : tblCols) {
tblCol.setWidth(280);
}
if (colInfoList != null && selectedColInfoList != null && colInfoList.size() == selectedColInfoList.size()) {
selectAllBtn.setSelection(true);
}
}
use of org.eclipse.swt.widgets.TableColumn in project cubrid-manager by CUBRID.
the class CubridIndexNavigatorView method createPartControl.
public void createPartControl(Composite parent) {
tableIndexTableViewer = new TableViewer(parent, SWT.FULL_SELECTION | SWT.MULTI | SWT.BORDER);
Table columnsTable = tableIndexTableViewer.getTable();
columnsTable.setLinesVisible(true);
columnsTable.setHeaderVisible(true);
final TableColumn pkColumn = new TableColumn(columnsTable, SWT.NONE);
pkColumn.setAlignment(SWT.LEFT);
pkColumn.setWidth(40);
pkColumn.setText(Messages.lblIndexType);
final TableColumn indexNameColumn = new TableColumn(columnsTable, SWT.NONE);
indexNameColumn.setAlignment(SWT.LEFT);
indexNameColumn.setWidth(80);
indexNameColumn.setText(Messages.tblColumnIndexName);
final TableColumn onColumn = new TableColumn(columnsTable, SWT.NONE);
onColumn.setAlignment(SWT.LEFT);
onColumn.setWidth(90);
onColumn.setText(Messages.tblColumnOnColumns);
tableIndexTableViewer.setContentProvider(new CubridIndexNavigatorContentProvider());
tableIndexTableViewer.setLabelProvider(new CubridIndexNavigatorLabelProvider());
}
Aggregations