Search in sources :

Example 86 with FormLayout

use of org.eclipse.swt.layout.FormLayout in project MonjaDB by Kanatoko.

the class MActionDialog method createDialogArea.

//--------------------------------------------------------------------------------
protected Control createDialogArea(Composite parent) {
    Composite composite = (Composite) super.createDialogArea(parent);
    composite.setLayout(new FormLayout());
    Group group1 = new Group(composite, SWT.SHADOW_ETCHED_OUT);
    FormData d7 = new FormData();
    d7.top = new FormAttachment(0, 6);
    d7.left = new FormAttachment(0, 3);
    d7.right = new FormAttachment(100, -3);
    d7.bottom = new FormAttachment(100, -3);
    group1.setLayoutData(d7);
    group1.setLayout(new FormLayout());
    Label nameLabel = new Label(group1, SWT.NONE);
    nameLabel.setText("Name :");
    FormData fd_nameLabel = new FormData();
    fd_nameLabel.top = new FormAttachment(0, 15);
    fd_nameLabel.left = new FormAttachment(0, 15);
    nameLabel.setLayoutData(fd_nameLabel);
    nameText = new Text(group1, SWT.BORDER);
    FormData d1 = new FormData();
    d1.left = new FormAttachment(nameLabel, 15);
    d1.top = new FormAttachment(nameLabel, -2, SWT.TOP);
    d1.right = new FormAttachment(nameLabel, 200, SWT.RIGHT);
    //d1.bottom = new FormAttachment( 100, -5 );
    nameText.setLayoutData(d1);
    Label actionLabel = new Label(group1, SWT.NONE);
    FormData fd_actionLabel = new FormData();
    fd_actionLabel.top = new FormAttachment(nameLabel, 20);
    fd_actionLabel.left = new FormAttachment(0, 8);
    actionLabel.setLayoutData(fd_actionLabel);
    actionLabel.setText("Actions :");
    actionText = new Text(group1, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.CANCEL | SWT.MULTI);
    FormData d2 = new FormData();
    d2.left = new FormAttachment(nameText, 0, SWT.LEFT);
    d2.bottom = new FormAttachment(100, -10);
    d2.top = new FormAttachment(actionLabel, -2, SWT.TOP);
    d2.right = new FormAttachment(100, -15);
    //d1.bottom = new FormAttachment( 100, -5 );
    actionText.setLayoutData(d2);
    Composite composite_1 = new Composite(group1, SWT.NONE);
    FormData fd_composite_1 = new FormData();
    fd_composite_1.bottom = new FormAttachment(100);
    fd_composite_1.right = new FormAttachment(0, 400);
    fd_composite_1.top = new FormAttachment(0, 200);
    composite_1.setLayoutData(fd_composite_1);
    if (savedAction.containsKey("name")) {
        nameText.setText(savedAction.get("name") + "");
    }
    if (savedAction.containsKey("actions")) {
        actionText.setText(savedAction.get("actions") + "");
    }
    return composite;
}
Also used : FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) Group(org.eclipse.swt.widgets.Group) Composite(org.eclipse.swt.widgets.Composite) Label(org.eclipse.swt.widgets.Label) Text(org.eclipse.swt.widgets.Text) FormAttachment(org.eclipse.swt.layout.FormAttachment)

Example 87 with FormLayout

use of org.eclipse.swt.layout.FormLayout in project MonjaDB by Kanatoko.

the class MInsertJsonDialog method createDialogArea.

//--------------------------------------------------------------------------------
protected Control createDialogArea(Composite parent) {
    Composite composite = (Composite) super.createDialogArea(parent);
    composite.setLayout(new FormLayout());
    Group group1 = new Group(composite, SWT.SHADOW_ETCHED_OUT);
    FormData d7 = new FormData();
    d7.top = new FormAttachment(0, 6);
    d7.left = new FormAttachment(0, 3);
    d7.right = new FormAttachment(100, -3);
    d7.bottom = new FormAttachment(100, -3);
    group1.setLayoutData(d7);
    group1.setLayout(new FormLayout());
    Label actionLabel = new Label(group1, SWT.NONE);
    FormData fd_actionLabel = new FormData();
    fd_actionLabel.top = new FormAttachment(0, 20);
    fd_actionLabel.left = new FormAttachment(0, 8);
    actionLabel.setLayoutData(fd_actionLabel);
    actionLabel.setText("JSON :");
    jsonText = new Text(group1, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.CANCEL | SWT.MULTI);
    FormData d2 = new FormData();
    d2.right = new FormAttachment(100, -19);
    d2.left = new FormAttachment(actionLabel, 12);
    d2.bottom = new FormAttachment(100, -10);
    d2.top = new FormAttachment(actionLabel, -2, SWT.TOP);
    jsonText.setLayoutData(d2);
    Composite composite_1 = new Composite(group1, SWT.NONE);
    FormData fd_composite_1 = new FormData();
    fd_composite_1.bottom = new FormAttachment(100);
    fd_composite_1.right = new FormAttachment(0, 400);
    fd_composite_1.top = new FormAttachment(0, 200);
    composite_1.setLayoutData(fd_composite_1);
    return composite;
}
Also used : FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) Group(org.eclipse.swt.widgets.Group) Composite(org.eclipse.swt.widgets.Composite) Label(org.eclipse.swt.widgets.Label) Text(org.eclipse.swt.widgets.Text) FormAttachment(org.eclipse.swt.layout.FormAttachment)

Example 88 with FormLayout

use of org.eclipse.swt.layout.FormLayout in project cubrid-manager by CUBRID.

the class ViewSQLLogDialog method createDialogArea.

/**
	 * Create dialog area content
	 * 
	 * @param parent the parent composite
	 * @return the control
	 */
protected Control createDialogArea(Composite parent) {
    Composite container = new Composite(parent, SWT.None);
    container.setLayoutData(CommonUITool.createGridData(GridData.FILL_BOTH, 1, 1, -1, -1));
    container.setLayout(new FormLayout());
    final TableViewer tableViewer = new TableViewer(container, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL | SWT.FULL_SELECTION);
    tableViewer.getTable().setLayoutData(CommonUITool.createGridData(GridData.FILL_BOTH, 1, 1, -1, -1));
    tableViewer.getTable().setLinesVisible(true);
    tableViewer.getTable().setHeaderVisible(true);
    tableViewer.getTable().setToolTipText("");
    ColumnViewerToolTipSupport.enableFor(tableViewer, ToolTip.NO_RECREATE);
    FormData tableData = new FormData();
    tableData.top = new FormAttachment(0, 0);
    tableData.bottom = new FormAttachment(60, 0);
    tableData.left = new FormAttachment(0, 0);
    tableData.right = new FormAttachment(100, 0);
    tableViewer.getTable().setLayoutData(tableData);
    final TableViewerColumn lineIndex = new TableViewerColumn(tableViewer, SWT.NONE);
    lineIndex.getColumn().setWidth(40);
    lineIndex.getColumn().setText(Messages.failedSQLlineNumber);
    final TableViewerColumn sqlColumn = new TableViewerColumn(tableViewer, SWT.NONE);
    sqlColumn.getColumn().setWidth(400);
    sqlColumn.getColumn().setText(Messages.failedSQL);
    final TableViewerColumn errColumn = new TableViewerColumn(tableViewer, SWT.NONE);
    errColumn.getColumn().setWidth(400);
    errColumn.getColumn().setText(Messages.failedErrorMessage);
    tableViewer.setContentProvider(new ViewFailedSQLTableContentProvider());
    tableViewer.setLabelProvider(new ViewFailedSQLTableLabelProvider());
    tableViewer.setInput(failedList);
    sqlColumn.setLabelProvider(new ColumnLabelProvider() {

        public String getToolTipText(Object element) {
            SqlRunnerFailed failedObj = (SqlRunnerFailed) element;
            return failedObj.getSql();
        }
    });
    errColumn.setLabelProvider(new ColumnLabelProvider() {

        public String getToolTipText(Object element) {
            SqlRunnerFailed failedObj = (SqlRunnerFailed) element;
            return failedObj.getErrorMessage();
        }
    });
    tableViewer.getTable().addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            TableItem[] items = tableViewer.getTable().getSelection();
            if (items.length == 1) {
                updateDetialInfo((SqlRunnerFailed) items[0].getData());
            }
        }
    });
    detailText = new StyledText(container, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL | SWT.WRAP);
    detailText.setEditable(false);
    FormData detailData = new FormData();
    detailData.top = new FormAttachment(60, 5);
    detailData.bottom = new FormAttachment(100, -5);
    detailData.left = new FormAttachment(0, 0);
    detailData.right = new FormAttachment(100, 0);
    detailText.setLayoutData(detailData);
    return container;
}
Also used : FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) StyledText(org.eclipse.swt.custom.StyledText) Composite(org.eclipse.swt.widgets.Composite) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) SqlRunnerFailed(com.cubrid.common.ui.common.sqlrunner.model.SqlRunnerFailed) ColumnLabelProvider(org.eclipse.jface.viewers.ColumnLabelProvider) SelectionEvent(org.eclipse.swt.events.SelectionEvent) TableViewer(org.eclipse.jface.viewers.TableViewer) FormAttachment(org.eclipse.swt.layout.FormAttachment) TableViewerColumn(org.eclipse.jface.viewers.TableViewerColumn) ViewFailedSQLTableContentProvider(com.cubrid.common.ui.common.sqlrunner.ViewFailedSQLTableContentProvider) ViewFailedSQLTableLabelProvider(com.cubrid.common.ui.common.sqlrunner.ViewFailedSQLTableLabelProvider)

Example 89 with FormLayout

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

the class InsertionIndicator method updatePosition.

/**
     * Update position of the indicator at top of <code>itemIndexTarget</code> position of the
     * <code>draggableTable</code>.
     * 
     * @param currentTable
     * @param itemIndexTarget
     */
public void updatePosition(Table currentTable, int itemIndexTarget) {
    // System.out.println(itemIndexTarget);
    this.draggableTable = currentTable;
    removeTablePaintListener();
    if (tablePaintListener == null) {
        tablePaintListener = new Listener() {

            public void handleEvent(Event event) {
                drawIndicatorLineInTable(event);
            }
        };
    }
    FormLayout formLayout = tablesZoneViewParent.getLayout();
    UIManager uiManager = mapperManager.getUiManager();
    TablesZoneView tablesZoneViewOutputs = uiManager.getTablesZoneViewOutputs();
    Display display = tablesZoneViewOutputs.getDisplay();
    Point tablePositionRefZone = display.map(currentTable, tablesZoneViewParent, new Point(0, 0));
    FormData formDataLeftArrow = (FormData) leftArrowDraggingIndicator.getLayoutData();
    FormData formDataRightArrow = (FormData) rightArrowDraggingIndicator.getLayoutData();
    ScrollBar verticalBar = currentTable.getVerticalBar();
    int offsetVerticalBar = -verticalBar.getSelection() * currentTable.getItemHeight();
    int indicYPositionRefZone = 0;
    if (WindowSystem.isGTK()) {
        if (itemIndexTarget == 0) {
            indicYPositionRefTable = 0 + offsetVerticalBar;
        } else {
            indicYPositionRefTable = itemIndexTarget * (currentTable.getItemHeight() + 2) + offsetVerticalBar;
        }
        indicYPositionRefZone = indicYPositionRefTable + tablePositionRefZone.y + formLayout.marginTop - HEIGHT_INDICATOR / 2;
        indicYPositionRefZone -= currentTable.getItemHeight() + 1;
    } else {
        if (itemIndexTarget == 0) {
            indicYPositionRefTable = 0 + offsetVerticalBar;
        } else {
            indicYPositionRefTable = itemIndexTarget * currentTable.getItemHeight() - 1 + offsetVerticalBar;
        }
        indicYPositionRefZone = indicYPositionRefTable + tablePositionRefZone.y + formLayout.marginTop - HEIGHT_INDICATOR / 2 + 4;
    }
    DataMapTableView dataMapTableView = mapperManager.retrieveDataMapTableView(currentTable);
    Rectangle boundsTableView = dataMapTableView.getBounds();
    int testValue = boundsTableView.y + boundsTableView.height - formLayout.marginTop - HEIGHT_INDICATOR / 2 - 5;
    if (indicYPositionRefZone > testValue) {
        indicYPositionRefZone = testValue;
    }
    currentTable.addListener(SWT.Paint, tablePaintListener);
    if (lastIndicYPositionRefZone != indicYPositionRefZone) {
        formDataLeftArrow.top.offset = indicYPositionRefZone;
        formDataRightArrow.top.offset = indicYPositionRefZone;
        formDataRightArrow.left.offset = currentTable.getSize().x + 2;
        currentTable.redraw();
        tablesZoneViewParent.layout();
    }
    lastIndicYPositionRefZone = indicYPositionRefZone;
}
Also used : FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) Listener(org.eclipse.swt.widgets.Listener) Rectangle(org.eclipse.swt.graphics.Rectangle) Event(org.eclipse.swt.widgets.Event) UIManager(org.talend.designer.dbmap.managers.UIManager) DataMapTableView(org.talend.designer.dbmap.ui.visualmap.table.DataMapTableView) Point(org.eclipse.swt.graphics.Point) TablesZoneView(org.talend.designer.dbmap.ui.visualmap.zone.scrollable.TablesZoneView) ScrollBar(org.eclipse.swt.widgets.ScrollBar) Point(org.eclipse.swt.graphics.Point) Display(org.eclipse.swt.widgets.Display)

Example 90 with FormLayout

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

the class FooterComposite method createComponents.

/**
     * DOC amaumont Comment method "createComponents".
     */
private void createComponents() {
    final UIManager uiManager = mapperManager.getUiManager();
    GridData footerCompositeGridData = new GridData(GridData.FILL_HORIZONTAL);
    this.setLayoutData(footerCompositeGridData);
    FormLayout formLayout = new FormLayout();
    formLayout.spacing = 15;
    this.setLayout(formLayout);
    Button okButton = new Button(this, SWT.NONE);
    //$NON-NLS-1$
    okButton.setText(Messages.getString("FooterComposite.button.OK"));
    FormData okFormData = new FormData();
    okFormData.width = 100;
    okButton.setLayoutData(okFormData);
    okButton.addSelectionListener(new SelectionListener() {

        public void widgetDefaultSelected(SelectionEvent e) {
        }

        public void widgetSelected(SelectionEvent e) {
            uiManager.closeMapper(SWT.OK);
        }
    });
    // final Button applyButton = new Button(this, SWT.NONE);
    // applyButton.setText("Apply");
    // FormData applyFormData = new FormData();
    // applyButton.setLayoutData(applyFormData);
    // applyButton.addSelectionListener(new SelectionListener() {
    //
    // public void widgetDefaultSelected(SelectionEvent e) {
    // }
    //
    // public void widgetSelected(SelectionEvent e) {
    // MessageBox messageBox = new MessageBox(uiManager.retrieveShellParent(footerComposite));
    // messageBox.setText("Info");
    // messageBox.setMessage("Not implemented yet !");
    // messageBox.open();
    // }
    //
    // });
    Button cancelButton = new Button(this, SWT.NONE);
    //$NON-NLS-1$
    cancelButton.setText(Messages.getString("FooterComposite.button.Cancel"));
    cancelButton.addSelectionListener(new SelectionListener() {

        public void widgetDefaultSelected(SelectionEvent e) {
        }

        public void widgetSelected(SelectionEvent e) {
            uiManager.closeMapper(SWT.CANCEL);
        }
    });
    FormData cancelFormData = new FormData();
    cancelFormData.width = 100;
    cancelButton.setLayoutData(cancelFormData);
    // applyFormData.right = new FormAttachment(100);
    // cancelFormData.right = new FormAttachment(applyButton, -5);
    cancelFormData.right = new FormAttachment(100, -5);
    okFormData.right = new FormAttachment(cancelButton, -5);
}
Also used : FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) Button(org.eclipse.swt.widgets.Button) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) UIManager(org.talend.designer.dbmap.managers.UIManager) FormAttachment(org.eclipse.swt.layout.FormAttachment) SelectionListener(org.eclipse.swt.events.SelectionListener)

Aggregations

FormLayout (org.eclipse.swt.layout.FormLayout)127 FormData (org.eclipse.swt.layout.FormData)97 FormAttachment (org.eclipse.swt.layout.FormAttachment)93 Composite (org.eclipse.swt.widgets.Composite)82 Button (org.eclipse.swt.widgets.Button)54 Label (org.eclipse.swt.widgets.Label)53 SelectionEvent (org.eclipse.swt.events.SelectionEvent)39 Point (org.eclipse.swt.graphics.Point)33 Group (org.eclipse.swt.widgets.Group)31 GridData (org.eclipse.swt.layout.GridData)30 Text (org.eclipse.swt.widgets.Text)30 GridLayout (org.eclipse.swt.layout.GridLayout)29 SelectionListener (org.eclipse.swt.events.SelectionListener)27 Combo (org.eclipse.swt.widgets.Combo)25 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)19 FillLayout (org.eclipse.swt.layout.FillLayout)19 ScrolledComposite (org.eclipse.swt.custom.ScrolledComposite)17 StyledText (org.eclipse.swt.custom.StyledText)13 ModifyListener (org.eclipse.swt.events.ModifyListener)12 ModifyEvent (org.eclipse.swt.events.ModifyEvent)11