Search in sources :

Example 1 with ResourceCallback

use of com.google.gwt.resources.client.ResourceCallback in project domino-ui-demo by DominoKit.

the class ProfileViewImpl method init.

@Override
protected HTMLDivElement init() {
    profile = Card.createProfile("Vegegoku", "vegegoku@bo3.com");
    profile.style().addCss("profile-card").addCss("classy-card").addCss("bg-theme");
    profile.setHeaderBackground(Color.TRANSPARENT);
    profile.setBodyBackground(Color.TRANSPARENT);
    profile.getHeader().style().removeCss("bg-theme");
    profile.setBodyPadding("10px");
    profile.getBody().styler(style -> style.removeCss("bg-theme"));
    profile.getHeaderTitle().setAttribute("id", "demo-profile");
    profile.appendChild(Elements.img(GWT.getModuleBaseURL() + "/images/user.png").style("border-radius:50%;"));
    HeaderAction headerAction = HeaderAction.create(Icons.ALL.more_vert().clickable());
    DropDownMenu dropDownMenu = DropDownMenu.create(headerAction).setPosition(DropDownPosition.BOTTOM).appendChild(DropdownAction.create("Action 1").addSelectionHandler(value -> Notification.createInfo(value).show())).appendChild(DropdownAction.create("Action 2").addSelectionHandler(value -> Notification.createInfo(value).show()));
    headerAction.addClickListener(evt -> {
        dropDownMenu.open();
        evt.stopPropagation();
    });
    profile.addHeaderAction(headerAction);
    Style.of(profile).setHeight("186px");
    profile.element().appendChild(div().css("bg-classy").element());
    try {
        CodeResource.INSTANCE.build().getText(new ResourceCallback<TextResource>() {

            @Override
            public void onError(ResourceException e) {
                DomGlobal.console.error("failed ", e);
            }

            @Override
            public void onSuccess(TextResource resource) {
                profile.getHeaderTitle().appendChild(small().textContent(resource.getText()).element());
                DomGlobal.console.info(resource.getText());
            }
        });
    } catch (Exception e) {
        DomGlobal.console.error("Failed to load build time : ", e);
    }
    return profile.element();
}
Also used : Icons(org.dominokit.domino.ui.icons.Icons) ResourceCallback(com.google.gwt.resources.client.ResourceCallback) DropdownAction(org.dominokit.domino.ui.dropdown.DropdownAction) TextResource(com.google.gwt.resources.client.TextResource) HeaderAction(org.dominokit.domino.ui.cards.HeaderAction) UiView(org.dominokit.domino.api.client.annotations.UiView) BaseElementView(org.dominokit.domino.view.BaseElementView) Elements(org.jboss.elemento.Elements) DomGlobal(elemental2.dom.DomGlobal) Style(org.dominokit.domino.ui.style.Style) GWT(com.google.gwt.core.client.GWT) ProfileView(org.dominokit.domino.profile.client.views.ProfileView) Notification(org.dominokit.domino.ui.notifications.Notification) DropDownPosition(org.dominokit.domino.ui.dropdown.DropDownPosition) Elements.small(org.jboss.elemento.Elements.small) Color(org.dominokit.domino.ui.style.Color) HTMLDivElement(elemental2.dom.HTMLDivElement) ProfileProxy(org.dominokit.domino.profile.client.presenters.ProfileProxy) Elements.div(org.jboss.elemento.Elements.div) DropDownMenu(org.dominokit.domino.ui.dropdown.DropDownMenu) Card(org.dominokit.domino.ui.cards.Card) ResourceException(com.google.gwt.resources.client.ResourceException) TextResource(com.google.gwt.resources.client.TextResource) HeaderAction(org.dominokit.domino.ui.cards.HeaderAction) DropDownMenu(org.dominokit.domino.ui.dropdown.DropDownMenu) ResourceException(com.google.gwt.resources.client.ResourceException) ResourceException(com.google.gwt.resources.client.ResourceException)

Aggregations

GWT (com.google.gwt.core.client.GWT)1 ResourceCallback (com.google.gwt.resources.client.ResourceCallback)1 ResourceException (com.google.gwt.resources.client.ResourceException)1 TextResource (com.google.gwt.resources.client.TextResource)1 DomGlobal (elemental2.dom.DomGlobal)1 HTMLDivElement (elemental2.dom.HTMLDivElement)1 UiView (org.dominokit.domino.api.client.annotations.UiView)1 ProfileProxy (org.dominokit.domino.profile.client.presenters.ProfileProxy)1 ProfileView (org.dominokit.domino.profile.client.views.ProfileView)1 Card (org.dominokit.domino.ui.cards.Card)1 HeaderAction (org.dominokit.domino.ui.cards.HeaderAction)1 DropDownMenu (org.dominokit.domino.ui.dropdown.DropDownMenu)1 DropDownPosition (org.dominokit.domino.ui.dropdown.DropDownPosition)1 DropdownAction (org.dominokit.domino.ui.dropdown.DropdownAction)1 Icons (org.dominokit.domino.ui.icons.Icons)1 Notification (org.dominokit.domino.ui.notifications.Notification)1 Color (org.dominokit.domino.ui.style.Color)1 Style (org.dominokit.domino.ui.style.Style)1 BaseElementView (org.dominokit.domino.view.BaseElementView)1 Elements (org.jboss.elemento.Elements)1