Search in sources :

Example 16 with FormLayout

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

the class OutputTablesZoneView method initLayout.

@Override
public Layout initLayout() {
    FormLayout formLayout = new FormLayout();
    formLayout.marginLeft = 40;
    formLayout.marginRight = 10;
    formLayout.marginTop = MARGIN_TOP_ZONE_WITHOUT_ACTION_BAR;
    formLayout.marginBottom = 10;
    formLayout.marginWidth = 0;
    formLayout.marginHeight = 0;
    formLayout.spacing = 10;
    setLayout(formLayout);
    return formLayout;
}
Also used : FormLayout(org.eclipse.swt.layout.FormLayout)

Example 17 with FormLayout

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

the class ProcessView method createPartControl.

/*
     * (non-Javadoc)
     * 
     * @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
     */
@Override
public void createPartControl(Composite parent) {
    this.parent = parent;
    parent.setLayout(new FillLayout());
    sash = new SashForm(parent, SWT.HORIZONTAL | SWT.SMOOTH);
    sash.setLayoutData(new GridData(GridData.FILL_BOTH));
    sash.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WHITE));
    GridLayout layout = new GridLayout();
    sash.setLayout(layout);
    Composite left = new Composite(sash, SWT.NONE);
    left.setLayout(new FillLayout());
    Composite right = new Composite(sash, SWT.NONE);
    right.setLayout(new FormLayout());
    FormData layouDatag = new FormData();
    layouDatag.left = new FormAttachment(0, 0);
    layouDatag.width = 32;
    layouDatag.top = new FormAttachment(0, 0);
    layouDatag.bottom = new FormAttachment(100, 0);
    final Composite buttonComposite = new Composite(right, SWT.ERROR);
    buttonComposite.setLayoutData(layouDatag);
    buttonComposite.setLayout(new GridLayout());
    Composite cotextCom = new Composite(right, SWT.NONE);
    layouDatag = new FormData();
    layouDatag.left = new FormAttachment(0, 32);
    layouDatag.right = new FormAttachment(100, 0);
    layouDatag.top = new FormAttachment(0, 0);
    layouDatag.bottom = new FormAttachment(100, 0);
    cotextCom.setLayoutData(layouDatag);
    cotextCom.setLayout(new GridLayout());
    tabFactory.initComposite(left, false);
    moveButton = new Button(buttonComposite, SWT.PUSH);
    //$NON-NLS-1$
    moveButton.setText(">>");
    moveButton.setToolTipText(Messages.getString("ProcessComposite.hideContext"));
    final GridData layoutData = new GridData();
    layoutData.verticalAlignment = GridData.CENTER;
    layoutData.horizontalAlignment = GridData.CENTER;
    layoutData.grabExcessHorizontalSpace = true;
    layoutData.grabExcessVerticalSpace = true;
    moveButton.setLayoutData(layoutData);
    addListeners();
    sash.setSashWidth(5);
    sash.setWeights(new int[] { 18, 5 });
    contextComposite = new ProcessContextComposite(cotextCom, SWT.NONE);
    contextComposite.setBackground(right.getDisplay().getSystemColor(SWT.COLOR_WHITE));
    // processComposite = new ProcessComposite(tabFactory.getTabComposite(), SWT.H_SCROLL | SWT.V_SCROLL |
    // SWT.NO_FOCUS);
    // dc = processComposite;
    // createBasicComposite(tabFactory.getTabComposite(), element, null);
    tabFactory.getTabComposite().layout();
    tabFactory.addSelectionChangedListener(new ISelectionChangedListener() {

        @Override
        public void selectionChanged(SelectionChangedEvent event) {
            IStructuredSelection selection = (IStructuredSelection) event.getSelection();
            TalendPropertyTabDescriptor descriptor = (TalendPropertyTabDescriptor) selection.getFirstElement();
            if (descriptor == null) {
                return;
            }
            if (currentSelectedTab != null && (currentSelectedTab.getCategory() != descriptor.getCategory())) {
                for (Control curControl : tabFactory.getTabComposite().getChildren()) {
                    curControl.dispose();
                }
            }
            if (currentSelectedTab == null || currentSelectedTab.getCategory() != descriptor.getCategory() || selectedPrimary) {
                currentSelectedTab = descriptor;
                selectedPrimary = false;
                createDynamicComposite(tabFactory.getTabComposite(), (Element) descriptor.getData(), descriptor.getCategory());
            }
        }
    });
    setElement();
    IHandlerService handlerService = (IHandlerService) getSite().getService(IHandlerService.class);
    IHandler handler1;
    IBrandingService brandingService = (IBrandingService) GlobalServiceRegister.getDefault().getService(IBrandingService.class);
    if (brandingService.getBrandingConfiguration().isAllowDebugMode()) {
        Action debugAction = new DebugAction();
        handler1 = new ActionHandler(debugAction);
        handlerService.activateHandler(debugAction.getActionDefinitionId(), handler1);
    }
    Action killAction = new KillAction();
    handler1 = new ActionHandler(killAction);
    handlerService.activateHandler(killAction.getActionDefinitionId(), handler1);
    FocusListener fl = new FocusListener() {

        @Override
        public void focusGained(FocusEvent e) {
            //$NON-NLS-1$
            log.trace(Messages.getString("ProcessView.gainFocusLog"));
            IContextService contextService = (IContextService) RunProcessPlugin.getDefault().getWorkbench().getAdapter(IContextService.class);
            //$NON-NLS-1$
            ca = contextService.activateContext("talend.runProcess");
        }

        @Override
        public void focusLost(FocusEvent e) {
            //$NON-NLS-1$
            log.trace(Messages.getString("ProcessView.lostFocusLog"));
            if (ca != null) {
                IContextService contextService = (IContextService) RunProcessPlugin.getDefault().getWorkbench().getAdapter(IContextService.class);
                contextService.deactivateContext(ca);
            }
        }
    };
    addListenerOnChildren(parent, fl);
    rubjobManager.setProcessShell(getSite().getShell());
    contextManagerListener = new PropertyChangeListener() {

        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            if (RunProcessContextManager.PROP_ACTIVE.equals(evt.getPropertyName())) {
                // rubjobManager.setBooleanTrace(false);
                runningProcessChanged();
            }
        }
    };
    RunProcessPlugin.getDefault().getRunProcessContextManager().addPropertyChangeListener(contextManagerListener);
    runAction = new RunAction();
}
Also used : Action(org.eclipse.jface.action.Action) ClearPerformanceAction(org.talend.designer.runprocess.ui.actions.ClearPerformanceAction) PropertyChangeListener(java.beans.PropertyChangeListener) Element(org.talend.core.model.process.Element) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) FocusEvent(org.eclipse.swt.events.FocusEvent) GridLayout(org.eclipse.swt.layout.GridLayout) ProcessContextComposite(org.talend.designer.runprocess.ui.ProcessContextComposite) Control(org.eclipse.swt.widgets.Control) Button(org.eclipse.swt.widgets.Button) IContextService(org.eclipse.ui.contexts.IContextService) FormAttachment(org.eclipse.swt.layout.FormAttachment) FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) PropertyChangeEvent(java.beans.PropertyChangeEvent) TraceDebugProcessComposite(org.talend.designer.runprocess.ui.TraceDebugProcessComposite) Composite(org.eclipse.swt.widgets.Composite) TargetExecComposite(org.talend.designer.runprocess.ui.TargetExecComposite) MemoryRuntimeComposite(org.talend.designer.runprocess.ui.MemoryRuntimeComposite) AdvanceSettingComposite(org.talend.designer.runprocess.ui.AdvanceSettingComposite) MultipleThreadDynamicComposite(org.talend.designer.core.ui.views.properties.MultipleThreadDynamicComposite) ProcessComposite(org.talend.designer.runprocess.ui.ProcessComposite) ProcessContextComposite(org.talend.designer.runprocess.ui.ProcessContextComposite) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) FillLayout(org.eclipse.swt.layout.FillLayout) TalendPropertyTabDescriptor(org.talend.core.ui.properties.tab.TalendPropertyTabDescriptor) IBrandingService(org.talend.core.ui.branding.IBrandingService) SashForm(org.eclipse.swt.custom.SashForm) IHandlerService(org.eclipse.ui.handlers.IHandlerService) GridData(org.eclipse.swt.layout.GridData) IHandler(org.eclipse.core.commands.IHandler) ActionHandler(org.eclipse.ui.commands.ActionHandler) FocusListener(org.eclipse.swt.events.FocusListener)

Example 18 with FormLayout

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

the class MemoryRuntimeComposite method initRuntimeGraphs.

private void initRuntimeGraphs(final Composite parent) {
    ISelection processContextSelection = viewPart.getSite().getSelectionProvider() == null ? null : viewPart.getSelection();
    setExpandHorizontal(true);
    setExpandVertical(true);
    FormData layouData = new FormData();
    layouData.left = new FormAttachment(0, 0);
    layouData.right = new FormAttachment(100, 0);
    layouData.top = new FormAttachment(0, 0);
    layouData.bottom = new FormAttachment(100, 0);
    this.setBackground(parent.getBackground());
    this.setLayout(new FormLayout());
    setLayoutData(layouData);
    monitorComposite = new Composite(this, SWT.NULL);
    FormData baseData = new FormData();
    baseData.left = new FormAttachment(0, 0);
    baseData.right = new FormAttachment(100, 0);
    baseData.top = new FormAttachment(0, 0);
    baseData.bottom = new FormAttachment(100, 0);
    monitorComposite.setLayout(new FormLayout());
    monitorComposite.setLayoutData(layouData);
    setContent(monitorComposite);
    Group topGroup = createTopGroup(monitorComposite);
    runtimeButton = new Button(topGroup, SWT.PUSH);
    if (processContext != null) {
        setRuntimeButtonByStatus(!processContext.isMonitoring());
    } else {
        setRuntimeButtonByStatus(true);
    }
    runtimeButton.setEnabled(true);
    GridData runButtonData = new GridData();
    Point execSize = null;
    execSize = computeSize(runtimeButton.getText());
    runButtonData.widthHint = execSize.x + 70;
    runtimeButton.setLayoutData(runButtonData);
    gcCheckButton = new Button(topGroup, SWT.CHECK);
    GridData gcCheckButtonData = new GridData();
    gcCheckButtonData.grabExcessHorizontalSpace = false;
    gcCheckButton.setLayoutData(gcCheckButtonData);
    gcCheckButton.setEnabled(true);
    gcCheckButton.setSelection(isGCSelected);
    Label periodLabel = new Label(topGroup, SWT.NULL);
    //$NON-NLS-1$
    periodLabel.setText(Messages.getString("ProcessView.moniorPeriod"));
    periodLabel.setBackground(getBackground());
    GridData periodLabelData = new GridData();
    execSize = computeSize(periodLabel.getText());
    periodLabelData.widthHint = execSize.x;
    periodLabelData.grabExcessHorizontalSpace = false;
    periodLabelData.horizontalAlignment = GridData.BEGINNING;
    periodLabel.setLayoutData(periodLabelData);
    periodCombo = new Combo(topGroup, SWT.READ_ONLY);
    GridData periodData = new GridData();
    execSize = computeSize("Select");
    periodData.widthHint = execSize.x;
    periodData.grabExcessHorizontalSpace = false;
    periodData.horizontalAlignment = GridData.BEGINNING;
    periodData.minimumWidth = execSize.x;
    periodCombo.setLayoutData(periodData);
    periodCombo.setItems(new String[] { "Select", "30 sec", "60 sec", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
    "120 sec" });
    periodCombo.setEnabled(isGCSelected);
    if (isGCSelected) {
        periodCombo.select(periodComboSelectionIndex);
    } else {
        periodCombo.select(0);
        periodComboSelectionIndex = 0;
    }
    contextCombo = new ComboViewer(topGroup, SWT.BORDER | SWT.READ_ONLY);
    contextCombo.getCombo().setLayout(new FormLayout());
    GridData contextComboData = new GridData();
    contextComboData.grabExcessHorizontalSpace = true;
    contextComboData.horizontalAlignment = GridData.END;
    //$NON-NLS-N$
    execSize = computeSize("Default");
    contextComboData.minimumWidth = execSize.x;
    contextCombo.getCombo().setLayoutData(contextComboData);
    contextCombo.setContentProvider(ArrayContentProvider.getInstance());
    contextCombo.setLabelProvider(new ContextNameLabelProvider());
    initContextInput();
    chartComposite = new RuntimeGraphcsComposite(monitorComposite, processContextSelection, SWT.NULL);
    FormLayout rgcLayout = new FormLayout();
    FormData charLayData = new FormData();
    charLayData.left = new FormAttachment(0, 10);
    charLayData.right = new FormAttachment(100, 0);
    charLayData.top = new FormAttachment(topGroup, 60, SWT.BOTTOM);
    charLayData.bottom = new FormAttachment(100, 0);
    chartComposite.setLayout(rgcLayout);
    chartComposite.setLayoutData(charLayData);
}
Also used : FormData(org.eclipse.swt.layout.FormData) FormLayout(org.eclipse.swt.layout.FormLayout) Group(org.eclipse.swt.widgets.Group) Composite(org.eclipse.swt.widgets.Composite) AbstractRuntimeGraphcsComposite(org.talend.designer.runtime.visualization.views.AbstractRuntimeGraphcsComposite) RuntimeGraphcsComposite(org.talend.designer.runtime.visualization.views.RuntimeGraphcsComposite) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) Label(org.eclipse.swt.widgets.Label) Combo(org.eclipse.swt.widgets.Combo) Point(org.eclipse.swt.graphics.Point) Button(org.eclipse.swt.widgets.Button) ComboViewer(org.eclipse.jface.viewers.ComboViewer) AbstractRuntimeGraphcsComposite(org.talend.designer.runtime.visualization.views.AbstractRuntimeGraphcsComposite) RuntimeGraphcsComposite(org.talend.designer.runtime.visualization.views.RuntimeGraphcsComposite) ISelection(org.eclipse.jface.viewers.ISelection) GridData(org.eclipse.swt.layout.GridData) FormAttachment(org.eclipse.swt.layout.FormAttachment)

Example 19 with FormLayout

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

the class TraceDebugProcessComposite method createLineLimitedControl.

private void createLineLimitedControl(Composite container) {
    Composite composite = new Composite(container, SWT.NONE);
    composite.setLayoutData(new GridData());
    FormLayout formLayout = new FormLayout();
    formLayout.marginWidth = 7;
    formLayout.marginHeight = 4;
    formLayout.spacing = 7;
    composite.setLayout(formLayout);
    enableLineLimitButton = new Button(composite, SWT.CHECK);
    //$NON-NLS-1$
    enableLineLimitButton.setText(Messages.getString("ProcessComposite.lineLimited"));
    FormData formData = new FormData();
    enableLineLimitButton.setLayoutData(formData);
    enableLineLimitButton.setEnabled(false);
    enableLineLimitButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            lineLimitText.setEditable(enableLineLimitButton.getSelection());
            RunProcessPlugin.getDefault().getPluginPreferences().setValue(RunprocessConstants.ENABLE_CONSOLE_LINE_LIMIT, enableLineLimitButton.getSelection());
        }
    });
    lineLimitText = new Text(composite, SWT.BORDER);
    formData = new FormData();
    formData.width = 120;
    formData.left = new FormAttachment(enableLineLimitButton, 0, SWT.RIGHT);
    lineLimitText.setLayoutData(formData);
    lineLimitText.setEnabled(false);
    lineLimitText.addListener(SWT.Verify, new Listener() {

        // this text only receive number here.
        @Override
        public void handleEvent(Event e) {
            String s = e.text;
            if (!s.equals("")) {
                //$NON-NLS-1$
                try {
                    Integer.parseInt(s);
                    RunProcessPlugin.getDefault().getPluginPreferences().setValue(RunprocessConstants.CONSOLE_LINE_LIMIT_COUNT, lineLimitText.getText() + s);
                } catch (Exception ex) {
                    e.doit = false;
                }
            }
        }
    });
    lineLimitText.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            RunProcessPlugin.getDefault().getPluginPreferences().setValue(RunprocessConstants.CONSOLE_LINE_LIMIT_COUNT, lineLimitText.getText());
        }
    });
    boolean enable = RunProcessPlugin.getDefault().getPluginPreferences().getBoolean(RunprocessConstants.ENABLE_CONSOLE_LINE_LIMIT);
    enableLineLimitButton.setSelection(enable);
    lineLimitText.setEditable(enable);
    String count = RunProcessPlugin.getDefault().getPluginPreferences().getString(RunprocessConstants.CONSOLE_LINE_LIMIT_COUNT);
    if (count.equals("")) {
        //$NON-NLS-1$
        //$NON-NLS-1$
        count = "100";
    }
    lineLimitText.setText(count);
}
Also used : FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) IStreamListener(org.eclipse.debug.core.IStreamListener) PropertyChangeListener(java.beans.PropertyChangeListener) Listener(org.eclipse.swt.widgets.Listener) ModifyListener(org.eclipse.swt.events.ModifyListener) Composite(org.eclipse.swt.widgets.Composite) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) ModifyListener(org.eclipse.swt.events.ModifyListener) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) StyledText(org.eclipse.swt.custom.StyledText) Text(org.eclipse.swt.widgets.Text) ModifyEvent(org.eclipse.swt.events.ModifyEvent) Button(org.eclipse.swt.widgets.Button) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) ModifyEvent(org.eclipse.swt.events.ModifyEvent) Event(org.eclipse.swt.widgets.Event) PropertyChangeEvent(java.beans.PropertyChangeEvent) SelectionEvent(org.eclipse.swt.events.SelectionEvent) FormAttachment(org.eclipse.swt.layout.FormAttachment)

Example 20 with FormLayout

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

the class TOSLoginComposite method createTosWorkspaceArea.

private void createTosWorkspaceArea(Composite parent) {
    tosWorkspaceComposite = toolkit.createComposite(parent);
    tosWorkspaceComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    tosWorkspaceComposite.setLayout(new FormLayout());
    tosWorkspaceComposite.setBackgroundMode(SWT.INHERIT_DEFAULT);
    FormData data;
    Label workSpaceLabel = toolkit.createLabel(tosWorkspaceComposite, Messages.getString("TOSLoginComposite.workspaceLabel"));
    workSpaceLabel.setFont(font);
    GC gc = new GC(workSpaceLabel);
    Point labelSize = gc.stringExtent(Messages.getString("TOSLoginComposite.workspaceLabel"));
    gc.dispose();
    data = new FormData();
    data.top = new FormAttachment(0, 10);
    data.left = new FormAttachment(0, 10);
    data.right = new FormAttachment(0, 10 + labelSize.x);
    data.bottom = new FormAttachment(0, 30);
    workSpaceLabel.setLayoutData(data);
    changeButton = toolkit.createButton(tosWorkspaceComposite, null, SWT.PUSH);
    data = new FormData();
    data.top = new FormAttachment(workSpaceLabel, 0, SWT.TOP);
    data.left = new FormAttachment(100, -75);
    data.right = new FormAttachment(100, -10);
    if (Platform.getOS().equals(Platform.OS_WIN32)) {
        data.bottom = new FormAttachment(workSpaceLabel, 0, SWT.BOTTOM);
    } else if (Platform.getOS().equals(Platform.OS_LINUX)) {
        data.bottom = new FormAttachment(workSpaceLabel, 5, SWT.BOTTOM);
    } else {
        data.bottom = new FormAttachment(workSpaceLabel, 5, SWT.BOTTOM);
    }
    changeButton.setText(Messages.getString("TOSLoginComposite.changeButton"));
    changeButton.setFont(font);
    changeButton.setLayoutData(data);
    workspaceText = toolkit.createText(tosWorkspaceComposite, null, SWT.READ_ONLY | SWT.BORDER);
    workspaceText.setFont(font);
    workspaceText.setBackground(GREY_COLOR);
    workspaceText.setText(loginComposite.getConnection().getWorkSpace());
    oldPath = loginComposite.getConnection().getWorkSpace();
    data = new FormData();
    data.width = 200;
    data.top = new FormAttachment(workSpaceLabel, 0, SWT.TOP);
    data.left = new FormAttachment(workSpaceLabel, 10, SWT.RIGHT);
    data.right = new FormAttachment(changeButton, -10, SWT.LEFT);
    data.bottom = new FormAttachment(changeButton, 0, SWT.BOTTOM);
    workspaceText.setLayoutData(data);
}
Also used : FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) GridData(org.eclipse.swt.layout.GridData) Label(org.eclipse.swt.widgets.Label) Point(org.eclipse.swt.graphics.Point) GC(org.eclipse.swt.graphics.GC) FormAttachment(org.eclipse.swt.layout.FormAttachment)

Aggregations

FormLayout (org.eclipse.swt.layout.FormLayout)726 FormData (org.eclipse.swt.layout.FormData)651 FormAttachment (org.eclipse.swt.layout.FormAttachment)649 Label (org.eclipse.swt.widgets.Label)503 Button (org.eclipse.swt.widgets.Button)484 SelectionEvent (org.eclipse.swt.events.SelectionEvent)444 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)407 Text (org.eclipse.swt.widgets.Text)390 Composite (org.eclipse.swt.widgets.Composite)384 Shell (org.eclipse.swt.widgets.Shell)365 ModifyListener (org.eclipse.swt.events.ModifyListener)355 Listener (org.eclipse.swt.widgets.Listener)354 Event (org.eclipse.swt.widgets.Event)352 ModifyEvent (org.eclipse.swt.events.ModifyEvent)350 Display (org.eclipse.swt.widgets.Display)343 ShellEvent (org.eclipse.swt.events.ShellEvent)335 ShellAdapter (org.eclipse.swt.events.ShellAdapter)330 TextVar (org.pentaho.di.ui.core.widget.TextVar)220 ColumnInfo (org.pentaho.di.ui.core.widget.ColumnInfo)200 TableView (org.pentaho.di.ui.core.widget.TableView)198