Example usage for com.google.gwt.i18n.client ConstantsWithLookup getString

List of usage examples for com.google.gwt.i18n.client ConstantsWithLookup getString

Introduction

In this page you can find the example usage for com.google.gwt.i18n.client ConstantsWithLookup getString.

Prototype

String getString(String methodName) throws MissingResourceException;

Source Link

Document

Look up String by method name.

Usage

From source file:com.nabla.dc.client.model.ImportErrorListModel.java

License:Apache License

@Override
protected Record[] recordsFromJson(final String jsonRecords) {
    // convert error code to human readable error message
    final Record[] records = super.recordsFromJson(jsonRecords);
    if (records != null) {
        final ConstantsWithLookup errorMessages = Application.getInstance().getServerErrorResource();
        for (Record record : records) {
            try {
                final String message = errorMessages.getString(record.getAttribute(fields.error()));
                record.setAttribute(fields.error(), message);
            } catch (final Throwable _) {
            }/*from  w  ww .ja  v a2 s  .  c  om*/
        }
    }
    return records;
}

From source file:com.nabla.wapp.shared.model.ValidationException.java

License:Apache License

public Map<String, String> getErrorMessages(final ConstantsWithLookup resource) {
    final Map<String, String> ret = new HashMap<String, String>();
    for (final Map.Entry<String, String> e : errors.entrySet())
        ret.put(e.getKey(), resource.getString(e.getValue()));
    return ret;//from   w w w  .j  a  v  a  2 s.c  o  m
}

From source file:fr.putnami.pwt.core.editor.client.helper.MessageHelper.java

License:Open Source License

public String findMessage(Class<?> propertyType, String key) {
    if (key == null) {
        return null;
    }// w  w w.  j a  v a2  s  .c om
    Class<?> typeToLookup = propertyType == null ? Object.class : propertyType;
    String label = null;
    while (typeToLookup != null && label == null) {
        try {
            ConstantsWithLookup constants = this.constantRegistry.get(typeToLookup);
            if (constants != null) {
                label = constants.getString(key);
            }
        } catch (MissingResourceException exc) {
            label = null;
        }
        typeToLookup = typeToLookup.getSuperclass();
    }

    return label;
}

From source file:org.broadleafcommerce.openadmin.client.MessageManager.java

License:Apache License

@Override
public String getString(String methodName) throws MissingResourceException {
    MissingResourceException backup = null;
    for (int j = constants.size() - 1; j >= 0; j--) {
        ConstantsWithLookup constant = constants.get(j);
        try {/*from w  w  w .  j  a v  a 2 s . com*/
            String temp = constant.getString(methodName);
            return temp;
        } catch (MissingResourceException e) {
            backup = e;
        }
    }
    throw backup;
}

From source file:org.sonatype.nexus.gwt.ui.client.table.DefaultColumnModel.java

License:Open Source License

public DefaultColumnModel(String[] propNames, ConstantsWithLookup constants) {
    headers = new String[propNames.length];
    for (int i = 0; i < propNames.length; i++) {
        headers[i] = constants.getString(Util.convertToJavaStyle("header." + propNames[i]));
    }//from   w  w  w.j a v a 2  s . c o  m
    init();
}

From source file:org.sonatype.nexus.gwt.ui.client.Util.java

License:Open Source License

public static String getStringProperty(ConstantsWithLookup constants, String property) {
    return constants.getString(convertToJavaStyle(property));
}