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

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

Introduction

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

Prototype

AnyRtlDirectionEstimator

Source Link

Usage

From source file:org.freemedsoftware.gwt.client.screen.patient.AllergyEntryScreen.java

License:Open Source License

public AllergyEntryScreen() {
    super(moduleName);
    final FlexTable flexTable = new FlexTable();
    initWidget(flexTable);// w ww  . ja  v a2s  .com

    final Label allergyLabel = new Label(_("Allergy"));
    flexTable.setWidget(0, 0, allergyLabel);
    allergyLabel.setDirectionEstimator(new AnyRtlDirectionEstimator());

    final Label reactionLabel = new Label(_("Reaction"));
    flexTable.setWidget(1, 0, reactionLabel);
    reactionLabel.setDirectionEstimator(new AnyRtlDirectionEstimator());

    final Label severityLabel = new Label(_("Severity"));
    flexTable.setWidget(2, 0, severityLabel);
    severityLabel.setDirectionEstimator(new AnyRtlDirectionEstimator());

    flexTable.setWidget(0, 1, allergyTextBox);
    flexTable.getFlexCellFormatter().setColSpan(0, 1, 2);
    allergyTextBox.setWidth("100%");

    flexTable.setWidget(1, 1, reactionTextBox);
    flexTable.getFlexCellFormatter().setColSpan(1, 1, 2);
    reactionTextBox.setWidth("100%");

    flexTable.setWidget(2, 1, severityTextBox);
    flexTable.getFlexCellFormatter().setColSpan(2, 1, 2);
    severityTextBox.setWidth("100%");

    final CustomButton saveButton = new CustomButton(_("Save"), AppConstants.ICON_ADD);
    flexTable.setWidget(3, 1, saveButton);
    saveButton.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent w) {
            // TODO add function to check input
            if (checkInput()) {
                saveButton.setEnabled(false);
                saveForm();
                // at the very end: close screen
                closeScreen();
            } else {
                Window.alert(_("Please fill in all fields!"));
            }
        }
    });

    final CustomButton resetButton = new CustomButton(_("Reset"), AppConstants.ICON_CLEAR);
    flexTable.setWidget(3, 2, resetButton);
    resetButton.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent w) {
            resetForm();
        }
    });
    Util.setFocus(allergyTextBox);
}