@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);
  }
Example #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);
  }
Example #3
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();
  }
  /** 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();
          }
        });
  }
Example #5
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);
  }
  /** 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();
          }
        });
  }
Example #7
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);
  }