info.magnolia.module.templatingcomponents.components
Class AbstractAuthoringUiComponent

java.lang.Object
  extended by info.magnolia.module.templatingcomponents.components.AbstractAuthoringUiComponent
All Implemented Interfaces:
AuthoringUiComponent
Direct Known Subclasses:
EditBar, NewBar, PageEditBar, SingletonParagraphBar

public abstract class AbstractAuthoringUiComponent
extends Object
implements AuthoringUiComponent

Common subclass for ui components, provides utility methods and defaults. Implementations should expose setter methods for their specific parameters (so that template-specific wrappers can set parameters). (no need to clutter things up with getters). Implementation might also expose static factory methods, which can take care of default values, i.e for labels.

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

Constructor Summary
protected AbstractAuthoringUiComponent(ServerConfiguration server, AggregationState aggregationState)
           
 
Method Summary
protected  String asString(List<String> strings)
          Utility method - our current gui components (magnolia-gui) expect comma separated strings.
protected  Content currentContent()
          Returns the "current content" from the aggregation state.
protected abstract  void doRender(Appendable out)
           
protected  AggregationState getAggregationState()
           
protected  String getI18BasenameFor(Content content)
           
protected  String getMessage(Content context, String key)
          The given node, if it has a mgnl:template property in it's metadata, will be used in conjunction with TemplateManager and ParagraphManager to figure out the i18nBasename to use to translate this key.
protected  String getMessage(String basename, String key)
           
protected  ServerConfiguration getServer()
           
 void postRender()
          Override this method if you need to "do something" once the component is rendered, i.e cleanup the context.
 void render(Appendable out)
           
protected  boolean shouldRender()
          Override this method if the component needs to be rendered under different conditions.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractAuthoringUiComponent

protected AbstractAuthoringUiComponent(ServerConfiguration server,
                                       AggregationState aggregationState)
Method Detail

getServer

protected ServerConfiguration getServer()

getAggregationState

protected AggregationState getAggregationState()

render

public void render(Appendable out)
            throws IOException
Specified by:
render in interface AuthoringUiComponent
Throws:
IOException

doRender

protected abstract void doRender(Appendable out)
                          throws IOException,
                                 javax.jcr.RepositoryException
Throws:
IOException
javax.jcr.RepositoryException

postRender

public void postRender()
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

currentContent

protected Content currentContent()
Returns the "current content" from the aggregation state. Override this method if your component needs a different target node.


shouldRender

protected boolean shouldRender()
Override this method if the component needs to be rendered under different conditions.


getMessage

protected String getMessage(Content context,
                            String key)
The given node, if it has a mgnl:template property in it's metadata, will be used in conjunction with TemplateManager and ParagraphManager to figure out the i18nBasename to use to translate this key.


getI18BasenameFor

protected String getI18BasenameFor(Content content)

getMessage

protected String getMessage(String basename,
                            String key)

asString

protected String asString(List<String> strings)
Utility method - our current gui components (magnolia-gui) expect comma separated strings.



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