use of org.eclipse.jface.viewers.TableViewer in project cubrid-manager by CUBRID.
the class DBSpaceLabelProvider method createBrokerInfoItem.
private void createBrokerInfoItem(ExpandBar bar, int index) {
ExpandItem brokerInfoItem = new ExpandItem(bar, SWT.NONE, index);
brokerInfoItem.setText(Messages.titleBrokerInfo);
Composite brokerComposite = new Composite(bar, SWT.None);
brokerComposite.setLayout(new FillLayout());
brokerTableViewer = new TableViewer(brokerComposite, SWT.BORDER | SWT.FULL_SELECTION);
brokerTableViewer.getTable().setHeaderVisible(true);
brokerTableViewer.getTable().setLinesVisible(true);
brokerTableViewer.setContentProvider(new BrokersStatusContentProvider());
BrokersStatusLabelProvider brokersStatusLabelProvider = new BrokersStatusLabelProvider();
brokersStatusLabelProvider.setServerInfo(serverInfo);
brokerTableViewer.setLabelProvider(brokersStatusLabelProvider);
TableColumn tblColumn = new TableColumn(brokerTableViewer.getTable(), SWT.LEFT);
tblColumn.setText(Messages.tblBrokerName);
tblColumn.setToolTipText(Messages.tipBrokerName);
tblColumn = new TableColumn(brokerTableViewer.getTable(), SWT.CENTER);
tblColumn.setText(Messages.tblBrokerStatus);
tblColumn.setToolTipText(Messages.tipBrokerStatus);
tblColumn = new TableColumn(brokerTableViewer.getTable(), SWT.LEFT);
tblColumn.setText(Messages.tblBrokerProcess);
tblColumn.setToolTipText(Messages.tipBrokerProcess);
tblColumn = new TableColumn(brokerTableViewer.getTable(), SWT.LEFT);
tblColumn.setText(Messages.tblPort);
tblColumn.setToolTipText(Messages.tipPort);
tblColumn = new TableColumn(brokerTableViewer.getTable(), SWT.LEFT);
tblColumn.setText(Messages.tblServer);
tblColumn.setToolTipText(Messages.tipServer);
tblColumn = new TableColumn(brokerTableViewer.getTable(), SWT.LEFT);
tblColumn.setText(Messages.tblQueue);
tblColumn.setToolTipText(Messages.tipQueue);
tblColumn = new TableColumn(brokerTableViewer.getTable(), SWT.LEFT);
tblColumn.setText(Messages.tblRequest);
tblColumn.setToolTipText(Messages.tipRequest);
tblColumn = new TableColumn(brokerTableViewer.getTable(), SWT.LEFT);
tblColumn.setText(Messages.tblTps);
tblColumn.setToolTipText(Messages.tipTps);
tblColumn = new TableColumn(brokerTableViewer.getTable(), SWT.LEFT);
tblColumn.setText(Messages.tblQps);
tblColumn.setToolTipText(Messages.tipQps);
tblColumn = new TableColumn(brokerTableViewer.getTable(), SWT.LEFT);
tblColumn.setText(Messages.tblLongTran);
tblColumn.setToolTipText(Messages.tipLongTran);
tblColumn = new TableColumn(brokerTableViewer.getTable(), SWT.LEFT);
tblColumn.setText(Messages.tblLongQuery);
tblColumn.setToolTipText(Messages.tipLongQuery);
tblColumn = new TableColumn(brokerTableViewer.getTable(), SWT.LEFT);
tblColumn.setText(Messages.tblErrQuery);
tblColumn.setToolTipText(Messages.tipErrQuery);
brokerInfoItem.setHeight(120);
brokerInfoItem.setExpanded(true);
brokerInfoItem.setControl(brokerComposite);
}
use of org.eclipse.jface.viewers.TableViewer in project cubrid-manager by CUBRID.
the class UnifyHostConfigEditor method createCubridCMConfTabItem.
/**
* create cubrid CM table
*/
public void createCubridCMConfTabItem() {
Composite comp = new Composite(confTabFolder, SWT.NONE);
comp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
comp.setLayout(new GridLayout(1, false));
cubridCMConfTableCTabItem = new CTabItem(confTabFolder, SWT.NONE);
cubridCMConfTableCTabItem.setText("cm.conf");
cubridCMConfTabTableViewer = new TableViewer(comp, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION);
cubridCMConfTabTableViewer.getTable().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
cubridCMConfTabTableViewer.getTable().setHeaderVisible(true);
cubridCMConfTabTableViewer.getTable().setLinesVisible(true);
cubridCMConfTabTableViewer.setUseHashlookup(true);
//create column
TableViewerColumn column = new TableViewerColumn(cubridCMConfTabTableViewer, SWT.LEFT);
column.getColumn().setWidth(0);
column.getColumn().setText("");
cubridCMConfTabTableViewer.setContentProvider(new UnifyHostCubridCMConfTableContentProvider());
cubridCMConfTabTableViewer.setLabelProvider(new UnifyHostCubridCMConfTableLabelProvider());
//use to mark click point, the right click menu use this point
cubridCMConfTabTableViewer.getTable().addListener(SWT.MouseDown, new Listener() {
public void handleEvent(Event event) {
cubridCMConfTableClickPoint = new Point(event.x, event.y);
cubridCMConfTableClickPointTiming = System.currentTimeMillis();
}
});
registerCubridCMConfTableContextMenu();
cubridCMConfTableCTabItem.setControl(comp);
if (confTabFolder.getSelection() == null) {
confTabFolder.setSelection(cubridCMConfTableCTabItem);
}
}
use of org.eclipse.jface.viewers.TableViewer in project cubrid-manager by CUBRID.
the class UnifyHostConfigDialog method createDialogArea.
protected Control createDialogArea(Composite parent) {
setTitle(Messages.unifyHostConfigDialogTitle);
setMessage(Messages.unifyHostConfigDialogMessage, IMessageProvider.INFORMATION);
Composite parentComp = (Composite) super.createDialogArea(parent);
Composite btnComposite = new Composite(parentComp, SWT.NONE);
{
btnComposite.setLayoutData(new GridData());
GridLayout layout = new GridLayout();
layout.numColumns = 2;
layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
btnComposite.setLayout(layout);
}
editCubridConfBtn = new Button(btnComposite, SWT.CHECK);
editCubridConfBtn.setText(com.cubrid.cubridmanager.ui.spi.Messages.editCubridConf + "(cubrid.conf)");
editCubridConfBtn.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
validate();
}
});
editBrokerConfBtn = new Button(btnComposite, SWT.CHECK);
editBrokerConfBtn.setText(com.cubrid.cubridmanager.ui.spi.Messages.editBrokerConf + "(cubrid_broker.conf)");
editBrokerConfBtn.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
validate();
}
});
editCMConfBtn = new Button(btnComposite, SWT.CHECK);
editCMConfBtn.setText(com.cubrid.cubridmanager.ui.spi.Messages.editCmConf + "(cm.conf)");
editCMConfBtn.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
validate();
}
});
// editHAConfBtn = new Button(btnComposite, SWT.CHECK);
// editHAConfBtn.setText(com.cubrid.cubridmanager.ui.spi.Messages.editHaConf+ "(cubrid_ha.conf)");
// editHAConfBtn.addSelectionListener(new SelectionAdapter() {
// public void widgetSelected(SelectionEvent event) {
// validate();
// }
// });
//
//
// editACLConfBtn = new Button(btnComposite, SWT.CHECK);
// editACLConfBtn.setText(Messages.unifyHostConfigDialogACLConfBtnLabel);
// editACLConfBtn.addSelectionListener(new SelectionAdapter() {
// public void widgetSelected(SelectionEvent event) {
// validate();
// }
// });
tableComposite = new Composite(parentComp, SWT.NONE);
{
GridData gd = new GridData(GridData.FILL_BOTH);
gd.horizontalSpan = 1;
gd.heightHint = 80;
tableComposite.setLayoutData(gd);
GridLayout layout = new GridLayout();
layout.numColumns = 1;
layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
tableComposite.setLayout(layout);
}
hostTableViewer = new TableViewer(tableComposite, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI | SWT.V_SCROLL);
hostTableViewer.getTable().setLayoutData(new GridData(GridData.FILL_BOTH));
hostTableViewer.getTable().setLinesVisible(true);
hostTableViewer.getTable().setHeaderVisible(false);
final TableViewerColumn databaseCol = new TableViewerColumn(hostTableViewer, SWT.NONE);
databaseCol.getColumn().setWidth(500);
databaseCol.getColumn().setText("");
hostTableViewer.setContentProvider(new HostTableContentProvider());
hostTableViewer.setLabelProvider(new HostTableLabelProvider());
registerContextMenu();
setInput();
// setAllChecked();
return parent;
}
use of org.eclipse.jface.viewers.TableViewer in project cubrid-manager by CUBRID.
the class EditMultiHostStatisticItemDialog method createDialogArea.
/**
* Creates and returns the contents of the upper part of this dialog (above
* the button bar).
*
* @param parent The parent composite to contain the dialog area
* @return the dialog area control
*/
protected Control createDialogArea(Composite parent) {
final Composite parentComp = (Composite) super.createDialogArea(parent);
final int DEFAULT_WIDTH = 80;
Composite compHost = new Composite(parentComp, SWT.RESIZE);
compHost.setLayout(new FillLayout());
compHost.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
hostTableViewer = new TableViewer(compHost, SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.MULTI | SWT.BORDER);
hostTableViewer.getTable().setHeaderVisible(true);
hostTableViewer.getTable().setLinesVisible(true);
hostTableViewer.addDoubleClickListener(new IDoubleClickListener() {
public void doubleClick(DoubleClickEvent event) {
TableItem[] tableItems = hostTableViewer.getTable().getSelection();
StatisticChartHost hostItem = (StatisticChartHost) tableItems[0].getData();
openAddStatisticHostDialog(hostItem, hostList.size() == 1, false);
}
});
//Host Name
final TableViewerColumn nameColumn = new TableViewerColumn(hostTableViewer, SWT.LEFT);
nameColumn.getColumn().setWidth(DEFAULT_WIDTH);
nameColumn.getColumn().setText(Messages.lblHostName);
//IP
final TableViewerColumn ipColumn = new TableViewerColumn(hostTableViewer, SWT.LEFT);
ipColumn.getColumn().setWidth(DEFAULT_WIDTH);
ipColumn.getColumn().setText(Messages.lblIp);
//Port
final TableViewerColumn portColumn = new TableViewerColumn(hostTableViewer, SWT.LEFT);
portColumn.getColumn().setWidth(50);
portColumn.getColumn().setText(Messages.lblPort);
//Data Type
final TableViewerColumn dataTypeColumn = new TableViewerColumn(hostTableViewer, SWT.LEFT);
dataTypeColumn.getColumn().setWidth(DEFAULT_WIDTH);
dataTypeColumn.getColumn().setText(Messages.lblDataType);
//Time Type
final TableViewerColumn timeTypeColumn = new TableViewerColumn(hostTableViewer, SWT.LEFT);
timeTypeColumn.getColumn().setWidth(DEFAULT_WIDTH);
timeTypeColumn.getColumn().setText(Messages.lblTimeType);
//Database Name
final TableViewerColumn dbNameColumn = new TableViewerColumn(hostTableViewer, SWT.LEFT);
dbNameColumn.getColumn().setWidth(DEFAULT_WIDTH);
dbNameColumn.getColumn().setText(Messages.lblDbName);
//Database Volume Name
final TableViewerColumn volNameColumn = new TableViewerColumn(hostTableViewer, SWT.LEFT);
volNameColumn.getColumn().setWidth(DEFAULT_WIDTH);
volNameColumn.getColumn().setText(Messages.lblVolName);
//Broker Name
final TableViewerColumn brokerColumn = new TableViewerColumn(hostTableViewer, SWT.LEFT);
brokerColumn.getColumn().setWidth(DEFAULT_WIDTH);
brokerColumn.getColumn().setText(Messages.lblBrokerName);
//Metric
final TableViewerColumn metricColumn = new TableViewerColumn(hostTableViewer, SWT.LEFT);
metricColumn.getColumn().setWidth(DEFAULT_WIDTH);
metricColumn.getColumn().setText(Messages.lblMetric);
hostTableViewer.setContentProvider(new HostTableViewerContentProvider());
hostTableViewer.setLabelProvider(new HostTableViewerLabelProvider());
hostTableViewer.getTable().addFocusListener(new FocusAdapter() {
@Override
public void focusGained(FocusEvent event) {
ActionManager.getInstance().changeFocusProvider(hostTableViewer.getTable());
}
});
hostTableViewer.getTable().addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
TableItem[] items = hostTableViewer.getTable().getSelection();
btnEditHost.setEnabled(items.length > 0);
btnDeleteHost.setEnabled(items.length > 0);
}
});
Composite compBtn = new Composite(parentComp, SWT.RESIZE);
GridLayout layoutCompBtn = new GridLayout(6, false);
layoutCompBtn.marginRight = 0;
// layoutCompBtn.numColumns = 6;
layoutCompBtn.marginWidth = 0;
compBtn.setLayout(layoutCompBtn);
compBtn.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false));
btnAddHost = new Button(compBtn, SWT.NONE);
btnAddHost.setText(Messages.btnAddHost);
btnAddHost.addSelectionListener(new ButtonAddHostAdapter());
btnEditHost = new Button(compBtn, SWT.NONE);
btnEditHost.setText(Messages.btnEditHost);
btnEditHost.addSelectionListener(new ButtonEditHostAdapter());
btnEditHost.setEnabled(false);
btnDeleteHost = new Button(compBtn, SWT.NONE);
btnDeleteHost.setText(Messages.btnDelHost);
btnDeleteHost.addSelectionListener(new ButtonDeleteHostAdapter());
btnDeleteHost.setEnabled(false);
if (!isNew && statisticChartItem != null) {
MultiHostChartItem multiHostChartItem = (MultiHostChartItem) statisticChartItem;
type = multiHostChartItem.getType();
timeType = TimeType.getEnumByType(multiHostChartItem.getDType());
hostList = multiHostChartItem.getHostList();
hostTableViewer.setInput(hostList);
} else {
hostList = new ArrayList<StatisticChartHost>();
}
return parentComp;
}
use of org.eclipse.jface.viewers.TableViewer in project cubrid-manager by CUBRID.
the class ChartCompositePart method createSeriesTable.
/**
* Create basic info table
*
* @param parent the parent composite
*
*/
private void createSeriesTable(Composite parent) {
final Composite comp = new Composite(parent, SWT.NONE);
GridData gdBasic = new GridData(SWT.FILL, SWT.NONE, false, false);
comp.setLayoutData(gdBasic);
GridLayout layout = new GridLayout();
layout.verticalSpacing = 0;
layout.horizontalSpacing = 0;
layout.marginLeft = 0;
layout.marginRight = 0;
layout.marginTop = 0;
layout.marginBottom = 0;
comp.setLayout(layout);
final Label label = new Label(comp, SWT.CENTER);
label.setText(Messages.tblSeriesTtl);
seriesTableViewer = new TableViewer(comp, SWT.NO_SCROLL | SWT.BORDER);
Table seriesTable = seriesTableViewer.getTable();
seriesTable.setHeaderVisible(true);
seriesTable.setLinesVisible(true);
GridData tblSeries = new GridData(SWT.FILL, SWT.TOP, true, false);
tblSeries.heightHint = CommonUITool.getHeightHintOfTable(seriesTable);
seriesTable.setLayoutData(tblSeries);
TableLayout seriesLayout = new TableLayout();
setSeriesTableLayout(seriesLayout);
seriesTable.setLayout(seriesLayout);
TableColumn tblColumn = new TableColumn(seriesTable, SWT.CENTER);
tblColumn.setText("");
tblColumn.setResizable(false);
for (Map.Entry<String, ShowSetting> entry : settingMap.entrySet()) {
tblColumn = new TableColumn(seriesTable, SWT.CENTER);
tblColumn.setText(entry.getKey());
tblColumn.setToolTipText(entry.getKey());
tblColumn.setResizable(false);
}
List<String[]> chartTblLst = new ArrayList<String[]>();
String[] arrays = valueMap.values().toArray(new String[valueMap.size()]);
String[] arrays2 = new String[arrays.length + 1];
arrays2[0] = "";
System.arraycopy(arrays, 0, arrays2, 1, arrays.length);
chartTblLst.add(arrays2);
ChartTableContentProvider chartTableContentProvider = new ChartTableContentProvider();
seriesTableViewer.setContentProvider(chartTableContentProvider);
seriesTableViewer.setLabelProvider(new ChartTableLabelProvider());
seriesTableViewer.setInput(chartTblLst);
int index = 0;
for (Map.Entry<String, ShowSetting> entry : settingMap.entrySet()) {
org.eclipse.swt.graphics.Color color = new org.eclipse.swt.graphics.Color(comp.getDisplay(), entry.getValue().getSeriesRgb());
seriesTableViewer.getTable().getItem(0).setBackground(index + 1, color);
index++;
}
seriesTable.addControlListener(new ControlAdapter() {
public void controlResized(ControlEvent event) {
updateTableLayout();
}
});
}
Aggregations