Search in sources :

Example 66 with GridData

use of org.eclipse.swt.layout.GridData in project dbeaver by serge-rider.

the class OracleConnectionPage method createSecurityGroup.

private void createSecurityGroup(Composite parent) {
    Label userNameLabel = UIUtils.createControlLabel(parent, OracleMessages.dialog_connection_user_name);
    userNameLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
    userNameText = new Text(parent, SWT.BORDER);
    GridData gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.grabExcessHorizontalSpace = true;
    userNameText.setLayoutData(gd);
    userNameText.addModifyListener(controlModifyListener);
    Label userRoleLabel = UIUtils.createControlLabel(parent, OracleMessages.dialog_connection_role);
    userRoleLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
    userRoleCombo = new Combo(parent, SWT.DROP_DOWN | SWT.READ_ONLY);
    gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING);
    gd.widthHint = 60;
    userRoleCombo.setLayoutData(gd);
    userRoleCombo.add(OracleConnectionRole.NORMAL.getTitle());
    userRoleCombo.add(OracleConnectionRole.SYSDBA.getTitle());
    userRoleCombo.add(OracleConnectionRole.SYSOPER.getTitle());
    userRoleCombo.select(0);
    Label passwordLabel = UIUtils.createControlLabel(parent, OracleMessages.dialog_connection_password);
    passwordLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
    passwordText = new Text(parent, SWT.BORDER | SWT.PASSWORD);
    gd = new GridData(GridData.FILL_HORIZONTAL);
    passwordText.setLayoutData(gd);
    passwordText.addModifyListener(controlModifyListener);
    osAuthCheck = UIUtils.createCheckbox(parent, OracleMessages.dialog_connection_os_authentication, false);
    gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
    gd.horizontalSpan = 2;
    osAuthCheck.setLayoutData(gd);
    osAuthCheck.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            boolean osAuth = osAuthCheck.getSelection();
            userNameText.setEnabled(!osAuth);
            passwordText.setEnabled(!osAuth);
        }
    });
    parent.setTabList(new Control[] { userNameText, passwordText, userRoleCombo, osAuthCheck });
}
Also used : GridData(org.eclipse.swt.layout.GridData)

Example 67 with GridData

use of org.eclipse.swt.layout.GridData in project dbeaver by serge-rider.

the class PostgreRestoreWizardPageSettings method createControl.

@Override
public void createControl(Composite parent) {
    Composite composite = UIUtils.createPlaceholder(parent, 1);
    Listener updateListener = new Listener() {

        @Override
        public void handleEvent(Event event) {
            updateState();
        }
    };
    Group formatGroup = UIUtils.createControlGroup(composite, "Settings", 2, GridData.FILL_HORIZONTAL, 0);
    formatCombo = UIUtils.createLabelCombo(formatGroup, "Format", SWT.DROP_DOWN | SWT.READ_ONLY);
    formatCombo.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
    for (PostgreBackupWizard.ExportFormat format : PostgreBackupWizard.ExportFormat.values()) {
        formatCombo.add(format.getTitle());
    }
    formatCombo.select(wizard.format.ordinal());
    formatCombo.addListener(SWT.Selection, updateListener);
    Group inputGroup = UIUtils.createControlGroup(composite, "Input", 2, GridData.FILL_HORIZONTAL, 0);
    UIUtils.createControlLabel(inputGroup, "Backup file");
    inputFileText = new TextWithOpenFile(inputGroup, "Choose backup file", new String[] { "*.backup", "*" });
    inputFileText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    inputFileText.getTextControl().addListener(SWT.Modify, updateListener);
    createSecurityGroup(composite);
    setControl(composite);
}
Also used : SelectionListener(org.eclipse.swt.events.SelectionListener) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) TextWithOpenFile(org.jkiss.dbeaver.ui.controls.TextWithOpenFile)

Example 68 with GridData

use of org.eclipse.swt.layout.GridData 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 69 with GridData

use of org.eclipse.swt.layout.GridData in project translationstudio8 by heartsome.

the class TermBaseSearchDialog method createDialogArea.

@Override
protected Control createDialogArea(Composite parent) {
    Composite tparent = (Composite) super.createDialogArea(parent);
    tparent.setLayout(new GridLayout());
    GridData parentData = new GridData(GridData.FILL_BOTH);
    parentData.heightHint = 600;
    parentData.widthHint = 775;
    tparent.setLayoutData(parentData);
    Group groupSearch = new Group(tparent, SWT.None);
    groupSearch.setText(Messages.getString("dialog.TermBaseSearchDialog.groupSearch"));
    GridLayoutFactory.swtDefaults().margins(5, 5).numColumns(3).equalWidth(false).applyTo(groupSearch);
    GridDataFactory.fillDefaults().grab(true, false).applyTo(groupSearch);
    Label lblSearch = new Label(groupSearch, SWT.NONE);
    lblSearch.setText(Messages.getString("dialog.TermBaseSearchDialog.lblSearch"));
    GridDataFactory.fillDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(lblSearch);
    cmbSearch = new Combo(groupSearch, SWT.DROP_DOWN | SWT.BORDER);
    cmbSearch.setText(strSearchText == null ? "" : strSearchText);
    GridData txtData = new GridData();
    // 解决在 Windows 下文本框高度太小的问题
    // txtData.heightHint = 20;
    txtData.widthHint = 590;
    cmbSearch.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    btnSearch = new Button(groupSearch, SWT.PUSH);
    btnSearch.setText(Messages.getString("dialog.TermBaseSearchDialog.btnSearch"));
    new Label(groupSearch, SWT.NONE);
    Composite compCondition = new Composite(groupSearch, SWT.NONE);
    GridLayoutFactory.fillDefaults().spacing(8, 0).numColumns(4).equalWidth(false).applyTo(compCondition);
    GridDataFactory.fillDefaults().span(2, 1).grab(true, false).applyTo(compCondition);
    btnIsCaseSensitive = new Button(compCondition, SWT.CHECK);
    btnIsCaseSensitive.setText(Messages.getString("dialog.TermBaseSearchDialog.btnIsCaseSensitive"));
    GridDataFactory.swtDefaults().applyTo(btnIsCaseSensitive);
    btnIsIgnoreMark = new Button(compCondition, SWT.CHECK);
    btnIsIgnoreMark.setText(Messages.getString("dialog.TermBaseSearchDialog.btnIsIgnoreMark"));
    btnIsIgnoreMark.setSelection(true);
    GridDataFactory.swtDefaults().applyTo(btnIsIgnoreMark);
    btnApplyRegularExpression = new Button(compCondition, SWT.CHECK);
    btnApplyRegularExpression.setText(Messages.getString("dialog.TermBaseSearchDialog.btnApplyRegularExpression"));
    GridDataFactory.swtDefaults().applyTo(btnApplyRegularExpression);
    Composite compMatchQuality = new Composite(compCondition, SWT.NONE);
    GridLayoutFactory.fillDefaults().extendedMargins(0, 0, 0, 0).margins(0, 0).spacing(0, 0).numColumns(3).equalWidth(false).applyTo(compMatchQuality);
    GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).grab(true, false).applyTo(compMatchQuality);
    new Label(compMatchQuality, SWT.NONE).setText(Messages.getString("dialog.TermBaseSearchDialog.lblQuality"));
    spiMatchQuality = new Spinner(compMatchQuality, SWT.BORDER);
    spiMatchQuality.setMaximum(100);
    spiMatchQuality.setMinimum(30);
    spiMatchQuality.setIncrement(5);
    spiMatchQuality.setSelection(100);
    GridData spinnaData = new GridData();
    spinnaData.widthHint = 23;
    spiMatchQuality.setLayoutData(spinnaData);
    new Label(compMatchQuality, SWT.NONE).setText("%");
    Label lblTB = new Label(groupSearch, SWT.NONE);
    lblTB.setText(Messages.getString("dialog.TermBaseSearchDialog.lblTB"));
    GridDataFactory.fillDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(lblTB);
    Composite cmpTB = new Composite(groupSearch, SWT.NONE);
    GridLayoutFactory.fillDefaults().spacing(8, 0).numColumns(2).equalWidth(false).applyTo(cmpTB);
    GridDataFactory.fillDefaults().span(2, 1).grab(true, false).applyTo(cmpTB);
    cmbDatabase = new Combo(cmpTB, SWT.READ_ONLY);
    GridDataFactory.swtDefaults().hint(120, SWT.DEFAULT).applyTo(cmbDatabase);
    initDatabaseCombo();
    btnSelectLang = new Button(cmpTB, SWT.RIGHT);
    // GridData data = new GridData();
    // data.widthHint = 150;
    // data.heightHint = 27;
    // btnSelectLang.setLayoutData(data);
    // btnSelectLang.setImage(Activator.getImageDescriptor(ImageConstants.CONCORDANCE_SELECT_LANG).createImage());
    // btnSelectLang.addPaintListener(new PaintListener() {
    // public void paintControl(PaintEvent e) {
    // e.gc.drawText(Messages.getString("dialog.TermBaseSearchDialog.btnSelectLang"), 5, 5,
    // SWT.DRAW_TRANSPARENT);
    // }
    // });
    btnSelectLang.setText(Messages.getString("dialog.TermBaseSearchDialog.btnSelectLang"));
    initLanguageMenu();
    Group groupTable = new Group(tparent, SWT.NONE);
    GridLayoutFactory.swtDefaults().margins(10, 10).applyTo(groupTable);
    groupTable.setLayoutData(new GridData(GridData.FILL_BOTH));
    // GridDataFactory.fillDefaults().hint(700, 440).applyTo(groupTable);
    groupTable.setText(Messages.getString("dialog.TermBaseSearchDialog.groupTable"));
    grid = new Grid(groupTable, SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER | SWT.FULL_SELECTION);
    grid.setHeaderVisible(true);
    grid.setLinesVisible(true);
    grid.setLayoutData(new GridData(GridData.FILL_BOTH));
    grid.setAutoHeight(true);
    grid.setRowsResizeable(true);
    grid.setWordWrapHeader(true);
    if (strSrcLang != null) {
        columnSrcLang = new GridColumn(grid, SWT.NONE);
        srcCellRenderer.setVerticalAlignment(SWT.CENTER);
        srcCellRenderer.setStyleColumn(0);
        columnSrcLang.setCellRenderer(srcCellRenderer);
        columnSrcLang.setText(strSrcLang);
        columnSrcLang.setWidth(365);
        columnSrcLang.setWordWrap(true);
    }
    if (strTgtLang != null) {
        GridColumn columnTgtLang = new GridColumn(grid, SWT.NONE);
        TBSearchCellRenderer cellRenderer = new TBSearchCellRenderer();
        cellRenderer.setVerticalAlignment(SWT.CENTER);
        columnTgtLang.setCellRenderer(cellRenderer);
        columnTgtLang.setText(strTgtLang);
        columnTgtLang.setWidth(365);
        columnTgtLang.setWordWrap(true);
    }
    for (String strLang : lstLangs) {
        final GridColumn column = new GridColumn(grid, SWT.NONE);
        TBSearchCellRenderer cellRenderer = new TBSearchCellRenderer();
        cellRenderer.setVerticalAlignment(SWT.CENTER);
        column.setCellRenderer(cellRenderer);
        column.setText(strLang);
        column.setWidth(0);
        column.setWordWrap(true);
    }
    readDialogSettings();
    setEnabled();
    updateCombo(cmbSearch, lstSearchHistory);
    if (!strSearchText.equals("")) {
        cmbSearch.setText(strSearchText);
    } else if (lstSearchHistory != null && lstSearchHistory.size() > 0) {
        cmbSearch.setText(lstSearchHistory.get(0));
    }
    cmbSearch.setSelection(new Point(0, cmbSearch.getText().length()));
    initListener();
    return parent;
}
Also used : Group(org.eclipse.swt.widgets.Group) Composite(org.eclipse.swt.widgets.Composite) Spinner(org.eclipse.swt.widgets.Spinner) Grid(org.eclipse.nebula.widgets.grid.Grid) Label(org.eclipse.swt.widgets.Label) Combo(org.eclipse.swt.widgets.Combo) Point(org.eclipse.swt.graphics.Point) GridLayout(org.eclipse.swt.layout.GridLayout) Button(org.eclipse.swt.widgets.Button) GridData(org.eclipse.swt.layout.GridData) GridColumn(org.eclipse.nebula.widgets.grid.GridColumn)

Example 70 with GridData

use of org.eclipse.swt.layout.GridData in project translationstudio8 by heartsome.

the class TermBaseSearchDialog method createHelpControl.

/**
	 * 添加帮助按钮 robert 2012-09-06
	 */
@Override
protected Control createHelpControl(Composite parent) {
    // ROBERTHELP 搜索术语
    String language = CommonFunction.getSystemLanguage();
    final String helpUrl = MessageFormat.format("/net.heartsome.cat.ts.ui.help/html/{0}/ch05s04.html#search-terminology", language);
    Image helpImage = JFaceResources.getImage(DLG_IMG_HELP);
    ToolBar toolBar = new ToolBar(parent, SWT.FLAT | SWT.NO_FOCUS);
    ((GridLayout) parent.getLayout()).numColumns++;
    toolBar.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_CENTER));
    final Cursor cursor = new Cursor(parent.getDisplay(), SWT.CURSOR_HAND);
    toolBar.setCursor(cursor);
    toolBar.addDisposeListener(new DisposeListener() {

        public void widgetDisposed(DisposeEvent e) {
            cursor.dispose();
        }
    });
    ToolItem helpItem = new ToolItem(toolBar, SWT.NONE);
    helpItem.setImage(helpImage);
    //$NON-NLS-1$
    helpItem.setToolTipText(JFaceResources.getString("helpToolTip"));
    helpItem.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            PlatformUI.getWorkbench().getHelpSystem().displayHelpResource(helpUrl);
        }
    });
    return toolBar;
}
Also used : DisposeListener(org.eclipse.swt.events.DisposeListener) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) ToolBar(org.eclipse.swt.widgets.ToolBar) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) Image(org.eclipse.swt.graphics.Image) Cursor(org.eclipse.swt.graphics.Cursor) DisposeEvent(org.eclipse.swt.events.DisposeEvent) ToolItem(org.eclipse.swt.widgets.ToolItem)

Aggregations

GridData (org.eclipse.swt.layout.GridData)2385 GridLayout (org.eclipse.swt.layout.GridLayout)1659 Composite (org.eclipse.swt.widgets.Composite)1448 Label (org.eclipse.swt.widgets.Label)982 Button (org.eclipse.swt.widgets.Button)732 SelectionEvent (org.eclipse.swt.events.SelectionEvent)719 Text (org.eclipse.swt.widgets.Text)578 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)577 Group (org.eclipse.swt.widgets.Group)509 Combo (org.eclipse.swt.widgets.Combo)234 ModifyListener (org.eclipse.swt.events.ModifyListener)225 ModifyEvent (org.eclipse.swt.events.ModifyEvent)214 SelectionListener (org.eclipse.swt.events.SelectionListener)213 Table (org.eclipse.swt.widgets.Table)196 Point (org.eclipse.swt.graphics.Point)167 TableViewer (org.eclipse.jface.viewers.TableViewer)162 FillLayout (org.eclipse.swt.layout.FillLayout)134 ScrolledComposite (org.eclipse.swt.custom.ScrolledComposite)118 Control (org.eclipse.swt.widgets.Control)117 Image (org.eclipse.swt.graphics.Image)114