com.google.gwt.i18n.client.Dictionary Java Examples

The following examples show how to use com.google.gwt.i18n.client.Dictionary. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AboutWindow.java    From proarc with GNU General Public License v3.0 6 votes vote down vote up
private Dialog init(ClientMessages i18n) {
    String appendMsg;
    try {
        Dictionary dictionary = Dictionary.getDictionary("aboutProArc");
        appendMsg = dictionary.get(LanguagesDataSource.activeLocale());
    } catch (MissingResourceException e) {
        appendMsg = "";
    }
    String rev = String.valueOf(i18n.proarc_build_revision());
    rev = rev.length() < 9 ? rev : rev.substring(0, 9);
    String msg = i18n.AboutWindow_Msg(
            i18n.proarc_version(),
            i18n.proarc_build_timestamp(), rev);

    Dialog d = new Dialog();
    d.setTitle(i18n.AboutWindow_Title());
    d.setMessage(msg + appendMsg);
    d.setButtons(Dialog.OK);
    d.setIsModal(Boolean.TRUE);
    d.setDismissOnOutsideClick(Boolean.TRUE);
    d.setAutoFocus(Boolean.TRUE);
    return d;
}
 
Example #2
Source File: Editor.java    From proarc with GNU General Public License v3.0 5 votes vote down vote up
private void initLogging() {
        Dictionary levels = Dictionary.getDictionary("EditorLoggingConfiguration");
        for (String loggerName : levels.keySet()) {
            String levelValue = levels.get(loggerName);
            try {
                Level level = Level.parse(levelValue);
                Logger logger = Logger.getLogger(loggerName);
                logger.setLevel(level);
                Logger.getLogger("").info(ClientUtils.format(
                        "logger: '%s', levelValue: %s", loggerName, level));
            } catch (IllegalArgumentException ex) {
                Logger.getLogger("").log(Level.SEVERE,
                        ClientUtils.format("logger: '%s', levelValue: %s", loggerName, levelValue), ex);
            }
        }

        if (GWT.isProdMode()) {
            // XXX SmartGWT 3.0 ignores thrown exceptions in production mode.
            // Javascript stack traces are useless but messages can be valuable
            GWT.setUncaughtExceptionHandler(new GWT.UncaughtExceptionHandler() {

                @Override
                public void onUncaughtException(Throwable e) {
                    StringBuilder sb = new StringBuilder();
                    for (Throwable t = e; t != null; t = t.getCause()) {
                        sb.append("* ").append(t.getClass().getName()).append(": ")
                                .append(t.getLocalizedMessage()).append("\n");
                        for (StackTraceElement elm : t.getStackTrace()) {
                            sb.append("  ").append(elm.toString()).append("\n");
                        }
                    }

                    // visible in javascript console; Window.alert is too much intrusive.
                    LOG.log(Level.SEVERE, e.getMessage(), e);
//                    Window.alert(sb.toString());
                }
            });
        }
    }