ItemSearch

* ContentTypeFilterWidget korrigiert. Leider funktioniert die elegante Version nicht, die ich vorher hatte, da man die Collections nicht wiederverwenden kann. Sie werden automatisch geschlossen und danach kann man den Inhalt nie wieder abfragen. Daher funktionierte die Suche bei ersten Mal, aber danach nie wieder.

git-svn-id: https://svn.libreccm.org/ccm/trunk@638 8810af33-2d31-482b-a856-94f89814c4df
master
quasi 2010-11-30 10:56:51 +00:00
parent 08d3a85fe2
commit f8fdf72f86
1 changed files with 13 additions and 7 deletions

View File

@ -39,11 +39,16 @@ public class ContentTypeFilterWidget extends FilterWidget {
private ContentType m_parentType = null; private ContentType m_parentType = null;
private ContentSection m_section = null; private ContentSection m_section = null;
private ContentTypeCollection m_types = null; private ContentType[] m_types = null;
public ContentTypeFilterWidget(ContentTypeCollection types) { public ContentTypeFilterWidget(ContentTypeCollection types) {
super(new ContentTypeFilterType(), new ArrayParameter(new StringParameter(ContentTypeFilterType.KEY))); super(new ContentTypeFilterType(), new ArrayParameter(new StringParameter(ContentTypeFilterType.KEY)));
m_types = types;
m_types = new ContentType[(int) types.size()];
for (int i = 0; types.next();) {
m_types[i++] = types.getContentType();
}
} }
public ContentTypeFilterWidget(ContentSection section) { public ContentTypeFilterWidget(ContentSection section) {
@ -90,7 +95,8 @@ public class ContentTypeFilterWidget extends FilterWidget {
protected ContentType[] getContentTypes(PageState state) { protected ContentType[] getContentTypes(PageState state) {
ContentType parentType = getParentType(state); ContentType parentType = getParentType(state);
ContentTypeCollection typesCollection = m_types; ContentTypeCollection typesCollection = null;
ContentType[] typesArray = m_types.clone();
// If the section and parent type both equals the preset from initializer // If the section and parent type both equals the preset from initializer
// there is no need to get a new ContentTypeCollection // there is no need to get a new ContentTypeCollection
@ -113,13 +119,13 @@ public class ContentTypeFilterWidget extends FilterWidget {
typesCollection = ContentType.getSiblingsOf(parentType); typesCollection = ContentType.getSiblingsOf(parentType);
} }
} }
}
ContentType[] typesArray = new ContentType[(int) typesCollection.size()]; typesArray = new ContentType[(int) typesCollection.size()];
for (int i = 0; typesCollection.next();) { for (int i = 0; typesCollection.next();) {
typesArray[i++] = typesCollection.getContentType(); typesArray[i++] = typesCollection.getContentType();
} }
}
return typesArray; return typesArray;
} }