use of com.sun.faces.facelets.el.VariableMapperWrapper in project muikku by otavanopisto.
the class WidgetSpaceComponentHandler method apply.
@Override
public void apply(FaceletContext context, UIComponent parent) throws IOException {
StringBuilder jsfBuilder = new StringBuilder();
jsfBuilder.append("<ui:composition xmlns:m=\"http://www.ofw.fi/xml/2013/muikku/components-taglib.xsd\" xmlns:ui=\"http://java.sun.com/jsf/facelets\">").append("<m:includeWidgets").append(" widgets=").append('"').append('#').append("{widgetsBackingBean.getWidgets('").append(getName(context)).append("')}").append('"').append("/>").append("</ui:composition>");
VariableMapper orig = context.getVariableMapper();
context.setVariableMapper(new VariableMapperWrapper(orig));
try {
context.includeFacelet(parent, new URL(null, "data://text/plain;base64," + Base64.encodeBase64String(jsfBuilder.toString().getBytes("UTF-8")), new DataStreamHandler()));
} catch (IOException e) {
throw new TagException(this.tag, "Failed to include widget space widgets");
} finally {
context.setVariableMapper(orig);
}
super.apply(context, parent);
}
use of com.sun.faces.facelets.el.VariableMapperWrapper in project muikku by otavanopisto.
the class EmbedJSF method apply.
@Override
public void apply(FaceletContext context, UIComponent uiComponent) throws IOException {
String unencoded = (String) jsfString.getObject(context, String.class);
String encoded = Base64.encodeBase64String(unencoded.getBytes());
VariableMapper orig = context.getVariableMapper();
context.setVariableMapper(new VariableMapperWrapper(orig));
try {
this.nextHandler.apply(context, null);
context.includeFacelet(uiComponent, new URL(null, "data://text/plain;base64," + encoded, new DataStreamHandler()));
} catch (IOException e) {
throw new TagAttributeException(this.tag, this.jsfString, "Invalid embedded JSF: " + unencoded);
} finally {
context.setVariableMapper(orig);
}
}
use of com.sun.faces.facelets.el.VariableMapperWrapper in project muikku by otavanopisto.
the class IncludeWidgetsTagHandler method includeWidget.
private void includeWidget(FaceletContext context, UIComponent parent) throws IOException {
StringBuilder jsfBuilder = new StringBuilder();
List<LocatedWidget> widgets = getWidgets(context);
jsfBuilder.append("<ui:composition xmlns:m=\"http://www.ofw.fi/xml/2013/muikku/components-taglib.xsd\" xmlns:ui=\"http://java.sun.com/jsf/facelets\">");
for (LocatedWidget widget : widgets) {
appendWidgetJsf(jsfBuilder, widget.getWidget());
}
jsfBuilder.append("</ui:composition>");
VariableMapper orig = context.getVariableMapper();
context.setVariableMapper(new VariableMapperWrapper(orig));
try {
this.nextHandler.apply(context, parent);
context.includeFacelet(parent, new URL(null, "data://text/plain;base64," + Base64.encodeBase64String(jsfBuilder.toString().getBytes("UTF-8")), new DataStreamHandler()));
} finally {
context.setVariableMapper(orig);
}
}
use of com.sun.faces.facelets.el.VariableMapperWrapper in project muikku by otavanopisto.
the class WidgetComponentHandler method includeWidget.
private void includeWidget(FaceletContext context, UIComponent parent, String widgetName) {
String path = getWidgetPath(widgetName);
VariableMapper orig = context.getVariableMapper();
context.setVariableMapper(new VariableMapperWrapper(orig));
try {
this.nextHandler.apply(context, null);
context.includeFacelet(parent, path);
} catch (IOException e) {
Logger.getLogger(getClass().getName()).log(Level.SEVERE, "Failed to include widget " + path, e);
} finally {
context.setVariableMapper(orig);
}
}
Aggregations