Search in sources :

Example 26 with FocusAdapter

use of org.eclipse.swt.events.FocusAdapter in project cubrid-manager by CUBRID.

the class ImportDataFromFileDialog method handleValue.

/**
	 *
	 * Handle value modify event
	 *
	 * @param item TableItem
	 */
protected void handleValue(final TableItem item) {
    String[] items = fileColumnList.toArray(new String[] {});
    final int editColumn = 2;
    final Combo fileColumnCombo = new Combo(parameterTable, SWT.BORDER | SWT.FULL_SELECTION);
    fileColumnCombo.setItems(items);
    fileColumnCombo.setVisibleItemCount(20);
    final String paraName = item.getText(0);
    fileColumnCombo.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent event) {
            validateFileColumn(paraName, fileColumnCombo.getText());
        }
    });
    fileColumnCombo.addFocusListener(new FocusAdapter() {

        public void focusLost(FocusEvent event) {
            if (isChanging) {
                return;
            }
            isChanging = true;
            if (validateFileColumn(paraName, fileColumnCombo.getText())) {
                item.setText(editColumn, fileColumnCombo.getText());
            }
            fileColumnCombo.dispose();
            isChanging = false;
            validate();
        }
    });
    //add listener for key pressed
    fileColumnCombo.addTraverseListener(new TraverseListener() {

        public void keyTraversed(TraverseEvent event) {
            if (event.detail == SWT.TRAVERSE_RETURN) {
                if (isChanging) {
                    return;
                }
                isChanging = true;
                if (validateFileColumn(paraName, fileColumnCombo.getText())) {
                    item.setText(editColumn, fileColumnCombo.getText());
                }
                fileColumnCombo.dispose();
                isChanging = false;
                validate();
                event.doit = true;
                handleValue(item);
            } else if (event.detail == SWT.TRAVERSE_ESCAPE) {
                if (isChanging) {
                    return;
                }
                isChanging = true;
                fileColumnCombo.dispose();
                event.doit = false;
                isChanging = false;
            }
        }
    });
    tableEditor.setEditor(fileColumnCombo, item, editColumn);
    fileColumnCombo.setText(item.getText(editColumn));
    fileColumnCombo.setFocus();
}
Also used : FocusAdapter(org.eclipse.swt.events.FocusAdapter) ModifyEvent(org.eclipse.swt.events.ModifyEvent) TraverseEvent(org.eclipse.swt.events.TraverseEvent) ModifyListener(org.eclipse.swt.events.ModifyListener) TraverseListener(org.eclipse.swt.events.TraverseListener) Combo(org.eclipse.swt.widgets.Combo) FocusEvent(org.eclipse.swt.events.FocusEvent)

Example 27 with FocusAdapter

use of org.eclipse.swt.events.FocusAdapter in project cubrid-manager by CUBRID.

the class TableEditorPart method createGeneralTabItem.

/**
	 * Create general tab item
	 *
	 * @param tabFolder the object of TabFolder
	 */
private void createGeneralTabItem(final TabFolder tabFolder) {
    final TabItem generalTabItem = new TabItem(tabFolder, SWT.NONE);
    generalTabItem.setText(Messages.infoGeneralTab);
    final Composite compositeGenaral = new Composite(tabFolder, SWT.NONE);
    GridLayout gridLayout = new GridLayout();
    compositeGenaral.setLayout(gridLayout);
    generalTabItem.setControl(compositeGenaral);
    final Group group = new Group(compositeGenaral, SWT.NONE);
    group.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
    gridLayout = new GridLayout();
    gridLayout.numColumns = 2;
    group.setLayout(gridLayout);
    group.setText(Messages.lblTableInfo);
    final Label tableNameLabel = new Label(group, SWT.NONE);
    tableNameLabel.setData(Messages.dataNewKey, null);
    tableNameLabel.setText(Messages.lblTableName);
    tableNameComp = new Composite(group, SWT.NONE);
    {
        GridLayout gl = new GridLayout();
        gl.numColumns = 5;
        gl.marginWidth = 0;
        tableNameComp.setLayout(gl);
        tableNameComp.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
        tableNameText = new Text(tableNameComp, SWT.BORDER);
        tableNameText.setTextLimit(ValidateUtil.MAX_SCHEMA_NAME_LENGTH);
        {
            GridData gd = new GridData(SWT.LEFT, SWT.CENTER, false, false);
            gd.widthHint = 200;
            tableNameText.setLayoutData(gd);
        }
        tableNameText.addModifyListener(new ModifyListener() {

            public void modifyText(ModifyEvent event) {
                if (tableNameText.getText().length() == 0) {
                    CommonUITool.hideErrorBaloon(errorBaloon);
                } else if (verifyTableName()) {
                    String tableName = tableNameText.getText();
                    newSchemaInfo.setClassname(tableName);
                }
            }
        });
        tableNameText.addFocusListener(new FocusAdapter() {

            public void focusLost(FocusEvent e) {
                CommonUITool.hideErrorBaloon(errorBaloon);
            }
        });
        final Label ownerLabel = new Label(tableNameComp, SWT.NONE);
        ownerLabel.setText(Messages.lblOwner);
        ownerCombo = new Combo(tableNameComp, SWT.READ_ONLY);
        {
            GridData gd = new GridData(SWT.LEFT, SWT.CENTER, false, false);
            gd.widthHint = 100;
            ownerCombo.setLayoutData(gd);
        }
        ownerCombo.setVisibleItemCount(10);
        fillOwnerCombo();
        if (supportCharset) {
            final Label collationLabel = new Label(tableNameComp, SWT.NONE);
            collationLabel.setText(Messages.lblCollation);
            collationCombo = new Combo(tableNameComp, SWT.READ_ONLY);
            {
                GridData gd = new GridData(SWT.LEFT, SWT.CENTER, false, false);
                gd.widthHint = 100;
                collationCombo.setLayoutData(gd);
            }
            collationCombo.setVisibleItemCount(10);
            fillCollationCombo();
            String collation = collationCombo.getText();
            newSchemaInfo.setCollation(collation);
            collationCombo.addSelectionListener(new SelectionListener() {

                public void widgetSelected(SelectionEvent e) {
                    String collation = collationCombo.getText();
                    newSchemaInfo.setCollation(collation);
                }

                public void widgetDefaultSelected(SelectionEvent e) {
                }
            });
            if (!isNewTableFlag && newSchemaInfo.getCollation() != null) {
                collationCombo.setText(newSchemaInfo.getCollation());
            }
        } else {
            new Label(tableNameComp, SWT.NONE);
            new Label(tableNameComp, SWT.NONE);
        }
    }
    final Label tableDescLabel = new Label(group, SWT.NONE);
    tableDescLabel.setText(Messages.lblTableDesc);
    tableDescText = new Text(group, SWT.BORDER);
    tableDescText.setTextLimit(512);
    tableDescText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
    if (newSchemaInfo != null && newSchemaInfo.getDescription() != null) {
        tableDescText.setText(newSchemaInfo.getDescription());
    }
    tableDescText.addFocusListener(new FocusAdapter() {

        public void focusGained(FocusEvent e) {
            if (!isSupportTableComment) {
                CommonUITool.showErrorBaloon(group, tableDescText, errorBaloon, "", Messages.errNotSupportTableCommentNotice);
                tableDescText.setFocus();
            }
        }

        public void focusLost(FocusEvent e) {
            CommonUITool.hideErrorBaloon(errorBaloon);
        }
    });
    tableDescText.setEditable(isSupportTableComment);
    if (database == null) {
        return;
    }
    if (CompatibleUtil.isSupportReuseOID(database.getDatabaseInfo())) {
        reuseOIDBtn = new Button(group, SWT.CHECK);
        reuseOIDBtn.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1));
        reuseOIDBtn.setText(Messages.btnReuseOid);
        if (!isNewTableFlag) {
            reuseOIDBtn.setEnabled(false);
        }
    }
    final Label columnsLabel = new Label(compositeGenaral, SWT.NONE);
    columnsLabel.setText(Messages.lblColumn);
    // create attribute table
    columnTableView = new TableViewer(compositeGenaral, SWT.FULL_SELECTION | SWT.BORDER);
    columnTableView.setUseHashlookup(true);
    columnTableView.setColumnProperties(columnProperites);
    columnsTable = columnTableView.getTable();
    //columnsTable.pack();
    final GridData gdColumnsTable = new GridData(SWT.FILL, SWT.FILL, true, true);
    gdColumnsTable.heightHint = 189;
    columnsTable.setLayoutData(gdColumnsTable);
    columnsTable.setLinesVisible(true);
    columnsTable.setHeaderVisible(true);
    // The empty column
    final TableColumn emptyColumn = new TableColumn(columnsTable, SWT.NONE);
    emptyColumn.setWidth(0);
    // The flag column
    final TableColumn flagColumn = new TableColumn(columnsTable, SWT.RIGHT_TO_LEFT);
    flagColumn.setWidth(28);
    // NAME
    final TableColumn nameColumn = new TableColumn(columnsTable, SWT.NONE);
    nameColumn.setWidth(140);
    nameColumn.setText(Messages.tblColumnName);
    // DATATYPE
    final TableColumn dataTypeColumn = new TableColumn(columnsTable, SWT.NONE);
    dataTypeColumn.setWidth(120);
    dataTypeColumn.setText(Messages.tblColumnDataType);
    // DEFAULT
    final TableColumn defaultColumn = new TableColumn(columnsTable, SWT.NONE);
    defaultColumn.setWidth(98);
    defaultColumn.setText(Messages.tblColumnDefault);
    defaultColumn.setToolTipText(Messages.tblColumnDefaultHint);
    // AUTO INCREMENT
    final TableColumn autoIncrTableColumn = new TableColumn(columnsTable, SWT.NONE);
    autoIncrTableColumn.setAlignment(SWT.LEFT);
    autoIncrTableColumn.setWidth(100);
    autoIncrTableColumn.setText(Messages.tblColumnAutoIncr);
    autoIncrTableColumn.setToolTipText(Messages.tblColumnAutoIncrHint);
    // NOT NULL
    final TableColumn notNullColumn = new TableColumn(columnsTable, SWT.NONE);
    notNullColumn.setWidth(65);
    notNullColumn.setText(Messages.tblColumnNotNull);
    notNullColumn.setAlignment(SWT.LEFT);
    notNullColumn.setToolTipText(Messages.tblColumnNotNullHint);
    // PK
    final TableColumn pkColumn = new TableColumn(columnsTable, SWT.NONE);
    pkColumn.setAlignment(SWT.CENTER);
    pkColumn.setWidth(90);
    pkColumn.setText(Messages.tblColumnPK);
    // UK
    final TableColumn uniqueColumn = new TableColumn(columnsTable, SWT.NONE);
    uniqueColumn.setWidth(55);
    uniqueColumn.setText(Messages.tblColumnUnique);
    uniqueColumn.setAlignment(SWT.LEFT);
    uniqueColumn.setToolTipText(Messages.tblColumnUniqueHint);
    // SHARED
    sharedColumn = new TableColumn(columnsTable, SWT.NONE);
    sharedColumn.setWidth(65);
    sharedColumn.setText(Messages.tblColumnShared);
    sharedColumn.setAlignment(SWT.LEFT);
    sharedColumn.setToolTipText(Messages.tblColumnSharedHint);
    if (supportCharset) {
        final TableColumn collationColumn = new TableColumn(columnsTable, SWT.NONE);
        collationColumn.setWidth(120);
        collationColumn.setText(Messages.tblColumnColumnCollation);
        collationColumn.setAlignment(SWT.LEFT);
    }
    final TableColumn descColumn = new TableColumn(columnsTable, SWT.NONE);
    descColumn.setWidth(180);
    descColumn.setText(Messages.tblColumnColumnDesc);
    descColumn.setAlignment(SWT.LEFT);
    boolean canEdit = true;
    if (!editor.isNewTableFlag() && !editor.isSupportChange()) {
        canEdit = false;
    }
    attrContentProvider = new AttributeContentProvider();
    attrLabelProvider = new AttributeLabelProvider(database.getDatabaseInfo(), newSchemaInfo, canEdit, editorAdaptor);
    columnTableView.setContentProvider(attrContentProvider);
    columnTableView.setLabelProvider(attrLabelProvider);
    CellEditor[] cellEditor = new CellEditor[columnProperites.length];
    {
        int index = 0;
        // Empty
        cellEditor[index++] = null;
        // Flag
        cellEditor[index++] = null;
        // NAME
        cellEditor[index++] = new TextCellEditor(columnsTable);
        // DATATYPE
        cellEditor[index++] = new DataTypeCellEditor((Composite) columnsTable, listDataTypes(), editorAdaptor);
        // DEFAULT
        cellEditor[index++] = new TextCellEditor(columnsTable);
        // AUTO INCREMENT
        cellEditor[index++] = new AutoIncrementCellEditor(columnsTable, editorAdaptor);
        // NOT NULL
        cellEditor[index++] = new CheckboxCellEditor(columnsTable);
        // PK
        cellEditor[index++] = new CheckboxCellEditor(columnsTable);
        // UK
        cellEditor[index++] = new CheckboxCellEditor(columnsTable);
        // SHARD
        cellEditor[index++] = new CheckboxCellEditor(columnsTable);
        // COLLATION
        if (supportCharset) {
            cellEditor[index++] = new ComboBoxCellEditor(columnsTable, getCollationArray(), SWT.READ_ONLY);
        }
        // MEMO
        cellEditor[index++] = new TextCellEditor(columnsTable);
    }
    columnTableView.setCellEditors(cellEditor);
    columnTableView.setCellModifier(new AttributeCellModifier(editorAdaptor));
    loadColumnData();
    CommonUITool.hackForYosemite(columnsTable);
    // Create button
    final Composite btnRowComposite = new Composite(compositeGenaral, SWT.NONE);
    btnRowComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
    {
        GridLayout layout = new GridLayout();
        layout.numColumns = 2;
        layout.marginWidth = 5;
        btnRowComposite.setLayout(layout);
    }
    final Composite optComposite = new Composite(btnRowComposite, SWT.NONE);
    optComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
    {
        GridLayout layout = new GridLayout();
        layout.numColumns = 1;
        layout.marginWidth = 0;
        optComposite.setLayout(layout);
    }
    final Composite btnComposite = new Composite(btnRowComposite, SWT.NONE);
    btnComposite.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false));
    {
        GridLayout layout = new GridLayout();
        layout.marginRight = 0;
        layout.numColumns = 6;
        layout.marginWidth = 0;
        btnComposite.setLayout(layout);
    }
    final Button setPkButton = new Button(btnComposite, SWT.NONE);
    setPkButton.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
    setPkButton.setText(Messages.btnPK);
    setPkButton.addSelectionListener(new PkBtnListenerOnGeneTab(isNewTableFlag));
    final GridData gdUpDown = new GridData(60, SWT.DEFAULT);
    upColumnBtn = new Button(btnComposite, SWT.NONE);
    upColumnBtn.setLayoutData(gdUpDown);
    upColumnBtn.setEnabled(false);
    upColumnBtn.setText(Messages.btnUp);
    upColumnBtn.addSelectionListener(new UpBtnListenerOnGeneTab());
    downColumnBtn = new Button(btnComposite, SWT.DOWN);
    downColumnBtn.setLayoutData(gdUpDown);
    downColumnBtn.setEnabled(false);
    downColumnBtn.setText(Messages.btnDown);
    downColumnBtn.addSelectionListener(new DownBtnListenerOnGeneTab());
    final Button addButton = new Button(btnComposite, SWT.NONE);
    final GridData gdAddButton = new GridData(SWT.LEFT, SWT.CENTER, false, false);
    gdAddButton.horizontalIndent = 10;
    addButton.setLayoutData(gdAddButton);
    addButton.setText(Messages.btnAddColumn);
    addButton.addSelectionListener(new AddBtnListenerOnGeneTab());
    deleteColumnBtn = new Button(btnComposite, SWT.NONE);
    final GridData gdDeleteButton = new GridData(SWT.LEFT, SWT.CENTER, false, false);
    gdDeleteButton.horizontalIndent = 10;
    deleteColumnBtn.setLayoutData(gdDeleteButton);
    deleteColumnBtn.setEnabled(false);
    deleteColumnBtn.setText(Messages.btnDelColumn);
    deleteColumnBtn.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            deleteColumn();
        }
    });
    columnsTable.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
            handleSelectionChangeInColumnTable();
        }
    });
    buildColumnTableMenu();
}
Also used : Group(org.eclipse.swt.widgets.Group) FocusAdapter(org.eclipse.swt.events.FocusAdapter) ModifyListener(org.eclipse.swt.events.ModifyListener) CheckboxCellEditor(org.eclipse.jface.viewers.CheckboxCellEditor) CellEditor(org.eclipse.jface.viewers.CellEditor) TextCellEditor(org.eclipse.jface.viewers.TextCellEditor) ComboBoxCellEditor(org.eclipse.jface.viewers.ComboBoxCellEditor) CheckboxCellEditor(org.eclipse.jface.viewers.CheckboxCellEditor) Label(org.eclipse.swt.widgets.Label) Combo(org.eclipse.swt.widgets.Combo) FocusEvent(org.eclipse.swt.events.FocusEvent) GridLayout(org.eclipse.swt.layout.GridLayout) ModifyEvent(org.eclipse.swt.events.ModifyEvent) Button(org.eclipse.swt.widgets.Button) SelectionEvent(org.eclipse.swt.events.SelectionEvent) Composite(org.eclipse.swt.widgets.Composite) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) ComboBoxCellEditor(org.eclipse.jface.viewers.ComboBoxCellEditor) StyledText(org.eclipse.swt.custom.StyledText) Text(org.eclipse.swt.widgets.Text) TableColumn(org.eclipse.swt.widgets.TableColumn) TabItem(org.eclipse.swt.widgets.TabItem) GridData(org.eclipse.swt.layout.GridData) TextCellEditor(org.eclipse.jface.viewers.TextCellEditor) TableViewer(org.eclipse.jface.viewers.TableViewer) SelectionListener(org.eclipse.swt.events.SelectionListener)

Example 28 with FocusAdapter

use of org.eclipse.swt.events.FocusAdapter in project dbeaver by serge-rider.

the class CustomCheckboxCellEditor method createControl.

@Override
protected Control createControl(Composite parent) {
    checkBox = new Button(parent, SWT.CHECK);
    checkBox.setFont(parent.getFont());
    checkBox.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            applyEditorValue();
            // This is needed for MacOS
            fireApplyEditorValue();
        }
    });
    checkBox.addFocusListener(new FocusAdapter() {

        @Override
        public void focusLost(FocusEvent e) {
            CustomCheckboxCellEditor.this.focusLost();
        }
    });
    return checkBox;
}
Also used : FocusAdapter(org.eclipse.swt.events.FocusAdapter) Button(org.eclipse.swt.widgets.Button) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) SelectionEvent(org.eclipse.swt.events.SelectionEvent) FocusEvent(org.eclipse.swt.events.FocusEvent)

Example 29 with FocusAdapter

use of org.eclipse.swt.events.FocusAdapter in project cubrid-manager by CUBRID.

the class EditMultiHostStatisticItemDialog method createDialogArea.

/**
	 * Creates and returns the contents of the upper part of this dialog (above
	 * the button bar).
	 * 
	 * @param parent The parent composite to contain the dialog area
	 * @return the dialog area control
	 */
protected Control createDialogArea(Composite parent) {
    final Composite parentComp = (Composite) super.createDialogArea(parent);
    final int DEFAULT_WIDTH = 80;
    Composite compHost = new Composite(parentComp, SWT.RESIZE);
    compHost.setLayout(new FillLayout());
    compHost.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    hostTableViewer = new TableViewer(compHost, SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.MULTI | SWT.BORDER);
    hostTableViewer.getTable().setHeaderVisible(true);
    hostTableViewer.getTable().setLinesVisible(true);
    hostTableViewer.addDoubleClickListener(new IDoubleClickListener() {

        public void doubleClick(DoubleClickEvent event) {
            TableItem[] tableItems = hostTableViewer.getTable().getSelection();
            StatisticChartHost hostItem = (StatisticChartHost) tableItems[0].getData();
            openAddStatisticHostDialog(hostItem, hostList.size() == 1, false);
        }
    });
    //Host Name
    final TableViewerColumn nameColumn = new TableViewerColumn(hostTableViewer, SWT.LEFT);
    nameColumn.getColumn().setWidth(DEFAULT_WIDTH);
    nameColumn.getColumn().setText(Messages.lblHostName);
    //IP
    final TableViewerColumn ipColumn = new TableViewerColumn(hostTableViewer, SWT.LEFT);
    ipColumn.getColumn().setWidth(DEFAULT_WIDTH);
    ipColumn.getColumn().setText(Messages.lblIp);
    //Port
    final TableViewerColumn portColumn = new TableViewerColumn(hostTableViewer, SWT.LEFT);
    portColumn.getColumn().setWidth(50);
    portColumn.getColumn().setText(Messages.lblPort);
    //Data Type
    final TableViewerColumn dataTypeColumn = new TableViewerColumn(hostTableViewer, SWT.LEFT);
    dataTypeColumn.getColumn().setWidth(DEFAULT_WIDTH);
    dataTypeColumn.getColumn().setText(Messages.lblDataType);
    //Time Type
    final TableViewerColumn timeTypeColumn = new TableViewerColumn(hostTableViewer, SWT.LEFT);
    timeTypeColumn.getColumn().setWidth(DEFAULT_WIDTH);
    timeTypeColumn.getColumn().setText(Messages.lblTimeType);
    //Database Name
    final TableViewerColumn dbNameColumn = new TableViewerColumn(hostTableViewer, SWT.LEFT);
    dbNameColumn.getColumn().setWidth(DEFAULT_WIDTH);
    dbNameColumn.getColumn().setText(Messages.lblDbName);
    //Database Volume Name
    final TableViewerColumn volNameColumn = new TableViewerColumn(hostTableViewer, SWT.LEFT);
    volNameColumn.getColumn().setWidth(DEFAULT_WIDTH);
    volNameColumn.getColumn().setText(Messages.lblVolName);
    //Broker Name
    final TableViewerColumn brokerColumn = new TableViewerColumn(hostTableViewer, SWT.LEFT);
    brokerColumn.getColumn().setWidth(DEFAULT_WIDTH);
    brokerColumn.getColumn().setText(Messages.lblBrokerName);
    //Metric
    final TableViewerColumn metricColumn = new TableViewerColumn(hostTableViewer, SWT.LEFT);
    metricColumn.getColumn().setWidth(DEFAULT_WIDTH);
    metricColumn.getColumn().setText(Messages.lblMetric);
    hostTableViewer.setContentProvider(new HostTableViewerContentProvider());
    hostTableViewer.setLabelProvider(new HostTableViewerLabelProvider());
    hostTableViewer.getTable().addFocusListener(new FocusAdapter() {

        @Override
        public void focusGained(FocusEvent event) {
            ActionManager.getInstance().changeFocusProvider(hostTableViewer.getTable());
        }
    });
    hostTableViewer.getTable().addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            TableItem[] items = hostTableViewer.getTable().getSelection();
            btnEditHost.setEnabled(items.length > 0);
            btnDeleteHost.setEnabled(items.length > 0);
        }
    });
    Composite compBtn = new Composite(parentComp, SWT.RESIZE);
    GridLayout layoutCompBtn = new GridLayout(6, false);
    layoutCompBtn.marginRight = 0;
    //		layoutCompBtn.numColumns = 6;
    layoutCompBtn.marginWidth = 0;
    compBtn.setLayout(layoutCompBtn);
    compBtn.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false));
    btnAddHost = new Button(compBtn, SWT.NONE);
    btnAddHost.setText(Messages.btnAddHost);
    btnAddHost.addSelectionListener(new ButtonAddHostAdapter());
    btnEditHost = new Button(compBtn, SWT.NONE);
    btnEditHost.setText(Messages.btnEditHost);
    btnEditHost.addSelectionListener(new ButtonEditHostAdapter());
    btnEditHost.setEnabled(false);
    btnDeleteHost = new Button(compBtn, SWT.NONE);
    btnDeleteHost.setText(Messages.btnDelHost);
    btnDeleteHost.addSelectionListener(new ButtonDeleteHostAdapter());
    btnDeleteHost.setEnabled(false);
    if (!isNew && statisticChartItem != null) {
        MultiHostChartItem multiHostChartItem = (MultiHostChartItem) statisticChartItem;
        type = multiHostChartItem.getType();
        timeType = TimeType.getEnumByType(multiHostChartItem.getDType());
        hostList = multiHostChartItem.getHostList();
        hostTableViewer.setInput(hostList);
    } else {
        hostList = new ArrayList<StatisticChartHost>();
    }
    return parentComp;
}
Also used : FocusAdapter(org.eclipse.swt.events.FocusAdapter) Composite(org.eclipse.swt.widgets.Composite) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) DoubleClickEvent(org.eclipse.jface.viewers.DoubleClickEvent) FillLayout(org.eclipse.swt.layout.FillLayout) FocusEvent(org.eclipse.swt.events.FocusEvent) GridLayout(org.eclipse.swt.layout.GridLayout) MultiHostChartItem(com.cubrid.cubridmanager.core.monstatistic.model.MultiHostChartItem) Button(org.eclipse.swt.widgets.Button) IDoubleClickListener(org.eclipse.jface.viewers.IDoubleClickListener) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) TableViewer(org.eclipse.jface.viewers.TableViewer) TableViewerColumn(org.eclipse.jface.viewers.TableViewerColumn) StatisticChartHost(com.cubrid.cubridmanager.core.monstatistic.model.StatisticChartHost)

Example 30 with FocusAdapter

use of org.eclipse.swt.events.FocusAdapter in project knime-core by knime.

the class ConfigureMetaNodePortsPage method createTopPart.

private void createTopPart(final Composite parent) {
    // top part
    Composite composite = new Composite(parent, SWT.TOP);
    GridLayout topLayout = new GridLayout();
    topLayout.numColumns = 2;
    composite.setLayout(topLayout);
    GridData gridData = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL);
    composite.setLayoutData(gridData);
    // label
    Label label = new Label(composite, SWT.NONE);
    label.setText("Metanode Name:");
    gridData = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING, GridData.VERTICAL_ALIGN_CENTER, false, false);
    label.setLayoutData(gridData);
    // text field
    m_name = new Text(composite, SWT.BORDER);
    gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL | GridData.VERTICAL_ALIGN_CENTER);
    m_name.setLayoutData(gridData);
    m_name.addFocusListener(new FocusAdapter() {

        @Override
        public void focusLost(final FocusEvent e) {
            updateStatus();
        }

        @Override
        public void focusGained(final FocusEvent e) {
            m_name.selectAll();
        }
    });
}
Also used : FocusAdapter(org.eclipse.swt.events.FocusAdapter) GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) GridData(org.eclipse.swt.layout.GridData) Label(org.eclipse.swt.widgets.Label) Text(org.eclipse.swt.widgets.Text) FocusEvent(org.eclipse.swt.events.FocusEvent)

Aggregations

FocusAdapter (org.eclipse.swt.events.FocusAdapter)68 FocusEvent (org.eclipse.swt.events.FocusEvent)64 SelectionEvent (org.eclipse.swt.events.SelectionEvent)42 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)36 Composite (org.eclipse.swt.widgets.Composite)29 GridData (org.eclipse.swt.layout.GridData)28 Text (org.eclipse.swt.widgets.Text)26 GridLayout (org.eclipse.swt.layout.GridLayout)25 Label (org.eclipse.swt.widgets.Label)20 Button (org.eclipse.swt.widgets.Button)17 Menu (org.eclipse.swt.widgets.Menu)17 Point (org.eclipse.swt.graphics.Point)16 MenuManager (org.eclipse.jface.action.MenuManager)15 MenuItem (org.eclipse.swt.widgets.MenuItem)15 ModifyEvent (org.eclipse.swt.events.ModifyEvent)14 ModifyListener (org.eclipse.swt.events.ModifyListener)14 KeyEvent (org.eclipse.swt.events.KeyEvent)12 Combo (org.eclipse.swt.widgets.Combo)12 KeyAdapter (org.eclipse.swt.events.KeyAdapter)11 Group (org.eclipse.swt.widgets.Group)11