Search in sources :

Example 1 with ServerInfoTableViewerLabelProvider

use of com.cubrid.cubridmanager.ui.host.editor.ServerInfoTableViewerLabelProvider in project cubrid-manager by CUBRID.

the class ImportExportConnectionDialog method createTable.

private void createTable(Composite composite) {
    hostListView = CheckboxTableViewer.newCheckList(composite, SWT.V_SCROLL | SWT.MULTI | SWT.BORDER | SWT.H_SCROLL | SWT.FULL_SELECTION);
    hostListView.addCheckStateListener(new ICheckStateListener() {

        public void checkStateChanged(CheckStateChangedEvent event) {
            if (isExport) {
                valid();
            }
        }
    });
    final GridData gdColumnsTable = new GridData(SWT.FILL, SWT.FILL, true, true);
    gdColumnsTable.horizontalSpan = 3;
    gdColumnsTable.heightHint = 189;
    hostListView.getTable().setLayoutData(gdColumnsTable);
    hostListView.getTable().setLinesVisible(true);
    hostListView.getTable().setHeaderVisible(true);
    final TableColumn hostName = new TableColumn(hostListView.getTable(), SWT.NONE);
    hostName.setAlignment(SWT.LEFT);
    hostName.setWidth(WIDTH_NAME);
    hostName.setText(Messages.columnHeaderServerInfo);
    if (isExport) {
        hostName.setImage(CommonUIPlugin.getImage("icons/checked_green.png"));
    } else {
        hostName.setImage(CommonUIPlugin.getImage("icons/unchecked.gif"));
    }
    hostName.addListener(SWT.Selection, new Listener() {

        public void handleEvent(Event event) {
            selectAll = !selectAll;
            hostListView.setAllChecked(selectAll);
            Image image = selectAll ? CommonUIPlugin.getImage("icons/checked_green.png") : CommonUIPlugin.getImage("icons/unchecked.gif");
            hostName.setImage(image);
            hostListView.refresh();
            if (isExport) {
                valid();
            }
        }
    });
    final TableColumn hostAddress = new TableColumn(hostListView.getTable(), SWT.NONE);
    hostAddress.setAlignment(SWT.CENTER);
    hostAddress.setWidth(WIDTH_ADDRESS);
    hostAddress.setText(Messages.columnHeaderServerAddress);
    final TableColumn hostPort = new TableColumn(hostListView.getTable(), SWT.NONE);
    hostPort.setAlignment(SWT.CENTER);
    hostPort.setWidth(WIDTH_PORT);
    hostPort.setText(Messages.columnHeaderServerPort);
    final TableColumn jdbcVer = new TableColumn(hostListView.getTable(), SWT.NONE);
    jdbcVer.setAlignment(SWT.CENTER);
    jdbcVer.setWidth(WIDTH_JDBC);
    jdbcVer.setText(Messages.columnHeaderServerJdbcVersion);
    final TableColumn hostUser = new TableColumn(hostListView.getTable(), SWT.NONE);
    hostUser.setAlignment(SWT.CENTER);
    hostUser.setWidth(WIDTH_USER);
    hostUser.setText(Messages.columnHeaderServerUserName);
    //		final TableColumn savedPass = new TableColumn(hostListView.getTable(), SWT.NONE);
    //		savedPass.setAlignment(SWT.CENTER);
    //		savedPass.setWidth(WIDTH_SAVEPASS);
    //		savedPass.setText(Messages.columnHeaderServerAutoSave);
    hostListView.setContentProvider(new ServerInfoTableViewerContentProvider());
    hostListView.setLabelProvider(new ServerInfoTableViewerLabelProvider());
    if (isExport) {
        initExportTableData();
    }
}
Also used : ICheckStateListener(org.eclipse.jface.viewers.ICheckStateListener) Listener(org.eclipse.swt.widgets.Listener) ServerInfoTableViewerLabelProvider(com.cubrid.cubridmanager.ui.host.editor.ServerInfoTableViewerLabelProvider) ICheckStateListener(org.eclipse.jface.viewers.ICheckStateListener) GridData(org.eclipse.swt.layout.GridData) CheckStateChangedEvent(org.eclipse.jface.viewers.CheckStateChangedEvent) Event(org.eclipse.swt.widgets.Event) SelectionEvent(org.eclipse.swt.events.SelectionEvent) ServerInfoTableViewerContentProvider(com.cubrid.cubridmanager.ui.host.editor.ServerInfoTableViewerContentProvider) CheckStateChangedEvent(org.eclipse.jface.viewers.CheckStateChangedEvent) Image(org.eclipse.swt.graphics.Image) TableColumn(org.eclipse.swt.widgets.TableColumn)

Aggregations

ServerInfoTableViewerContentProvider (com.cubrid.cubridmanager.ui.host.editor.ServerInfoTableViewerContentProvider)1 ServerInfoTableViewerLabelProvider (com.cubrid.cubridmanager.ui.host.editor.ServerInfoTableViewerLabelProvider)1 CheckStateChangedEvent (org.eclipse.jface.viewers.CheckStateChangedEvent)1 ICheckStateListener (org.eclipse.jface.viewers.ICheckStateListener)1 SelectionEvent (org.eclipse.swt.events.SelectionEvent)1 Image (org.eclipse.swt.graphics.Image)1 GridData (org.eclipse.swt.layout.GridData)1 Event (org.eclipse.swt.widgets.Event)1 Listener (org.eclipse.swt.widgets.Listener)1 TableColumn (org.eclipse.swt.widgets.TableColumn)1