Example usage for com.google.gwt.i18n.client Dictionary keySet

List of usage examples for com.google.gwt.i18n.client Dictionary keySet

Introduction

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

Prototype

public Set<String> keySet() 

Source Link

Document

The set of keys associated with this dictionary.

Usage

From source file:com.google.gwt.sample.i18n.client.I18N.java

License:Apache License

private void initDictionaryExample() {
    FlexTable t = new FlexTable();
    t.setStyleName("i18n-dictionary");
    bindElement("dictionaryExample", t);

    Dictionary userInfo = Dictionary.getDictionary("userInfo");
    Iterator<String> s = userInfo.keySet().iterator();
    for (int i = 0; s.hasNext(); i++) {
        String key = s.next();/* ww w .j a  va  2  s.  c om*/
        t.setText(0, i, key);
        t.setText(1, i, userInfo.get(key));
    }
    t.getRowFormatter().setStyleName(0, "i18n-dictionary-header-row");
}

From source file:com.google.gwt.sample.showcase.client.content.i18n.CwDictionaryExample.java

License:Apache License

/**
 * Initialize this example./*from  www  . jav  a 2 s  .  co  m*/
 */
@ShowcaseSource
@Override
public Widget onInitialize() {
    // Create a vertical panel to layout the contents
    VerticalPanel layout = new VerticalPanel();

    // Show the HTML variable that defines the dictionary
    HTML source = new HTML("<pre>var userInfo = {\n" + "&nbsp;&nbsp;name: \"Amelie Crutcher\",\n"
            + "&nbsp;&nbsp;timeZone: \"EST\",\n" + "&nbsp;&nbsp;userID: \"123\",\n"
            + "&nbsp;&nbsp;lastLogOn: \"2/2/2006\"\n" + "};</pre>\n");
    source.getElement().setDir("ltr");
    source.getElement().getStyle().setProperty("textAlign", "left");
    layout.add(new HTML(constants.cwDictionaryExampleLinkText()));
    layout.add(source);

    // Create the Dictionary of data
    FlexTable userInfoGrid = new FlexTable();
    CellFormatter formatter = userInfoGrid.getCellFormatter();
    Dictionary userInfo = Dictionary.getDictionary("userInfo");
    Set<String> keySet = userInfo.keySet();
    int columnCount = 0;
    for (String key : keySet) {
        // Get the value from the set
        String value = userInfo.get(key);

        // Add a column with the data
        userInfoGrid.setHTML(0, columnCount, key);
        formatter.addStyleName(0, columnCount, "cw-DictionaryExample-header");
        userInfoGrid.setHTML(1, columnCount, value);
        formatter.addStyleName(1, columnCount, "cw-DictionaryExample-data");

        // Go to the next column
        columnCount++;
    }
    layout.add(new HTML("<br><br>"));
    layout.add(userInfoGrid);

    // Return the layout Widget
    return layout;
}

From source file:com.google.livingstories.client.lsp.Externs.java

License:Apache License

public static void bind() {
    currentParameters = Window.Location.getParameterMap();

    Set<Integer> corePanelIds = new HashSet<Integer>();
    JsArrayInteger corePanelIdsJs = getCorePanelIds();
    if (corePanelIdsJs != null) {
        for (int i = 0; i < corePanelIdsJs.length(); i++) {
            corePanelIds.add(corePanelIdsJs.get(i));
        }//from  w ww.  ja  v  a 2 s.c  o m
    }

    Dictionary itemTypes = Dictionary.getDictionary("ITEM_TYPES");
    for (String key : itemTypes.keySet()) {
        String itemType = itemTypes.get(key);
        int panelId = Integer.valueOf(key);
        boolean isCurrentFilteredType = corePanelIds.contains(panelId);
        ContentItemType contentType = getContentTypeForFilters(itemType);
        if (contentType == null) {
            throw new IllegalArgumentException("No matching content type: " + itemType);
        } else if (contentType != ContentItemType.ASSET) {
            contentTypesToPanelIds.put(contentType, panelId);
            if (isCurrentFilteredType) {
                coreItemTypes.add(contentType);
            }
        } else {
            AssetType assetType = getAssetTypeForFilters(itemType);
            assetTypesToPanelIds.put(assetType, panelId);
            if (isCurrentFilteredType) {
                coreItemTypes.add(ContentItemType.ASSET);
                coreItemAssetTypes.add(assetType);
            }
        }
    }

    Dictionary themes = Dictionary.getDictionary("THEMES");
    for (String key : themes.keySet()) {
        themesById.put(Integer.valueOf(key), themes.get(key));
    }

    parseContentItems(getContentItemsJs());
}

From source file:cz.cas.lib.proarc.webapp.client.Editor.java

License:Open Source License

private void initLogging() {
    Dictionary levels = Dictionary.getDictionary("EditorLoggingConfiguration");
    for (String loggerName : levels.keySet()) {
        String levelValue = levels.get(loggerName);
        try {/*  w  w w .  ja  v a2s .  c  om*/
            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());
            }
        });
    }
}

From source file:edu.umb.jsVGL.client.GeneticModels.GeneticModelFactory.java

License:Open Source License

public ProblemTypeSpecification processModelSpecParams(Dictionary params) {
    ProblemTypeSpecification problemSpec = new ProblemTypeSpecification();
    Set<String> paramNames = params.keySet();
    Iterator<String> paramNameIt = paramNames.iterator();
    while (paramNameIt.hasNext()) {
        String name = paramNameIt.next();
        String value = params.get(name);
        problemSpec = updateProblemSpec(problemSpec, name, value);
    }/*from w  ww  .jav a  2  s.c o m*/
    return problemSpec;
}

From source file:net.s17fabu.vip.gwt.showcase.client.content.i18n.CwDictionaryExample.java

License:Apache License

/**
 * Initialize this example.//  w  ww.  ja v  a  2s .co m
 */
@Override
public Widget onInitialize() {
    // Create a vertical panel to layout the contents
    VerticalPanel layout = new VerticalPanel();

    // Show the HTML variable that defines the dictionary
    HTML source = new HTML("<pre>var userInfo = {\n" + "&nbsp;&nbsp;name: \"Amelie Crutcher\",\n"
            + "&nbsp;&nbsp;timeZone: \"EST\",\n" + "&nbsp;&nbsp;userID: \"123\",\n"
            + "&nbsp;&nbsp;lastLogOn: \"2/2/2006\"\n" + "};</pre>\n");
    source.getElement().setDir("ltr");
    source.getElement().getStyle().setProperty("textAlign", "left");
    layout.add(new HTML(constants.cwDictionaryExampleLinkText()));
    layout.add(source);

    // Create the Dictionary of data
    FlexTable userInfoGrid = new FlexTable();
    Dictionary userInfo = Dictionary.getDictionary("userInfo");
    Set<String> keySet = userInfo.keySet();
    int columnCount = 0;
    for (String key : keySet) {
        // Get the value from the set
        String value = userInfo.get(key);

        // Add a column with the data
        userInfoGrid.setHTML(0, columnCount, key);
        userInfoGrid.setHTML(1, columnCount, value);

        // Go to the next column
        columnCount++;
    }
    userInfoGrid.getRowFormatter().setStyleName(0, "cw-DictionaryExample-headerRow");
    userInfoGrid.getRowFormatter().setStyleName(1, "cw-DictionaryExample-dataRow");
    layout.add(new HTML("<br><br>"));
    layout.add(userInfoGrid);

    // Return the layout Widget
    return layout;
}

From source file:org.ebayopensource.turmeric.monitoring.client.ConsoleUtil.java

License:Open Source License

/**
 * Gets the config.//from www .  j  av  a 2s . c o  m
 *
 * @return the config
 */
public static Map<String, String> getConfig() {
    if (configMap.isEmpty()) {

        try {
            Dictionary configDictionary = Dictionary.getDictionary("turmericConfig");
            Set<String> keys = configDictionary.keySet();
            for (String key : keys)
                configMap.put(key, configDictionary.get(key));
        } catch (MissingResourceException e) {
            //log it?
        }

    }

    return Collections.unmodifiableMap(configMap);
}

From source file:org.ebayopensource.turmeric.policy.adminui.client.PolicyAdminUIUtil.java

License:Open Source License

/**
 * Gets the config./*from  w w  w.j  ava 2s .  co  m*/
 * 
 * @return the config
 */
public static Map<String, String> getConfig() {
    if (configMap.isEmpty()) {

        try {
            Dictionary configDictionary = Dictionary.getDictionary("turmericConfig");
            Set<String> keys = configDictionary.keySet();
            for (String key : keys)
                configMap.put(key, configDictionary.get(key));
        } catch (MissingResourceException e) {
            //TODO log it?
        }

    }

    return Collections.unmodifiableMap(configMap);
}

From source file:org.onesocialweb.gwt.client.OswClient.java

License:Apache License

private void loadPreferences() {
    Dictionary prefs = Dictionary.getDictionary("preferences");
    for (String key : prefs.keySet()) {
        preferences.put(key, prefs.get(key));
    }/*from   w w w.  j  ava 2  s  . c om*/
}

From source file:org.opentaps.gwt.crmsfa.client.orders.form.ProductReReservationForm.java

License:Open Source License

/**
 * Keep arguments for later use, initialize list of facilities.
 *
 * @param title Window title/*from   w w  w . j  a  v  a 2s  . com*/
 * @param facilities collection of facilities as pairs of <code>facilitId</code> and <code>facilityName</code>
 * @param orderId order identifier value.
 * @param orderItemSeqId order item sequence number
 * @param inventoryItemId the inventory item identifier value
 * @param shipGroupSeqId the ship group identifier value
 * @param quantity the quantity reserved
 */
public ProductReReservationForm(String title, Dictionary facilities, String orderId, String orderItemSeqId,
        String inventoryItemId, String shipGroupSeqId, String quantity) {
    super(title, FORM_WIDTH, FORM_HEIGHT);
    Set<String> facilityIds = facilities.keySet();
    facilityList = new String[facilityIds.size()][2];
    int i = 0;
    for (String facilityId : facilityIds) {
        facilityList[i][0] = facilityId;
        facilityList[i][1] = facilities.get(facilityId);
        i++;
    }
    this.orderId = orderId;
    this.orderItemSeqId = orderItemSeqId;
    this.inventoryItemId = inventoryItemId;
    this.shipGroupSeqId = shipGroupSeqId;
    this.quantity = quantity;
}