Java 类com.google.gwt.user.client.ui.IntegerBox 实例源码

项目:synergynet3.1    文件:EarlyYearsUI.java   
/**
 * Gets the train track pieces num.
 *
 * @param box
 *            the box
 * @return the train track pieces num
 */
private Integer getTrainTrackPiecesNum(IntegerBox box)
{
    Integer toSend = box.getValue();
    if (toSend == null)
    {
        return null;
    }
    if (toSend < 0)
    {
        toSend = 0;
    }
    else if (toSend > PIECE_LIMIT)
    {
        toSend = PIECE_LIMIT;
    }
    return toSend;
}
项目:dhcalc    文件:BasePanel.java   
protected int getValue(IntegerBox box) {

        try {
            Integer value = box.getValue();

            if (value == null) {
                box.setValue(0);
                value = 0;
            }

            return value;
        } catch (Exception e) {
            box.setValue(0);
            return 0;
        }
    }
项目:gwthtml5apps    文件:ExportImage.java   
private IntegerBox makeIntegerBox(Panel parent,String name,int value){
    HorizontalPanel h1=new HorizontalPanel();
    //h.setWidth("100%");

    parent.add(h1);

    Label label=new Label(name);
    label.setWidth("100px");
    h1.add(label);

    IntegerBox box=new IntegerBox();
    box.setWidth("40px");
    box.setValue(value);
    h1.add(box);
    return box;
}
项目:swcv    文件:SettingsPanel.java   
private Widget createMinLengthField()
{
    final IntegerBox box = new IntegerBox();
    box.setValue(setting.getMinWordLength());
    box.setMaxLength(2);
    box.setWidth("15px");

    box.addChangeHandler(new ChangeHandler()
    {
        @Override
        public void onChange(ChangeEvent event)
        {
            setting.setMinWordLength(box.getValue());
        }
    });

    box.setTitle("Specify the minimum number of characters in a word");
    return box;
}
项目:dhcalc    文件:BasePanel.java   
protected String getFieldValue(IntegerBox field, String defaultValue) {
    try {
        return String.valueOf(field.getValue());
    } catch (Exception e) {
        field.setText(defaultValue);
        return defaultValue;
    }
}
项目:dhcalc    文件:BasePanel.java   
protected void setFieldValue(Field f, String value) {

        Object field = f.field;

        if (value == null)
            value = f.defaultValue;

        if (field instanceof TextBox)
            setFieldValue((TextBox) field, value);
        else if (field instanceof IntegerBox)
            setFieldValue((IntegerBox) field, value);
        else if (field instanceof NumberSpinner)
            setFieldValue((NumberSpinner) field, value);
        else if (field instanceof LongSpinner)
            setFieldValue((LongSpinner) field, value);
        else if (field instanceof DoubleSpinner)
            setFieldValue((DoubleSpinner) field, value);
        else if (field instanceof DoubleBox)
            setFieldValue((DoubleBox) field, value);
        else if (field instanceof SimpleCheckBox)
            setFieldValue((SimpleCheckBox) field, value);
        else if (field instanceof ListBox)
            setFieldValue((ListBox) field, value);
        else if (field instanceof PassivesPanel)
            setFieldValue((PassivesPanel) field, value);
        else if (field instanceof GemsPanel)
            setFieldValue((GemsPanel) field, value);
        else if (field instanceof ItemPanel)
            setFieldValue((ItemPanel) field, value);
        else if (field instanceof SkillsPanel)
            setFieldValue((SkillsPanel) field, value);
        else if (field instanceof DamageTypePanel)
            setFieldValue((DamageTypePanel) field, value);
        else if (field instanceof SkillDamagePanel)
            setFieldValue((SkillDamagePanel) field, value);
    }
项目:dhcalc    文件:BasePanel.java   
protected void setFieldValue(IntegerBox field, String value) {
    try {
        field.setValue(Integer.valueOf(value));
    } catch (Exception e) {
        field.setValue(0);
    }
}
项目:platypus-js    文件:TimePicker.java   
private int updateValue(IntegerBox aInput, int aVal, int maxVal) {
    if (aInput.getValue() != null) {
        int val = aInput.getValue();
        if (val > maxVal) {
            val = maxVal;
            aInput.setValue(val);
        }
        if (val < 0) {
            val = 0;
            aInput.setValue(val);
        }
        aVal = val;
    }
    return aVal;
}
项目:platypus-js    文件:TimePicker.java   
private int updateUpValue(IntegerBox aInput, int aVal, int maxVal) {
    aVal += 1;
    if (aVal > maxVal) {
        aVal = 0;
    }
    aInput.setValue(aVal);
    return aVal;
}
项目:platypus-js    文件:TimePicker.java   
private int updateDownValue(IntegerBox aInput, int aVal, int maxVal) {
    aVal -= 1;
    if (aVal < 0) {
        aVal = maxVal;
    }
    aInput.setValue(aVal);
    return aVal;
}
项目:gwthtml5apps    文件:ResizeDataEditor.java   
public ResizeDataEditor(){
    super();

    HorizontalPanel sizes=new HorizontalPanel();
    sizes.setVerticalAlignment(HorizontalPanel.ALIGN_MIDDLE);
    this.add(sizes);
    Label f1Label=new Label(SimpleResize.textConstants.size());
    f1Label.setWidth("100px");
    sizes.add(f1Label);

    sizeEditor=new IntegerBox();
    sizeEditor.setWidth("100px");
    sizes.add(sizeEditor);
}
项目:gwthtml5apps    文件:SimpleLogo.java   
private IntegerBox makeIntegerBox(Panel parent,String name,int value){
    HorizontalPanel h=new HorizontalPanel();
    parent.add(h);

    Label label=new Label(name);
    label.setWidth("100px");
    h.add(label);

    IntegerBox box=new IntegerBox();
    box.setValue(value);
    h.add(box);
    return box;
}
项目:gerrit    文件:RangeBox.java   
Box() {
  box = new IntegerBox();
  box.setVisibleLength(10);
  box.setAlignment(TextAlignment.RIGHT);
  initWidget(box);
}
项目:dhcalc    文件:NumberSpinner.java   
public NumberSpinner(String text) {
    super(new IntegerBox(), text, 0, Integer.MAX_VALUE, 1);
}
项目:dhcalc    文件:BasePanel.java   
protected String getFieldValue(Field f) {
    Object field = f.field;
    String defaultValue = f.defaultValue;

    if (field instanceof TextBox)
        return getFieldValue((TextBox) field, defaultValue);
    else if (field instanceof IntegerBox)
        return getFieldValue((IntegerBox) field, defaultValue);
    else if (field instanceof NumberSpinner)
        return getFieldValue((NumberSpinner) field, defaultValue);
    else if (field instanceof LongSpinner)
        return getFieldValue((LongSpinner) field, defaultValue);
    else if (field instanceof DoubleSpinner)
        return getFieldValue((DoubleSpinner) field, defaultValue);
    else if (field instanceof DoubleBox)
        return getFieldValue((DoubleBox) field, defaultValue);
    else if (field instanceof SimpleCheckBox)
        return getFieldValue((SimpleCheckBox) field, defaultValue);
    else if (field instanceof ListBox)
        return getFieldValue((ListBox) field, defaultValue);
    else if (field instanceof PassivesPanel)
        return getFieldValue(((PassivesPanel) field).getPassives(),
                defaultValue);
    else if (field instanceof GemsPanel)
        return getGemsFieldValue(((GemsPanel) field).getGems(),
                defaultValue);
    else if (field instanceof ItemPanel)
        return getSpecialItemsFieldValue(((ItemPanel) field).getItems(),
                ((ItemPanel) field).getSetCounts(), defaultValue);
    else if (field instanceof SkillsPanel)
        return getEnumFieldValue(((SkillsPanel) field).getSkills(),
                defaultValue);
    else if (field instanceof DamageTypePanel)
        return getFieldValue(((DamageTypePanel) field).getValues(),
                defaultValue);
    else if (field instanceof SkillDamagePanel)
        return getFieldValue(((SkillDamagePanel) field).getValues(),
                defaultValue);
    else
        return defaultValue;
}
项目:platypus-js    文件:IntegerEditorCell.java   
public IntegerEditorCell() {
    super(new IntegerBox());
}
项目:dtgov    文件:CliTargetPanel.java   
/**
 * @see com.google.gwt.event.dom.client.KeyPressHandler#onKeyPress(com.google.gwt.event.dom.client.KeyPressEvent)
 */
@Override
public void onKeyPress(KeyPressEvent event) {
    if (Character.isLetter(event.getCharCode()))
        ((IntegerBox) event.getSource()).cancelKey();
}