Example usage for com.google.gwt.user.client.ui Widget addStyleName

List of usage examples for com.google.gwt.user.client.ui Widget addStyleName

Introduction

In this page you can find the example usage for com.google.gwt.user.client.ui Widget addStyleName.

Prototype

public void addStyleName(String style) 

Source Link

Document

Adds a secondary or dependent style name to this object.

Usage

From source file:org.eurekastreams.web.client.ui.connect.widget.ShareActivityWidget.java

License:Apache License

/**
 * Constructor./*from   w w w. ja  v a 2  s.  c  o  m*/
 * 
 * @param activityId
 *            ID of activity to share.
 */
public ShareActivityWidget(final Long activityId) {
    final SimplePanel main = new SimplePanel();
    main.addStyleName(StaticResourceBundle.INSTANCE.coreCss().shareMessageDialog());
    initWidget(main);

    EventBus.getInstance().addObserver(GotActivityResponseEvent.class,
            new Observer<GotActivityResponseEvent>() {
                public void update(final GotActivityResponseEvent ev) {
                    ShareMessageDialogContent dialogContent = new ShareMessageDialogContent(ev.getResponse());
                    dialogContent.setHost(new DialogContentHost() {
                        public void center() {
                        }

                        public void hide() {
                            WidgetJSNIFacadeImpl.nativeClose();
                        }
                    });
                    Widget dialogWidget = dialogContent.getBody();
                    dialogWidget.addStyleName(StaticResourceBundle.INSTANCE.coreCss().embeddedWidget());
                    dialogWidget.addStyleName(StaticResourceBundle.INSTANCE.coreCss().connectCommentWidget());
                    main.add(dialogWidget);
                }
            });

    ActivityModel.getInstance().fetch(activityId, true);
}

From source file:org.eurekastreams.web.client.ui.connect.widget.UserProfileBadgeWidget.java

License:Apache License

/**
 * Constructor.//from  w  w w. ja  va  2s .c  o  m
 *
 * @param accountId
 *            Unique ID of person to display.
 */
public UserProfileBadgeWidget(final String accountId) {
    final FlowPanel widget = new FlowPanel();
    widget.addStyleName(StaticResourceBundle.INSTANCE.coreCss().eurekaConnectBadgeContainer());
    initWidget(widget);

    widget.addStyleName(StaticResourceBundle.INSTANCE.coreCss().eurekaConnectLoading());

    EventBus.getInstance().addObserver(GotPersonalInformationResponseEvent.class,
            new Observer<GotPersonalInformationResponseEvent>() {
                public void update(final GotPersonalInformationResponseEvent event) {
                    widget.removeStyleName(StaticResourceBundle.INSTANCE.coreCss().eurekaConnectLoading());
                    PersonModelView entity = event.getResponse();

                    if (entity == null) {
                        final AvatarWidget blankAvatar = new AvatarWidget(EntityType.PERSON, Size.Normal);
                        blankAvatar.addStyleName(
                                StaticResourceBundle.INSTANCE.coreCss().eurekaConnectBadgeAvatar());

                        widget.add(blankAvatar);

                        final Label blankName = new Label(accountId);
                        blankName
                                .addStyleName(StaticResourceBundle.INSTANCE.coreCss().eurekaConnectBadgeName());

                        widget.add(blankName);
                    } else {
                        Widget linkPanel = AvatarLinkPanel.create(entity, Size.Normal, false);
                        linkPanel.addStyleName(
                                StaticResourceBundle.INSTANCE.coreCss().eurekaConnectBadgeAvatar());
                        widget.add(linkPanel);

                        String linkUrl = "/#" + Session.getInstance()
                                .generateUrl(new CreateUrlRequest(Page.PEOPLE, entity.getAccountId()));

                        Anchor name = new Anchor(entity.getDisplayName(), linkUrl, "_BLANK");
                        name.addStyleName(StaticResourceBundle.INSTANCE.coreCss().eurekaConnectBadgeName());

                        Label title = new Label(entity.getTitle());
                        title.addStyleName(StaticResourceBundle.INSTANCE.coreCss().eurekaConnectBadgeTitle());

                        Label company = new Label(entity.getCompanyName());
                        company.addStyleName(
                                StaticResourceBundle.INSTANCE.coreCss().eurekaConnectBadgeCompany());

                        widget.add(name);
                        widget.add(title);
                        widget.add(company);
                    }
                }
            });

    PersonalInformationModel.getInstance().fetch(accountId, false);
}

From source file:org.eurekastreams.web.client.ui.pages.discover.ActiveStreamItemPanel.java

License:Apache License

/**
 * Constructor.//  ww w  .  java2  s  .c o  m
 *
 * @param inStreamDTO
 *            the streamDTO to represent
 */
public ActiveStreamItemPanel(final StreamDTO inStreamDTO) {
    coreCss = StaticResourceBundle.INSTANCE.coreCss();
    avatarPanel = new AvatarLinkPanel(inStreamDTO.getEntityType(), inStreamDTO.getUniqueId(),
            inStreamDTO.getAvatarId(), Size.Small);
    Widget main = binder.createAndBindUi(this);
    initWidget(main);

    // add follow controls if not the current person
    if (inStreamDTO.getEntityType() != EntityType.PERSON
            || inStreamDTO.getEntityId() != Session.getInstance().getCurrentPerson().getEntityId()) {
        final Widget followPanel;
        // it's not the current user - see if it's a private group, and if we're not admin
        if (inStreamDTO.getEntityType() == EntityType.GROUP && inStreamDTO instanceof DomainGroupModelView
                && ((DomainGroupModelView) inStreamDTO).isPublic() != null
                && !((DomainGroupModelView) inStreamDTO).isPublic()
                && !Session.getInstance().getCurrentPerson().getRoles().contains(Role.SYSTEM_ADMIN)) {
            // this is a private group and we're not an admin, so we gotta request access
            followPanel = new FollowPanel(inStreamDTO, style.request(),
                    StaticResourceBundle.INSTANCE.coreCss().unFollowLink(),
                    StaticResourceBundle.INSTANCE.coreCss().followLink(), false, style.pending());
        } else {
            followPanel = new FollowPanel(inStreamDTO);
        }
        followPanel.addStyleName(style.followPanel());
        infoPanel.add(followPanel);
    }

    // set text and link for name; assume group if not person
    Page linkPage = (inStreamDTO.getEntityType() == EntityType.PERSON) ? Page.PEOPLE : Page.GROUPS;
    String nameUrl = Session.getInstance().generateUrl(//
            new CreateUrlRequest(linkPage, inStreamDTO.getUniqueId()));
    streamNameLink.setTargetHistoryToken(nameUrl);
    streamNameLink.setText(inStreamDTO.getDisplayName());
    streamNameLink.setTitle(inStreamDTO.getDisplayName());

    messageCount.setInnerText(inStreamDTO.getFollowersCount() == 1 ? "1 Daily Message"
            : Integer.toString(inStreamDTO.getFollowersCount()) + " Daily Messages");
}

From source file:org.eurekastreams.web.client.ui.pages.discover.FeaturedStreamItemPanel.java

License:Apache License

/**
 * Constructor.// w ww .j a  v a  2  s  .  c  o m
 *
 * @param inStreamDTO
 *            the streamDTO to represent
 */
public FeaturedStreamItemPanel(final FeaturedStreamDTO inStreamDTO) {
    coreCss = StaticResourceBundle.INSTANCE.coreCss();
    avatarPanel = new AvatarLinkPanel(inStreamDTO.getEntityType(), inStreamDTO.getUniqueId(),
            inStreamDTO.getAvatarId(), Size.Normal);
    Widget main = binder.createAndBindUi(this);
    initWidget(main);

    // add follow controls if not the current person
    if (inStreamDTO.getEntityType() != EntityType.PERSON
            || inStreamDTO.getEntityId() != Session.getInstance().getCurrentPerson().getEntityId()) {
        Widget followPanel = new FollowPanel(inStreamDTO);
        followPanel.addStyleName(style.followPanel());
        leftPanel.add(followPanel);
    }

    // assume group if not person
    Page linkPage = (inStreamDTO.getEntityType() == EntityType.PERSON) ? Page.PEOPLE : Page.GROUPS;
    String nameUrl = Session.getInstance().generateUrl(//
            new CreateUrlRequest(linkPage, inStreamDTO.getUniqueId()));
    streamNameLink.setTargetHistoryToken(nameUrl);
    streamNameLink.setText(inStreamDTO.getDisplayName());

    streamDescriptionText.setInnerText(inStreamDTO.getDescription());
}

From source file:org.guvnor.client.screens.LHSMenuViewImpl.java

License:Apache License

private boolean checkStyle(ClickEvent e, Widget widget) {
    if (widget.getElement().equals(e.getRelativeElement())) {
        widget.removeStyleName(style.normal());
        widget.addStyleName(style.selected());
        return true;
    } else {/*from   www  . jav a 2 s  .c  o  m*/
        widget.removeStyleName(style.selected());
        widget.addStyleName(style.normal());
        return false;
    }
}

From source file:org.gwtbootstrap3.client.ui.base.form.FormElementContainer.java

License:Apache License

/** {@inheritDoc} */
@Override/*from   w  w w . j  a v a  2s.  c  o  m*/
public void add(final Widget w) {
    if (w instanceof ListBox || w instanceof FileUpload) {
        w.addStyleName(Styles.FORM_CONTROL);
    }
    add(w, (Element) getElement());
}

From source file:org.gwtbootstrap3.client.ui.base.mixin.DataTargetMixin.java

License:Apache License

@Override
public void setDataTargetWidgets(final List<Widget> widgets) {
    final String styleName = Document.get().createUniqueId();
    for (final Widget widget : widgets) {
        widget.addStyleName(styleName);
    }//from   w  w w . jav a2 s  .  c  o  m
    this.setDataTarget("." + styleName);
}

From source file:org.gwtbootstrap3.client.ui.Breadcrumbs.java

License:Apache License

@Override
protected void onAttach() {
    if (!isOrWasAttached() && children.size() > 0) {
        final Widget lastWidget = children.get(children.size() - 1);
        lastWidget.addStyleName(Styles.ACTIVE);
    }// w w w.  ja va2 s .  com

    super.onAttach();
}

From source file:org.gwtbootstrap3.client.ui.Breadcrumbs.java

License:Apache License

/**
 * {@inheritDoc}//  ww  w  . ja va  2 s  .c o  m
 */
@Override
public void add(final Widget w) {
    w.addStyleName(Styles.ACTIVE);
    super.add(w);
    children.add(w);
}

From source file:org.gwtportlets.portlet.client.edit.WidgetZIndexer.java

License:Open Source License

private void scan() {
    RootPanel p = RootPanel.get();/*from w w w  .ja  v  a2s .c  o  m*/
    int n = p.getWidgetCount();
    if (n == startWidgetCount) {
        stop();
    }
    for (int i = startWidgetCount; i < n; i++) {
        Widget w = p.getWidget(i);
        if (!w.getStyleName().contains(ZINDEX_STYLE)) {
            w.addStyleName(ZINDEX_STYLE);
        }
    }
}