Interface ComponentHelper
-
@ProviderType public interface ComponentHelper
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description StringgenerateClassicUIPlaceholder(String classNames, String title)Build the placeholder image HTML for the Classic UI.StringgetDDEditBlock(org.apache.sling.api.SlingHttpServletRequest request, String name, boolean... isConfigured)Convenience wrapper for getDDEditBlock(SlingHttpServletRequest request, String getName, WCMEditType editType, boolean...StringgetDDEditBlock(org.apache.sling.api.SlingHttpServletRequest request, String name, ComponentEditType.Type editType, boolean... isConfigured)Returns the HTML for creating DropTarget Edit Icon(s) for a specific (named) DropTargets defined by a Component.StringgetEditBlock(org.apache.sling.api.SlingHttpServletRequest request, ComponentEditType.Type editType, boolean... isConfigured)Creates a String HTML representation of the Component's edit block.StringgetEditIconImgTag(ComponentEditType.Type editType)Get the edit icon HTML img tag (>img ...<) for the specified EditTypebooleanisAuthoringMode(org.apache.sling.api.SlingHttpServletRequest request)Checks if the mode equals in an "Authoring" mode; Edit or Design.booleanprintDDEditBlock(org.apache.sling.api.SlingHttpServletRequest request, org.apache.sling.api.SlingHttpServletResponse response, String name, boolean... isConfigured)Print the DropTarget Edit Icon to the response.booleanprintDDEditBlock(org.apache.sling.api.SlingHttpServletRequest request, org.apache.sling.api.SlingHttpServletResponse response, String name, ComponentEditType.Type editType, boolean... isConfigured)Print the DropTarget Edit Icon to the response.booleanprintEditBlock(org.apache.sling.api.SlingHttpServletRequest request, org.apache.sling.api.SlingHttpServletResponse response, ComponentEditType.Type editType, boolean... isConfigured)Prints the HTML representation of the Component's edit block to the Response.booleanprintEditBlockOrNothing(org.apache.sling.api.SlingHttpServletRequest request, org.apache.sling.api.SlingHttpServletResponse response, ComponentEditType.Type editType, boolean... isConfigured)Wrapper for printEditBlock(...) with special handling for non-Authoring modes.
-
-
-
Method Detail
-
isAuthoringMode
boolean isAuthoringMode(org.apache.sling.api.SlingHttpServletRequest request)
Checks if the mode equals in an "Authoring" mode; Edit or Design.- Parameters:
request- the current request- Returns:
- true if the mode is either EDIT or DESIGN
-
printEditBlock
boolean printEditBlock(org.apache.sling.api.SlingHttpServletRequest request, org.apache.sling.api.SlingHttpServletResponse response, ComponentEditType.Type editType, boolean... isConfigured)Prints the HTML representation of the Component's edit block to the Response. If EditType DropTargets equals specified, Block will created by inspecting the Drop Targets.- Parameters:
request- the requestresponse- the responseeditType- the edit typeisConfigured- will display edit block if evaluates to FALSE- Returns:
- true if editblock has been printed
-
printEditBlockOrNothing
boolean printEditBlockOrNothing(org.apache.sling.api.SlingHttpServletRequest request, org.apache.sling.api.SlingHttpServletResponse response, ComponentEditType.Type editType, boolean... isConfigured)Wrapper for printEditBlock(...) with special handling for non-Authoring modes.Normal use: inclusion at top of component JSP before any markup is output:
<% if(WCMHelper.printEditBlockOrNothing(slingRequest, slingResponse, WCMEditType.NONE, StringUtils.isNotBlank(properties.get("foo", ""))) { return; // Stops execution of the JSP; leaving only the Edit Block rendered in Authoring Mode or nothing in non-Authoring Modes } %> *
- Parameters:
request- the requestresponse- the responseeditType- the edit typeisConfigured- will display edit block if evaluates to FALSE- Returns:
- true if editblock has been printed
-
printDDEditBlock
boolean printDDEditBlock(org.apache.sling.api.SlingHttpServletRequest request, org.apache.sling.api.SlingHttpServletResponse response, String name, boolean... isConfigured)Print the DropTarget Edit Icon to the response.Allow the WCMHelper to automatically derive the placeholder icon based on the DropTarget's Groups and Accepts properties.
Only displays if an 'AND' of all 'visible' parameters evaluates to true.
- Parameters:
request-response-isConfigured- will display edit block if evaluates to false- Returns:
-
printDDEditBlock
boolean printDDEditBlock(org.apache.sling.api.SlingHttpServletRequest request, org.apache.sling.api.SlingHttpServletResponse response, String name, ComponentEditType.Type editType, boolean... isConfigured)Print the DropTarget Edit Icon to the response.Specify the DropTarget Icon to display.
Only displays if an 'AND' of all 'visible' parameters evaluates to true.
- Parameters:
request-response-editType-isConfigured- will display edit block if evaluates to false- Returns:
-
getEditBlock
String getEditBlock(org.apache.sling.api.SlingHttpServletRequest request, ComponentEditType.Type editType, boolean... isConfigured)
Creates a String HTML representation of the Component's edit block. If EditType DropTargets equals specified, Block will created by inspecting the Drop Targets.- Parameters:
request-editType-isConfigured- will display edit block if evaluates to false- Returns:
-
getDDEditBlock
String getDDEditBlock(org.apache.sling.api.SlingHttpServletRequest request, String name, boolean... isConfigured)
Convenience wrapper for getDDEditBlock(SlingHttpServletRequest request, String getName, WCMEditType editType, boolean... visible) where editType equals null.- Parameters:
request-name-isConfigured- will display edit block if evaluates to false- Returns:
-
getDDEditBlock
String getDDEditBlock(org.apache.sling.api.SlingHttpServletRequest request, String name, ComponentEditType.Type editType, boolean... isConfigured)
Returns the HTML for creating DropTarget Edit Icon(s) for a specific (named) DropTargets defined by a Component.Allows the developer to specific the EditType Icon to be used for the Drop Target via editType parameter. If editType equals left null, the edit type will be derived based on the DropTarget's Groups and Accepts properties.
- Parameters:
request-editType-isConfigured- will display edit block if evaluates to false- Returns:
-
getEditIconImgTag
String getEditIconImgTag(ComponentEditType.Type editType)
Get the edit icon HTML img tag (>img ...<) for the specified EditType- Parameters:
editType-- Returns:
-
generateClassicUIPlaceholder
String generateClassicUIPlaceholder(String classNames, String title)
Build the placeholder image HTML for the Classic UI.- Parameters:
classNames- the HTML class names which will be added to the generated HTML.title- the title (if any) for the generated HTML.- Returns:
- an HTML fragment.
-
-