use of gwt.material.design.client.base.MaterialWidget in project gwt-material by GwtMaterialDesign.
the class MaterialSideNavMini method setup.
@Override
protected void setup() {
applyBodyScroll();
if (isExpandable()) {
setType(SideNavType.MINI_WITH_EXPAND);
applyTransition(getElement());
int originalWidth = getWidth();
int miniWidth = 64;
pushElement(getMain(), miniWidth);
pushElementMargin(getFooter(), miniWidth);
setWidth(miniWidth);
registerHandler(addOpeningHandler(event -> expand(originalWidth)));
registerHandler(addClosingHandler(event -> collapse(miniWidth)));
// Add Opening when sidenav link is clicked by default
for (Widget w : getChildren()) {
if (w instanceof MaterialWidget && isExpandOnClick()) {
$(w.getElement()).off("click").on("click", (e, param1) -> {
if (!getElement().hasClassName("expanded")) {
show();
}
return true;
});
}
}
} else {
setType(SideNavType.MINI);
setWidth(64);
}
}
use of gwt.material.design.client.base.MaterialWidget in project gwt-material by GwtMaterialDesign.
the class ColorHelper method setupComputedBackgroundColor.
public static String setupComputedBackgroundColor(Color color) {
MaterialWidget temp = new MaterialWidget(Document.get().createDivElement());
temp.setBackgroundColor(color);
RootPanel.get().add(temp);
String computed = getComputedBackgroundColor(temp.getElement()).toLowerCase();
temp.removeFromParent();
return computed;
}
Aggregations