javax.faces.context.ResponseWriter Java Examples

The following examples show how to use javax.faces.context.ResponseWriter. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DojoTabPaneContentRenderer.java    From XPagesExtensionLibrary with Apache License 2.0 6 votes vote down vote up
@Override
    public void encodeBegin(FacesContext context, UIComponent component) throws IOException {
        super.encodeBegin(context, component);
        ResponseWriter w = context.getResponseWriter();
        
        String clientId = component.getClientId(context);
        
        w.startElement("div", component); // $NON-NLS-1$
        w.writeAttribute("id", clientId, "id"); // $NON-NLS-1$ $NON-NLS-2$

        // Force the width/height to the parent
        w.writeAttribute("style", "width:100%;height:100%", null); // $NON-NLS-1$ $NON-NLS-2$
        
/*        
        UIDojoTabPane pane = (UIDojoTabPane)component.getParent();
        String style = pane.getContentStyle();
        if(StringUtil.isNotEmpty(style)) {
            w.writeAttribute("style", style, null); // $NON-NLS-1$
        }
        String styleClass = pane.getContentStyleClass();
        if(StringUtil.isNotEmpty(styleClass)) {
            w.writeAttribute("class", styleClass, null); // $NON-NLS-1$
        }
*/        
    }
 
Example #2
Source File: MobileFormTableRenderer.java    From XPagesExtensionLibrary with Apache License 2.0 6 votes vote down vote up
@Override
protected void writeOneColumnRows(FacesContext context, ResponseWriter w, FormLayout c, UIComponent parent, ComputedFormData formData) throws IOException {
    List<UIComponent> children = TypedUtil.getChildren(parent);
    for(UIComponent child: children) {
        if(!child.isRendered()) {
            continue;
        }
        if(child instanceof UIFormLayoutRow) {
            newLine(w);
            writeFormRow(context, w, c, formData, (UIFormLayoutRow)child);
        } else {
            if( !(child instanceof FormLayout) ){
                writeChildRows(context, w, c, child, formData);
            }// do not recurse through FormLayout descendants
        }
    }
}
 
Example #3
Source File: OpenStreetMapRenderer.java    From BootsFaces-OSP with Apache License 2.0 6 votes vote down vote up
/**
 * This methods generates the HTML code of the current b:openStreetMap.
 * <code>encodeBegin</code> generates the start of the component. After the, the
 * JSF framework calls <code>encodeChildren()</code> to generate the HTML code
 * between the beginning and the end of the component. For instance, in the case
 * of a panel component the content of the panel is generated by
 * <code>encodeChildren()</code>. After that, <code>encodeEnd()</code> is called
 * to generate the rest of the HTML code.
 *
 * @param context   the FacesContext.
 * @param component the current b:openStreetMap.
 * @throws IOException thrown if something goes wrong when writing the HTML
 *                     code.
 */
@Override
public void encodeBegin(FacesContext context, UIComponent component) throws IOException {
	
	if (!component.isRendered()) {
		return;
	}
	OpenStreetMap openStreetMap = (OpenStreetMap) component;

	ResponseWriter rw = context.getResponseWriter();
	String clientId = openStreetMap.getClientId();

	rw.startElement("div", openStreetMap);
	rw.writeAttribute("id", clientId, "id");
	rw.writeAttribute("style", "width:" + openStreetMap.getWidth() + "; height:" + openStreetMap.getHeight(), null);

}
 
Example #4
Source File: UIFenixCalendar.java    From fenixedu-academic with GNU Lesser General Public License v3.0 6 votes vote down vote up
private void encodeMonthRow(ResponseWriter writer, Calendar date, Locale locale) throws IOException {
    // writer.startElement("tr", this);
    // writer.startElement("td", this);
    writer.startElement("caption", this);
    writer.writeAttribute("style", "font-weight: 600; background: #bbb", null);
    writer.writeAttribute("class", "text-center", null);
    // writer.writeAttribute("colspan", 6, null);

    SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy HH:mm", locale);
    DateFormatSymbols dfs = sdf.getDateFormatSymbols();
    writer.write((dfs.getMonths())[date.get(Calendar.MONTH)]);

    writer.endElement("caption");
    // writer.endElement("td");
    // writer.endElement("tr");
}
 
Example #5
Source File: DojoGridRenderer.java    From XPagesExtensionLibrary with Apache License 2.0 6 votes vote down vote up
protected void emitColumn(FacesContext context, ResponseWriter writer, UIDojoDataGridColumn c) throws IOException {
    if(!c.isRendered()) {
        return;
    }
    JSUtil.writeln(writer);
    writer.startElement("th", c); // $NON-NLS-1$
    
    Map<String,String> attrs = DojoRendererUtil.createMap(context);
    DojoRendererUtil.addDojoHtmlAttributes(attrs,"field",c.getField()); // $NON-NLS-1$
    DojoRendererUtil.addDojoHtmlAttributes(attrs,"width",c.getWidth()); // $NON-NLS-1$
    DojoRendererUtil.addDojoHtmlAttributes(attrs,"cellType",c.getCellType()); // $NON-NLS-1$
    DojoRendererUtil.addDojoHtmlAttributes(attrs,"formatter",c.getFormatter()); // $NON-NLS-1$
    DojoRendererUtil.addDojoHtmlAttributes(attrs,"get",c.getGet()); // $NON-NLS-1$
    DojoRendererUtil.addDojoHtmlAttributes(attrs,"options",c.getOptions()); // $NON-NLS-1$
    DojoRendererUtil.addDojoHtmlAttributes(attrs,"editable",c.isEditable()); // $NON-NLS-1$
    DojoRendererUtil.addDojoHtmlAttributes(attrs,"hidden",c.isHidden()); // $NON-NLS-1$
    DojoRendererUtil.writeDojoHtmlAttributesMap(context,attrs);
    
    String title = c.getLabel();
    if(StringUtil.isNotEmpty(title)) {
        writer.writeText(title, "label"); // $NON-NLS-1$
    }

    writer.endElement("th"); // $NON-NLS-1$
}
 
Example #6
Source File: RendererUtil.java    From sakai with Educational Community License v2.0 6 votes vote down vote up
/**
 * Renders a script that includes an external JavaScript that gets added to
 * the document through a document.write() if a gatekeeper value is NOT set.
 * This effectively makes the script inclusion a per request JavaScript
 * singleton.
 * 
 * @param writer
 *            the ResponseWriter
 * @param gateKey
 *            for key value pair
 * @param gateValue
 *            value for key value pair for gatekeeper
 * @param contextBasePath
 *            the web app with the script
 * @param scriptPath
 *            the webapp-relative path
 * @throws IOException
 */
public static void writeSmartExternalScripts(ResponseWriter writer, String gateKey,
        String gateValue, String contextBasePath, String[] scriptPaths) throws IOException
{
    writer.write("<script>");
    writer.write("  if (typeof window['" + gateKey + "'] == '" + gateValue + "')");
    writer.write("  {");

    for (int i = 0; i < scriptPaths.length; i++)
    {
        writer.write("    document.write(");
        writer.write("   \"<\" + \"script src='/'\" + "
                + contextBasePath + " +");
        writer.write("   \"'" + scriptPaths[i] + "'><\" + \"/script>);");
    }

    writer.write("   var " + gateKey + " = '" + gateValue + "';");

    writer.write("  }");
    writer.write("</script>");
    writer.write("");
    writer.write("");
}
 
Example #7
Source File: PagerSizesRenderer.java    From XPagesExtensionLibrary with Apache License 2.0 6 votes vote down vote up
@Override
protected void writePagerContent(FacesContext context, ResponseWriter w, AbstractPager _pager, FacesDataIterator dataIterator) throws IOException {
    UIPagerSizes pager = (UIPagerSizes) _pager;
    w.startElement("div", null); // $NON-NLS-1$

    w.startElement("ul", null); // $NON-NLS-1$
    String styleClass = pager.getStyleClass();
    String pgClass = ExtLibUtil.concatStyleClasses("pagination", styleClass); // $NON-NLS-1$
    if (StringUtil.isNotEmpty(pgClass)) {
        w.writeAttribute("class", pgClass, null); // $NON-NLS-1$
    }

    String text = pager.getText();
    if (StringUtil.isEmpty(text)) {
        // "Show {0} items per page";
        text = com.ibm.xsp.extlib.controls.ResourceHandler.getString("PagerSizesRenderer.Show0itemsperpage"); //$NON-NLS-1$
    }
    int pos = text.indexOf("{0}"); //$NON-NLS-1$
    writerStartText(context, w, pager, dataIterator, text, pos);
    writerPages(context, w, pager, dataIterator, text, pos);
    writerEndText(context, w, pager, dataIterator, text, pos);
    w.endElement("ul"); // $NON-NLS-1$

    w.endElement("div"); // $NON-NLS-1$
}
 
Example #8
Source File: ForumPostRenderer.java    From XPagesExtensionLibrary with Apache License 2.0 6 votes vote down vote up
protected void writeAuthorName(FacesContext context, ResponseWriter w, UIForumPost c, UIComponent facet) throws IOException {
    if(facet==null) {
        return;
    }
    w.startElement("div", c); // $NON-NLS-1$
    String style = (String)getProperty(PROP_AUTHORNAMESTYLE);
    if(StringUtil.isNotEmpty(style)) {
        w.writeAttribute("style", style, null); // $NON-NLS-1$
    }
    String styleClass = (String)getProperty(PROP_AUTHORNAMECLASS);
    if(StringUtil.isNotEmpty(styleClass)) {
        w.writeAttribute("class", styleClass, null); // $NON-NLS-1$
    }
    FacesUtil.renderComponent(context, facet);
    w.endElement("div"); // $NON-NLS-1$
}
 
Example #9
Source File: SelectMultiMenuRenderer.java    From BootsFaces-OSP with Apache License 2.0 6 votes vote down vote up
/** Renders the select tag. */
protected void renderSelectTag(FacesContext context, ResponseWriter rw, String clientId, String name,
		SelectMultiMenu menu) throws IOException {
	renderSelectTag(rw, menu);
	renderSelectTagAttributes(rw, clientId, name, menu);
       AJAXRenderer.generateBootsFacesAJAXAndJavaScript(FacesContext.getCurrentInstance(), menu, rw, false);
	Object selectedOption = getValue2Render(context, menu);
	String[] optionList;
	if (selectedOption == null) {
		optionList = new String[0];
	} else if (!(selectedOption instanceof String)) {
		throw new FacesException("SelectMultiMenu only works with Strings!");
	} else {
		optionList = ((String) selectedOption).split(",");
	}
	renderOptions(context, rw, optionList, menu);

	renderInputTagEnd(rw);
}
 
Example #10
Source File: SwitchRenderer.java    From BootsFaces-OSP with Apache License 2.0 6 votes vote down vote up
/**
 * The b:switch and the b:selectBooleanCheckbox share most of their code.
 * This method allows to add extra attributes for the switch.
 * 
 * @param rw
 * @param selectBooleanCheckbox
 * @throws IOException
 */
protected void addAttributesForSwitch(ResponseWriter rw, SelectBooleanCheckbox selectBooleanCheckbox)
		throws IOException {
	Switch switchComponent = (Switch) selectBooleanCheckbox;
	writeAttribute(rw, "data-off-text", switchComponent.getOffText());
	writeAttribute(rw, "data-on-text", switchComponent.getOnText());
	writeAttribute(rw, "data-on-color", switchComponent.getOnColor());
	writeAttribute(rw, "data-off-color", switchComponent.getOffColor());
	if (switchComponent.isIndeterminate())
		writeAttribute(rw, "data-indeterminate", switchComponent.isIndeterminate());
	if (switchComponent.isInverse())
		writeAttribute(rw, "data-inverse", switchComponent.isInverse());
	writeAttribute(rw, "data-size", switchComponent.getSwitchsize());
	if (!switchComponent.isAnimate())
		writeAttribute(rw, "data-animate", switchComponent.isAnimate());
	if (switchComponent.isDisabled())
		writeAttribute(rw, "data-disabled", switchComponent.isDisabled());
	if (switchComponent.isReadonly())
		writeAttribute(rw, "data-readonly", switchComponent.isReadonly());
	writeAttribute(rw, "data-label-text", switchComponent.getLabelText());
	if (switchComponent.getHandleWidth() > 0)
		writeAttribute(rw, "data-handle-width", switchComponent.getHandleWidth());
	if (switchComponent.getLabelWidth() > 0)
		writeAttribute(rw, "data-label-width", switchComponent.getLabelWidth());
}
 
Example #11
Source File: ResponsiveAppLayoutRenderer.java    From XPagesExtensionLibrary with Apache License 2.0 6 votes vote down vote up
protected void writeSearchButton(FacesContext context, ResponseWriter w, UIApplicationLayout c, BasicApplicationConfigurationImpl configuration, SearchBar searchBar, ITree tree, boolean searchOptions) throws IOException {
     String submitSearch = "_xspAppSearchSubmit"; // $NON-NLS-1$
     
     w.startElement("div", c); // $NON-NLS-1$
     w.writeAttribute("class","input-group-btn",null); // $NON-NLS-1$ $NON-NLS-2$
     newLine(w);
     
     // Write the required script (done here because of Bootstrap 3 last-child selector on the input-group-btn)
     writeSearchScript(context, w, c, configuration, searchBar, tree, searchOptions);
     newLine(w);
    
     w.startElement("button",c); // $NON-NLS-1$
     w.writeAttribute("class","btn btn-default applayout-searchbtn",null); // $NON-NLS-1$ $NON-NLS-2$
     w.writeAttribute("onclick","javascript:"+submitSearch+"(); return false;",null); // $NON-NLS-1$ $NON-NLS-2$ $NON-NLS-3$
     String searchLabel = com.ibm.xsp.extlib.controls.ResourceHandler.getString("AbstractApplicationLayoutRenderer.Search.1"); // $NON-NLS-1$
     w.writeAttribute("aria-label", searchLabel,null); // $NON-NLS-1$ 
     w.startElement("span",c); // $NON-NLS-1$
     w.writeAttribute("aria-hidden","true",null); // $NON-NLS-1$ $NON-NLS-2$
     w.writeAttribute("class", Resources.get().getIconClass("search"),null); // $NON-NLS-1$ $NON-NLS-2$
     w.endElement("span"); // $NON-NLS-1$
     w.endElement("button"); // $NON-NLS-1$
     
     w.endElement("div"); // $NON-NLS-1$
}
 
Example #12
Source File: QuestionLinkRender.java    From sakai with Educational Community License v2.0 6 votes vote down vote up
/** 
 * @see javax.faces.render.Renderer#encodeBegin(javax.faces.context.FacesContext, javax.faces.component.UIComponent)
 */
public void encodeBegin(FacesContext context, UIComponent component)
    throws IOException
{
  ResponseWriter writer = context.getResponseWriter();
  String showLink = (String) component.getAttributes().get("showLink");
  String URL = (String) component.getAttributes().get("URL");
  String message = (String) component.getAttributes().get("message");
  if ("true".equals(showLink))
  {
    writer.write("<a href=\"");
    writer.write(URL);
    writer.write("\" target=\"content\">");
    writer.write(message);
    writer.write("</a>");
  }
}
 
Example #13
Source File: TabBarButtonRenderer.java    From XPagesExtensionLibrary with Apache License 2.0 6 votes vote down vote up
@Override
   public void encodeBegin(FacesContext context, UIComponent component) throws IOException {
       if (!component.isRendered()) {
           return;
       }

       // Get the response renderer
       ResponseWriter writer = context.getResponseWriter();

       // Do not render if it is not needed
       if (AjaxUtil.isAjaxNullResponseWriter(writer)) {
           return;
       }

       // And write the value
       if (component instanceof UIDojoWidgetBase) {
           writeTag(context, (UIDojoWidgetBase) component, writer);
       }
       
}
 
Example #14
Source File: BadgeRenderer.java    From BootsFaces-OSP with Apache License 2.0 6 votes vote down vote up
/**
 * This methods generates the HTML code of the current b:badge.
 *
 * @param context
 *            the FacesContext.
 * @param component
 *            the current b:badge.
 * @throws IOException
 *             thrown if something goes wrong when writing the HTML code.
 */
@Override
public void encodeBegin(FacesContext context, UIComponent component) throws IOException {
	if (!component.isRendered()) {
		return;
	}
	Badge badge = (Badge) component;
	ResponseWriter rw = context.getResponseWriter();
	String clientId = badge.getClientId();

	if (!component.isRendered()) {
		return;
	}
	String styleClass = badge.getStyleClass();
	String style=badge.getStyle();
	String val = getValue2Render(context, badge);

	generateBadge(context, badge, rw, clientId, styleClass, style, val, null);
}
 
Example #15
Source File: Tooltip.java    From BootsFaces-OSP with Apache License 2.0 6 votes vote down vote up
private static void verifyAndWriteTooltip(FacesContext context, ResponseWriter rw, String tooltip,
		String position, String container) throws IOException {
	if (null == position)
		position="bottom";
	boolean ok = "top".equals(position);
	ok |= "bottom".equals(position);
	ok |= "right".equals(position);
	ok |= "left".equals(position);
	ok |= "auto".equals(position);
	ok |= "auto top".equals(position);
	ok |= "auto bottom".equals(position);
	ok |= "auto right".equals(position);
	ok |= "auto left".equals(position);
	if (!ok) {
		position = "bottom";
		context.addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, "Wrong JSF markup",
				"Tooltip position must either be 'auto', 'top', 'bottom', 'left' or 'right'."));
	}
	rw.writeAttribute("data-toggle", "tooltip", null);
	rw.writeAttribute("data-placement", position, "data-placement");
	rw.writeAttribute("data-container", container, "data-container");
	rw.writeAttribute("title", tooltip, null);
}
 
Example #16
Source File: DropDownButtonRenderer.java    From XPagesExtensionLibrary with Apache License 2.0 6 votes vote down vote up
@Override
protected void renderChildren(FacesContext context, ResponseWriter writer, TreeContextImpl tree) throws IOException {
    int depth = tree.getDepth();
    if (depth == 1) {
        super.renderChildren(context, writer, tree);
    }
    else {
        if (tree.getNode().getType() != ITreeNode.NODE_LEAF) {
            DojoMenuRenderer r = new DojoMenuRenderer();
            String clientId = tree.getClientId(context, "ab", 1); // $NON-NLS-1$

            String mid = clientId + MENUID_SUFFIX; // $NON-NLS-1$
            r.setMenuId(mid);

            if (StringUtil.isNotEmpty(clientId)) {
                r.setConnectId(clientId);
            }

            r.setConnectEvent("onclick"); // $NON-NLS-1$
            r.render(context, writer, tree);
        }
    }
}
 
Example #17
Source File: HideDivisionRenderer.java    From sakai with Educational Community License v2.0 6 votes vote down vote up
public void encodeEnd(FacesContext context, UIComponent component) throws
  IOException {
    if (!component.isRendered()) {
      return;
    }

    ResponseWriter writer = context.getResponseWriter();

    String jsfId = (String) RendererUtil.getAttribute(context, component, "id");
    String id = jsfId;

    if (component.getId() != null &&
        !component.getId().startsWith(UIViewRoot.UNIQUE_ID_PREFIX))
    {
      id = component.getClientId(context);
    }

    writer.write("</div>");

//    writer.write("<script type=\"text/javascript\">");
//    writer.write("  showHideDiv('" + id +
//        "', '" +  RESOURCE_PATH + "');");
//    writer.write("</script>");
  }
 
Example #18
Source File: QuestionLinkRender.java    From sakai with Educational Community License v2.0 6 votes vote down vote up
/** 
 * @see javax.faces.render.Renderer#encodeBegin(javax.faces.context.FacesContext, javax.faces.component.UIComponent)
 */
public void encodeBegin(FacesContext context, UIComponent component)
    throws IOException
{
  ResponseWriter writer = context.getResponseWriter();
  String showLink = (String) component.getAttributes().get("showLink");
  String URL = (String) component.getAttributes().get("URL");
  String message = (String) component.getAttributes().get("message");
  if ("true".equals(showLink))
  {
    writer.write("<a href=\"");
    writer.write(URL);
    writer.write("\" target=\"content\">");
    writer.write(message);
    writer.write("</a>");
  }
}
 
Example #19
Source File: DojoWidgetBaseRenderer.java    From XPagesExtensionLibrary with Apache License 2.0 6 votes vote down vote up
@Override
public void encodeEnd(FacesContext context, UIComponent component) throws IOException {
    if (!component.isRendered()) {
        return;
    }

    // Get the response renderer
    ResponseWriter writer = context.getResponseWriter();

    // Do not render if it is not needed
    if (AjaxUtil.isAjaxNullResponseWriter(writer)) {
        return;
    }

    // And write the value
    if (component instanceof UIDojoWidgetBase) {
        endTag(context, writer, (UIDojoWidgetBase) component);
    }
}
 
Example #20
Source File: TocTreeRender.java    From sakai with Educational Community License v2.0 6 votes vote down vote up
/** 
 * @see javax.faces.render.Renderer#encodeBegin(javax.faces.context.FacesContext, javax.faces.component.UIComponent)
 */
public void encodeBegin(FacesContext context, UIComponent component)
    throws IOException
{
  String jsLibraryUrl = "../js";
  ResponseWriter writer = context.getResponseWriter();
  writer.write("<script type=\"text/javascript\">var _editor_url = \""
      + jsLibraryUrl + "/\";</script>\n");
  writer.write("<script type=\"text/javascript\" src=\"" + jsLibraryUrl
      + "/divTree.js\"></script>\n");
  writer
      .write("<link href=\"../css/divTree.css\" type=\"text/css\" rel=\"stylesheet\">");

  UIData data = (UIData) component;
  Object value = data.getValue();
  Set categories = (Set) value;
  encodeRecursive(writer, categories);
}
 
Example #21
Source File: BreadCrumbsRenderer.java    From XPagesExtensionLibrary with Apache License 2.0 5 votes vote down vote up
@Override
protected void renderEntryNode(FacesContext context, ResponseWriter writer, TreeContextImpl tree) throws IOException {
    if(!tree.getNodeContext().isFirstNode()) {
        renderSeparator(context, writer, tree);
    }
    super.renderEntryNode(context, writer, tree);
}
 
Example #22
Source File: PeerRefreshRenderer.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
public void encodeEnd(FacesContext context, UIComponent component) throws IOException
{
	ResponseWriter writer = context.getResponseWriter();
	String txt = (String) RendererUtil.getAttribute(context, component, "value");
	if ((txt != null) && (txt.length() > 0))
	{
		writer.write("<script type=\"text/javascript\" language=\"JavaScript\">\n");
		writer.write("try\n");
		writer.write("{\n");
		writer.write("	if (parent." + txt + ".location.toString().length > 1)\n");
		writer.write("	{\n");
		writer.write("		parent." + txt + ".location.replace(parent." + txt + ".location);\n");
		writer.write("	}\n");
		writer.write("}\n");
		writer.write("catch (e1)\n");
		writer.write("{\n");
		writer.write("	try\n");
		writer.write("	{\n");
		writer.write("		if (parent.parent." + txt + ".location.toString().length > 1)\n");
		writer.write("		{\n");
		writer.write("			parent.parent." + txt + ".location.replace(parent.parent." + txt + ".location);\n");
		writer.write("		}\n");
		writer.write("	}\n");
		writer.write("	catch (e2)\n");
		writer.write("	{\n");
		writer.write("	}\n");
		writer.write("}\n");
		writer.write("</script>\n");
	}
}
 
Example #23
Source File: SketchPadRenderer.java    From ctsms with GNU Lesser General Public License v2.1 5 votes vote down vote up
private void encodeInput(FacesContext context, SketchPad sketchPad) throws IOException {
	ResponseWriter writer = context.getResponseWriter();
	String inputId = getInputId(sketchPad, context);
	writer.startElement("input", sketchPad);
	writer.writeAttribute("type", "hidden", null);
	writer.writeAttribute("id", inputId, null);
	writer.writeAttribute("name", inputId, null);
	Object value = getValue(context, sketchPad);
	if (value != null) {
		writer.writeAttribute("value", value.toString(), null);
	}
	writer.endElement("input");
}
 
Example #24
Source File: DropDownButtonRenderer.java    From XPagesExtensionLibrary with Apache License 2.0 5 votes vote down vote up
@Override
protected void startRenderContainer(FacesContext context, ResponseWriter writer, TreeContextImpl tree) throws IOException {
    int depth = tree.getDepth();
    if(depth==1) {
        writer.startElement("div",null); // $NON-NLS-1$
        writer.writeAttribute("class", "btn-group", null); // $NON-NLS-1$ $NON-NLS-2$
    } else {
        super.startRenderContainer(context, writer, tree);
    }
}
 
Example #25
Source File: ShowAreaRender.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
public void encodeEnd(FacesContext context, UIComponent component)
    throws IOException
{
  ResponseWriter writer = context.getResponseWriter();

  String value = (String) component.getAttributes().get("value");

  if ((value != null) && (!"".equals(value)))
  {
  }
}
 
Example #26
Source File: ApplicationLinksRenderer.java    From XPagesExtensionLibrary with Apache License 2.0 5 votes vote down vote up
@Override
protected void renderEntryItemLinkAttributes(FacesContext context, ResponseWriter writer, TreeContextImpl tree, boolean enabled, boolean selected) throws IOException {
    if(tree.getNode().getType()==ITreeNode.NODE_CONTAINER) {
        writer.writeAttribute("aria-haspopup", "true", null); // $NON-NLS-1$ $NON-NLS-2$
    }
    super.renderEntryItemLinkAttributes(context, writer, tree, enabled, selected);
}
 
Example #27
Source File: AbstractApplicationLayoutRenderer.java    From XPagesExtensionLibrary with Apache License 2.0 5 votes vote down vote up
protected void writeLeftColumn(FacesContext context, ResponseWriter w, UIApplicationLayout c, BasicApplicationConfigurationImpl configuration) throws IOException {
    UIComponent left = c.getLeftColumn();
    if(!isEmptyComponent(left)) {
        if(DEBUG) {
            w.writeComment("Start Left Column"); // $NON-NLS-1$
            newLine(w);
        }
        w.startElement("div",c); // $NON-NLS-1$
        w.writeAttribute("role", "region", null); // $NON-NLS-1$ $NON-NLS-2$

        String leftColumnLabel = configuration.getLeftColumnLabel();
        if (StringUtil.isNotEmpty(leftColumnLabel)) {
            w.writeAttribute("aria-label", leftColumnLabel, null); // $NON-NLS-1$
        }

        String columnFirstClass = (String)getProperty(PROP_COLUMNFIRSTCLASS);
        if( StringUtil.isNotEmpty(columnFirstClass) ){
            w.writeAttribute("class",columnFirstClass,null); // $NON-NLS-1$
        }
        writeLeftColumnExtraAttributes(context, w, c, configuration);
        
        FacesUtil.renderComponent(context, left);
        w.endElement("div"); // $NON-NLS-1$
        newLine(w);
        if(DEBUG) {
            w.writeComment("End Left Column"); // $NON-NLS-1$
            newLine(w);
        }
    }
}
 
Example #28
Source File: WidgetContainerRenderer.java    From XPagesExtensionLibrary with Apache License 2.0 5 votes vote down vote up
@Override
public void encodeBegin(FacesContext context, UIComponent component) throws IOException {
    UIWidgetContainer container = (UIWidgetContainer)component;
    if(!container.isRendered()) {
        return;
    }
    ResponseWriter w = context.getResponseWriter();
    writeMainFrame(context, w, container);
}
 
Example #29
Source File: AbstractDataViewRenderer.java    From XPagesExtensionLibrary with Apache License 2.0 5 votes vote down vote up
@Override
public void encodeRows(FacesContext context, UIDataIterator iterator, int first, int rows) throws IOException {
    ResponseWriter w = context.getResponseWriter();
    AbstractDataView c = (AbstractDataView)iterator;

    ViewDefinition viewDef = createViewDefinition(context);
    initViewDefinition(context, c, viewDef);
    
    writeRows(context, w, c, viewDef, first, rows);
}
 
Example #30
Source File: R.java    From BootsFaces-OSP with Apache License 2.0 5 votes vote down vote up
/**
 * Decorate the facet children with a class to render bootstrap like
 * "prepend" and "append" sections
 * 
 * @param parent
 * @param comp
 * @param ctx
 * @param rw
 * @throws IOException
 */
public static void decorateFacetComponent(UIComponent parent, UIComponent comp, FacesContext ctx, ResponseWriter rw)
		throws IOException {
	/*
	 * System.out.println("COMPONENT CLASS = " + comp.getClass().getName());
	 * System.out.println("FAMILY = " + comp.getFamily());
	 * System.out.println("CHILD COUNT = " + comp.getChildCount());
	 * System.out.println("PARENT CLASS = " + comp.getParent().getClass());
	 * 
	 * 
	 * if (app.getClass().getName().endsWith("Button") ||
	 * (app.getChildCount() > 0 &&
	 * app.getChildren().get(0).getClass().getName().endsWith("Button"))) {
	 * rw.startElement("div", inputText); rw.writeAttribute("class",
	 * "input-group-btn", "class"); app.encodeAll(context);
	 * rw.endElement("div"); } else { if (app instanceof Icon) ((Icon)
	 * app).setAddon(true); rw.startElement("span", inputText);
	 * rw.writeAttribute("class", "input-group-addon", "class");
	 * app.encodeAll(context); rw.endElement("span"); }
	 */
	if (comp.getChildCount() >= 1 && comp.getClass().getName().endsWith("Panel")) {
		for (UIComponent child : comp.getChildren()) {
			decorateComponent(parent, child, ctx, rw);
		}
	} else {
		decorateComponent(parent, comp, ctx, rw);
	}
}