Search in sources :

Example 36 with TableViewerColumn

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

the class UnifyHostConfigEditor method createCubridConfTableData.

/**
	 * create table data by cubridConfConfig model
	 */
public void createCubridConfTableData() {
    //remove column
    int oldCount = cubridConfTabTableViewer.getTable().getColumnCount();
    for (int i = 0; i < oldCount; i++) {
        cubridConfTabTableViewer.getTable().getColumn(0).dispose();
    }
    //create column
    TableViewerColumn column = new TableViewerColumn(cubridConfTabTableViewer, SWT.LEFT);
    column.getColumn().setWidth(150);
    column.getColumn().setText(Messages.unifyHostConfTableColumnPropName);
    column.setEditingSupport(new PropValueEditingSupport(cubridConfTabTableViewer, 0));
    int columnIndex = 0;
    for (Entry<String, CubridConfConfig> entry : cubridConfConfigDataMap.entrySet()) {
        CubridConfConfig cubridConfConfig = entry.getValue();
        for (int i = 0; i < cubridConfConfig.getPropertyList().size(); i++) {
            TableViewerColumn propColumn = new TableViewerColumn(cubridConfTabTableViewer, SWT.LEFT);
            propColumn.getColumn().setWidth(160);
            propColumn.getColumn().setText(Messages.unifyHostCubridConfTableTitle + columnIndex);
            propColumn.setEditingSupport(new PropValueEditingSupport(cubridConfTabTableViewer, columnIndex + 1));
            propColumn.getColumn().addSelectionListener(new SelectionAdapter() {

                @SuppressWarnings("all")
                public void widgetSelected(SelectionEvent event) {
                }
            });
            columnIndex++;
        }
    }
    cubridConfTabTableViewer.setLabelProvider(new UnifyHostCubridConfTableLabelProvider());
    cubridConfTabTableViewer.setInput(cubridConfConfigListData);
    cubridConfConfigListData.clear();
    cubridConfConfigListData.addAll(unifyHostConfigUtil.parseCubridConfConfigToCommonTableValue(cubridConfConfigDataMap));
    cubridConfTabTableViewer.refresh();
}
Also used : SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) SelectionEvent(org.eclipse.swt.events.SelectionEvent) Point(org.eclipse.swt.graphics.Point) TableViewerColumn(org.eclipse.jface.viewers.TableViewerColumn) CubridConfConfig(com.cubrid.cubridmanager.ui.host.model.CubridConfConfig)

Example 37 with TableViewerColumn

use of org.eclipse.jface.viewers.TableViewerColumn 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 38 with TableViewerColumn

use of org.eclipse.jface.viewers.TableViewerColumn 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 39 with TableViewerColumn

use of org.eclipse.jface.viewers.TableViewerColumn 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)

Example 40 with TableViewerColumn

use of org.eclipse.jface.viewers.TableViewerColumn 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;
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) Button(org.eclipse.swt.widgets.Button) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) TableViewer(org.eclipse.jface.viewers.TableViewer) TableViewerColumn(org.eclipse.jface.viewers.TableViewerColumn)

Aggregations

TableViewerColumn (org.eclipse.jface.viewers.TableViewerColumn)134 TableViewer (org.eclipse.jface.viewers.TableViewer)72 Composite (org.eclipse.swt.widgets.Composite)53 GridData (org.eclipse.swt.layout.GridData)52 SelectionEvent (org.eclipse.swt.events.SelectionEvent)45 TableColumn (org.eclipse.swt.widgets.TableColumn)41 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)36 GridLayout (org.eclipse.swt.layout.GridLayout)32 ColumnLabelProvider (org.eclipse.jface.viewers.ColumnLabelProvider)28 Table (org.eclipse.swt.widgets.Table)25 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)19 DoubleClickEvent (org.eclipse.jface.viewers.DoubleClickEvent)16 IDoubleClickListener (org.eclipse.jface.viewers.IDoubleClickListener)16 Point (org.eclipse.swt.graphics.Point)15 TableColumnLayout (org.eclipse.jface.layout.TableColumnLayout)14 ColumnWeightData (org.eclipse.jface.viewers.ColumnWeightData)14 FillLayout (org.eclipse.swt.layout.FillLayout)14 Button (org.eclipse.swt.widgets.Button)14 Image (org.eclipse.swt.graphics.Image)13 Text (org.eclipse.swt.widgets.Text)11