/** * 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); }
/** * 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); }
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 : ""); }
/* (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); } }