Example usage for com.google.gwt.user.client.ui ValueListBox getValue

List of usage examples for com.google.gwt.user.client.ui ValueListBox getValue

Introduction

In this page you can find the example usage for com.google.gwt.user.client.ui ValueListBox getValue.

Prototype

public T getValue() 

Source Link

Usage

From source file:com.sciencegadgets.client.ui.LinkPrompt.java

License:Open Source License

boolean isValidSpec(Label label, TextBox textBox, ValueListBox<String> listBox) {
    Style labelStyle = label.getElement().getStyle();

    if ("".equals(textBox.getValue()) && listBox.getValue() == null) {
        labelStyle.clearColor();//w w w  .  ja  v a  2  s  . com
        labelStyle.clearFontWeight();
        return false;
    }

    boolean isValid;
    try {
        Double value = Double.parseDouble(textBox.getValue());
        if (value > 0 && listBox.getValue() != null) {
            isValid = true;
        } else {
            isValid = false;
        }
    } catch (NumberFormatException e) {
        isValid = false;
    }

    if (isValid) {
        labelStyle.clearColor();
        labelStyle.setFontWeight(FontWeight.BOLD);
    } else {
        labelStyle.setColor("red");
        labelStyle.setFontWeight(FontWeight.BOLD);
    }
    return isValid;
}