Search in sources :

Example 71 with TableViewer

use of org.eclipse.jface.viewers.TableViewer in project cubrid-manager by CUBRID.

the class MultiHostConnectionDialog method createDialogArea.

@Override
protected Control createDialogArea(Composite parent) {
    Composite parentComp = (Composite) super.createDialogArea(parent);
    Composite newComp = new Composite(parentComp, SWT.NONE);
    GridData data = new GridData(GridData.FILL_BOTH);
    setTitle(Messages.titleConnectionProgress);
    setMessage(Messages.msgClickToConnect, IMessageProvider.INFORMATION);
    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);
    newComp.setLayout(layout);
    data.grabExcessHorizontalSpace = true;
    data.grabExcessVerticalSpace = true;
    newComp.setLayoutData(data);
    viewer = new TableViewer(newComp, SWT.FULL_SELECTION | SWT.MULTI | SWT.BORDER);
    final GridData gdColumnsTable = new GridData(SWT.FILL, SWT.FILL, true, true);
    table = viewer.getTable();
    table.setLayoutData(gdColumnsTable);
    table.setHeaderVisible(true);
    table.setLinesVisible(true);
    {
        TableColumn icons = new TableColumn(table, SWT.CENTER, 0);
        icons.setText("");
        icons.setWidth(20);
        TableColumn taskName = new TableColumn(table, SWT.CENTER, 1);
        taskName.setText(Messages.colTaskName);
        taskName.setWidth(150);
        TableColumn taskProgress = new TableColumn(table, SWT.CENTER, 2);
        taskProgress.setText(Messages.colTaskProgress);
        taskProgress.setWidth(300);
        TableColumn details = new TableColumn(table, SWT.CENTER, 3);
        details.setText(Messages.colTaskDetails);
        details.setWidth(300);
    }
    initTask();
    Control control = super.createDialogArea(parent);
    return control;
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) Control(org.eclipse.swt.widgets.Control) Composite(org.eclipse.swt.widgets.Composite) GridData(org.eclipse.swt.layout.GridData) TableViewer(org.eclipse.jface.viewers.TableViewer) TableColumn(org.eclipse.swt.widgets.TableColumn)

Example 72 with TableViewer

use of org.eclipse.jface.viewers.TableViewer in project cubrid-manager by CUBRID.

the class MultiHostEditDialog method createDialogArea.

protected Control createDialogArea(Composite parent) {
    getShell().setText(Messages.multiEditServerDialogTitle);
    Composite parentComp = (Composite) super.createDialogArea(parent);
    setTitle(Messages.multiEditServerDialogTitle);
    setMessage(Messages.multiEditServerDialogMessages);
    serverTable = new TableViewer(parentComp, SWT.SINGLE | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION);
    GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1);
    serverTable.getTable().setLayoutData(gridData);
    serverTable.getTable().setHeaderVisible(true);
    serverTable.getTable().setLinesVisible(true);
    @SuppressWarnings("all") final TableViewerColumn //emty column can make image not take no use place at first column
    empty = new TableViewerColumn(serverTable, SWT.NONE);
    final TableViewerColumn columnName = new TableViewerColumn(serverTable, SWT.NONE);
    columnName.getColumn().setWidth(130);
    columnName.getColumn().setText(Messages.multiEditServerDialogColumnName);
    columnName.setEditingSupport(new HostEditingSupport(0, serverTable));
    final TableViewerColumn columnHost = new TableViewerColumn(serverTable, SWT.NONE);
    columnHost.getColumn().setWidth(100);
    columnHost.getColumn().setText(Messages.multiConnectServerDialogColumnHostAddress);
    columnHost.setEditingSupport(new HostEditingSupport(1, serverTable));
    final TableViewerColumn columnPort = new TableViewerColumn(serverTable, SWT.NONE);
    columnPort.getColumn().setWidth(50);
    columnPort.getColumn().setText(Messages.multiEditServerDialogColumnPort);
    columnPort.setEditingSupport(new HostEditingSupport(2, serverTable));
    final TableViewerColumn columnDriver = new TableViewerColumn(serverTable, SWT.NONE);
    columnDriver.getColumn().setWidth(160);
    columnDriver.getColumn().setText(Messages.multiEditServerDialogColumnDriver);
    columnDriver.setEditingSupport(new HostEditingSupport(3, serverTable));
    final TableViewerColumn columnUser = new TableViewerColumn(serverTable, SWT.NONE);
    columnUser.getColumn().setWidth(80);
    columnUser.getColumn().setText(Messages.multiConnectServerDialogColumnUser);
    columnUser.setEditingSupport(new HostEditingSupport(4, serverTable));
    final TableViewerColumn columnPassword = new TableViewerColumn(serverTable, SWT.NONE);
    columnPassword.getColumn().setWidth(70);
    columnPassword.getColumn().setText(Messages.multiEditServerDialogColumnPassword);
    columnPassword.setEditingSupport(new HostEditingSupport(5, serverTable));
    final TableViewerColumn columnAutosavePassword = new TableViewerColumn(serverTable, SWT.NONE);
    columnAutosavePassword.getColumn().setWidth(40);
    columnAutosavePassword.getColumn().setText(Messages.multiEditServerDialogColumnAutosavePassword);
    columnAutosavePassword.getColumn().setToolTipText(Messages.multiEditServerDialogColumnAutosavePassword);
    columnAutosavePassword.setEditingSupport(new AutosavePasswordSupport(serverTable));
    serverTable.setContentProvider(new ServerListContentProvider());
    serverTable.setLabelProvider(new ServerListLabelProvider());
    serverTable.setInput(tmpServerList);
    return parentComp;
}
Also used : Composite(org.eclipse.swt.widgets.Composite) GridData(org.eclipse.swt.layout.GridData) TableViewer(org.eclipse.jface.viewers.TableViewer) TableViewerColumn(org.eclipse.jface.viewers.TableViewerColumn)

Example 73 with TableViewer

use of org.eclipse.jface.viewers.TableViewer in project cubrid-manager by CUBRID.

the class NewMultiHostConnectionDialog method createDialogArea.

protected Control createDialogArea(Composite parent) {
    getShell().setText(Messages.multiConnectServerDialogTitle);
    Composite parentComp = (Composite) super.createDialogArea(parent);
    setTitle(Messages.multiConnectServerDialogTitle);
    setMessage(Messages.multiConnectServerDialogMessages);
    serverTable = new TableViewer(parentComp, SWT.SINGLE | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION);
    GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1);
    serverTable.getTable().setLayoutData(gridData);
    serverTable.getTable().setHeaderVisible(true);
    serverTable.getTable().setLinesVisible(true);
    final TableViewerColumn columnHost = new TableViewerColumn(serverTable, SWT.CENTER);
    columnHost.getColumn().setWidth(120);
    columnHost.getColumn().setText(Messages.multiConnectServerDialogColumnHostAddress);
    final TableViewerColumn columnUser = new TableViewerColumn(serverTable, SWT.CENTER);
    columnUser.getColumn().setWidth(200);
    columnUser.getColumn().setText(Messages.multiConnectServerDialogColumnUser);
    final TableViewerColumn columnErrMsg = new TableViewerColumn(serverTable, SWT.CENTER);
    columnErrMsg.getColumn().setWidth(200);
    columnErrMsg.getColumn().setText(Messages.multiConnectServerDialogColumnErrMsg);
    final TableViewerColumn columnStatus = new TableViewerColumn(serverTable, SWT.CENTER);
    columnStatus.getColumn().setWidth(100);
    columnStatus.getColumn().setText(Messages.multiConnectServerDialogColumnStatus);
    serverTable.setContentProvider(new ServerListContentProvider());
    serverTable.setLabelProvider(new ServerListLabelProvider());
    serverTable.addDoubleClickListener(new IDoubleClickListener() {

        public void doubleClick(DoubleClickEvent event) {
            IStructuredSelection selection = (IStructuredSelection) event.getSelection();
            FailedHostServerInfo multiHostConnectionFailedServerInfo = (FailedHostServerInfo) selection.getFirstElement();
            editHost(multiHostConnectionFailedServerInfo);
        }
    });
    serverTable.setInput(failedServerList);
    MenuManager menuManager = new MenuManager();
    Menu contextMenu = menuManager.createContextMenu(serverTable.getTable());
    serverTable.getTable().setMenu(contextMenu);
    Menu menu = new Menu(getShell(), SWT.POP_UP);
    final MenuItem itemEdit = new MenuItem(menu, SWT.PUSH);
    itemEdit.setText(Messages.msgConnectHostDialog);
    itemEdit.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
            IStructuredSelection selection = (StructuredSelection) serverTable.getSelection();
            FailedHostServerInfo multiHostConnectionFailedServerInfo = (FailedHostServerInfo) selection.getFirstElement();
            editHost(multiHostConnectionFailedServerInfo);
        }
    });
    menu.addMenuListener(new MenuAdapter() {

        public void menuShown(MenuEvent event) {
            IStructuredSelection selection = (IStructuredSelection) serverTable.getSelection();
            FailedHostServerInfo multiHostConnectionFailedServerInfo = (FailedHostServerInfo) selection.getFirstElement();
            if (multiHostConnectionFailedServerInfo.getCubridServer().isConnected()) {
                itemEdit.setEnabled(false);
            } else {
                itemEdit.setEnabled(true);
            }
        }
    });
    serverTable.getTable().setMenu(menu);
    return parentComp;
}
Also used : Composite(org.eclipse.swt.widgets.Composite) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) MenuAdapter(org.eclipse.swt.events.MenuAdapter) DoubleClickEvent(org.eclipse.jface.viewers.DoubleClickEvent) MenuItem(org.eclipse.swt.widgets.MenuItem) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) IDoubleClickListener(org.eclipse.jface.viewers.IDoubleClickListener) GridData(org.eclipse.swt.layout.GridData) MenuManager(org.eclipse.jface.action.MenuManager) SelectionEvent(org.eclipse.swt.events.SelectionEvent) Menu(org.eclipse.swt.widgets.Menu) TableViewer(org.eclipse.jface.viewers.TableViewer) TableViewerColumn(org.eclipse.jface.viewers.TableViewerColumn) MenuEvent(org.eclipse.swt.events.MenuEvent)

Example 74 with TableViewer

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);
}
Also used : Composite(org.eclipse.swt.widgets.Composite) ExpandItem(org.eclipse.swt.widgets.ExpandItem) BrokersStatusContentProvider(com.cubrid.cubridmanager.ui.broker.editor.BrokersStatusContentProvider) FillLayout(org.eclipse.swt.layout.FillLayout) TableViewer(org.eclipse.jface.viewers.TableViewer) BrokersStatusLabelProvider(com.cubrid.cubridmanager.ui.broker.editor.BrokersStatusLabelProvider) TableColumn(org.eclipse.swt.widgets.TableColumn)

Example 75 with TableViewer

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);
    }
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) ICellEditorListener(org.eclipse.jface.viewers.ICellEditorListener) Listener(org.eclipse.swt.widgets.Listener) Composite(org.eclipse.swt.widgets.Composite) GridData(org.eclipse.swt.layout.GridData) FocusEvent(org.eclipse.swt.events.FocusEvent) MenuEvent(org.eclipse.swt.events.MenuEvent) CubridNodeChangedEvent(com.cubrid.common.ui.spi.event.CubridNodeChangedEvent) Event(org.eclipse.swt.widgets.Event) SelectionEvent(org.eclipse.swt.events.SelectionEvent) Point(org.eclipse.swt.graphics.Point) CTabItem(org.eclipse.swt.custom.CTabItem) TableViewer(org.eclipse.jface.viewers.TableViewer) TableViewerColumn(org.eclipse.jface.viewers.TableViewerColumn)

Aggregations

TableViewer (org.eclipse.jface.viewers.TableViewer)273 GridData (org.eclipse.swt.layout.GridData)161 Composite (org.eclipse.swt.widgets.Composite)152 Table (org.eclipse.swt.widgets.Table)128 GridLayout (org.eclipse.swt.layout.GridLayout)111 SelectionEvent (org.eclipse.swt.events.SelectionEvent)105 TableColumn (org.eclipse.swt.widgets.TableColumn)91 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)79 Label (org.eclipse.swt.widgets.Label)72 TableViewerColumn (org.eclipse.jface.viewers.TableViewerColumn)70 ISelectionChangedListener (org.eclipse.jface.viewers.ISelectionChangedListener)61 Button (org.eclipse.swt.widgets.Button)61 SelectionChangedEvent (org.eclipse.jface.viewers.SelectionChangedEvent)60 ArrayContentProvider (org.eclipse.jface.viewers.ArrayContentProvider)56 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)52 DoubleClickEvent (org.eclipse.jface.viewers.DoubleClickEvent)37 IDoubleClickListener (org.eclipse.jface.viewers.IDoubleClickListener)37 ArrayList (java.util.ArrayList)28 Point (org.eclipse.swt.graphics.Point)26 Event (org.eclipse.swt.widgets.Event)26