|
From: <pb...@fe...> - 2013-02-03 12:31:41
|
Author: pboy
Date: 2013-02-03 12:31:30 +0000 (Sun, 03 Feb 2013)
New Revision: 2485
Added:
releases/2.0.0/ccm-cms/src/com/arsdigita/cms/contenttypes/GenericOrganizationalUnitBundleCollection.java
releases/2.0.0/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericPersonOrgaUnitsStep.java
releases/2.0.0/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericPersonOrgaUnitsTable.java
Modified:
releases/2.0.0/ccm-cms/src/com/arsdigita/cms/Initializer.java
releases/2.0.0/ccm-cms/src/com/arsdigita/cms/contenttypes/ContenttypesResources.properties
releases/2.0.0/ccm-cms/src/com/arsdigita/cms/contenttypes/ContenttypesResources_de.properties
releases/2.0.0/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationalUnitContactAddForm.java
releases/2.0.0/ccm-cms/src/com/arsdigita/cms/ui/authoring/AuthoringKitWizard.java
Log:
Backport of r2464 (Improved ItemSearchWidget, improved authoring step) (on behalf of JensP).
Modified: releases/2.0.0/ccm-cms/src/com/arsdigita/cms/Initializer.java
===================================================================
--- releases/2.0.0/ccm-cms/src/com/arsdigita/cms/Initializer.java 2013-02-03 09:50:25 UTC (rev 2484)
+++ releases/2.0.0/ccm-cms/src/com/arsdigita/cms/Initializer.java 2013-02-03 12:31:30 UTC (rev 2485)
@@ -18,7 +18,10 @@
*/
package com.arsdigita.cms;
+import com.arsdigita.cms.contenttypes.GenericPerson;
import com.arsdigita.cms.contenttypes.Link;
+import com.arsdigita.cms.contenttypes.ui.GenericPersonOrgaUnitsStep;
+import com.arsdigita.cms.contenttypes.util.ContenttypesGlobalizationUtil;
import com.arsdigita.cms.dispatcher.AssetURLFinder;
import com.arsdigita.cms.dispatcher.ItemDelegatedURLPatternGenerator;
import com.arsdigita.cms.dispatcher.ItemTemplatePatternGenerator;
@@ -36,6 +39,7 @@
import com.arsdigita.cms.search.LaunchDateFilterType;
import com.arsdigita.cms.search.LuceneQueryEngine;
import com.arsdigita.cms.search.VersionFilterType;
+import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
import com.arsdigita.cms.workflow.CMSEngine;
import com.arsdigita.cms.workflow.CMSTask;
import com.arsdigita.cms.workflow.CMSTaskType;
@@ -107,9 +111,7 @@
s_log.debug("CMS.Initializer.(Constructor) invoked");
- add(new PDLInitializer
- (new ManifestSource
- ("ccm-cms.pdl.mf",
+ add(new PDLInitializer(new ManifestSource("ccm-cms.pdl.mf",
new NameFilter(DbHelper.getDatabaseSuffix(database), "pdl"))));
add(new com.arsdigita.cms.contentsection.Initializer());
@@ -131,26 +133,26 @@
super.init(e);
/* Register object instantiator for Workspace (Content Center) */
- e.getFactory().registerInstantiator
- (Workspace.BASE_DATA_OBJECT_TYPE,
+ e.getFactory().registerInstantiator(Workspace.BASE_DATA_OBJECT_TYPE,
new ACSObjectInstantiator() {
@Override
public DomainObject doNewInstance(DataObject dobj) {
return new Workspace(dobj);
}
+
} );
LanguageUtil.setSupportedLanguages(
Kernel.getConfig().getSupportedLanguages());
/* Register object instantiator for CMS Service */
- e.getFactory().registerInstantiator
- (Service.BASE_DATA_OBJECT_TYPE,
+ e.getFactory().registerInstantiator(Service.BASE_DATA_OBJECT_TYPE,
new ACSObjectInstantiator() {
@Override
public DomainObject doNewInstance(DataObject dobj) {
return new Service(dobj);
}
+
} );
URLService.registerFinder(ContentPage.BASE_DATA_OBJECT_TYPE,
@@ -170,6 +172,7 @@
return find(oid);
}
+
public String find( OID oid )
throws NoValidURLException {
@@ -177,8 +180,7 @@
try {
link = (Link) DomainObjectFactory.newInstance( oid );
} catch( DataObjectNotFoundException ex ) {
- throw new NoValidURLException
- ( "Cannot find an object with oid: " + oid );
+ throw new NoValidURLException("Cannot find an object with oid: " + oid);
}
if (Link.EXTERNAL_LINK.equals(link.getTargetType())) {
@@ -193,9 +195,9 @@
}
}
}
- }
- );
+ });
+
ImageSizerFactory.initialize();
registerInstantiators(e.getFactory());
@@ -220,15 +222,12 @@
// Just set the class implementing methods run when for publishing
// or unpublishing to file. No initialisation of the class here.
try {
- QueueManager.setListener((PublishToFileListener)
- ContentSection.getConfig()
+ QueueManager.setListener((PublishToFileListener) ContentSection.getConfig()
.getPublishToFileClass().newInstance());
} catch (InstantiationException ex) {
- throw new UncheckedWrapperException
- ("Failed to instantiate the listener class", ex);
+ throw new UncheckedWrapperException("Failed to instantiate the listener class", ex);
} catch (IllegalAccessException ex) {
- throw new UncheckedWrapperException
- ("Couldn't access the listener class", ex);
+ throw new UncheckedWrapperException("Couldn't access the listener class", ex);
}
MetadataProviderRegistry.registerAdapter(
@@ -236,6 +235,13 @@
new AssetMetadataProvider());
+ AuthoringKitWizard.registerAssetStep(
+ GenericPerson.BASE_DATA_OBJECT_TYPE,
+ GenericPersonOrgaUnitsStep.class,
+ ContenttypesGlobalizationUtil.globalize("person.authoring.orgas.title"),
+ ContenttypesGlobalizationUtil.globalize("person.authoring.orgas.title"),
+ 20);
+
s_log.debug("CMS.Initializer.init(DomainInitEvent) completed");
} // END init(DomainInitEvent e)
@@ -246,13 +252,11 @@
private void registerPatternGenerators() {
PatternStylesheetResolver.registerPatternGenerator(
"item_template_oid",
- new ItemTemplatePatternGenerator()
- );
+ new ItemTemplatePatternGenerator());
PatternStylesheetResolver.registerPatternGenerator(
"item_delegated_url",
- new ItemDelegatedURLPatternGenerator()
- );
+ new ItemDelegatedURLPatternGenerator());
}
@@ -262,57 +266,57 @@
private void registerInstantiators(DomainObjectFactory f) {
// Register the CMSTaskInstaniator
- f.registerInstantiator
- (CMSTask.BASE_DATA_OBJECT_TYPE,
+ f.registerInstantiator(CMSTask.BASE_DATA_OBJECT_TYPE,
new ACSObjectInstantiator() {
@Override
public DomainObject doNewInstance(DataObject dataObject) {
return new CMSTask(dataObject);
}
+
});
- f.registerInstantiator
- (CMSTaskType.BASE_DATA_OBJECT_TYPE,
+ f.registerInstantiator(CMSTaskType.BASE_DATA_OBJECT_TYPE,
new DomainObjectInstantiator() {
public DomainObject doNewInstance(DataObject dataObject) {
return new CMSTaskType(dataObject);
}
+
});
- f.registerInstantiator
- (TaskEventURLGenerator.BASE_DATA_OBJECT_TYPE,
+ f.registerInstantiator(TaskEventURLGenerator.BASE_DATA_OBJECT_TYPE,
new DomainObjectInstantiator() {
public DomainObject doNewInstance(DataObject dataObject) {
return new TaskEventURLGenerator(dataObject);
}
+
});
- f.registerInstantiator
- (Workflow.BASE_DATA_OBJECT_TYPE,
+ f.registerInstantiator(Workflow.BASE_DATA_OBJECT_TYPE,
new ACSObjectInstantiator() {
public DomainObject doNewInstance(DataObject dataObject) {
return new Workflow(dataObject);
}
+
});
- f.registerInstantiator
- (WorkflowTemplate.BASE_DATA_OBJECT_TYPE,
+ f.registerInstantiator(WorkflowTemplate.BASE_DATA_OBJECT_TYPE,
new ACSObjectInstantiator() {
@Override
public DomainObject doNewInstance(DataObject dataObject) {
return new WorkflowTemplate(dataObject);
}
+
});
- f.registerInstantiator
- (TemplateContext.BASE_DATA_OBJECT_TYPE,
+ f.registerInstantiator(TemplateContext.BASE_DATA_OBJECT_TYPE,
new DomainObjectInstantiator() {
public DomainObject doNewInstance(DataObject dataObject) {
return new TemplateContext(dataObject);
}
+
@Override
- public DomainObjectInstantiator
- resolveInstantiator(DataObject obj) {
+ public DomainObjectInstantiator resolveInstantiator(DataObject obj) {
return this;
}
+
});
}
@@ -354,4 +358,5 @@
},
new IntermediaQueryEngine());
}
+
}
Modified: releases/2.0.0/ccm-cms/src/com/arsdigita/cms/contenttypes/ContenttypesResources.properties
===================================================================
--- releases/2.0.0/ccm-cms/src/com/arsdigita/cms/contenttypes/ContenttypesResources.properties 2013-02-03 09:50:25 UTC (rev 2484)
+++ releases/2.0.0/ccm-cms/src/com/arsdigita/cms/contenttypes/ContenttypesResources.properties 2013-02-03 12:31:30 UTC (rev 2485)
@@ -147,3 +147,8 @@
cms.contenttypes.ui.person.select_contact.already_added=The selected contact has already been added to current item.
cms.contenttypes.ui.person.alias.delete.label=Delete
cms.contenttypes.ui.person.alias.delete.confirm=Are you sure to remove the alias?
+person.ui.orgaunits.none=This person is not assigned to any organizational units.
+person.ui.orgaunits.columns.name=Title
+person.ui.orgaunits.columns.year=Year
+person.ui.orgaunits.columns.type=Type
+person.authoring.orgas.title=Organisational Units
Modified: releases/2.0.0/ccm-cms/src/com/arsdigita/cms/contenttypes/ContenttypesResources_de.properties
===================================================================
--- releases/2.0.0/ccm-cms/src/com/arsdigita/cms/contenttypes/ContenttypesResources_de.properties 2013-02-03 09:50:25 UTC (rev 2484)
+++ releases/2.0.0/ccm-cms/src/com/arsdigita/cms/contenttypes/ContenttypesResources_de.properties 2013-02-03 12:31:30 UTC (rev 2485)
@@ -158,3 +158,8 @@
cms.contenttypes.ui.person.select_contact.already_added=Das ausgew\u00e4hlte Kontakt-Item wurde dem aktuellen Item bereits hinzugef\u00fcgt.
cms.contenttypes.ui.person.alias.delete.label=L\u00f6schen
cms.contenttypes.ui.person.alias.delete.confirm=Sind Sie sicher, dass Sie das Alias entfernen wollen?
+person.ui.orgaunits.none=Diese Person ist keiner Organisationseinheit zugewiesen.
+person.ui.orgaunits.columns.name=Titel
+person.ui.orgaunits.columns.year=Jahr
+person.ui.orgaunits.columns.type=Typ
+person.authoring.orgas.title=Organisationseinheiten
Added: releases/2.0.0/ccm-cms/src/com/arsdigita/cms/contenttypes/GenericOrganizationalUnitBundleCollection.java
===================================================================
--- releases/2.0.0/ccm-cms/src/com/arsdigita/cms/contenttypes/GenericOrganizationalUnitBundleCollection.java (rev 0)
+++ releases/2.0.0/ccm-cms/src/com/arsdigita/cms/contenttypes/GenericOrganizationalUnitBundleCollection.java 2013-02-03 12:31:30 UTC (rev 2485)
@@ -0,0 +1,34 @@
+package com.arsdigita.cms.contenttypes;
+
+import com.arsdigita.cms.ContentBundle;
+import com.arsdigita.domain.DomainCollection;
+import com.arsdigita.domain.DomainObjectFactory;
+import com.arsdigita.persistence.DataCollection;
+
+/**
+ *
+ * @author Jens Pelzetter <je...@jp...>
+ * @version $Id$
+ */
+public class GenericOrganizationalUnitBundleCollection extends DomainCollection {
+
+ public GenericOrganizationalUnitBundleCollection(final DataCollection dataCollection) {
+ super(dataCollection);
+ m_dataCollection.addOrder("name asc");
+ }
+
+ public GenericOrganizationalUnitBundle getGenericOrganizationalUnitBundle() {
+ return new GenericOrganizationalUnitBundle(m_dataCollection.getDataObject());
+ }
+
+ public GenericOrganizationalUnit getGenericOrganizationalUnit() {
+ final ContentBundle bundle = (ContentBundle) DomainObjectFactory.newInstance(m_dataCollection.getDataObject());
+ return (GenericOrganizationalUnit) bundle.getPrimaryInstance();
+ }
+
+ public GenericOrganizationalUnit getGenericOrganizationalUnit(final String language) {
+ final ContentBundle bundle = (ContentBundle) DomainObjectFactory.newInstance(m_dataCollection.getDataObject());
+ return (GenericOrganizationalUnit) bundle.getInstance(language);
+ }
+
+}
Modified: releases/2.0.0/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationalUnitContactAddForm.java
===================================================================
--- releases/2.0.0/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationalUnitContactAddForm.java 2013-02-03 09:50:25 UTC (rev 2484)
+++ releases/2.0.0/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationalUnitContactAddForm.java 2013-02-03 12:31:30 UTC (rev 2485)
@@ -78,7 +78,7 @@
"cms.contenttypes.ui.genericorgaunit.select_contact").localize()));
m_itemSearch = new ItemSearchWidget(ITEM_SEARCH, ContentType.
findByAssociatedObjectType(GenericContact.class.getName()));
- m_itemSearch.setDisableCreatePane(true);
+ m_itemSearch.setDisableCreatePane(false);
add(m_itemSearch);
selectedContactLabel = new Label("");
Added: releases/2.0.0/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericPersonOrgaUnitsStep.java
===================================================================
--- releases/2.0.0/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericPersonOrgaUnitsStep.java (rev 0)
+++ releases/2.0.0/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericPersonOrgaUnitsStep.java 2013-02-03 12:31:30 UTC (rev 2485)
@@ -0,0 +1,27 @@
+package com.arsdigita.cms.contenttypes.ui;
+
+import com.arsdigita.cms.ItemSelectionModel;
+import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
+import com.arsdigita.cms.ui.authoring.SimpleEditStep;
+
+/**
+ *
+ * @author Jens Pelzetter <je...@jp...>
+ * @version $Id$
+ */
+public class GenericPersonOrgaUnitsStep extends SimpleEditStep {
+
+ public GenericPersonOrgaUnitsStep(final ItemSelectionModel itemModel, final AuthoringKitWizard parent) {
+ this(itemModel, parent, null);
+ }
+
+ public GenericPersonOrgaUnitsStep(final ItemSelectionModel itemModel,
+ final AuthoringKitWizard parent,
+ final String prefix) {
+ super(itemModel, parent, prefix);
+
+ final GenericPersonOrgaUnitsTable table = new GenericPersonOrgaUnitsTable(itemModel);
+ setDisplayComponent(table);
+ }
+
+}
Added: releases/2.0.0/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericPersonOrgaUnitsTable.java
===================================================================
--- releases/2.0.0/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericPersonOrgaUnitsTable.java (rev 0)
+++ releases/2.0.0/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericPersonOrgaUnitsTable.java 2013-02-03 12:31:30 UTC (rev 2485)
@@ -0,0 +1,151 @@
+package com.arsdigita.cms.contenttypes.ui;
+
+import com.arsdigita.bebop.Component;
+import com.arsdigita.bebop.Label;
+import com.arsdigita.bebop.Link;
+import com.arsdigita.bebop.PageState;
+import com.arsdigita.bebop.Table;
+import com.arsdigita.bebop.table.TableCellRenderer;
+import com.arsdigita.bebop.table.TableColumn;
+import com.arsdigita.bebop.table.TableColumnModel;
+import com.arsdigita.bebop.table.TableModel;
+import com.arsdigita.bebop.table.TableModelBuilder;
+import com.arsdigita.cms.CMS;
+import com.arsdigita.cms.ContentSection;
+import com.arsdigita.cms.ItemSelectionModel;
+import com.arsdigita.cms.contenttypes.GenericOrganizationalUnit;
+import com.arsdigita.cms.contenttypes.GenericOrganizationalUnitBundleCollection;
+import com.arsdigita.cms.contenttypes.GenericPerson;
+import com.arsdigita.cms.contenttypes.util.ContenttypesGlobalizationUtil;
+import com.arsdigita.cms.dispatcher.ItemResolver;
+import com.arsdigita.domain.DomainObjectFactory;
+import com.arsdigita.persistence.DataCollection;
+import com.arsdigita.persistence.DataObject;
+import com.arsdigita.util.LockableImpl;
+import java.math.BigDecimal;
+
+/**
+ *
+ * @author Jens Pelzetter <je...@jp...>
+ * @version $Id$
+ */
+public class GenericPersonOrgaUnitsTable extends Table {
+
+ private final static String TABLE_COL_EDIT = "table_col_edit";
+ private final static String TABLE_COL_YEAR = "table_col_year";
+ private final static String TABLE_COL_TYPE = "table_col_type";
+ private ItemSelectionModel itemModel;
+
+ public GenericPersonOrgaUnitsTable(final ItemSelectionModel itemModel) {
+ super();
+
+ this.itemModel = itemModel;
+
+ setEmptyView(new Label(ContenttypesGlobalizationUtil.globalize("person.ui.orgaunits.none")));
+
+ final TableColumnModel columnModel = getColumnModel();
+ columnModel.add(new TableColumn(
+ 0,
+ ContenttypesGlobalizationUtil.globalize("person.ui.orgaunits.columns.name").localize(),
+ TABLE_COL_EDIT));
+ columnModel.add(new TableColumn(
+ 2,
+ ContenttypesGlobalizationUtil.globalize("person.ui.orgaunits.columns.type").localize(),
+ TABLE_COL_TYPE));
+
+ setModelBuilder(new ModelBuilder(itemModel));
+
+ columnModel.get(0).setCellRenderer(new EditCellRenderer());
+ }
+
+ private class ModelBuilder extends LockableImpl implements TableModelBuilder {
+
+ private final ItemSelectionModel itemModel;
+
+ public ModelBuilder(final ItemSelectionModel itemModel) {
+ this.itemModel = itemModel;
+ }
+
+ public TableModel makeModel(final Table table, final PageState state) {
+ table.getRowSelectionModel().clearSelection(state);
+
+ final GenericPerson person = (GenericPerson) itemModel.getSelectedItem(state);
+
+ return new Model(table, state, person);
+ }
+
+ }
+
+ private class Model implements TableModel {
+
+ private final Table table;
+ private final GenericOrganizationalUnitBundleCollection orgaUnits;
+
+ public Model(final Table table, final PageState state, final GenericPerson person) {
+ this.table = table;
+ orgaUnits =
+ new GenericOrganizationalUnitBundleCollection((DataCollection) person.getGenericPersonBundle().get("organizationalunits"));
+ }
+
+ @Override
+ public int getColumnCount() {
+ return table.getColumnModel().size();
+ }
+
+ @Override
+ public boolean nextRow() {
+ boolean ret;
+
+ if ((orgaUnits != null) && orgaUnits.next()) {
+ ret = true;
+ } else {
+ ret = false;
+ }
+
+ return ret;
+ }
+
+ @Override
+ public Object getElementAt(final int columnIndex) {
+ switch (columnIndex) {
+ case 0:
+ return orgaUnits.getGenericOrganizationalUnit().getTitle();
+ case 1:
+ return ((DataObject) orgaUnits.getGenericOrganizationalUnit().get("type")).get("label");
+ default:
+ return null;
+ }
+ }
+
+ @Override
+ public Object getKeyAt(final int columnIndex) {
+ return orgaUnits.getGenericOrganizationalUnit().getID();
+ }
+
+ }
+
+ private class EditCellRenderer extends LockableImpl implements TableCellRenderer {
+
+ public Component getComponent(final Table table,
+ final PageState state,
+ final Object value,
+ final boolean isSelected,
+ final Object key,
+ final int row,
+ final int column) {
+ //final com.arsdigita.cms.SecurityManager securityManager = CMS.getSecurityManager(state);
+ final GenericOrganizationalUnit orgaUnit = new GenericOrganizationalUnit((BigDecimal) key);
+
+ final ContentSection section = CMS.getContext().getContentSection();
+ final ItemResolver resolver = section.getItemResolver();
+ final Link link = new Link(value.toString(),
+ resolver.generateItemURL(state,
+ orgaUnit,
+ section,
+ orgaUnit.getVersion()));
+ return link;
+
+ }
+
+ }
+}
Modified: releases/2.0.0/ccm-cms/src/com/arsdigita/cms/ui/authoring/AuthoringKitWizard.java
===================================================================
--- releases/2.0.0/ccm-cms/src/com/arsdigita/cms/ui/authoring/AuthoringKitWizard.java 2013-02-03 09:50:25 UTC (rev 2484)
+++ releases/2.0.0/ccm-cms/src/com/arsdigita/cms/ui/authoring/AuthoringKitWizard.java 2013-02-03 12:31:30 UTC (rev 2485)
@@ -69,6 +69,7 @@
import java.util.Collection;
import java.util.Iterator;
import java.util.ArrayList;
+import java.util.Collections;
/**
* <p>This class represents a single authoring kit. The wizard
@@ -102,7 +103,8 @@
AuthoringKitWizard.class,
ContentType.class
};
- private static final ArrayList s_assets = new ArrayList();
+ //private static final ArrayList s_assets = new ArrayList();
+ private static final java.util.List<AssetStepEntry> s_assets = new ArrayList<AssetStepEntry>();
private final Object[] m_vals;
private final ContentType m_type;
private final AuthoringKit m_kit;
@@ -268,14 +270,19 @@
s_log.debug("skip step " + it.next());
}
}
- Iterator assets = s_assets.iterator();
+ //Iterator assets = s_assets.iterator();
+ Iterator<AssetStepEntry> assets = s_assets.iterator();
while (assets.hasNext()) {
- Object[] data = (Object[]) assets.next();
- String baseObjectType = (String) data[0];
- Class step = (Class) data[1];
+ //Object[] data = (Object[]) assets.next();
+ final AssetStepEntry data = assets.next();
+ //String baseObjectType = (String) data[0];
+ final String baseObjectType = data.getBaseDataObjectType();
+ //Class step = (Class) data[1];
+ Class step = data.getStep();
s_log.debug("possibly adding asset step " + step.getName());
if (!skipSteps.contains(step.getName())) {
- GlobalizedMessage label = (GlobalizedMessage) data[2];
+ //GlobalizedMessage label = (GlobalizedMessage) data[2];
+ GlobalizedMessage label = data.getLabel();
if (!thisType.isSubtypeOf(baseObjectType)) {
continue;
@@ -425,11 +432,17 @@
+ " step class: "
+ step.getName());
- Iterator assets = s_assets.iterator();
+ //Iterator assets = s_assets.iterator();
+ Iterator<AssetStepEntry> assets = s_assets.iterator();
while (assets.hasNext()) {
- Object[] data = (Object[]) assets.next();
- String thisObjectType = (String) data[0];
- GlobalizedMessage thisLabel = (GlobalizedMessage) data[2];
+ //Object[] data = (Object[]) assets.next();
+ //String thisObjectType = (String) data[0];
+ //GlobalizedMessage thisLabel = (GlobalizedMessage) data[2];
+
+ final AssetStepEntry data = assets.next();
+ String thisObjectType = data.getBaseDataObjectType();
+ GlobalizedMessage thisLabel = data.getLabel();
+
/**
* jensp 2011-11-14: The code above was only testing for the same
* label, but not for the same object type. I don't think that
@@ -447,9 +460,83 @@
break;
}
}
- s_assets.add(new Object[]{baseObjectType, step, label, description});
+ s_assets.add(new AssetStepEntry(baseObjectType, step, label, description, sortKey));
+ Collections.sort(s_assets);
+ //s_assets.add(new Object[]{baseObjectType, step, label, description});
}
+ private static class AssetStepEntry implements Comparable<AssetStepEntry> {
+ private String baseDataObjectType;
+ private Class step;
+ private GlobalizedMessage label;
+ private GlobalizedMessage description;
+ private Integer sortKey;
+
+ public AssetStepEntry() {
+ super();
+ }
+
+ public AssetStepEntry(final String baseDataObjectType,
+ final Class step,
+ final GlobalizedMessage label,
+ final GlobalizedMessage description,
+ final Integer sortKey) {
+ this.baseDataObjectType = baseDataObjectType;
+ this.step = step;
+ this.label = label;
+ this.description = description;
+ this.sortKey = sortKey;
+ }
+
+ public String getBaseDataObjectType() {
+ return baseDataObjectType;
+ }
+
+ public void setBaseDataObjectType(final String baseDataObjectType) {
+ this.baseDataObjectType = baseDataObjectType;
+ }
+
+ public Class getStep() {
+ return step;
+ }
+
+ public void setStep(final Class step) {
+ this.step = step;
+ }
+
+ public GlobalizedMessage getLabel() {
+ return label;
+ }
+
+ public void setLabel(final GlobalizedMessage label) {
+ this.label = label;
+ }
+
+ public GlobalizedMessage getDescription() {
+ return description;
+ }
+
+ public void setDescription(final GlobalizedMessage description) {
+ this.description = description;
+ }
+
+ public Integer getSortKey() {
+ return sortKey;
+ }
+
+ public void setSortKey(final Integer sortKey) {
+ this.sortKey = sortKey;
+ }
+
+ public int compareTo(final AssetStepEntry other) {
+ if (sortKey == other.getSortKey()) {
+ return step.getName().compareTo(other.getStep().getName());
+ } else {
+ return sortKey.compareTo(other.getSortKey());
+ }
+ }
+ }
+
/**
* @return The content type handled by this wizard
*/
|