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

The following examples show how to use javax.faces.context.ResponseWriter#writeComment() . 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: AbstractApplicationLayoutRenderer.java    From XPagesExtensionLibrary with Apache License 2.0 6 votes vote down vote up
protected void writeBannerContent(FacesContext context, ResponseWriter w, UIApplicationLayout c, BasicApplicationConfigurationImpl configuration) throws IOException {
    if(DEBUG) {
        w.writeComment("Start Banner"); // $NON-NLS-1$
        newLine(w);
    }
    //TWET97XJZA: Unnecessary now. Replaced by role='main' on lotusContent div
    //writeBannerLink(context, w, c, configuration);
    writeBannerProductlogo(context, w, c, configuration);
    newLine(w);
    writeBannerUtilityLinks(context, w, c, configuration);
    newLine(w);
    writeBannerApplicationLinks(context, w, c, configuration);
    newLine(w);
    if(DEBUG) {
        w.writeComment("End Banner"); // $NON-NLS-1$
        newLine(w);
    }
}
 
Example 2
Source File: AbstractApplicationLayoutRenderer.java    From XPagesExtensionLibrary with Apache License 2.0 6 votes vote down vote up
protected void writeContentColumn(FacesContext context, ResponseWriter w, UIApplicationLayout c, BasicApplicationConfigurationImpl configuration) throws IOException {
    if(!isEmptyChildren(c)) {
        if(DEBUG) {
            w.writeComment("Start Content Column"); // $NON-NLS-1$
            newLine(w);
        }
        w.startElement("div",c); // $NON-NLS-1$
        String mainContentClass = (String)getProperty(PROP_MAINCONTENTCLASS);
        if( StringUtil.isNotEmpty(mainContentClass) ){
            w.writeAttribute("class",mainContentClass,null); // $NON-NLS-1$
        }
        String mainContentRole = (String)getProperty(PROP_MAINCONTENTROLE);
        if( StringUtil.isNotEmpty(mainContentRole) ){
            w.writeAttribute("role",mainContentRole,null); // $NON-NLS-1$
        }
        writeContentColumnExtraAttributes(context, w, c, configuration);
        renderChildren(context, c);
        w.endElement("div"); // $NON-NLS-1$
        newLine(w);
        if(DEBUG) {
            w.writeComment("End Content Column"); // $NON-NLS-1$
            newLine(w);
        }
    }
}
 
Example 3
Source File: ResponsiveAppLayoutRenderer.java    From XPagesExtensionLibrary with Apache License 2.0 5 votes vote down vote up
protected void writeContentColumn(FacesContext context, ResponseWriter w, UIApplicationLayout c, int size, BasicApplicationConfigurationImpl configuration) throws IOException {
    if (!isEmptyChildren(c)) {
        if (DEBUG) {
            w.writeComment("Start Content Column"); // $NON-NLS-1$
            newLine(w);
        }
        w.startElement("div", c); // $NON-NLS-1$
        
        boolean left = !isEmptyComponent(c.getLeftColumn());
        boolean right = !isEmptyComponent(c.getRightColumn());
        
        String mdCol = (String)getProperty(PROP_COLUMN_MEDIUM) + size;
        String smCol = (String)getProperty(PROP_COLUMN_SMALL) + (size + (left ? -1 : 0) + (right ? -1 : 0)) ;
        String contentColClass = "applayout-content"; // $NON-NLS-1$
        String colClass = ExtLibUtil.concatStyleClasses(mdCol, smCol);
        colClass        = ExtLibUtil.concatStyleClasses(colClass, contentColClass);
        
        if (StringUtil.isNotEmpty(colClass)) {
            w.writeAttribute("class", colClass, null); // $NON-NLS-1$
        }
        
        renderChildren(context, c);
        
        w.endElement("div"); // $NON-NLS-1$
        newLine(w); // $NON-NLS-1$
        
        if (DEBUG) {
            w.writeComment("End Content Column"); // $NON-NLS-1$
            newLine(w);
        }
    }
}
 
Example 4
Source File: ResponsiveAppLayoutRenderer.java    From XPagesExtensionLibrary with Apache License 2.0 5 votes vote down vote up
protected void writeBannerContent(FacesContext context, ResponseWriter w, UIApplicationLayout c, BasicApplicationConfigurationImpl configuration) throws IOException {
    if (DEBUG) {
        w.writeComment("Start Banner"); // $NON-NLS-1$
        newLine(w);
    }

    boolean hasChildren = c.getChildCount() > 0;
    ITree appLinks      = TreeImpl.get(configuration.getBannerApplicationLinks());
    ITree utilityLinks  = TreeImpl.get(configuration.getBannerUtilityLinks());
    boolean bannerHasContent = hasChildren || appLinks != null || utilityLinks != null;
    
    w.startElement("div", c); // $NON-NLS-1$
    w.writeAttribute("class", "navbar-header", null);       // $NON-NLS-1$ $NON-NLS-2$
    
    if(bannerHasContent) {
        writeBannerLink(context, w, c, configuration);
    }
    newLine(w);
    writeBannerProductlogo(context, w, c, configuration);
    
    w.endElement("div"); // $NON-NLS-1$
    
    w.startElement("div", c); // $NON-NLS-1$
    w.writeAttribute("class",  ExtLibUtil.concatStyleClasses((String)getProperty(PROP_BANNER_COLLAPSE_CLASS), "navbar-collapse collapse"), null); // $NON-NLS-1$ $NON-NLS-2$
    newLine(w);
    
    writeBannerApplicationLinks(context, w, c, configuration);
    newLine(w);
    writeBannerUtilityLinks(context, w, c, configuration);
    newLine(w);
    
    w.endElement("div"); // $NON-NLS-1$
    newLine(w, ""); // $NON-NLS-1$
    
    if (DEBUG) {
        w.writeComment("End Banner"); // $NON-NLS-1$
        newLine(w);
    }
}
 
Example 5
Source File: ResponsiveAppLayoutRenderer.java    From XPagesExtensionLibrary with Apache License 2.0 5 votes vote down vote up
protected void writeMastFooter(FacesContext context, ResponseWriter w, UIApplicationLayout c, BasicApplicationConfigurationImpl configuration) throws IOException {
    UIComponent mastFooter = c.getMastFooter();
    if (!isEmptyComponent(mastFooter)) {
        if (DEBUG) {
            w.writeComment("Start Mast Footer"); // $NON-NLS-1$
            newLine(w);
        }
        FacesUtil.renderComponent(context, mastFooter);
        if (DEBUG) {
            w.writeComment("End Mast Footer"); // $NON-NLS-1$
            newLine(w);
        }
    }
}
 
Example 6
Source File: ResponsiveAppLayoutRenderer.java    From XPagesExtensionLibrary with Apache License 2.0 5 votes vote down vote up
protected void writeMastHeader(FacesContext context, ResponseWriter w, UIApplicationLayout c, BasicApplicationConfigurationImpl configuration) throws IOException {
    UIComponent mastHeader = c.getMastHeader();
    if (!isEmptyComponent(mastHeader)) {
        if (DEBUG) {
            w.writeComment("Start Mast Header"); // $NON-NLS-1$
            newLine(w);
        }
        FacesUtil.renderComponent(context, mastHeader);
        if (DEBUG) {
            w.writeComment("End Mast Header"); // $NON-NLS-1$
            newLine(w);
        }
    }
}
 
Example 7
Source File: ResponsiveAppLayoutRenderer.java    From XPagesExtensionLibrary with Apache License 2.0 5 votes vote down vote up
protected void writeRightColumn(FacesContext context, ResponseWriter w, UIApplicationLayout c, int size, BasicApplicationConfigurationImpl configuration) throws IOException {
    UIComponent right = c.getRightColumn();
    if (!isEmptyComponent(right)) {
        if (DEBUG) {
            w.writeComment("Start Right Column"); // $NON-NLS-1$
            newLine(w);
        }
        w.startElement("div", c); // $NON-NLS-1$
        String mdCol = (String)getProperty(PROP_COLUMN_MEDIUM) + size;
        String smCol = (String)getProperty(PROP_COLUMN_SMALL) + (size+1);
        String rightColClass = "applayout-column-right"; // $NON-NLS-1$
        String colClass = ExtLibUtil.concatStyleClasses(mdCol, smCol);
        colClass        = ExtLibUtil.concatStyleClasses(colClass, rightColClass);
        
        if (StringUtil.isNotEmpty(colClass)) {
            w.writeAttribute("class", colClass, null); // $NON-NLS-1$
        }
        FacesUtil.renderComponent(context, right);
        
        w.endElement("div"); // $NON-NLS-1$
        newLine(w);
        
        if (DEBUG) {
            w.writeComment("End Right Column"); // $NON-NLS-1$
            newLine(w);
        }
    }
}
 
Example 8
Source File: DojoFormWidgetRenderer.java    From XPagesExtensionLibrary with Apache License 2.0 5 votes vote down vote up
protected void newLine(ResponseWriter w, String comment) throws IOException {
    if(DEBUG){
        if(  comment!=null) {
            w.writeComment(comment);
        }
    }
    JSUtil.writeln(w);
}
 
Example 9
Source File: AbstractApplicationLayoutRenderer.java    From XPagesExtensionLibrary with Apache License 2.0 5 votes vote down vote up
protected void writeRightColumn(FacesContext context, ResponseWriter w, UIApplicationLayout c, BasicApplicationConfigurationImpl configuration) throws IOException {
    UIComponent right = c.getRightColumn();
    if(!isEmptyComponent(right)) {
        if(DEBUG) {
            w.writeComment("Start Right Column"); // $NON-NLS-1$
            newLine(w);
        }
        String columnLastTag = (String)getProperty(PROP_COLUMNLASTTAG);
        if( StringUtil.isNotEmpty(columnLastTag) ){
            w.startElement(columnLastTag,c);
            w.writeAttribute("role", "region", null); // $NON-NLS-1$ $NON-NLS-2$

            String rightColumnLabel = configuration.getRightColumnLabel();
            if (StringUtil.isNotEmpty(rightColumnLabel)) {
                w.writeAttribute("aria-label", rightColumnLabel, null); // $NON-NLS-1$
            }
            
            String columnLastClass = (String)getProperty(PROP_COLUMNLASTCLASS);
            if(StringUtil.isNotEmpty(columnLastClass) ){
                w.writeAttribute("class",columnLastClass,null); // $NON-NLS-1$
            }
            writeRightColumnExtraAttributes(context, w, c, configuration);
        }
        
        FacesUtil.renderComponent(context, right);
        
        if( StringUtil.isNotEmpty(columnLastTag) ){
            w.endElement(columnLastTag);
            newLine(w);
        }
        
        if(DEBUG) {
            w.writeComment("End Right Column"); // $NON-NLS-1$
            newLine(w);
        }
    }
}
 
Example 10
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 11
Source File: AbstractApplicationLayoutRenderer.java    From XPagesExtensionLibrary with Apache License 2.0 5 votes vote down vote up
protected void writeMastFooter(FacesContext context, ResponseWriter w, UIApplicationLayout c, BasicApplicationConfigurationImpl configuration) throws IOException {
    UIComponent mastFooter = c.getMastFooter();
    if(!isEmptyComponent(mastFooter)) {
        if(DEBUG) {
            w.writeComment("Start Mast Footer"); // $NON-NLS-1$
            newLine(w);
        }
        FacesUtil.renderComponent(context, mastFooter);
        if(DEBUG) {
            w.writeComment("End Mast Footer"); // $NON-NLS-1$
            newLine(w);
        }
    }
}
 
Example 12
Source File: OneUIv302ApplicationLayoutRenderer.java    From XPagesExtensionLibrary with Apache License 2.0 5 votes vote down vote up
@Override
protected void writeContentColumn(FacesContext context, ResponseWriter w, UIApplicationLayout c, BasicApplicationConfigurationImpl configuration) throws IOException {
    if(!isEmptyChildren(c)) {
        if(DEBUG) {
            w.writeComment("Start Content Column"); // $NON-NLS-1$
            newLine(w);
        }
       
        w.startElement("div",c); // $NON-NLS-1$
        
        String mainContentClass = (String)getProperty(PROP_MAINCONTENTCLASS);
        if( StringUtil.isNotEmpty(mainContentClass) ){
            w.writeAttribute("class",mainContentClass,null); // $NON-NLS-1$
        }
        String mainContentRole = (String)getProperty(PROP_MAINCONTENTROLE);
        if( StringUtil.isNotEmpty(mainContentRole) ){
            w.writeAttribute("role",mainContentRole,null); // $NON-NLS-1$
        }
        w.startElement("a",c);
        // TODO non-unique ID, should this be clientID prefixed?
        String mainContentAnchorId = (String)getProperty(PROP_MAINCONTENTANCHORID);
        if( StringUtil.isNotEmpty(mainContentAnchorId) ){
            w.writeAttribute("id",mainContentAnchorId,null); // $NON-NLS-1$
        }
        // TODO non-unique anchor name? should this be clientID prefixed?
        String mainContentAnchorName = (String)getProperty(PROP_MAINCONTENTANCHORNAME);
        if( StringUtil.isNotEmpty(mainContentAnchorName) ){
            w.writeAttribute("name",mainContentAnchorName,null); // $NON-NLS-1$
        }
        w.endElement("a");
        writeContentColumnExtraAttributes(context, w, c, configuration);
        renderChildren(context, c);
        w.endElement("div"); // $NON-NLS-1$
        newLine(w);
        if(DEBUG) {
            w.writeComment("End Content Column"); // $NON-NLS-1$
            newLine(w);
        }
    }
}
 
Example 13
Source File: ForumViewRenderer.java    From XPagesExtensionLibrary with Apache License 2.0 5 votes vote down vote up
@Override
protected void writeContent(FacesContext context, ResponseWriter w, AbstractDataView c, ViewDefinition viewDef) throws IOException {
    if(DEBUG) {
        w.writeComment("Start ForumView content"); // $NON-NLS-1$
        newLine(w);
    }
    w.startElement("ul",c); // $NON-NLS-1$
    w.writeAttribute("id", c.getAjaxContainerClientId(context), null); // $NON-NLS-1$
    
    String style = (String)getProperty(PROP_MAINLISTSTYLE);
    if(StringUtil.isNotEmpty(style)) {
        w.writeAttribute("style", style, null); // $NON-NLS-1$
    }
    String styleClass = (String)getProperty(PROP_MAINLISTCLASS);
    if(StringUtil.isNotEmpty(styleClass)) {
        w.writeAttribute("class", styleClass, null); // $NON-NLS-1$
    }
    newLine(w);
    
    // And the rows
    int first = c.getFirst();
    int count = c.getRows();
    writeRows(context, w, c, viewDef, first, count);
    
    w.endElement("ul"); // $NON-NLS-1$
    newLine(w);
    if(DEBUG) {
        w.writeComment("End ForumView content"); // $NON-NLS-1$
        newLine(w);
    }
}
 
Example 14
Source File: AbstractApplicationLayoutRenderer.java    From XPagesExtensionLibrary with Apache License 2.0 4 votes vote down vote up
protected void writePlaceBar(FacesContext context, ResponseWriter w, UIApplicationLayout c, BasicApplicationConfigurationImpl configuration) throws IOException {
    w.startElement("div",c); // $NON-NLS-1$
    w.writeAttribute("role", "region", null); // $NON-NLS-1$ $NON-NLS-2$

    String placeBarName = configuration.getPlaceBarName();
    if(StringUtil.isNotEmpty(placeBarName)) {
        String placeBarNameTag = (String)getProperty(PROP_PLACEBARNAMETAG);
        boolean isPlaceBarTag = StringUtil.isNotEmpty(placeBarNameTag);
        if( isPlaceBarTag ){
            String pbName_id = StringUtil.format("{0}_pbName", c.getClientId(context)); // $NON-NLS-1$
            w.writeAttribute("aria-labelledby", pbName_id, null); // $NON-NLS-1$
        }
    }

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

    String placeBarClass = (String)getProperty(PROP_PLACEBARCLASS);
    if( StringUtil.isNotEmpty(placeBarClass) ){
        w.writeAttribute("class",placeBarClass,null); // $NON-NLS-1$
    }
    newLine(w);
    w.startElement("div",c); // $NON-NLS-1$
    String placeBarTrailingCornerClass = (String)getProperty(PROP_PLACEBARTRAILINGCORNERCLASS);
    if( StringUtil.isNotEmpty(placeBarTrailingCornerClass) ){
        w.writeAttribute("class",placeBarTrailingCornerClass,null); // $NON-NLS-1$
    }
    newLine(w);
    w.startElement("div",c); // $NON-NLS-1$
    String placeBarInnerClass = (String)getProperty(PROP_PLACEBARINNERCLASS);
    if( StringUtil.isNotEmpty(placeBarInnerClass) ){
        w.writeAttribute("class",placeBarInnerClass,null); // $NON-NLS-1$
    }
    newLine(w);

    
    writePlaceBarName(context, w, c, configuration);            
    UIComponent cPlaceBarName = c.getPlaceBarName();
    if(!isEmptyComponent(cPlaceBarName)) {
        if(DEBUG) {
            w.writeComment("Start PlaceBarName Facet"); // $NON-NLS-1$
            newLine(w);
        }
        FacesUtil.renderComponent(context, cPlaceBarName);
    }
    
    
    writePlaceBarActions(context, w, c, configuration);
    UIComponent cPlaceBarActions = c.getPlaceBarActions();
    if(!isEmptyComponent(cPlaceBarActions)) {
        if(DEBUG) {
            w.writeComment("Start PlaceBarActions Facet"); // $NON-NLS-1$
            newLine(w);
        }
        w.startElement("div",c); // $NON-NLS-1$
        w.writeAttribute("class", "lotusBtnContainer", null); //$NON-NLS-1$ $NON-NLS-2$
        FacesUtil.renderComponent(context, cPlaceBarActions);
        w.endElement("div"); // $NON-NLS-1$
    }
    
    // Close the place bar
    w.endElement("div"); newLine(w,placeBarInnerClass); // $NON-NLS-1$
    w.endElement("div"); newLine(w,placeBarTrailingCornerClass); // $NON-NLS-1$
    w.endElement("div"); newLine(w,placeBarClass); // $NON-NLS-1$
}
 
Example 15
Source File: SimpleResponsiveLayoutRenderer.java    From XPagesExtensionLibrary with Apache License 2.0 4 votes vote down vote up
protected void writeSearchBar(FacesContext context, ResponseWriter w, UIApplicationLayout c, SimpleResponsiveApplicationConfiguration configuration) throws IOException {
    UIComponent cSearchBar = c.getSearchBar();
    if (!isEmptyComponent(cSearchBar)) {
        if (DEBUG) {
            w.writeComment("Start SearchBar Facet"); // $NON-NLS-1$
            newLine(w);
        }
        w.startElement("div", c); // $NON-NLS-1$
        w.writeAttribute("class","col-sm-2 col-md-2 navbar-search navbar-right applayout-searchbar",null); // $NON-NLS-1$ $NON-NLS-2$
        w.writeAttribute("role", "search", null); // $NON-NLS-1$ $NON-NLS-2$
        FacesUtil.renderComponent(context, cSearchBar);
        w.endElement("div"); // $NON-NLS-1$
        if (DEBUG) {
            w.writeComment("End SearchBar Facet"); // $NON-NLS-1$
            newLine(w);
        }
        return;
    }

    SearchBar searchBar = configuration.getSearchBar();
    if (searchBar != null && searchBar.isRendered()) {
        w.startElement("div", c); // $NON-NLS-1$
        w.writeAttribute("class","col-sm-3 col-md-2 navbar-search navbar-right input-group applayout-searchbar",null); // $NON-NLS-1$ $NON-NLS-2$
        w.writeAttribute("role", "search", null); // $NON-NLS-1$ $NON-NLS-2$
        newLine(w);

        boolean searchOptions = false;
        ITree tree = TreeImpl.get(searchBar.getOptions());
        if (tree != null) {
            searchOptions = true;
        }

        // Write the search options
        if (searchOptions) {
            writeSearchOptions(context, w, c, configuration, searchBar, tree);
        }
        
        // Write the search box
        writeSearchBox(context, w, c, configuration, searchBar, tree, searchOptions);
        writeSearchButton(context, w, c, configuration, searchBar, tree, searchOptions);
        
        w.endElement("div"); // $NON-NLS-1$
        newLine(w);
    }
}
 
Example 16
Source File: FacesRendererEx.java    From XPagesExtensionLibrary with Apache License 2.0 4 votes vote down vote up
protected void newLine(ResponseWriter w, String comment) throws IOException {
	if(DEBUG && comment!=null) {
		w.writeComment(comment);
	}
	JSUtil.writeln(w);
}
 
Example 17
Source File: AbstractDataViewRenderer.java    From XPagesExtensionLibrary with Apache License 2.0 4 votes vote down vote up
protected void writeRows(FacesContext context, ResponseWriter w, AbstractDataView c, ViewDefinition viewDef, int first, int rows) throws IOException {
    try {
        // Initialize the view definition
        viewDef.first = first;
        viewDef.rows = rows;

        beforeRows(context, w, c, viewDef);
        
        // Horrible fix for 852...
        if(ExtLibUtil.isXPages852()) {
            // We use the offset that was previously stored when we read the very first row
            // This assumes that the view had been already read from the beginning.
            Object o = c.getAttributes().get("__view_indent_offset"); // $NON-NLS-1$
            if(o instanceof Integer) {
                viewDef.indentOffset = (Integer)o;
            }
        }
        
        for(int i=0; i<rows; i++) {
            int index = first+i;
            c.setRowIndex(index);
            if(!c.isRowAvailable()) {
                if(index == 0 && c instanceof UIForumView){
                    w.startElement("li", null); //$NON-NLS-1$
                    w.writeComment("no content"); //$NON-NLS-1$
                    w.endElement("li"); //$NON-NLS-1$
                }
                break;
            }
            if(ExtLibUtil.isXPages852()) {
                if(index==0) {
                    // There is a bug in the view datamodel in 852
                    // When the view do start from the root level (ex: from a parent id), then 
                    viewDef.indentOffset = Math.max(0,calculateIndentOffset(context, c, viewDef));
                    if(viewDef.indentOffset>0) {
                        TypedUtil.getAttributes(c).put("__view_indent_offset",Integer.valueOf(viewDef.indentOffset)); // $NON-NLS-1$
                    }
                }
            }
            beforeRow(context, w, c, viewDef);
            writeRow(context, w, c, viewDef);
            afterRow(context, w, c, viewDef);
        }

        afterRows(context, w, c, viewDef);
    } finally {
        //reset
        c.setRowIndex(-1);
    }
}
 
Example 18
Source File: ResponsiveAppLayoutRenderer.java    From XPagesExtensionLibrary with Apache License 2.0 4 votes vote down vote up
protected void writeSearchBar(FacesContext context, ResponseWriter w, UIApplicationLayout c, BasicApplicationConfigurationImpl configuration) throws IOException {
    UIComponent cSearchBar = c.getSearchBar();
    if (!isEmptyComponent(cSearchBar)) {
        if (DEBUG) {
            w.writeComment("Start SearchBar Facet"); // $NON-NLS-1$
            newLine(w);
        }
        w.startElement("div", c); // $NON-NLS-1$
        w.writeAttribute("class","col-md-4 navbar-search navbar-right applayout-searchbar",null); // $NON-NLS-1$ $NON-NLS-2$
        w.writeAttribute("role", "search", null); // $NON-NLS-1$ $NON-NLS-2$
        FacesUtil.renderComponent(context, cSearchBar);
        w.endElement("div"); // $NON-NLS-1$
        if (DEBUG) {
            w.writeComment("End SearchBar Facet"); // $NON-NLS-1$
            newLine(w);
        }
        return;
    }

    SearchBar searchBar = configuration.getSearchBar();
    if (searchBar != null && searchBar.isRendered()) {
        if (DEBUG) {
            w.writeComment("Start Search Bar"); // $NON-NLS-1$
            newLine(w);
        }
        w.startElement("div", c); // $NON-NLS-1$
        w.writeAttribute("class","col-md-4 navbar-search navbar-right input-group applayout-searchbar",null); // $NON-NLS-1$ $NON-NLS-2$
        w.writeAttribute("role", "search", null); // $NON-NLS-1$ $NON-NLS-2$
        newLine(w);

        boolean searchOptions = false;
        ITree tree = TreeImpl.get(searchBar.getOptions());
        if (tree != null) {
            searchOptions = true;
        }

        // Write the search options
        if (searchOptions) {
            writeSearchOptions(context, w, c, configuration, searchBar, tree);
        }
        
        // Write the search box
        writeSearchBox(context, w, c, configuration, searchBar, tree, searchOptions);
        writeSearchButton(context, w, c, configuration, searchBar, tree, searchOptions);
        
        w.endElement("div"); // $NON-NLS-1$
        newLine(w);
        if (DEBUG) {
            w.writeComment("End Search Bar"); // $NON-NLS-1$
            newLine(w);
        }
    }
}
 
Example 19
Source File: ResponsiveAppLayoutRenderer.java    From XPagesExtensionLibrary with Apache License 2.0 4 votes vote down vote up
protected void writePlaceBar(FacesContext context, ResponseWriter w, UIApplicationLayout c, BasicApplicationConfigurationImpl configuration, String pageWidthClass) throws IOException {
    w.startElement("div", c); // $NON-NLS-1$
    w.writeAttribute("class", (String)getProperty(PROP_PLACEBARCLASS), null); // $NON-NLS-1$ $NON-NLS-2$
    
    // Set A11y properties for the title bar
    w.writeAttribute("role", "region", null); // $NON-NLS-1$ $NON-NLS-2$
    String placeBarName = configuration.getPlaceBarName();
    if(StringUtil.isNotEmpty(placeBarName)) {
        // if titleBarName has been set = add aria-labelledby prop with id of titleBarName
        String pbName_id = StringUtil.format("{0}_pbName", c.getClientId(context)); // $NON-NLS-1$
        w.writeAttribute("aria-labelledby", pbName_id, null); // $NON-NLS-1$
    }
    
    String placeBarLabel = configuration.getPlaceBarLabel();
    // if aria label has been set on place bar = add aria-label prop
    // if no aria label set, but placeBarName is set = add aria-label prop with placeBarName value
    // if no aria label set, and no placeBarName set = add aria-label prop with default value
    String placeBarAriaLabel = (StringUtil.isNotEmpty(placeBarLabel) ? placeBarLabel 
                                  : (StringUtil.isNotEmpty(placeBarName) ? ""
                                      : (String)getProperty(PROP_PLACEBARARIALABEL)));
    if (StringUtil.isNotEmpty(placeBarAriaLabel)) {
        w.writeAttribute("aria-label", placeBarAriaLabel, null); // $NON-NLS-1$
    }
    
    //container div
    w.startElement("div", c); // $NON-NLS-1$
    if(StringUtil.isNotEmpty(pageWidthClass)) {
        w.writeAttribute("class", pageWidthClass, null); // $NON-NLS-1$
    }
    
    w.startElement("div", c); // $NON-NLS-1$
    w.writeAttribute("class", "applayout-placebar-title", null); // $NON-NLS-1$ $NON-NLS-2$
    writePlaceBarName(context, w, c, configuration);
    UIComponent cPlaceBarName = c.getPlaceBarName();
    if (!isEmptyComponent(cPlaceBarName)) {
        if (DEBUG) {
            w.writeComment("Start PlaceBarName Facet"); // $NON-NLS-1$
            newLine(w);
        }
        FacesUtil.renderComponent(context, cPlaceBarName);
    }
    w.endElement("div"); // $NON-NLS-1$

    w.startElement("div", c); // $NON-NLS-1$
    w.writeAttribute("class", "navbar navbar-right applayout-placebar-actions", null); // $NON-NLS-1$ $NON-NLS-2$
    
    String placeBarNavAriaLabel = (String)getProperty(PROP_PLACEBARACTIONSARIALABEL);
    if( StringUtil.isNotEmpty(placeBarNavAriaLabel) ){
        w.writeAttribute("aria-label", placeBarNavAriaLabel, null); // $NON-NLS-1$
    }
    String placeBarNavRole = (String)getProperty(PROP_PLACEBARACTIONSROLE);
    if( StringUtil.isNotEmpty(placeBarNavRole) ){
        w.writeAttribute("role", placeBarNavRole, null); // $NON-NLS-1$
    }
    
    writePlaceBarActions(context, w, c, configuration);
    UIComponent cPlaceBarActions = c.getPlaceBarActions();
    if (!isEmptyComponent(cPlaceBarActions)) {
        if (DEBUG) {
            w.writeComment("Start PlaceBarActions Facet"); // $NON-NLS-1$
            newLine(w);
        }
        w.startElement("div", c); // $NON-NLS-1$
        w.writeAttribute("class", "lotusBtnContainer", null); //$NON-NLS-1$ $NON-NLS-2$
        FacesUtil.renderComponent(context, cPlaceBarActions);
        w.endElement("div"); // $NON-NLS-1$
    }
    w.endElement("div"); // $NON-NLS-1$

    // Close the banner
    w.endElement("div"); // $NON-NLS-1$
    w.endElement("div"); // $NON-NLS-1$
}
 
Example 20
Source File: AbstractTreeRenderer.java    From XPagesExtensionLibrary with Apache License 2.0 4 votes vote down vote up
protected void newLine(ResponseWriter w, String comment) throws IOException {
	if(DEBUG && comment!=null) {
		w.writeComment(comment);
	}
	JSUtil.writeln(w);
}