Fixed another occurence of the PrintListener bug

git-svn-id: https://svn.libreccm.org/ccm/trunk@2986 8810af33-2d31-482b-a856-94f89814c4df
master
jensp 2014-11-23 13:15:56 +00:00
parent 3c678af21f
commit 4dbf93f31d
2 changed files with 68 additions and 67 deletions

View File

@ -115,6 +115,7 @@ public class ItemListPortletEditor extends ObjectListPortletEditor {
public void prepare(PrintEvent ev) { public void prepare(PrintEvent ev) {
OptionGroup target = (OptionGroup)ev.getTarget(); OptionGroup target = (OptionGroup)ev.getTarget();
target.clearOptions();
ContentTypeCollection types = ContentType.getRegisteredContentTypes(); ContentTypeCollection types = ContentType.getRegisteredContentTypes();
types.addOrder(ContentType.LABEL); types.addOrder(ContentType.LABEL);

View File

@ -15,7 +15,6 @@
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
package com.arsdigita.navigation.ui.portlet; package com.arsdigita.navigation.ui.portlet;
import com.arsdigita.navigation.portlet.ObjectListPortlet; import com.arsdigita.navigation.portlet.ObjectListPortlet;
@ -95,7 +94,8 @@ public class ObjectListPortletEditor extends PortletConfigFormSection {
add(new Label("Base object type:", Label.BOLD), ColumnPanel.RIGHT); add(new Label("Base object type:", Label.BOLD), ColumnPanel.RIGHT);
add(m_baseObjectType); add(m_baseObjectType);
m_restrictedObjectType = buildRestrictedObjectTypeWidget(new StringParameter("restrictedObjectType")); m_restrictedObjectType = buildRestrictedObjectTypeWidget(new StringParameter(
"restrictedObjectType"));
add(new Label("Restricted object type:", Label.BOLD), ColumnPanel.RIGHT); add(new Label("Restricted object type:", Label.BOLD), ColumnPanel.RIGHT);
add(m_restrictedObjectType); add(m_restrictedObjectType);
@ -205,6 +205,7 @@ public class ObjectListPortletEditor extends PortletConfigFormSection {
type.getQualifiedName())); type.getQualifiedName()));
} }
} }
} }
protected void initWidgets(PageState state, protected void initWidgets(PageState state,
@ -269,15 +270,13 @@ public class ObjectListPortletEditor extends PortletConfigFormSection {
if (!baseType.isSubtypeOf(ACSObject.BASE_DATA_OBJECT_TYPE)) { if (!baseType.isSubtypeOf(ACSObject.BASE_DATA_OBJECT_TYPE)) {
throw new FormProcessException( throw new FormProcessException(
"The type '" + baseTypeName + "The type '" + baseTypeName + "' is not a subtype of '"
"' is not a subtype of '" + + ACSObject.BASE_DATA_OBJECT_TYPE + "'");
ACSObject.BASE_DATA_OBJECT_TYPE + "'");
} }
String specificTypeName = (String) m_restrictedObjectType.getValue(state); String specificTypeName = (String) m_restrictedObjectType.getValue(state);
ObjectType specificType = null; ObjectType specificType = null;
if (specificTypeName != null && if (specificTypeName != null && !"".equals(specificTypeName)) {
!"".equals(specificTypeName)) {
specificType = MetadataRoot.getMetadataRoot().getObjectType(specificTypeName); specificType = MetadataRoot.getMetadataRoot().getObjectType(specificTypeName);
if (specificType == null) { if (specificType == null) {
throw new FormProcessException( throw new FormProcessException(
@ -286,13 +285,11 @@ public class ObjectListPortletEditor extends PortletConfigFormSection {
if (!specificType.isSubtypeOf(baseType)) { if (!specificType.isSubtypeOf(baseType)) {
throw new FormProcessException( throw new FormProcessException(
"The type '" + specificTypeName + "The type '" + specificTypeName + "' is not a subtype of '" + baseTypeName + "'");
"' is not a subtype of '" + baseTypeName + "'");
} }
} }
ObjectType type = specificType == null ? ObjectType type = specificType == null ? baseType : specificType;
baseType : specificType;
String order = (String) m_order.getValue(state); String order = (String) m_order.getValue(state);
validateFields(type, order); validateFields(type, order);
@ -308,8 +305,8 @@ public class ObjectListPortletEditor extends PortletConfigFormSection {
throws FormProcessException { throws FormProcessException {
Root root = MetadataRoot.getMetadataRoot().getRoot(); Root root = MetadataRoot.getMetadataRoot().getRoot();
com.redhat.persistence.metadata.ObjectType objType = com.redhat.persistence.metadata.ObjectType objType = root.getObjectType(type
root.getObjectType(type.getQualifiedName()); .getQualifiedName());
String[] fields = StringUtils.split(str, ','); String[] fields = StringUtils.split(str, ',');
for (int i = 0; i < fields.length; i++) { for (int i = 0; i < fields.length; i++) {
@ -329,8 +326,8 @@ public class ObjectListPortletEditor extends PortletConfigFormSection {
if (!objType.exists(Path.get(field))) { if (!objType.exists(Path.get(field))) {
throw new FormProcessException( throw new FormProcessException(
"The type '" + type.getQualifiedName() + "The type '" + type.getQualifiedName() + "' does not have a property '" + field
"' does not have a property '" + field + "'"); + "'");
} }
} }
} }
@ -350,9 +347,12 @@ public class ObjectListPortletEditor extends PortletConfigFormSection {
myportlet.setAttributes((String) m_attributes.getValue(state)); myportlet.setAttributes((String) m_attributes.getValue(state));
myportlet.setFilterCategory(m_filterCategory.getCategory(state)); myportlet.setFilterCategory(m_filterCategory.getCategory(state));
myportlet.setDescendCategories(((Boolean)m_descendCategories.getValue(state)).booleanValue()); myportlet.setDescendCategories(((Boolean) m_descendCategories.getValue(state))
.booleanValue());
myportlet.setCheckPermissions(((Boolean) m_checkPermissions.getValue(state)).booleanValue()); myportlet.setCheckPermissions(((Boolean) m_checkPermissions.getValue(state)).booleanValue());
myportlet.setExcludeIndexObjects(((Boolean)m_excludeIndexObjects.getValue(state)).booleanValue()); myportlet.setExcludeIndexObjects(((Boolean) m_excludeIndexObjects.getValue(state))
.booleanValue());
myportlet.setProperties((Object[]) m_properties.getValue(state)); myportlet.setProperties((Object[]) m_properties.getValue(state));
} }
} }