Search in sources :

Example 1 with JetFileStamp

use of org.talend.componentdesigner.model.enumtype.JetFileStamp in project tdi-studio-se by Talend.

the class WizardJetFilesChoosePage method initialize.

@Override
protected void initialize() {
    if (this.componentPref.getName() == null) {
        useBeginButton.setSelection(true);
        componentPref.setJetFileStamps(JetFileStamp.findFileStamps(true, false, false));
        useDefaultResourceButton.setSelection(true);
        final List<ResourceLanguageType> resourceTypes = new ArrayList<ResourceLanguageType>();
        resourceTypes.add(ResourceLanguageType.DEFAULTRESOURCETYPE);
        componentPref.setResourceLanguageTypes(resourceTypes);
        defaultImageButton.setSelection(true);
    } else {
        // initialize jet file stamp
        for (JetFileStamp fileStamp : componentPref.getJetFileStamps()) {
            switch(fileStamp) {
                case JETBEGINSTAMP:
                    this.useBeginButton.setSelection(true);
                    break;
                case JETMAINSTAMP:
                    this.useMainButton.setSelection(true);
                    break;
                case JETENDSTAMP:
                    this.useEndButton.setSelection(true);
                    break;
                default:
            }
        }
        // initialize resource file language
        for (ResourceLanguageType resourceLangType : componentPref.getResourceLanguageTypes()) {
            switch(resourceLangType) {
                case DEFAULTRESOURCETYPE:
                    this.useDefaultResourceButton.setSelection(true);
                    break;
                case ZHRESOURCETYPE:
                    this.useZHResourceButton.setSelection(true);
                    break;
                case FRRESOURCETYPE:
                    this.useFRResourceButton.setSelection(true);
                    break;
                default:
            }
        }
        // initialize image selection
        if (this.componentPref.getImageURL() == null) {
            defaultImageButton.setSelection(true);
        } else {
            browserImageButton.setSelection(true);
            imageDirectoryText.setText(componentPref.getImageURL());
        }
        // initialize library list selection
        libComposite.setLibEntries(componentPref.getLibEntries());
    }
    setPageComplete(validatePage());
}
Also used : ResourceLanguageType(org.talend.componentdesigner.model.enumtype.ResourceLanguageType) JetFileStamp(org.talend.componentdesigner.model.enumtype.JetFileStamp) ArrayList(java.util.ArrayList)

Example 2 with JetFileStamp

use of org.talend.componentdesigner.model.enumtype.JetFileStamp in project tdi-studio-se by Talend.

the class WizardJetFilesChoosePage method creatFilesSelectionGrp.

private void creatFilesSelectionGrp(Composite groupsComposite) {
    Group filesSelectionGrp = new Group(groupsComposite, SWT.NONE);
    //$NON-NLS-1$
    filesSelectionGrp.setText("Select required Jet files");
    // GridDataFactory.fillDefaults().span(1, 1).grab(true, false).applyTo(
    // filesSelectionGrp);
    filesSelectionGrp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    GridLayout groupLayout = new GridLayout(1, false);
    filesSelectionGrp.setLayout(groupLayout);
    // create the language selection check button
    useBeginButton = new Button(filesSelectionGrp, SWT.CHECK | SWT.RIGHT);
    //$NON-NLS-1$
    useBeginButton.setText(Messages.getString("WizardJetFilesChoosePage.BeginFile"));
    useMainButton = new Button(filesSelectionGrp, SWT.CHECK | SWT.RIGHT);
    //$NON-NLS-1$
    useMainButton.setText(Messages.getString("WizardJetFilesChoosePage.MainFile"));
    useEndButton = new Button(filesSelectionGrp, SWT.CHECK | SWT.RIGHT);
    //$NON-NLS-1$
    useEndButton.setText(Messages.getString("WizardJetFilesChoosePage.EndFile"));
    SelectionListener listener = new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            setPageComplete(validatePage());
            List<JetFileStamp> jetFileTypes = JetFileStamp.findFileStamps(useBeginButton.getSelection(), useMainButton.getSelection(), useEndButton.getSelection());
            componentPref.setJetFileStamps(jetFileTypes);
        }
    };
    useBeginButton.addSelectionListener(listener);
    useMainButton.addSelectionListener(listener);
    useEndButton.addSelectionListener(listener);
}
Also used : Group(org.eclipse.swt.widgets.Group) JetFileStamp(org.talend.componentdesigner.model.enumtype.JetFileStamp) GridLayout(org.eclipse.swt.layout.GridLayout) Button(org.eclipse.swt.widgets.Button) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) SelectionListener(org.eclipse.swt.events.SelectionListener)

Example 3 with JetFileStamp

use of org.talend.componentdesigner.model.enumtype.JetFileStamp in project tdi-studio-se by Talend.

the class ComponentPref method readToString.

/**
     * Parse fields of current class to string.
     * 
     * @return
     */
public String readToString() {
    StringBuffer fields = new StringBuffer(getName() + FIELDS_SEPARATOR + getLanguageType().getNameSuffix() + FIELDS_SEPARATOR);
    // 1. append jetFileTypes
    if (this.getJetFileStamps().size() > 0) {
        for (JetFileStamp fileStamp : getJetFileStamps()) {
            fields.append(fileStamp.getFileStampName());
            fields.append(INTERNAL_FIELDS_SEPARATOR);
        }
    }
    fields.append(FIELDS_SEPARATOR);
    // 2. append resourceFileTypes.
    if (this.resourceLanguageTypes.size() > 0) {
        for (ResourceLanguageType resourceType : resourceLanguageTypes) {
            fields.append(resourceType.getLang());
            fields.append(INTERNAL_FIELDS_SEPARATOR);
        }
    }
    fields.append(FIELDS_SEPARATOR);
    // 3. append imageUrl String.
    if (this.imageURL == null) {
        fields.append(PluginConstant.EMPTY_STRING);
    } else {
        fields.append(imageURL);
    }
    fields.append(FIELDS_SEPARATOR);
    // 4. append library entries string.
    if (libEntries != null && this.libEntries.length > 0) {
        for (ILibEntry entry : this.libEntries) {
            fields.append(entry.getName());
            fields.append(EQUEL_FIELDS_SEPARATOR);
            fields.append(entry.isExternal());
            fields.append(EQUEL_FIELDS_SEPARATOR);
            fields.append(entry.getLocation());
            fields.append(INTERNAL_FIELDS_SEPARATOR);
        }
    }
    return fields.toString();
}
Also used : ILibEntry(org.talend.componentdesigner.model.ILibEntry) JetFileStamp(org.talend.componentdesigner.model.enumtype.JetFileStamp) ResourceLanguageType(org.talend.componentdesigner.model.enumtype.ResourceLanguageType)

Aggregations

JetFileStamp (org.talend.componentdesigner.model.enumtype.JetFileStamp)3 ResourceLanguageType (org.talend.componentdesigner.model.enumtype.ResourceLanguageType)2 ArrayList (java.util.ArrayList)1 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)1 SelectionEvent (org.eclipse.swt.events.SelectionEvent)1 SelectionListener (org.eclipse.swt.events.SelectionListener)1 GridData (org.eclipse.swt.layout.GridData)1 GridLayout (org.eclipse.swt.layout.GridLayout)1 Button (org.eclipse.swt.widgets.Button)1 Group (org.eclipse.swt.widgets.Group)1 ILibEntry (org.talend.componentdesigner.model.ILibEntry)1