Exemple #1
0
 /*
  * (non-Javadoc)
  *
  * @see
  * cc.kune.core.client.cookies.CookiesManager#setAuthCookie(java.lang.String)
  */
 @Override
 public void setAuthCookie(final String userHash) {
   // http://code.google.com/p/google-web-toolkit-incubator/wiki/LoginSecurityFAQ
   final Date expires = new Date(System.currentTimeMillis() + SessionConstants.SESSION_DURATION);
   Cookies.setCookie(
       SessionConstants.USERHASH,
       userHash,
       expires,
       CookieUtils.getDomain(),
       "/",
       WindowUtils.isHttps());
   Cookies.setCookie(
       SessionConstants.JSESSIONID,
       userHash,
       expires,
       CookieUtils.getDomain(),
       "/",
       WindowUtils.isHttps());
   Log.info("Received hash: " + userHash, null);
 }
Exemple #2
0
  /**
   * Instantiates a new basic thumb.
   *
   * @param imageRef This can be a ImageResource or a String Url
   * @param imgSize the img size
   * @param text the text
   * @param textMaxLenght the text max lenght
   * @param crop the crop
   * @param clickHandler the click handler
   */
  public BasicThumb(
      final Object imageRef,
      final int imgSize,
      final String text,
      final int textMaxLenght,
      final boolean crop,
      final ClickHandler clickHandler) {
    super();
    onOverLabel = false;
    panel = new VerticalPanel();
    if (imageRef instanceof String) {
      final String imageUrl = (String) imageRef;
      if (imgSize == NOSIZE) {
        image = new Image(imageUrl);
      } else {
        if (crop) {
          image = new Image(imageUrl, 0, 0, imgSize, imgSize);
        } else {
          image = new Image(imageUrl);
          image.setPixelSize(imgSize, imgSize);
        }
      }
    } else if (imageRef instanceof ImageResource) {
      image = new Image((ImageResource) imageRef);
      image.setPixelSize(imgSize, imgSize);
    } else {
      // This should not happen
      image = new Image();
      image.setPixelSize(imgSize, imgSize);
      Log.info("Unrecognized icon of BasicThumb: " + imageRef);
    }
    final String title = textMaxLenght == NOSIZE ? text : TextUtils.ellipsis(text, textMaxLenght);
    label = new Label(title);
    panel.add(image);
    panel.add(label);
    panel.addStyleName("k-basic-thumb");
    panel.addStyleName("kune-Margin-Mini-trbl");
    panel.addStyleName("k-pointer");
    panel.addStyleName("k-floatleft");
    panel.setCellHorizontalAlignment(label, VerticalPanel.ALIGN_CENTER);
    if (clickHandler != null) {
      addClickHandlerImpl(clickHandler);
    }
    image.addMouseOverHandler(
        new MouseOverHandler() {

          @Override
          public void onMouseOver(final MouseOverEvent event) {
            if (onOverLabel) {
              label.setVisible(true);
            }
          }
        });
    image.addMouseOutHandler(
        new MouseOutHandler() {

          @Override
          public void onMouseOut(final MouseOutEvent event) {
            if (onOverLabel) {
              label.setVisible(false);
            }
          }
        });
    setElement(panel.getElement());
  }