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 BrokerStatusView method createBasicTable.
/**
* Create basic info table
*
* @param comp the parent composite
*
*/
private void createBasicTable(Composite comp) {
final Composite basicComposite = new Composite(comp, SWT.NONE);
GridData gdBasic = new GridData(SWT.FILL, SWT.NONE, false, false);
basicComposite.setLayoutData(gdBasic);
basicComposite.setLayout(new GridLayout());
basicTableViewer = new TableViewer(basicComposite, SWT.NO_SCROLL | SWT.BORDER);
Table basicTable = basicTableViewer.getTable();
basicTable.setHeaderVisible(true);
basicTable.setLinesVisible(true);
GridData tblBasic = new GridData(SWT.FILL, SWT.TOP, true, false);
tblBasic.heightHint = CommonUITool.getHeightHintOfTable(basicTable);
basicTable.setLayoutData(tblBasic);
TableLayout basicLayout = new TableLayout();
setBasicLayout(basicLayout);
basicTable.setLayout(basicLayout);
basicTable.setBackground(basicComposite.getBackground());
TableColumn tblColumn = new TableColumn(basicTable, SWT.CENTER);
tblColumn.setText(Messages.tblBscPid);
tblColumn.setToolTipText(Messages.tblBscPid);
tblColumn = new TableColumn(basicTable, SWT.CENTER);
tblColumn.setText(Messages.tblBscPort);
tblColumn.setToolTipText(Messages.tblBscPort);
tblColumn = new TableColumn(basicTable, SWT.CENTER);
tblColumn.setText(Messages.tblBscJobQueue);
tblColumn.setToolTipText(Messages.tblBscJobQueue);
tblColumn = new TableColumn(basicTable, SWT.CENTER);
tblColumn.setText(Messages.tblBscAutoAddAs);
tblColumn.setToolTipText(Messages.tblBscAutoAddAs);
tblColumn = new TableColumn(basicTable, SWT.CENTER);
tblColumn.setText(Messages.tblBscSqlLogMode);
tblColumn.setToolTipText(Messages.tblBscSqlLogMode);
tblColumn = new TableColumn(basicTable, SWT.CENTER);
tblColumn.setText(Messages.tblBscLongTranTime);
tblColumn.setToolTipText(Messages.tblBscLongTranTime);
tblColumn = new TableColumn(basicTable, SWT.CENTER);
tblColumn.setText(Messages.tblBscLongQueryTime);
tblColumn.setToolTipText(Messages.tblBscLongQueryTime);
tblColumn = new TableColumn(basicTable, SWT.CENTER);
tblColumn.setText(Messages.tblBscSessionTimeout);
tblColumn.setToolTipText(Messages.tblBscSessionTimeout);
tblColumn = new TableColumn(basicTable, SWT.CENTER);
tblColumn.setText(Messages.tblBscKeepConn);
tblColumn.setToolTipText(Messages.tblBscKeepConn);
tblColumn = new TableColumn(basicTable, SWT.CENTER);
tblColumn.setText(Messages.tblBscAccessMode);
tblColumn.setToolTipText(Messages.tblBscAccessMode);
basicTableViewer.setContentProvider(new BrokerBasicInfoContentProvider());
ServerInfo serverInfo = cubridNode.getServer().getServerInfo();
BrokerBasicInfoLabelProvider basicInfoLabelProvider = new BrokerBasicInfoLabelProvider();
basicInfoLabelProvider.setServerInfo(serverInfo);
basicTableViewer.setLabelProvider(basicInfoLabelProvider);
basicTableViewer.setInput(basicInfoLst);
}
use of org.eclipse.jface.viewers.TableViewer in project cubrid-manager by CUBRID.
the class BackupDatabaseDialog method createBackupHistoryComp.
/**
*
* Create backup history information tab composite
*
* @return the composite
*/
private Composite createBackupHistoryComp() {
Composite composite = new Composite(tabFolder, SWT.NONE);
composite.setLayoutData(new GridData(GridData.FILL_BOTH));
GridLayout layout = new GridLayout();
composite.setLayout(layout);
Label tipLabel = new Label(composite, SWT.LEFT | SWT.WRAP);
tipLabel.setText(Messages.msgBackupHistoryList);
GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
tipLabel.setLayoutData(gridData);
final String[] columnNameArr = new String[] { Messages.tblColumnBackupLevel, Messages.tblColumnBackupDate, Messages.tblColumnSize, Messages.tblColumnBackupPath };
TableViewer historyTableViewer = CommonUITool.createCommonTableViewer(composite, new TableViewerSorter(), columnNameArr, CommonUITool.createGridData(GridData.FILL_BOTH, 1, 1, 400, 200));
historyTableViewer.setInput(getBackupHistoryInfoList());
Table historyTable = historyTableViewer.getTable();
for (int i = 0; i < historyTable.getColumnCount(); i++) {
historyTable.getColumn(i).pack();
}
return composite;
}
use of org.eclipse.jface.viewers.TableViewer in project cubrid-manager by CUBRID.
the class DeleteDatabaseDialog method createDirectoryList.
/**
* create the directory list
*
* @param composite the parent composite
*/
private void createDirectoryList(Composite composite) {
final CLabel volumeInformationOfLabel = new CLabel(composite, SWT.NONE);
volumeInformationOfLabel.setText(Messages.lblVolumeInfomation);
final String[] columnNameArr = new String[] { Messages.tblColDelDbVolName, Messages.tblColDelDbVolPath, Messages.tblColDelDbChangeDate, Messages.tblColDelDbVolType, Messages.tblColDelDbTotalSize, Messages.tblColDelDbRemainSize, Messages.tblColDelDbVolSize };
tableViewer = CommonUITool.createCommonTableViewer(composite, new TableViewerSorter() {
@SuppressWarnings("unchecked")
public int compare(Viewer viewer, Object e1, Object e2) {
if (!(e1 instanceof Map) || !(e2 instanceof Map)) {
return 0;
}
int rc = 0;
Map<String, String> map1 = (Map<String, String>) e1;
Map<String, String> map2 = (Map<String, String>) e2;
if (column == 5 || column == 4) {
rc = CommonUITool.str2Int((String) map1.get("" + column)) - CommonUITool.str2Int((String) map2.get("" + column));
} else if (column == 6) {
double r = CommonUITool.str2Double((String) map1.get("" + column)) - CommonUITool.str2Double((String) map2.get("" + column));
if (r == 0) {
rc = 0;
} else {
rc = r > 0 ? 1 : -1;
}
} else {
String str1 = (String) map1.get("" + column);
String str2 = (String) map2.get("" + column);
rc = str1.compareTo(str2);
}
// If descending order, flip the direction
if (direction == DESCENDING) {
rc = -rc;
}
return rc;
}
}, columnNameArr, CommonUITool.createGridData(GridData.FILL_BOTH, 1, 1, -1, 200));
volumeTable = tableViewer.getTable();
}
use of org.eclipse.jface.viewers.TableViewer in project cubrid-manager by CUBRID.
the class JobAutoDashboardEditorPart method createQueryPlanInfoTable.
public void createQueryPlanInfoTable(Composite parent) {
parent.setLayout(new GridLayout(1, false));
ToolBar toolBar = new ToolBar(parent, SWT.RIGHT);
toolBar.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
ToolItem refreshItem = new ToolItem(toolBar, SWT.PUSH);
refreshItem.setText(com.cubrid.common.ui.cubrid.table.Messages.tablesDetailInfoPartRefreshBtn);
refreshItem.setImage(CommonUIPlugin.getImage("icons/action/refresh.png"));
refreshItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(final SelectionEvent event) {
refreshQueryPlan();
}
});
ToolItem createItem = new ToolItem(toolBar, SWT.PUSH);
createItem.setText(Messages.jobAutoInfoDetailPartCreateQueryPlanBtn);
createItem.setImage(CubridManagerUIPlugin.getImage("icons/action/auto_query_add.png"));
createItem.setEnabled(canAddOrEdit);
createItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(final SelectionEvent event) {
addQueryPlan();
}
});
ToolItem editItem = new ToolItem(toolBar, SWT.PUSH);
editItem.setText(Messages.jobAutoInfoDetailPartEditQueryPlanBtn);
editItem.setImage(CubridManagerUIPlugin.getImage("icons/action/auto_query_edit.png"));
editItem.setEnabled(canAddOrEdit);
editItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(final SelectionEvent event) {
editQueryPlan();
}
});
ToolItem deleteItem = new ToolItem(toolBar, SWT.PUSH);
deleteItem.setText(Messages.jobAutoInfoDetailPartDeleteQueryPlanBtn);
deleteItem.setImage(CubridManagerUIPlugin.getImage("icons/action/auto_query_delete.png"));
deleteItem.setEnabled(canAddOrEdit);
deleteItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(final SelectionEvent event) {
deleteQueryPlan();
}
});
ToolItem openLogItem = new ToolItem(toolBar, SWT.PUSH);
openLogItem.setText(Messages.jobAutoInfoDetailPartOpenQueryLogBtn);
openLogItem.setImage(CubridManagerUIPlugin.getImage("icons/action/auto_log.png"));
openLogItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(final SelectionEvent event) {
openQueryPlanLog();
}
});
final Composite tableComposite = new Composite(parent, SWT.NONE);
tableComposite.setLayout(new FillLayout());
tableComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
queryPlanInfoTable = new TableViewer(tableComposite, SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.MULTI | SWT.BORDER);
queryPlanInfoTable.getTable().setHeaderVisible(true);
queryPlanInfoTable.getTable().setLinesVisible(true);
queryPlanInfoTable.addDoubleClickListener(new IDoubleClickListener() {
public void doubleClick(DoubleClickEvent event) {
editQueryPlan();
}
});
final TableViewerColumn nameColumn = new TableViewerColumn(queryPlanInfoTable, SWT.LEFT);
nameColumn.getColumn().setWidth(120);
nameColumn.getColumn().setText(Messages.queryPlanInfoTableNameColumn);
final TableViewerColumn periodTypeColumn = new TableViewerColumn(queryPlanInfoTable, SWT.LEFT);
periodTypeColumn.getColumn().setWidth(100);
periodTypeColumn.getColumn().setText(Messages.queryPlanInfoTablePeriodTypeColumn);
final TableViewerColumn periodDetailColumn = new TableViewerColumn(queryPlanInfoTable, SWT.LEFT);
periodDetailColumn.getColumn().setWidth(150);
periodDetailColumn.getColumn().setText(Messages.queryPlanInfoTablePeriodDetailColumn);
final TableViewerColumn queryTimeColumn = new TableViewerColumn(queryPlanInfoTable, SWT.LEFT);
queryTimeColumn.getColumn().setWidth(90);
queryTimeColumn.getColumn().setText(Messages.queryPlanInfoTablePeriodTimeColumn);
if (isSupportPeriodicAutoJob) {
final TableViewerColumn queryIntervalColumn = new TableViewerColumn(queryPlanInfoTable, SWT.LEFT);
queryIntervalColumn.getColumn().setWidth(100);
queryIntervalColumn.getColumn().setText(Messages.queryPlanInfoTablePeriodIntervalColumn);
}
final TableViewerColumn queryColumn = new TableViewerColumn(queryPlanInfoTable, SWT.LEFT);
queryColumn.getColumn().setWidth(200);
queryColumn.getColumn().setText(Messages.queryPlanInfoTableQueryColumn);
queryPlanInfoTable.setContentProvider(new QueryPlanTableViewerContentProvider());
queryPlanInfoTable.setLabelProvider(new QueryPlanTableViewerLabelProvider());
MenuManager menuManager = new MenuManager();
menuManager.setRemoveAllWhenShown(true);
Menu contextMenu = menuManager.createContextMenu(queryPlanInfoTable.getTable());
queryPlanInfoTable.getTable().setMenu(contextMenu);
Menu menu = new Menu(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), SWT.POP_UP);
final MenuItem createMenuItem = new MenuItem(menu, SWT.PUSH);
createMenuItem.setText(Messages.jobAutoInfoDetailPartCreateQueryPlanBtn);
createMenuItem.setImage(CubridManagerUIPlugin.getImage("icons/action/auto_query_add.png"));
createMenuItem.setEnabled(canAddOrEdit);
createMenuItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
addQueryPlan();
}
});
final MenuItem editMenuItem = new MenuItem(menu, SWT.PUSH);
editMenuItem.setText(Messages.jobAutoInfoDetailPartEditQueryPlanBtn);
editMenuItem.setImage(CubridManagerUIPlugin.getImage("icons/action/auto_query_edit.png"));
editMenuItem.setEnabled(canAddOrEdit);
editMenuItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
editQueryPlan();
}
});
final MenuItem dropMenuItem = new MenuItem(menu, SWT.PUSH);
dropMenuItem.setText(Messages.jobAutoInfoDetailPartDeleteQueryPlanBtn);
dropMenuItem.setImage(CubridManagerUIPlugin.getImage("icons/action/auto_query_delete.png"));
dropMenuItem.setEnabled(canAddOrEdit);
dropMenuItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
deleteQueryPlan();
}
});
final MenuItem openLogMenuItem = new MenuItem(menu, SWT.PUSH);
openLogMenuItem.setText(Messages.jobAutoInfoDetailPartOpenQueryLogBtn);
openLogMenuItem.setImage(CubridManagerUIPlugin.getImage("icons/action/auto_log.png"));
openLogMenuItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
openQueryPlanLog();
}
});
queryPlanInfoTable.getTable().setMenu(menu);
}
Aggregations