Search in sources :

Example 1 with MembershipExpirationTabItem

use of cz.metacentrum.perun.webgui.tabs.memberstabs.MembershipExpirationTabItem in project perun by CESNET.

the class MembershipExpirationWidget method build.

/**
 * Builds the widget
 */
private void build() {
    statusWidget.clear(true);
    statusWidget.setCellSpacing(0);
    statusWidget.setCellPadding(0);
    statusWidget.setStyleName("membership-expiration");
    if (member != null) {
        Attribute expire = member.getAttribute("urn:perun:member:attribute-def:def:membershipExpiration");
        if (expire != null && !"null".equalsIgnoreCase(expire.getValue())) {
            statusWidget.setHTML(0, 0, expire.getValue());
        } else {
            statusWidget.setHTML(0, 0, "<i>never</i>");
        }
        if (expire != null && expire.isWritable()) {
            Anchor change = new Anchor("change");
            change.addClickHandler(new ClickHandler() {

                @Override
                public void onClick(ClickEvent clickEvent) {
                    PerunWebSession.getInstance().getTabManager().addTabToCurrentTab(new MembershipExpirationTabItem(member, new JsonCallbackEvents() {

                        @Override
                        public void onFinished(JavaScriptObject jso) {
                            if (containingTabItem != null) {
                                // forcefully refresh tab !!
                                containingTabItem.draw();
                            }
                        }
                    }));
                }
            });
            statusWidget.setWidget(0, 1, change);
            statusWidget.getFlexCellFormatter().setStyleName(0, 1, "change");
        }
    } else {
    }
}
Also used : JsonCallbackEvents(cz.metacentrum.perun.webgui.json.JsonCallbackEvents) Anchor(com.google.gwt.user.client.ui.Anchor) MembershipExpirationTabItem(cz.metacentrum.perun.webgui.tabs.memberstabs.MembershipExpirationTabItem) ClickHandler(com.google.gwt.event.dom.client.ClickHandler) Attribute(cz.metacentrum.perun.webgui.model.Attribute) JavaScriptObject(com.google.gwt.core.client.JavaScriptObject) ClickEvent(com.google.gwt.event.dom.client.ClickEvent)

Aggregations

JavaScriptObject (com.google.gwt.core.client.JavaScriptObject)1 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)1 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)1 Anchor (com.google.gwt.user.client.ui.Anchor)1 JsonCallbackEvents (cz.metacentrum.perun.webgui.json.JsonCallbackEvents)1 Attribute (cz.metacentrum.perun.webgui.model.Attribute)1 MembershipExpirationTabItem (cz.metacentrum.perun.webgui.tabs.memberstabs.MembershipExpirationTabItem)1