Example usage for org.apache.commons.validator GenericValidator isBlankOrNull

List of usage examples for org.apache.commons.validator GenericValidator isBlankOrNull

Introduction

In this page you can find the example usage for org.apache.commons.validator GenericValidator isBlankOrNull.

Prototype

public static boolean isBlankOrNull(String value) 

Source Link

Document

Checks if the field isn't null and length of the field is greater than zero not including whitespace.

Usage

From source file:org.squale.welcom.taglib.button.impl.ButtonSkinv2.java

/**
 * retourne la largeur du bouton en fonction du type
 * //from   www  . ja  va 2  s .com
 * @param type le type
 * @param name nom du bouton
 * @return la largeur
 */
private String getWidth(final String name, final String type) {
    String width = WelcomConfigurator.getMessage("chartev2.bouton." + type + "." + name + ".width");

    if (GenericValidator.isBlankOrNull(width)) {
        width = WelcomConfigurator.getMessage("chartev2.bouton." + name + ".width");
    }

    if (!GenericValidator.isBlankOrNull(width)) {
        if (Util.isEqualsIgnoreCase(width, "small")) {
            return "115";
        } else if (Util.isEqualsIgnoreCase(width, "medium")) {
            return "150";
        } else if (Util.isEqualsIgnoreCase(width, "long")) {
            return "210";
        } else {
            return width;
        }
    } else {
        return "115";
    }
}

From source file:org.squale.welcom.taglib.button.impl.ButtonSkinv2.java

/**
 * retourne la direction en fonction du type
 * /*from  w w  w  . j av  a2 s  . co  m*/
 * @param type le type du bouton
 * @param name nom du bouton
 * @return la direction
 */
private String getDirection(final String name, final String type) {
    if (Util.isEquals("form", type)) {
        String direction = WelcomConfigurator
                .getMessage("chartev2.bouton." + type + "." + name + ".alignement");

        if (GenericValidator.isBlankOrNull(direction)) {
            direction = WelcomConfigurator.getMessage("chartev2.bouton." + name + ".alignement");
        }

        if (!GenericValidator.isBlankOrNull(direction)) {
            return direction;
        }
    }

    return "d";
}

From source file:org.squale.welcom.taglib.button.impl.ButtonSkinv2.java

/**
 * retourne le path du picto//  w w  w .j  a  v  a  2 s .co m
 * 
 * @param type le type du bouton
 * @param name nom du bouton
 * @param parentTag tag parent
 * @return le pathpicto
 */
private String getPathPicto(final Tag parentTag, final String name, final String type) {
    String couleur = COULEUR_BLUE_AF;

    if ((parentTag instanceof TableBottomTag) || (parentTag instanceof JSOngletBottomTag)
            || (parentTag instanceof ButtonBarTag) || (parentTag instanceof FormulaireBottomTag)) {
        couleur = COULEUR_WHITE;
    }

    String picto = WelcomConfigurator.getMessage("chartev2.bouton." + type + "." + name + ".icone", couleur);

    if (!GenericValidator.isBlankOrNull(picto)) {
        return picto;
    } else {
        picto = WelcomConfigurator.getMessage("chartev2.bouton." + name + ".icone", couleur);

        if (!GenericValidator.isBlankOrNull(picto)) {
            return picto;
        } else {
            return DEFAULT_PICTO;
        }
    }
}

From source file:org.squale.welcom.taglib.button.impl.ButtonSkinv2.java

/**
 * @see org.squale.welcom.taglib.button.IButtonRenderer#drawRenderMenuHRefTag(StringBuffer results)
 *//*from w  w w.  jav  a2  s  . c o  m*/
public String drawRenderMenuHRefTag(final PageContext pageContext, final Tag parentTag, final String name,
        final String rawValue, final String target, final String href, final String onclick,
        final String toolTip, final String styleId) {
    StringBuffer results = new StringBuffer();
    // div.menuAction
    results.append("<a href=\"" + href);
    results.append("\" ");

    if (!GenericValidator.isBlankOrNull(onclick)) {
        results.append("onClick=\"" + onclick + "\" ");
    }

    if (!GenericValidator.isBlankOrNull(toolTip)) {
        results.append(toolTip);
    }

    if (!GenericValidator.isBlankOrNull(styleId)) {
        results.append(" id=\"" + styleId + "\"");
    }

    if (!GenericValidator.isBlankOrNull(target)) {
        results.append(" target=\"" + target + "\" ");
    }

    results.append("> <img src=\"" + getPathPicto(parentTag, name, "menu") + "\"");
    results.append(" >");
    results.append(getLabel(pageContext, name, rawValue, "menu"));
    results.append("</a>");
    return results.toString();
}

From source file:org.squale.welcom.taglib.button.impl.ButtonSkinv2.java

/**
 * @see org.squale.welcom.taglib.button.IButtonRenderer#drawRenderFormHRefTag(StringBuffer results)
 *//* www .ja  v a  2  s  .c  om*/
public String drawRenderFormHRefTag(final PageContext pageContext, final Tag parentTag, final String name,
        final String rawValue, final String target, final String onclick, final String toolTip,
        final String styleId) {
    StringBuffer results = new StringBuffer();
    results.append("<a href=\"javascript:");
    results.append(onclick);
    results.append("\" ");

    if (!GenericValidator.isBlankOrNull(toolTip)) {
        results.append(toolTip);
    }

    if (!GenericValidator.isBlankOrNull(styleId)) {
        results.append(" id=\"" + styleId + "\"");
    }

    if (!GenericValidator.isBlankOrNull(target)) {
        results.append(" target=\"" + target + "\" ");
    }

    results.append(" class=\"" + getFormClass(parentTag, name, "form") + "\"");
    results.append(" style=\"BACKGROUND-IMAGE: url(" + getPathPicto(parentTag, name, "form") + ")\"");
    results.append(" >");

    results.append(getLabel(pageContext, name, rawValue, "form"));
    results.append("</a>");
    return results.toString();
}

From source file:org.squale.welcom.taglib.button.impl.ButtonSkinv2.java

/**
 * @see org.squale.welcom.taglib.button.IButtonRenderer#drawRenderFormInputTag(StringBuffer results)
 *//*from  w  w w .  ja va  2  s  .com*/
public String drawRenderFormInputTag(final PageContext pageContext, final Tag parentTag, final String name,
        final String rawValue, final String target, final String onclick, final String toolTip,
        final String styleId) {
    StringBuffer results = new StringBuffer();

    // Si c'est un bouton mineur, c'est un Href
    if ((parentTag instanceof TableBottomTag) || (parentTag instanceof JSOngletBottomTag)
            || (parentTag instanceof ButtonBarTag) || (parentTag instanceof FormulaireBottomTag)) {
        results.append("<input");

        if (!GenericValidator.isBlankOrNull(toolTip)) {
            results.append(toolTip);
        }

        if (!GenericValidator.isBlankOrNull(styleId)) {
            results.append(" id=\"" + styleId + "\"");
        }

        results.append(
                " class=\"" + getFormClass(parentTag, name, "form") + "\" type=\"submit\" name=\"Submit\" ");

        results.append(" style=\"BACKGROUND-IMAGE: url(" + getPathPicto(parentTag, name, "form") + ")\"");

        results.append(" onMouseOver=\"rollover(true,this)\" onMouseOut=\"rollover(false,this)\"");
        results.append(" onclick=\"" + onclick + "\"");
        results.append(" value=\"" + getLabel(pageContext, name, rawValue, "form") + "\"");
        results.append(" />");
    } else {
        results.append(drawRenderFormHRefTag(pageContext, parentTag, name, rawValue, target, onclick, toolTip,
                styleId));
    }
    return results.toString();
}

From source file:org.squale.welcom.taglib.canvas.CanvasCenterTag.java

/**
 * @see javax.servlet.jsp.tagext.TagSupport#doStartTag()
 *//*from ww  w .  j  a  v  a2 s . c o  m*/
public int doStartTag() throws JspException {
    final StringBuffer sb = new StringBuffer();
    sb.append(
            render.drawStart(pageContext.getRequest().getAttribute(CanvasLeftMenuTag.KEY_CANVASLEFT) != null));

    // Recupere le ttle definit du parent
    if (GenericValidator.isBlankOrNull(titleKey)) {

        // Recherche si un parent est du bon type
        final PageTag pageTag = (PageTag) findAncestorWithClass(this, PageTag.class);

        if (pageTag != null) {
            this.setTitleKey(pageTag.getTitleKey());
            this.setTitleKeyArg0(pageTag.getTitleKeyArg0());
            this.setTitleKeyArg1(pageTag.getTitleKeyArg1());
            this.setTitleKeyArg2(pageTag.getTitleKeyArg2());
            this.setTitleKeyArg3(pageTag.getTitleKeyArg3());

            if (GenericValidator.isBlankOrNull(subTitleKey)) {
                this.setSubTitleKey(pageTag.getSubTitleKey());
                this.setSubTitleKeyArg0(pageTag.getSubTitleKeyArg0());
                this.setSubTitleKeyArg1(pageTag.getSubTitleKeyArg1());
                this.setSubTitleKeyArg2(pageTag.getSubTitleKeyArg2());
                this.setSubTitleKeyArg3(pageTag.getSubTitleKeyArg3());
            }
        }
    }

    if (!GenericValidator.isBlankOrNull(titleKey)) {
        drawTitreBar(sb);
    }

    ResponseUtils.write(pageContext, sb.toString());

    return EVAL_PAGE;
}

From source file:org.squale.welcom.taglib.canvas.CanvasCenterTag.java

/**
 * Methode charge de dessiner le titre/* w ww.  j a v  a 2 s. c om*/
 * 
 * @param sb le stringbuffer dans lequel elle ecrit le html
 * @throws JspException exception pouvant etre levee
 */
private void drawTitreBar(final StringBuffer sb) throws JspException {

    // construit le titre
    final String titlekeyArgs[] = { titleKeyArg0, titleKeyArg1, titleKeyArg2, titleKeyArg3 };
    String messageTitre = WRequestUtils.message(super.pageContext, titleKey, titlekeyArgs);
    if (GenericValidator.isBlankOrNull(messageTitre)) {
        messageTitre = titleKey;
    }

    // construit le soustitre
    final String subTitlekeyArgs[] = { subTitleKeyArg0, subTitleKeyArg1, subTitleKeyArg2, subTitleKeyArg3 };
    String messageSousTitre = WRequestUtils.message(super.pageContext, subTitleKey, subTitlekeyArgs);

    if (GenericValidator.isBlankOrNull(messageSousTitre)) {
        messageSousTitre = subTitleKey;
    }

    sb.append(render.drawTitre(messageTitre, subTitleKey, messageSousTitre));
}

From source file:org.squale.welcom.taglib.canvas.CanvasHeaderTag.java

/**
 * @see javax.servlet.jsp.tagext.TagSupport#doStartTag()
 *//*from w ww. ja v a 2s.  c  om*/
public int doStartTag() throws JspException {

    if (GenericValidator.isBlankOrNull(headerImageURL)) {
        headerImageURL = WelcomConfigurator.getMessage(WelcomConfigurator.HEADER_IMAGE_KEY);
    }

    ResponseUtils.write(pageContext, render.drawHeader(headerImageURL).toString());

    return EVAL_PAGE;
}

From source file:org.squale.welcom.taglib.canvas.CanvasPopupTag.java

/**
 * Gere la barre de titre/*from w  w  w  . j  a v  a  2 s.c om*/
 * 
 * @throws JspException exception pouvant etre levee
 * @return tritre du message
 */
private String getTitreMessage() throws JspException {
    // Titre
    final String titlekeyArgs[] = { titleKeyArg0, titleKeyArg1, titleKeyArg2, titleKeyArg3 };
    String message = WRequestUtils.message(super.pageContext, titleKey, titlekeyArgs);

    if (GenericValidator.isBlankOrNull(message)) {
        message = titleKey;
    }

    return message;
}