Example usage for com.google.gwt.i18n.client NumberFormat getFormat

List of usage examples for com.google.gwt.i18n.client NumberFormat getFormat

Introduction

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

Prototype

public static NumberFormat getFormat(String pattern) 

Source Link

Document

Gets a NumberFormat instance for the default locale using the specified pattern and the default currencyCode.

Usage

From source file:org.rstudio.core.client.StringUtil.java

License:Open Source License

public static String formatGeneralNumber(long number) {
    String val = number + "";
    if (val.length() < 5 || (number < 0 && val.length() < 6))
        return val;
    return NumberFormat.getFormat("0,000").format(number);
}

From source file:org.sakaiproject.gradebook.gwt.client.DataTypeConversionUtil.java

License:Educational Community License

public static NumberFormat getDefaultNumberFormat() {
    return NumberFormat.getFormat("#.#####");
}

From source file:org.sakaiproject.gradebook.gwt.client.DataTypeConversionUtil.java

License:Educational Community License

public static NumberFormat getShortNumberFormat() {
    return NumberFormat.getFormat("#.##");
}

From source file:org.sakaiproject.gradebook.gwt.client.DataTypeConversionUtil.java

License:Educational Community License

public static NumberFormat getLongNumberFormat() {
    return NumberFormat.getFormat("#.#####");
}

From source file:org.sigmah.client.page.common.widget.CoordinateEditor.java

License:Open Source License

public CoordinateEditor(String negHemiChars, String posHemiChars) {
    this.negHemiChars = negHemiChars;
    this.posHemiChars = posHemiChars;
    this.decimalSeperators = ".,";
    this.noHemisphereMessage = I18N.CONSTANTS.noHemisphere();
    this.tooManyNumbersErrorMessage = I18N.CONSTANTS.tooManyNumbers();
    this.invalidMinutesMessage = I18N.CONSTANTS.invalidMinutes();
    this.invalidSecondsMessage = I18N.CONSTANTS.invalidSeconds();
    this.noNumberErrorMessage = I18N.CONSTANTS.noNumber();

    dddFormat = NumberFormat.getFormat("+0.000000;-0.000000");
    shortFracFormat = NumberFormat.getFormat("0.00");
    intFormat = NumberFormat.getFormat("0");
}

From source file:org.sigmah.client.page.entry.editor.IndicatorFieldSet.java

License:Open Source License

protected void addIndicator(IndicatorDTO indicator) {

    Text indicatorLabel = new Text(indicator.getName());
    indicatorLabel.setStyleAttribute("fontSize", "9pt");

    add(indicatorLabel);/*  www  . j av a  2  s  .  c  om*/

    NumberField indicatorField = new NumberField();
    indicatorField.setName(indicator.getPropertyName());
    indicatorField.setWidth(50);
    indicatorField.setFormat(NumberFormat.getFormat("0"));
    indicatorField.setStyleAttribute("textAlign", "right");

    if (indicator.getDescription() != null && !indicator.getDescription().isEmpty()) {
        ToolTipConfig tip = new ToolTipConfig();
        tip.setDismissDelay(0);
        tip.setShowDelay(100);
        tip.setText(indicator.getDescription());

        indicatorField.setToolTip(tip);
    }

    add(indicatorField);

    Text unitLabel = new Text(indicator.getUnits());
    unitLabel.setStyleAttribute("fontSize", "9pt");

    add(unitLabel);
}

From source file:org.sigmah.client.page.entry.MonthlyGrid.java

License:Open Source License

public ColumnModel createColumnModel() {

    List<ColumnConfig> columns = new ArrayList<ColumnConfig>();

    ColumnConfig indicator = new ColumnConfig("indicatorName", I18N.CONSTANTS.indicators(), 150);
    indicator.setSortable(false);//from  w w  w  . ja  v  a2s  .co m
    indicator.setMenuDisabled(true);
    columns.add(indicator);

    NumberFormat indicatorFormat = NumberFormat.getFormat("0");

    for (int i = 0; i != 7; ++i) {

        NumberField indicatorField = new NumberField();
        indicatorField.getPropertyEditor().setFormat(indicatorFormat);

        ColumnConfig valueColumn = new ColumnConfig("month" + i, "", 75);
        valueColumn.setNumberFormat(indicatorFormat);
        valueColumn.setEditor(new CellEditor(indicatorField));
        valueColumn.setSortable(false);
        valueColumn.setMenuDisabled(true);

        columns.add(valueColumn);
    }

    return new ColumnModel(columns);
}

From source file:org.sigmah.client.page.map.BubbleLayerForm.java

License:Open Source License

public BubbleLayerForm() {
    super();//from  w  w  w.  ja v a 2 s  . c o  m

    setHeading(I18N.CONSTANTS.selectTheSymbol());
    setIcon(IconImageBundle.ICONS.graduatedSymbol());

    setLabelWidth(100);
    setFieldWidth(200);

    colorField = new ColorField();
    colorField.setFieldLabel(I18N.CONSTANTS.color());
    colorField.setValue("0000BB");
    this.add(colorField);

    minRadiusField = new NumberField();
    minRadiusField.setAllowDecimals(false);
    minRadiusField.setAllowBlank(false);
    minRadiusField.setFormat(NumberFormat.getFormat("0"));
    minRadiusField.setValue(5);
    minRadiusField.setFieldLabel(I18N.CONSTANTS.radiusMinimum());
    this.add(minRadiusField);

    maxRadiusField = new NumberField();
    maxRadiusField.setAllowDecimals(false);
    maxRadiusField.setAllowBlank(false);
    maxRadiusField.setFormat(NumberFormat.getFormat("0"));
    maxRadiusField.setValue(15);
    maxRadiusField.setFieldLabel(I18N.CONSTANTS.radiusMaximum());
    this.add(maxRadiusField);

    clusterCombo = new MappingComboBox<Integer>();
    clusterCombo.add(0, I18N.CONSTANTS.none());
    clusterCombo.add(1, I18N.CONSTANTS.automatic());
    clusterCombo.setMappedValue(1);
    clusterCombo.setFieldLabel(I18N.CONSTANTS.clustering());
    this.add(clusterCombo);

}

From source file:org.sigmah.client.page.report.ReportListPageView.java

License:Open Source License

@Inject
public ReportListPageView(Dispatcher service) {
    super();/*  w  w w  . j av a2s .  c  om*/
    this.service = service;

    setLayout(new FitLayout());
    setHeaderVisible(false);
    weekdays = LocaleInfo.getCurrentLocale().getDateTimeConstants().weekdays();
    numberFormat = NumberFormat.getFormat("0");
}

From source file:org.sigmah.client.ui.view.admin.ParametersAdminView.java

License:Open Source License

/**
 * Creates the password expiration policy management panel.
 * //ww w. ja va2  s  . c om
 * @return The password expiration policy management panel.
 */
private ContentPanel createPasswordExpirationManagementPanel() {

    final ContentPanel panel = Panels.content(I18N.CONSTANTS.userPasswordSettings());

    passwordExpirationManagementForm = Forms.panel(300);

    resetNewUserPasswordCheckBox = Forms.checkbox(I18N.CONSTANTS.resetNewUserPasswords());
    resetNewUserPasswordCheckBox.setFieldLabel(I18N.CONSTANTS.resetNewUserPasswords());

    policyTypeCombo = new SimpleComboBox<ExpirationPolicy>();
    policyTypeCombo.add(Arrays.asList(ExpirationPolicy.values()));
    policyTypeCombo.setTriggerAction(ComboBox.TriggerAction.ALL);
    policyTypeCombo.setEditable(false);
    policyTypeCombo.setAllowBlank(false);
    policyTypeCombo.setFieldLabel(I18N.CONSTANTS.automaticExpirationPolicy());

    frequencyField = new SpinnerField();
    frequencyField.setMinValue(0);
    frequencyField.setValue(0);
    frequencyField.setWidth(40);
    frequencyField.setFormat(NumberFormat.getFormat("0"));
    frequencyField.setIncrement(1);
    frequencyField.setFieldLabel(I18N.CONSTANTS.every());

    scheduledDateField = new DateField();
    scheduledDateField.setMinValue(new Date());
    scheduledDateField.setFieldLabel(I18N.CONSTANTS.at());

    passwordExpirationManagementForm.add(resetNewUserPasswordCheckBox);
    passwordExpirationManagementForm.add(policyTypeCombo);
    passwordExpirationManagementForm.add(frequencyField);
    passwordExpirationManagementForm.add(scheduledDateField);

    // button
    passwordExpirationSaveButton = Forms.button(I18N.CONSTANTS.saveExportConfiguration(),
            IconImageBundle.ICONS.save());
    passwordExpirationManagementForm.addButton(passwordExpirationSaveButton);

    panel.add(passwordExpirationManagementForm);

    return panel;
}