本文整理匯總了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);