@Nonnull private JiraRendererPlugin getRenderer() { final JiraRendererPlugin renderer = rendererManager.getRendererForType(AtlassianWikiRenderer.RENDERER_TYPE); if (renderer == null) { throw new InfrastructureException("wikimarkup renderer not found, but it is required to render the project description"); } return renderer; } }
private void populateRendererParams(final Map<String, Object> velocityParams, final FieldLayoutItem fieldLayoutItem) { final String rendererType = (fieldLayoutItem != null) ? fieldLayoutItem.getRendererType() : null; velocityParams.put("rendererDescriptor", getRendererManager().getRendererForType(rendererType).getDescriptor()); velocityParams.put("rendererParams", new HashMap()); }
private Object processValueThroughRenderer(FieldLayoutItem fieldLayoutItem, Object value) { if (isRenderable()) { String rendererType = (fieldLayoutItem != null) ? fieldLayoutItem.getRendererType() : null; value = rendererManager.getRendererForType(rendererType).transformFromEdit(value); } return value; }
public String getContactAdministratorsMessage() { String message = getApplicationProperties().getDefaultBackedString(APKeys.JIRA_CONTACT_ADMINISTRATORS_MESSSAGE); return rendererManager.getRendererForType(AtlassianWikiRenderer.RENDERER_TYPE).render(message, null); }
@ActionViewData(key="renderedMessageContent") public String getRenderedMessage() { String message = getApplicationProperties().getDefaultBackedText(APKeys.JIRA_CONTACT_ADMINISTRATORS_MESSSAGE); if (isEmpty(message) || !getShouldDisplayForm()) { message = getText("admin.generalconfiguration.contact.administrators.message.default"); } return rendererManager.getRendererForType(AtlassianWikiRenderer.RENDERER_TYPE).render(message, null); }
@Override public void updateValue(FieldLayoutItem fieldLayoutItem, Issue issue, ModifiedValue modifiedValue, IssueChangeHolder issueChangeHolder) { // all comment creations are seen as an update Map<String, Object> commentParams = (Map<String, Object>) modifiedValue.getNewValue(); String body = (String) commentParams.get(getId()); // allow the renderer for this field a change to transform the value String rendererType = (fieldLayoutItem != null) ? fieldLayoutItem.getRendererType() : null; body = (String) rendererManager.getRendererForType(rendererType).transformFromEdit(body); if (commentParams.containsKey(EDIT_COMMENT)) { editComment(issueChangeHolder, commentParams, body); } else if(commentParams.containsKey(REMOVE_COMMENT)) { removeComment(issueChangeHolder, commentParams); } else { if (StringUtils.isNotBlank(body)) { createComment(issue, issueChangeHolder, commentParams, body); } } }
/** * Returns the edit HTML for this renderable application property. * * @param fieldName the field name to use in the generated HTML * @return a String containing the edit HTML */ @Override public final String getEditHtml(String fieldName) { if (isOnDemand()) { JiraRendererModuleDescriptor rendererDescriptor = rendererManager.getRendererForType(AtlassianWikiRenderer.RENDERER_TYPE).getDescriptor(); Map<String, String> renderParams = Maps.newHashMap(ImmutableMap.of( "rows", "10", "cols", "60", "wrap", "virtual", "class", "long-field" )); return rendererDescriptor.getEditVM(getValue(), null, AtlassianWikiRenderer.RENDERER_TYPE, fieldName, fieldName, renderParams, false); } return renderTemplate(EDIT_VM, new Context(fieldName)); }
velocityParams.put("rendererDescriptor", rendererManager.getRendererForType(rendererType).getDescriptor()); velocityParams.put("groupLevels", getGroupLevels()); velocityParams.put("mentionable", mentionService.isUserAbleToMention(authenticationContext.getUser()));
public String getRendererDisplayName(String rendererType) { HackyRendererType hackyRendererType = HackyRendererType.fromKey(rendererType); if (hackyRendererType != null) { return getText(hackyRendererType.getDisplayNameI18nKey()); } else { return rendererManager.getRendererForType(rendererType).getDescriptor().getName(); } }
public String getRendererDisplayName(String rendererType) { final HackyRendererType hackyRendererType = HackyRendererType.fromKey(rendererType); if (hackyRendererType != null) { return getText(hackyRendererType.getDisplayNameI18nKey()); } else { return rendererManager.getRendererForType(rendererType).getDescriptor().getName(); } }
public void updateIssue(FieldLayoutItem fieldLayoutItem, MutableIssue issue, Map fieldValueHolder) { if (fieldValueHolder.containsKey(getId())) { String rendererType = (fieldLayoutItem != null) ? fieldLayoutItem.getRendererType() : null; // give the renderer a change to transform the incomming value String env = (String)rendererManager.getRendererForType(rendererType).transformFromEdit(getValueFromParams(fieldValueHolder)); if (TextUtils.stringSet(env)) issue.setEnvironment(env); else issue.setEnvironment(null); } }
public void updateIssue(FieldLayoutItem fieldLayoutItem, MutableIssue issue, Map fieldValueHolder) { if (fieldValueHolder.containsKey(getId())) { final String rendererType = (fieldLayoutItem != null) ? fieldLayoutItem.getRendererType() : null; // give the renderer a change to transform the incomming value final String desc = (String) rendererManager.getRendererForType(rendererType).transformFromEdit(getValueFromParams(fieldValueHolder)); if (TextUtils.stringSet(desc)) issue.setDescription(desc); else issue.setDescription(null); } }
if (customField != null && customField.isRenderable() && (fieldLayoutItem != null)) params.put("rendererDescriptor", ComponentAccessor.getComponent(RendererManager.class).getRendererForType(fieldLayoutItem.getRendererType()).getDescriptor()); params.put("rendererParams", new HashMap());
public String getEditHtml(FieldLayoutItem fieldLayoutItem, OperationContext operationContext, Action action, Issue issue, Map displayParameters) { Map velocityParams = getVelocityParams(fieldLayoutItem, action, issue, displayParameters); populateVelocityParams(operationContext.getFieldValuesHolder(), velocityParams); if (isRenderable()) { String rendererType = (fieldLayoutItem != null) ? fieldLayoutItem.getRendererType() : null; velocityParams.put("rendererDescriptor", rendererManager.getRendererForType(rendererType).getDescriptor()); } return renderTemplate(getEditTemplateName(), velocityParams); }
/** * Renders the input control for the Contact administrators message. * * @return the HTML of the input control to be displayed on the form. */ public String getContactAdministratorsMessageEditHtml() { try { final JiraRendererModuleDescriptor rendererDescriptor = rendererManager.getRendererForType(AtlassianWikiRenderer.RENDERER_TYPE).getDescriptor(); final Map<Object,Object> rendererParams = MapBuilder.newBuilder().add("rows", "10").add("cols", "60").add("wrap", "virtual").add("class", "long-field").toMutableMap(); return rendererDescriptor.getEditVM(getContactAdministratorsMessage(), null, AtlassianWikiRenderer.RENDERER_TYPE, "contactAdministratorsMessage", "contactAdministratorsMessage", rendererParams, false); } catch (DataAccessException e) { log.error("Could not render edit template for Contact Administrators Message", e); return ""; } }
/** * Renders the input control for the Work Description (i.e. Comment) of the Log Work form. The control will be different * depending on which renderer is chosen for the Log Work field for this specific issue context. * * @return the HTML of the input control to be displayed on the form. */ public String getWorkDescriptionEditHtml() { try { final FieldLayoutItem worklogFieldLayoutItem = fieldLayoutManager.getFieldLayout(getIssueObject()).getFieldLayoutItem(IssueFieldConstants.WORKLOG); final String rendererType = (worklogFieldLayoutItem != null) ? worklogFieldLayoutItem.getRendererType() : null; final JiraRendererModuleDescriptor rendererDescriptor = rendererManager.getRendererForType(rendererType).getDescriptor(); final Map<Object,Object> rendererParams = MapBuilder.newBuilder().add("rows", "10").add("cols", "60").add("wrap", "virtual").add("class", "long-field").toMutableMap(); return rendererDescriptor.getEditVM(getComment(), getIssueObject().getKey(), rendererType, "comment", "comment", rendererParams, false); } catch (DataAccessException e) { log.error("Could not render edit template for work description", e); return ""; } }
protected void doValidation() { final OrderableField field = getSelectedLayoutItem().getOrderableField(); if (isFieldLocked(getSelectedLayoutItem().getOrderableField())) { addErrorMessage(getText("admin.managed.configuration.items.customfield.error.cannot.alter.renderer.locked", field.getName()), Reason.FORBIDDEN); return; } if (hackyFieldRendererRegistry.shouldOverrideDefaultRenderers(field)) { if (HackyRendererType.fromKey(getSelectedRendererType()) == null) { addErrorMessage(getText("admin.errors.fieldlayout.cannot.add.renderer.type",getSelectedRendererType())); } } else { if(!(field instanceof RenderableField && ((RenderableField) field).isRenderable()) ) { addErrorMessage(getText("admin.errors.fieldlayout.cannot.set.renderer","'" + getText(field.getNameKey()) + "'")); } if(!getRendererManager().getRendererForType(getSelectedRendererType()).getRendererType().equals(getSelectedRendererType())) { addErrorMessage(getText("admin.errors.fieldlayout.cannot.add.renderer.type",getSelectedRendererType())); } } }