info.magnolia.module.templatingcomponents.components
Class SingletonParagraphBar

java.lang.Object
  extended by info.magnolia.module.templatingcomponents.components.AbstractAuthoringUiComponent
      extended by info.magnolia.module.templatingcomponents.components.SingletonParagraphBar
All Implemented Interfaces:
AuthoringUiComponent

public class SingletonParagraphBar
extends AbstractAuthoringUiComponent

An hybrid between a new bar and an edit bar for non-moveable paragraphs: it's either added by the editor, edited, or removed. This is currently meant to be used in conjunction with the regular edit bar component: if the request content is present, wrappers should render their content (which should render said paragraph with an edit bar), and if not, this renders a "new bar".

Version:
$Revision: $ ($Author: $)
Author:
gjoseph

Constructor Summary
SingletonParagraphBar(ServerConfiguration server, AggregationState aggregationState)
           
 
Method Summary
protected  void doRender(Appendable out)
           
static boolean isInSingleton()
          Utility method for other components to determine if they are being rendered inside a SingletonParagraphBar.
static SingletonParagraphBar make(ServerConfiguration serverCfg, AggregationState aggState, String contentName, List<String> allowedParagraphs, String enableButtonLabel)
           
 void postRender()
          Override this method if you need to "do something" once the component is rendered, i.e cleanup the context.
 void setAllowedParagraphs(List<String> allowedParagraphs)
           
 void setContentName(String contentName)
           
 void setEnableButtonLabel(String enableButtonLabel)
           
 
Methods inherited from class info.magnolia.module.templatingcomponents.components.AbstractAuthoringUiComponent
asString, currentContent, getAggregationState, getI18BasenameFor, getMessage, getMessage, getServer, render, shouldRender
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SingletonParagraphBar

public SingletonParagraphBar(ServerConfiguration server,
                             AggregationState aggregationState)
Method Detail

isInSingleton

public static boolean isInSingleton()
Utility method for other components to determine if they are being rendered inside a SingletonParagraphBar.


make

public static SingletonParagraphBar make(ServerConfiguration serverCfg,
                                         AggregationState aggState,
                                         String contentName,
                                         List<String> allowedParagraphs,
                                         String enableButtonLabel)
Parameters:
serverCfg -
aggState -
contentName - the name of the node which contains (or will contain) the singleton paragraph; this is a child node of AbstractAuthoringUiComponent.currentContent().
allowedParagraphs - the list of paragraph definitions (their names) that are allow to be added by this component
enableButtonLabel - if null, default will be used

setContentName

public void setContentName(String contentName)

setAllowedParagraphs

public void setAllowedParagraphs(List<String> allowedParagraphs)

setEnableButtonLabel

public void setEnableButtonLabel(String enableButtonLabel)

doRender

protected void doRender(Appendable out)
                 throws IOException,
                        javax.jcr.RepositoryException
Specified by:
doRender in class AbstractAuthoringUiComponent
Throws:
IOException
javax.jcr.RepositoryException

postRender

public void postRender()
Description copied from class: AbstractAuthoringUiComponent
Override this method if you need to "do something" once the component is rendered, i.e cleanup the context.

Specified by:
postRender in interface AuthoringUiComponent
Overrides:
postRender in class AbstractAuthoringUiComponent


Copyright © 2003-2012 Magnolia International Ltd.. All Rights Reserved.