예제 #1
0
  /**
   * Constructor.
   *
   * @param entityType Type of entity the avatar belongs to.
   * @param entityUniqueId Short name / account id of entity the avatar belongs to.
   * @param avatar Avatar image widget.
   */
  public AvatarLinkPanel(
      final EntityType entityType, final String entityUniqueId, final AvatarWidget avatar) {
    Panel main = new FlowPanel();
    main.addStyleName(StaticResourceBundle.INSTANCE.coreCss().avatar());
    initWidget(main);

    Page page;
    switch (entityType) {
      case PERSON:
        page = Page.PEOPLE;
        break;
      case GROUP:
        page = Page.GROUPS;
        break;
      default:
        // this should never happen
        return;
    }
    HashMap<String, String> params = new HashMap<String, String>();
    params.put("tab", "Stream");

    String linkUrl =
        Session.getInstance().generateUrl(new CreateUrlRequest(page, entityUniqueId, params));

    Hyperlink link = new InlineHyperlink("", linkUrl);
    main.add(link);
    link.getElement().appendChild(avatar.getElement());
  }
예제 #2
0
  public TagPopup(UIObject target, String spaceUname, String tagname) {
    super(target, true, true, true);
    this.spaceUname = spaceUname;
    this.tagname = tagname;

    VerticalPanel panel = new VerticalPanel();
    panel.add(message);
    panel.add(new HTML("<b>" + tagname + "</b>"));
    panel.add(new Hr());
    panel.add(pagesPanel);
    if (!AbstractEntryPoint.isOffline()) {
      // so far, have to block tag cloud in offline model as the macro render logic is on
      // MacroHandler side, it is not easy to do in
      // offline model.
      Hyperlink tagCloud =
          new Hyperlink(
              Msg.consts.goto_tagcloud(),
              GwtUtils.buildToken(
                  GwtUtils.getCPageToken(SharedConstants.CPAGE_TAG_CLOUD), spaceUname));
      tagCloud.addClickHandler(
          new ClickHandler() {
            public void onClick(ClickEvent event) {
              TagPopup.this.hide();
            }
          });
      panel.add(tagCloud);
      panel.setCellHorizontalAlignment(tagCloud, HasHorizontalAlignment.ALIGN_RIGHT);
    }
    panel.setSize("100%", "100%");
    this.setWidget(panel);
  }
  @SuppressWarnings("deprecation") // GWT 1.x vs 2.x
  private void setData() {

    ListPanel listPanel = new ListPanel();

    listPanel.setHeader(1, "Component Type");
    listPanel.setHeader(2, "Number");
    listPanel.setColumnWidth(1, "100%");

    for (int i = 0; i < componentTypeInfos.length; i++) {
      final ComponentTypeInfo componentTypeInfo = componentTypeInfos[i];

      listPanel.setCell(
          i,
          0,
          new Image("images/components." + componentTypeInfo.getType().toLowerCase() + ".gif"));

      Hyperlink componentTypeLink =
          new Hyperlink(componentTypeInfo.getType(), componentTypeInfo.getType());
      componentTypeLink.addClickHandler(
          new ClickHandler() {
            public void onClick(ClickEvent event) {
              onComponentType(componentTypeInfo);
            }
          });

      listPanel.setCell(i, 1, componentTypeLink);
      listPanel.setCellText(i, 2, "" + componentTypeInfo.getComponentNumber());
    }

    rootPanel.setWidget(0, 0, listPanel);
  }
  /**
   * 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;
   }
 }
예제 #6
0
 @Inject
 public ModuleWindow(ModuleInfo module) {
   this.module = module;
   masked = binder.createAndBindUi(this);
   super.initWidget(masked);
   title.setTargetHistoryToken("SingleRender$" + module.getId());
 }
예제 #7
0
  /** constructor */
  public LoginUiHorizontal() {

    HorizontalPanel hp = new HorizontalPanel();
    hp.add(wLoading);
    hp.add(pUi);

    pWidget.add(hp);

    initWidget(pWidget);

    // observers
    bLogin.addClickListener(this);
    bForgot.addClickListener(this);

    tbConsumerKey.addClickListener(this);
    tbConsumerKey.addChangeListener(this);
    tbConsumerKey.addKeyboardListener(this);
    tbConsumerKey.addFocusListener(this);

    tbConsumerSecret.addClickListener(this);
    tbConsumerSecret.addChangeListener(this);
    tbConsumerSecret.addKeyboardListener(this);
    tbConsumerSecret.addFocusListener(this);

    tbConsumerSecretPass.addClickListener(this);
    tbConsumerSecretPass.addChangeListener(this);
    tbConsumerSecretPass.addKeyboardListener(this);
    tbConsumerSecretPass.addFocusListener(this);

    cbRemberMe.addKeyboardListener(this);
    cbRemberMe.addClickListener(this);

    hAccountLogin.addClickListener(this);
    hForgotPassword.addClickListener(this);

    // style
    pWidget.setStyleName("login-Ui");

    // defaults
    pError.setVisible(false);

    hp.setCellVerticalAlignment(wLoading, VerticalPanel.ALIGN_MIDDLE);

    // debug
    // pWidget.addStyleName("test2");

  }
 /** Handle the post activity action - triggered by CONTROL-ENTER or clicking the Post button. */
 private void handlePostMessage() {
   if (!postButton.getStyleName().contains("inactive")
       && messageText.length() <= MAX_MESSAGE_LENGTH
       && (!messageText.isEmpty() || attachment != null)) {
     hidePostButton();
     postMessage();
     lastFetched = "";
   }
 }
예제 #9
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);
  }
예제 #10
0
  public void onSuccess(PageItemListModel model) {
    if (!GwtClientUtils.preSuccessCheck(model, message)) {
      return;
    }

    pagesPanel.clear();
    for (PageItemModel item : model.itemList) {
      Hyperlink link =
          new Hyperlink(item.title, GwtUtils.getSpacePageToken(item.spaceUname, item.title));
      link.addClickHandler(
          new ClickHandler() {
            public void onClick(ClickEvent event) {
              TagPopup.this.hide();
            }
          });
      pagesPanel.add(link);
    }

    resized();
  }
예제 #11
0
  private void agregarAlgoritmoCategoria(int pos, AlgoritmoCategoria c) {
    HorizontalPanel h = new HorizontalPanel();
    Hyperlink hyper = new Hyperlink();
    hyper.setHTML(c.getNombre());

    h.add(hyper);
    if (c.getEstado() == 1) {
      Image m = new Image("cuidado.jpg");
      m.setPixelSize(15, 15);
      h.add(m);
    } else if (c.getEstado() == 2) {
      Image m = new Image("ok.png");
      m.setPixelSize(15, 15);
      h.add(m);
    } else if (c.getEstado() == 3) {
      Image m = new Image("pregunta.jpg");
      m.setPixelSize(15, 15);
      h.add(m);
    }
    panelesCategorias[pos].add(h);
  }
예제 #12
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);
  }
예제 #13
0
  /** @param node */
  public LoggerDetailTopPanel(final LoggerInfo info, String shortName, final LogTreeNode node) {
    super();
    this.info = info;
    this.shortName = shortName;
    this.node = node;
    this.topTopList = new ListPanel();
    this.topTopList.setWidth("100%");
    this.topTopList.setHeight("100%");
    this.topTopList.setCellText(0, 0, "Short name:");
    Hyperlink l = new Hyperlink(this.shortName, null);
    l.setTitle(this.info.getFullName());

    this.topTopList.setCell(0, 1, l);
    this.topTopList.setCellText(0, 2, "Use parent handlers:");

    final ListBox ups = new ListBox();
    ups.addItem("Yes", _TRUE);
    ups.addItem("No", _FALSE);
    ups.setVisibleItemCount(1);
    ups.setSelectedIndex(info.isUseParentHandlers() ? 0 : 1);
    this.topTopList.setCell(0, 3, ups);

    for (int i = 0; i < LogTreeNode._LEVELS.length; i++) {
      levelB.addItem(LogTreeNode._LEVELS[i], LogTreeNode._LEVELS[i]);
      if (LogTreeNode._LEVELS[i].equals(info.getLevel())) levelB.setSelectedIndex(i);
    }

    this.topTopList.setCellText(2, 0, "Level:");
    this.topTopList.setCell(2, 1, levelB);
    this.topTopList.setCellText(2, 2, "Filter class name:");
    this.filterClassName.setWidth("100%");
    this.filterClassName.setText(info.getFilterClass());
    this.topTopList.setCell(2, 3, this.filterClassName);

    Hyperlink saveDetails = new Hyperlink();
    saveDetails.setText("Loger details (Save)");
    this.setHeader(0, saveDetails);
    this.setCell(0, 0, this.topTopList);

    buildParamList();
    this.setColumnWidth(0, "100%");
    // Change listeners for ListBoxes:
    class UseParentHandlerListener implements ChangeListener {

      /*
       * (non-Javadoc)
       *
       * @see com.google.gwt.user.client.ui.ChangeListener#onChange(com.google .gwt.user.client.ui.Widget)
       */
      public void onChange(Widget sender) {

        final ListBox ss = (ListBox) sender;
        final String value = ss.getValue(ss.getSelectedIndex());
        final boolean sendValue;
        if (value.equals(_TRUE)) sendValue = (true);
        else sendValue = (false);

        class UseParentHandlerCallback implements AsyncCallback {

          /*
           * (non-Javadoc)
           *
           * @see com.google.gwt.user.client.rpc.AsyncCallback#onFailure (java.lang.Throwable)
           */
          public void onFailure(Throwable caught) {

            Logger.error(
                "Could not set \"UseParentHandler\" flag for logger ["
                    + info.getFullName()
                    + "] due to["
                    + caught.getMessage()
                    + "]");
            if (sendValue) {
              ss.setItemSelected(1, true);
            } else {
              ss.setItemSelected(0, true);
            }
          }

          /*
           * (non-Javadoc)
           *
           * @see com.google.gwt.user.client.rpc.AsyncCallback#onSuccess (java.lang.Object)
           */
          public void onSuccess(Object result) {}
        }

        ServerConnection.logServiceAsync.setUseParentHandlers(
            info.getFullName(), sendValue, new UseParentHandlerCallback());
      }
    }

    class LevelChangeListener implements ChangeListener {

      public void onChange(Widget sender) {
        ListBox ss = (ListBox) sender;
        final String logLevel = ss.getValue(ss.getSelectedIndex());

        class LevelChangeCallBack implements AsyncCallback {

          public void onFailure(Throwable caught) {
            Logger.error(
                "Could not set logger level for logger ["
                    + info.getFullName()
                    + "] due to["
                    + caught.getMessage()
                    + "]");
          }

          public void onSuccess(Object result) {
            if (logLevel.equals(LogTreeNode._LEVEL_OFF)) {
              node.turnOff();
            } else {
              node.turnOn();
            }
          }
        }

        ServerConnection.logServiceAsync.setLoggerLevel(
            info.getFullName(), logLevel, new LevelChangeCallBack());
      }
    }

    // add listeners
    ups.addChangeListener(new UseParentHandlerListener());
    levelB.addChangeListener(new LevelChangeListener());
  }
예제 #14
0
  /** 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();
          }
        });
  }
예제 #15
0
    private void doInitHandlerInfo(final LoggerInfo info) {

      // ScrollPanel scroll=new ScrollPanel(handlersBriefInfo);
      // display.add(scroll, DockPanel.CENTER);
      handlersBriefInfo = new ListPanel();
      display.add(handlersBriefInfo, DockPanel.CENTER);
      display.setCellWidth(handlersBriefInfo, "100%");
      // handlersBriefInfo.setHeight("200px");
      // handlersBriefInfo.setWidth("630px");

      handlersBriefInfo.setColumnWidth(0, "25px");
      handlersBriefInfo.setColumnWidth(1, "25px");

      handlersBriefInfo.setColumnWidth(2, "100px");
      handlersBriefInfo.setColumnWidth(3, "80%");

      handlersBriefInfo.setHeader(0, "Index");
      handlersBriefInfo.setHeader(1, "Remove");
      handlersBriefInfo.setHeader(2, "Name");
      handlersBriefInfo.setHeader(3, "Class name");

      if (info.getHandlerInfos() != null)
        for (int i = 0; i < info.getHandlerInfos().length; i++) {

          final int ii = i;
          // FIXME: Add details
          Hyperlink details = new Hyperlink();
          details.setHTML("#" + i);

          Hyperlink remove = new Hyperlink();
          remove.setHTML("Remove");
          ClickListener removeClick =
              new ClickListener() {

                public void onClick(Widget sender) {

                  AsyncCallback removeCallback =
                      new AsyncCallback() {

                        public void onFailure(Throwable caught) {
                          Logger.error(
                              "Failed to remove handler from logger["
                                  + fullName
                                  + "] at index["
                                  + ii
                                  + "] due to:\n"
                                  + caught);
                        }

                        public void onSuccess(Object result) {
                          onHide();
                          onShow();
                        }
                      };

                  ServerConnection.logServiceAsync.removeHandlerAtIndex(
                      info.getFullName(), ii, removeCallback);
                }
              };

          remove.addClickListener(removeClick);

          handlersBriefInfo.setCell(i, 0, details);
          handlersBriefInfo.setCell(i, 1, remove);
          handlersBriefInfo.setCellText(i, 2, info.getHandlerInfos()[i].getName());
          handlersBriefInfo.setCellText(i, 3, info.getHandlerInfos()[i].getHandelerClassName());
        }
    }
  /** Wires up events. */
  private void setupEvents() {
    // user clicked in message text box
    message.addFocusHandler(
        new FocusHandler() {
          public void onFocus(final FocusEvent inEvent) {
            if ((" " + getStyleName() + " ")
                .contains(StaticResourceBundle.INSTANCE.coreCss().small())) {
              removeStyleName(StaticResourceBundle.INSTANCE.coreCss().small());
              onExpand();
            }
          }
        });

    message.addValueChangedHandler(
        new ValueChangeHandler<String>() {
          public void onValueChange(final ValueChangeEvent<String> newValue) {
            checkMessageTextChanged();
          }
        });

    // user typed in message text box
    message.addKeystrokeHandler(
        new KeyUpHandler() {
          public void onKeyUp(final KeyUpEvent ev) {
            if (ev.getNativeKeyCode() == KeyCodes.KEY_ENTER
                && ev.isControlKeyDown()
                && message.getText().length() > 0) {
              checkMessageTextChanged();
              handlePostMessage();
            } else {
              checkMessageTextChanged();
            }
          }
        });

    // user clicked on post button
    postButton.addClickHandler(
        new ClickHandler() {
          public void onClick(final ClickEvent ev) {
            checkMessageTextChanged();
            handlePostMessage();
          }
        });

    final EventBus eventBus = Session.getInstance().getEventBus();
    eventBus.addObserver(
        MessageStreamAppendEvent.class,
        new Observer<MessageStreamAppendEvent>() {
          public void update(final MessageStreamAppendEvent event) {
            errorMsg.setVisible(false);
            addStyleName(StaticResourceBundle.INSTANCE.coreCss().small());
            messageText = "";
            message.setText(postBoxDefaultText);
            onRemainingCharactersChanged();
            links.close();
          }
        });

    eventBus.addObserver(
        GotSystemSettingsResponseEvent.class,
        new Observer<GotSystemSettingsResponseEvent>() {
          public void update(final GotSystemSettingsResponseEvent event) {
            String warning = event.getResponse().getContentWarningText();
            if (warning != null && !warning.isEmpty()) {
              contentWarning.getElement().setInnerHTML(warning);
            } else {
              contentWarning.setVisible(false);
            }
            message.setVisible(true);
          }
        });

    eventBus.addObserver(
        MessageTextAreaChangedEvent.getEvent(),
        new Observer<MessageTextAreaChangedEvent>() {
          public void update(final MessageTextAreaChangedEvent arg1) {
            // the value changed - make sure we're not stuck in the disabled, non-editable mode
            if ((" " + getStyleName() + " ")
                .contains(StaticResourceBundle.INSTANCE.coreCss().small())) {
              removeStyleName(StaticResourceBundle.INSTANCE.coreCss().small());
            }
            onRemainingCharactersChanged();
          }
        });

    eventBus.addObserver(
        MessageAttachmentChangedEvent.class,
        new Observer<MessageAttachmentChangedEvent>() {
          public void update(final MessageAttachmentChangedEvent evt) {
            errorMsg.setVisible(false);
            attachment = evt.getAttachment();
            if (attachment == null && messageText.isEmpty()) {
              hidePostButton();
            } else {
              showPostButton();
            }
          }
        });

    eventBus.addObserver(
        new ErrorPostingMessageToNullScopeEvent(),
        new Observer<ErrorPostingMessageToNullScopeEvent>() {
          public void update(final ErrorPostingMessageToNullScopeEvent event) {
            errorMsg.setText(event.getErrorMsg());
            errorMsg.setVisible(true);
            showPostButton();
          }
        });
  }
 /** Hides the post button. */
 private void hidePostButton() {
   postButton.addStyleName(StaticResourceBundle.INSTANCE.coreCss().inactive());
 }
예제 #18
0
  private void addNavigationLinks(State currentState) {
    // If the user is not authenticated we're not going to bother setting up the link bar
    // they shouldn't have access to any of the stuff anyway.
    String role = "";
    if (!currentState.isAuthenticated()) {
      return;
    }

    if (!currentState.getUserProjectRole().equals(ProjectRole.None)) {
      role = " (" + currentState.getUserProjectRole().getLabel() + ")";
    }

    Label userName = new Label(currentState.getUserName() + role);

    this.linksPanel.add(userName);

    this.linksPanel.add(new Label(messages.delimiter()));

    // Only the admin and aoe can mange the site settings.
    if (currentState.isSiteAdministrator()
        || currentState.getUserProjectRole() == ProjectRole.Acquisition_Organization_Engineer) {
      currentState.setMode(GwtModesType.ReadWrite);
    }
    {
      Hyperlink adminLink =
          new Hyperlink(
              messages.adminLinkText(),
              ManageSitePilot.generateNavigationId(ManageSitePilot.PageId.home));
      this.linksPanel.add(adminLink);
      this.linksPanel.add(new Label(messages.delimiter()));
    }

    // user preferences page
    Hyperlink preference =
        new Hyperlink(
            messages.linkTitle2(),
            ChooseCasePilot.generateNavigationId(ChooseCasePilot.PageId.preferences));
    this.linksPanel.add(preference);
    this.linksPanel.add(new Label(messages.delimiter()));

    // help page
    //		Hyperlink help = new Hyperlink(messages.linkTitle3(),
    // HomePilot.generateNavigationId(HomePilot.PageId.help));
    HTML helpLink = new HTML("<a href='" + properties.getHelpLink() + "'>help</a>");
    this.linksPanel.add(helpLink);
    this.linksPanel.add(new Label(messages.delimiter()));

    // sign out
    Hyperlink signOut =
        new Hyperlink(
            "sign out", ChooseCasePilot.generateNavigationId(ChooseCasePilot.PageId.logout));
    this.linksPanel.add(signOut);
    signOut.addClickHandler(
        new ClickHandler() {

          @Override
          public void onClick(ClickEvent event) {
            logInService.logOut(
                new AsyncCallback<Void>() {

                  @Override
                  public void onFailure(Throwable caught) {
                    // TODO Auto-generated method stub

                  }

                  @Override
                  public void onSuccess(Void result) {
                    // TODO Auto-generated method stub

                  }
                });
          }
        });

    this.linksPanel.setSpacing(3);
    this.linksPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
    this.linksPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP);
  }
예제 #19
0
  @Override
  public void onModuleLoad() {
    box = new AutoProgressMessageBox("Por favor espere", "Carregando sistema...");
    box.setProgressText("Iniciando...");
    box.auto();
    box.show();

    Timer t =
        new Timer() {

          // float i;
          @Override
          public void run() {
            // box.updateProgress(i / 100, "{0}% Completo");
            // i += 10;
            // ageitar contadores
            servico.iniciaSistema(
                new AsyncCallback<String>() {

                  @Override
                  public void onFailure(Throwable caught) {
                    AlertMessageBox d =
                        new AlertMessageBox(
                            "Desculpe", "Erro ao carregar sistema." + caught.getMessage());
                    // d.addHideHandler(hideHandler);
                    d.show();
                    // cancel();

                  }

                  @Override
                  public void onSuccess(String result) {
                    // AlertMessageBox d = new AlertMessageBox("Alerta", "OK");
                    // d.addHideHandler(hideHandler);
                    // d.show();
                  }
                });
            // if (i > 100) {
            //  cancel();

            // }
            box.hide();
            cancel();
          }
        };
    t.scheduleRepeating(3000);

    // painel principal
    rootPanel = RootPanel.get();

    Image image_5 = new Image("imagens/imagemPojeto.png");
    rootPanel.add(image_5, 0, 0);
    image_5.setSize("100%", "570px");

    final Label lblLogin = new Label("Login:"******"Senha:");
    rootPanel.add(lblSenha, 627, 285);

    // botao criar conta
    final TextButton txtbtnCriarContaAgora = new TextButton("Criar Conta Agora");
    txtbtnCriarContaAgora.addClickHandler(
        new ClickHandler() {

          @Override
          public void onClick(ClickEvent event) {
            CriarConta conta = new CriarConta();
            conta.load();
          }
        });
    rootPanel.add(txtbtnCriarContaAgora, 329, 360);

    Hyperlink htmlEsqueceuASenha = new Hyperlink("Esqueceu a senha?", true, "");
    // htmlEsqueceuASenha.setStyleName("serverResponseLabelError");
    htmlEsqueceuASenha.addClickHandler(
        new ClickHandler() {

          @Override
          public void onClick(ClickEvent event) {
            SenhaEsquecida senhaEsquecida = new SenhaEsquecida();
            senhaEsquecida.carregar();
          }
        });

    final TextBox textBox = new TextBox();
    // rootPanel.add(textBox, 676, 200);

    final PasswordTextBox passwordTextBox = new PasswordTextBox();

    passwordTextBox.setSize("161px", "16px");

    // botao logar
    final TextButton txtbtnLogar = new TextButton("Logar");
    txtbtnLogar.addClickHandler(
        new ClickHandler() {

          @Override
          public void onClick(ClickEvent event) {
            servico.getSenhaUsuarioLogin(
                textBox.getText(),
                new AsyncCallback<String>() {

                  @Override
                  public void onFailure(Throwable caught) {
                    AlertMessageBox d = new AlertMessageBox("Alerta", caught.getMessage());
                    d.show();
                  }

                  @Override
                  public void onSuccess(String result) {
                    if (passwordTextBox.getText().equals(result)) {
                      Logado log = new Logado(textBox.getText().trim(), result);
                      rootPanel.add(log.asWidget());
                    } else {
                      AlertMessageBox d = new AlertMessageBox("Alerta", "Senha incorreta.");
                      d.show();
                    }
                  }
                });
          }
        });
    rootPanel.add(txtbtnLogar, 676, 315);
    rootPanel.add(textBox, 676, 250);
    rootPanel.add(passwordTextBox, 678, 285);
    rootPanel.add(htmlEsqueceuASenha, 676, 342);
  }
  /**
   * 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);
  }
예제 #21
0
  private void buildParamList() {
    paramsList = new ListPanel();
    // Now part with constructor params
    Hyperlink addParam = new Hyperlink("Add", null);
    Hyperlink removeParam = new Hyperlink("Remove", null);

    addParam.addClickListener(
        new ClickListener() {

          public void onClick(Widget arg0) {
            TextBox paramType = new TextBox();
            TextBox value = new TextBox();
            // paramsList.setCell(paramTypes.size(), 1, paramType);
            paramTypes.add(paramType);
            // paramsList.setCell(paramBoxes.size(), 2, value);
            paramBoxes.add(value);
            buildParamList();
          }
        });

    removeParam.addClickListener(
        new ClickListener() {

          public void onClick(Widget arg0) {
            if (paramTypes.size() > 0) {

              paramBoxes.remove(paramBoxes.size() - 1);
              paramTypes.remove(paramTypes.size() - 1);
              buildParamList();
            }
          }
        });

    // Small trick
    FlexTable ft = new FlexTable();
    ft.setWidget(0, 0, addParam);
    ft.setText(0, 1, "/");
    ft.setWidget(0, 2, removeParam);

    paramsList.setHeader(0, ft);
    paramsList.setHeader(1, "Type");
    paramsList.setHeader(2, "Value");
    paramsList.setColumnWidth(0, "8%");
    paramsList.setColumnWidth(1, "46%");
    paramsList.setColumnWidth(2, "46%");
    paramsList.setWidth("100%");
    paramsList.setHeight("100%");
    // Rebuild boxes
    for (int i = 0; i < paramTypes.size(); i++) {
      paramsList.setCell(i, 1, (Widget) paramTypes.get(i));
      paramsList.setCell(i, 2, (Widget) paramBoxes.get(i));
      paramsList.setCellText(i, 0, "#" + (i + 1));
    }

    ListPanel pp = new ListPanel();
    pp.setHeader(0, "Filter Class Consturctor Parameters");
    pp.setCell(0, 0, paramsList);
    pp.setWidth("100%");
    pp.setHeight("100%");
    this.setCell(1, 0, pp);
  }
예제 #22
0
 /**
  * Returns the Members count as hyperlink to VO-Members
  *
  * @return hyperlink
  */
 public Hyperlink getMembersCountHyperlink() {
   hyp.setTargetHistoryToken(session.getTabManager().getLinkForTab(new VoMembersTabItem(voId)));
   return this.hyp;
 }
예제 #23
0
 private Widget buildUserPreferences() {
   Hyperlink theUserPreferencesLink =
       new Hyperlink(constants.userSettings(), ViewToken.Preferences.name());
   theUserPreferencesLink.setStylePrimaryName("identif-2");
   return theUserPreferencesLink;
 }
 /** Displays the post button. */
 private void showPostButton() {
   postButton.removeStyleName(StaticResourceBundle.INSTANCE.coreCss().inactive());
 }