Added separator support into the property sheet

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@3454 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Gavin Cornwell
2006-08-03 09:44:13 +00:00
parent d3fb5dd9fd
commit a4e8facbae
13 changed files with 333 additions and 6 deletions

View File

@@ -32,6 +32,7 @@ import org.alfresco.web.ui.repo.component.property.BaseAssociationEditor;
import org.alfresco.web.ui.repo.component.property.PropertySheetItem;
import org.alfresco.web.ui.repo.component.property.UIProperty;
import org.alfresco.web.ui.repo.component.property.UIPropertySheet;
import org.alfresco.web.ui.repo.component.property.UISeparator;
import org.alfresco.web.ui.repo.component.property.UIPropertySheet.ClientValidation;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -83,6 +84,12 @@ public abstract class BaseComponentGenerator implements IComponentGenerator
// setup any converter the property needs
setupConverter(context, propertySheet, item, propertyDef, component);
}
else if (item instanceof UISeparator)
{
// just create the component and add it
component = createComponent(context, propertySheet, item);
item.getChildren().add(component);
}
else
{
// get the association definition

View File

@@ -0,0 +1,23 @@
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 = "<div class='wizardSectionHeading mainSubTitle' style='margin-top: 6px; margin-bottom: 6px;'>&nbsp;" +
item.getDisplayLabel() + "</div>";
return html;
}
}

View File

@@ -0,0 +1,49 @@
package org.alfresco.web.bean.generator;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import org.alfresco.web.ui.repo.component.property.PropertySheetItem;
import org.alfresco.web.ui.repo.component.property.UIPropertySheet;
/**
* Generates a component to represent a separator.
*
* @author gavinc
*/
public class SeparatorGenerator extends BaseComponentGenerator
{
@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", getHtml(component, item));
return component;
}
/**
* Returns the HTML to display for the separator
*
* @param component The JSF component representing the separator
* @param item The separator item
* @return The HTML
*/
protected String getHtml(UIComponent component, PropertySheetItem item)
{
return "<div style='margin-top: 6px; margin-bottom: 6px;'><hr/></div>";
}
}