Indents a resources box.<p>

@param resourceInfo the resource box

@return an indented resource box
507463
private Component indent(CmsResourceInfo resourceInfo) {

        boolean simple = false;

        if (simple) {
            return resourceInfo;

        } else {
            HorizontalLayout hl = new HorizontalLayout();
            Label label = new Label("");
            label.setWidth("35px");
            hl.addComponent(label);
            hl.addComponent(resourceInfo);
            hl.setExpandRatio(resourceInfo, 1.0f);
            hl.setWidth("100%");
            return hl;
        }
    }
1057347
private void initResInfo() {

        Object dialogObject = getDialogObject();
        if ((dialogObject == null) || CmsDialog.DIALOG_INITIAL.equals(getParamAction())) {
            m_resInfo = new CmsResourceTypeInfoBean();
            int id = findNextTypeId();
            m_resInfo.setId(id);
            m_resInfo.setModuleName(getParamModule());
        } else {
            m_resInfo = (CmsResourceTypeInfoBean)dialogObject;
        }
    }
434222
public static String parseSource(ResourceInfo resourceInfo) {
        if (resourceInfo != null) {
            Class clazz = resourceInfo.getResourceClass();
            if (clazz != null)
                return ClassUtils.toString(clazz, resourceInfo.getResourceMethod());
        }
        return null;
    }
501979
public static CmsResourceInfo getOUInfo(CmsOrganizationalUnit ou) {

        String style = OpenCmsTheme.ICON_OU;
        if (ou.hasFlagWebuser()) {
            style = OpenCmsTheme.ICON_OU_WEB;
        }
        CmsCssIcon image = new CmsCssIcon(style);
        return new CmsResourceInfo(
            ou.getDisplayName(A_CmsUI.get().getLocale()),
            ou.getDescription(A_CmsUI.get().getLocale()),
            image);
    }
1037497
public CmsPushButton createInfoButton() {

        CmsPushButton infoButton = new CmsPushButton();
        infoButton.setImageClass(I_CmsButton.ButtonData.INFO_BUTTON.getSmallIconClass());
        infoButton.setTitle(I_CmsButton.ButtonData.INFO_BUTTON.getTitle());
        infoButton.setButtonStyle(I_CmsButton.ButtonStyle.FONT_ICON, null);
        add(infoButton);
        infoButton.addClickHandler(new ClickHandler() {

            public void onClick(ClickEvent event) {

                CmsResourceInfoDialog.load(m_editableData.getStructureId(), true, null, getInfoContext(), null);
            }
        });
        return infoButton;
    }
739729
private StringBuffer buildResourceList(ArrayList<CmsAccessControlEntry> entries) {

        StringBuffer result = new StringBuffer(256);
        Iterator<CmsAccessControlEntry> i = entries.iterator();
        boolean hasEntries = i.hasNext();

        if (hasEntries || !getInheritOption()) {
            // create headline for resource entries
            result.append(dialogSubheadline(key(Messages.GUI_PERMISSION_TITLE_0)));
        }

        // create the internal form
        result.append(buildInternalForm());

        if (hasEntries) {
            // only create output if entries are present
            result.append(dialogSpacer());
            // open white box
            result.append(dialogWhiteBox(HTML_START));

            // list all entries
            while (i.hasNext()) {
                CmsAccessControlEntry curEntry = i.next();
                result.append(buildPermissionEntryForm(curEntry, getEditable(), false, null));
                if (i.hasNext()) {
                    result.append(dialogSeparator());
                }
            }

            // close white box
            result.append(dialogWhiteBox(HTML_END));
        }
        return result;
    }
624935
@Override
    public CmsDirectEditResourceInfo getResourceInfo(String resourceName) {

        try {
            // first check some simple preconditions for direct edit
            if (m_cms.getRequestContext().getCurrentProject().isOnlineProject()) {
                // don't show direct edit button in online project
                return CmsDirectEditResourceInfo.INACTIVE;
            }
            if (CmsResource.isTemporaryFileName(resourceName)) {
                // don't show direct edit button on a temporary file
                return CmsDirectEditResourceInfo.INACTIVE;
            }
            if (!m_cms.isInsideCurrentProject(resourceName)) {
                // don't show direct edit button on files not belonging to the current project
                return CmsDirectEditResourceInfo.INACTIVE;
            }
            // read the target resource
            CmsResource resource = m_cms.readResource(resourceName, CmsResourceFilter.ALL);
            if (!OpenCms.getResourceManager().getResourceType(resource.getTypeId()).isDirectEditable()
                && !resource.isFolder()) {
                // don't show direct edit button for non-editable resources
                return CmsDirectEditResourceInfo.INACTIVE;
            }
            // check the resource lock
            CmsLock lock = m_cms.getLock(resource);
            boolean locked = !(lock.isUnlocked()
                || lock.isOwnedInProjectBy(
                    m_cms.getRequestContext().getCurrentUser(),
                    m_cms.getRequestContext().getCurrentProject()));
            // check the users permissions on the resource
            // only if write permissions are granted the resource may be direct editable
            if (locked) {
                // a locked resource must be shown as "disabled"
                return new CmsDirectEditResourceInfo(CmsDirectEditPermissions.DISABLED, resource, lock);
            }
            // if we have write permission and the resource is not locked then direct edit is enabled
            return new CmsDirectEditResourceInfo(CmsDirectEditPermissions.ENABLED, resource, lock);

        } catch (Exception e) {
            // all exceptions: don't mix up the result HTML, always return INACTIVE mode
            if (LOG.isWarnEnabled()) {
                LOG.warn(
                    org.opencms.workplace.editors.Messages.get().getBundle().key(
                        org.opencms.workplace.editors.Messages.LOG_CALC_EDIT_MODE_FAILED_1,
                        resourceName),
                    e);
            }
        }
        // otherwise the resource is not direct editable
        return CmsDirectEditResourceInfo.INACTIVE;
    }
1180507
private String buildInternalForm() {

        StringBuffer result = new StringBuffer(128);

        CmsResource resource = null;
        boolean internal = false;

        // try to read the internal flag from the resource
        try {
            resource = getCms().readResource(getParamResource(), CmsResourceFilter.ALL);
            internal = resource.isInternal();
        } catch (CmsException e) {
            // an error occurred reading the resource
            LOG.error(e.getLocalizedMessage());
        }

        if ((resource != null) && (resource.isFile())) {
            // only show internal check box on files
            result.append("<form action=\"").append(getDialogUri()).append(
                "\" method=\"post\" name=\"internal\" class=\"nomargin\">\n");
            result.append("<table border=\"0\" width=\"100%\">\n");
            result.append("<tr>\n");
            result.append("\t<td class=\"dialogpermissioncell\">").append(key(Messages.GUI_PERMISSION_INTERNAL_0));
            result.append(" <input type=\"checkbox\" name=\"");
            result.append(PARAM_INTERNAL);
            result.append("\" value=\"true\"");
            if (internal) {
                result.append(" checked=\"checked\"");
            }
            if (!getEditable()) {
                result.append(" disabled=\"disabled\"");
            }
            result.append(" ></td>\n");
            if (getEditable()) {
                result.append("<td><input  type=\"submit\" class=\"dialogbutton\" value=\"").append(
                    key(Messages.GUI_LABEL_SET_0)).append("\">");
            }
            result.append("</td>\n");
            result.append("</tr>\n");
            result.append("</table>\n");
            setParamAction(DIALOG_INTERNALUSE);
            setParamType(null);
            setParamName(null);
            result.append(paramsAsHidden());
            result.append("</form>\n");
        }
        return result.toString();

    }
1224135
@SuppressWarnings("deprecation")
    CmsResourceInfo formatResourceType(I_CmsResourceType type) {

        CmsExplorerTypeSettings settings = OpenCms.getWorkplaceManager().getExplorerTypeSetting(type.getTypeName());
        Resource icon;
        String title;
        String subtitle;
        if (settings != null) {
            icon = CmsResourceUtil.getBigIconResource(settings, null);
            title = CmsVaadinUtils.getMessageText(settings.getKey());
            if (title.startsWith("???")) {
                title = type.getTypeName();
            }
            subtitle = type.getTypeName()
                + " (ID: "
                + type.getTypeId()
                + (settings.getReference() != null ? (", " + settings.getReference()) : "")
                + ")";
        } else {
            icon = CmsResourceUtil.getBigIconResource(
                OpenCms.getWorkplaceManager().getExplorerTypeSetting("unknown"),
                null);
            title = type.getTypeName();
            subtitle = type.getTypeName() + " (ID: " + type.getTypeId() + ")";
        }
        CmsResourceInfo info = new CmsResourceInfo(title, subtitle, icon);
        return info;
    }
345766
String buildDirectoryContentIndent(String indent) {

    return Optional.ofNullable(indent).filter(StringUtils::hasText)
      .map(it -> it + StringUtils.SINGLE_SPACE + SUB_DIRECTORY_OFFSET + DIRECTORY_SWIM_LANE)
      .orElseGet(() ->StringUtils.SINGLE_SPACE + DIRECTORY_SWIM_LANE);
  }
1092486
public CmsResource createResource() throws CmsException {

        String path = OpenCms.getResourceManager().getNameGenerator().getNewFileName(
            m_cms,
            m_pathWithPattern,
            5,
            m_explorerNameGeneration);
        Locale contentLocale = OpenCms.getLocaleManager().getDefaultLocale(m_cms, CmsResource.getFolderPath(path));
        CmsRequestContext context = m_cms.getRequestContext();
        if (m_modelResource != null) {
            context.setAttribute(CmsRequestContext.ATTRIBUTE_MODEL, m_modelResource.getRootPath());
        }
        context.setAttribute(CmsRequestContext.ATTRIBUTE_NEW_RESOURCE_LOCALE, contentLocale);
        CmsResource res = m_cms.createResource(
            path,
            OpenCms.getResourceManager().getResourceType(m_type),
            null,
            new ArrayList<CmsProperty>());
        if (m_propChanges != null) {
            CmsPropertyEditorHelper helper = new CmsPropertyEditorHelper(m_cms);
            helper.overrideStructureId(res.getStructureId());
            helper.saveProperties(m_propChanges);
        }
        // Path or other metadata may have changed
        m_createdResource = m_cms.readResource(res.getStructureId(), CmsResourceFilter.IGNORE_EXPIRATION);
        try {
            m_cms.unlockResource(m_createdResource);
        } catch (CmsException e) {
            LOG.info(e.getLocalizedMessage(), e);
        }
        for (I_Callback callback : m_callbacks) {
            callback.onResourceCreated(this);
        }
        return m_createdResource;
    }
606183
@SuppressWarnings("unchecked")
    private Set<String> getResourcePaths() {

        Set<String> resources = new HashSet<String>();
        for (Component c : m_resources) {
            if (c instanceof CmsRemovableFormRow<?>) {
                String value = ((CmsRemovableFormRow<CmsPathSelectField>)c).getInput().getValue();
                if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(value)) {
                    resources.add(value);
                }
            }
        }
        return resources;
    }
954900
public String buildImageInformation() {

        // count all image resources of the gallery folder
        int count = 0;
        try {
            int imageId = OpenCms.getResourceManager().getResourceType(
                CmsResourceTypeImage.getStaticTypeName()).getTypeId();
            CmsResourceFilter filter = CmsResourceFilter.IGNORE_EXPIRATION.addRequireType(imageId);
            List<CmsResource> images = getCms().readResources(getParamResource(), filter, false);
            count = images.size();
        } catch (CmsException e) {
            // ignore this exception
        }

        Object[] args = new Object[] {getParamResource(), new Integer(count)};
        return key(Messages.GUI_RENAMEIMAGES_INFO_IMAGECOUNT_2, args);
    }
940713
public List<String> getResources() {

        List<String> res = new ArrayList<String>();
        for (I_CmsEditableGroupRow row : m_resourcesGroup.getRows()) {
            res.add(((CmsPathSelectField)row.getComponent()).getValue());
        }
        return res;
    }
859571
@Override
    public void encode(OutputStream output, Indenter indenter, String nsURI) {

        // Make a PrintStream for a nicer printing interface
        PrintStream out = new PrintStream(output);

        // Prepare the indentation string
        char[] topIndent = indenter.makeString().toCharArray();
        out.print(topIndent);
        if (nsURI != null) {
            out.append("<Request xmlns=\"").append(nsURI).println("\">");
        } else {
            out.println("<Request>");
        }
        // go in one more for next-level elements...
        indenter.in();
        char[] indent = indenter.makeString().toCharArray();

        // ...and go in again for everything else
        indenter.in();

        // first off, go through all subjects
        Iterator it = subjects.iterator();
        while (it.hasNext()) {
            Subject subject = (Subject)(it.next());
            encodeSubject(subject, out, indenter);
        }

        // next do the resource
        if ((resource.size() != 0) || (resourceContent != null)) {
            out.print(indent);
            out.println("<Resource>");
            if (resourceContent != null)
                out.append(indenter.makeString()).append("<ResourceContent>")
                   .append(resourceContent).println("</ResourceContent>");
            encodeAttributes(resource, out, indenter);
            out.print(indent);
            out.println("</Resource>");
        } else {
            out.print(indent);
            out.println("<Resource/>");
        }

        // now the action
        if (action.size() != 0) {
            out.print(indent);
            out.println("<Action>");
            encodeAttributes(action, out, indenter);
            out.print(indent);
            out.println("</Action>");
        } else {
            out.print(indent);
            out.println("<Action/>");
        }


        //Bug ID:1745062 
        out.print(indent);
        out.println("<Environment>");
        // finally the environment, if there are any attrs
        if (environment.size() != 0) {
            encodeAttributes(environment, out, indenter);
        } 
        out.print(indent);
        out.println("</Environment>");

        // we're back to the top
        indenter.out();
        indenter.out();
        
        out.print(topIndent);
        out.println("</Request>");
    }
1353276
private List<CmsResourceInfo> getResourceInfos() {

        List<CmsResourceInfo> infos = new ArrayList<CmsResourceInfo>();
        for (CmsSite site : m_sitesToDelete) {
            infos.add(
                new CmsResourceInfo(site.getTitle(), site.getSiteRoot(), m_manager.getFavIcon(site.getSiteRoot())));
        }
        return infos;
    }
236055
public String getCurrentResourceName() {

        if (isMultiOperation()) {
            return "";
        }
        String resourceName = CmsResource.getName(getParamResource());
        if (resourceName.endsWith("/")) {
            resourceName = resourceName.substring(0, resourceName.length() - 1);
        }
        return resourceName;
    }