Search in sources :

Example 16 with RowLayout

use of org.eclipse.swt.layout.RowLayout in project yyl_example by Relucent.

the class MyRowLayout method main.

public static void main(String[] args) {
    final Display display = Display.getDefault();
    final Shell shell = new Shell();
    RowLayout rowLayout = new RowLayout();
    rowLayout.marginTop = 10;
    rowLayout.marginLeft = 5;
    rowLayout.spacing = 2;
    // true or false 
    rowLayout.wrap = true;
    rowLayout.type = SWT.HORIZONTAL;
    //# rowLayout.type = SWT.VERTICAL;
    rowLayout.pack = true;
    rowLayout.justify = false;
    new Button(shell, SWT.NONE).setText("b1");
    new Button(shell, SWT.NONE).setText("button2");
    Button b = new Button(shell, SWT.NONE);
    b.setText("btn3");
    RowData rowData = new RowData(50, 50);
    b.setLayoutData(rowData);
    shell.setLayout(rowLayout);
    shell.setText("RowLayout");
    shell.setSize(200, 200);
    shell.layout();
    shell.open();
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch()) {
            display.sleep();
        }
    }
}
Also used : Shell(org.eclipse.swt.widgets.Shell) RowData(org.eclipse.swt.layout.RowData) Button(org.eclipse.swt.widgets.Button) RowLayout(org.eclipse.swt.layout.RowLayout) Display(org.eclipse.swt.widgets.Display)

Example 17 with RowLayout

use of org.eclipse.swt.layout.RowLayout in project yyl_example by Relucent.

the class MyStackLayout method open.

void open() {
    final Display display = Display.getDefault();
    final Shell shell = new Shell();
    final Composite comp1 = new Composite(shell, SWT.NONE);
    final StackLayout stackLayout = new StackLayout();
    final Text txt1 = new Text(comp1, SWT.BORDER);
    txt1.setText("T1");
    final Text txt2 = new Text(comp1, SWT.BORDER);
    txt2.setText("T2");
    Composite comp2 = new Composite(shell, SWT.NONE);
    comp2.setLayout(new RowLayout());
    Button btn1 = new Button(comp2, SWT.NONE);
    Button btn2 = new Button(comp2, SWT.NONE);
    btn1.setText("T1");
    btn2.setText("T2");
    comp1.setLayout(stackLayout);
    stackLayout.topControl = txt1;
    btn1.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            stackLayout.topControl = txt1;
            comp1.layout();
        }
    });
    btn2.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            stackLayout.topControl = txt2;
            comp1.layout();
        }
    });
    shell.setLayout(new FillLayout());
    shell.setText("StackLayout");
    shell.setSize(200, 200);
    //		shell.setMaximized(true);
    shell.layout();
    shell.open();
    while (!shell.isDisposed()) if (!display.readAndDispatch())
        display.sleep();
}
Also used : Shell(org.eclipse.swt.widgets.Shell) Composite(org.eclipse.swt.widgets.Composite) Button(org.eclipse.swt.widgets.Button) RowLayout(org.eclipse.swt.layout.RowLayout) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) StackLayout(org.eclipse.swt.custom.StackLayout) SelectionEvent(org.eclipse.swt.events.SelectionEvent) Text(org.eclipse.swt.widgets.Text) FillLayout(org.eclipse.swt.layout.FillLayout) Display(org.eclipse.swt.widgets.Display)

Example 18 with RowLayout

use of org.eclipse.swt.layout.RowLayout in project tdi-studio-se by Talend.

the class MergeOrderDialog method createDialogArea.

/*
     * (non-Javadoc)
     * 
     * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
     */
@Override
protected Control createDialogArea(Composite parent) {
    Composite composite = (Composite) super.createDialogArea(parent);
    Composite tableComposite = new Composite(composite, SWT.None);
    tableComposite.setLayout(new GridLayout());
    GridData gridData = new GridData(GridData.FILL_BOTH);
    gridData.widthHint = WIDTH;
    gridData.minimumWidth = WIDTH;
    gridData.heightHint = HEIGHT;
    gridData.minimumHeight = HEIGHT;
    tableComposite.setLayoutData(gridData);
    final TableViewerCreator tableViewerCreator = new TableViewerCreator(tableComposite);
    tableViewerCreator.setBorderVisible(true);
    tableViewerCreator.setCheckboxInFirstColumn(false);
    tableViewerCreator.setColumnsResizableByDefault(true);
    tableViewerCreator.setColumnsSortableByDefault(true);
    tableViewerCreator.setLayoutMode(LAYOUT_MODE.FILL_HORIZONTAL);
    Table table = tableViewerCreator.createTable();
    table.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL));
    TableViewerCreatorColumn column = new TableViewerCreatorColumn(tableViewerCreator);
    //$NON-NLS-1$
    column.setTitle(Messages.getString("MergeOrderDialog.Order"));
    column.setModifiable(true);
    column.setWidth(50);
    //$NON-NLS-1$
    column.setToolTipHeader(Messages.getString("MergeOrderDialog.CurrentOrderConnection"));
    column.setBeanPropertyAccessors(new IBeanPropertyAccessors<Connection, String>() {

        public String get(Connection bean) {
            return String.valueOf(connectionList.indexOf(bean) + 1);
        }

        public void set(Connection bean, String value) {
        // bean.setName(value);
        }
    });
    column = new TableViewerCreatorColumn(tableViewerCreator);
    //$NON-NLS-1$
    column.setTitle(Messages.getString("MergeOrderDialog.ConnectionName"));
    column.setBeanPropertyAccessors(new IBeanPropertyAccessors<Connection, String>() {

        public String get(Connection bean) {
            return getDisplayStr(bean);
        }

        public void set(Connection bean, String value) {
        // bean.setName(value);
        }
    });
    column.setModifiable(false);
    column.setWidth(200);
    tableViewerCreator.init(connectionList);
    Composite buttonComposite = new Composite(composite, SWT.None);
    buttonComposite.setLayout(new RowLayout(SWT.HORIZONTAL));
    Button moveUp = new Button(buttonComposite, SWT.PUSH);
    //$NON-NLS-1$
    moveUp.setToolTipText(Messages.getString("MergeOrderDialog.MoveUp"));
    moveUp.setImage(ImageProvider.getImage(EImage.UP_ICON));
    moveUp.addListener(SWT.Selection, new Listener() {

        public void handleEvent(Event event) {
            IStructuredSelection selection = (IStructuredSelection) tableViewerCreator.getTableViewer().getSelection();
            Connection connection = (Connection) selection.getFirstElement();
            int connId = connectionList.indexOf(connection);
            if (connId > 0) {
                Collections.swap(connectionList, connId - 1, connId);
                tableViewerCreator.getTableViewer().refresh();
            }
        }
    });
    Button moveDown = new Button(buttonComposite, SWT.PUSH);
    //$NON-NLS-1$
    moveDown.setToolTipText(Messages.getString("MergeOrderDialog.MoveDown"));
    moveDown.setImage(ImageProvider.getImage(EImage.DOWN_ICON));
    if (getMergeNode() != null && getMergeNode().isReadOnly()) {
        moveUp.setEnabled(false);
        moveDown.setEnabled(false);
    }
    final int nbConn = getConnectionQty();
    moveDown.addListener(SWT.Selection, new Listener() {

        public void handleEvent(Event event) {
            IStructuredSelection selection = (IStructuredSelection) tableViewerCreator.getTableViewer().getSelection();
            if (selection.size() > 0) {
                Connection connection = (Connection) selection.getFirstElement();
                int connId = connectionList.indexOf(connection);
                if (connId < (nbConn - 1)) {
                    Collections.swap(connectionList, connId + 1, connId);
                    tableViewerCreator.getTableViewer().refresh();
                }
            }
        }
    });
    return composite;
}
Also used : TableViewerCreator(org.talend.commons.ui.swt.tableviewer.TableViewerCreator) Table(org.eclipse.swt.widgets.Table) Listener(org.eclipse.swt.widgets.Listener) Composite(org.eclipse.swt.widgets.Composite) IConnection(org.talend.core.model.process.IConnection) Connection(org.talend.designer.core.ui.editor.connections.Connection) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) GridLayout(org.eclipse.swt.layout.GridLayout) Button(org.eclipse.swt.widgets.Button) RowLayout(org.eclipse.swt.layout.RowLayout) GridData(org.eclipse.swt.layout.GridData) Event(org.eclipse.swt.widgets.Event) TableViewerCreatorColumn(org.talend.commons.ui.swt.tableviewer.TableViewerCreatorColumn)

Example 19 with RowLayout

use of org.eclipse.swt.layout.RowLayout in project tdi-studio-se by Talend.

the class TabFolderEditors method createMetadataEditorTab.

/**
     * DOC amaumont Comment method "createMetadataEditor".
     */
private void createMetadataEditorTab() {
    CTabItem item = new CTabItem(tabFolderEditors, SWT.BORDER);
    //$NON-NLS-1$
    item.setText(Messages.getString("TabFolderEditors.schemaEditor"));
    SashForm inOutMetaEditorContainer = new SashForm(tabFolderEditors, SWT.SMOOTH | SWT.HORIZONTAL | SWT.SHADOW_OUT);
    inOutMetaEditorContainer.setLayout(new RowLayout(SWT.HORIZONTAL));
    item.setControl(inOutMetaEditorContainer);
    CommandStack commandStack = mapperManager.getCommandStack();
    inputMetaEditor = new MetadataTableEditorView(inOutMetaEditorContainer, SWT.BORDER);
    inputMetaEditor.setCurrentDbms(dbmsId);
    inputMetaEditor.setShowDbTypeColumn(true, false, true);
    inputMetaEditor.setShowDbColumnName(true, false);
    inputMetaEditor.setShowPatternColumn(false);
    inputMetaEditor.setShowTalendTypeColumn(false);
    inputMetaEditor.initGraphicComponents();
    inputMetaEditor.getExtendedTableViewer().setCommandStack(commandStack);
    outputMetaEditor = new MetadataTableEditorView(inOutMetaEditorContainer, SWT.BORDER);
    outputMetaEditor.setCurrentDbms(dbmsId);
    outputMetaEditor.setShowDbTypeColumn(true, false, true);
    outputMetaEditor.setShowDbColumnName(true, false);
    outputMetaEditor.setShowTalendTypeColumn(false);
    outputMetaEditor.setShowPatternColumn(false);
    outputMetaEditor.initGraphicComponents();
    outputMetaEditor.getExtendedTableViewer().setCommandStack(commandStack);
}
Also used : SashForm(org.eclipse.swt.custom.SashForm) CommandStack(org.eclipse.gef.commands.CommandStack) RowLayout(org.eclipse.swt.layout.RowLayout) CTabItem(org.eclipse.swt.custom.CTabItem) MetadataTableEditorView(org.talend.core.ui.metadata.editor.MetadataTableEditorView)

Example 20 with RowLayout

use of org.eclipse.swt.layout.RowLayout in project tdi-studio-se by Talend.

the class TabFolderEditors method createComponents.

/**
     * qzhang Comment method "createComponents".
     */
private void createComponents() {
    CTabItem item = new CTabItem(tabFolderEditors, SWT.BORDER);
    //$NON-NLS-1$
    item.setText(Messages.getString("TabFolderEditors.FunParamTab.TitleText"));
    inOutMetaEditorContainer = new SashForm(tabFolderEditors, SWT.SMOOTH | SWT.HORIZONTAL | SWT.SHADOW_OUT);
    inOutMetaEditorContainer.setLayout(new RowLayout(SWT.HORIZONTAL));
    item.setControl(inOutMetaEditorContainer);
    createTableView();
    item = new CTabItem(tabFolderEditors, SWT.BORDER);
    //$NON-NLS-1$
    item.setText(Messages.getString("TabFolderEditors.PreviewTab.TitleText"));
    Composite composite = new Composite(tabFolderEditors, SWT.BORDER);
    GridLayout gridLayout = new GridLayout();
    gridLayout.numColumns = 1;
    composite.setLayout(gridLayout);
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));
    createPreview(composite, 700, 210);
    item.setControl(composite);
    tabFolderEditors.addListener(SWT.Selection, new Listener() {

        public void handleEvent(Event event) {
            lastSelectedTab = tabFolderEditors.getSelectionIndex();
        }
    });
    tabFolderEditors.setSelection(0);
}
Also used : SashForm(org.eclipse.swt.custom.SashForm) GridLayout(org.eclipse.swt.layout.GridLayout) Listener(org.eclipse.swt.widgets.Listener) Composite(org.eclipse.swt.widgets.Composite) RowLayout(org.eclipse.swt.layout.RowLayout) GridData(org.eclipse.swt.layout.GridData) Event(org.eclipse.swt.widgets.Event) SelectionEvent(org.eclipse.swt.events.SelectionEvent) CTabItem(org.eclipse.swt.custom.CTabItem)

Aggregations

RowLayout (org.eclipse.swt.layout.RowLayout)56 Composite (org.eclipse.swt.widgets.Composite)51 Button (org.eclipse.swt.widgets.Button)39 GridData (org.eclipse.swt.layout.GridData)37 SelectionEvent (org.eclipse.swt.events.SelectionEvent)35 GridLayout (org.eclipse.swt.layout.GridLayout)32 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)30 Label (org.eclipse.swt.widgets.Label)26 Group (org.eclipse.swt.widgets.Group)19 Text (org.eclipse.swt.widgets.Text)11 Combo (org.eclipse.swt.widgets.Combo)9 SelectionListener (org.eclipse.swt.events.SelectionListener)8 ArrayList (java.util.ArrayList)6 RowData (org.eclipse.swt.layout.RowData)6 Event (org.eclipse.swt.widgets.Event)6 Listener (org.eclipse.swt.widgets.Listener)6 List (java.util.List)5 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)5 StyledText (org.eclipse.swt.custom.StyledText)5 Table (org.eclipse.swt.widgets.Table)5