/**
   * Constructor.
   *
   * @param inSettings the system settings
   * @param inSupportGroup the support domain group
   */
  public SupportStreamHelpPanel(
      final SystemSettings inSettings, final DomainGroupModelView inSupportGroup) {
    Label headerLabel = new Label("Support Stream");
    headerPanel.add(headerLabel);
    headerPanel.addStyleName(StaticResourceBundle.INSTANCE.coreCss().header());
    contentPanel.add(descriptionPanel);
    add(headerPanel);
    add(contentPanel);

    logoPanel.add(
        new AvatarWidget(
            inSupportGroup.getId(), inSupportGroup.getAvatarId(), EntityType.GROUP, Size.Normal));
    logoPanel.addStyleName(StaticResourceBundle.INSTANCE.coreCss().supportGroupLogoPanel());

    contentPanel.addStyleName(StaticResourceBundle.INSTANCE.coreCss().contentPanel());
    contentPanel.add(logoPanel);
    descriptionPanel.add(new Label(inSupportGroup.getDescription()));

    Hyperlink gotoStreamLink =
        new Hyperlink(
            "Go to Stream",
            Session.getInstance()
                .generateUrl(
                    new CreateUrlRequest(
                        Page.GROUPS, inSettings.getSupportStreamGroupShortName())));
    descriptionPanel.add(gotoStreamLink);
    gotoStreamLink.addStyleName(
        StaticResourceBundle.INSTANCE.coreCss().goToSupportGroupStreamLink());

    contentPanel.add(descriptionPanel);
    descriptionPanel.addStyleName(
        StaticResourceBundle.INSTANCE.coreCss().supportGroupDescriptionPanel());
  }
 /** Gets triggered whenever the comment changes. */
 private void onCommentChanges() {
   Integer charsRemaining = MAXLENGTH - commentBox.getText().length();
   countDown.setText(charsRemaining.toString());
   if (charsRemaining >= 0 && charsRemaining != MAXLENGTH) {
     countDown.removeStyleName("over-character-limit");
     post.removeStyleName("inactive");
     inactive = false;
   } else {
     if (charsRemaining != MAXLENGTH) {
       countDown.addStyleName("over-character-limit");
     }
     post.addStyleName("inactive");
     inactive = true;
   }
 }
예제 #3
0
  public StartGameScreen(SoundPlayer soundPlayer) {

    HTML joinGameLabel = new HTML("<h3>Games you can play in:</h3>");
    joinGameLabel.addStyleName("heavy");
    content.add(joinGameLabel);

    VerticalPanel indented = new VerticalPanel();
    indented.addStyleName("indented");
    content.add(indented);
    joinableGamesTable.setText(0, 0, "Loading...");
    indented.add(joinableGamesTable);
    content.add(new HTML("<br />"));

    Hyperlink createGameLink =
        new Hyperlink("Create a Game", ScreenControllers.getHistoryToken(Screen.CREATE_GAME));
    soundPlayer.addMenuClick(createGameLink);
    createGameLink.addStyleName("heavy");
    content.add(createGameLink);
  }
예제 #4
0
  private void drawForgotPassword() {

    // reset ui
    pUi.clear();

    bForgot.setTitle(
        "This will reset your password, and send you a email of the new password to login.");

    HorizontalPanel hp = new HorizontalPanel();
    hp.setSpacing(4);
    hp.add(tbConsumerKey);
    hp.add(bForgot);
    hp.add(hAccountLogin);

    pUi.add(hp);

    // style
    hForgotPassword.addStyleName("login-Ui-InputOptions");
    hp.setCellVerticalAlignment(hAccountLogin, VerticalPanel.ALIGN_BOTTOM);
  }
  /** Activate the control. */
  public void activate() {
    this.clear();
    this.setVisible(true);
    Widget avatar =
        new AvatarWidget(
            Session.getInstance().getCurrentPerson().getId(),
            Session.getInstance().getCurrentPerson().getAvatarId(),
            EntityType.PERSON,
            Size.VerySmall,
            Background.White);
    avatar.addStyleName("avatar");
    this.add(avatar);

    FlowPanel body = new FlowPanel();
    body.addStyleName("body");

    commentBox = new TextArea();
    body.add(commentBox);
    commentBox.setFocus(true);

    countDown = new Label(Integer.toString(MAXLENGTH));
    countDown.addStyleName("characters-remaining");
    body.add(countDown);

    post = new Hyperlink("post", History.getToken());
    post.addStyleName("post-button");
    post.addStyleName("inactive");

    final Label warning = new Label();
    warning.addStyleName("warning hidden");
    body.add(warning);

    Session.getInstance()
        .getEventBus()
        .addObserver(
            GotSystemSettingsResponseEvent.class,
            new Observer<GotSystemSettingsResponseEvent>() {
              public void update(final GotSystemSettingsResponseEvent event) {
                String text = event.getResponse().getContentWarningText();
                if (text != null && !text.isEmpty()) {
                  warning.removeStyleName("hidden");
                  warning.setText(text);
                }
              }
            });

    SystemSettingsModel.getInstance().fetch(null, true);

    post.addClickHandler(
        new ClickHandler() {
          public void onClick(final ClickEvent event) {
            fullCollapse = false;
            if (!inactive) {
              unActivate();
              CommentDTO comment = new CommentDTO();
              comment.setBody(commentBox.getText());
              comment.setActivityId(messageId);
              Session.getInstance()
                  .getActionProcessor()
                  .makeRequest(
                      new ActionRequestImpl<CommentDTO>("postActivityCommentAction", comment),
                      new AsyncCallback<CommentDTO>() {
                        /* implement the async call back methods */
                        public void onFailure(final Throwable caught) {}

                        public void onSuccess(final CommentDTO result) {
                          Session.getInstance()
                              .getEventBus()
                              .notifyObservers(new CommentAddedEvent(result, messageId));
                        }
                      });
            }
          }
        });
    body.add(post);

    this.add(body);
    commentBox.setFocus(true);
    nativeSetFocus(commentBox.getElement());

    commentBox.addBlurHandler(
        new BlurHandler() {
          public void onBlur(final BlurEvent arg0) {
            TimerFactory timerFactory = new TimerFactory();
            timerFactory.runTimer(
                BLUR_DELAY,
                new TimerHandler() {
                  public void run() {
                    if (commentBox.getText().length() == 0) {
                      unActivate();
                    }
                  }
                });
          }
        });

    commentBox.addKeyPressHandler(
        new KeyPressHandler() {
          public void onKeyPress(final KeyPressEvent event) {
            if (event.getCharCode() == KeyCodes.KEY_ESCAPE) {
              unActivate();
            }
          }
        });

    commentBox.addKeyUpHandler(
        new KeyUpHandler() {
          public void onKeyUp(final KeyUpEvent event) {
            onCommentChanges();
          }
        });

    commentBox.addChangeHandler(
        new ChangeHandler() {
          public void onChange(final ChangeEvent event) {
            onCommentChanges();
          }
        });
  }
 /** Hides the post button. */
 private void hidePostButton() {
   postButton.addStyleName(StaticResourceBundle.INSTANCE.coreCss().inactive());
 }
  /**
   * Builds the UI.
   *
   * @param inScope the scope.
   */
  private void setupWidgets(final StreamScope inScope) {
    this.getElement().setAttribute("id", "post-to-stream");
    this.addStyleName(StaticResourceBundle.INSTANCE.coreCss().small());

    charsRemaining = new Label();
    postButton = new Hyperlink("", History.getToken());
    postButton.getElement().setAttribute("tabindex", "2");
    message = new PostToStreamTextboxPanel();
    message.setText(postBoxDefaultText);
    message.setVisible(false); // Hide until post ready event.

    this.addStyleName(StaticResourceBundle.INSTANCE.coreCss().postToStream());
    errorMsg.addStyleName(StaticResourceBundle.INSTANCE.coreCss().formErrorBox());
    errorMsg.setVisible(false);
    this.add(errorMsg);

    FlowPanel postInfoContainer = new FlowPanel();
    postInfoContainer.addStyleName(StaticResourceBundle.INSTANCE.coreCss().postInfoContainer());

    postButton.addStyleName(StaticResourceBundle.INSTANCE.coreCss().postButton());
    postInfoContainer.add(postButton);

    charsRemaining.addStyleName(StaticResourceBundle.INSTANCE.coreCss().charactersRemaining());
    postInfoContainer.add(charsRemaining);

    AvatarWidget avatar =
        new AvatarWidget(
            Session.getInstance().getCurrentPerson(), EntityType.PERSON, Size.VerySmall);
    avatar.addStyleName(StaticResourceBundle.INSTANCE.coreCss().postEntryAvatar());

    Panel entryPanel = new FlowPanel();
    entryPanel.addStyleName(StaticResourceBundle.INSTANCE.coreCss().postEntryPanel());
    entryPanel.add(avatar);
    entryPanel.add(postInfoContainer);
    entryPanel.add(message);
    SimplePanel breakPanel = new SimplePanel();
    breakPanel.addStyleName(StaticResourceBundle.INSTANCE.coreCss().breakClass());
    entryPanel.add(breakPanel);
    add(entryPanel);

    // below text area: links and post to on one line, then content warning below

    expandedPanel.addStyleName(StaticResourceBundle.INSTANCE.coreCss().postExpandedPanel());

    postToPanel = new PostToPanel(inScope);
    expandedPanel.add(postToPanel);
    links = new AddLinkComposite();
    expandedPanel.add(links);

    contentWarning = new FlowPanel();
    contentWarningContainer.addStyleName(StaticResourceBundle.INSTANCE.coreCss().contentWarning());
    contentWarningContainer.add(new SimplePanel());
    contentWarningContainer.add(contentWarning);
    expandedPanel.add(contentWarningContainer);

    add(expandedPanel);

    setVisible(false);

    setVisible(Session.getInstance().getCurrentPerson() != null);
  }