Search in sources :

Example 6 with TableViewerSorter

use of com.cubrid.common.ui.spi.TableViewerSorter in project cubrid-manager by CUBRID.

the class LockInfoDetailDialog method createBlockedLockHolersGroup.

/**
	 * 
	 * Create blocked lock hoders group
	 * 
	 * @param composite the parent composite
	 */
private void createBlockedLockHolersGroup(Composite composite) {
    final Group blockedLockHolersGroup = new Group(composite, SWT.NONE);
    blockedLockHolersGroup.setText(Messages.grpBlockedHolder);
    blockedLockHolersGroup.setLayoutData(new GridData(GridData.FILL_BOTH));
    GridLayout layout = new GridLayout();
    layout.marginWidth = 10;
    layout.marginHeight = 10;
    blockedLockHolersGroup.setLayout(layout);
    final String[] columnNameArr = new String[] { Messages.tblColLockTranIndex, Messages.tblColLockGrantedMode, Messages.tblColLockCount, Messages.tblColLockBlockedMode, Messages.tblColLockStartWaitingAt, Messages.tblColLockWaitForNsecs };
    blockedHolderTableViewer = CommonUITool.createCommonTableViewer(blockedLockHolersGroup, new TableViewerSorter(), columnNameArr, CommonUITool.createGridData(GridData.FILL_BOTH, 3, 1, -1, 200));
    blockedHolderTable = blockedHolderTableViewer.getTable();
    blockedHolderTableViewer.setInput(blockedHolderListData);
}
Also used : Group(org.eclipse.swt.widgets.Group) GridLayout(org.eclipse.swt.layout.GridLayout) TableViewerSorter(com.cubrid.common.ui.spi.TableViewerSorter) GridData(org.eclipse.swt.layout.GridData)

Example 7 with TableViewerSorter

use of com.cubrid.common.ui.spi.TableViewerSorter in project cubrid-manager by CUBRID.

the class LockInfoDialog method createLockSettingComposite.

/**
	 * 
	 * Create the lock setting composite
	 * 
	 * @return the composite
	 */
private Composite createLockSettingComposite() {
    final Composite composit = new Composite(tabFolder, SWT.NONE);
    composit.setLayoutData(new GridData(GridData.FILL_BOTH));
    GridLayout layout = new GridLayout();
    layout.marginWidth = 10;
    layout.marginHeight = 10;
    composit.setLayout(layout);
    final Group theLockSettingGroup = new Group(composit, SWT.NONE);
    theLockSettingGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    theLockSettingGroup.setText(Messages.grpLockSetting);
    layout = new GridLayout();
    layout.numColumns = 2;
    theLockSettingGroup.setLayout(layout);
    lockEscLabel = new Label(theLockSettingGroup, SWT.NONE);
    final GridData gdLockEscText = new GridData(SWT.FILL, SWT.FILL, false, false);
    lockEscLabel.setLayoutData(gdLockEscText);
    deadLockNumLabel = new Label(theLockSettingGroup, SWT.NONE);
    final GridData gdDeadLockNumText = new GridData(SWT.FILL, SWT.FILL, false, false);
    deadLockNumLabel.setLayoutData(gdDeadLockNumText);
    final Group clientsCurrentlyGroup = new Group(composit, SWT.NONE);
    clientsCurrentlyGroup.setLayoutData(new GridData(GridData.FILL_BOTH));
    clientsCurrentlyGroup.setText(Messages.grpClientsCur);
    layout = new GridLayout();
    clientsCurrentlyGroup.setLayout(layout);
    final String[] columnNameArr = new String[] { Messages.tblColLockInfoIndex, Messages.tblColLockInfoPname, Messages.tblColLockInfoUid, Messages.tblColLockInfoHost, Messages.tblColLockInfoPid, Messages.tblColLockInfoIsolationLevel, Messages.tblColLockInfoTimeOut };
    connTableViewer = CommonUITool.createCommonTableViewer(clientsCurrentlyGroup, new TableViewerSorter(), columnNameArr, CommonUITool.createGridData(GridData.FILL_BOTH, 3, 1, -1, 200));
    connectionList = connTableViewer.getTable();
    connTableViewer.setInput(connListData);
    return composit;
}
Also used : Group(org.eclipse.swt.widgets.Group) GridLayout(org.eclipse.swt.layout.GridLayout) TableViewerSorter(com.cubrid.common.ui.spi.TableViewerSorter) Composite(org.eclipse.swt.widgets.Composite) GridData(org.eclipse.swt.layout.GridData) Label(org.eclipse.swt.widgets.Label)

Example 8 with TableViewerSorter

use of com.cubrid.common.ui.spi.TableViewerSorter 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();
}
Also used : CLabel(org.eclipse.swt.custom.CLabel) TableViewerSorter(com.cubrid.common.ui.spi.TableViewerSorter) TableViewer(org.eclipse.jface.viewers.TableViewer) Viewer(org.eclipse.jface.viewers.Viewer) HashMap(java.util.HashMap) Map(java.util.Map)

Example 9 with TableViewerSorter

use of com.cubrid.common.ui.spi.TableViewerSorter in project cubrid-manager by CUBRID.

the class QueryLogDialog method createLockHoldersGroup.

/**
	 * Creates the Lock holders group
	 *
	 * @param composite Composite
	 */
private void createLockHoldersGroup(Composite composite) {
    final Group lockHoldersGroup = new Group(composite, SWT.NONE);
    lockHoldersGroup.setText(LOCK_HOLDERS_GROUP_NAME);
    lockHoldersGroup.setLayoutData(new GridData(GridData.FILL_BOTH));
    GridLayout layout = new GridLayout(1, true);
    layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    lockHoldersGroup.setLayout(layout);
    final String[] columnNameArr = new String[] { DATABASE, CM_USER, QUERY_ID, TIME, ERROR_CODE, DESCRIPTION };
    tableViewer = CommonUITool.createCommonTableViewer(lockHoldersGroup, new TableViewerSorter(), columnNameArr, CommonUITool.createGridData(GridData.FILL_BOTH, 1, 1, -1, 200));
    queryLogsTable = tableViewer.getTable();
    initialTableModel();
    tableViewer.setInput(queryLogsInfoTableList);
    for (int i = 0; i < queryLogsTable.getColumnCount(); i++) {
        queryLogsTable.getColumn(i).pack();
    }
    /* TOOLS-3216 Display the error log with red color */
    for (int i = 0; i < queryLogsTable.getItemCount(); i++) {
        String logDesc = (String) queryLogsInfoTableList.get(i).get("5");
        String startDesc = "start";
        String sucDesc = "success";
        if (!startDesc.equals(logDesc) && !sucDesc.equals(logDesc)) {
            queryLogsTable.getItem(i).setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
        }
    }
}
Also used : Group(org.eclipse.swt.widgets.Group) GridLayout(org.eclipse.swt.layout.GridLayout) TableViewerSorter(com.cubrid.common.ui.spi.TableViewerSorter) GridData(org.eclipse.swt.layout.GridData)

Example 10 with TableViewerSorter

use of com.cubrid.common.ui.spi.TableViewerSorter in project cubrid-manager by CUBRID.

the class BackupErrLogDialog method createLockHoldersGroup.

/**
	 * create the LockHoldersGroup
	 * 
	 * @param composite Composite
	 */
private void createLockHoldersGroup(Composite composite) {
    final Group lockHoldersGroup = new Group(composite, SWT.NONE);
    lockHoldersGroup.setText(LOCK_HOLDERS_GROUP_NAME);
    lockHoldersGroup.setLayoutData(new GridData(GridData.FILL_BOTH));
    GridLayout layout = new GridLayout(1, true);
    layout.marginWidth = 10;
    layout.marginHeight = 10;
    lockHoldersGroup.setLayout(layout);
    final String[] columnNameArr = new String[] { DATABASE, BACKUP_ID, ERROR_TIME, ERROR_DESCRIPTION };
    tableViewer = CommonUITool.createCommonTableViewer(lockHoldersGroup, new TableViewerSorter(), columnNameArr, CommonUITool.createGridData(GridData.FILL_BOTH, 1, 1, -1, 200));
    errorLogsTable = tableViewer.getTable();
    initialTableModel();
    tableViewer.setInput(errorLogsInfoTableList);
    for (int i = 0; i < errorLogsTable.getColumnCount(); i++) {
        errorLogsTable.getColumn(i).pack();
    }
    /* TOOLS-3216 Display the error log with red color */
    for (int i = 0; i < errorLogsTable.getItemCount(); i++) {
        String dbName = (String) errorLogsInfoTableList.get(i).get("0");
        String logDesc = (String) errorLogsInfoTableList.get(i).get("3");
        String startDesc = "backupdb(" + dbName + "): auto job start";
        String sucDesc = "backupdb(" + dbName + "): success";
        if (!startDesc.equals(logDesc) && !sucDesc.equals(logDesc)) {
            errorLogsTable.getItem(i).setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
        }
    }
}
Also used : Group(org.eclipse.swt.widgets.Group) GridLayout(org.eclipse.swt.layout.GridLayout) TableViewerSorter(com.cubrid.common.ui.spi.TableViewerSorter) GridData(org.eclipse.swt.layout.GridData)

Aggregations

TableViewerSorter (com.cubrid.common.ui.spi.TableViewerSorter)30 GridData (org.eclipse.swt.layout.GridData)20 GridLayout (org.eclipse.swt.layout.GridLayout)19 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)12 SelectionEvent (org.eclipse.swt.events.SelectionEvent)12 Label (org.eclipse.swt.widgets.Label)12 TableViewer (org.eclipse.jface.viewers.TableViewer)11 Composite (org.eclipse.swt.widgets.Composite)11 Group (org.eclipse.swt.widgets.Group)10 TableContentProvider (com.cubrid.common.ui.spi.TableContentProvider)7 TableColumn (org.eclipse.swt.widgets.TableColumn)7 HashMap (java.util.HashMap)6 Map (java.util.Map)6 Button (org.eclipse.swt.widgets.Button)5 TableLabelProvider (com.cubrid.common.ui.spi.TableLabelProvider)4 Table (org.eclipse.swt.widgets.Table)4 CellEditor (org.eclipse.jface.viewers.CellEditor)3 CLabel (org.eclipse.swt.custom.CLabel)3 Point (org.eclipse.swt.graphics.Point)3 CheckStateChangedEvent (org.eclipse.jface.viewers.CheckStateChangedEvent)2