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

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

Introduction

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

Prototype

public native String get(String key) ;

Source Link

Document

Get the value associated with the given Dictionary key.

Usage

From source file:at.ait.dme.yuma.client.Application.java

License:EUPL

/**
 * returns a request parameter. the initial request parameters provided to the 
 * entry point are stored as javascript variables and are therefore accessible 
 * through the dictionary. see also annotate.jsp.
 * //from  w  w w  .  j av  a2 s.  c o m
 * @param parameterName
 * @return parameter value
 */
private static String getRequestParameterValue(String parameterName) {
    String parameterValue;
    try {
        Dictionary parameters = Dictionary.getDictionary("parameters");
        parameterValue = parameters.get(parameterName);
        if (parameterValue.equals("null"))
            parameterValue = null;
    } catch (Exception e) {
        return null;
    }
    return parameterValue;
}

From source file:at.ait.dme.yuma.suite.apps.core.client.YUMACoreProperties.java

License:EUPL

private static String getValue(String key) {
    String value;/*from   w  ww. j  a  v  a2  s  .  c om*/
    try {
        Dictionary params = Dictionary.getDictionary("parameters");
        value = params.get(key);
        if (value.equals("null"))
            value = null;
    } catch (Exception e) {
        return null;
    }
    return value;
}

From source file:au.com.uptick.serendipity.client.MultiPageEntryPoint.java

License:Open Source License

private void onModuleLoad2() {
    try {//from  w  w  w .j a  va 2s.  co  m

        if (!Log.isLoggingEnabled()) {
            Window.alert("Logging is disabled.");
        }

        // Use a code guard e.g. "if (Log.isDebugEnabled() {...}"
        // to ensure unnecessary code is complied out when log_level=OFF
        // or any log_level higher than DEBUG
        if (Log.isDebugEnabled()) {
            startTimeMillis = System.currentTimeMillis();
        }

        // No code guard necessary as the code will be
        // complied out when log_level=OFF
        Log.debug("onModuleLoad2()");

        // inject global styles
        GWT.<GlobalResources>create(GlobalResources.class).css().ensureInjected();

        // load constants
        constants = (SerendipityConstants) GWT.create(SerendipityConstants.class);

        // load messages
        messages = (SerendipityMessages) GWT.create(SerendipityMessages.class);

        // this is required by gwt-platform proxy's generator
        DelayedBindRegistry.bind(ginjector);

        // get Host Page name
        Dictionary dictionary = Dictionary.getDictionary("Pages");
        revealCurrentPlace(dictionary.get("page"));

        // hide the animated 'loading.gif'
        RootPanel.get("loading").setVisible(false);

        // Use a code guard e.g. "if (Log.isDebugEnabled() {...}"
        // to ensure unnecessary code is complied out when log_level=OFF
        // or any log_level higher than DEBUG
        if (Log.isDebugEnabled()) {
            long endTimeMillis = System.currentTimeMillis();
            float durationSeconds = (endTimeMillis - startTimeMillis) / 1000F;
            Log.debug("Duration: " + durationSeconds + " seconds");
        }

    } catch (Exception e) {
        Log.error("e: " + e);
        e.printStackTrace();

        Window.alert(e.getMessage());
    }
}

From source file:br.com.pegasus.solutions.smartgwt.lib.client.rpc.impl.GenericGwtRpcDataSource.java

License:Apache License

private void showErrorMsg(final DSResponse response, Throwable e) {
    if ("session_expired".equals(e.getMessage())) {
        MessageUtil.showError(Dictionary.getDictionary("Application_" + LocaleUtil.CURRENT_LOCALE)
                .get("session_expired_login_again"), sessionTimeOutCallback);
    } else {//from   w  w  w  .java2  s.  c  o m
        response.setStatus(RPCResponse.STATUS_FAILURE);
        response.setAttribute("data", e.getMessage());
    }
}

From source file:br.com.pegasus.solutions.smartgwt.lib.client.upload.FileUploader.java

License:Apache License

private void buildUploadButton() {
    if (this.uploadButton == null) {
        this.uploadButton = new ToolStripButton(this.submitBtnName, this.iconSubmitBtn);
        this.uploadButton.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent event) {
                initialStateProgressBar();

                if (iSubmitAction != null) {
                    iSubmitAction.onClick(null);
                } else {
                    if (StringUtil.isEmpty(getFileName())) {
                        MessageUtil.showMsg(Dictionary.getDictionary("Application_" + LocaleUtil.CURRENT_LOCALE)
                                .get("no_file_specified"));
                        return;
                    }/* w ww .  jav  a 2 s .co  m*/

                    progressbar.setPercentDone(20);
                    uploadButton.setDisabled(true);
                    submit();
                }
            }
        });
    }
}

From source file:br.com.pegasus.solutions.smartgwt.lib.client.view.impl.form.field.FindTextItem.java

License:Apache License

/**
 * add contend in dialog the dictionary must have a property gridName
 * //w w w  .  ja v a 2s .  com
 * @param dialogTitle
 *            {@link String}
 * @param listGrid
 *            {@link ListGrid}
 * @param id
 *            {@link String}
 * @param title
 *            {@link String}
 * @param selectedEvent
 *            {@link SelectedItemListGridIF}
 * @return void
 */
public void addContentDialog(@SuppressWarnings("rawtypes") GenericGwtRpcDataSource genericDS, String id,
        String title, ListGrid listGrid, SelectedItemListGridIF selectedEvent) {
    Dictionary dcRec = genericDS.getDC();
    this.listGrid = listGrid;
    this.idFieldName = dcRec.get(id);
    this.descriptionFieldName = dcRec.get(title);
    this.selectedEvent = selectedEvent;

    addDefaultListGridDefinitions(listGrid);
    this.pagingToolBar = new PagingToolBar(listGrid, null, true, false);

    if (this.doubleClickEnabledOnListGrid) {
        getListGrid().addDoubleClickHandler(new DoubleClickHandler() {
            public void onDoubleClick(DoubleClickEvent event) {
                setIdFieldValue();
                setDescriptionFieldValue();

                if (hasSelectedRecord()) {
                    getSelectedEvent().action(idFieldValue, descriptionFieldValue);
                    popUp.getDialog().hide();
                }
            }
        });
    }

    VLayout listGridLayout = new VLayout();
    listGridLayout.setWidth100();
    listGridLayout.setHeight("*");
    listGridLayout.setMargin(5);
    listGridLayout.addMember(listGrid);

    VLayout searchContent = new VLayout();
    searchContent.setTop(2);
    searchContent.setBottom(0);
    searchContent.setMargin(5);
    searchContent.setWidth100();
    searchContent.setHeight100();

    searchContent.addMember(listGridLayout);
    searchContent.addMember(this.pagingToolBar);

    this.popUp = new PopUp.PopUpBuilder().title(dcRec.get("gridName")).contentPopUp(searchContent).width(width)
            .height(height).okAction(new ClickHandler() {
                @Override
                public void onClick(ClickEvent event) {
                    setIdFieldValue();
                    setDescriptionFieldValue();

                    if (hasSelectedRecord()) {
                        getSelectedEvent().action(idFieldValue, descriptionFieldValue);
                        popUp.getDialog().hide();
                    } else {
                        MessageUtil.showError(dc.get("select_one_record"));
                    }

                }
            }).buildInstance();

    this.pagingToolBar.fetchData();
}

From source file:br.com.pegasus.solutions.smartgwt.lib.client.view.impl.form.field.FindTextItem.java

License:Apache License

/**
 * add contend in dialog the dictionary must have a property gridName
 * //from www  . ja  va 2s  .co  m
 * @param dialogTitle
 *            {@link String}
 * @param listGrid
 *            {@link ListGrid}
 * @param id
 *            {@link String}
 * @param title
 *            {@link String}
 * @param selectedEvent
 *            {@link SelectedItemListGridIF}
 * @return void
 */
public void addContentDialog(@SuppressWarnings("rawtypes") GenericGwtRpcDataSource genericDS,
        String dialogTitleId, String id, String title, ListGrid listGrid,
        SelectedItemListGridIF selectedEvent) {
    Dictionary dcRec = genericDS.getDC();
    this.listGrid = listGrid;
    this.idFieldName = dcRec.get(id);
    this.descriptionFieldName = dcRec.get(title);
    this.selectedEvent = selectedEvent;

    addDefaultListGridDefinitions(listGrid);
    this.pagingToolBar = new PagingToolBar(listGrid, null, true, false);

    if (this.doubleClickEnabledOnListGrid) {
        getListGrid().addDoubleClickHandler(new DoubleClickHandler() {
            public void onDoubleClick(DoubleClickEvent event) {
                setIdFieldValue();
                setDescriptionFieldValue();

                if (hasSelectedRecord()) {
                    getSelectedEvent().action(idFieldValue, descriptionFieldValue);
                    popUp.getDialog().hide();
                }
            }
        });
    }

    VLayout listGridLayout = new VLayout();
    listGridLayout.setWidth100();
    listGridLayout.setHeight("*");
    listGridLayout.setMargin(5);
    listGridLayout.addMember(listGrid);

    VLayout searchContent = new VLayout();
    searchContent.setTop(2);
    searchContent.setBottom(0);
    searchContent.setMargin(5);
    searchContent.setWidth100();
    searchContent.setHeight100();

    searchContent.addMember(listGridLayout);
    searchContent.addMember(this.pagingToolBar);

    this.popUp = new PopUp.PopUpBuilder().title(dcRec.get(dialogTitleId)).contentPopUp(searchContent)
            .width(width).height(height).okAction(new ClickHandler() {
                @Override
                public void onClick(ClickEvent event) {
                    setIdFieldValue();
                    setDescriptionFieldValue();

                    if (hasSelectedRecord()) {
                        getSelectedEvent().action(idFieldValue, descriptionFieldValue);
                        popUp.getDialog().hide();
                    } else {
                        MessageUtil.showError(dc.get("select_one_record"));
                    }

                }
            }).buildInstance();

    this.pagingToolBar.fetchData();
}

From source file:br.com.pegasus.solutions.smartgwt.lib.client.view.impl.form.field.IdsTextItem.java

License:Apache License

/**
 * add contend in dialog the dictionary must have a property gridName
 * /*from  w  ww . java 2  s . c  o  m*/
 * @param dialogTitle
 *            {@link String}
 * @param listGrid
 *            {@link ListGrid}
 * @param id
 *            {@link String}
 * @param title
 *            {@link String}
 * @param selectedEvent
 *            {@link SelectedItemListGridIF}
 * @return void
 */
public void addContentDialog(@SuppressWarnings("rawtypes") GenericGwtRpcDataSource genericDS, String id,
        String title, ListGrid listGrid, SelectedItemListGridIF selectedEvent) {
    Dictionary dcRec = genericDS.getDC();
    this.listGrid = listGrid;
    this.idFieldName = dcRec.get(id);
    this.descriptionFieldName = dcRec.get(title);
    this.selectedEvent = selectedEvent;

    addDefaultListGridDefinitions(listGrid);
    this.pagingToolBar = new PagingToolBar(listGrid, PAGE_SIZE, true, false);

    if (this.doubleClickEnabledOnListGrid) {
        getListGrid().addDoubleClickHandler(new DoubleClickHandler() {
            public void onDoubleClick(DoubleClickEvent event) {
                setIdFieldValue();
                setDescriptionFieldValue();

                if (hasSelectedRecord()) {
                    getSelectedEvent().action(idFieldValue, descriptionFieldValue);
                    popUp.getDialog().hide();
                }
            }
        });
    }

    VLayout listGridLayout = new VLayout();
    listGridLayout.setWidth100();
    listGridLayout.setHeight("*");
    listGridLayout.setMargin(5);
    listGridLayout.addMember(listGrid);

    VLayout searchContent = new VLayout();
    searchContent.setTop(2);
    searchContent.setBottom(0);
    searchContent.setMargin(5);
    searchContent.setWidth100();
    searchContent.setHeight100();

    searchContent.addMember(listGridLayout);
    searchContent.addMember(this.pagingToolBar);

    this.popUp = new PopUp.PopUpBuilder().title(dcRec.get("gridName")).contentPopUp(searchContent).width(width)
            .height(height).okAction(new ClickHandler() {
                @Override
                public void onClick(ClickEvent event) {
                    setIdFieldValue();
                    setDescriptionFieldValue();

                    if (hasSelectedRecord()) {
                        getSelectedEvent().action(idFieldValue, descriptionFieldValue);
                        popUp.getDialog().hide();
                    } else {
                        MessageUtil.showError(dc.get("select_one_record"));
                    }

                }
            }).buildInstance();

    this.pagingToolBar.fetchData();
}

From source file:br.com.pegasus.solutions.smartgwt.lib.client.view.impl.form.field.IdsTextItem.java

License:Apache License

/**
 * add contend in dialog the dictionary must have a property gridName
 * /*ww  w.j a v  a 2s  .  c  o  m*/
 * @param dialogTitle
 *            {@link String}
 * @param listGrid
 *            {@link ListGrid}
 * @param id
 *            {@link String}
 * @param title
 *            {@link String}
 * @param selectedEvent
 *            {@link SelectedItemListGridIF}
 * @return void
 */
public void addContentDialog(@SuppressWarnings("rawtypes") GenericGwtRpcDataSource genericDS,
        String dialogTitleId, String id, String title, ListGrid listGrid,
        SelectedItemListGridIF selectedEvent) {
    Dictionary dcRec = genericDS.getDC();
    this.listGrid = listGrid;
    this.idFieldName = dcRec.get(id);
    this.descriptionFieldName = dcRec.get(title);
    this.selectedEvent = selectedEvent;

    addDefaultListGridDefinitions(listGrid);
    this.pagingToolBar = new PagingToolBar(listGrid, PAGE_SIZE, null, true, false);

    if (this.doubleClickEnabledOnListGrid) {
        getListGrid().addDoubleClickHandler(new DoubleClickHandler() {
            public void onDoubleClick(DoubleClickEvent event) {
                setIdFieldValue();
                setDescriptionFieldValue();

                if (hasSelectedRecord()) {
                    getSelectedEvent().action(idFieldValue, descriptionFieldValue);
                    popUp.getDialog().hide();
                }
            }
        });
    }

    VLayout listGridLayout = new VLayout();
    listGridLayout.setWidth100();
    listGridLayout.setHeight("*");
    listGridLayout.setMargin(5);
    listGridLayout.addMember(listGrid);

    VLayout searchContent = new VLayout();
    searchContent.setTop(2);
    searchContent.setBottom(0);
    searchContent.setMargin(5);
    searchContent.setWidth100();
    searchContent.setHeight100();

    searchContent.addMember(listGridLayout);
    searchContent.addMember(this.pagingToolBar);

    this.popUp = new PopUp.PopUpBuilder().title(dcRec.get(dialogTitleId)).contentPopUp(searchContent)
            .width(width).height(height).okAction(new ClickHandler() {
                @Override
                public void onClick(ClickEvent event) {
                    setIdFieldValue();
                    setDescriptionFieldValue();

                    if (hasSelectedRecord()) {
                        getSelectedEvent().action(idFieldValue, descriptionFieldValue);
                        popUp.getDialog().hide();
                    } else {
                        MessageUtil.showError(dc.get("select_one_record"));
                    }

                }
            }).buildInstance();

    this.pagingToolBar.fetchData();
}

From source file:br.com.pegasus.solutions.smartgwt.lib.client.view.impl.util.ValidatorUtil.java

License:Apache License

/**
 * get mail validator/*from w w w  .  j a  va 2  s.  c  om*/
 * 
 * @return {@link Validator}
 */
public static Validator getMailValidator() {
    Dictionary dc = Dictionary.getDictionary("Application_" + LocaleUtil.CURRENT_LOCALE);
    RegExpValidator emailValidator = new RegExpValidator();
    emailValidator.setExpression("^([a-zA-Z0-9_.\\-+])+@(([a-zA-Z0-9\\-])+\\.)+[a-zA-Z0-9]{2,4}$");
    emailValidator.setErrorMessage(StringUtil.replaceHtmlSpecialCharsSequence(dc.get("invalid_email_address")));

    return emailValidator;
}