Checks if editing of the given component in edit mode is forbidden due to a lock in the template editor
for this component.
@param wcmComponentContext WCM component context
@return true if editing the component is forbidden
496462
public static boolean isEditRestricted(@NotNull ComponentContext wcmComponentContext) {
    Page page = wcmComponentContext.getPage();
    if (page == null) {
      return false;
    }
    ResourceResolver resourceResolver = wcmComponentContext.getResource().getResourceResolver();
    Template template = page.getTemplate();

    if (template == null || isPageInTemplateDefinition(page) || !isEditableTemplate(template)) {
      return false;
    }

    // check if the current resource path already points to a structure path in the editable template
    String resourcePath = wcmComponentContext.getResource().getPath();
    String templateStructurePath = template.getPath() + "/" + NN_EDITABLE_TEMPLATE_STRUCTURE + "/" + JCR_CONTENT;
    String resourcePathInStructure = null;
    if (StringUtils.startsWith(resourcePath, templateStructurePath + "/")) {
      resourcePathInStructure = resourcePath;
    }
    else {
      // resource path points to the current page, build structure path from path in page
      String relativePathInPage = StringUtils.substringAfter(resourcePath, page.getContentResource().getPath());
      if (StringUtils.isNotEmpty(relativePathInPage)) {
        resourcePathInStructure = templateStructurePath + relativePathInPage;
      }
    }
    if (resourcePathInStructure == null) {
      return false;
    }

    Resource resourceInStructure = resourceResolver.getResource(resourcePathInStructure);
    if (resourceInStructure == null) {
      return false;
    }
    return !resourceInStructure.getValueMap().get(PN_EDITABLE, false);
  }
774443
static boolean isDirectEditEnabled(CmsObject cms) {

        return !cms.getRequestContext().getCurrentProject().isOnlineProject()
            && (cms.getRequestContext().getAttribute(CmsGwtConstants.PARAM_DISABLE_DIRECT_EDIT) == null);
    }
653870
@Override
	public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
		WMultiSelectPair multiSelectPair = (WMultiSelectPair) component;
		XmlStringBuilder xml = renderContext.getWriter();
		boolean readOnly = multiSelectPair.isReadOnly();

		xml.appendTagOpen("ui:multiselectpair");
		xml.appendAttribute("id", component.getId());
		xml.appendOptionalAttribute("class", component.getHtmlClass());
		xml.appendOptionalAttribute("track", component.isTracking(), "true");
		xml.appendOptionalAttribute("hidden", multiSelectPair.isHidden(), "true");
		if (readOnly) {
			xml.appendAttribute("readOnly", "true");
		} else {
			int rows = multiSelectPair.getRows();
			int min = multiSelectPair.getMinSelect();
			int max = multiSelectPair.getMaxSelect();
			xml.appendAttribute("size", rows < 2 ? WMultiSelectPair.DEFAULT_ROWS : rows);
			xml.appendOptionalAttribute("disabled", multiSelectPair.isDisabled(), "true");
			xml.appendOptionalAttribute("required", multiSelectPair.isMandatory(), "true");
			xml.appendOptionalAttribute("shuffle", multiSelectPair.isShuffle(), "true");
			xml.appendOptionalAttribute("fromListName", multiSelectPair.getAvailableListName());
			xml.appendOptionalAttribute("toListName", multiSelectPair.getSelectedListName());
			xml.appendOptionalAttribute("accessibleText", multiSelectPair.getAccessibleText());
			xml.appendOptionalAttribute("min", min > 0, min);
			xml.appendOptionalAttribute("max", max > 0, max);
		}
		xml.appendClose();

		// Options
		List<?> options = multiSelectPair.getOptions();
		boolean renderSelectionsOnly = readOnly;

		if (options != null) {
			if (multiSelectPair.isShuffle()) {
				// We need to render the selected options in order
				renderOrderedOptions(multiSelectPair, options, 0, xml, renderSelectionsOnly);
			} else {
				renderUnorderedOptions(multiSelectPair, options, 0, xml, renderSelectionsOnly);
			}
		}

		if (!readOnly) {
			DiagnosticRenderUtil.renderDiagnostics(multiSelectPair, renderContext);
		}
		xml.appendEndTag("ui:multiselectpair");
	}
993541
function() {
      var t = this,
          isEditMode = t.$el.hasClass('edit-mode'),
          text = isEditMode ? 'Lock Components' : 'Edit Components',
          icon = isEditMode ? 'lock' : 'edit';
      t.$('.nm-pvm-lock').text(text);
      t.$('.nm-pvm-edit i').attr('class', 'icon-' + icon);
    }
870125
@Override
	public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {

		WTree tree = (WTree) component;
		XmlStringBuilder xml = renderContext.getWriter();

		// Check if rendering an open item request
		String openId = tree.getOpenRequestItemId();
		if (openId != null) {
			handleOpenItemRequest(tree, xml, openId);
			return;
		}

		// Check the tree has tree items (WCAG requirement)
		TreeItemModel model = tree.getTreeModel();
		if (model == null || model.getRowCount() <= 0) {
			LOG.warn("Tree not rendered as it has no items.");
			return;
		}

		xml.appendTagOpen("ui:tree");
		xml.appendAttribute("id", component.getId());
		xml.appendOptionalAttribute("class", component.getHtmlClass());
		xml.appendOptionalAttribute("track", component.isTracking(), "true");
		xml.appendOptionalAttribute("htree", WTree.Type.HORIZONTAL == tree.getType(), "true");
		xml.appendOptionalAttribute("multiple", WTree.SelectMode.MULTIPLE == tree.getSelectMode(), "true");
		xml.appendOptionalAttribute("disabled", tree.isDisabled(), "true");
		xml.appendOptionalAttribute("hidden", tree.isHidden(), "true");
		xml.appendOptionalAttribute("required", tree.isMandatory(), "true");

		switch (tree.getExpandMode()) {
			case CLIENT:
				xml.appendAttribute("mode", "client");
				break;

			case DYNAMIC:
				xml.appendAttribute("mode", "dynamic");
				break;

			case LAZY:
				xml.appendAttribute("mode", "lazy");
				break;

			default:
				throw new IllegalStateException("Invalid expand mode: " + tree.getType());
		}
		xml.appendClose();

		// Render margin
		MarginRendererUtil.renderMargin(tree, renderContext);

		if (tree.getCustomTree() == null) {
			handlePaintItems(tree, xml);
		} else {
			handlePaintCustom(tree, xml);
		}

		DiagnosticRenderUtil.renderDiagnostics(tree, renderContext);
		xml.appendEndTag("ui:tree");
	}
797359
def is_edit_allowed(self):
        
        checkPermission = self.context.portal_membership.checkPermission
        return checkPermission(FieldEditResultsInterpretation, self.context)
403589
@Override
	public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
		WPanel panel = (WPanel) component;
		XmlStringBuilder xml = renderContext.getWriter();
		WButton submitButton = panel.getDefaultSubmitButton();
		String submitId = submitButton == null ? null : submitButton.getId();
		String titleText = panel.getTitleText();

		boolean renderChildren = isRenderContent(panel);

		xml.appendTagOpen("ui:panel");
		xml.appendAttribute("id", component.getId());
		xml.appendOptionalAttribute("class", component.getHtmlClass());
		xml.appendOptionalAttribute("track", component.isTracking(), "true");
		if (PanelMode.LAZY.equals(panel.getMode())) {
			xml.appendOptionalAttribute("hidden", !renderChildren, "true");
		} else {
			xml.appendOptionalAttribute("hidden", component.isHidden(), "true");
		}
		xml.appendOptionalAttribute("buttonId", submitId);
		xml.appendOptionalAttribute("title", titleText);
		xml.appendOptionalAttribute("accessKey", Util.upperCase(panel.getAccessKeyAsString()));
		xml.appendOptionalAttribute("type", getPanelType(panel));
		xml.appendOptionalAttribute("mode", getPanelMode(panel));

		xml.appendClose();

		// Render margin
		MarginRendererUtil.renderMargin(panel, renderContext);

		if (renderChildren) {
			renderChildren(panel, renderContext);
		} else {
			// Content will be loaded via AJAX
			xml.append("<ui:content/>");
		}

		xml.appendEndTag("ui:panel");
	}
771829
public static UIContext getContextForComponent(final WComponent component) {
		// Start with the current Context
		UIContext result = UIContextHolder.getCurrent();
		// Go through the contexts until we find the component
		while (result instanceof SubUIContext && !((SubUIContext) result).isInContext(component)) {
			result = ((SubUIContext) result).getBacking();
		}
		return result;
	}
40328
public boolean isShowInContext(String currentContext) {

        if ((m_settings == null)
            || !m_settings.containsKey(CmsTemplateContextInfo.SETTING)
            || CmsStringUtil.isEmptyOrWhitespaceOnly(m_settings.get(CmsTemplateContextInfo.SETTING))) {
            return true;
        }
        return CmsStringUtil.splitAsList(m_settings.get(CmsTemplateContextInfo.SETTING), "|").contains(currentContext);
    }
346604
@Override
	public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
		WMultiTextField textField = (WMultiTextField) component;
		XmlStringBuilder xml = renderContext.getWriter();

		boolean readOnly = textField.isReadOnly();

		String[] values = textField.getTextInputs();

		xml.appendTagOpen("ui:multitextfield");
		xml.appendAttribute("id", component.getId());
		xml.appendOptionalAttribute("class", component.getHtmlClass());
		xml.appendOptionalAttribute("track", component.isTracking(), "true");
		xml.appendOptionalAttribute("hidden", textField.isHidden(), "true");

		if (readOnly) {
			xml.appendAttribute("readOnly", "true");
		} else {
			int cols = textField.getColumns();
			int minLength = textField.getMinLength();
			int maxLength = textField.getMaxLength();
			int maxInputs = textField.getMaxInputs();
			String pattern = textField.getPattern();
			xml.appendOptionalAttribute("disabled", textField.isDisabled(), "true");
			xml.appendOptionalAttribute("required", textField.isMandatory(), "true");
			xml.appendOptionalAttribute("toolTip", textField.getToolTip());
			xml.appendOptionalAttribute("accessibleText", textField.getAccessibleText());
			xml.appendOptionalAttribute("size", cols > 0, cols);
			xml.appendOptionalAttribute("minLength", minLength > 0, minLength);
			xml.appendOptionalAttribute("maxLength", maxLength > 0, maxLength);
			xml.appendOptionalAttribute("max", maxInputs > 0, maxInputs);
			xml.appendOptionalAttribute("pattern", !Util.empty(pattern), pattern);
			// NOTE: do not use HtmlRenderUtil.getEffectivePlaceholder for placeholder - we do not want to echo "required" in every field.
			String placeholder = textField.getPlaceholder();
			xml.appendOptionalAttribute("placeholder", !Util.empty(placeholder), placeholder);
			xml.appendOptionalAttribute("title", I18nUtilities.format(null, InternalMessages.DEFAULT_MULTITEXTFIELD_TIP));
		}
		xml.appendClose();

		if (values != null) {
			for (String value : values) {
				xml.appendTag("ui:value");
				xml.appendEscaped(value);
				xml.appendEndTag("ui:value");
			}
		}

		if (!readOnly) {
			DiagnosticRenderUtil.renderDiagnostics(textField, renderContext);
		}
		xml.appendEndTag("ui:multitextfield");
	}
780123
@Override
	public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
		WPasswordField field = (WPasswordField) component;
		XmlStringBuilder xml = renderContext.getWriter();

		boolean readOnly = field.isReadOnly();

		xml.appendTagOpen(TAG_NAME);
		xml.appendAttribute("id", component.getId());
		xml.appendOptionalAttribute("class", component.getHtmlClass());
		xml.appendOptionalAttribute("track", component.isTracking(), "true");
		xml.appendOptionalAttribute("hidden", component.isHidden(), "true");

		if (readOnly) {
			xml.appendAttribute("readOnly", "true");
			xml.appendEnd();
			return;
		}
		int cols = field.getColumns();
		int minLength = field.getMinLength();
		int maxLength = field.getMaxLength();
		WComponent submitControl = field.getDefaultSubmitButton();
		String submitControlId = submitControl == null ? null : submitControl.getId();

		xml.appendOptionalAttribute("disabled", field.isDisabled(), "true");
		xml.appendOptionalAttribute("required", field.isMandatory(), "true");
		xml.appendOptionalAttribute("minLength", minLength > 0, minLength);
		xml.appendOptionalAttribute("maxLength", maxLength > 0, maxLength);
		xml.appendOptionalAttribute("toolTip", field.getToolTip());
		xml.appendOptionalAttribute("accessibleText", field.getAccessibleText());
		xml.appendOptionalAttribute("size", cols > 0, cols);
		xml.appendOptionalAttribute("buttonId", submitControlId);
		String placeholder = field.getPlaceholder();
		xml.appendOptionalAttribute("placeholder", !Util.empty(placeholder), placeholder);
		String autocomplete = field.getAutocomplete();
		xml.appendOptionalAttribute("autocomplete", !Util.empty(autocomplete), autocomplete);

		List<Diagnostic> diags = field.getDiagnostics(Diagnostic.ERROR);
		if (diags == null || diags.isEmpty()) {
			xml.appendEnd();
			return;
		}
		xml.appendClose();
		DiagnosticRenderUtil.renderDiagnostics(field, renderContext);
		xml.appendEndTag(TAG_NAME);
	}
908902
public boolean containsContextsWithACModel(AbstractACModel acModel) {
        for (ProcessContext context : getComponents()) {
            if (context.getACModel().equals(acModel)) {
                return true;
            }
        }
        return false;
    }
203783
@Override
	public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
		WHeading heading = (WHeading) component;
		XmlStringBuilder xml = renderContext.getWriter();

		xml.appendTagOpen("ui:heading");
		xml.appendAttribute("id", component.getId());
		xml.appendOptionalAttribute("class", component.getHtmlClass());
		xml.appendOptionalAttribute("track", component.isTracking(), "true");
		xml.appendAttribute("level", heading.getHeadingLevel().getLevel());
		xml.appendOptionalAttribute("accessibleText", heading.getAccessibleText());
		xml.appendClose();

		// Render margin
		MarginRendererUtil.renderMargin(heading, renderContext);

		if (heading.getDecoratedLabel() == null) {
			// Constructed with a String
			xml.append(heading.getText(), heading.isEncodeText());
		} else {
			heading.getDecoratedLabel().paint(renderContext);
		}

		xml.appendEndTag("ui:heading");
	}
432461
@Override
	public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
		WMultiFileWidget widget = (WMultiFileWidget) component;
		XmlStringBuilder xml = renderContext.getWriter();

		// Check if rendering a file upload response
		String uploadId = widget.getFileUploadRequestId();
		if (uploadId != null) {
			handleFileUploadRequest(widget, xml, uploadId);
			return;
		}
		boolean readOnly = widget.isReadOnly();


		xml.appendTagOpen(TAG_NAME);
		xml.appendAttribute("id", component.getId());
		xml.appendOptionalAttribute("class", component.getHtmlClass());
		xml.appendOptionalAttribute("track", component.isTracking(), "true");
		xml.appendOptionalAttribute("hidden", widget.isHidden(), "true");
		if (readOnly) {
			xml.appendAttribute("readOnly", "true");
		} else {
			long maxFileSize = widget.getMaxFileSize();
			int maxFiles = widget.getMaxFiles();
			WComponent dropzone = widget.getDropzone();
			WImageEditor editor = widget.getEditor();

			xml.appendOptionalAttribute("disabled", widget.isDisabled(), "true");
			xml.appendOptionalAttribute("required", widget.isMandatory(), "true");
			xml.appendOptionalAttribute("toolTip", widget.getToolTip());
			xml.appendOptionalAttribute("accessibleText", widget.getAccessibleText());
			xml.appendOptionalAttribute("acceptedMimeTypes", typesToString(widget.getFileTypes()));
			xml.appendOptionalAttribute("maxFileSize", maxFileSize > 0, maxFileSize);
			xml.appendOptionalAttribute("maxFiles", maxFiles > 0, maxFiles);
			if (dropzone != null) {
				xml.appendAttribute("dropzone", dropzone.getId());
			}
			if (editor != null) {
				xml.appendAttribute("editor", editor.getId());
				if (editor.getUseCamera()) {
					xml.appendAttribute("camera", true);
				}
			}
		}
		if (widget.getColumns() != null) {
			xml.appendAttribute("cols", widget.getColumns());
		}
		if (widget.getFileAjaxAction() != null) {
			xml.appendAttribute("ajax", "true");
		}

		List<Diagnostic> diags = readOnly ? null : widget.getDiagnostics(Diagnostic.ERROR);

		if (widget.getFiles().isEmpty()) {
			if (readOnly || diags == null || diags.isEmpty()) {
				xml.appendEnd();
				return;
			}
			xml.appendClose();
		} else {
			xml.appendClose();
			// Render files
			int i = 0;
			for (FileWidgetUpload file : widget.getFiles()) {
				FileWidgetRendererUtil.renderFileElement(widget, xml, file, i++);
			}
		}
		if (!readOnly && diags != null && !diags.isEmpty()) {
			DiagnosticRenderUtil.renderDiagnostics(widget, renderContext);
		}
		xml.appendEndTag(TAG_NAME);
	}
316654
@Override
	public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
		WEditableImage editableImage = (WEditableImage) component;
		XmlStringBuilder xml = renderContext.getWriter();

		// No image set
		if (editableImage.getImage() == null && editableImage.getImageUrl() == null) {
			return;
		}

		WImageRenderer.renderTagOpen(editableImage, xml);
		WComponent uploader = editableImage.getEditUploader();
		if (uploader != null) {
			xml.appendAttribute("data-wc-editor", uploader.getId());
		}
		xml.appendEnd();
	}
81199
public boolean isAccessible(Map context, Object target, Member member, String propertyName)
	{
	    int         modifiers = member.getModifiers();
	    boolean     result = Modifier.isPublic(modifiers);

	    if (!result) {
	        if (Modifier.isPrivate(modifiers)) {
	            result = getAllowPrivateAccess();
	        } else {
	            if (Modifier.isProtected(modifiers)) {
	                result = getAllowProtectedAccess();
	            } else {
	                result = getAllowPackageProtectedAccess();
	            }
	        }
	    }
	    return result;
	}
971307
@Override
	public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
		WTableRowRenderer renderer = (WTableRowRenderer) component;
		XmlStringBuilder xml = renderContext.getWriter();
		WTable table = renderer.getTable();
		TableModel dataModel = table.getTableModel();

		int[] columnOrder = table.getColumnOrder();
		final int numCols = columnOrder == null ? table.getColumnCount() : columnOrder.length;

		// Get current row details
		RowIdWrapper wrapper = renderer.getCurrentRowIdWrapper();
		List<Integer> rowIndex = wrapper.getRowIndex();

		boolean tableSelectable = table.getSelectMode() != SelectMode.NONE;
		boolean rowSelectable = tableSelectable && dataModel.isSelectable(rowIndex);
		boolean rowSelected = rowSelectable && table.getSelectedRows().contains(wrapper.getRowKey());

		boolean tableExpandable = table.getExpandMode() != WTable.ExpandMode.NONE;
		boolean rowExpandable = tableExpandable && dataModel.isExpandable(rowIndex) && wrapper.
				hasChildren();
		boolean rowExpanded = rowExpandable && table.getExpandedRows().contains(wrapper.getRowKey());

		String rowIndexAsString = TableUtil.rowIndexListToString(rowIndex);

		xml.appendTagOpen("ui:tr");
		xml.appendAttribute("rowIndex", rowIndexAsString);
		xml.appendOptionalAttribute("unselectable", !rowSelectable, "true");
		xml.appendOptionalAttribute("selected", rowSelected, "true");
		xml.appendOptionalAttribute("expandable", rowExpandable && !rowExpanded, "true");
		xml.appendClose();

		// wrote the column cell.
		boolean isRowHeader = table.isRowHeaders(); // need this before we get into the loop
		for (int i = 0; i < numCols; i++) {
			int colIndex = columnOrder == null ? i : columnOrder[i];
			WTableColumn col = table.getColumn(colIndex);
			String cellTag = "ui:td";

			if (col.isVisible()) {
				if (isRowHeader) { // The first rendered column will be the row header.
					cellTag = "ui:th";
					isRowHeader = false; // only set one col as the row header.
				}
				xml.appendTag(cellTag);
				renderer.getRenderer(colIndex).paint(renderContext);
				xml.appendEndTag(cellTag);
			}
		}

		if (rowExpandable) {
			xml.appendTagOpen("ui:subtr");
			xml.appendOptionalAttribute("open", rowExpanded, "true");
			xml.appendClose();

			if (rowExpanded || table.getExpandMode() == ExpandMode.CLIENT) {
				renderChildren(renderer, renderContext, wrapper.getChildren());
			}

			xml.appendEndTag("ui:subtr");
		}

		xml.appendEndTag("ui:tr");
	}