Search in sources :

Example 51 with SelectionListener

use of org.eclipse.swt.events.SelectionListener in project translationstudio8 by heartsome.

the class JaretTablePrintDialog method createParameterArea.

protected void createParameterArea(Composite parent) {
    GridLayout gl = new GridLayout();
    gl.numColumns = 2;
    parent.setLayout(gl);
    _repeatHeader = new Button(parent, SWT.CHECK);
    _repeatHeader.setSelection(_configuration.getRepeatHeader());
    _repeatHeader.setText("Repeat header");
    GridData gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.horizontalSpan = 2;
    _repeatHeader.setLayoutData(gd);
    final Label scaleText = new Label(parent, SWT.RIGHT);
    scaleText.setText(getScaleText());
    gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.horizontalSpan = 2;
    scaleText.setLayoutData(gd);
    final Scale scale = new Scale(parent, SWT.HORIZONTAL);
    gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.horizontalSpan = 2;
    scale.setLayoutData(gd);
    scale.setMaximum(1000);
    scale.setMinimum(10);
    scale.setSelection((int) (_configuration.getScale() * 100));
    scale.addSelectionListener(new SelectionListener() {

        public void widgetSelected(SelectionEvent ev) {
            int val = scale.getSelection();
            double s = (double) val / 100.0;
            _configuration.setScale(s);
            scaleText.setText(getScaleText());
            updateConf();
        }

        public void widgetDefaultSelected(SelectionEvent arg0) {
        }
    });
    _pagesLabel = new Label(parent, SWT.RIGHT);
    gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.horizontalSpan = 2;
    _pagesLabel.setLayoutData(gd);
    _printerData = _pdatas[_printerCombo.getSelectionIndex()];
    Printer printer = new Printer(_printerData);
    _tablePrinter.setPrinter(printer);
    Point pages = _tablePrinter.calculatePageCount(_configuration);
    printer.dispose();
    _pagesLabel.setText(getPagesText(pages));
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) Button(org.eclipse.swt.widgets.Button) GridData(org.eclipse.swt.layout.GridData) Label(org.eclipse.swt.widgets.Label) SelectionEvent(org.eclipse.swt.events.SelectionEvent) Scale(org.eclipse.swt.widgets.Scale) Point(org.eclipse.swt.graphics.Point) Printer(org.eclipse.swt.printing.Printer) JaretTablePrinter(de.jaret.util.ui.table.JaretTablePrinter) SelectionListener(org.eclipse.swt.events.SelectionListener)

Example 52 with SelectionListener

use of org.eclipse.swt.events.SelectionListener in project translationstudio8 by heartsome.

the class ConfigureColumnsAction method createColumnControlPanel.

/**
     * Create the dialog area. TODO can be done much nicer ... but works for the first draft
     * 
     * @param parent parent composite
     * @return initialized control
     */
private Control createColumnControlPanel(Composite parent) {
    Composite panel = new Composite(parent, SWT.NULL);
    panel.setLayout(new RowLayout());
    Label l = new Label(panel, SWT.NULL);
    l.setText("Configure the columns");
    Table table = new Table(parent, SWT.CHECK | SWT.MULTI | SWT.FULL_SELECTION | SWT.BORDER | SWT.V_SCROLL);
    _chkBoxViewer = new CheckboxTableViewer(table);
    _chkBoxViewer.setContentProvider(new ColTableContentProvider());
    _chkBoxViewer.setLabelProvider(new ColTableLabelProvider());
    TableColumn column = new TableColumn(_chkBoxViewer.getTable(), SWT.LEFT);
    column.setText("Column");
    column.setWidth(100);
    _chkBoxViewer.getTable().setHeaderVisible(true);
    _chkBoxViewer.setInput("x");
    final int firstColIdx = _allowFixedColumns ? 0 : _table.getFixedColumns();
    for (int i = 0; i < _table.getTableModel().getColumnCount(); i++) {
        IColumn col = _table.getTableModel().getColumn(i);
        _chkBoxViewer.setChecked(col, _tvs.getColumnVisible(col));
    }
    table.getColumn(0).pack();
    table.addListener(SWT.Selection, new Listener() {

        public void handleEvent(Event event) {
            if (event.detail == SWT.CHECK) {
                TableItem item = (TableItem) event.item;
                IColumn col = (IColumn) item.getData();
                int idx = _tvs.getSortedColumns().indexOf(col);
                if (_allowFixedColumns || idx >= _table.getFixedColumns()) {
                    _tvs.setColumnVisible(col, item.getChecked());
                } else {
                    _chkBoxViewer.setChecked(col, _tvs.getColumnVisible(col));
                }
            }
        }
    });
    Button upButton = new Button(panel, SWT.PUSH);
    upButton.setText("up");
    upButton.addSelectionListener(new SelectionListener() {

        public void widgetSelected(SelectionEvent arg0) {
            if (_chkBoxViewer.getTable().getSelectionCount() > 0) {
                TableItem item = _chkBoxViewer.getTable().getItem(_chkBoxViewer.getTable().getSelectionIndex());
                IColumn col = (IColumn) item.getData();
                int idx = _tvs.getSortedColumns().indexOf(col);
                if (idx > firstColIdx) {
                    _tvs.getSortedColumns().remove(col);
                    _tvs.getSortedColumns().add(idx - 1, col);
                    _table.updateColumnList();
                    _table.redraw();
                    _chkBoxViewer.refresh();
                }
            }
        }

        public void widgetDefaultSelected(SelectionEvent arg0) {
        }
    });
    Button downButton = new Button(panel, SWT.PUSH);
    downButton.setText("down");
    downButton.addSelectionListener(new SelectionListener() {

        public void widgetSelected(SelectionEvent arg0) {
            if (_chkBoxViewer.getTable().getSelectionCount() > 0) {
                TableItem item = _chkBoxViewer.getTable().getItem(_chkBoxViewer.getTable().getSelectionIndex());
                IColumn col = (IColumn) item.getData();
                int idx = _tvs.getSortedColumns().indexOf(col);
                if (idx < _tvs.getSortedColumns().size() - 1) {
                    _tvs.getSortedColumns().remove(col);
                    _tvs.getSortedColumns().add(idx + 1, col);
                    _table.updateColumnList();
                    _table.redraw();
                    _chkBoxViewer.refresh();
                }
            }
        }

        public void widgetDefaultSelected(SelectionEvent arg0) {
        }
    });
    return panel;
}
Also used : Table(org.eclipse.swt.widgets.Table) JaretTable(de.jaret.util.ui.table.JaretTable) Listener(org.eclipse.swt.widgets.Listener) ILabelProviderListener(org.eclipse.jface.viewers.ILabelProviderListener) SelectionListener(org.eclipse.swt.events.SelectionListener) Composite(org.eclipse.swt.widgets.Composite) CheckboxTableViewer(org.eclipse.jface.viewers.CheckboxTableViewer) TableItem(org.eclipse.swt.widgets.TableItem) Label(org.eclipse.swt.widgets.Label) TableColumn(org.eclipse.swt.widgets.TableColumn) IColumn(de.jaret.util.ui.table.model.IColumn) Button(org.eclipse.swt.widgets.Button) RowLayout(org.eclipse.swt.layout.RowLayout) SelectionEvent(org.eclipse.swt.events.SelectionEvent) Event(org.eclipse.swt.widgets.Event) SelectionEvent(org.eclipse.swt.events.SelectionEvent) SelectionListener(org.eclipse.swt.events.SelectionListener)

Example 53 with SelectionListener

use of org.eclipse.swt.events.SelectionListener in project translationstudio8 by heartsome.

the class ConcordanceSearchDialog method initListener.

/**
	 * 初始化各控件的监听 ;
	 */
private void initListener() {
    btnSearch.addSelectionListener(new SelectionListener() {

        public void widgetSelected(SelectionEvent e) {
            initGroupIdAndSearch();
        }

        public void widgetDefaultSelected(SelectionEvent e) {
        }
    });
    cmbSearch.addKeyListener(new KeyListener() {

        public void keyPressed(KeyEvent e) {
            if (e.character == SWT.CR) {
                initGroupIdAndSearch();
            }
        }

        public void keyReleased(KeyEvent e) {
        }
    });
    btnFirst.addSelectionListener(new SelectionListener() {

        public void widgetSelected(SelectionEvent e) {
            if (curPageNum > 0 && amountPage > 0) {
                curPageNum = 1;
                if (search()) {
                    refreshPageNumText();
                }
            }
        }

        public void widgetDefaultSelected(SelectionEvent e) {
        }
    });
    btnPre.addSelectionListener(new SelectionListener() {

        public void widgetDefaultSelected(SelectionEvent e) {
        }

        public void widgetSelected(SelectionEvent e) {
            if (curPageNum > 0) {
                curPageNum--;
                if (search()) {
                    refreshPageNumText();
                }
            }
        }
    });
    btnNext.addSelectionListener(new SelectionListener() {

        public void widgetDefaultSelected(SelectionEvent e) {
        }

        public void widgetSelected(SelectionEvent e) {
            if (curPageNum < amountPage) {
                curPageNum++;
                if (search()) {
                    refreshPageNumText();
                }
            }
        }
    });
    btnLast.addSelectionListener(new SelectionListener() {

        public void widgetDefaultSelected(SelectionEvent e) {
        }

        public void widgetSelected(SelectionEvent e) {
            if (curPageNum > 0 && amountPage > 0) {
                curPageNum = amountPage;
                if (search()) {
                    refreshPageNumText();
                }
            }
        }
    });
    txtPage.addKeyListener(new KeyListener() {

        public void keyReleased(KeyEvent e) {
        }

        public void keyPressed(KeyEvent e) {
            if (e.character == SWT.CR) {
                String pageNum = txtPage.getText();
                try {
                    curPageNum = Integer.parseInt(pageNum);
                } catch (NumberFormatException e1) {
                    // LOGGER.error("NumberFormatException", e1);
                    txtPage.setText(String.valueOf(curPageNum) + splitPageSeparator + amountPage);
                    return;
                }
                if (curPageNum > amountPage) {
                    curPageNum = amountPage;
                }
                if (curPageNum < 1) {
                    curPageNum = 1;
                }
                search();
                txtPage.setText(String.valueOf(curPageNum));
            }
        }
    });
    txtPage.addFocusListener(new FocusAdapter() {

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

        @Override
        public void focusGained(FocusEvent e) {
            txtPage.setText("");
        }
    });
}
Also used : KeyEvent(org.eclipse.swt.events.KeyEvent) FocusAdapter(org.eclipse.swt.events.FocusAdapter) SelectionEvent(org.eclipse.swt.events.SelectionEvent) KeyListener(org.eclipse.swt.events.KeyListener) FocusEvent(org.eclipse.swt.events.FocusEvent) SelectionListener(org.eclipse.swt.events.SelectionListener)

Example 54 with SelectionListener

use of org.eclipse.swt.events.SelectionListener in project translationstudio8 by heartsome.

the class ProjectPropertiesPreferencePage method initListener.

private void initListener() {
    btnFieldAdd.addSelectionListener(new SelectionListener() {

        public void widgetSelected(SelectionEvent e) {
            String[] arrField = fieldList.getItems();
            InputDialog dialog = new InputDialog(getShell(), Messages.getString("preferencepage.ProjectPropertiesPreferencePage.AddDialog.title1"), Messages.getString("preferencepage.ProjectPropertiesPreferencePage.AddDialog.lbl1"), null, new InputValidator(FIELD_ADD, new ArrayList<String>(Arrays.asList(arrField))));
            if (dialog.open() == IDialogConstants.OK_ID) {
                String fieldVal = dialog.getValue();
                fieldList.add(fieldVal.trim());
            }
        }

        public void widgetDefaultSelected(SelectionEvent e) {
        }
    });
    btnFieldEdit.addSelectionListener(new SelectionListener() {

        public void widgetSelected(SelectionEvent e) {
            if (fieldList.getSelectionCount() <= 0) {
                MessageDialog.openInformation(getShell(), Messages.getString("preferencepage.ProjectPropertiesPreferencePage.msgTitle2"), Messages.getString("preferencepage.ProjectPropertiesPreferencePage.msg10"));
                return;
            } else if (fieldList.getSelectionCount() > 1) {
                MessageDialog.openInformation(getShell(), Messages.getString("preferencepage.ProjectPropertiesPreferencePage.msgTitle2"), Messages.getString("preferencepage.ProjectPropertiesPreferencePage.msg11"));
                return;
            } else {
                int selIndex = fieldList.getSelectionIndex();
                String selVal = fieldList.getSelection()[0];
                ArrayList<String> lstField = new ArrayList<String>(Arrays.asList(fieldList.getItems()));
                lstField.remove(selVal);
                InputDialog dialog = new InputDialog(getShell(), Messages.getString("preferencepage.ProjectPropertiesPreferencePage.AddDialog.title4"), Messages.getString("preferencepage.ProjectPropertiesPreferencePage.AddDialog.lbl1"), selVal, new InputValidator(FIELD_ADD, lstField));
                if (dialog.open() == IDialogConstants.OK_ID) {
                    String fieldVal = dialog.getValue().trim();
                    fieldList.remove(selIndex);
                    fieldList.add(fieldVal, selIndex);
                    fieldList.select(selIndex);
                }
            }
        }

        public void widgetDefaultSelected(SelectionEvent e) {
        }
    });
    btnFieldDel.addSelectionListener(new SelectionListener() {

        public void widgetSelected(SelectionEvent e) {
            if (fieldList.getSelectionCount() == 0) {
                MessageDialog.openInformation(getShell(), Messages.getString("preferencepage.ProjectPropertiesPreferencePage.msgTitle2"), Messages.getString("preferencepage.ProjectPropertiesPreferencePage.msg8"));
                return;
            }
            if (MessageDialog.openConfirm(getShell(), Messages.getString("preferencepage.ProjectPropertiesPreferencePage.msgTitle1"), Messages.getString("preferencepage.ProjectPropertiesPreferencePage.msg1"))) {
                fieldList.remove(fieldList.getSelectionIndices());
            }
        }

        public void widgetDefaultSelected(SelectionEvent e) {
        }
    });
    attrNameList.addSelectionListener(new SelectionListener() {

        public void widgetSelected(SelectionEvent e) {
            if (attrNameList.getSelectionCount() > 0) {
                String strSel = attrNameList.getSelection()[0];
                ArrayList<String> lstAttrVal = mapAttr.get(strSel);
                attrValList.removeAll();
                attrValList.setItems(lstAttrVal.toArray(new String[lstAttrVal.size()]));
            }
        }

        public void widgetDefaultSelected(SelectionEvent e) {
        }
    });
    btnAttrNameAdd.addSelectionListener(new SelectionListener() {

        public void widgetSelected(SelectionEvent e) {
            String[] arrAttrName = attrNameList.getItems();
            InputDialog dialog = new InputDialog(getShell(), Messages.getString("preferencepage.ProjectPropertiesPreferencePage.AddDialog.title2"), Messages.getString("preferencepage.ProjectPropertiesPreferencePage.AddDialog.lbl2"), null, new InputValidator(ATTRNAME_ADD, new ArrayList<String>(Arrays.asList(arrAttrName))));
            if (dialog.open() == IDialogConstants.OK_ID) {
                String attrName = dialog.getValue().trim();
                attrNameList.add(attrName);
                mapAttr.put(attrName, new ArrayList<String>());
                attrNameList.setSelection(new String[] { attrName });
                attrValList.removeAll();
            }
        }

        public void widgetDefaultSelected(SelectionEvent e) {
        }
    });
    btnAttrNameEdit.addSelectionListener(new SelectionListener() {

        public void widgetSelected(SelectionEvent e) {
            if (attrNameList.getSelectionCount() <= 0) {
                MessageDialog.openInformation(getShell(), Messages.getString("preferencepage.ProjectPropertiesPreferencePage.msgTitle2"), Messages.getString("preferencepage.ProjectPropertiesPreferencePage.msg10"));
                return;
            } else if (attrNameList.getSelectionCount() > 1) {
                MessageDialog.openInformation(getShell(), Messages.getString("preferencepage.ProjectPropertiesPreferencePage.msgTitle2"), Messages.getString("preferencepage.ProjectPropertiesPreferencePage.msg11"));
                return;
            } else {
                int selIndex = attrNameList.getSelectionIndex();
                String selVal = attrNameList.getSelection()[0];
                ArrayList<String> lstAttrVal = mapAttr.get(selVal);
                ArrayList<String> lstAttrName = new ArrayList<String>(Arrays.asList(attrNameList.getItems()));
                lstAttrName.remove(selVal);
                InputDialog dialog = new InputDialog(getShell(), Messages.getString("preferencepage.ProjectPropertiesPreferencePage.AddDialog.title5"), Messages.getString("preferencepage.ProjectPropertiesPreferencePage.AddDialog.lbl2"), selVal, new InputValidator(ATTRNAME_ADD, lstAttrName));
                if (dialog.open() == IDialogConstants.OK_ID) {
                    String attrNameVal = dialog.getValue().trim();
                    attrNameList.remove(selIndex);
                    attrNameList.add(attrNameVal, selIndex);
                    attrNameList.select(selIndex);
                    mapAttr.remove(selVal);
                    mapAttr.put(attrNameVal, lstAttrVal);
                }
            }
        }

        public void widgetDefaultSelected(SelectionEvent e) {
        }
    });
    btnAttrNameDel.addSelectionListener(new SelectionListener() {

        public void widgetSelected(SelectionEvent e) {
            if (attrNameList.getSelectionCount() == 0) {
                MessageDialog.openInformation(getShell(), Messages.getString("preferencepage.ProjectPropertiesPreferencePage.msgTitle2"), Messages.getString("preferencepage.ProjectPropertiesPreferencePage.msg8"));
                return;
            }
            if (MessageDialog.openConfirm(getShell(), Messages.getString("preferencepage.ProjectPropertiesPreferencePage.msgTitle1"), Messages.getString("preferencepage.ProjectPropertiesPreferencePage.msg1"))) {
                String[] arrSelName = attrNameList.getSelection();
                for (String attrName : arrSelName) {
                    mapAttr.remove(attrName);
                }
                attrNameList.remove(attrNameList.getSelectionIndices());
                if (attrNameList.getSelectionCount() > 0) {
                    String strSel = attrNameList.getSelection()[0];
                    ArrayList<String> lstAttrVal = mapAttr.get(strSel);
                    attrValList.removeAll();
                    attrValList.setItems(lstAttrVal.toArray(new String[lstAttrVal.size()]));
                } else {
                    attrValList.removeAll();
                }
            }
        }

        public void widgetDefaultSelected(SelectionEvent e) {
        }
    });
    btnAttrValAdd.addSelectionListener(new SelectionListener() {

        public void widgetSelected(SelectionEvent e) {
            if (attrNameList.getSelectionCount() != 1) {
                MessageDialog.openInformation(getShell(), Messages.getString("preferencepage.ProjectPropertiesPreferencePage.msgTitle2"), Messages.getString("preferencepage.ProjectPropertiesPreferencePage.msg9"));
                return;
            }
            String[] arrAttrVal = attrValList.getItems();
            InputDialog dialog = new InputDialog(getShell(), Messages.getString("preferencepage.ProjectPropertiesPreferencePage.AddDialog.title3"), Messages.getString("preferencepage.ProjectPropertiesPreferencePage.AddDialog.lbl3"), null, new InputValidator(ATTRVAL_ADD, new ArrayList<String>(Arrays.asList(arrAttrVal))));
            if (dialog.open() == IDialogConstants.OK_ID) {
                String attrVal = dialog.getValue().trim();
                attrValList.add(attrVal);
                String attrName = attrNameList.getSelection()[0];
                mapAttr.get(attrName).add(attrVal);
            }
        }

        public void widgetDefaultSelected(SelectionEvent e) {
        }
    });
    btnAttrValEdit.addSelectionListener(new SelectionListener() {

        public void widgetSelected(SelectionEvent e) {
            if (attrValList.getSelectionCount() <= 0) {
                MessageDialog.openInformation(getShell(), Messages.getString("preferencepage.ProjectPropertiesPreferencePage.msgTitle2"), Messages.getString("preferencepage.ProjectPropertiesPreferencePage.msg10"));
                return;
            } else if (attrValList.getSelectionCount() > 1) {
                MessageDialog.openInformation(getShell(), Messages.getString("preferencepage.ProjectPropertiesPreferencePage.msgTitle2"), Messages.getString("preferencepage.ProjectPropertiesPreferencePage.msg11"));
                return;
            } else {
                int selIndex = attrValList.getSelectionIndex();
                String selVal = attrValList.getSelection()[0];
                String attrName = attrNameList.getSelection()[0];
                ArrayList<String> lstAttrVal = new ArrayList<String>(Arrays.asList(attrValList.getItems()));
                lstAttrVal.remove(selVal);
                InputDialog dialog = new InputDialog(getShell(), Messages.getString("preferencepage.ProjectPropertiesPreferencePage.AddDialog.title6"), Messages.getString("preferencepage.ProjectPropertiesPreferencePage.AddDialog.lbl3"), selVal, new InputValidator(ATTRVAL_ADD, lstAttrVal));
                if (dialog.open() == IDialogConstants.OK_ID) {
                    String attrVal = dialog.getValue().trim();
                    attrValList.remove(selIndex);
                    attrValList.add(attrVal, selIndex);
                    attrValList.select(selIndex);
                    lstAttrVal = mapAttr.get(attrName);
                    lstAttrVal.set(selIndex, attrVal);
                }
            }
        }

        public void widgetDefaultSelected(SelectionEvent e) {
        }
    });
    btnAttrValDel.addSelectionListener(new SelectionListener() {

        public void widgetSelected(SelectionEvent e) {
            if (attrNameList.getSelectionCount() != 1) {
                MessageDialog.openInformation(getShell(), Messages.getString("preferencepage.ProjectPropertiesPreferencePage.msgTitle2"), Messages.getString("preferencepage.ProjectPropertiesPreferencePage.msg9"));
                return;
            }
            if (attrValList.getSelectionCount() == 0) {
                MessageDialog.openInformation(getShell(), Messages.getString("preferencepage.ProjectPropertiesPreferencePage.msgTitle2"), Messages.getString("preferencepage.ProjectPropertiesPreferencePage.msg8"));
                return;
            }
            if (MessageDialog.openConfirm(getShell(), Messages.getString("preferencepage.ProjectPropertiesPreferencePage.msgTitle1"), Messages.getString("preferencepage.ProjectPropertiesPreferencePage.msg1"))) {
                String attrName = attrNameList.getSelection()[0];
                String[] arrSelVal = attrValList.getSelection();
                mapAttr.get(attrName).removeAll(new ArrayList<String>(Arrays.asList(arrSelVal)));
                attrValList.remove(attrValList.getSelectionIndices());
            }
        }

        public void widgetDefaultSelected(SelectionEvent e) {
        }
    });
}
Also used : InputDialog(net.heartsome.cat.ts.ui.dialog.InputDialog) IInputValidator(org.eclipse.jface.dialogs.IInputValidator) SelectionEvent(org.eclipse.swt.events.SelectionEvent) ArrayList(java.util.ArrayList) Point(org.eclipse.swt.graphics.Point) SelectionListener(org.eclipse.swt.events.SelectionListener)

Example 55 with SelectionListener

use of org.eclipse.swt.events.SelectionListener in project translationstudio8 by heartsome.

the class AddOrEditCatalogDialog method createDialogArea.

@Override
protected Control createDialogArea(Composite parent) {
    Composite tParent = (Composite) super.createDialogArea(parent);
    GridDataFactory.fillDefaults().hint(600, 150).grab(true, true).applyTo(tParent);
    Composite contentCmp = new Composite(tParent, SWT.NONE);
    GridDataFactory.fillDefaults().grab(true, false).applyTo(contentCmp);
    GridLayoutFactory.fillDefaults().numColumns(3).applyTo(contentCmp);
    GridData labelData = new GridData(SWT.FILL, SWT.CENTER, false, false);
    // 第一行,类型选择行
    Label typeLbl = new Label(contentCmp, SWT.RIGHT | SWT.NONE);
    typeLbl.setText(Messages.getString("dialogs.AddOrEditCatalogDialog.typeLbl"));
    typeLbl.setLayoutData(labelData);
    Composite radioCmp = new Composite(contentCmp, SWT.NONE);
    radioCmp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 2, SWT.DEFAULT));
    radioCmp.setLayout(new GridLayout(4, false));
    publicBtn = new Button(radioCmp, SWT.RADIO);
    publicBtn.setText(Messages.getString("dialogs.AddOrEditCatalogDialog.publicBtn"));
    systermBtn = new Button(radioCmp, SWT.RADIO);
    systermBtn.setText(Messages.getString("dialogs.AddOrEditCatalogDialog.systermBtn"));
    uriBtn = new Button(radioCmp, SWT.RADIO);
    uriBtn.setText(Messages.getString("dialogs.AddOrEditCatalogDialog.uriBtn"));
    nextCataBtn = new Button(radioCmp, SWT.RADIO);
    nextCataBtn.setText(Messages.getString("dialogs.AddOrEditCatalogDialog.nextCataBtn"));
    // 第二行--id行
    idLbl = new Label(contentCmp, SWT.RIGHT);
    idLbl.setText(Messages.getString("dialogs.AddOrEditCatalogDialog.idLbl"));
    GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(idLbl);
    idTxt = new Text(contentCmp, SWT.BORDER);
    idTxt.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 2, SWT.DEFAULT));
    // 第三行--url选择行
    Label urlLbl = new Label(contentCmp, SWT.RIGHT);
    urlLbl.setText(Messages.getString("dialogs.AddOrEditCatalogDialog.urlLbl"));
    GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(urlLbl);
    urlTxt = new Text(contentCmp, SWT.BORDER);
    urlTxt.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
    urlTxt.setEditable(false);
    Button browseBtn = new Button(contentCmp, SWT.NONE);
    browseBtn.setText(Messages.getString("dialogs.AddOrEditCatalogDialog.browseBtn"));
    browseBtn.addSelectionListener(new SelectionListener() {

        public void widgetSelected(SelectionEvent e) {
            browseFiles();
        }

        public void widgetDefaultSelected(SelectionEvent e) {
            browseFiles();
        }
    });
    publicBtn.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            displayIdTxt(true);
        }
    });
    systermBtn.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            displayIdTxt(true);
        }
    });
    uriBtn.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            displayIdTxt(true);
        }
    });
    nextCataBtn.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            displayIdTxt(false);
        }
    });
    return tParent;
}
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) Label(org.eclipse.swt.widgets.Label) SelectionEvent(org.eclipse.swt.events.SelectionEvent) Text(org.eclipse.swt.widgets.Text) SelectionListener(org.eclipse.swt.events.SelectionListener)

Aggregations

SelectionListener (org.eclipse.swt.events.SelectionListener)711 SelectionEvent (org.eclipse.swt.events.SelectionEvent)665 GridData (org.eclipse.swt.layout.GridData)411 Button (org.eclipse.swt.widgets.Button)409 Composite (org.eclipse.swt.widgets.Composite)381 GridLayout (org.eclipse.swt.layout.GridLayout)374 Label (org.eclipse.swt.widgets.Label)256 Text (org.eclipse.swt.widgets.Text)152 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)140 Group (org.eclipse.swt.widgets.Group)137 ModifyListener (org.eclipse.swt.events.ModifyListener)113 ModifyEvent (org.eclipse.swt.events.ModifyEvent)112 Combo (org.eclipse.swt.widgets.Combo)101 ISelectionChangedListener (org.eclipse.jface.viewers.ISelectionChangedListener)69 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)69 SelectionChangedEvent (org.eclipse.jface.viewers.SelectionChangedEvent)69 FormData (org.eclipse.swt.layout.FormData)69 Event (org.eclipse.swt.widgets.Event)69 FormAttachment (org.eclipse.swt.layout.FormAttachment)68 ArrayList (java.util.ArrayList)57