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,9 +32,6 @@ import org.alfresco.config.element.ConfigElementAdapter;
*/
public class PropertySheetConfigElement extends ConfigElementAdapter
{
// TODO: Currently this object just deals with properties and associations to show,
// in the future it will also deal with properties and associations to hide.
public static final String CONFIG_ELEMENT_ID = "property-sheet";
protected Map<String, ItemConfig> items = new LinkedHashMap<String, ItemConfig>(8, 10f);
@@ -193,6 +190,24 @@ public class PropertySheetConfigElement extends ConfigElementAdapter
converter, inView, inEdit, compGenerator));
}
/**
* Adds a separator
*
* @param name The name of the separator
* @param displayLabel Display label to use for the separator
* @param displayLabelId Display label message id to use for the separator
* @param inView Sets whether the separator should be shown when the property
* sheet is in view mode
* @param inEdit Sets whether the separator should be shown when the property
* sheet is in edit mode
* @param compGenerator The name of a bean that can be used as a component generator
*/
/*package*/ void addSeparator(String name, String displayLabel, String displayLabelId,
String inView, String inEdit, String compGenerator)
{
addItem(new SeparatorConfig(name, displayLabel, displayLabelId, inView, inEdit, compGenerator));
}
/**
* @return Returns a map of the all the items
*/
@@ -266,6 +281,12 @@ public class PropertySheetConfigElement extends ConfigElementAdapter
boolean readOnly, String converter, String inView, String inEdit,
String compGenerator, String ignoreIfMissing)
{
// check we have a name
if (name == null || name.length() == 0)
{
throw new ConfigException("You must specify a name for a proprty sheet item");
}
this.name = name;
this.displayLabel = displayLabel;
this.displayLabelId = displayLabelId;
@@ -420,4 +441,17 @@ public class PropertySheetConfigElement extends ConfigElementAdapter
inView, inEdit, compGenerator, null);
}
}
/**
* Inner class to represent a configured separator
*/
public class SeparatorConfig extends ItemConfig
{
public SeparatorConfig(String name, String displayLabel, String displayLabelId,
String inView, String inEdit, String compGenerator)
{
super(name, displayLabel, displayLabelId, false, null,
inView, inEdit, compGenerator, null);
}
}
}