use of com.cubrid.common.ui.spi.TableContentProvider in project cubrid-manager by CUBRID.
the class DatabaseDashboardEditor method createDatabaseComposite.
/**
* create database information composite
*
* @param bar ExpandBar
* @param bar index
*/
public void createDatabaseComposite(ExpandBar bar, int index) {
ExpandItem dbInfoItem = new ExpandItem(bar, SWT.NONE, index);
dbInfoItem.setText(Messages.exportDashboardDBTableTitle);
Composite dbComposite = new Composite(bar, SWT.None);
dbComposite.setLayout(new FillLayout());
dbInfoTableViewer = new TableViewer(dbComposite, SWT.BORDER | SWT.FULL_SELECTION);
GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
gridData.heightHint = 16;
dbInfoTableViewer.getTable().setLayoutData(gridData);
dbInfoTableViewer.getTable().setHeaderVisible(true);
dbInfoTableViewer.getTable().setLinesVisible(false);
final TableViewerColumn columnCPU = new TableViewerColumn(dbInfoTableViewer, SWT.CENTER);
columnCPU.getColumn().setWidth(60);
columnCPU.getColumn().setText("CPU");
columnCPU.getColumn().setToolTipText("CPU");
final TableViewerColumn columnMemory = new TableViewerColumn(dbInfoTableViewer, SWT.CENTER);
columnMemory.getColumn().setWidth(120);
columnMemory.getColumn().setText(com.cubrid.cubridmanager.ui.monitoring.Messages.dbSysMemInfoGroupName);
columnMemory.getColumn().setToolTipText(com.cubrid.cubridmanager.ui.monitoring.Messages.dbSysMemInfoGroupName);
final TableViewerColumn columnQPS = new TableViewerColumn(dbInfoTableViewer, SWT.CENTER);
columnQPS.getColumn().setWidth(80);
columnQPS.getColumn().setText("QPS");
columnQPS.getColumn().setToolTipText(com.cubrid.cubridmanager.ui.host.Messages.tipQps);
final TableViewerColumn columnHitRatio = new TableViewerColumn(dbInfoTableViewer, SWT.CENTER);
columnHitRatio.getColumn().setWidth(80);
columnHitRatio.getColumn().setText("Hit Ratio");
columnHitRatio.getColumn().setToolTipText(Messages.databaseTableHitRatioColumnLabel);
final TableViewerColumn columnIo1 = new TableViewerColumn(dbInfoTableViewer, SWT.CENTER);
columnIo1.getColumn().setWidth(100);
columnIo1.getColumn().setText("Fetch pages");
columnIo1.getColumn().setToolTipText("num_data_page_fetches");
final TableViewerColumn columnIo2 = new TableViewerColumn(dbInfoTableViewer, SWT.CENTER);
columnIo2.getColumn().setWidth(100);
columnIo2.getColumn().setText("Dirty pages");
columnIo2.getColumn().setToolTipText("num_data_page_dirties");
final TableViewerColumn columnIo3 = new TableViewerColumn(dbInfoTableViewer, SWT.CENTER);
columnIo3.getColumn().setWidth(100);
columnIo3.getColumn().setText("I/O Reads");
columnIo3.getColumn().setToolTipText("num_data_page_ioreads");
final TableViewerColumn columnIo4 = new TableViewerColumn(dbInfoTableViewer, SWT.CENTER);
columnIo4.getColumn().setWidth(100);
columnIo4.getColumn().setText("I/O Writes");
columnIo4.getColumn().setToolTipText("num_data_page_iowrites");
dbInfoTableViewer.setContentProvider(new TableContentProvider());
dbInfoTableViewer.setLabelProvider(new TableLabelProvider());
dbInfoTableViewer.setInput(dbInfoListData);
dbInfoItem.setControl(dbComposite);
dbInfoItem.setHeight(80);
dbInfoItem.setExpanded(true);
tableViewOnBarIndexMap.put(dbInfoTableViewer, index);
}
use of com.cubrid.common.ui.spi.TableContentProvider in project cubrid-manager by CUBRID.
the class DatabaseStatusEditor method createCommonTableViewer.
/**
*
* Create the common table viewer that can be sorted by TableViewerSorter
* object,this viewer's input object must be List<Map<String,Object>> and
* Map's key must be column index,Map's value of the column must be String.
*
* @param parent the parent composite
* @param sorter the sorter
* @param columnNameArr the column name array
* @param gridData the griddata
* @return the table viewer
*/
public static TableViewer createCommonTableViewer(Composite parent, ViewerSorter sorter, final String[] columnNameArr, GridData gridData) {
final TableViewer tableViewer = new TableViewer(parent, SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION | SWT.NO_SCROLL);
tableViewer.setContentProvider(new TableContentProvider());
tableViewer.setLabelProvider(new TableLabelProvider());
if (sorter != null) {
tableViewer.setSorter(sorter);
}
tableViewer.getTable().setLinesVisible(true);
tableViewer.getTable().setHeaderVisible(true);
tableViewer.getTable().setLayoutData(gridData);
for (int i = 0; i < columnNameArr.length; i++) {
final TableColumn tblColumn = new TableColumn(tableViewer.getTable(), SWT.LEFT);
tblColumn.setText(columnNameArr[i]);
if (sorter != null) {
tblColumn.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
TableColumn column = (TableColumn) event.widget;
int j = 0;
for (j = 0; j < columnNameArr.length; j++) {
if (column.getText().equals(columnNameArr[j])) {
break;
}
}
TableViewerSorter sorter = ((TableViewerSorter) tableViewer.getSorter());
if (sorter == null) {
return;
}
sorter.doSort(j);
tableViewer.getTable().setSortColumn(column);
tableViewer.getTable().setSortDirection(sorter.isAsc() ? SWT.UP : SWT.DOWN);
tableViewer.refresh();
for (int k = 0; k < tableViewer.getTable().getColumnCount(); k++) {
tableViewer.getTable().getColumn(k).pack();
}
}
});
}
tblColumn.pack();
}
return tableViewer;
}
use of com.cubrid.common.ui.spi.TableContentProvider in project cubrid-manager by CUBRID.
the class SqlmapNavigatorView method createParamView.
private void createParamView(Composite parent) {
String[] columnNames = { Messages.lblSqlmapName, Messages.lblSqlmapValue, Messages.lblSqlmapType };
Label lblCondTitle = new Label(parent, SWT.NONE);
lblCondTitle.setText(Messages.lblSqlmapParameters);
paramView = CommonUITool.createCommonTableViewer(parent, null, columnNames, CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 1, 1, -1, 120));
paramView.setColumnProperties(columnNames);
paramView.setContentProvider(new TableContentProvider());
paramView.setLabelProvider(new TableLabelProvider());
TableLayout tableLayout = new TableLayout();
tableLayout.addColumnData(new ColumnPixelData(100));
tableLayout.addColumnData(new ColumnPixelData(80));
tableLayout.addColumnData(new ColumnPixelData(70));
paramView.getTable().setLayout(tableLayout);
paramView.addDoubleClickListener(new IDoubleClickListener() {
@SuppressWarnings("unchecked")
public void doubleClick(DoubleClickEvent event) {
StructuredSelection sel = (StructuredSelection) event.getSelection();
Map<String, String> data = (Map<String, String>) sel.getFirstElement();
modifyParam(data);
}
});
Menu menu = new Menu(paramView.getTable().getShell(), SWT.POP_UP);
paramView.getTable().setMenu(menu);
final MenuItem addMenuItem = new MenuItem(menu, SWT.PUSH);
addMenuItem.setText(Messages.mnuSqlmapAdd);
addMenuItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
addParameter();
}
});
final MenuItem modifyMenuItem = new MenuItem(menu, SWT.PUSH);
modifyMenuItem.setText(Messages.mnuSqlmapModify);
modifyMenuItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
modifyParameterByCurrentSelected();
}
});
final MenuItem delMenuItem = new MenuItem(menu, SWT.PUSH);
delMenuItem.setText(Messages.mnuSqlmapRemove);
delMenuItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
if (CommonUITool.openConfirmBox(Messages.msgSqlmapRemove)) {
removeParameterByCurrentSelected();
}
}
});
}
use of com.cubrid.common.ui.spi.TableContentProvider in project cubrid-manager by CUBRID.
the class CommonUITool method createCheckBoxTableViewer.
/**
*
* Create the common checkbox table viewer that can be sorted by
* TableViewerSorter object,this viewer's input object must be
* List<Map<String,Object>> and Map's key must be column index,Map's value
* of the column must be String.
*
* @param parent the parent composite
* @param sorter the table sorter
* @param columnNameArr the column name array
* @param gridData the gridData layout object
* @return the TableViewer object
*/
public static TableViewer createCheckBoxTableViewer(Composite parent, ViewerSorter sorter, final String[] columnNameArr, GridData gridData) {
final CheckboxTableViewer tableViewer = CheckboxTableViewer.newCheckList(parent, SWT.V_SCROLL | SWT.MULTI | SWT.BORDER | SWT.H_SCROLL | SWT.FULL_SELECTION);
tableViewer.setContentProvider(new TableContentProvider());
tableViewer.setLabelProvider(new TableLabelProvider());
if (sorter != null) {
tableViewer.setSorter(sorter);
}
tableViewer.getTable().setLinesVisible(true);
tableViewer.getTable().setHeaderVisible(true);
tableViewer.getTable().setLayoutData(gridData);
for (int i = 0; i < columnNameArr.length; i++) {
final TableColumn tblColumn = new TableColumn(tableViewer.getTable(), SWT.LEFT);
tblColumn.setText(columnNameArr[i]);
if (sorter != null) {
tblColumn.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
TableColumn column = (TableColumn) event.widget;
int j = 0;
for (j = 0; j < columnNameArr.length; j++) {
if (column.getText().equals(columnNameArr[j])) {
break;
}
}
TableViewerSorter sorter = ((TableViewerSorter) tableViewer.getSorter());
if (sorter == null) {
return;
}
sorter.doSort(j);
tableViewer.getTable().setSortColumn(column);
tableViewer.getTable().setSortDirection(sorter.isAsc() ? SWT.UP : SWT.DOWN);
tableViewer.refresh();
packTable(tableViewer);
}
});
}
tblColumn.pack();
}
return tableViewer;
}
use of com.cubrid.common.ui.spi.TableContentProvider in project cubrid-manager by CUBRID.
the class ObjectInfoComposite method initViewColumn.
/**
* Initial view column setting
*
* @param composite
*/
private void initViewColumn(Composite composite) {
viewColTableViewer = new TableViewer(composite, SWT.V_SCROLL | SWT.BORDER | SWT.H_SCROLL | SWT.FULL_SELECTION);
viewColTableViewer.setContentProvider(new TableContentProvider());
viewColTableViewer.setLabelProvider(new TableLabelProvider());
viewColTableViewer.getTable().setLinesVisible(true);
viewColTableViewer.getTable().setHeaderVisible(true);
final TableColumn nameColumn = new TableColumn(viewColTableViewer.getTable(), SWT.NONE);
nameColumn.setText(Messages.tblColViewName);
nameColumn.pack();
final TableColumn dataTypeColumn = new TableColumn(viewColTableViewer.getTable(), SWT.NONE);
dataTypeColumn.setText(Messages.tblColViewDataType);
dataTypeColumn.pack();
final TableColumn defaultColumn = new TableColumn(viewColTableViewer.getTable(), SWT.NONE);
defaultColumn.setText(Messages.tblColViewDefaultType);
defaultColumn.pack();
final TableColumn defaultValueColumn = new TableColumn(viewColTableViewer.getTable(), SWT.NONE);
defaultValueColumn.setText(Messages.tblColViewDefaultValue);
defaultValueColumn.pack();
}
Aggregations