Refine search
private String getMessageKey(String message) { if (!Strings.isEmpty(message) && message.startsWith("{") && message.endsWith("}")) { return message.substring(1, message.length() - 1); } return null; } }
/** * Method to override if you want special escaping of the options html. * * @param displayValue * @return The escaped display value */ protected CharSequence escapeOptionHtml(String displayValue) { return Strings.escapeMarkup(displayValue); }
/** * Construct. * * @param notAllowed * comma separated list with values which are not allowed in the user agent * @param detectionStrings * a list with strings which has to be in the user agent string */ UserAgent(String notAllowed, List<String>... detectionStrings) { notAllowedList = Strings.split(notAllowed, ','); this.detectionStrings = detectionStrings; }
private CharSequence escapeAttribute(final CharSequence attr) { if(null == attr) { return null; } CharSequence escaped = Strings.escapeMarkup(attr.toString()); // No need to escape the apostrophe; it just clutters the markup return Strings.replaceAll(escaped, "'", "'"); }
/** * Attempts to parse a {@link Url.QueryParameter} which may hold {@link PageComponentInfo}. * * @param parameter * The {@link Url.QueryParameter} to parse. * * @return The parsed {@link PageComponentInfo}, or {@code null} if the parameter could not be parsed. */ public static PageComponentInfo parsePageComponentInfoParameter(final Url.QueryParameter parameter) { Args.notNull(parameter, "parameter"); if (Strings.isEmpty(parameter.getName()) == false && Strings.isEmpty(parameter.getValue()) == true) { return PageComponentInfo.parse(parameter.getName()); } return null; }
@Override protected void respond(AjaxRequestTarget target) { final RequestCycle requestCycle = RequestCycle.get(); StringValue position = requestCycle.getRequest().getRequestParameters().getParameterValue("position"); if (!position.isNull()) { final String strPos = position.toString(); if (!Strings.isEmpty(strPos)) { onToggleFromClient(strPos, toggle(strPos)); } } }
public final void onComponentTag(final Component component, final ComponentTag tag) { super.onComponentTag(component, tag); String existingStyles = (String) tag.getAttributes().get(HTMLAttribute.STYLE); putExistingStyles(existingStyles); onStyleAttribute(this.styleAttribute); String styles = this.styleAttribute.getStyles(); if (!Strings.isEmpty(styles)) { tag.put(HTMLAttribute.STYLE, styles); } }
/** * checks given component' default model, if it's empty or null the component will be hidden. * * @param component component to check */ public static void hideIfModelIsEmpty(final Component component) { if (component != null && Strings.isEmpty(component.getDefaultModelObjectAsString())) { component.setVisible(false); } }
@Override public void onConfigure(Component component) { Object object = component.getDefaultModelObject(); boolean visible = object instanceof CharSequence ? !Strings.isEmpty((CharSequence)object) : object!=null; component.setVisibilityAllowed(visible); }
@Override protected void onConfigure() { super.onConfigure(); if (Strings.isEmpty(headerLabel.getDefaultModelObjectAsString())) { // there must be at least on character inside the header to prevent // layout problems. headerLabel.setDefaultModelObject(" "); headerLabel.setEscapeModelStrings(false); } footer.setVisible(buttons.size() > 0); }
@Override protected void onConfigure() { super.onConfigure(); Components.hideIfModelIsEmpty(title); image.setVisible(!Strings.isEmpty(getDefaultModelObjectAsString())); } }
@Override public void onComponentTagBody(MarkupStream markupStream, ComponentTag openTag) { if ("button".equals(openTag.getName())) { String modelObjectAsString = getDefaultModelObjectAsString(); if (Strings.isEmpty(modelObjectAsString) == false) { replaceComponentTagBody(markupStream, openTag, modelObjectAsString); return; } } super.onComponentTagBody(markupStream, openTag); }
/** * Returns whether the Url is context absolute. Absolute Urls start with a '{@literal /}'. * * @return <code>true</code> if Url starts with the context path, <code>false</code> otherwise. */ public boolean isContextAbsolute() { return !contextRelative && !isFull() && !getSegments().isEmpty() && Strings.isEmpty(getSegments().get(0)); }
/** * Checks whether the passed Url can be handled by this mapper * * @param url * the Url to check * @return {@code true} - if the Url can be handled, {@code false} - otherwise */ protected boolean canBeHandled(final Url url) { List<String> segments = url.getSegments(); return (segments.size() >= 4 && urlStartsWith(url, getContext().getNamespace(), getContext().getResourceIdentifier()) && Strings.isEmpty(segments.get(3)) == false ); } }
/** * @return The 'id' attribute from the associated markup tag */ public final String getMarkupIdFromMarkup() { ComponentTag tag = getMarkupTag(); if (tag != null) { String id = tag.getAttribute("id"); if (Strings.isEmpty(id) == false) { return id.trim(); } } return null; }