本文整理汇总了Java中com.google.gwt.uibinder.client.UiField类的典型用法代码示例。如果您正苦于以下问题:Java UiField类的具体用法?Java UiField怎么用?Java UiField使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
UiField类属于com.google.gwt.uibinder.client包,在下文中一共展示了UiField类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getFake
import com.google.gwt.uibinder.client.UiField; //导入依赖的package包/类
/**
* Returns a new instance of FakeUiBinder that implements the given interface.
* This is accomplished by returning a dynamic proxy object that delegates
* calls to a backing FakeUiBinder.
*
* @param type interface to be implemented by the returned type. This must
* represent an interface that directly extends {@link UiBinder}.
*/
@Override
public UiBinder<?, ?> getFake(final Class<?> type) {
return (UiBinder<?, ?>) Proxy.newProxyInstance(
FakeUiBinderProvider.class.getClassLoader(),
new Class<?>[] {type},
new InvocationHandler() {
@Override
public Object invoke(Object proxy, Method method, Object[] args) throws Exception {
// createAndBindUi is the only method defined by UiBinder
for (Field field : getAllFields(args[0].getClass())) {
if (field.isAnnotationPresent(UiField.class)
&& !field.getAnnotation(UiField.class).provided()) {
field.setAccessible(true);
field.set(args[0], GWT.create(field.getType()));
}
}
return GWT.create(getUiRootType(type));
}
});
}
示例2: shouldMockUiBinders
import com.google.gwt.uibinder.client.UiField; //导入依赖的package包/类
@Test
public void shouldMockUiBinders() {
class Owner {
@UiField Element uiField;
}
Owner owner = new Owner();
SomeUiBinder uiBinder = GWT.create(SomeUiBinder.class);
uiBinder.createAndBindUi(owner);
when(owner.uiField.getClassName()).thenReturn("class");
Assert.assertEquals("class", owner.uiField.getClassName());
}
示例3: onUIEvent
import com.google.gwt.uibinder.client.UiField; //导入依赖的package包/类
void onUIEvent(UiField event);