当前位置: 首页>>代码示例>>Java>>正文


Java ValueBoxBase类代码示例

本文整理汇总了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"));
}
 
开发者ID:GwtMaterialDesign,项目名称:gwt-material,代码行数:17,代码来源:MaterialValueBoxTest.java

示例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();
				}
			});
		}
	}
}
 
开发者ID:dawg6,项目名称:dhcalc,代码行数:19,代码来源:BasePanel.java

示例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;
}
 
开发者ID:ManfredTremmel,项目名称:gwt-bean-validators,代码行数:19,代码来源:ExtendedValueBoxEditor.java

示例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();
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:41,代码来源:ClassificationsEdit.java

示例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();
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:33,代码来源:CurriculaCourses.java

示例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);
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:8,代码来源:UniTimeTextBox.java

示例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;
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:7,代码来源:ValueEditor.java

示例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);
  }
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:30,代码来源:OnEditEnabler.java

示例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);
}
 
开发者ID:billy1380,项目名称:blogwt,代码行数:12,代码来源:EditPostPage.java

示例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);
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:12,代码来源:ValueBoxEditorView.java

示例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();
  }
}
 
开发者ID:ManfredTremmel,项目名称:gwt-bean-validators,代码行数:17,代码来源:ExtendedValueBoxEditor.java

示例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);
}
 
开发者ID:Putnami,项目名称:putnami-web-toolkit,代码行数:11,代码来源:MaskValueBoxHelper.java

示例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());
    }
}
 
开发者ID:rkfg,项目名称:gwtutil,代码行数:10,代码来源:ClientUtils.java

示例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;
}
 
开发者ID:rkfg,项目名称:gwtutil,代码行数:12,代码来源:ClientUtils.java

示例15: getValueBox

import com.google.gwt.user.client.ui.ValueBoxBase; //导入依赖的package包/类
public ValueBoxBase<String> getValueBox() {
	return iText;
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:4,代码来源:AriaSuggestBox.java


注:本文中的com.google.gwt.user.client.ui.ValueBoxBase类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。