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 java.lang.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  java.lang.String asString(java.util.List<java.lang.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(java.lang.Appendable out)
           
protected  AggregationState getAggregationState()
           
protected  java.lang.String getI18BasenameFor(Content content)
           
protected  java.lang.String getMessage(Content context, java.lang.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  java.lang.String getMessage(java.lang.String basename, java.lang.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(java.lang.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(java.lang.Appendable out)
            throws java.io.IOException
Specified by:
render in interface AuthoringUiComponent
Throws:
java.io.IOException

doRender

protected abstract void doRender(java.lang.Appendable out)
                          throws java.io.IOException,
                                 javax.jcr.RepositoryException
Throws:
java.io.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 java.lang.String getMessage(Content context,
                                      java.lang.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 java.lang.String getI18BasenameFor(Content content)

getMessage

protected java.lang.String getMessage(java.lang.String basename,
                                      java.lang.String key)

asString

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



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