writer.endElement("div");
}
private void encodeNavBarControls(FacesContext facesContext, View view) throws IOException {
ResponseWriter writer = facesContext.getResponseWriter();
NavBarControl leftControl = (NavBarControl) view.getFacet("leftNavBar");
NavBarControl rightControl = (NavBarControl) view.getFacet("rightNavBar");
//TODO: Fix the code duplication here
if(leftControl != null && leftControl.isRendered()) {
String href="#";
String viewId = leftControl.getView();
String styleClass = leftControl.getType() != null ? leftControl.getType() : "";
if(leftControl.getEffect() != null) {
styleClass = styleClass + " " + leftControl.getEffect();
}
writer.startElement("a", null);
writer.writeAttribute("class", styleClass, null);
if(viewId != null) {
if(viewId.equals("home"))
href = href + "home";
else {
UIComponent viewComponent = leftControl.findComponent(leftControl.getView());
if(viewComponent == null)
throw new FacesException("Cannot find component \"" + leftControl.getView() + "\" in view.");
href = href + viewComponent.getClientId(facesContext);
}
}
writer.writeAttribute("href", href, null);
if(leftControl.getLabel() != null) {
writer.write(leftControl.getLabel());
}
writer.endElement("a");
}
if(rightControl != null && rightControl.isRendered()) {
String href="#";
String viewId = rightControl.getView();
String styleClass = rightControl.getType() != null ? rightControl.getType() : "";
if(rightControl.getEffect() != null) {
styleClass = styleClass + " " + rightControl.getEffect();
}
writer.startElement("a", null);
writer.writeAttribute("class", styleClass, null);
if(viewId != null) {
if(viewId.equals("home"))
href = href + "home";
else {
UIComponent viewComponent = rightControl.findComponent(rightControl.getView());
if(viewComponent == null)
throw new FacesException("Cannot find component \"" + rightControl.getView() + "\" in view.");
href = href + viewComponent.getClientId(facesContext);
}
}
writer.writeAttribute("href", href, null);
if(rightControl.getLabel() != null) {
writer.write(rightControl.getLabel());
}
writer.endElement("a");
}
}