- fixed issues with editing spaces

- made topic pages consistent with 1.2
- added ability to force properties to render even if they are not present in the node
- changed warnings about missing properties to debug but added a log label to turn it on easily

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@2922 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Gavin Cornwell
2006-05-18 21:02:07 +00:00
parent 8bb97be974
commit d3a6eb447f
14 changed files with 127 additions and 80 deletions

View File

@@ -139,13 +139,16 @@ public class PropertySheetConfigElement extends ConfigElementAdapter
* sheet is in view mode
* @param inEdit Sets whether the property should be shown when the property
* sheet is in edit mode
* @parm compGenerator The name of a bean that can be used as a component generator
* @param compGenerator The name of a bean that can be used as a component generator
* @param ignoreIfMissing Sets whether the property should be rendered if it is not
* found in the data dictionary or the node itself
*/
/*package*/ void addProperty(String name, String displayLabel, String displayLabelId, String readOnly,
String converter, String inView, String inEdit, String compGenerator)
String converter, String inView, String inEdit, String compGenerator,
String ignoreIfMissing)
{
addItem(new PropertyConfig(name, displayLabel, displayLabelId, Boolean.parseBoolean(readOnly),
converter, inView, inEdit, compGenerator));
converter, inView, inEdit, compGenerator, ignoreIfMissing));
}
/**
@@ -160,7 +163,7 @@ public class PropertySheetConfigElement extends ConfigElementAdapter
* sheet is in view mode
* @param inEdit Sets whether the property should be shown when the property
* sheet is in edit mode
* @parm compGenerator The name of a bean that can be used as a component generator
* @param compGenerator The name of a bean that can be used as a component generator
*/
/*package*/ void addAssociation(String name, String displayLabel, String displayLabelId, String readOnly,
String converter, String inView, String inEdit, String compGenerator)
@@ -181,7 +184,7 @@ public class PropertySheetConfigElement extends ConfigElementAdapter
* sheet is in view mode
* @param inEdit Sets whether the property should be shown when the property
* sheet is in edit mode
* @parm compGenerator The name of a bean that can be used as a component generator
* @param compGenerator The name of a bean that can be used as a component generator
*/
/*package*/ void addChildAssociation(String name, String displayLabel, String displayLabelId, String readOnly,
String converter, String inView, String inEdit, String compGenerator)
@@ -257,10 +260,11 @@ public class PropertySheetConfigElement extends ConfigElementAdapter
private boolean readOnly;
private boolean showInViewMode = true;
private boolean showInEditMode = true;
private boolean ignoreIfMissing = true;
public ItemConfig(String name, String displayLabel, String displayLabelId,
boolean readOnly, String converter, String inView, String inEdit,
String compGenerator)
String compGenerator, String ignoreIfMissing)
{
this.name = name;
this.displayLabel = displayLabel;
@@ -277,6 +281,10 @@ public class PropertySheetConfigElement extends ConfigElementAdapter
{
this.showInEditMode = Boolean.parseBoolean(inEdit);
}
if (ignoreIfMissing != null)
{
this.ignoreIfMissing = Boolean.parseBoolean(ignoreIfMissing);
}
}
/**
@@ -343,6 +351,15 @@ public class PropertySheetConfigElement extends ConfigElementAdapter
return this.componentGenerator;
}
/**
* @return Whether the property should be rendered if it is not found in the
* data dictionary or the node itself.
*/
public boolean getIgnoreIfMissing()
{
return this.ignoreIfMissing;
}
/**
* @see java.lang.Object#toString()
*/
@@ -356,6 +373,7 @@ public class PropertySheetConfigElement extends ConfigElementAdapter
buffer.append(" read-only=").append(this.readOnly);
buffer.append(" show-in-view-mode=").append(this.showInViewMode);
buffer.append(" show-in-edit-mode=").append(this.showInEditMode);
buffer.append(" ignore-if-missing=").append(this.ignoreIfMissing);
buffer.append(" component-generator=").append(this.componentGenerator).append(")");
return buffer.toString();
}
@@ -368,10 +386,10 @@ public class PropertySheetConfigElement extends ConfigElementAdapter
{
public PropertyConfig(String name, String displayLabel, String displayLabelId,
boolean readOnly, String converter, String inView, String inEdit,
String compGenerator)
String compGenerator, String ignoreIfMissing)
{
super(name, displayLabel, displayLabelId, readOnly, converter,
inView, inEdit, compGenerator);
inView, inEdit, compGenerator, ignoreIfMissing);
}
}
@@ -385,7 +403,7 @@ public class PropertySheetConfigElement extends ConfigElementAdapter
String compGenerator)
{
super(name, displayLabel, displayLabelId, readOnly, converter,
inView, inEdit, compGenerator);
inView, inEdit, compGenerator, null);
}
}
@@ -399,7 +417,7 @@ public class PropertySheetConfigElement extends ConfigElementAdapter
String compGenerator)
{
super(name, displayLabel, displayLabelId, readOnly, converter,
inView, inEdit, compGenerator);
inView, inEdit, compGenerator, null);
}
}
}

View File

@@ -42,10 +42,12 @@ public class PropertySheetElementReader implements ConfigElementReader
public static final String ATTR_SHOW_IN_EDIT_MODE = "show-in-edit-mode";
public static final String ATTR_SHOW_IN_VIEW_MODE = "show-in-view-mode";
public static final String ATTR_COMPONENT_GENERATOR = "component-generator";
public static final String ATTR_IGNORE_IF_MISSING = "ignore-if-missing";
/**
* @see org.alfresco.config.xml.elementreader.ConfigElementReader#parse(org.dom4j.Element)
*/
@SuppressWarnings("unchecked")
public ConfigElement parse(Element element)
{
PropertySheetConfigElement configElement = null;
@@ -78,9 +80,11 @@ public class PropertySheetElementReader implements ConfigElementReader
if (ELEMENT_SHOW_PROPERTY.equals(item.getName()))
{
String ignoreIfMissing = item.attributeValue(ATTR_IGNORE_IF_MISSING);
// add the property to show to the custom config element
configElement.addProperty(propName, label, labelId, readOnly, converter,
inView, inEdit, compGenerator);
inView, inEdit, compGenerator, ignoreIfMissing);
}
else if (ELEMENT_SHOW_ASSOC.equals(item.getName()))
{

View File

@@ -18,7 +18,6 @@ package org.alfresco.web.config;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -99,12 +98,14 @@ public class WebClientConfigTest extends BaseTest
assertNotNull("createddate property config should not be null", createdDataProp);
assertEquals("display label for createddate should be null", null, createdDataProp.getDisplayLabel());
assertTrue("read only for createddate should be 'true'", createdDataProp.isReadOnly());
assertTrue("ignoreIfMissing for createddate should be 'true'", createdDataProp.getIgnoreIfMissing());
ItemConfig iconProp = props.get("icon");
assertNotNull("icon property config should not be null", iconProp);
assertEquals("display label for icon should be null", null, iconProp.getDisplayLabel());
assertEquals("component-generator", "SpaceIconPickerGenerator", iconProp.getComponentGenerator());
assertFalse("read only for icon should be 'false'", iconProp.isReadOnly());
assertFalse("ignoreIfMissing for icon should be 'false'", iconProp.getIgnoreIfMissing());
// test that a call to the generic getChildren call throws an error
try
@@ -277,6 +278,7 @@ public class WebClientConfigTest extends BaseTest
assertFalse("icon should not be read-only", iconCfg.isReadOnly());
assertTrue("icon should be shown in view mode", iconCfg.isShownInViewMode());
assertTrue("icon should be shown in edit mode", iconCfg.isShownInEditMode());
assertFalse("ignoreIfMissing for icon should be 'false'", iconCfg.getIgnoreIfMissing());
}
/**