com.googlecode.gwt.test.uibinder.widget.UiHTMLPanelTagFactory Maven / Gradle / Ivy
package com.googlecode.gwt.test.uibinder.widget;
import com.google.gwt.dom.client.Element;
import com.google.gwt.user.client.ui.HTMLPanel;
import com.google.gwt.user.client.ui.IsWidget;
import com.googlecode.gwt.test.uibinder.UiObjectTag;
import com.googlecode.gwt.test.uibinder.UiObjectTagFactory;
import java.util.List;
import java.util.Map;
/**
* Handles <g:HTMLPanel> tags.
*
* @author Gael Lazzari
*/
public class UiHTMLPanelTagFactory implements UiObjectTagFactory {
private static class UiHTMLPanelTag extends UiObjectTag {
@Override
protected void appendElement(HTMLPanel wrapped, Element element, String namespaceURI,
List childWidgets) {
getElement(wrapped).appendChild(element);
}
@Override
protected void finalizeObject(HTMLPanel widget) {
// nothing to do
}
@Override
protected void initializeObject(HTMLPanel wrapped, Map attributes,
Object owner) {
// nothing to do
}
@Override
protected HTMLPanel instanciate(Class clazz,
Map attributes, Object owner) {
if (clazz == HTMLPanel.class) {
return new HTMLPanel("");
}
// use default instanciation system
return super.instanciate(clazz, attributes, owner);
}
}
/*
* (non-Javadoc)
*
* @see com.googlecode.gwt.test.uibinder.UiObjectTagFactory#createUiObjectTag (java.lang.Class,
* java.util.Map)
*/
public UiObjectTag createUiObjectTag(Class clazz, Map attributes) {
if (HTMLPanel.class.isAssignableFrom(clazz)) {
return new UiHTMLPanelTag();
}
return null;
}
}