private void computeCompoundLabel() { if (StringUtility.hasText(m_labelBase) && StringUtility.hasText(m_labelSuffix)) { super.setLabel(m_labelBase + " " + m_labelSuffix); } else { super.setLabel(StringUtility.emptyIfNull(m_labelBase) + StringUtility.emptyIfNull(m_labelSuffix)); } }
public HttpClientInfo init(String userAgent) { m_userAgent.set(StringUtility.emptyIfNull(userAgent)); initInfos(); return this; }
@Override public String toString() { String s = getText(); if (s == null) { s = StringUtility.emptyIfNull(getValue()); } return s; } }
protected void extractParameters(final URI uri) { m_parameters = new HashMap<>(); for (final String param : StringUtility.split(uri.getRawQuery(), "&")) { if (!StringUtility.hasText(param)) { continue; } final String[] kv = StringUtility.split(param, "=", 2); if (kv.length != 2) { continue; } final String k = StringUtility.emptyIfNull(urlDecode(kv[0])); final String v = StringUtility.emptyIfNull(urlDecode(kv[1])); m_parameters.put(k, v); } }
protected IHtmlTableRow createHtmlRow(String property, Object value) { return HTML.tr( HTML.td(StringUtility.emptyIfNull(StringUtility.box("", property, ":"))).cssClass("scout-info-form-table-cell-description"), HTML.td(StringUtility.emptyIfNull(value)).cssClass("scout-info-form-table-cell-value")); }
@Override protected void execChangedDisplayText() { String s = StringUtility.emptyIfNull(getDisplayText()).trim(); if (!s.isEmpty()) { if (!s.endsWith("*")) { s = s + "*"; } m_lowercaseFilterPattern = Pattern.compile(StringUtility.toRegExPattern(s.toLowerCase())); getUserBookmarkTreeField().getTree().addNodeFilter(this); } else { getUserBookmarkTreeField().getTree().removeNodeFilter(this); } }
protected boolean handleRequest(final HttpServletRequest request, final HttpServletResponse response, final FilterChain chain) throws IOException, ServletException { // Is running within a valid subject? if (BEANS.get(ServletFilterHelper.class).isRunningWithValidSubject(request)) { chain.doFilter(request, response); return true; } // Is request path excluded from authentication? if (m_config.getPathInfoFilter().accepts(StringUtility.emptyIfNull(request.getServletPath()) + StringUtility.emptyIfNull(request.getPathInfo()))) { chain.doFilter(request, response); return true; } // Is already authenticated? final Principal principal = BEANS.get(ServletFilterHelper.class).findPrincipal(request, m_config.getPrincipalProducer()); if (principal != null) { BEANS.get(ServletFilterHelper.class).continueChainAsSubject(principal, request, response, chain); return true; } // Is a request to base URL? (copy from UiServlet.doGet) final String contextPath = request.getServletContext().getContextPath(); if (StringUtility.hasText(contextPath) && request.getRequestURI().endsWith(contextPath)) { response.sendRedirect(request.getRequestURI() + "/"); return true; } return false; }
if (a != null) { for (CalendarComponent comp : a) { String key = StringUtility.emptyIfNull(comp.getItem().getSubject()).toLowerCase().trim(); List<CalendarComponent> list = classificationMap.computeIfAbsent(key, k -> new ArrayList<>()); list.add(comp);
if (i < 10 || i == n - 1) { t.append("- "); t.append(StringUtility.emptyIfNull(item)); t.append("\n");
/** * Called by {@link #execCopy(List)} for each row and each visible column in case of a <code>CTRL-C</code> event on * the table to copy the given rows into the clipboard. */ protected void appendCopyTextForColumn(StringBuilder clipboardPlainText, ITableRow row, IColumn<?> column, boolean firstColumn) { String text; if (column instanceof IBooleanColumn) { boolean value = BooleanUtility.nvl(((IBooleanColumn) column).getValue(row), false); text = value ? "X" : ""; } else { text = StringUtility.emptyIfNull(row.getCell(column).getText()); } // special intercept for html if (text != null && row.getCell(column).isHtmlEnabled()) { text = HTML.raw(text).toPlainText(); } // text/plain if (!firstColumn) { clipboardPlainText.append("\t"); } clipboardPlainText.append(StringUtility.emptyIfNull(StringUtility.unwrapText(text))); }
/** * Parses values in table row and sets it to the table row */ public final void parseValueAndSet(ITableRow row, Object rawValue, boolean updateDisplayText) { try { setValue(row, interceptParseValue(row, rawValue), updateDisplayText); } catch (ProcessingException e) { row.getCellForUpdate(this).addErrorStatus(new ParsingFailedStatus(e, StringUtility.emptyIfNull(rawValue))); } }
/** * Parses values in table row and sets it to the table row */ @Override public final void parseValueAndSet(ITableRow row, Object rawValue) { try { setValue(row, interceptParseValue(row, rawValue)); } catch (ProcessingException e) { row.getCellForUpdate(this).addErrorStatus(new ParsingFailedStatus(e, StringUtility.emptyIfNull(rawValue))); } }
xEntity.setAttribute("negated", (entityNode.isNegative() ? "true" : "false")); List<String> texts = entityNode.getTexts(); xEntity.setAttribute("displayValues", CollectionUtility.hasElements(texts) ? StringUtility.emptyIfNull(CollectionUtility.firstElement(texts)) : null); x.appendChild(xEntity); if (CollectionUtility.hasElements(texts)) { Iterator<String> it = texts.iterator(); xAtt.setAttribute("displayValue", StringUtility.emptyIfNull(it.next())); int i = 2; while (it.hasNext()) { xAtt.setAttribute(("displayValue" + i), StringUtility.emptyIfNull(it.next())); i++;
@Override public void setTextContents(String textContents) { ClipboardForm form = new ClipboardForm(); form.setMimeTypes(MimeType.TXT); // anonymous text paste, no filename BinaryResource binaryResource = BinaryResources.create() .withContentType(MimeType.TXT.getType()) .withContent(StringUtility.emptyIfNull(textContents)) .build(); form.getClipboardField().setValue(Collections.singleton(binaryResource)); execInitClipboardForm(form); form.startCopy(); } }
final String message = TEXTS.get("InvalidValueMessageX", StringUtility.emptyIfNull(rawValue)); ProcessingException pe = new ProcessingException(message, e); LOG.warn("Unexpected Error: ", pe);