Created
August 19, 2010 12:32
-
-
Save robu/537763 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Override | |
| public void setTitle(String title) { | |
| ComponentList componentList = (ComponentList) getComponents(FIELD_NAME_TITLE); | |
| if (componentList == null) { | |
| componentList = new ComponentList(getContentContainer().getContent(true), FIELD_NAME_TITLE); | |
| getContentContainer().getContent(true).put(FIELD_NAME_TITLE, componentList); | |
| } | |
| Iterator<Component> compIter = componentList.iterator(); | |
| Component titleComponent = null; | |
| if (compIter.hasNext()) { | |
| titleComponent = compIter.next(); | |
| } else { | |
| titleComponent = new Component(componentList); | |
| titleComponent.setType("title"); | |
| componentList.add(titleComponent); | |
| } | |
| titleComponent.getContent().put("titleText", title); | |
| } | |
| @Transient | |
| public String getTitle() { | |
| ComponentList componentList = (ComponentList) getComponents(FIELD_NAME_TITLE); | |
| Iterator<Component> compIter = componentList.iterator(); | |
| Component titleComponent = null; | |
| if (compIter.hasNext()) { | |
| titleComponent = compIter.next(); | |
| } else { | |
| return ""; | |
| } | |
| return (String) titleComponent.getContent().get("titleText"); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <#-- | |
| @icon text_align_left | |
| @name Title | |
| --> | |
| <#include "../macros/util.ftl"/> | |
| <@dbgShowContextVariables/> | |
| <@inplace.text key="titleText" tag="h2" id="title" style="font-size: ${fontSize ! '14pt'}">${titleText}</@inplace.text> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <@inplace.components key="title" min=1 max=1 initial=["title"] valid=["title"]/> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment