Search in sources :

Example 1 with UiChild

use of com.google.gwt.uibinder.client.UiChild in project gwt-test-utils by gwt-test-utils.

the class UiObjectTag method collectUiChildMethods.

private Map<String, UiChildMethodHolder> collectUiChildMethods(Class<? extends T> clazz) {
    Map<String, UiChildMethodHolder> map = new HashMap<String, UiObjectTag.UiChildMethodHolder>();
    Map<Method, UiChild> uiChildMap = GwtReflectionUtils.getAnnotatedMethod(clazz, UiChild.class);
    for (Map.Entry<Method, UiChild> entry : uiChildMap.entrySet()) {
        Method method = entry.getKey();
        UiChild annotation = entry.getValue();
        UiChildMethodHolder holder = new UiChildMethodHolder();
        holder.uiChildMethod = method;
        // default is -1
        holder.invocationLimit = annotation.limit();
        holder.invocationCount = 0;
        String tagName = (annotation.tagname().equals("")) ? computeUiChildMethodTagName(method) : annotation.tagname();
        map.put(tagName, holder);
    }
    return map;
}
Also used : HashMap(java.util.HashMap) UiChild(com.google.gwt.uibinder.client.UiChild) Method(java.lang.reflect.Method) HashMap(java.util.HashMap) Map(java.util.Map)

Example 2 with UiChild

use of com.google.gwt.uibinder.client.UiChild in project gwt-test-utils by gwt-test-utils.

the class WidgetWithUiChild method addMyUiLabel.

@UiChild
void addMyUiLabel(Label l) {
    FlowPanel flowPanel = (FlowPanel) this.getWidget();
    flowPanel.add(l);
    labels.add(l);
}
Also used : FlowPanel(com.google.gwt.user.client.ui.FlowPanel) UiChild(com.google.gwt.uibinder.client.UiChild)

Example 3 with UiChild

use of com.google.gwt.uibinder.client.UiChild in project gwt-test-utils by gwt-test-utils.

the class WidgetWithUiChild method uiCustomChild.

@UiChild(tagname = "customChild", limit = 1)
void uiCustomChild(Widget w) {
    FlowPanel flowPanel = (FlowPanel) this.getWidget();
    flowPanel.add(w);
    customWidgets.add(w);
}
Also used : FlowPanel(com.google.gwt.user.client.ui.FlowPanel) UiChild(com.google.gwt.uibinder.client.UiChild)

Aggregations

UiChild (com.google.gwt.uibinder.client.UiChild)3 FlowPanel (com.google.gwt.user.client.ui.FlowPanel)2 Method (java.lang.reflect.Method)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1