From: <pb...@fe...> - 2013-02-02 17:23:14
|
Author: pboy Date: 2013-02-02 17:23:03 +0000 (Sat, 02 Feb 2013) New Revision: 2464 Added: trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/GenericOrganizationalUnitBundleCollection.java trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericPersonOrgaUnitsStep.java trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericPersonOrgaUnitsTable.java Modified: trunk/ccm-cms/src/WEB-INF/content-types/GenericPerson.xml trunk/ccm-cms/src/com/arsdigita/cms/Initializer.java trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/ContenttypesResources.properties trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/ContenttypesResources_de.properties trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationalUnitContactAddForm.java trunk/ccm-cms/src/com/arsdigita/cms/ui/authoring/AuthoringKitWizard.java trunk/ccm-core/src/com/arsdigita/domain/xml/TraversalHandler.java Log: Improved ItemSearchWidget (create contact), added authoring step for genericPerson. Modified: trunk/ccm-cms/src/WEB-INF/content-types/GenericPerson.xml =================================================================== --- trunk/ccm-cms/src/WEB-INF/content-types/GenericPerson.xml 2013-02-02 16:40:47 UTC (rev 2463) +++ trunk/ccm-cms/src/WEB-INF/content-types/GenericPerson.xml 2013-02-02 17:23:03 UTC (rev 2464) @@ -29,7 +29,7 @@ component="com.arsdigita.cms.contenttypes.ui.GenericPersonContactPropertiesStep" ordering="2"/> - <ctd:include href="/WEB-INF/content-types/assign-categories-step.xml"/> + <ctd:include href="/WEB-INF/content-types/assign-categories-step.xml"/> </ctd:authoring-kit> </ctd:content-type> Modified: trunk/ccm-cms/src/com/arsdigita/cms/Initializer.java =================================================================== --- trunk/ccm-cms/src/com/arsdigita/cms/Initializer.java 2013-02-02 16:40:47 UTC (rev 2463) +++ trunk/ccm-cms/src/com/arsdigita/cms/Initializer.java 2013-02-02 17:23:03 UTC (rev 2464) @@ -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; @@ -93,8 +97,8 @@ /** Creates a s_logging category with name = to the full name of class */ private static Logger s_log = Logger.getLogger(Initializer.class); - /** Configuration object for the CMS module */ + /** Configuration object for the CMS module */ private static final CMSConfig s_conf = CMSConfig.getInstance(); /** @@ -107,10 +111,8 @@ s_log.debug("CMS.Initializer.(Constructor) invoked"); - add(new PDLInitializer - (new ManifestSource - ("ccm-cms.pdl.mf", - new NameFilter(DbHelper.getDatabaseSuffix(database), "pdl")))); + add(new PDLInitializer(new ManifestSource("ccm-cms.pdl.mf", + new NameFilter(DbHelper.getDatabaseSuffix(database), "pdl")))); add(new com.arsdigita.cms.contentsection.Initializer()); add(new com.arsdigita.cms.publishToFile.Initializer()); @@ -131,28 +133,28 @@ super.init(e); /* Register object instantiator for Workspace (Content Center) */ - e.getFactory().registerInstantiator - (Workspace.BASE_DATA_OBJECT_TYPE, - new ACSObjectInstantiator() { - @Override - public DomainObject doNewInstance(DataObject dobj) { - return new Workspace(dobj); - } - } ); + 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()); + Kernel.getConfig().getSupportedLanguages()); /* Register object instantiator for CMS Service */ - e.getFactory().registerInstantiator - (Service.BASE_DATA_OBJECT_TYPE, - new ACSObjectInstantiator() { - @Override - public DomainObject doNewInstance(DataObject dobj) { - return new Service(dobj); - } - } ); + 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, new ItemURLFinder()); URLService.registerFinder(ContentBundle.BASE_DATA_OBJECT_TYPE, @@ -163,54 +165,54 @@ new AssetURLFinder()); URLService.registerFinder( - Link.BASE_DATA_OBJECT_TYPE, - new URLFinder() { - public String find(OID oid, String context) - throws NoValidURLException { + Link.BASE_DATA_OBJECT_TYPE, + new URLFinder() { + public String find(OID oid, String context) + throws NoValidURLException { - return find(oid); - } - public String find( OID oid ) - throws NoValidURLException { - - Link link; - try { - link = (Link) DomainObjectFactory.newInstance( oid ); - } catch( DataObjectNotFoundException ex ) { - throw new NoValidURLException - ( "Cannot find an object with oid: " + oid ); + return find(oid); } - if (Link.EXTERNAL_LINK.equals(link.getTargetType())) { - return link.getTargetURI(); - } else { - ContentItem target = link.getTargetItem(); + public String find(OID oid) + throws NoValidURLException { + Link link; try { - return URLService.locate( target.getOID() ); - } catch( URLFinderNotFoundException ex ) { - throw new UncheckedWrapperException( ex ); + link = (Link) DomainObjectFactory.newInstance(oid); + } catch (DataObjectNotFoundException ex) { + throw new NoValidURLException("Cannot find an object with oid: " + oid); } + + if (Link.EXTERNAL_LINK.equals(link.getTargetType())) { + return link.getTargetURI(); + } else { + ContentItem target = link.getTargetItem(); + + try { + return URLService.locate(target.getOID()); + } catch (URLFinderNotFoundException ex) { + throw new UncheckedWrapperException(ex); + } + } } - } - } - ); + }); + ImageSizerFactory.initialize(); registerInstantiators(e.getFactory()); registerLuceneEngine(); registerIntermediaEngine(); registerPatternGenerators(); - + // cg - register Task Retrieval engine Engine.registerEngine(CMSEngine.CMS_ENGINE_TYPE, new CMSEngine()); // Setup Workspace tab to URL mapping final String workspaceURL = CMS.WORKSPACE_PACKAGE_KEY; final String contentCenterMap = s_conf.getContentCenterMap(); - WorkspaceSetup workspaceSetup = new WorkspaceSetup( workspaceURL, - contentCenterMap); + WorkspaceSetup workspaceSetup = new WorkspaceSetup(workspaceURL, + contentCenterMap); workspaceSetup.run(); // register item adapters @@ -220,22 +222,26 @@ // 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() - .getPublishToFileClass().newInstance()); + 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( - FileAsset.BASE_DATA_OBJECT_TYPE, - new AssetMetadataProvider()); + FileAsset.BASE_DATA_OBJECT_TYPE, + 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) @@ -245,113 +251,112 @@ */ private void registerPatternGenerators() { PatternStylesheetResolver.registerPatternGenerator( - "item_template_oid", - new ItemTemplatePatternGenerator() - ); + "item_template_oid", + new ItemTemplatePatternGenerator()); PatternStylesheetResolver.registerPatternGenerator( - "item_delegated_url", - new ItemDelegatedURLPatternGenerator() - ); + "item_delegated_url", + new ItemDelegatedURLPatternGenerator()); } /** * Registers object instantiators */ - private void registerInstantiators(DomainObjectFactory f) { + private void registerInstantiators(DomainObjectFactory f) { // Register the CMSTaskInstaniator - 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, - new DomainObjectInstantiator() { - public DomainObject doNewInstance(DataObject dataObject) { - return new CMSTaskType(dataObject); - } - }); - 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, - new ACSObjectInstantiator() { - public DomainObject doNewInstance(DataObject dataObject) { - return new Workflow(dataObject); - } - }); + f.registerInstantiator(CMSTask.BASE_DATA_OBJECT_TYPE, + new ACSObjectInstantiator() { + @Override + public DomainObject doNewInstance(DataObject dataObject) { + return new CMSTask(dataObject); + } - f.registerInstantiator - (WorkflowTemplate.BASE_DATA_OBJECT_TYPE, - new ACSObjectInstantiator() { - @Override - public DomainObject doNewInstance(DataObject dataObject) { - return new WorkflowTemplate(dataObject); - } - }); + }); + f.registerInstantiator(CMSTaskType.BASE_DATA_OBJECT_TYPE, + new DomainObjectInstantiator() { + public DomainObject doNewInstance(DataObject dataObject) { + return new CMSTaskType(dataObject); + } - f.registerInstantiator - (TemplateContext.BASE_DATA_OBJECT_TYPE, - new DomainObjectInstantiator() { - public DomainObject doNewInstance(DataObject dataObject) { - return new TemplateContext(dataObject); - } - @Override - public DomainObjectInstantiator - resolveInstantiator(DataObject obj) { - return this; - } - }); - } + }); + 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, + new ACSObjectInstantiator() { + public DomainObject doNewInstance(DataObject dataObject) { + return new Workflow(dataObject); + } + + }); + + 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, + new DomainObjectInstantiator() { + public DomainObject doNewInstance(DataObject dataObject) { + return new TemplateContext(dataObject); + } + + @Override + public DomainObjectInstantiator resolveInstantiator(DataObject obj) { + return this; + } + + }); + } + private void registerLuceneEngine() { QueryEngineRegistry.registerEngine(IndexerType.LUCENE, - new FilterType[] { - new CategoryFilterType(), - new ContentSectionFilterType(), - new CMSContentSectionFilterType(), - new ContentTypeFilterType(), - new CreationDateFilterType(), - new CreationUserFilterType(), - new LastModifiedDateFilterType(), - new LastModifiedUserFilterType(), - new ObjectTypeFilterType(), - new PermissionFilterType(), - new VersionFilterType() - }, + new FilterType[]{ + new CategoryFilterType(), + new ContentSectionFilterType(), + new CMSContentSectionFilterType(), + new ContentTypeFilterType(), + new CreationDateFilterType(), + new CreationUserFilterType(), + new LastModifiedDateFilterType(), + new LastModifiedUserFilterType(), + new ObjectTypeFilterType(), + new PermissionFilterType(), + new VersionFilterType() + }, new LuceneQueryEngine()); } private void registerIntermediaEngine() { QueryEngineRegistry.registerEngine(IndexerType.INTERMEDIA, - new FilterType[] { - new CategoryFilterType(), - new ContentSectionFilterType(), - new CMSContentSectionFilterType(), - new ContentTypeFilterType(), - new CreationDateFilterType(), - new CreationUserFilterType(), - new LastModifiedDateFilterType(), - new LastModifiedUserFilterType(), - new LaunchDateFilterType(), - new ObjectTypeFilterType(), - new PermissionFilterType(), - new VersionFilterType() - }, + new FilterType[]{ + new CategoryFilterType(), + new ContentSectionFilterType(), + new CMSContentSectionFilterType(), + new ContentTypeFilterType(), + new CreationDateFilterType(), + new CreationUserFilterType(), + new LastModifiedDateFilterType(), + new LastModifiedUserFilterType(), + new LaunchDateFilterType(), + new ObjectTypeFilterType(), + new PermissionFilterType(), + new VersionFilterType() + }, new IntermediaQueryEngine()); } + } Modified: trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/ContenttypesResources.properties =================================================================== --- trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/ContenttypesResources.properties 2013-02-02 16:40:47 UTC (rev 2463) +++ trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/ContenttypesResources.properties 2013-02-02 17:23:03 UTC (rev 2464) @@ -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: trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/ContenttypesResources_de.properties =================================================================== --- trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/ContenttypesResources_de.properties 2013-02-02 16:40:47 UTC (rev 2463) +++ trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/ContenttypesResources_de.properties 2013-02-02 17:23:03 UTC (rev 2464) @@ -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: trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/GenericOrganizationalUnitBundleCollection.java =================================================================== --- trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/GenericOrganizationalUnitBundleCollection.java (rev 0) +++ trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/GenericOrganizationalUnitBundleCollection.java 2013-02-02 17:23:03 UTC (rev 2464) @@ -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: trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationalUnitContactAddForm.java =================================================================== --- trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationalUnitContactAddForm.java 2013-02-02 16:40:47 UTC (rev 2463) +++ trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationalUnitContactAddForm.java 2013-02-02 17:23:03 UTC (rev 2464) @@ -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: trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericPersonOrgaUnitsStep.java =================================================================== --- trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericPersonOrgaUnitsStep.java (rev 0) +++ trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericPersonOrgaUnitsStep.java 2013-02-02 17:23:03 UTC (rev 2464) @@ -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: trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericPersonOrgaUnitsTable.java =================================================================== --- trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericPersonOrgaUnitsTable.java (rev 0) +++ trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericPersonOrgaUnitsTable.java 2013-02-02 17:23:03 UTC (rev 2464) @@ -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: trunk/ccm-cms/src/com/arsdigita/cms/ui/authoring/AuthoringKitWizard.java =================================================================== --- trunk/ccm-cms/src/com/arsdigita/cms/ui/authoring/AuthoringKitWizard.java 2013-02-02 16:40:47 UTC (rev 2463) +++ trunk/ccm-cms/src/com/arsdigita/cms/ui/authoring/AuthoringKitWizard.java 2013-02-02 17:23:03 UTC (rev 2464) @@ -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 */ Modified: trunk/ccm-core/src/com/arsdigita/domain/xml/TraversalHandler.java =================================================================== --- trunk/ccm-core/src/com/arsdigita/domain/xml/TraversalHandler.java 2013-02-02 16:40:47 UTC (rev 2463) +++ trunk/ccm-core/src/com/arsdigita/domain/xml/TraversalHandler.java 2013-02-02 17:23:03 UTC (rev 2464) @@ -66,8 +66,10 @@ m_adapters = new HashMap(); } + @Override public void characters(char[] ch, int start, int len) {} + @Override public void startElement(String uri, String localName, String qn, Attributes attrs) { if (!XMLNS.equals(uri)) { |