- 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

@@ -42,6 +42,7 @@ public abstract class PropertySheetItem extends UIPanel implements NamingContain
protected String displayLabel;
protected String converter;
protected Boolean readOnly;
protected Boolean ignoreIfMissing;
protected String componentGenerator;
protected String resolvedDisplayLabel;
@@ -198,6 +199,38 @@ public abstract class PropertySheetItem extends UIPanel implements NamingContain
this.readOnly = readOnly;
}
/**
* @return Determines whether the item should be ignored (not rendered)
* if the item can not be found
*/
public boolean getIgnoreIfMissing()
{
if (this.ignoreIfMissing == null)
{
ValueBinding vb = getValueBinding("ignoreIfMissing");
if (vb != null)
{
this.ignoreIfMissing = (Boolean)vb.getValue(getFacesContext());
}
}
if (this.ignoreIfMissing == null)
{
this.ignoreIfMissing = Boolean.TRUE;
}
return this.ignoreIfMissing;
}
/**
* @param ignoreIfMissing Sets the whether the item will be ignored
* if it can not be found
*/
public void setIgnoreIfMissing(boolean ignoreIfMissing)
{
this.ignoreIfMissing = ignoreIfMissing;
}
/**
* @see javax.faces.component.StateHolder#restoreState(javax.faces.context.FacesContext, java.lang.Object)
*/
@@ -212,6 +245,7 @@ public abstract class PropertySheetItem extends UIPanel implements NamingContain
this.converter = (String)values[4];
this.componentGenerator = (String)values[5];
this.resolvedDisplayLabel = (String)values[6];
this.ignoreIfMissing = (Boolean)values[7];
}
/**
@@ -219,7 +253,7 @@ public abstract class PropertySheetItem extends UIPanel implements NamingContain
*/
public Object saveState(FacesContext context)
{
Object values[] = new Object[7];
Object values[] = new Object[8];
// standard component attributes are saved by the super class
values[0] = super.saveState(context);
values[1] = this.name;
@@ -228,6 +262,7 @@ public abstract class PropertySheetItem extends UIPanel implements NamingContain
values[4] = this.converter;
values[5] = this.componentGenerator;
values[6] = this.resolvedDisplayLabel;
values[7] = this.ignoreIfMissing;
return (values);
}

View File

@@ -41,6 +41,7 @@ import org.springframework.web.jsf.FacesContextUtils;
public class UIProperty extends PropertySheetItem
{
private static Log logger = LogFactory.getLog(UIProperty.class);
private static Log missingPropsLogger = LogFactory.getLog("alfresco.missingProperties");
/**
* Default constructor
@@ -76,8 +77,9 @@ public class UIProperty extends PropertySheetItem
if (propDef == null)
{
// there is no definition for the node, so it may have been added to
// the node as an additional property, so look for it in the node itself
if (node.hasProperty(propertyName))
// the node as an additional property, so look for it in the node itself.
// Or, if the ignoreIfMissing flag is set to false, show the property
if (node.hasProperty(propertyName) || getIgnoreIfMissing() == false)
{
String displayLabel = (String)getDisplayLabel();
if (displayLabel == null)
@@ -91,8 +93,9 @@ public class UIProperty extends PropertySheetItem
}
else
{
// warn the user that the property was not found anywhere!
logger.warn("Failed to find property definition for property '" + propertyName + "' for node: " + node.getNodeRef().toString());
// warn the user that the property was not found anywhere
if (missingPropsLogger.isDebugEnabled())
missingPropsLogger.debug("Failed to find property '" + propertyName + "' for node: " + node.getNodeRef().toString());
}
}
else

View File

@@ -743,6 +743,7 @@ public class UIPropertySheet extends UIPanel implements NamingContainer
propSheetItem.setName(item.getName());
propSheetItem.setConverter(item.getConverter());
propSheetItem.setComponentGenerator(item.getComponentGenerator());
propSheetItem.setIgnoreIfMissing(item.getIgnoreIfMissing());
String displayLabel = item.getDisplayLabel();
if (item.getDisplayLabelId() != null)