Java Code Examples for javax.faces.context.ResponseWriter#writeURIAttribute()

The following examples show how to use javax.faces.context.ResponseWriter#writeURIAttribute() . 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: HtmlSortHeaderRenderer.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
public void encodeEnd(FacesContext facesContext, UIComponent component) throws IOException {
	try{
		if(log.isDebugEnabled()) log.debug("encodeEnd rendering " + component);
		if(!UserRoleUtils.isEnabledOnUserRole(component)){
			super.encodeEnd(facesContext, component);
		}else{
			HtmlCommandSortHeader sortHeader = (HtmlCommandSortHeader) component;
			HtmlDataTable dataTable = sortHeader.findParentDataTable();

			if(sortHeader.isArrow() && sortHeader.getColumnName().equals(dataTable.getSortColumn())){
				ResponseWriter writer = facesContext.getResponseWriter();
				writer.write(HTML.NBSP_ENTITY);
				HtmlGraphicImage image = new HtmlGraphicImage();
				// String path =
				// facesContext.getExternalContext().getRequestContextPath();
				if(dataTable.isSortAscending()){
					// image.setValue(path + "/images/sortascending.gif");
					image.setValue("/library/image/sakai/sortascending.gif");
					image.setAlt("Sort by title ascending");
					image.setTitle("Sort by title ascending");
				}else{
					// image.setValue(path + "/images/sortdescending.gif");
					image.setValue("/library/image/sakai/sortdescending.gif");
					image.setAlt("Sort by title descending");
					image.setTitle("Sort by title descending");
				}

				writer.startElement(HTML.IMG_ELEM, image);
				writer.writeURIAttribute("src", image.getValue(), null);
				writer.writeAttribute("alt", image.getAlt(), null);
				writer.writeAttribute("title", image.getTitle(), null);
				writer.endElement(HTML.IMG_ELEM);
			}
			super.encodeEnd(facesContext, component);
		}
	}catch(Exception e){
		log.warn("Exception occurred in HtmlSortHeaderRenderer:" + e.getMessage());
	}
}
 
Example 2
Source File: HtmlSortHeaderRenderer.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
public void encodeEnd(FacesContext facesContext, UIComponent component)
		throws IOException {
	if (log.isDebugEnabled()) log.debug("encodeEnd rendering " + component);
	if (!UserRoleUtils.isEnabledOnUserRole(component)) {
           super.encodeEnd(facesContext, component);
       } else {
		HtmlCommandSortHeader sortHeader = (HtmlCommandSortHeader) component;
		HtmlDataTable dataTable = sortHeader.findParentDataTable();

		if (sortHeader.isArrow() && sortHeader.getColumnName().equals(dataTable.getSortColumn())) {
			ResponseWriter writer = facesContext.getResponseWriter();

               writer.write(HTML.NBSP_ENTITY);

               HtmlGraphicImage image = new HtmlGraphicImage();
               if (dataTable.isSortAscending()) {
                   image.setValue("/library/image/sakai/sortascending.gif");
                   image.setAlt(MessageFormat.format(rb.getString("sort_ascending"), sortHeader.getColumnName().toLowerCase()));
			} else {
                   image.setValue("/library/image/sakai/sortdescending.gif");
                   image.setAlt(MessageFormat.format(rb.getString("sort_descending"), sortHeader.getColumnName().toLowerCase()));
			}

               writer.startElement(HTML.IMG_ELEM, image);
               writer.writeURIAttribute("src", image.getValue(), null);
               writer.writeAttribute("alt",image.getAlt().toString(), null);
               writer.endElement(HTML.IMG_ELEM);
		}
           super.encodeEnd(facesContext, component);
	}
}
 
Example 3
Source File: HtmlSortHeaderRenderer.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
public void encodeEnd(FacesContext facesContext, UIComponent component) throws IOException {
	try{
		if(log.isDebugEnabled()) log.debug("encodeEnd rendering " + component);
		if(!UserRoleUtils.isEnabledOnUserRole(component)){
			super.encodeEnd(facesContext, component);
		}else{
			HtmlCommandSortHeader sortHeader = (HtmlCommandSortHeader) component;
			HtmlDataTable dataTable = sortHeader.findParentDataTable();

			if(sortHeader.isArrow() && sortHeader.getColumnName().equals(dataTable.getSortColumn())){
				ResponseWriter writer = facesContext.getResponseWriter();
				writer.write(HTML.NBSP_ENTITY);
				HtmlGraphicImage image = new HtmlGraphicImage();
				// String path =
				// facesContext.getExternalContext().getRequestContextPath();
				if(dataTable.isSortAscending()){
					// image.setValue(path + "/images/sortascending.gif");
					image.setValue("/library/image/sakai/sortascending.gif");
					image.setAlt("Sort by title ascending");
					image.setTitle("Sort by title ascending");
				}else{
					// image.setValue(path + "/images/sortdescending.gif");
					image.setValue("/library/image/sakai/sortdescending.gif");
					image.setAlt("Sort by title descending");
					image.setTitle("Sort by title descending");
				}

				writer.startElement(HTML.IMG_ELEM, image);
				writer.writeURIAttribute("src", image.getValue(), null);
				writer.writeAttribute("alt", image.getAlt(), null);
				writer.writeAttribute("title", image.getTitle(), null);
				writer.endElement(HTML.IMG_ELEM);
			}
			super.encodeEnd(facesContext, component);
		}
	}catch(Exception e){
		log.warn("Exception occurred in HtmlSortHeaderRenderer:" + e.getMessage());
	}
}
 
Example 4
Source File: HtmlSortHeaderRenderer.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
public void encodeEnd(FacesContext facesContext, UIComponent component)
		throws IOException {
	if (log.isDebugEnabled()) log.debug("encodeEnd rendering " + component);
	if (!UserRoleUtils.isEnabledOnUserRole(component)) {
           super.encodeEnd(facesContext, component);
       } else {
		HtmlCommandSortHeader sortHeader = (HtmlCommandSortHeader) component;
		HtmlDataTable dataTable = sortHeader.findParentDataTable();

		if (sortHeader.isArrow() && sortHeader.getColumnName().equals(dataTable.getSortColumn())) {
			ResponseWriter writer = facesContext.getResponseWriter();

               writer.write(HTML.NBSP_ENTITY);

               HtmlGraphicImage image = new HtmlGraphicImage();
               String path = facesContext.getExternalContext().getRequestContextPath();
               if (dataTable.isSortAscending()) {
                   image.setValue(path + "/images/sortascending.gif");
			} else {
                   image.setValue(path + "/images/sortdescending.gif");
			}

               writer.startElement(HTML.IMG_ELEM, image);
               writer.writeURIAttribute("src", image.getValue(), null);
               writer.endElement(HTML.IMG_ELEM);
		}
           super.encodeEnd(facesContext, component);
	}
}
 
Example 5
Source File: ResponsiveAppLayoutRenderer.java    From XPagesExtensionLibrary with Apache License 2.0 5 votes vote down vote up
protected void writeLegalLogo(FacesContext context, ResponseWriter w, UIApplicationLayout c, BasicApplicationConfigurationImpl configuration) throws IOException {
    String logoImg=configuration.getLegalLogo();
    if(StringUtil.isNotEmpty(logoImg)) {
        w.startElement("span", c); // $NON-NLS-1$
        String clazz=configuration.getLegalLogoClass();
        if(StringUtil.isNotEmpty(clazz)) {
            w.writeAttribute("class", clazz, null); // $NON-NLS-1$
        }
        String style=ExtLibUtil.concatStyles("float:left;vertical-align:middle;margin-right: 5px;", configuration.getLegalLogoStyle()); // $NON-NLS-1$
        if(StringUtil.isNotEmpty(style)) {
            w.writeAttribute("style", style, null); // $NON-NLS-1$
        }
        String imgSrc=HtmlRendererUtil.getImageURL(context, logoImg);
        w.startElement("img", c); // $NON-NLS-1$
        w.writeURIAttribute("src", imgSrc, null); // $NON-NLS-1$
        String logoAlt=configuration.getLegalLogoAlt();
        if(!ExtLibRenderUtil.isAltPresent(logoAlt)) {
            logoAlt = com.ibm.xsp.extlib.controls.ResourceHandler.getString("AbstractApplicationLayoutRenderer.LegalLogo"); // $NON-NLS-1$
        }
        w.writeAttribute("alt", logoAlt, null); // $NON-NLS-1$
        String width=configuration.getLegalLogoWidth();
        if(StringUtil.isNotEmpty(width)) {
            w.writeAttribute("width", width, null); // $NON-NLS-1$
        }
        String height=configuration.getLegalLogoHeight();
        if(StringUtil.isNotEmpty(height)) {
            w.writeAttribute("height", height, null); // $NON-NLS-1$
        }
        w.endElement("img"); // $NON-NLS-1$
        w.endElement("span"); // $NON-NLS-1$
    }
}
 
Example 6
Source File: SimpleResponsiveLayoutRenderer.java    From XPagesExtensionLibrary with Apache License 2.0 5 votes vote down vote up
protected void writeNavbarProductlogo(FacesContext context, ResponseWriter w, UIApplicationLayout c, SimpleResponsiveApplicationConfiguration configuration) throws IOException {
    
    w.startElement("div",c); // $NON-NLS-1$
    
    String style = configuration.getNavbarLogoStyle();
    if(StringUtil.isNotEmpty(style)) {
        w.writeAttribute("style",style,null); // $NON-NLS-1$
    }
    
    String logoImg  = configuration.getNavbarLogo();
    String logoAlt  = configuration.getNavbarLogoAlt();
    
    if(StringUtil.isNotEmpty(logoImg)) {
        String clazz = ExtLibUtil.concatStyleClasses("navbar-brand-img", configuration.getNavbarLogoStyleClass()); // $NON-NLS-1$
        w.writeAttribute("class", clazz, null); // $NON-NLS-1$
        
        String imgSrc = HtmlRendererUtil.getImageURL(context, logoImg);
        w.startElement("img",c); // $NON-NLS-1$
        w.writeURIAttribute("src",imgSrc,null); // $NON-NLS-1$
   
        if(ExtLibRenderUtil.isAltPresent(logoAlt)) {
            w.writeAttribute("alt",logoAlt,null); // $NON-NLS-1$
        }
        w.endElement("img"); // $NON-NLS-1$
        
    }

    w.endElement("div"); // $NON-NLS-1$

}
 
Example 7
Source File: AbstractApplicationLayoutRenderer.java    From XPagesExtensionLibrary with Apache License 2.0 5 votes vote down vote up
protected void writeBannerLink(FacesContext context, ResponseWriter w, UIApplicationLayout c, BasicApplicationConfigurationImpl configuration) throws IOException {
    w.startElement("a",c);
    
    String href = (String) getProperty(PROP_BANNERLINKHREF);
    if( null == href || '#' != href.charAt(0) ){
        href="#"; //$NON-NLS-1$
    }
    w.writeAttribute("href",href,null); // $NON-NLS-1$
    
    String accesskey = (String) getProperty(PROP_BANNERLINKACCESSKEY);
    if( null != accesskey ){
        w.writeAttribute("accesskey", accesskey, null); // $NON-NLS-1$
    }
    String styleClass = (String) getProperty(PROP_BANNERLINKCLASS);
    if( StringUtil.isNotEmpty(styleClass) ){
        w.writeAttribute("class",styleClass,null); // $NON-NLS-1$
    }
    
    w.startElement("img",c); // $NON-NLS-1$
    String bgif = (String)getProperty(PROP_BLANKIMG);
    if(StringUtil.isNotEmpty(bgif)) {
        w.writeURIAttribute("src",HtmlRendererUtil.getImageURL(context,bgif),null); // $NON-NLS-1$
    }
    //TODO consider removing - don't think its used
    String alt = (String) getProperty(PROP_BANNERLINKALT);
    if( !isAltNotEmpty(alt) ){
        alt = "Banner Link"; // // $NON-NLS-1$
    }
    w.writeAttribute("alt",alt,null); // $NON-NLS-1$
    w.endElement("img"); // $NON-NLS-1$
    w.endElement("a"); // $NON-NLS-1$
}
 
Example 8
Source File: GoogleSearch.java    From XPagesExtensionLibrary with Apache License 2.0 5 votes vote down vote up
private void renderLink(ResponseWriter writer, UIComponent component, String value) throws IOException {
    writer.startElement("a", component);
    String lk = "http://www.google.com/search?q="+value; // $NON-NLS-1$
    writer.writeURIAttribute("href", lk, null); // $NON-NLS-1$
    writer.writeAttribute("target", "_blank", null); // $NON-NLS-1$ $NON-NLS-2$
    writer.writeAttribute("title", "Google search link", null); // $NON-NLS-1$ $NLS-GoogleSearch.Googlesearchlink-2$
    if(null != value && StringUtil.isNotEmpty(value)) {
        writer.writeText(value, null);
    }else{
        writer.writeAttribute("style", "display:none", null); // $NON-NLS-1$ $NON-NLS-2$
    }
    writer.endElement("a");
}
 
Example 9
Source File: HtmlSortHeaderRenderer.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
public void encodeEnd(FacesContext facesContext, UIComponent component)
		throws IOException {
	if (log.isDebugEnabled()) log.debug("encodeEnd rendering " + component);
	if (!UserRoleUtils.isEnabledOnUserRole(component)) {
           super.encodeEnd(facesContext, component);
       } else {
		HtmlCommandSortHeader sortHeader = (HtmlCommandSortHeader) component;
		HtmlDataTable dataTable = sortHeader.findParentDataTable();

		if (sortHeader.isArrow() && sortHeader.getColumnName().equals(dataTable.getSortColumn())) {
			ResponseWriter writer = facesContext.getResponseWriter();

               writer.write(HTML.NBSP_ENTITY);

               HtmlGraphicImage image = new HtmlGraphicImage();
               if (dataTable.isSortAscending()) {
                   image.setValue("/library/image/sakai/sortascending.gif");
                   image.setAlt(MessageFormat.format(rb.getString("sort_ascending"), sortHeader.getColumnName().toLowerCase()));
			} else {
                   image.setValue("/library/image/sakai/sortdescending.gif");
                   image.setAlt(MessageFormat.format(rb.getString("sort_descending"), sortHeader.getColumnName().toLowerCase()));
			}

               writer.startElement(HTML.IMG_ELEM, image);
               writer.writeURIAttribute("src", image.getValue(), null);
               writer.writeAttribute("alt",image.getAlt().toString(), null);
               writer.endElement(HTML.IMG_ELEM);
		}
           super.encodeEnd(facesContext, component);
	}
}
 
Example 10
Source File: HtmlSortHeaderRenderer.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
public void encodeEnd(FacesContext facesContext, UIComponent component)
		throws IOException {
	if (log.isDebugEnabled()) log.debug("encodeEnd rendering " + component);
	if (!UserRoleUtils.isEnabledOnUserRole(component)) {
           super.encodeEnd(facesContext, component);
       } else {
		HtmlCommandSortHeader sortHeader = (HtmlCommandSortHeader) component;
		HtmlDataTable dataTable = sortHeader.findParentDataTable();

		if (sortHeader.isArrow() && sortHeader.getColumnName().equals(dataTable.getSortColumn())) {
			ResponseWriter writer = facesContext.getResponseWriter();

               writer.write(HTML.NBSP_ENTITY);

               HtmlGraphicImage image = new HtmlGraphicImage();
               String path = facesContext.getExternalContext().getRequestContextPath();
               if (dataTable.isSortAscending()) {
                   image.setValue(path + "/images/sortascending.gif");
			} else {
                   image.setValue(path + "/images/sortdescending.gif");
			}

               writer.startElement(HTML.IMG_ELEM, image);
               writer.writeURIAttribute("src", image.getValue(), null);
               writer.endElement(HTML.IMG_ELEM);
		}
           super.encodeEnd(facesContext, component);
	}
}
 
Example 11
Source File: AbstractApplicationLayoutRenderer.java    From XPagesExtensionLibrary with Apache License 2.0 4 votes vote down vote up
protected void writeBannerProductlogo(FacesContext context, ResponseWriter w, UIApplicationLayout c, BasicApplicationConfigurationImpl configuration) throws IOException {
    w.startElement("span",c); // $NON-NLS-1$
    
    String clazz = ExtLibUtil.concatStyleClasses((String)getProperty(PROP_PRODUCTLOGOCLASS),configuration.getProductLogoClass());
    if(StringUtil.isNotEmpty(clazz)) {
        w.writeAttribute("class",clazz,null); // $NON-NLS-1$
    }
   
    String style = ExtLibUtil.concatStyles((String)getProperty(PROP_PRODUCTLOGOSTYLE),configuration.getProductLogoStyle());
    if(StringUtil.isNotEmpty(style)) {
        w.writeAttribute("style",style,null); // $NON-NLS-1$
    }

    String logoImg = configuration.getProductLogo();
    if(StringUtil.isEmpty(logoImg)) {
        logoImg = (String)getProperty(PROP_PRODUCTLOGO);
    }
    if(StringUtil.isNotEmpty(logoImg)) {
        String imgSrc = HtmlRendererUtil.getImageURL(context, logoImg);
        w.startElement("img",c); // $NON-NLS-1$
        w.writeURIAttribute("src",imgSrc,null); // $NON-NLS-1$
        String logoAlt = configuration.getProductLogoAlt();
        if(StringUtil.isEmpty(logoAlt)) {
            logoAlt = (String)getProperty(PROP_PRODUCTLOGOALT);
        }
        if(!isAltNotEmpty(logoAlt)) {
            logoAlt = "Banner Product Logo"; // $NLS-AbstractApplicationLayoutRenderer.BannerProductLogo-1$
        }
        w.writeAttribute("alt",logoAlt,null); // $NON-NLS-1$
        String width = configuration.getProductLogoWidth();
        if(StringUtil.isEmpty(width)) {
            width = (String)getProperty(PROP_PRODUCTLOGOWIDTH);
        }
        if(StringUtil.isNotEmpty(width)) {
            w.writeAttribute("width",width,null); // $NON-NLS-1$
        }
        String height = configuration.getProductLogoHeight();
        if(StringUtil.isEmpty(height)) {
            height = (String)getProperty(PROP_PRODUCTLOGOHEIGHT);
        }
        if(StringUtil.isNotEmpty(height)) {
            w.writeAttribute("height",height,null); // $NON-NLS-1$
        }
        w.endElement("img"); // $NON-NLS-1$
    }

    w.endElement("span"); // $NON-NLS-1$
}
 
Example 12
Source File: AbstractApplicationLayoutRenderer.java    From XPagesExtensionLibrary with Apache License 2.0 4 votes vote down vote up
protected void writeLegalLogo(FacesContext context, ResponseWriter w, UIApplicationLayout c, BasicApplicationConfigurationImpl configuration) throws IOException {
    String logoImg = configuration.getLegalLogo();
    if(StringUtil.isEmpty(logoImg)) {
        logoImg = (String)getProperty(PROP_LEGALLOGO);
    }
    if(StringUtil.isNotEmpty(logoImg)) {
        w.startElement("td",c); // $NON-NLS-1$
        w.startElement("span",c); // $NON-NLS-1$
        String clazz = ExtLibUtil.concatStyleClasses((String)getProperty(PROP_LEGALLOGOCLASS),configuration.getLegalLogoClass());
        if(StringUtil.isNotEmpty(clazz)) {
            w.writeAttribute("class",clazz,null); // $NON-NLS-1$
        }
        String style = ExtLibUtil.concatStyles((String)getProperty(PROP_LEGALLOGOSTYLE),configuration.getLegalLogoStyle());
        if(StringUtil.isNotEmpty(style)) {
            w.writeAttribute("style",style,null); // $NON-NLS-1$
        }
        String imgSrc = HtmlRendererUtil.getImageURL(context, logoImg);
        w.startElement("img",c); // $NON-NLS-1$
        //w.writeAttribute("class","lotusIBMLogoFooter",null);
        w.writeURIAttribute("src",imgSrc,null); // $NON-NLS-1$
        String logoAlt = configuration.getLegalLogoAlt();
        if(!isAltNotEmpty(logoAlt)) {
            logoAlt = "Legal Logo"; // $NLS-AbstractApplicationLayoutRenderer.LegalLogo-1$
        }
        w.writeAttribute("alt",logoAlt,null); // $NON-NLS-1$
        String width = configuration.getLegalLogoWidth();
        if(StringUtil.isEmpty(width)) {
            width = (String)getProperty(PROP_LEGALLOGOWIDTH);
        }
        if(StringUtil.isNotEmpty(width)) {
            w.writeAttribute("width",width,null); // $NON-NLS-1$
        }
        String height = configuration.getLegalLogoHeight();
        if(StringUtil.isEmpty(height)) {
            height = (String)getProperty(PROP_LEGALLOGOHEIGHT);
        }
        if(StringUtil.isNotEmpty(height)) {
            w.writeAttribute("height",height,null); // $NON-NLS-1$
        }
        w.endElement("img"); // $NON-NLS-1$
        w.endElement("span"); // $NON-NLS-1$
        w.endElement("td"); // $NON-NLS-1$
    }
}
 
Example 13
Source File: WidgetContainerRenderer.java    From XPagesExtensionLibrary with Apache License 2.0 4 votes vote down vote up
protected void writeCollapsible(FacesContext context, ResponseWriter w, UIWidgetContainer c) throws IOException {
    if(c.isCollapsible()) {
        boolean closed = c.isClosed();
        String id = c.getClientId(context);

        //Open twisty
        w.startElement("span",c); // $NON-NLS-1$
        w.writeAttribute("id",id+_OPENED,null); // $NON-NLS-1$
        if(closed){
            w.writeAttribute("style", _DISPLAY_NONE, null);  // $NON-NLS-1$
        } else {
            w.writeAttribute("style", _DISPLAY_BLOCK, null);  // $NON-NLS-1$
        }
        w.startElement("a",c);
        w.writeAttribute("id",id+_LKOPENED,null); // $NON-NLS-1$
        String clsLk = (String)getProperty(PROP_TWISTYCLASSLINK);
        if(StringUtil.isNotEmpty(clsLk)) {
            w.writeAttribute("class",clsLk,null); // $NON-NLS-1$
        }
        w.writeAttribute("role","button",null); // $NON-NLS-1$ $NON-NLS-2$
        w.writeAttribute("href","javascript:;",null); // $NON-NLS-1$ $NON-NLS-2$
        w.writeAttribute("title","click to collapse the section",null); // $NON-NLS-1$ $NLS-WidgetContainerRenderer.clicktocollapsethesection-2$

        if (closed) {
            // accesskey
            String accesskey = c.getAccesskey();
            if (StringUtil.isNotEmpty(accesskey)) {
                w.writeAttribute("accesskey", accesskey, null); // tabindex $NON-NLS-1$
            }
            // tabindex
            String tabindex = c.getTabindex();
            if (StringUtil.isNotEmpty(tabindex)) {
                w.writeAttribute("tabindex", tabindex, null); // tabindex $NON-NLS-1$
            } else {
                w.writeAttribute("tabindex", "0", null); // tabindex $NON-NLS-1$
            }
        }
        
        w.startElement("span",c); // $NON-NLS-1$
        w.writeAttribute("class","lotusAltText", null); // $NON-NLS-1$ $NON-NLS-2$
        // up arrow
        w.writeText("\u25B2", null);  // //$NON-NLS-1$
        //<span class="lotusAltText">&#x25bc;</span></a>
        w.endElement("span"); //$NON-NLS-1$

        w.startElement("img",c); // $NON-NLS-1$
        String collapseStr = "Collapse section"; // $NLS-WidgetContainerRenderer.Collapsesection-1$
        w.writeAttribute("aria-label",collapseStr,null); // $NON-NLS-1$
        w.writeAttribute("alt",collapseStr,null); // $NON-NLS-1$
        String bgif = (String)getProperty(PROP_BLANKIMG);
        if(StringUtil.isNotEmpty(bgif)) {
            w.writeURIAttribute("src",HtmlRendererUtil.getImageURL(context,bgif),null); // $NON-NLS-1$
        }
        String clsOpen = (String)getProperty(PROP_TWISTYCLASSIMGOPEN);
        if(StringUtil.isNotEmpty(clsOpen)) {
            w.writeAttribute("class",clsOpen,null); // $NON-NLS-1$
        }

        w.endElement("a"); //$NON-NLS-1$
        w.endElement("span"); //$NON-NLS-1$
        
        //Close twisty
        w.startElement("span",c); // $NON-NLS-1$
        w.writeAttribute("id",id+_CLOSED,null); // $NON-NLS-1$
        if(closed){
            w.writeAttribute("style", _DISPLAY_BLOCK, null);  // $NON-NLS-1$
        } else {
            w.writeAttribute("style", _DISPLAY_NONE, null);  // $NON-NLS-1$
        }
        w.startElement("a",c);
        w.writeAttribute("id",id+_LKCLOSED,null); // $NON-NLS-1$
        if(StringUtil.isNotEmpty(clsLk)) {
            w.writeAttribute("class",clsLk,null); // $NON-NLS-1$
        }
        w.writeAttribute("role","button",null); // $NON-NLS-1$ $NON-NLS-2$
        w.writeAttribute("href","javascript:;",null); // $NON-NLS-1$ $NON-NLS-2$
        w.writeAttribute("title","click to expand the section",null); // $NON-NLS-1$ $NLS-WidgetContainerRenderer.clicktoexpandthesection-2$

        w.startElement("span",c); // $NON-NLS-1$
        w.writeAttribute("class","lotusAltText", null); // $NON-NLS-1$ $NON-NLS-2$
        // down arrow
        w.writeText("\u25BC", null);  // //$NON-NLS-1$
        //<span class="lotusAltText">&#x25bc;</span></a>
        w.endElement("span"); //$NON-NLS-1$

        w.startElement("img",c); // $NON-NLS-1$
        String expandStr = "Expand section"; //$NLS-WidgetContainerRenderer.Expandsection-1$
        w.writeAttribute("aria-label",expandStr,null); // $NON-NLS-1$ 
        w.writeAttribute("alt",expandStr,null); // $NON-NLS-1$
        if(StringUtil.isNotEmpty(bgif)) {
            w.writeURIAttribute("src",HtmlRendererUtil.getImageURL(context,bgif),null); // $NON-NLS-1$
        }
        String clsClose = (String)getProperty(PROP_TWISTYCLASSIMGCLOSE);
        if(StringUtil.isNotEmpty(clsClose)) {
            w.writeAttribute("class",clsClose,null); // $NON-NLS-1$
        }

        w.endElement("a"); //$NON-NLS-1$
        w.endElement("span"); //$NON-NLS-1$
    }
}
 
Example 14
Source File: OneUIv302WidgetContainerRenderer.java    From XPagesExtensionLibrary with Apache License 2.0 4 votes vote down vote up
@Override
protected void writeBodyScrollUp(FacesContext context, ResponseWriter w, UIWidgetContainer c) throws IOException {
    if(!c.isDisableScrollUp()) {
        w.startElement("div", c); // $NON-NLS-1$
        String clsDiv = (String)getProperty(PROP_CSSSCROLLUP);
        if(StringUtil.isNotEmpty(clsDiv)) {
            w.writeAttribute("class", clsDiv, null); // $NON-NLS-1$
        }
        w.startElement("a", c); // $NON-NLS-1$
        String clsA = (String)getProperty(PROP_CSSSCROLLUPLINK);
        if(StringUtil.isNotEmpty(clsA)) {
            w.writeAttribute("class", clsA, null); // $NON-NLS-1$
        }
        w.writeAttribute("href","javascript:;",null); // $NON-NLS-1$ $NON-NLS-2$
        String script = EventHandlerUtil.getEventScript(context, c, "onScrollUp"); // $NON-NLS-1$
        if(StringUtil.isNotEmpty(script)) {
            w.writeAttribute("onClick", script, null); // $NON-NLS-1$
        }
        w.writeAttribute("title","Scroll up",null); // $NON-NLS-1$ $NLS-WidgetContainerRenderer.Scrollup-2$
        String upImg = (String)getProperty(PROP_CSSSCROLLUPIMAGE);
        w.startElement("img", c); // $NON-NLS-1$
        if(StringUtil.isNotEmpty(upImg)){
            w.writeAttribute("class", upImg, null); // $NON-NLS-1$
        }
        
        String blankImg = (String)getProperty(PROP_BLANKIMG);
        if(StringUtil.isNotEmpty(blankImg)) {
            w.writeURIAttribute("src",HtmlRendererUtil.getImageURL(context,blankImg),null); // $NON-NLS-1$
        }
        w.writeAttribute("alt", "", null); // $NON-NLS-1$
        
        String alt = (String)getProperty(PROP_CSSSCROLLUPALTTEXT);
        if(StringUtil.isNotEmpty(alt)) {
            w.startElement("span", c); // $NON-NLS-1$
            w.writeAttribute("class", "lotusAltText", null); //$NON-NLS-1$ //$NON-NLS-2$
            w.writeText(alt, null);
            w.endElement("span"); // $NON-NLS-1$
        }
        w.endElement("a"); // $NON-NLS-1$
        w.endElement("div"); // $NON-NLS-1$
    }
}
 
Example 15
Source File: OneUIv302WidgetContainerRenderer.java    From XPagesExtensionLibrary with Apache License 2.0 4 votes vote down vote up
@Override
protected void writeBodyScrollDown(FacesContext context, ResponseWriter w, UIWidgetContainer c) throws IOException {
    if(!c.isDisableScrollDown()) {
        w.startElement("div", c); // $NON-NLS-1$
        String clsDiv = (String)getProperty(PROP_CSSSCROLLDOWN);
        if(StringUtil.isNotEmpty(clsDiv)) {
            w.writeAttribute("class", clsDiv, null); // $NON-NLS-1$
        }
        w.startElement("a", c); // $NON-NLS-1$
        String clsA = (String)getProperty(PROP_CSSSCROLLDOWNLINK);
        if(StringUtil.isNotEmpty(clsA)) {
            w.writeAttribute("class", clsA, null); // $NON-NLS-1$
        }
        w.writeAttribute("href","javascript:;",null); // $NON-NLS-1$ $NON-NLS-2$
        String script = EventHandlerUtil.getEventScript(context, c, "onScrollDown"); // $NON-NLS-1$
        if(StringUtil.isNotEmpty(script)) {
            w.writeAttribute("onClick", script, null); // $NON-NLS-1$
        }
        w.writeAttribute("title","Scroll down",null); // $NON-NLS-1$ $NLS-WidgetContainerRenderer.Scrolldown-2$
        String dwnImg = (String)getProperty(PROP_CSSSCROLLDOWNIMAGE);
        w.startElement("img", c); // $NON-NLS-1$
        if(StringUtil.isNotEmpty(dwnImg)){
            w.writeAttribute("class", dwnImg, null); // $NON-NLS-1$
        }
        
        String blankImg = (String)getProperty(PROP_BLANKIMG);
        if(StringUtil.isNotEmpty(blankImg)) {
            w.writeURIAttribute("src",HtmlRendererUtil.getImageURL(context,blankImg),null); // $NON-NLS-1$
        }
        
        w.writeAttribute("alt", "", null); // $NON-NLS-1$
        
        String alt = (String)getProperty(PROP_CSSSCROLLDOWNALTTEXT);
        if(StringUtil.isNotEmpty(alt)) {
            w.startElement("span", c); // $NON-NLS-1$
            w.writeAttribute("class", "lotusAltText", null); //$NON-NLS-1$ //$NON-NLS-2$
            w.writeText(alt, null);
            w.endElement("span"); // $NON-NLS-1$
        }
        w.endElement("a"); // $NON-NLS-1$
        w.endElement("div"); // $NON-NLS-1$
    }
}
 
Example 16
Source File: OneUIv3PlaceBarActionsRenderer.java    From XPagesExtensionLibrary with Apache License 2.0 4 votes vote down vote up
@Override
protected void renderPopupButton(FacesContext context, ResponseWriter writer, TreeContextImpl tree, boolean enabled, boolean selected) throws IOException {
    writer.startElement("a",null);
    
    // A popup button requires an id
    String clientId = tree.getClientId(context,"ab",1); // $NON-NLS-1$
    if(StringUtil.isNotEmpty(clientId)) {
        writer.writeAttribute("id", clientId, null); // $NON-NLS-1$
    }
    
    writer.writeAttribute("href", "javascript:;", null); // $NON-NLS-1$ $NON-NLS-2$

    String image = tree.getNode().getImage();
    boolean hasImage = StringUtil.isNotEmpty(image);
    if(hasImage) {
        writer.startElement("img",null); // $NON-NLS-1$
        if(StringUtil.isNotEmpty(image)) {
            image = HtmlRendererUtil.getImageURL(context, image);
            writer.writeURIAttribute("src",image,null); // $NON-NLS-1$
        }
        writer.endElement("img"); // $NON-NLS-1$
    }
    
    // Render the text
    String label = tree.getNode().getLabel();
    if(StringUtil.isNotEmpty(label)) {
        writer.writeText(label, "label"); // $NON-NLS-1$
    }

    // Render the popup image (down arrow)
    // Uniquely if it has multiple choices
    if(tree.getNode().getType()!=ITreeNode.NODE_LEAF) {
        writer.startElement("img",null); // $NON-NLS-1$
        //writer.writeAttribute("class","yourProductSprite yourProductSprite-btnDropDown2",null); // $NON-NLS-1$ $NON-NLS-2$
        writer.writeAttribute("src",HtmlRendererUtil.getImageURL(context,OneUIResources.get().DROPDOWN_PNG),null); // $NON-NLS-1$
        writer.writeAttribute("aria-label","Show Menu",null);  // $NON-NLS-1$ $NLS-OneUIv3PlaceBarActionsRenderer.ShowMenu-2$
        writer.writeAttribute("alt","Show Menu",null);  // $NON-NLS-1$ $NLS-OneUIv3PlaceBarActionsRenderer.ShowMenu.1-2$
        writer.endElement("img"); // $NON-NLS-1$
        writer.startElement("span",null); // $NON-NLS-1$
        writer.writeAttribute("class","lotusAltText",null); // $NON-NLS-1$ $NON-NLS-2$
        writer.writeText("\u25BC", null); //$NON-NLS-1$
        writer.endElement("span"); // $NON-NLS-1$
    }

    writer.endElement("a");
    JSUtil.writeln(writer);
}
 
Example 17
Source File: ImageRenderer.java    From BootsFaces-OSP with Apache License 2.0 4 votes vote down vote up
/**
 * This methods generates the HTML code of the current b:image.
 *
 * @param context
 *            the FacesContext.
 * @param component
 *            the current b:image.
 * @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;
	}
	Image image = (Image) component;
	ResponseWriter rw = context.getResponseWriter();
	String clientId = image.getClientId();
	
	boolean useXHRLoader = false;
	if (image.getOnloadend()!= null || image.getOnloadstart() != null || image.getOnprogress() != null) {
		useXHRLoader = true;
	}

	rw.startElement("img", image);
	Tooltip.generateTooltip(context, image, rw);
	rw.writeAttribute("id", clientId, "id");
	if (!useXHRLoader) {
		rw.writeURIAttribute("src", getImageSource(context, component), "value");
	}

	renderPassThruAttributes(context, image, new String[] { "alt", "height", "lang", "style", "title", "width" });

	String styleClass = image.getStyleClass();
	if (null == styleClass)
		styleClass = Responsive.getResponsiveStyleClass(image, false);
	else
		styleClass += Responsive.getResponsiveStyleClass(image, false);
	if (styleClass != null && styleClass.trim().length() > 0) {
		writeAttribute(rw, "class", styleClass, "styleClass");
	}

	AJAXRenderer.generateBootsFacesAJAXAndJavaScript(FacesContext.getCurrentInstance(), image, rw, false);

	rw.endElement("img");
	if (useXHRLoader) {
		rw.startElement("script", image);
		rw.writeText("document.getElementById('" + clientId + "').load('" + getImageSource(context, component) + "', " 
		+ getJSFunction(image.getOnloadstart()) + "," + getJSFunction(image.getOnprogress())
		+ ", " + getJSFunction(image.getOnloadend()) + ");", null);
		rw.endElement("script");
	}
	Tooltip.activateTooltips(context, image);
}