Beispiel #1
0
  @Override
  public void displayUsers(Map<Integer, String> users) {
    usersList.clear();

    for (Integer userId : users.keySet()) {
      HTMLPanel panel = new HTMLPanel("");

      Anchor linkToEdit = new Anchor();

      linkToEdit.setText(users.get(userId));

      PlaceRequest placeToGo =
          new PlaceRequest.Builder()
              .nameToken(NameTokens.USER)
              .with(NameTokens.PARAM_ID, String.valueOf(userId))
              .build();
      linkToEdit.setHref("#" + tokenFormatter.toPlaceToken(placeToGo));

      Button deleteButton = new Button();
      deleteButton.setText("X");
      deleteButton.addClickHandler(clickEvent -> getUiHandlers().deleteUser(userId));

      panel.add(linkToEdit);
      panel.add(deleteButton);

      usersList.add(panel);
    }
  }
 public void updateSummary() {
   resource.setHref(c.getResourceUrl());
   lblQuery.setText(c.getQueryString());
   if (c.getImageUrl() != null) {
     imgResource.setUrl(c.getImageUrl());
   }
 }
Beispiel #3
0
 private void loadLogin() {
   // Assemble login panel.
   signInLink.setHref(loginInfo.getLoginUrl());
   loginPanel.add(loginLabel);
   loginPanel.add(signInLink);
   RootPanel.get("tasksList").add(loginPanel);
 }
 public void setResourcePlayLink() {
   Anchor resourceAnchor = new Anchor();
   resourceAnchor.setHref(getResourceLink());
   resourceAnchor.setStyleName("");
   resourceAnchor.getElement().appendChild(resourceImageContainer.getElement());
   resourceThumbContainer.insert(resourceAnchor, 0);
 }
Beispiel #5
0
 private void loadLogout() {
   // Assemble logout panel.
   Anchor logoutLink = new Anchor("Sign Out");
   logoutLink.setHref(loginInfo.getLogoutUrl());
   loginInfoPanel.add(new Label(loginInfo.getEmailAddress()));
   loginInfoPanel.add(logoutLink);
   RootPanel.get("authInfo").add(loginInfoPanel);
 }
Beispiel #6
0
 private void loadLogin() {
   // Assemble login panel.
   Anchor loginLink = new Anchor("Sign In");
   loginLink.setHref(loginInfo.getLoginUrl());
   loginInfoPanel.add(new Label("Please sign in to your Google Account."));
   loginInfoPanel.add(loginLink);
   RootPanel.get("authInfo").add(loginInfoPanel);
 }
 /** Init the actions button */
 private void init() {
   // Delete button
   delete = new Anchor();
   delete.setHref("#");
   delete.addStyleName("delete_icon");
   delete.setTitle("Supprimer");
   this.add(delete);
 }
Beispiel #8
0
 @Override
 public void onFailure(final Throwable error) {
   if (error instanceof HTTPException) {
     final HTTPException exception = (HTTPException) error;
     if (exception.getCode() == 401) {
       anchor.setText("Login");
       anchor.setHref(exception.getMessage());
       login = exception.getMessage();
     }
   }
 }
Beispiel #9
0
  /** @see org.overlord.apiman.dt.ui.client.local.pages.AbstractPlanPage#renderPage() */
  @Override
  protected void renderPage() {
    super.renderPage();
    description.setText(planBean.getDescription());
    createdOn.setText(Formatting.formatShortDate(planBean.getCreatedOn()));
    createdBy.setText(planBean.getCreatedBy());
    String toUserHref =
        navHelper.createHrefToPage(
            UserServicesPage.class,
            MultimapUtil.fromMultiple("user", planBean.getCreatedBy())); // $NON-NLS-1$
    createdBy.setHref(toUserHref);

    version.setText(versionBean.getVersion());
    versionCreatedOn.setText(Formatting.formatShortDate(versionBean.getCreatedOn()));
    versionCreatedBy.setText(versionBean.getCreatedBy());
    toUserHref =
        navHelper.createHrefToPage(
            UserServicesPage.class,
            MultimapUtil.fromMultiple("user", versionBean.getCreatedBy())); // $NON-NLS-1$
    versionCreatedBy.setHref(toUserHref);
  }
 @Override
 public void addProperty(EntryDto dto) {
   if (dto.getValue().toLowerCase().startsWith("http")) {
     Anchor a = new Anchor();
     a.setTarget("_blank");
     a.setHref(dto.getValue());
     a.setText(dto.getValue());
     properties.addProperty(new Label(dto.getKey()), a.asWidget());
   } else {
     properties.addProperty(dto.getKey(), dto.getValue());
   }
 }
Beispiel #11
0
  @UiConstructor
  public ImageAnchor(String imageUrl) {

    image = new Image(imageUrl);
    image.getElement().getStyle().setBorderStyle(BorderStyle.NONE);
    image.getElement().getStyle().setVerticalAlign(VerticalAlign.MIDDLE);

    subtitle = new Label();
    subtitle.setVisible(false);

    anchor = new Anchor();
    initWidget(anchor);
    anchor.setHref("javascript:;");
    anchor.getElement().appendChild(image.getElement());
    anchor.getElement().appendChild(subtitle.getElement());
    // Removes the dotted outline
    anchor.getElement().getStyle().setProperty("outline", "0");
  }
 public void showSuccessMessageWidget(String collectionId) {
   getAddingLabel().setVisible(false);
   getAddToShelfCollectionButton().setVisible(true);
   if (getAddToShelfCollectionButton().getText().equalsIgnoreCase("Add")) {
     getAddToShelfCollectionButton().setText(i18n.GL0691());
     successMessageLabelText.setText(i18n.GL0547());
     successMessageLabelText.getElement().setAttribute("alt", i18n.GL0547());
     successMessageLabelText.getElement().setAttribute("title", i18n.GL0547());
   } else {
     successMessageLabelText.setText(i18n.GL0692());
     successMessageLabelText.getElement().setAttribute("alt", i18n.GL0692());
     successMessageLabelText.getElement().setAttribute("title", i18n.GL0692());
   }
   addCollectionInsteadLabelContainer.clear();
   addResourceInsteadLabel.setText(i18n.GL0685());
   addCollectionInsteadLabelContainer.add(addResourceInsteadLabel);
   addResourceInsteadLabel.getElement().getStyle().setMarginRight(60, Unit.PX);
   // addResourceInsteadLabel.getElement().getStyle().setMarginTop(-15,Unit.PX);
   collectionAddImageContainer.setVisible(false);
   collectionAddedSuccessMessageContainer.setVisible(true);
   workSpaceLink.setHref("#organize&id=" + collectionId + "&eventType=refresh");
 }
Beispiel #13
0
  private void loadStockWatcher() {
    // Set up sign out hyperlink.
    signOutLink.setHref(loginInfo.getLogoutUrl());

    // Create table for tasks.
    tasksFlexTable.setText(0, 0, "Tâche");
    tasksFlexTable.setText(0, 1, "DeadLine");
    tasksFlexTable.setText(0, 2, "Priorité");
    tasksFlexTable.setText(0, 3, "Remove");

    // Add styles to elements in the stock list table.
    tasksFlexTable.getRowFormatter().addStyleName(0, "watchListHeader");
    tasksFlexTable.addStyleName("watchList");
    tasksFlexTable.getCellFormatter().addStyleName(0, 1, "watchListNumericColumn");
    tasksFlexTable.getCellFormatter().addStyleName(0, 2, "watchListNumericColumn");
    tasksFlexTable.getCellFormatter().addStyleName(0, 3, "watchListRemoveColumn");

    loadStocks();

    // Assemble Add Task panel.
    addPanel.add(newTaskTextBox);
    addPanel.add(addTaskButton);
    addPanel.addStyleName("addPanel");

    // Assemble Main panel.
    errorMsgLabel.setStyleName("errorMessage");
    errorMsgLabel.setVisible(false);

    mainPanel.add(errorMsgLabel);
    mainPanel.add(signOutLink);
    mainPanel.add(tasksFlexTable);
    mainPanel.add(addPanel);
    mainPanel.add(lastUpdatedLabel);

    // Associate the Main panel with the HTML host page.
    RootPanel.get("tasksList").add(mainPanel);

    // Move cursor focus to the input box.
    newTaskTextBox.setFocus(true);

    // Setup timer to refresh list automatically.
    Timer refreshTimer =
        new Timer() {
          @Override
          public void run() {
            refreshWatchList();
          }
        };
    refreshTimer.scheduleRepeating(REFRESH_INTERVAL);

    // Listen for mouse events on the Add button.
    addTaskButton.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            addTask();
          }
        });

    // Listen for keyboard events in the input box.
    newTaskTextBox.addKeyPressHandler(
        new KeyPressHandler() {
          public void onKeyPress(KeyPressEvent event) {
            if (event.getCharCode() == KeyCodes.KEY_ENTER) {
              addTask();
            }
          }
        });
  }
 @Override
 public void setTargetHistoryToken(String historyToken) {
   hyperlink.setHref("#" + historyToken); // $NON-NLS-1$
 }
Beispiel #15
0
  /**
   * Build the widget
   *
   * @param user the logged in user
   * @return the {@link Widget}
   */
  protected Widget buildUserIdentityCard() {

    final FlowPanel theIDWidget = new FlowPanel();
    theIDWidget.setStylePrimaryName("bonita_identification");

    final FlowPanel theLeftAlignedBox = new FlowPanel();
    theLeftAlignedBox.setStylePrimaryName("bonita_identified-left");

    theIDWidget.add(theLeftAlignedBox);

    final Image theAvatar = new Image("images/avatar-default.gif");
    theAvatar.setStyleName("bonita_avatar");

    theLeftAlignedBox.add(theAvatar);

    final FlowPanel theRightAlignedBox = new FlowPanel();
    theRightAlignedBox.setStylePrimaryName("bonita_identified-right");

    theLeftAlignedBox.add(theRightAlignedBox);

    HTML theUserIdentity = null;
    if (user.isAnonymous()) {
      theUserIdentity = new HTML(FormsResourceBundle.getMessages().anonymousLabel());
    } else {
      theUserIdentity = new HTML(user.getUsername());
    }
    theUserIdentity.setStylePrimaryName("bonita_identif-1");

    theRightAlignedBox.add(theUserIdentity);

    Anchor theLogoutLink = null;
    if (user.isAnonymous()) {
      theLogoutLink = new Anchor(FormsResourceBundle.getMessages().loginButtonLabel());
    } else {
      theLogoutLink = new Anchor(FormsResourceBundle.getMessages().logoutButtonLabel());
    }
    theLogoutLink.setStylePrimaryName("bonita_identif-2");

    final URLUtils urlUtils = URLUtilsFactory.getInstance();
    final List<String> paramsToRemove = new ArrayList<String>();
    paramsToRemove.add(URLUtils.LOCALE_PARAM);
    final List<String> hashParamsToRemove = new ArrayList<String>();
    if (user.isAutoLogin()) {
      hashParamsToRemove.add(URLUtils.AUTO_LOGIN_PARAM);
    } else {
      hashParamsToRemove.add(URLUtils.USER_CREDENTIALS_PARAM);
    }
    if (!user.isAnonymous()) {
      for (final Entry<String, Object> hashParamEntry : context.entrySet()) {
        hashParamsToRemove.add(hashParamEntry.getKey());
      }
    }
    Map<String, String> hashParamsToAdd = new HashMap<String, String>();
    hashParamsToAdd.put(URLUtils.TODOLIST_PARAM, "true");
    hashParamsToAdd.put(URLUtils.VIEW_MODE_PARAM, "app");
    final String theRedirectURL =
        urlUtils.rebuildUrl(paramsToRemove, null, hashParamsToRemove, hashParamsToAdd);
    String theURL = "?" + URLUtils.REDIRECT_URL_PARAM + "=";
    try {
      theURL += URL.encodeQueryString(theRedirectURL);
    } catch (final Exception e) {
      Window.alert("Unable to redirect to login page: Invalid URL");
      theURL += GWT.getModuleBaseURL();
    }
    theLogoutLink.setHref(theURL);

    theRightAlignedBox.add(theLogoutLink);

    return theIDWidget;
  }
  public void setView(UserFollowDo userFollowDo) {
    profileThumbnailImage.setUrl(userFollowDo.getProfileImageUrl());
    profileThumbnailImage.addErrorHandler(
        new ErrorHandler() {

          @Override
          public void onError(ErrorEvent event) {
            profileThumbnailImage.setUrl("images/settings/setting-user-image.png");
          }
        });

    // userNameLabel.setText(userFollowDo.getUsername());
    userNameLabel.getElement().setId(userFollowDo.getGooruUid());

    int collectionCount = userFollowDo.getSummary().getCollection();
    userCollections.setText(
        collectionCount + (collectionCount == 1 ? " Collection" : " Collections"));
    userCollections
        .getElement()
        .setAttribute(
            "alt", collectionCount + (collectionCount == 1 ? " Collection" : " Collections"));
    userCollections
        .getElement()
        .setAttribute(
            "title", collectionCount + (collectionCount == 1 ? " Collection" : " Collections"));

    userFollowDetails.setText(
        userFollowDo.getSummary().getFollowers()
            + (userFollowDo.getSummary().getFollowers() == 1 ? " Follower" : " Followers")
            + " | "
            + userFollowDo.getSummary().getFollowing()
            + " Following");
    userFollowDetails
        .getElement()
        .setAttribute(
            "alt",
            userFollowDo.getSummary().getFollowers()
                + (userFollowDo.getSummary().getFollowers() == 1 ? " Follower" : " Followers")
                + " | "
                + userFollowDo.getSummary().getFollowing()
                + " Following");
    userFollowDetails
        .getElement()
        .setAttribute(
            "title",
            userFollowDo.getSummary().getFollowers()
                + (userFollowDo.getSummary().getFollowers() == 1 ? " Follower" : " Followers")
                + " | "
                + userFollowDo.getSummary().getFollowing()
                + " Following");

    String gooruUid = userNameLabel.getElement().getId();
    Anchor anchor = new Anchor();
    String userName = userFollowDo.getUsername();

    String token = "#" + PlaceTokens.PROFILE_PAGE + "&id=" + gooruUid + "&user="******"style", "font-size: 18px !important");
    anchor.setTarget("_blank");
    userNameLabel.setText("");
    userNameLabel.getElement().setAttribute("alt", "");
    userNameLabel.getElement().setAttribute("title", "");
    //		boolean isEnabled =  userFollowDo.getCustomFields() != null &&
    // userFollowDo.getCustomFields().get(0).getOptionalValue() != null &&
    // userFollowDo.getCustomFields().get(0).getOptionalValue().equalsIgnoreCase("true") ? true :
    // false;
    boolean isEnabled = false;
    if (userFollowDo.getCustomFields() != null) {
      for (int i = 0; i < userFollowDo.getCustomFields().size(); i++)
        if (userFollowDo
            .getCustomFields()
            .get(i)
            .getOptionalKey()
            .equalsIgnoreCase("show_profile_page")) {
          isEnabled =
              userFollowDo.getCustomFields().get(i).getOptionalValue().equalsIgnoreCase("true")
                  ? true
                  : false;
        }
    }
    if (isEnabled) {
      userNameLabel.getElement().appendChild(anchor.getElement());
    } else {
      userNameLabel.setText(userFollowDo.getUsername());
      userNameLabel.getElement().setAttribute("alt", userFollowDo.getUsername());
      userNameLabel.getElement().setAttribute("title", userFollowDo.getUsername());
      userNameLabel.getElement().getStyle().setCursor(Cursor.DEFAULT);
    }
  }
Beispiel #17
0
 public Header(String userName, String userIdS, String logoutUrl) {
   initWidget(binder.createAndBindUi(this));
   userNickname.setText(userName);
   userId.setDefaultValue(userIdS);
   signOutLink.setHref(logoutUrl);
 }
 /** {@inheritDoc} */
 @Override
 public void setPrefixHref(String href) {
   prefixHeader.setHref(href);
   mainlink.setText(href);
   mainlink.setHref(href);
 }
  public com.google.gwt.user.client.ui.Widget createAndBindUi(
      final org.restlet.example.book.restlet.ch09.client.TopPanel owner) {

    org.restlet.example.book.restlet.ch09.client.TopPanel_BinderImpl_GenBundle
        clientBundleFieldNameUnlikelyToCollideWithUserSpecifiedFieldOkay =
            (org.restlet.example.book.restlet.ch09.client.TopPanel_BinderImpl_GenBundle)
                GWT.create(
                    org.restlet.example.book.restlet.ch09.client.TopPanel_BinderImpl_GenBundle
                        .class);
    com.google.gwt.resources.client.ImageResource logo =
        clientBundleFieldNameUnlikelyToCollideWithUserSpecifiedFieldOkay.logo();
    com.google.gwt.resources.client.DataResource logoIe6Data =
        clientBundleFieldNameUnlikelyToCollideWithUserSpecifiedFieldOkay.logoIe6Data();
    org.restlet.example.book.restlet.ch09.client.TopPanel_BinderImpl_GenCss_style style =
        clientBundleFieldNameUnlikelyToCollideWithUserSpecifiedFieldOkay.style();
    java.lang.String domId0 = com.google.gwt.dom.client.Document.get().createUniqueId();
    com.google.gwt.user.client.ui.Anchor signOutLink =
        (com.google.gwt.user.client.ui.Anchor)
            GWT.create(com.google.gwt.user.client.ui.Anchor.class);
    java.lang.String domId1 = com.google.gwt.dom.client.Document.get().createUniqueId();
    com.google.gwt.user.client.ui.Anchor aboutLink =
        (com.google.gwt.user.client.ui.Anchor)
            GWT.create(com.google.gwt.user.client.ui.Anchor.class);
    com.google.gwt.user.client.ui.HTMLPanel f_HTMLPanel1 =
        new com.google.gwt.user.client.ui.HTMLPanel(
            template
                .html3(
                    "" + style.logo() + "",
                    "" + style.statusDiv() + "",
                    "" + style.linksDiv() + "",
                    domId0,
                    domId1)
                .asString());

    signOutLink.setHTML(template.html1().asString());
    signOutLink.setHref("javascript:;");
    aboutLink.setHTML(template.html2().asString());
    aboutLink.setHref("javascript:;");

    UiBinderUtil.TempAttachment attachRecord0 = UiBinderUtil.attachToDom(f_HTMLPanel1.getElement());
    com.google.gwt.user.client.Element domId0Element =
        com.google.gwt.dom.client.Document.get().getElementById(domId0).cast();
    com.google.gwt.user.client.Element domId1Element =
        com.google.gwt.dom.client.Document.get().getElementById(domId1).cast();
    attachRecord0.detach();
    f_HTMLPanel1.addAndReplaceElement(signOutLink, domId0Element);
    f_HTMLPanel1.addAndReplaceElement(aboutLink, domId1Element);

    final com.google.gwt.event.dom.client.ClickHandler
        handlerMethodWithNameVeryUnlikelyToCollideWithUserFieldNames1 =
            new com.google.gwt.event.dom.client.ClickHandler() {
              public void onClick(com.google.gwt.event.dom.client.ClickEvent event) {
                owner.onAboutClicked(event);
              }
            };
    aboutLink.addClickHandler(handlerMethodWithNameVeryUnlikelyToCollideWithUserFieldNames1);

    final com.google.gwt.event.dom.client.ClickHandler
        handlerMethodWithNameVeryUnlikelyToCollideWithUserFieldNames2 =
            new com.google.gwt.event.dom.client.ClickHandler() {
              public void onClick(com.google.gwt.event.dom.client.ClickEvent event) {
                owner.onSignOutClicked(event);
              }
            };
    signOutLink.addClickHandler(handlerMethodWithNameVeryUnlikelyToCollideWithUserFieldNames2);

    owner.aboutLink = aboutLink;
    owner.signOutLink = signOutLink;
    clientBundleFieldNameUnlikelyToCollideWithUserSpecifiedFieldOkay.style().ensureInjected();

    return f_HTMLPanel1;
  }