Ejemplo n.º 1
0
 /**
  * Instantiates a new prompt top dialog.
  *
  * @param builder the builder
  */
 protected PromptTopDialog(final Builder builder) {
   super(builder);
   promptLabel = new Label();
   promptLabel.addStyleName("kune-Margin-Medium-b");
   if (builder.promptLines > 1) {
     textField = new TextArea();
     textField.setHeight(20 * builder.promptLines);
   } else {
     textField = new TextField<String>();
   }
   if (TextUtils.notEmpty(builder.textFieldStyle)) {
     textField.addStyleName(builder.textFieldStyle);
   }
   textField.setRegex(builder.regex);
   textField.getMessages().setRegexText(builder.regexText);
   textField.getMessages().setMinLengthText(builder.minLengthText);
   textField.getMessages().setMaxLengthText(builder.maxLengthText);
   textField.setTabIndex(1);
   textField.setId(builder.textboxId);
   if (TextUtils.notEmpty(builder.emptyText)) {
     textField.setEmptyText(builder.emptyText);
   }
   if (builder.textFieldWidth != 0) {
     textField.setWidth(builder.textFieldWidth);
   }
   if (builder.minLength != 0) {
     textField.setMinLength(builder.minLength);
   }
   if (builder.maxLength != 0) {
     textField.setMaxLength(builder.maxLength);
   }
   if (builder.promptWidth != 0) {
     textField.setWidth(builder.promptWidth);
   }
   textField.setAllowBlank(builder.allowBlank);
   textField.addListener(
       Events.OnKeyPress,
       new Listener<FieldEvent>() {
         @Override
         public void handleEvent(final FieldEvent fe) {
           if (fe.getEvent().getKeyCode() == 13) {
             builder.onEnter.onEnter();
           }
         }
       });
   if (TextUtils.notEmpty(builder.promptText)) {
     promptLabel.setText(builder.promptText);
   }
   super.getInnerPanel().add(promptLabel);
   super.getInnerPanel().add(textField);
 }
Ejemplo n.º 2
0
 @Override
 public void actionPerformed(final ActionEvent event) {
   final StateToken token = session.getCurrentStateToken().copy().clearDocument();
   final String url =
       new Url(
               session.getSiteUrl() + FileConstants.EVENTSSERVLET,
               new UrlParam(FileConstants.TOKEN, token.toString()))
           .toString();
   NotifyUser.info(
       i18n.t("Calendar exporting"),
       i18n.t(
           "Open or use this address in your prefered calendar program for instance in your mobile: [%s]",
           TextUtils.generateHtmlLink(url, url, true)),
       ID,
       true);
 }
Ejemplo n.º 3
0
 /**
  * Instantiates a new notification sender default.
  *
  * @param mailService the mail service
  * @param waveService the wave service
  * @param xmppManager the xmpp manager
  * @param i18n the i18n
  * @param usersOnline the users online
  * @param kuneProperties the kune properties
  * @throws IOException Signals that an I/O exception has occurred.
  */
 @Inject
 public NotificationSenderDefault(
     final MailService mailService,
     final KuneWaveService waveService,
     final XmppManager xmppManager,
     final I18nTranslationServiceMultiLang i18n,
     final UsersOnline usersOnline,
     final KuneProperties kuneProperties)
     throws IOException {
   this.mailService = mailService;
   this.waveService = waveService;
   this.xmppManager = xmppManager;
   this.i18n = i18n;
   this.usersOnline = usersOnline;
   emailTemplate =
       FileUtils.readFileToString(
           new File(kuneProperties.get(KuneProperties.SITE_EMAIL_TEMPLATE)));
   Preconditions.checkNotNull(emailTemplate);
   Preconditions.checkArgument(TextUtils.notEmpty(emailTemplate));
   siteName = kuneProperties.get(KuneProperties.SITE_NAME);
 }
Ejemplo n.º 4
0
 public static String changeLang(final String url, final String lang) {
   final String[] hashSplitted = url.split("#");
   final String hash = hashSplitted.length > 1 ? hashSplitted[1] : "";
   String query = hashSplitted.length >= 1 ? hashSplitted[0] : (url.equals("#") ? "" : url);
   query = query.startsWith("?") ? query.substring(1) : query;
   final String[] params = query.split("&");
   final Url changedUrl = new Url("");
   if (!query.contains("locale")) {
     addLangParam(lang, changedUrl);
   }
   for (final String param : params) {
     if (TextUtils.notEmpty(param)) {
       final String[] pair = param.split("=");
       if (pair[0].equals("locale")) {
         addLangParam(lang, changedUrl);
       } else {
         changedUrl.add(new UrlParam(pair[0], pair[1]));
       }
     }
   }
   return changedUrl.toString() + (url.contains("#") ? "#" + hash : "");
 }
Ejemplo n.º 5
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());
  }
Ejemplo n.º 6
0
 /* (non-Javadoc)
  * @see cc.kune.common.client.actions.ui.AbstractGuiItem#setToolTipText(java.lang.String)
  */
 @Override
 public void setToolTipText(final String tooltip) {
   if (TextUtils.notEmpty(tooltip)) {
     item.setTitle(tooltip);
   }
 }