本文整理汇总了Java中com.google.gwt.user.client.ui.ValueBoxBase类的典型用法代码示例。如果您正苦于以下问题:Java ValueBoxBase类的具体用法?Java ValueBoxBase怎么用?Java ValueBoxBase使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ValueBoxBase类属于com.google.gwt.user.client.ui包,在下文中一共展示了ValueBoxBase类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testTabIndex
import com.google.gwt.user.client.ui.ValueBoxBase; //导入依赖的package包/类
@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"));
}
示例2: onLoad
import com.google.gwt.user.client.ui.ValueBoxBase; //导入依赖的package包/类
@Override
protected void onLoad() {
Field[] fields = getFields();
for (Field f : fields) {
if (f.field instanceof ValueBoxBase) {
final ValueBoxBase<?> tf = (ValueBoxBase<?>) f.field;
tf.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
tf.selectAll();
}
});
}
}
}
示例3: getValue
import com.google.gwt.user.client.ui.ValueBoxBase; //导入依赖的package包/类
@Override
public T getValue() {
T value = null;
if (this.takesValues instanceof ValueBoxBase<?>) {
try {
value = ((ValueBoxBase<T>) this.takesValues).getValueOrThrow();
} catch (final ParseException e) {
final String entryAsText = ((ValueBoxBase<T>) this.takesValues).getText();
final String localizedMessage = this.messages.parseExceptionMessage(entryAsText);
if (this.delegate != null) {
this.delegate.recordError(localizedMessage, entryAsText, e);
}
}
} else {
value = this.takesValues.getValue();
}
return value;
}
示例4: MyCell
import com.google.gwt.user.client.ui.ValueBoxBase; //导入依赖的package包/类
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();
}
示例5: ShareTextBox
import com.google.gwt.user.client.ui.ValueBoxBase; //导入依赖的package包/类
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();
}
示例6: UniTimeTextBox
import com.google.gwt.user.client.ui.ValueBoxBase; //导入依赖的package包/类
public UniTimeTextBox(int maxWidth, int width, ValueBoxBase.TextAlignment align) {
this();
setWidth(width + "px");
setMaxLength(maxWidth);
if (align != null)
setAlignment(align);
}
示例7: setEditor
import com.google.gwt.user.client.ui.ValueBoxBase; //导入依赖的package包/类
@UiChild(limit = 1, tagname = "editor")
public void setEditor(ValueBoxBase<T> widget) {
editChild = widget;
editPanel.add(editChild);
editProxy = null;
}
示例8: on
import com.google.gwt.user.client.ui.ValueBoxBase; //导入依赖的package包/类
private void on(GwtEvent<?> e) {
if (widget.isEnabled()
|| !(e.getSource() instanceof FocusWidget)
|| !((FocusWidget) e.getSource()).isEnabled()) {
if (e.getSource() instanceof ValueBoxBase) {
final TextBoxBase box = ((TextBoxBase) e.getSource());
Scheduler.get()
.scheduleDeferred(
new ScheduledCommand() {
@Override
public void execute() {
if (box.getValue().trim().equals(originalValue)) {
widget.setEnabled(false);
}
}
});
}
return;
}
if (e.getSource() instanceof TextBoxBase) {
onTextBoxBase((TextBoxBase) e.getSource());
} else {
// For many widgets, we can assume that a change is an edit. If
// a widget does not work that way, it should be special cased
// above.
widget.setEnabled(true);
}
}
示例9: markup
import com.google.gwt.user.client.ui.ValueBoxBase; //导入依赖的package包/类
/**
* @param text
* @return
*/
private String markup (ValueBoxBase<String> valueBox) {
StringBuffer markdown = new StringBuffer(valueBox.getValue());
markdown.insert(valueBox.getCursorPos(), CARET_BEFORE);
return PostHelper.makeMarkup(markdown.toString())
.replace(CARET_BEFORE, CARET_FINALLY)
.replace(CARET_AFTER, CARET_FINALLY);
}
示例10: setValueBox
import com.google.gwt.user.client.ui.ValueBoxBase; //导入依赖的package包/类
@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);
}
示例11: ExtendedValueBoxEditor
import com.google.gwt.user.client.ui.ValueBoxBase; //导入依赖的package包/类
/**
* constructor uses widget as base.
*
* @param ptakesValues widget which is able to set and get value from/to
* @param pdecorator corresponding decorator
*/
public ExtendedValueBoxEditor(final TakesValue<T> ptakesValues,
final AbstractDecorator<T> pdecorator) {
super(null);
this.messages = GWT.create(ExtendedValueBoxEditorMessages.class);
this.takesValues = ptakesValues;
this.decorator = pdecorator;
if (this.takesValues instanceof ValueBoxBase<?>) {
this.delegate = ((ValueBoxBase<T>) this.takesValues).asEditor().getDelegate();
}
}
示例12: MaskValueBoxHelper
import com.google.gwt.user.client.ui.ValueBoxBase; //导入依赖的package包/类
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);
}
示例13: setTextboxValueBySelectionModel
import com.google.gwt.user.client.ui.ValueBoxBase; //导入依赖的package包/类
public static void setTextboxValueBySelectionModel(ValueBoxBase<String> textBox,
SingleSelectionModel<? extends HasListboxValue> selectionModel) {
HasListboxValue selected = selectionModel.getSelectedObject();
if (selected == null) {
textBox.setValue("");
} else {
textBox.setValue(selected.getListboxValue());
}
}
示例14: tryValueBoxValue
import com.google.gwt.user.client.ui.ValueBoxBase; //导入依赖的package包/类
public static <T> T tryValueBoxValue(ValueBoxBase<T> valueBox, String onEmptyFailText, ValueCondition<T> condition) {
T result = valueBox.getValue();
if (result == null || result instanceof String && ((String) result).isEmpty()) {
valueBox.setFocus(true);
throw new ValueBoxEmptyException(onEmptyFailText);
}
if (condition != null) {
condition.test(result);
}
return result;
}
示例15: getValueBox
import com.google.gwt.user.client.ui.ValueBoxBase; //导入依赖的package包/类
public ValueBoxBase<String> getValueBox() {
return iText;
}