Returns the HTML for the site selector box for the explorer tree window.<p>

@param htmlAttributes optional attributes for the &lt;select&gt; tag
@return HTML code for the site selector box
424814
public String getSiteSelector(String htmlAttributes) {

        List<String> options = new ArrayList<String>();
        List<String> values = new ArrayList<String>();
        int selectedIndex = 0;
        String preSelection = getSettings().getTreeSite(getTreeType());
        if (preSelection == null) {
            if ("".equals(getCms().getRequestContext().getSiteRoot())) {
                // we are in the root site, getCurrentSite(CmsObject) includes NOT the root site
                preSelection = "";
            } else {
                // get the site root of the current site
                preSelection = OpenCms.getSiteManager().getCurrentSite(getCms()).getSiteRoot();
            }
            // set the tree site to avoid discrepancies between selector and tree
            getSettings().setTreeSite(getTreeType(), preSelection);
        }

        boolean includeRootSite = true;
        boolean showSiteUrls = false;
        if (TYPE_PAGELINK.equals(getTreeType())) {
            // in wysiwyg editor link dialog, don't show root site, but show site URLs
            includeRootSite = false;
            showSiteUrls = true;
        }
        List<CmsSite> sites = OpenCms.getSiteManager().getAvailableSites(
            getCms(),
            includeRootSite,
            true,
            getCms().getRequestContext().getOuFqn());

        Iterator<CmsSite> i = sites.iterator();
        int pos = 0;
        while (i.hasNext()) {
            CmsSite site = i.next();
            values.add(site.getSiteRoot());
            String curOption = substituteSiteTitle(site.getTitle());
            if (showSiteUrls && (site.getSiteMatcher() != null)) {
                // show the site URL in editor link dialog tree
                curOption = site.getUrl() + " (" + curOption + ")";
                if (getCms().getRequestContext().getSiteRoot().equals(site.getSiteRoot())) {
                    // mark the current workplace site in selector
                    curOption = "*" + curOption;
                }
            }

            if (site.getSiteRoot().equals(preSelection)) {
                // this is the user's currently selected site
                selectedIndex = pos;
            }
            options.add(curOption);
            pos++;
        }

        return buildSelect(htmlAttributes, options, values, selectedIndex);
    }
1301873
private String buildSelectButtonStyle(String htmlAttributes, int selectedIndex) {

        List<String> options = new ArrayList<String>(3);
        options.add(key(Messages.GUI_PREF_BUTTONSTYLE_IMG_0));
        options.add(key(Messages.GUI_PREF_BUTTONSTYLE_IMGTXT_0));
        options.add(key(Messages.GUI_PREF_BUTTONSTYLE_TXT_0));
        String[] vals = new String[] {"0", "1", "2"};
        List<String> values = new ArrayList<String>(java.util.Arrays.asList(vals));
        return buildSelect(htmlAttributes, options, values, selectedIndex);
    }
1016550
public Content getMarkerAnchor(String anchorName, Content anchorContent) {
        if (anchorContent == null)
            anchorContent = new Comment(" ");
        Content markerAnchor = HtmlTree.A(configuration.htmlVersion, anchorName, anchorContent);
        return markerAnchor;
    }
638836
public String buildSelectPreferredEditors(String htmlAttributes) {

        StringBuffer result = new StringBuffer(1024);
        HttpServletRequest request = getJsp().getRequest();
        if (htmlAttributes != null) {
            htmlAttributes += " name=\"" + PARAM_PREFERREDEDITOR_PREFIX;
        }
        Map<String, SortedMap<Float, CmsWorkplaceEditorConfiguration>> resourceEditors = OpenCms.getWorkplaceManager().getWorkplaceEditorManager().getConfigurableEditors();
        if (resourceEditors != null) {
            // first: iterate over the resource types and consider order from configuration
            Iterator<String> i = resourceEditors.keySet().iterator();

            SortedMap<Float, String> rankResources = new TreeMap<Float, String>();
            while (i.hasNext()) {
                String currentResourceType = i.next();
                CmsExplorerTypeSettings settings = OpenCms.getWorkplaceManager().getExplorerTypeSetting(
                    currentResourceType);
                rankResources.put(new Float(settings.getNewResourceOrder()), currentResourceType);
            }

            while (rankResources.size() > 0) {
                // get editor configuration with lowest order
                Float keyVal = rankResources.firstKey();
                String currentResourceType = rankResources.get(keyVal);

                SortedMap<Float, CmsWorkplaceEditorConfiguration> availableEditors = resourceEditors.get(
                    currentResourceType);
                if ((availableEditors != null) && (availableEditors.size() > 0)) {
                    String preSelection = computeEditorPreselection(request, currentResourceType);
                    List<String> options = new ArrayList<String>(availableEditors.size() + 1);
                    List<String> values = new ArrayList<String>(availableEditors.size() + 1);
                    options.add(key(Messages.GUI_PREF_EDITOR_BEST_0));
                    values.add(INPUT_DEFAULT);
                    // second: iteration over the available editors for the resource type
                    int selectedIndex = 0;
                    int counter = 1;
                    while (availableEditors.size() > 0) {
                        Float key = availableEditors.lastKey();
                        CmsWorkplaceEditorConfiguration conf = availableEditors.get(key);
                        options.add(keyDefault(conf.getEditorLabel(), conf.getEditorLabel()));
                        values.add(conf.getEditorUri());
                        if (conf.getEditorUri().equals(preSelection)) {
                            selectedIndex = counter;
                        }
                        counter++;
                        availableEditors.remove(key);
                    }

                    // create the table row for the current resource type
                    result.append("<tr>\n\t<td style=\"white-space: nowrap;\">");
                    String localizedName = keyDefault("label.editor.preferred." + currentResourceType, "");
                    if (CmsStringUtil.isEmpty(localizedName)) {
                        localizedName = CmsWorkplaceMessages.getResourceTypeName(this, currentResourceType);
                    }
                    result.append(localizedName);
                    result.append("</td>\n\t<td>");
                    result.append(
                        buildSelect(htmlAttributes + currentResourceType + "\"", options, values, selectedIndex));
                    result.append("</td>\n</tr>\n");
                }
                rankResources.remove(keyVal);
            }
        }
        return result.toString();
    }
946768
public String buildSelectExplorerFileEntries(String htmlAttributes) {

        String emptyOption = OpenCms.getWorkplaceManager().getDefaultUserSettings().getExplorerFileEntryOptions();
        if (CmsStringUtil.isEmptyOrWhitespaceOnly(emptyOption)) {
            emptyOption = "50,100,200,300,400,500";
        }
        // remove all non digits without ','
        emptyOption = emptyOption.replaceAll("[^0-9|^,]", "");
        // remove all empty entries
        emptyOption = emptyOption.replaceAll(",,", ",");
        List<String> opts = CmsStringUtil.splitAsList(emptyOption, ",", true);
        opts.add(key(Messages.GUI_LABEL_UNLIMITED_0));
        opts.remove("0");
        List<String> vals = CmsStringUtil.splitAsList(emptyOption, ",", true);
        vals.add("" + Integer.MAX_VALUE);
        vals.remove("0");
        int selectedIndex = 2;
        for (int i = 0; i < vals.size(); i++) {
            if (vals.get(i).equals(getParamTabExFileEntries())) {
                selectedIndex = i;
                break;
            }
        }
        return buildSelect(htmlAttributes, opts, vals, selectedIndex);
    }
67042
public String buildSelectStartGalleries(String htmlAttributes) {

        StringBuffer result = new StringBuffer(1024);
        HttpServletRequest request = getJsp().getRequest();
        // set the attributes for the select tag
        if (htmlAttributes != null) {
            htmlAttributes += " name=\"" + PARAM_STARTGALLERY_PREFIX;
        }
        Map<String, A_CmsAjaxGallery> galleriesTypes = OpenCms.getWorkplaceManager().getGalleries();
        if (galleriesTypes != null) {

            // sort the galleries by localized name
            Map<String, String> localizedGalleries = new TreeMap<String, String>();
            for (Iterator<String> i = galleriesTypes.keySet().iterator(); i.hasNext();) {
                String currentGalleryType = i.next();
                String localizedName = CmsWorkplaceMessages.getResourceTypeName(this, currentGalleryType);
                localizedGalleries.put(localizedName, currentGalleryType);
            }

            for (Iterator<Map.Entry<String, String>> i = localizedGalleries.entrySet().iterator(); i.hasNext();) {
                Map.Entry<String, String> entry = i.next();
                // first: retrieve the gallery type
                String currentGalleryType = entry.getValue();
                // second: retrieve the gallery type id
                int currentGalleryTypeId = 0;
                try {
                    currentGalleryTypeId = OpenCms.getResourceManager().getResourceType(currentGalleryType).getTypeId();
                } catch (CmsLoaderException e) {
                    // resource type not found, log error
                    if (LOG.isErrorEnabled()) {
                        LOG.error(e.getLocalizedMessage(), e);
                    }
                    continue;
                }
                // third: get the available galleries for this gallery type id
                List<CmsResource> availableGalleries = A_CmsAjaxGallery.getGalleries(currentGalleryTypeId, getCms());

                // forth: fill the select box
                List<String> options = new ArrayList<String>(availableGalleries.size() + 2);
                List<String> values = new ArrayList<String>(availableGalleries.size() + 2);
                options.add(key(Messages.GUI_PREF_STARTGALLERY_PRESELECT_0));
                values.add(INPUT_DEFAULT);
                options.add(key(Messages.GUI_PREF_STARTGALLERY_NONE_0));
                values.add(INPUT_NONE);

                String savedValue = computeStartGalleryPreselection(request, currentGalleryType);
                int counter = 2;
                int selectedIndex = 0;
                Iterator<CmsResource> iGalleries = availableGalleries.iterator();
                while (iGalleries.hasNext()) {
                    CmsResource res = iGalleries.next();
                    String rootPath = res.getRootPath();
                    String sitePath = getCms().getSitePath(res);
                    // select the value
                    if ((savedValue != null) && (savedValue.equals(rootPath))) {
                        selectedIndex = counter;
                    }
                    counter++;
                    // gallery title
                    String title = "";
                    try {
                        // read the gallery title
                        title = getCms().readPropertyObject(
                            sitePath,
                            CmsPropertyDefinition.PROPERTY_TITLE,
                            false).getValue("");
                    } catch (CmsException e) {
                        // error reading title property
                        if (LOG.isErrorEnabled()) {
                            LOG.error(e.getLocalizedMessage(), e);
                        }
                    }
                    options.add(title.concat(" (").concat(sitePath).concat(")"));
                    values.add(rootPath);

                }
                // select the value
                if ((savedValue != null) && savedValue.equals(INPUT_NONE)) {
                    selectedIndex = 1;
                }

                // create the table row for the current resource type
                result.append("<tr>\n\t<td style=\"white-space: nowrap;\">");

                result.append(entry.getKey());
                result.append("</td>\n\t<td>");
                result.append(buildSelect(htmlAttributes + currentGalleryType + "\"", options, values, selectedIndex));
                result.append("</td>\n</tr>\n");

            }

        }
        return result.toString();
    }
1209869
public String buildSelectDirectEditButtonStyle(String htmlAttributes) {

        int selectedIndex = Integer.parseInt(getParamTabEdDirectEditButtonStyle());
        return buildSelectButtonStyle(htmlAttributes, selectedIndex);
    }
382193
@Override
    public void setHTML(final String html) {
        getElement().setInnerHTML(SourceCodeHelper.parseCode(html).asString());
    }
246725
public static HtmlTree A_NAME(String name) {
        HtmlTree htmltree = new HtmlTree(HtmlTag.A);
        htmltree.addAttr(HtmlAttr.NAME, nullCheck(name));
        return htmltree;
    }
543043
public static String stripHtml(String html) {
		return (html == null) ? "" : Jsoup.parse(html).text();
	}
594800
public Attribute getAttribute4Select(final String _selectStmt)
    {
        final OneSelect oneselect = this.selectStmt2OneSelect.get(_selectStmt);
        return oneselect == null ? null : oneselect.getAttribute();
    }
569876
public String htmlActionBar() {

        StringBuffer html = new StringBuffer(1024);
        html.append("<td class='misc'>\n");
        html.append("\t<div>\n");
        Iterator<CmsListItemDetails> itDetails = m_itemDetails.elementList().iterator();
        while (itDetails.hasNext()) {
            I_CmsListAction detailAction = itDetails.next().getAction();
            html.append("\t\t");
            html.append(detailAction.buttonHtml());
            if (itDetails.hasNext()) {
                html.append("&nbsp;");
            }
            html.append("\n");
        }
        Iterator<I_CmsListAction> itActions = m_indepActions.elementList().iterator();
        while (itActions.hasNext()) {
            I_CmsListAction indepAction = itActions.next();
            html.append("\t\t");
            html.append("&nbsp;");
            html.append(indepAction.buttonHtml());
            html.append("\n");
        }
        html.append("\t</div>\n");
        html.append("</td>\n");
        return html.toString();
    }
621565
private String getHtmlCode()
	{
		StringBuffer _body = new StringBuffer();
		for (Option _option : getOptions())
		{
			_body.append(_option.getHtmlCode());
		}
		Object[] _params =
		{
				getHtmlCodeForNameAttribute(),
				getHtmlCodeForIdAttribute(),
				_body.toString(),
				isMultiple() ? HtmlUtils.SpecialAttribute.ALLOW_MULTIPLE_SELECTION : HtmlUtils.SpecialAttribute.NONE,
				isDisabled() ? HtmlUtils.SpecialAttribute.DISABLED : HtmlUtils.SpecialAttribute.NONE
		};
		return FORMAT__SELECT.format(_params);
	}
377684
private JComboBox<String> getSiteSelect() {
		if (siteSelect == null) {
			siteSelect = new JComboBox<>(siteModel);
			siteSelect.addItem(Constant.messages.getString("httpsessions.toolbar.site.select"));
			siteSelect.setSelectedIndex(0);

			// Add the item listener for when the site is selected
			siteSelect.addItemListener(new ItemListener() {
				@Override
				public void itemStateChanged(ItemEvent e) {
					if (ItemEvent.SELECTED == e.getStateChange()) {
						if (siteSelect.getSelectedIndex() > 0) {
							siteSelected((String) e.getItem());

						} // If the user selects the first option (empty one), force the selection to
							// the first valid site
						else if (siteModel.getSize() > 1) {
							siteModel.setSelectedItem(siteModel.getElementAt(1));
						}
					}
				}
			});
		}
		return siteSelect;
	}
171963
public Content getMarkerAnchor(String anchorName, Content anchorContent) {
        if (anchorContent == null)
            anchorContent = new Comment(" ");
        Content markerAnchor = HtmlTree.A_NAME(anchorName, anchorContent);
        return markerAnchor;
    }
100673
public String buildSelectPlaces(String htmlAttributes) {

        List<String> options = new ArrayList<String>(4);
        options.add(OPTION_DECIMALPLACES_1);
        options.add(OPTION_DECIMALPLACES_2);
        options.add(OPTION_DECIMALPLACES_3);
        options.add(OPTION_DECIMALPLACES_4);
        List<String> values = new ArrayList<String>(4);
        values.add("1");
        values.add("2");
        values.add("3");
        values.add("4");
        int selectedIndex = 2;
        if (getAction() != ACTION_DEFAULT) {
            selectedIndex = values.indexOf(getParamPlaces());
        }
        return buildSelect(htmlAttributes, options, values, selectedIndex);
    }
511148
public static HtmlTree UL(HtmlStyle styleClass, Content body) {
        HtmlTree htmltree = new HtmlTree(HtmlTag.UL, nullCheck(body));
        htmltree.addStyle(nullCheck(styleClass));
        return htmltree;
    }