Search in sources :

Example 66 with SashForm

use of org.eclipse.swt.custom.SashForm in project cubrid-manager by CUBRID.

the class MultiSQLQueryResultComposite method initialize.

public void initialize() {
    //count column row count and weights
    int columnCount = (int) Math.ceil(Math.sqrt((double) sqlList.size()));
    int rowCount = (int) Math.ceil(((double) sqlList.size() / (double) columnCount));
    int[] columnWeights = new int[columnCount];
    for (int i = 0; i < columnCount; i++) {
        columnWeights[i] = 100 / columnCount;
    }
    int[] rowWeights = new int[rowCount];
    for (int i = 0; i < rowCount; i++) {
        rowWeights[i] = 100 / rowCount;
    }
    //create row
    SashForm horizontalMainForm = createSashForm(this, SWT.VERTICAL, columnCount);
    List<SashForm> verticalFormList = new ArrayList<SashForm>();
    for (int i = 0; i < rowCount; i++) {
        SashForm verticalForm = createSashForm(horizontalMainForm, SWT.HORIZONTAL, rowCount);
        verticalFormList.add(verticalForm);
    }
    setWeightsToSashForm(horizontalMainForm, rowWeights);
    //create column
    for (int i = 0; i < verticalFormList.size(); i++) {
        SashForm verticalForm = verticalFormList.get(i);
        for (int j = 0; j < columnCount; j++) {
            createResultQueryResultComposite(verticalForm, getAssignSQL());
        }
        setWeightsToSashForm(verticalForm, columnWeights);
    }
    assignIndex = 0;
}
Also used : SashForm(org.eclipse.swt.custom.SashForm) ArrayList(java.util.ArrayList)

Example 67 with SashForm

use of org.eclipse.swt.custom.SashForm in project tdi-studio-se by Talend.

the class HL7OutputUI method createContent.

/**
     * Comment method "createContent".
     *
     * @param child
     */
private void createContent(Composite mainComposite) {
    // this.isRepository);
    if (this.hl7Manager.isRepetable()) {
    // header.updateStatus("");
    }
    // Splitter
    xmlToSchemaSash = new SashForm(mainComposite, SWT.HORIZONTAL | SWT.SMOOTH);
    xmlToSchemaSash.setLayoutData(new GridData(GridData.FILL_BOTH));
    xmlToSchemaSash.setBackgroundMode(SWT.INHERIT_FORCE);
    canModify = externalNode.getProcess().isReadOnly();
    if (externalNode.getOriginalNode().getJobletNode() != null) {
        canModify = externalNode.getOriginalNode().isReadOnly();
    }
    IElementParameter propertyParam = externalNode.getElementParameter(EParameterName.PROPERTY_TYPE.getName());
    if (propertyParam != null) {
        isRespo = propertyParam.getValue().equals("REPOSITORY");
    }
    addSchemaViewer(xmlToSchemaSash, 300, 110);
    addXMLViewer(xmlToSchemaSash, 400, 110);
    xmlToSchemaSash.setWeights(new int[] { 40, 60 });
    linker = new SchemaXMLLinker(this.xmlToSchemaSash);
    linker.init(schemaViewer.getTable(), xmlViewer);
    linker.setManager(hl7Manager);
    initSchemaTable();
    new FooterComposite(mainComposite, SWT.NONE, hl7Manager);
    redrawLinkers();
}
Also used : SashForm(org.eclipse.swt.custom.SashForm) FooterComposite(org.talend.designer.hl7.ui.footer.FooterComposite) GridData(org.eclipse.swt.layout.GridData) IElementParameter(org.talend.core.model.process.IElementParameter) SchemaXMLLinker(org.talend.designer.hl7.ui.edit.SchemaXMLLinker)

Example 68 with SashForm

use of org.eclipse.swt.custom.SashForm in project tdi-studio-se by Talend.

the class PigExpressionBuilderDialog method createDialogArea.

@Override
protected Control createDialogArea(Composite parent) {
    container = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    container.setLayout(layout);
    container.setLayoutData(new GridData(GridData.FILL_BOTH));
    applyDialogFont(container);
    final SashForm sashForm = new SashForm(container, SWT.NONE);
    sashForm.setOrientation(SWT.VERTICAL);
    final Composite upperComposite = new Composite(sashForm, SWT.NONE);
    upperComposite.setLayout(new FillLayout());
    final SashForm upperSashform = new SashForm(upperComposite, SWT.NONE);
    expressionComposite = new PigExpressionComposite(this, upperSashform, SWT.NONE, dataBean);
    expressionComposite.setExpression(defaultExpression, true);
    testComposite = new PigInputTableComposite(upperSashform, SWT.NONE);
    testComposite.addVariables(defaultVariables);
    upperSashform.setWeights(new int[] { 3, 2 });
    final Composite lowerComposite = new Composite(sashForm, SWT.NONE);
    lowerComposite.setLayout(new FillLayout());
    categoryComposite = new PigCategoryComposite(lowerComposite, SWT.NONE, manager);
    final GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
    sashForm.setLayoutData(gridData);
    sashForm.setWeights(new int[] { 3, 2 });
    return container;
}
Also used : SashForm(org.eclipse.swt.custom.SashForm) GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) GridData(org.eclipse.swt.layout.GridData) FillLayout(org.eclipse.swt.layout.FillLayout)

Example 69 with SashForm

use of org.eclipse.swt.custom.SashForm in project tdi-studio-se by Talend.

the class ImportDemoProjectItemsPage method createControl.

/*
     * (non-Javadoc)
     * 
     * @see
     * org.eclipse.ui.internal.wizards.datatransfer.WizardFileSystemResourceExportPage1#createControl(org.eclipse.swt
     * .widgets.Composite)
     */
@Override
public void createControl(Composite parent) {
    Composite container = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.verticalSpacing = 10;
    container.setLayout(layout);
    container.setLayoutData(new GridData(GridData.FILL_BOTH));
    Label label = new Label(container, SWT.NONE);
    //$NON-NLS-1$
    label.setText(Messages.getString("ImportDemoProjectPage.availableProjectsPrompt"));
    GridData gd = new GridData();
    label.setLayoutData(gd);
    SashForm sashForm = new SashForm(container, SWT.HORIZONTAL);
    gd = new GridData(GridData.FILL_BOTH);
    gd.widthHint = 300;
    sashForm.setLayoutData(gd);
    wizardSelectionViewer = CheckboxTableViewer.newCheckList(sashForm, SWT.CHECK | SWT.SINGLE);
    wizardSelectionViewer.getTable().setLayoutData(new GridData(GridData.FILL_BOTH));
    wizardSelectionViewer.addCheckStateListener(this);
    wizardSelectionViewer.addSelectionChangedListener(new ISelectionChangedListener() {

        @Override
        public void selectionChanged(SelectionChangedEvent event) {
            if (((IStructuredSelection) event.getSelection()).getFirstElement() instanceof DemoProjectBean) {
                DemoProjectBean selectNode = (DemoProjectBean) ((IStructuredSelection) event.getSelection()).getFirstElement();
                showDescriptionIn(selectNode);
            }
        }
    });
    createDescriptionIn(sashForm);
    initializeViewer();
    Dialog.applyDialogFont(container);
    setControl(container);
}
Also used : SashForm(org.eclipse.swt.custom.SashForm) GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) GridData(org.eclipse.swt.layout.GridData) Label(org.eclipse.swt.widgets.Label) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection)

Example 70 with SashForm

use of org.eclipse.swt.custom.SashForm in project tdi-studio-se by Talend.

the class JavaScdDialog method createScdContents.

/**
     * DOC hcw Comment method "createContents".
     * 
     * @param composite
     */
@Override
Control createScdContents(Composite parent) {
    SashForm sashForm = new SashForm(parent, SWT.VERTICAL | SWT.SMOOTH);
    GridDataFactory.fillDefaults().grab(true, true).applyTo(sashForm);
    sashForm.setLayout(new GridLayout(1, true));
    sashForm.SASH_WIDTH = 1;
    Composite sashPart1 = new Composite(sashForm, SWT.NONE);
    GridLayoutFactory.swtDefaults().numColumns(2).equalWidth(true).spacing(20, 10).applyTo(sashPart1);
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, true).applyTo(sashPart1);
    Composite filterUnusedComposite = new Composite(sashPart1, SWT.NONE);
    GridLayoutFactory.swtDefaults().margins(0, 0).spacing(0, 0).applyTo(filterUnusedComposite);
    GridDataFactory.fillDefaults().span(1, 2).grab(true, true).applyTo(filterUnusedComposite);
    ViewerFilter filter = createFilter(filterUnusedComposite);
    unusedFields = new FieldSection(filterUnusedComposite, scdManager, false, false);
    unusedFields.setTitle(Messages.getString("JavaScdDialog.unUsed"), //$NON-NLS-1$
    SWTResourceManager.getColor(//$NON-NLS-1$
    198, //$NON-NLS-1$
    195, 198));
    unusedFields.setTableInput(scdManager.getUnusedFields());
    unusedFields.getTableViewer().addFilter(filter);
    unusedFields.setSortable(true);
    GridDataFactory.swtDefaults().grab(true, true).align(SWT.FILL, SWT.FILL).applyTo(unusedFields.getControl());
    //$NON-NLS-1$
    addContextHelp(unusedFields.getTableViewer().getTable(), "org.talend.designer.scd.unused");
    type0Fields = new FieldSection(sashPart1, scdManager, false, false);
    type0Fields.setTitle(Messages.getString("JavaScdDialog.type0Field"), //$NON-NLS-1$
    SWTResourceManager.getColor(//$NON-NLS-1$
    255, 146, 0));
    GridDataFactory.swtDefaults().align(SWT.FILL, SWT.FILL).grab(true, true).applyTo(type0Fields.getControl());
    GridData fieldsData = new GridData(GridData.FILL_BOTH);
    fieldsData.heightHint = 100;
    type0Fields.getControl().setLayoutData(fieldsData);
    type0Fields.setTableInput(scdManager.getType0Table());
    //$NON-NLS-1$
    addContextHelp(type0Fields.getTableViewer().getTable(), "org.talend.designer.scd.type0");
    type1Fields = new FieldSection(sashPart1, scdManager, false, false, ScdParameterConstants.DROP_COPY_TYPE1FIELDS);
    type1Fields.setTitle(Messages.getString("JavaScdDialog.type1Field"), //$NON-NLS-1$
    SWTResourceManager.getColor(//$NON-NLS-1$
    255, 203, 0));
    GridDataFactory.swtDefaults().align(SWT.FILL, SWT.FILL).grab(true, true).applyTo(type1Fields.getControl());
    type1Fields.getControl().setLayoutData(fieldsData);
    type1Fields.setTableInput(scdManager.getType1Table());
    //$NON-NLS-1$
    addContextHelp(type1Fields.getTableViewer().getTable(), "org.talend.designer.scd.type1");
    Composite sashPart2 = new Composite(sashForm, SWT.NONE);
    GridLayoutFactory.swtDefaults().numColumns(2).equalWidth(true).spacing(20, 10).applyTo(sashPart2);
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, true).applyTo(sashPart2);
    sourceKeys = new FieldSection(sashPart2, scdManager, false, false, ScdParameterConstants.DROP_COPY_SOURCEKEYS);
    sourceKeys.setTitle(Messages.getString("JavaScdDialog.sourceKey"), //$NON-NLS-1$
    SWTResourceManager.getColor(//$NON-NLS-1$
    156, //$NON-NLS-1$
    0, 255));
    GridDataFactory.swtDefaults().align(SWT.FILL, SWT.FILL).grab(true, true).applyTo(sourceKeys.getControl());
    sourceKeys.setTableInput(scdManager.getSourceKeys());
    //$NON-NLS-1$
    addContextHelp(sourceKeys.getTableViewer().getTable(), "org.talend.designer.scd.sourceKey");
    type2Fields = new Type2Section(sashPart2, scdManager, ScdParameterConstants.DROP_COPY_TYPE2FIELDS);
    type2Fields.setTitle(Messages.getString("JavaScdDialog.type2Field"), //$NON-NLS-1$
    SWTResourceManager.getColor(//$NON-NLS-1$
    255, 255, 0));
    GridDataFactory.swtDefaults().span(1, 2).align(SWT.FILL, SWT.FILL).grab(true, true).applyTo(type2Fields.getControl());
    type2Fields.setTableInput(scdManager.getType2Table());
    if (scdManager.getVersionData() != null) {
        type2Fields.setVersionInput(scdManager.getVersionData());
    } else {
        type2Fields.setVersionInput(new Versioning());
    }
    //$NON-NLS-1$
    addContextHelp(type2Fields.getTableViewer().getTable(), "org.talend.designer.scd.type2");
    surrogateKeys = new SurrogateSection(sashPart2, scdManager);
    surrogateKeys.setTitle(Messages.getString("JavaScdDialog.surrogateKey"), //$NON-NLS-1$
    SWTResourceManager.getColor(214, 40, 255));
    GridDataFactory.swtDefaults().align(SWT.FILL, SWT.FILL).grab(true, false).applyTo(surrogateKeys.getControl());
    surrogateKeys.setTableInput(scdManager.getSurrogateKeys());
    surrogateKeys.addContextHelp(this);
    Composite sashPart3 = new Composite(sashForm, SWT.NONE);
    GridLayoutFactory.swtDefaults().numColumns(2).equalWidth(true).spacing(20, 10).applyTo(sashPart3);
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, true).applyTo(sashPart3);
    Label placeHolder = new Label(sashPart3, SWT.NONE);
    GridDataFactory.swtDefaults().align(SWT.FILL, SWT.FILL).grab(true, true).applyTo(placeHolder);
    type3Fields = new Type3Section(sashPart3, scdManager);
    type3Fields.setTitle(Messages.getString("JavaScdDialog.type3Key"), //$NON-NLS-1$
    SWTResourceManager.getColor(//$NON-NLS-1$
    24, 182, 255));
    GridDataFactory.swtDefaults().align(SWT.FILL, SWT.FILL).grab(true, true).applyTo(type3Fields.getControl());
    type3Fields.setTableInput(scdManager.getType3Table());
    //$NON-NLS-1$
    addContextHelp(type3Fields.getTable(), "org.talend.designer.scd.type3");
    scdManager.setUnusedFieldsSource(unusedFields);
    ScdSection[] sections = { surrogateKeys, sourceKeys, type0Fields, type1Fields, type2Fields, type3Fields };
    for (ScdSection scd : sections) {
        scdManager.addUnusedFieldsTarget(scd);
    }
    sashForm.setSashWidth(3);
    // the following codes are used to adjust the heights
    int totalHeight = getDialogSize().y;
    sashForm.setWeights(new int[] { totalHeight / 4, totalHeight / 2, totalHeight / 4 });
    return sashForm;
}
Also used : Composite(org.eclipse.swt.widgets.Composite) ViewerFilter(org.eclipse.jface.viewers.ViewerFilter) Label(org.eclipse.swt.widgets.Label) Point(org.eclipse.swt.graphics.Point) SashForm(org.eclipse.swt.custom.SashForm) Versioning(org.talend.designer.scd.model.Versioning) GridLayout(org.eclipse.swt.layout.GridLayout) GridData(org.eclipse.swt.layout.GridData)

Aggregations

SashForm (org.eclipse.swt.custom.SashForm)96 GridData (org.eclipse.swt.layout.GridData)65 GridLayout (org.eclipse.swt.layout.GridLayout)57 Composite (org.eclipse.swt.widgets.Composite)56 SelectionEvent (org.eclipse.swt.events.SelectionEvent)31 FillLayout (org.eclipse.swt.layout.FillLayout)30 Label (org.eclipse.swt.widgets.Label)26 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)25 CTabItem (org.eclipse.swt.custom.CTabItem)14 Button (org.eclipse.swt.widgets.Button)13 StyledText (org.eclipse.swt.custom.StyledText)12 ToolBar (org.eclipse.swt.widgets.ToolBar)12 ArrayList (java.util.ArrayList)11 Point (org.eclipse.swt.graphics.Point)11 Table (org.eclipse.swt.widgets.Table)11 ToolItem (org.eclipse.swt.widgets.ToolItem)11 TableViewer (org.eclipse.jface.viewers.TableViewer)10 Event (org.eclipse.swt.widgets.Event)10 Listener (org.eclipse.swt.widgets.Listener)9 Tree (org.eclipse.swt.widgets.Tree)9