diff --git a/source/java/org/alfresco/web/bean/generator/HeaderSeparatorGenerator.java b/source/java/org/alfresco/web/bean/generator/HeaderSeparatorGenerator.java deleted file mode 100644 index 2cb6e31f9b..0000000000 --- a/source/java/org/alfresco/web/bean/generator/HeaderSeparatorGenerator.java +++ /dev/null @@ -1,23 +0,0 @@ -package org.alfresco.web.bean.generator; - -import javax.faces.component.UIComponent; - -import org.alfresco.web.ui.repo.component.property.PropertySheetItem; - -/** - * Generates a component to represent a separator that gets rendered - * as a header. - * - * @author gavinc - */ -public class HeaderSeparatorGenerator extends SeparatorGenerator -{ - @Override - protected String getHtml(UIComponent component, PropertySheetItem item) - { - String html = "
The HTML to be used for the separator is configured via the
+ * setHtml
method.
+ *
+ * @author gavinc
+ */
+public class HtmlSeparatorGenerator extends BaseComponentGenerator
+{
+ protected String html = "default";
+
+ /**
+ * Returns the HTML configured to be used for this separator
+ *
+ * @return The HTML to display
+ */
+ public String getHtml()
+ {
+ return html;
+ }
+
+ /**
+ * Sets the HTML to display for the separator
+ *
+ * @param html The HTML
+ */
+ public void setHtml(String html)
+ {
+ this.html = html;
+ }
+
+ @SuppressWarnings("unchecked")
+ public UIComponent generate(FacesContext context, String id)
+ {
+ UIComponent component = this.createOutputTextComponent(context, id);
+ component.getAttributes().put("escape", Boolean.FALSE);
+
+ return component;
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ protected UIComponent createComponent(FacesContext context, UIPropertySheet propertySheet,
+ PropertySheetItem item)
+ {
+ UIComponent component = this.generate(context, item.getName());
+
+ // set the HTML to use
+ component.getAttributes().put("value", getResolvedHtml(component, item));
+
+ return component;
+ }
+
+ /**
+ * Returns the resolved HTML to use for the separator.
+ *
In the default case we just return the HTML set
+ * via setHtml however subclasses may choose to generate
+ * the resulting HTML using a combination of the HTML set
+ * via setHtml and the given PropertySheetItem.
+ *
+ * @param component The JSF component representing the separator
+ * @param item The separator item
+ * @return The resolved HTML
+ */
+ protected String getResolvedHtml(UIComponent component, PropertySheetItem item)
+ {
+ // In the default case we just return the HTML set via setHtml
+
+ return this.html;
+ }
+}
\ No newline at end of file
diff --git a/source/java/org/alfresco/web/bean/generator/LabelSeparatorGenerator.java b/source/java/org/alfresco/web/bean/generator/LabelSeparatorGenerator.java
new file mode 100644
index 0000000000..7cbaf898c9
--- /dev/null
+++ b/source/java/org/alfresco/web/bean/generator/LabelSeparatorGenerator.java
@@ -0,0 +1,85 @@
+package org.alfresco.web.bean.generator;
+
+import javax.faces.component.UIComponent;
+
+import org.alfresco.web.ui.repo.component.property.PropertySheetItem;
+
+/**
+ * Generates a component to represent a separator that uses the
+ * property sheet display label configuration. The CSS class used
+ * for the HTML representing the label can also be configured via
+ * the setStyleClass
method.
+ *
+ * @author gavinc
+ */
+public class LabelSeparatorGenerator extends HtmlSeparatorGenerator
+{
+ protected String style = "margin-top: 6px; margin-bottom: 6px;";
+ protected String styleClass;
+
+ /**
+ * Returns the CSS class configured to be used for this separator
+ *
+ * @return The CSS class
+ */
+ public String getStyleClass()
+ {
+ return styleClass;
+ }
+
+ /**
+ * Sets the CSS class to use for the separator
+ *
+ * @param styleClass The CSS class
+ */
+ public void setStyleClass(String styleClass)
+ {
+ this.styleClass = styleClass;
+ }
+
+ /**
+ * Returns the CSS style configured to be used for this separator
+ *
+ * @return The CSS style
+ */
+ public String getStyle()
+ {
+ return style;
+ }
+
+ /**
+ * Sets the CSS style to use for the separator
+ *
+ * @param style The CSS style
+ */
+ public void setStyle(String style)
+ {
+ this.style = style;
+ }
+
+ @Override
+ protected String getResolvedHtml(UIComponent component, PropertySheetItem item)
+ {
+ StringBuilder htmlBuilder = new StringBuilder("
<hr/>
element.
*
* @author gavinc
*/
-public class SeparatorGenerator extends BaseComponentGenerator
+public class SeparatorGenerator extends HtmlSeparatorGenerator
{
- @SuppressWarnings("unchecked")
- public UIComponent generate(FacesContext context, String id)
+ public SeparatorGenerator()
{
- UIComponent component = this.createOutputTextComponent(context, id);
- component.getAttributes().put("escape", Boolean.FALSE);
+ // For the standard separator just show a