Search in sources :

Example 1 with Versioning

use of org.talend.designer.scd.model.Versioning in project tdi-studio-se by Talend.

the class PerlScdDialog method createScdContents.

/**
     * DOC hcw Comment method "createContents".
     * 
     * @param composite
     */
@Override
Control createScdContents(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    GridLayoutFactory.swtDefaults().numColumns(2).equalWidth(true).spacing(20, 10).applyTo(composite);
    GridDataFactory.fillDefaults().applyTo(composite);
    Composite filterUnusedComposite = new Composite(composite, SWT.NONE);
    GridLayoutFactory.swtDefaults().margins(0, 0).spacing(0, 0).applyTo(filterUnusedComposite);
    GridDataFactory.swtDefaults().grab(true, true).applyTo(filterUnusedComposite);
    ViewerFilter filter = createFilter(filterUnusedComposite);
    unusedFields = new FieldSection(filterUnusedComposite, scdManager, false, false);
    //$NON-NLS-1$
    unusedFields.setTitle("Unused", SWTResourceManager.getColor(198, 195, 198));
    unusedFields.setTableInput(scdManager.getUnusedFields());
    unusedFields.getTableViewer().addFilter(filter);
    GridDataFactory.swtDefaults().grab(true, true).applyTo(unusedFields.getControl());
    //$NON-NLS-1$
    addContextHelp(unusedFields.getTableViewer().getTable(), "org.talend.designer.scd.unused");
    type1Fields = new FieldSection(composite, scdManager, false, false);
    //$NON-NLS-1$
    type1Fields.setTitle("Type 1 fields", SWTResourceManager.getColor(255, 203, 0));
    GridDataFactory.swtDefaults().grab(true, true).align(SWT.FILL, SWT.FILL).applyTo(type1Fields.getControl());
    type1Fields.setTableInput(scdManager.getType1Table());
    //$NON-NLS-1$
    addContextHelp(type1Fields.getTableViewer().getTable(), "org.talend.designer.scd.type1");
    sourceKeys = new FieldSection(composite, scdManager, false, false);
    //$NON-NLS-1$
    sourceKeys.setTitle(Messages.getString("PerlScdDialog.sourceKey"), SWTResourceManager.getColor(156, 0, 255));
    GridDataFactory.swtDefaults().grab(true, true).align(SWT.FILL, SWT.FILL).applyTo(sourceKeys.getControl());
    sourceKeys.setTableInput(scdManager.getSourceKeys());
    //$NON-NLS-1$
    addContextHelp(sourceKeys.getTableViewer().getTable(), "org.talend.designer.scd.sourceKey");
    type2Fields = new Type2Section(composite, scdManager);
    //$NON-NLS-1$
    type2Fields.setTitle(Messages.getString("PerlScdDialog.typeField"), SWTResourceManager.getColor(255, 255, 0));
    GridDataFactory.swtDefaults().grab(true, true).align(SWT.FILL, SWT.FILL).applyTo(type2Fields.getControl());
    type2Fields.setTableInput(scdManager.getType2Table());
    type2Fields.setSupportCreationType(false);
    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");
    scdManager.setUnusedFieldsSource(unusedFields);
    ScdSection[] sections = { sourceKeys, type1Fields, type2Fields };
    for (ScdSection scd : sections) {
        scdManager.addUnusedFieldsTarget(scd);
    }
    return composite;
}
Also used : Versioning(org.talend.designer.scd.model.Versioning) Composite(org.eclipse.swt.widgets.Composite) ViewerFilter(org.eclipse.jface.viewers.ViewerFilter)

Example 2 with Versioning

use of org.talend.designer.scd.model.Versioning 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)

Example 3 with Versioning

use of org.talend.designer.scd.model.Versioning in project tdi-studio-se by Talend.

the class ScdManager method reloadType2Parameter.

public void reloadType2Parameter() {
    IElementParameter useL2 = paramsMap.get(ScdParameterConstants.USE_L2);
    if (useL2 != null && useL2.getValue().equals(Boolean.TRUE)) {
        versionData = new Versioning();
        IElementParameter l2FieldsParam = paramsMap.get(ScdParameterConstants.L2_FIELDS_PARAM_NAME);
        List<Map<String, String>> values = (List<Map<String, String>>) l2FieldsParam.getValue();
        type2Table = convertTableParameterValue(values);
        // start date
        versionData.setStartName(getStringParameter(ScdParameterConstants.L2_STARTDATE_FIELD));
        IElementParameter param = paramsMap.get(ScdParameterConstants.L2_STARTDATE_VALUE);
        if (param != null) {
            versionData.setStartType(VersionStartType.getTypeByValue((String) param.getValue()));
            if (versionData.getStartType() == VersionStartType.INPUT_FIELD) {
                versionData.setStartComplement(getStringParameter(ScdParameterConstants.L2_STARTDATE_INPUT_FIELD));
            }
        }
        // end date
        versionData.setEndName(getStringParameter(ScdParameterConstants.L2_ENDDATE_FIELD));
        param = paramsMap.get(ScdParameterConstants.L2_ENDDATE_VALUE);
        if (param != null) {
            versionData.setEndType(VersionEndType.getTypeByValue((String) param.getValue()));
            if (versionData.getEndType() == VersionEndType.FIXED_YEAR) {
                versionData.setEndComplement(getStringParameter(ScdParameterConstants.L2_ENDDATE_FIXED_VALUE));
            }
        }
        // version
        versionData.setVersionChecked(getBooleanParameter(ScdParameterConstants.USE_L2_VERSION));
        if (versionData.isVersionChecked()) {
            versionData.setVersionName(getStringParameter(ScdParameterConstants.L2_VERSION_FIELD));
        }
        // activate
        versionData.setActiveChecked(getBooleanParameter(ScdParameterConstants.USE_L2_ACTIVE));
        if (versionData.isActiveChecked()) {
            versionData.setActiveName(getStringParameter(ScdParameterConstants.L2_ACTIVE_FIELD));
        }
    }
}
Also used : Versioning(org.talend.designer.scd.model.Versioning) IElementParameter(org.talend.core.model.process.IElementParameter) ArrayList(java.util.ArrayList) List(java.util.List) HashMap(java.util.HashMap) Map(java.util.Map)

Aggregations

Versioning (org.talend.designer.scd.model.Versioning)3 ViewerFilter (org.eclipse.jface.viewers.ViewerFilter)2 Composite (org.eclipse.swt.widgets.Composite)2 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1 SashForm (org.eclipse.swt.custom.SashForm)1 Point (org.eclipse.swt.graphics.Point)1 GridData (org.eclipse.swt.layout.GridData)1 GridLayout (org.eclipse.swt.layout.GridLayout)1 Label (org.eclipse.swt.widgets.Label)1 IElementParameter (org.talend.core.model.process.IElementParameter)1