Package pl.net.bluesoft.rnd.processtool.model.dict

Examples of pl.net.bluesoft.rnd.processtool.model.dict.ProcessDictionary


    protected RegisteredDictionaryHolder<GlobalDictionaryProvider> globalDictionaryHolder =
            new RegisteredDictionaryHolder<GlobalDictionaryProvider>();

    public ProcessDictionary getSpecificOrDefaultOrGlobalDictionary(ProcessDefinitionConfig definition,
                                                                    String providerId, String dictionaryId, String languageCode) {
        ProcessDictionary dictionary = getSpecificOrDefaultProcessDictionary(definition, providerId, dictionaryId, languageCode);
            if (dictionary == null) {
            dictionary = getSpecificOrDefaultGlobalDictionary(providerId, dictionaryId, languageCode);
            }
        return dictionary;
        }
View Full Code Here


        return dictionary;
        }

    public ProcessDictionary getSpecificOrDefaultProcessDictionary(ProcessDefinitionConfig definition,
                                                                   String providerId, String dictionaryId, String languageCode) {
        ProcessDictionary dictionary = getSpecificProcessDictionary(definition, providerId, dictionaryId, languageCode);
        if (dictionary == null) {
            dictionary = getDefaultProcessDictionary(definition, providerId, dictionaryId);
        }
        return dictionary;
    }
View Full Code Here

    public void addProcessDictionaryProvider(String providerId, ProcessDictionaryProvider provider) {
        processDictionaryHolder.addDictionaryProvider(providerId, provider);
    }

    public ProcessDictionary getSpecificOrDefaultGlobalDictionary(String providerId, String dictionaryId, String languageCode) {
        ProcessDictionary dictionary = getSpecificGlobalDictionary(providerId, dictionaryId, languageCode);
        if (dictionary == null) {
            dictionary = getDefaultGlobalDictionary(providerId, dictionaryId);
        }
        return dictionary;
    }
View Full Code Here

        this.cache = new ExpiringCache<String, ProcessDictionary>(Strings.hasText(interval) ? Integer.parseInt(interval) * 1000L : DEFAULT_CACHE_REFRESH_INTERVAL);
    }

    @Override
    public boolean hasFullyLocalizedMessage(String key, Locale locale) {
        ProcessDictionary dictionary = fetchSpecificDictionary(fullyLocalizedLanguageCode(locale));
        return dictionary != null && dictionary.containsKey(key);
    }
View Full Code Here

        return dictionary != null && dictionary.containsKey(key);
    }

    @Override
    public boolean hasLocalizedMessage(String key, Locale locale) {
        ProcessDictionary dictionary = fetchSpecificDictionary(localizedLanguageCode(locale));
        return dictionary != null && dictionary.containsKey(key);
    }
View Full Code Here

        return dictionary != null && dictionary.containsKey(key);
    }

    @Override
    public String getMessage(String key, Locale locale) {
        ProcessDictionary dictionary = fetchSpecificDictionary(fullyLocalizedLanguageCode(locale));
        if (dictionary == null) {
            dictionary = fetchSpecificDictionary(localizedLanguageCode(locale));
        }
        if (dictionary == null) {
            dictionary = fetchDefaultDictionary();
        }
        if (dictionary != null && dictionary.containsKey(key)) {
            ProcessDictionaryItem<String, String> item = dictionary.lookup(key);
            ProcessDictionaryItemValue<String> value = item.getValueForCurrentDate();
            if (value != null) {
                return value.getValue();
            }
        }
View Full Code Here

    private void loadDictionaries() {
        new ComponentEvaluator<AbstractSelect>(dictContainers) {
            @Override
            public void evaluate(AbstractSelect component, WidgetElement element) throws Exception {
             
                ProcessDictionary dict = nvl(element.getGlobal(), false) ?
                        processDictionaryRegistry.getSpecificOrDefaultGlobalDictionary(element.getProvider(),
                                element.getDict(), i18NSource.getLocale().toString()) :
                        processDictionaryRegistry.getSpecificOrDefaultProcessDictionary(
                                processInstance.getDefinition(), element.getProvider(),
                                element.getDict(), i18NSource.getLocale().toString());

                if (dict != null) {
                    Date validForDate = getValidForDate(element);
                    int i = 0;
                    for (Object o : dict.items()) {
                        ProcessDictionaryItem item = (ProcessDictionaryItem) o;
                        component.addItem(item.getKey());
                        String itemKey = item.getKey().toString();
                        ProcessDictionaryItemValue val = item.getValueForDate(validForDate);
                        String message = getMessage((String) (val != null ? val.getValue() : item.getKey()));
View Full Code Here

        }
        return BLANK;
    }

    private void addDictionary(String languageCode, String dictionaryName) {
        ProcessDictionary dict = processDictionaryRegistry.getSpecificOrDefaultOrGlobalDictionary(
                processDefinitionConfig, "db", dictionaryName, languageCode);
        if (dict != null) {
            Map<String, String> dictionary = new HashMap<String, String>();
            for (Object item : dict.items()) {
                ProcessDictionaryItem pdItem = (ProcessDictionaryItem) item;
                dictionary.put(pdItem.getKey().toString(), pdItem.getValueForCurrentDate().toString());
            }
            dictionaryMap.put(dictionaryKey(languageCode, dictionaryName), dictionary);
        }
View Full Code Here

    ProcessDictionaryRegistry registry = ctx.getProcessDictionaryRegistry();

    List<ProcessDictionary> dictionaries = new ArrayList<ProcessDictionary>();

    for (ProcessDefinitionConfig definition : definitions) {
      ProcessDictionary dictProcess = registry.getSpecificOrDefaultProcessDictionary(definition, "db", dictionary, i18NSource.getLocale().toString());

      if (dictProcess != null) {
        dictionaries.add(dictProcess);
      }
    }

    ProcessDictionary dictGlobal = registry.getSpecificOrDefaultGlobalDictionary("db", dictionary, i18NSource.getLocale().toString());

    if (dictGlobal != null) {
      dictionaries.add(dictGlobal);
    }
View Full Code Here

public class HelpUtility {
  public static Component helpIcon(final Application application, final I18NSource i18NSource, ContextHelp contextHelp, String dictionary, String key,
      Boolean showDebugKey, Component optionalComponent, Placement popupPlacement) {
    ProcessToolContext ctx = ProcessToolContext.Util.getThreadProcessToolContext();
    ProcessDictionaryRegistry processDictionaryRegistry = ctx.getProcessDictionaryRegistry();
    ProcessDictionary dict = processDictionaryRegistry.getSpecificOrDefaultGlobalDictionary("db", dictionary, i18NSource.getLocale().toString());

    return helpIcon(dict, application, i18NSource, contextHelp, key, showDebugKey, optionalComponent, popupPlacement);
  }
View Full Code Here

TOP

Related Classes of pl.net.bluesoft.rnd.processtool.model.dict.ProcessDictionary

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.