com.google.gwt.user.client.ui.ValueBoxBase Java Examples

The following examples show how to use com.google.gwt.user.client.ui.ValueBoxBase. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MaterialValueBoxTest.java    From gwt-material with Apache License 2.0 6 votes vote down vote up
@Override
public void testTabIndex() {
    ValueBoxBase widget = getWidget().getValueBoxBase();
    final int INITIAL_TAB_INDEX = 0;
    final int FINAL_TAB_INDEX = 1;

    // when / then
    widget.setTabIndex(INITIAL_TAB_INDEX);
    assertEquals(INITIAL_TAB_INDEX, widget.getTabIndex());
    assertEquals(String.valueOf(INITIAL_TAB_INDEX), widget.getElement().getPropertyString("tabIndex"));

    // when / then
    widget.setTabIndex(FINAL_TAB_INDEX);
    assertEquals(FINAL_TAB_INDEX, widget.getTabIndex());
    assertEquals(String.valueOf(FINAL_TAB_INDEX), widget.getElement().getPropertyString("tabIndex"));
}
 
Example #2
Source File: MaskValueBoxHelper.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 5 votes vote down vote up
public MaskValueBoxHelper(ValueBoxBase<String> valueBox) {
	this.valueBox = valueBox;

	valueBox.addKeyDownHandler(this);
	valueBox.addKeyUpHandler(this);
	valueBox.addKeyPressHandler(this);
	valueBox.addBlurHandler(this);
	valueBox.addFocusHandler(this);
	valueBox.addMouseUpHandler(this);
}
 
Example #3
Source File: ValueBoxEditorView.java    From dashbuilder with Apache License 2.0 5 votes vote down vote up
@Override
public void setValueBox(final ValueBoxBase<T> widget) {
    this.widget = widget;
    widget.addValueChangeHandler(new ValueChangeHandler<T>() {
        @Override
        public void onValueChange(final ValueChangeEvent<T> event) {
            presenter.onValueChanged(event.getValue());
        }
    });
    contents.add(widget);
}
 
Example #4
Source File: MaterialValueBoxTest.java    From gwt-material with Apache License 2.0 5 votes vote down vote up
protected <W extends MaterialValueBox> void checkAutocomplete(W widget) {
    ValueBoxBase valueBoxBase = widget.getValueBoxBase();

    widget.setAutocomplete(true);
    assertTrue(widget.isAutocomplete());
    assertEquals(valueBoxBase.getElement().getAttribute("autocomplete"), "on");

    widget.setAutocomplete(false);
    assertFalse(widget.isAutocomplete());
    assertEquals(valueBoxBase.getElement().getAttribute("autocomplete"), "off");

    valueBoxBase.getElement().removeAttribute("autocomplete");
}
 
Example #5
Source File: UniTimeTextBox.java    From unitime with Apache License 2.0 5 votes vote down vote up
public UniTimeTextBox(int maxWidth, int width, ValueBoxBase.TextAlignment align) {
	this();
	setWidth(width + "px");
	setMaxLength(maxWidth);
	if (align != null)
		setAlignment(align);
}
 
Example #6
Source File: CurriculaCourses.java    From unitime with Apache License 2.0 5 votes vote down vote up
public ShareTextBox(int column, Float share, Float defaultShare) {
	super(6, ValueBoxBase.TextAlignment.RIGHT);
	iColumn = column;
	iShare = share;
	iDefaultShare = defaultShare;
	addChangeHandler(new ChangeHandler() {
		@Override
		public void onChange(ChangeEvent event) {
			try {
				if (getText().isEmpty()) {
					iShare = null;
				} else if (getText().endsWith("%")) {
					iShare = (float)NF.parse(getText().substring(0, getText().length() - 1)) / 100.0f;
					if (iShare > 1.0f) iShare = 1.0f;
					if (iShare <= 0.0f) iShare = 0.0f;
				} else {
					Integer exp = iClassifications.getExpected(iColumn);
					if (exp == null || exp == 0)
						iShare = (float)NF.parse(getText()) / 100.0f;
					else
						iShare = (float)NF.parse(getText()) / iClassifications.getExpected(iColumn);
					if (iShare > 1.0f) iShare = 1.0f;
					if (iShare < 0.0f) iShare = 0.0f;
				}
			} catch (Exception e) {
				iShare = null;
			}
			update();
		}
	});
	update();
}
 
Example #7
Source File: ClassificationsEdit.java    From unitime with Apache License 2.0 5 votes vote down vote up
public MyCell(CurriculumInterface curriculum, CurriculumClassificationInterface classification) {
	iCurriculum	= curriculum;
	iClasf = classification;
	
	iPanel = new HorizontalPanel();
	
	iTextBox = new UniTimeTextBox(6, ValueBoxBase.TextAlignment.RIGHT);
	iTextBox.addChangeHandler(new ChangeHandler() {
		@Override
		public void onChange(ChangeEvent event) {
			try {
				if (iTextBox.getText().isEmpty()) {
					iClasf.setExpected(null);
				} else {
					iClasf.setExpected(Integer.valueOf(iTextBox.getText()));
				}
			} catch (Exception e) {
				iClasf.setExpected(null);
			}
			update();
			for (MySumCell sum: iSums)
				sum.update();
		}
	});
	
	iRearLabel = new HTML("", false);
	iRearLabel.setWidth("50px");
	iRearLabel.setStyleName("unitime-Label");
	iRearLabel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
	
	iPanel.add(iTextBox);
	iPanel.setCellVerticalAlignment(iTextBox, HasVerticalAlignment.ALIGN_MIDDLE);
	
	iPanel.add(iRearLabel);
	iPanel.setCellVerticalAlignment(iRearLabel, HasVerticalAlignment.ALIGN_MIDDLE);

	initWidget(iPanel);	
	
	update();
}
 
Example #8
Source File: AbstractInputMask.java    From gwt-material-addins with Apache License 2.0 4 votes vote down vote up
public void setup(ValueBoxBase<T> tValueBox) {
    valueBoxBase = tValueBox;
    add(valueBoxBase);
    setType(InputType.TEXT);
}
 
Example #9
Source File: ValueBoxEditor.java    From dashbuilder with Apache License 2.0 4 votes vote down vote up
@UiChild(limit = 1, tagname = "valuebox")
void setValueBox(final ValueBoxBase<T> widget);
 
Example #10
Source File: FilterBox.java    From unitime with Apache License 2.0 4 votes vote down vote up
public ValueBoxBase<String> getValueBox() {
	return iFilter;
}
 
Example #11
Source File: UniTimeTextBox.java    From unitime with Apache License 2.0 4 votes vote down vote up
public UniTimeTextBox(int maxWidth, ValueBoxBase.TextAlignment align, boolean editable) {
	this(maxWidth, align);
	setReadOnly(!editable);
}
 
Example #12
Source File: UniTimeTextBox.java    From unitime with Apache License 2.0 4 votes vote down vote up
public UniTimeTextBox(int maxWidth, ValueBoxBase.TextAlignment align) {
	this(maxWidth, 10 * maxWidth, align);
}
 
Example #13
Source File: AriaSuggestBox.java    From unitime with Apache License 2.0 4 votes vote down vote up
public ValueBoxBase<String> getValueBox() {
	return iText;
}
 
Example #14
Source File: MaterialValueBox.java    From gwt-material with Apache License 2.0 4 votes vote down vote up
private MaterialValueBoxEditor(ValueBoxBase<V> valueBoxBase) {
    super(valueBoxBase);
    this.valueBoxBase = valueBoxBase;
}
 
Example #15
Source File: AbstractInputMask.java    From gwt-material-addins with Apache License 2.0 4 votes vote down vote up
public AbstractInputMask(ValueBoxBase valueBoxBase) {
    setup(valueBoxBase);
}
 
Example #16
Source File: AbstractInputMask.java    From gwt-material-addins with Apache License 2.0 4 votes vote down vote up
public AbstractInputMask() {
    super((ValueBoxBase<T>) new TextBox());
}
 
Example #17
Source File: MaterialValueBox.java    From gwt-material with Apache License 2.0 4 votes vote down vote up
protected ReadOnlyMixin<MaterialValueBox, ValueBoxBase> getReadOnlyMixin() {
    if (readOnlyMixin == null) {
        readOnlyMixin = new ReadOnlyMixin<>(this, valueBoxBase, readOnly -> ToggleReadOnlyEvent.fire(this, readOnly));
    }
    return readOnlyMixin;
}
 
Example #18
Source File: MaterialValueBox.java    From gwt-material with Apache License 2.0 4 votes vote down vote up
@Ignore
public ValueBoxBase<T> getValueBoxBase() {
    return valueBoxBase;
}
 
Example #19
Source File: MaterialValueBox.java    From gwt-material with Apache License 2.0 4 votes vote down vote up
@Editor.Ignore
public ValueBoxBase<T> asValueBoxBase() {
    return valueBoxBase;
}
 
Example #20
Source File: MaterialValueBox.java    From gwt-material with Apache License 2.0 4 votes vote down vote up
@Deprecated
@UiChild(limit = 1)
public void addValueBox(ValueBoxBase<T> widget) {
    setup(widget);
}
 
Example #21
Source File: MaterialValueBox.java    From gwt-material with Apache License 2.0 4 votes vote down vote up
public void setup(ValueBoxBase<T> tValueBox) {
    valueBoxBase = tValueBox;
    add(valueBoxBase);
}
 
Example #22
Source File: MaterialValueBox.java    From gwt-material with Apache License 2.0 4 votes vote down vote up
public MaterialValueBox(ValueBoxBase<T> tValueBox) {
    this();
    setup(tValueBox);
}