use of org.jboss.gwt.elemento.core.IsElement in project console by hal.
the class RootView method appendContent.
@SuppressWarnings("unchecked")
private void appendContent(IsWidget content) {
// single or multiple elements with precedence for multiple elements
boolean finished = false;
if (content instanceof Iterable) {
Iterable<HTMLElement> elements = (Iterable<HTMLElement>) content;
for (HTMLElement element : elements) {
rootContainer.appendChild(element);
finished = true;
}
}
if (!finished) {
HTMLElement element = content instanceof IsElement ? ((IsElement<HTMLElement>) content).element() : Widgets.element(content);
rootContainer.appendChild(element);
}
}
use of org.jboss.gwt.elemento.core.IsElement in project console by hal.
the class RootView method setInSlot.
@Override
public void setInSlot(Object slot, IsWidget content) {
if (slot == SLOT_HEADER_CONTENT || slot == SLOT_FOOTER_CONTENT) {
// single elements only!
HTMLElement element = content instanceof IsElement ? ((IsElement) content).element() : Widgets.element(content);
slots.put(slot, element);
if (!initialized && slots.containsKey(SLOT_HEADER_CONTENT) && slots.containsKey(SLOT_FOOTER_CONTENT)) {
// append all three building blocks to the document body
document.body.appendChild(slots.get(SLOT_HEADER_CONTENT));
document.body.appendChild(rootContainer);
document.body.appendChild(slots.get(SLOT_FOOTER_CONTENT));
initialized = true;
}
} else if (slot == Slots.MAIN) {
Elements.removeChildrenFrom(rootContainer);
appendContent(content);
} else {
logger.warn("Unknown slot {}. Delegate to super.setInSlot()", slot);
super.setInSlot(slot, content);
}
}
Aggregations