Example usage for com.google.gwt.i18n.shared DateTimeFormat DateTimeFormat

List of usage examples for com.google.gwt.i18n.shared DateTimeFormat DateTimeFormat

Introduction

In this page you can find the example usage for com.google.gwt.i18n.shared DateTimeFormat DateTimeFormat.

Prototype

protected DateTimeFormat(String pattern, DateTimeFormatInfo dtfi) 

Source Link

Document

Constructs a format object using the specified pattern and user-supplied date time constants.

Usage

From source file:com.google.gwt.sample.stockwatcher.server.CurrencyServiceImpl.java

private String calculateRatesUrl() {
    String pattern = "yyyy-MM-dd";
    DefaultDateTimeFormatInfo info = new DefaultDateTimeFormatInfo();
    DateTimeFormat dtf = new DateTimeFormat(pattern, info) {
    };/*ww  w  . j  a v  a 2s.co m*/
    Date d = new Date();
    CalendarUtil.addMonthsToDate(d, -1);
    return "http://api.fixer.io/" + dtf.format(d) + "?base=HKD";
}

From source file:org.openelis.scriptlet.ms.conf.Scriptlet.java

License:Open Source License

public Scriptlet(ScriptletProxy proxy, Integer analysisId) {
    this.proxy = proxy;
    this.analysisId = analysisId;

    proxy.log(Level.FINE, "Initializing MSConfScriptlet1", null);
    try {/* w  w  w.  j  a  v  a  2s . c o m*/
        if (!initialized) {
            initialized = true;
            YES = proxy.getDictionaryBySystemName("yes").getId();
            UNIT_MM = proxy.getDictionaryBySystemName("millimeters").getId();
            UNIT_YEARS = proxy.getDictionaryBySystemName("years_local").getId();
            GEST_AGE_LMP = proxy.getDictionaryBySystemName("gest_age_date_type_lmp").getId();
            GEST_AGE_US = proxy.getDictionaryBySystemName("gest_age_date_type_us").getId();
            INT_POSITIVE = proxy.getDictionaryBySystemName("positive").getId();
            INT_NEGATIVE = proxy.getDictionaryBySystemName("negative").getId();
            ACTION_SEE_ACHE = proxy.getDictionaryBySystemName("ms_rec_action_see_ache_res").getId();
            ACTION_NO_ACTION = proxy.getDictionaryBySystemName("ms_rec_action_no_action").getId();
            YES_STR = YES.toString();

            /*
             * the formatter that converts from string to date
             */
            dateFormatter = new DateTimeFormat(Messages.get().datePattern(), new DefaultDateTimeFormatInfo()) {
            };
        }
        proxy.log(Level.FINE, "Initialized MSConfScriptlet1", null);
    } catch (Exception e) {
        initialized = false;
        proxy.log(Level.SEVERE, "Failed to initialize dictionary constants", e);
    }
}

From source file:org.openelis.scriptlet.ms.firstInteg.Scriptlet.java

License:Open Source License

public Scriptlet(ScriptletProxy proxy, Integer analysisId) {
    this.proxy = proxy;
    this.analysisId = analysisId;

    proxy.log(Level.FINE, "Initializing MS1stIntegScriptlet1", null);
    try {/*  w  w  w.  ja  va  2 s.  co m*/
        if (!initialized) {
            initialized = true;
            YES = proxy.getDictionaryBySystemName("yes").getId();
            UNIT_MM = proxy.getDictionaryBySystemName("millimeters").getId();
            UNIT_POUNDS = proxy.getDictionaryBySystemName("pounds_local").getId();
            UNIT_YEARS = proxy.getDictionaryBySystemName("years_local").getId();
            INT_POSITIVE = proxy.getDictionaryBySystemName("positive").getId();
            INT_NEGATIVE = proxy.getDictionaryBySystemName("negative").getId();
            INT_UNKNOWN = proxy.getDictionaryBySystemName("unknown").getId();
            ACTION_US_DIAG = proxy.getDictionaryBySystemName("ms_rec_action_us_diag").getId();
            ACTION_NO_ACTION = proxy.getDictionaryBySystemName("ms_rec_action_no_action").getId();
            ACTION_RISK_NOT_CALC = proxy.getDictionaryBySystemName("ms_rec_action_risk_not_calc").getId();
            YES_STR = YES.toString();

            /*
             * the formatter that converts from string to date
             */
            dateFormatter = new DateTimeFormat(Messages.get().datePattern(), new DefaultDateTimeFormatInfo()) {
            };
        }
        proxy.log(Level.FINE, "Initialized MS1stIntegScriptlet1", null);
    } catch (Exception e) {
        initialized = false;
        proxy.log(Level.SEVERE, "Failed to initialize dictionary constants", e);
    }
}

From source file:org.openelis.scriptlet.ms.firstTri.Scriptlet.java

License:Open Source License

public Scriptlet(ScriptletProxy proxy, Integer analysisId) {
    this.proxy = proxy;
    this.analysisId = analysisId;

    proxy.log(Level.FINE, "Initializing MS1stTriScriptlet1", null);
    try {//from w  ww  .j av  a  2 s. co  m
        if (!initialized) {
            initialized = true;
            YES = proxy.getDictionaryBySystemName("yes").getId();
            UNIT_MM = proxy.getDictionaryBySystemName("millimeters").getId();
            UNIT_POUNDS = proxy.getDictionaryBySystemName("pounds_local").getId();
            UNIT_YEARS = proxy.getDictionaryBySystemName("years_local").getId();
            INT_POSITIVE = proxy.getDictionaryBySystemName("positive").getId();
            INT_NEGATIVE = proxy.getDictionaryBySystemName("negative").getId();
            INT_UNKNOWN = proxy.getDictionaryBySystemName("unknown").getId();
            ACTION_US_DIAG = proxy.getDictionaryBySystemName("ms_rec_action_us_diag").getId();
            ACTION_NO_ACTION = proxy.getDictionaryBySystemName("ms_rec_action_no_action").getId();
            ACTION_RISK_NOT_CALC = proxy.getDictionaryBySystemName("ms_rec_action_risk_not_calc").getId();
            YES_STR = YES.toString();

            /*
             * the formatter that converts from string to date
             */
            dateFormatter = new DateTimeFormat(Messages.get().datePattern(), new DefaultDateTimeFormatInfo()) {
            };
        }
        proxy.log(Level.FINE, "Initialized MS1stTriScriptlet1", null);
    } catch (Exception e) {
        initialized = false;
        proxy.log(Level.SEVERE, "Failed to initialize dictionary constants", e);
    }
}

From source file:org.openelis.scriptlet.ms.integrate.Scriptlet.java

License:Open Source License

public Scriptlet(ScriptletProxy proxy, Integer analysisId) {
    this.proxy = proxy;
    this.analysisId = analysisId;

    proxy.log(Level.FINE, "Initializing MSIntegrateScriptlet1", null);
    try {/*w ww.jav a2 s  . c om*/
        if (!initialized) {
            initialized = true;
            YES = proxy.getDictionaryBySystemName("yes").getId();
            NO = proxy.getDictionaryBySystemName("no").getId();
            UNIT_MM = proxy.getDictionaryBySystemName("millimeters").getId();
            UNIT_POUNDS = proxy.getDictionaryBySystemName("pounds_local").getId();
            UNIT_YEARS = proxy.getDictionaryBySystemName("years_local").getId();
            INT_POSITIVE = proxy.getDictionaryBySystemName("positive").getId();
            INT_NEGATIVE = proxy.getDictionaryBySystemName("negative").getId();
            INT_UNKNOWN = proxy.getDictionaryBySystemName("unknown").getId();
            ACTION_US_AMN = proxy.getDictionaryBySystemName("ms_rec_action_us_amn").getId();
            ACTION_US_DIAG = proxy.getDictionaryBySystemName("ms_rec_action_us_diag").getId();
            ACTION_NO_ACTION = proxy.getDictionaryBySystemName("ms_rec_action_no_action").getId();
            ACTION_RISK_NOT_CALC = proxy.getDictionaryBySystemName("ms_rec_action_risk_not_calc").getId();
            YES_STR = YES.toString();
            RACE_BLACK_STR = proxy.getDictionaryBySystemName("race_b").getId().toString();

            /*
             * the formatters that convert from string to date or vice-versa
             */
            dateFormatter = new DateTimeFormat(Messages.get().datePattern(), new DefaultDateTimeFormatInfo()) {
            };
            dateTimeFormatter = new DateTimeFormat(Messages.get().dateTimePattern(),
                    new DefaultDateTimeFormatInfo()) {
            };
        }
        proxy.log(Level.FINE, "Initialized MSIntegrateScriptlet1", null);
    } catch (Exception e) {
        initialized = false;
        proxy.log(Level.SEVERE, "Failed to initialize dictionary constants", e);
    }
}

From source file:org.openelis.scriptlet.ms.ntd.Scriptlet.java

License:Open Source License

public Scriptlet(ScriptletProxy proxy, Integer analysisId) {
    this.proxy = proxy;
    this.analysisId = analysisId;

    proxy.log(Level.FINE, "Initializing MSNTDScriptlet1", null);
    try {/*from www.jav  a 2 s  .  c o m*/
        if (!initialized) {
            initialized = true;
            YES = proxy.getDictionaryBySystemName("yes").getId();
            NO = proxy.getDictionaryBySystemName("no").getId();
            UNIT_MM = proxy.getDictionaryBySystemName("millimeters").getId();
            UNIT_POUNDS = proxy.getDictionaryBySystemName("pounds_local").getId();
            UNIT_YEARS = proxy.getDictionaryBySystemName("years_local").getId();
            GEST_AGE_LMP = proxy.getDictionaryBySystemName("gest_age_date_type_lmp").getId();
            GEST_AGE_US = proxy.getDictionaryBySystemName("gest_age_date_type_us").getId();
            INT_POSITIVE = proxy.getDictionaryBySystemName("positive").getId();
            INT_NEGATIVE = proxy.getDictionaryBySystemName("negative").getId();
            ACTION_US = proxy.getDictionaryBySystemName("ms_rec_action_us").getId();
            ACTION_US_AMN = proxy.getDictionaryBySystemName("ms_rec_action_us_amn").getId();
            ACTION_NO_ACTION = proxy.getDictionaryBySystemName("ms_rec_action_no_action").getId();
            YES_STR = YES.toString();

            /*
             * the formatter that converts from string to date
             */
            dateFormatter = new DateTimeFormat(Messages.get().datePattern(), new DefaultDateTimeFormatInfo()) {
            };
        }
        proxy.log(Level.FINE, "Initialized MSNTDScriptlet1", null);
    } catch (Exception e) {
        initialized = false;
        proxy.log(Level.SEVERE, "Failed to initialize dictionary constants", e);
    }
}

From source file:org.openelis.scriptlet.ms.quad.Scriptlet.java

License:Open Source License

public Scriptlet(ScriptletProxy proxy, Integer analysisId) {
    this.proxy = proxy;
    this.analysisId = analysisId;

    proxy.log(Level.FINE, "Initializing MSQuadScriptlet1", null);
    try {//from   w w w  .  j av a 2s . c o  m
        if (!initialized) {
            initialized = true;
            YES = proxy.getDictionaryBySystemName("yes").getId();
            NO = proxy.getDictionaryBySystemName("no").getId();
            UNIT_MM = proxy.getDictionaryBySystemName("millimeters").getId();
            UNIT_POUNDS = proxy.getDictionaryBySystemName("pounds_local").getId();
            UNIT_YEARS = proxy.getDictionaryBySystemName("years_local").getId();
            GEST_AGE_LMP = proxy.getDictionaryBySystemName("gest_age_date_type_lmp").getId();
            GEST_AGE_US = proxy.getDictionaryBySystemName("gest_age_date_type_us").getId();
            INT_POSITIVE = proxy.getDictionaryBySystemName("positive").getId();
            INT_NEGATIVE = proxy.getDictionaryBySystemName("negative").getId();
            INT_UNKNOWN = proxy.getDictionaryBySystemName("unknown").getId();
            ACTION_US = proxy.getDictionaryBySystemName("ms_rec_action_us").getId();
            ACTION_AMN = proxy.getDictionaryBySystemName("ms_rec_action_amn").getId();
            ACTION_US_AMN = proxy.getDictionaryBySystemName("ms_rec_action_us_amn").getId();
            ACTION_NO_ACTION = proxy.getDictionaryBySystemName("ms_rec_action_no_action").getId();
            ACTION_RISK_NOT_CALC = proxy.getDictionaryBySystemName("ms_rec_action_risk_not_calc").getId();
            YES_STR = YES.toString();

            /*
             * the formatter that converts from string to date
             */
            dateFormatter = new DateTimeFormat(Messages.get().datePattern(), new DefaultDateTimeFormatInfo()) {
            };
        }
        proxy.log(Level.FINE, "Initialized MSQuadScriptlet1", null);
    } catch (Exception e) {
        initialized = false;
        proxy.log(Level.SEVERE, "Failed to initialize dictionary constants", e);
    }
}

From source file:org.ow2.proactive_grid_cloud_portal.common.shared.Config.java

License:Open Source License

private static String getCurrentYear() {
    DefaultDateTimeFormatInfo info = new DefaultDateTimeFormatInfo();
    DateTimeFormat dateTimeFormat = new DateTimeFormat("yyyy", info) {
    };//from  ww w  . j a  va 2  s  .  com
    return dateTimeFormat.format(new Date());
}