Builds the html for the template select box.<p>

@param attributes optional attributes for the &lt;select&gt; tag
@return the html for the template select box
546883
public String buildSelectTemplates(String attributes) {

        List options = new ArrayList();
        List values = new ArrayList();
        TreeMap templates = null;
        int selectedIndex = -1;
        try {
            // get all available templates
            templates = CmsNewResourceXmlPage.getTemplates(getCms(), null);
        } catch (CmsException e) {
            // can usually be ignored
            if (LOG.isInfoEnabled()) {
                LOG.info(e);
            }
        }
        if (templates == null) {
            // no templates found, return empty String
            return "";
        } else {
            // templates found, create option and value lists
            CmsMessages messages = Messages.get().getBundle(getLocale());
            options.add(messages.key(Messages.GUI_PLEASE_SELECT_0));
            values.add("");
            options.add(messages.key(Messages.GUI_BUTTON_ALL_0));
            values.add(ALL);
            if (ALL.equals(getParamTemplate())) {
                selectedIndex = 1;
            }
            Iterator i = templates.entrySet().iterator();
            int counter = 2;
            while (i.hasNext()) {
                Map.Entry entry = (Map.Entry)i.next();
                String key = (String)entry.getKey();
                String path = (String)entry.getValue();
                if (path.equals(getParamTemplate())) {
                    selectedIndex = counter;
                }
                options.add(key);
                values.add(path);
                counter++;
            }
        }
        return buildSelect(attributes, options, values, selectedIndex, false);
    }
1046044
public AttributesBuilder attribute(String attributeName, Object attributeValue) {
		this.attributes.setAttribute(attributeName, attributeValue);
		return this;
	}
954035
public static String createBeanAttributesId(BeanAttributes<?> attributes) {
        StringBuilder builder = new StringBuilder();
        builder.append(attributes.getName());
        builder.append(",");
        builder.append(attributes.getScope().getName());
        builder.append(",");
        builder.append(attributes.isAlternative());
        builder.append(AnnotatedTypes.createAnnotationCollectionId(attributes.getQualifiers()));
        builder.append(createTypeCollectionId(attributes.getStereotypes()));
        builder.append(createTypeCollectionId(attributes.getTypes()));
        return builder.toString();
    }
488888
String buildSelect(String htmlAttributes, SelectOptions options) {

        return buildSelect(htmlAttributes, options.getOptions(), options.getValues(), options.getSelectedIndex());
    }
1363669
public PlacementDescription withAttributes(java.util.Map<String, String> attributes) {
        setAttributes(attributes);
        return this;
    }
1335046
public String buildSelectWorkplaceSearchResult(String htmlAttributes) {

        List<String> options = new ArrayList<String>(3);
        List<String> values = new ArrayList<String>(3);
        int checkedIndex = 0;

        // add all styles to the select box
        options.add(key(CmsSearchResultStyle.STYLE_EXPLORER.getKey()));
        values.add(CmsSearchResultStyle.STYLE_EXPLORER.getMode());
        if (getParamTabExWorkplaceSearchResult().equals(CmsSearchResultStyle.STYLE_EXPLORER.toString())) {
            // mark the currently active locale
            checkedIndex = 0;
        }
        options.add(key(CmsSearchResultStyle.STYLE_LIST_WITH_EXCERPTS.getKey()));
        values.add(CmsSearchResultStyle.STYLE_LIST_WITH_EXCERPTS.getMode());
        if (getParamTabExWorkplaceSearchResult().equals(CmsSearchResultStyle.STYLE_LIST_WITH_EXCERPTS.toString())) {
            // mark the currently active locale
            checkedIndex = 1;
        }
        options.add(key(CmsSearchResultStyle.STYLE_LIST_WITHOUT_EXCERPTS.getKey()));
        values.add(CmsSearchResultStyle.STYLE_LIST_WITHOUT_EXCERPTS.getMode());
        if (getParamTabExWorkplaceSearchResult().equals(CmsSearchResultStyle.STYLE_LIST_WITHOUT_EXCERPTS.toString())) {
            // mark the currently active locale
            checkedIndex = 2;
        }

        return buildSelect(htmlAttributes, options, values, checkedIndex);
    }
1034374
public static String open(Tag tag, AttributeValue... attrs) {

        StringBuffer sb = new StringBuffer();
        sb.append("<").append(tag.name());
        for (AttributeValue attr : attrs) {
            sb.append(" ").append(attr.toString());
        }
        sb.append(">");
        return sb.toString();
    }
701010
public DescribeThingResult withAttributes(java.util.Map<String, String> attributes) {
        setAttributes(attributes);
        return this;
    }
1176274
public String buildSelectSite(String htmlAttributes) {

        SelectOptions selectOptions = getSiteSelectOptions();

        return buildSelect(htmlAttributes, selectOptions);
    }
769791
protected void addAttribute() {
        attributes.put(attribute, builder.toString().trim());
        attribute = null;
        Strings.clearBuilder(builder);
    }
1313785
public String buildSelectWorkplaceButtonStyle(String htmlAttributes) {

        int selectedIndex = Integer.parseInt(getParamTabWpButtonStyle());
        return buildSelectButtonStyle(htmlAttributes, selectedIndex);
    }
1083532
public TemplateBean getTemplate() {

        TemplateBean templateBean = getRequestAttribute(CmsTemplateContextManager.ATTR_TEMPLATE_BEAN);
        if (templateBean == null) {
            templateBean = new TemplateBean("", "");
        }
        return templateBean;
    }
368754
private static String templateToHtml( Template t){
		if( t == null ) {
			return "null";
		}

		StringBuilder result = new StringBuilder();

		result.append(
			"<table class=\"Template\">\n" +
			"<tr><th class=\"Template\">Template</th></tr>\n"+
			"<tr><td class=\"Template\">" +
			"Name: \""+convertTags( t.getName() )+"\"<br>"+
			"</td></tr>\n");

		if( t.getParameters().size() != 0 ){
			result.append("<tr><td class=\"Template\">");
			for( String parameter: t.getParameters() ) {
				result.append("Parameter: \""+convertTags( parameter )+"\"<br>");
			}
			result.append("</td></tr>\n");
		}

		result.append("</table>" );

		return result.toString();
	}
1219527
public function buildTagAttributes(array $attributes)
	{
		$html = array();

		foreach ($attributes as $key => $value)
		{
			if (is_null($value))
				continue;

			if (is_numeric($key))
				$key = $value;

			$html[] = $key . '="' . htmlentities($value, ENT_QUOTES, 'UTF-8', false) . '"';
		}

		return (count($html) > 0) ? ' ' . implode(' ', $html) : '';
	}
615649
public HtmlElementWriter attribute(String name, String value) {
    attributes.put(name, value);
    return this;
  }
1076490
public ElemAttrs buildAttrOb()
    {
        int count = mAttrCount;
        if (count == 0) {
            return null;
        }
        // If we have actual attributes, let's first just create the
        // raw array that has all attribute information:
        String[] raw = new String[count << 2];
        for (int i = 0; i < count; ++i) {
            Attribute attr = mAttributes[i];
            int ix = (i << 2);
            raw[ix] = attr.mLocalName;
            raw[ix+1] = attr.mNamespaceURI;
            raw[ix+2] = attr.mPrefix;
            raw[ix+3] = getValue(i);
        }

        // Do we have a "short" list?
        if (count < LONG_ATTR_LIST_LEN) {
            return new ElemAttrs(raw, mNonDefCount);
        }

        // Ok, nope; we need to also pass the Map information...
        /* 02-Feb-2009, TSa: Must make a copy of the Map array now,
         *   otherwise could get overwritten.
         */
        int amapLen = mAttrMap.length;
        int[] amap = new int[amapLen];
        // TODO: JDK 1.6 has Arrays.copyOf(), should use with Woodstox 6
        System.arraycopy(mAttrMap, 0, amap, 0, amapLen);
        return new ElemAttrs(raw, mNonDefCount,
                             amap, mAttrHashSize, mAttrSpillEnd);
    }
1308354
public function htmlAttr()
    {
        $attributes = [
            'data-template' => $this->templateName(),
            'data-debug'    => $this->debug() ? 'true' : false,
            'lang'          => $this->lang(),
            'locale'        => $this->locale(),
            'class'         => $this->htmlClasses()
        ];

        return html_build_attributes($attributes);
    }