Rename getPropertyAndRemoveFromList() to pullProperty(). The original method remains in the code but marked deprecated.

This commit is contained in:
ryounes 2011-03-31 19:04:15 +00:00
parent 5021069574
commit 54de8d5f5b
2 changed files with 10 additions and 6 deletions

View file

@ -448,7 +448,12 @@ public class GroupedPropertyList extends BaseTemplateModel {
return null; return null;
} }
@Deprecated
public PropertyTemplateModel getPropertyAndRemoveFromList(String propertyUri) { public PropertyTemplateModel getPropertyAndRemoveFromList(String propertyUri) {
return pullProperty(propertyUri);
}
public PropertyTemplateModel pullProperty(String propertyUri) {
for (PropertyGroupTemplateModel pgtm : groups) { for (PropertyGroupTemplateModel pgtm : groups) {
List<PropertyTemplateModel> properties = pgtm.getProperties(); List<PropertyTemplateModel> properties = pgtm.getProperties();
@ -470,6 +475,5 @@ public class GroupedPropertyList extends BaseTemplateModel {
} }
return null; return null;
} }
} }

View file

@ -172,11 +172,11 @@ name will be used as the label. -->
Currently the page displays the vitro namespace links properties. Future versions Currently the page displays the vitro namespace links properties. Future versions
will use the vivo core ontology links property, eliminating the need for special handling. will use the vivo core ontology links property, eliminating the need for special handling.
Note that this macro has a side-effect in the calls to propertyGroups.getPropertyAndRemoveFromList(). Note that this macro has a side-effect in the calls to propertyGroups.pullProperty().
--> -->
<#macro vitroLinks propertyGroups namespaces editable linkListClass="individual-urls"> <#macro vitroLinks propertyGroups namespaces editable linkListClass="individual-urls">
<#local primaryLink = propertyGroups.getPropertyAndRemoveFromList("${namespaces.vitro}primaryLink")!> <#local primaryLink = propertyGroups.pullProperty("${namespaces.vitro}primaryLink")!>
<#local additionalLinks = propertyGroups.getPropertyAndRemoveFromList("${namespaces.vitro}additionalLink")!> <#local additionalLinks = propertyGroups.pullProperty("${namespaces.vitro}additionalLink")!>
<#if (primaryLink?has_content || additionalLinks?has_content)> <#-- true when the property is in the list, even if not populated (when editing) --> <#if (primaryLink?has_content || additionalLinks?has_content)> <#-- true when the property is in the list, even if not populated (when editing) -->
<nav role="navigation"> <nav role="navigation">
@ -205,10 +205,10 @@ name will be used as the label. -->
Values for showPlaceholder: "always", "never", "with_add_link" Values for showPlaceholder: "always", "never", "with_add_link"
Note that this macro has a side-effect in the call to propertyGroups.getPropertyAndRemoveFromList(). Note that this macro has a side-effect in the call to propertyGroups.pullProperty().
--> -->
<#macro image individual propertyGroups namespaces editable showPlaceholder="never" placeholder=""> <#macro image individual propertyGroups namespaces editable showPlaceholder="never" placeholder="">
<#local mainImage = propertyGroups.getPropertyAndRemoveFromList("${namespaces.vitroPublic}mainImage")!> <#local mainImage = propertyGroups.pullProperty("${namespaces.vitroPublic}mainImage")!>
<#local extraParams = ""> <#local extraParams = "">
<#if placeholder?has_content> <#if placeholder?has_content>
<#local extraParams = { "placeholder" : placeholder } > <#local extraParams = { "placeholder" : placeholder } >