Search in sources :

Example 1 with ResourceLanguageType

use of org.talend.componentdesigner.model.enumtype.ResourceLanguageType 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 ResourceLanguageType

use of org.talend.componentdesigner.model.enumtype.ResourceLanguageType 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)2 ResourceLanguageType (org.talend.componentdesigner.model.enumtype.ResourceLanguageType)2 ArrayList (java.util.ArrayList)1 ILibEntry (org.talend.componentdesigner.model.ILibEntry)1