use of com.manydesigns.elements.xml.XhtmlBuffer in project Portofino by ManyDesigns.
the class SessionMessagesTag method doStartTag.
public int doStartTag() {
JspWriter out = pageContext.getOut();
XhtmlBuffer xb = new XhtmlBuffer(out);
List<String> errorMessages = com.manydesigns.elements.messages.SessionMessages.consumeErrorMessages();
List<String> warningMessages = com.manydesigns.elements.messages.SessionMessages.consumeWarningMessages();
List<String> infoMessages = com.manydesigns.elements.messages.SessionMessages.consumeInfoMessages();
if (!errorMessages.isEmpty()) {
xb.openElement("div");
xb.addAttribute("class", "alert alert-danger alert-dismissable fade in");
writeCloseButton(xb);
writeList(xb, errorMessages, "errorMessages");
xb.closeElement("div");
}
if (!warningMessages.isEmpty()) {
xb.openElement("div");
xb.addAttribute("class", "alert alert-warning alert-dismissable fade in");
writeCloseButton(xb);
writeList(xb, warningMessages, "warningMessages");
xb.closeElement("div");
}
if (!infoMessages.isEmpty()) {
xb.openElement("div");
xb.addAttribute("class", "alert alert-success alert-dismissable fade in");
writeCloseButton(xb);
writeList(xb, infoMessages, "infoMessages");
xb.closeElement("div");
}
return SKIP_BODY;
}
use of com.manydesigns.elements.xml.XhtmlBuffer in project Portofino by ManyDesigns.
the class WriteTag method doTag.
private void doTag(JspWriter out) throws OgnlException {
Integer scopeCode;
if (scope == null) {
scopeCode = null;
} else if (APPLICATION_SCOPE.equals(scope)) {
scopeCode = PageContext.APPLICATION_SCOPE;
} else if (SESSION_SCOPE.equals(scope)) {
scopeCode = PageContext.SESSION_SCOPE;
} else if (REQUEST_SCOPE.equals(scope)) {
scopeCode = PageContext.REQUEST_SCOPE;
} else if (PAGE_SCOPE.equals(scope)) {
scopeCode = PageContext.PAGE_SCOPE;
} else {
logger.warn("Unknown scope: {}", scope);
return;
}
Object bean;
if (scopeCode != null) {
bean = pageContext.getAttribute(name, scopeCode);
} else {
bean = pageContext.findAttribute(name);
}
if (bean == null) {
logger.warn("Bean {} not found in scope {}", name, scope);
return;
}
if (property != null) {
// use property as Ognl expression
OgnlContext ognlContext = ElementsThreadLocals.getOgnlContext();
bean = OgnlUtils.getValueQuietly(property, ognlContext, bean);
}
if (bean instanceof XhtmlFragment) {
XhtmlFragment xhtmlFragment = (XhtmlFragment) bean;
XhtmlBuffer xb = new XhtmlBuffer(out);
xhtmlFragment.toXhtml(xb);
} else {
logger.warn("Bean {} scope {} property {} not of type XhtmlFragment: {}", new String[] { name, scope, property, bean != null ? bean.getClass().getName() : null });
}
}
use of com.manydesigns.elements.xml.XhtmlBuffer in project Portofino by ManyDesigns.
the class RequestMessages method addErrorMessage.
public static void addErrorMessage(XhtmlFragment xml) {
XhtmlBuffer buf = new XhtmlBuffer();
xml.toXhtml(buf);
getErrorQueue().add(buf.toString());
}
use of com.manydesigns.elements.xml.XhtmlBuffer in project Portofino by ManyDesigns.
the class SessionMessages method addWarningMessage.
public static void addWarningMessage(XhtmlFragment xml) {
XhtmlBuffer buf = new XhtmlBuffer();
xml.toXhtml(buf);
getWarningQueue().add(buf.toString());
}
use of com.manydesigns.elements.xml.XhtmlBuffer in project Portofino by ManyDesigns.
the class SessionMessages method addErrorMessage.
public static void addErrorMessage(XhtmlFragment xml) {
XhtmlBuffer buf = new XhtmlBuffer();
xml.toXhtml(buf);
getErrorQueue().add(buf.toString());
}
Aggregations