Verweise für PublicationList entfernt
git-svn-id: https://svn.libreccm.org/ccm/trunk@615 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
85c395a29b
commit
b32ee91884
|
|
@ -1,26 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<xrd:adapters
|
|
||||||
xmlns:xrd="http://xmlns.redhat.com/schemas/waf/xml-renderer-rules"
|
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://rhea.redhat.com/schemas/waf/xml-renderer-rules xml-renderer-rules.xsd">
|
|
||||||
|
|
||||||
<xrd:context name="com.arsdigita.cms.dispatcher.SimpleXMLGenerator" >
|
|
||||||
|
|
||||||
<xrd:adapter objectType="com.arsdigita.cms.contenttypes.PublicationList"
|
|
||||||
extends="com.arsdigita.cms.ContentPage">
|
|
||||||
|
|
||||||
<xrd:associations rule="include">
|
|
||||||
<xrd:property name="/object/publications"/>
|
|
||||||
<xrd:property name="/object/publications/authors"/>
|
|
||||||
<xrd:property name="/object/publications/publisher"/>
|
|
||||||
<xrd:property name="/object/publications/series"/>
|
|
||||||
<xrd:property name="/object/publications/series/editors"/>
|
|
||||||
<xrd:property name="/object/publications/articles"/>
|
|
||||||
<xrd:property name="/object/publications/collectedvolume"/>
|
|
||||||
</xrd:associations>
|
|
||||||
|
|
||||||
</xrd:adapter>
|
|
||||||
|
|
||||||
</xrd:context>
|
|
||||||
|
|
||||||
</xrd:adapters>
|
|
||||||
|
|
@ -57,7 +57,6 @@ public class Publication extends ContentPage {
|
||||||
public final static String AUTHORS = "authors";
|
public final static String AUTHORS = "authors";
|
||||||
public final static String EDITOR = "editor";
|
public final static String EDITOR = "editor";
|
||||||
public final static String AUTHOR_ORDER = "authorOrder";
|
public final static String AUTHOR_ORDER = "authorOrder";
|
||||||
public final static String PUBLICATIONLISTS = "publicationLists";
|
|
||||||
public final static String SERIES = "series";
|
public final static String SERIES = "series";
|
||||||
public final static String BASE_DATA_OBJECT_TYPE =
|
public final static String BASE_DATA_OBJECT_TYPE =
|
||||||
"com.arsdigita.cms.contenttypes.Publication";
|
"com.arsdigita.cms.contenttypes.Publication";
|
||||||
|
|
@ -184,28 +183,6 @@ public class Publication extends ContentPage {
|
||||||
return !this.getAuthors().isEmpty();
|
return !this.getAuthors().isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
public PublicationListCollection getPublicationLists() {
|
|
||||||
return new PublicationListCollection(
|
|
||||||
(DataCollection) get(PUBLICATIONLISTS));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addPublicationList(PublicationList list) {
|
|
||||||
Assert.exists(list, PublicationList.class);
|
|
||||||
|
|
||||||
add(PUBLICATIONLISTS, list);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void removePublicationList(PublicationList list) {
|
|
||||||
Assert.exists(list, PublicationList.class);
|
|
||||||
|
|
||||||
remove(PUBLICATIONLISTS, list);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean hasPublicationLists() {
|
|
||||||
return !this.getPublicationLists().isEmpty();
|
|
||||||
}
|
|
||||||
|
|
||||||
public SeriesCollection getSeries() {
|
public SeriesCollection getSeries() {
|
||||||
return new SeriesCollection((DataCollection) get(SERIES));
|
return new SeriesCollection((DataCollection) get(SERIES));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,93 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2010 Jens Pelzetter,
|
|
||||||
* for the Center of Social Politics of the University of Bremen
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU Lesser General Public License
|
|
||||||
* as published by the Free Software Foundation; either version 2.1 of
|
|
||||||
* the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
|
||||||
* License along with this library; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package com.arsdigita.cms.contenttypes;
|
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
|
|
||||||
import com.arsdigita.cms.ContentPage;
|
|
||||||
import com.arsdigita.domain.DataObjectNotFoundException;
|
|
||||||
import com.arsdigita.persistence.DataCollection;
|
|
||||||
import com.arsdigita.persistence.DataObject;
|
|
||||||
import com.arsdigita.persistence.OID;
|
|
||||||
import com.arsdigita.util.Assert;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This content type is used to create a simple list of {@link Publication}
|
|
||||||
* items. This is only a temporally solution. This content type be replaced by
|
|
||||||
* a more flexible portlet or application soon.
|
|
||||||
*
|
|
||||||
* @author Jens Pelzetter
|
|
||||||
*/
|
|
||||||
public class PublicationList extends ContentPage {
|
|
||||||
|
|
||||||
public static final String DESCRIPTION = "description";
|
|
||||||
public static final String PUBLICATIONS = "publications";
|
|
||||||
public static final String BASE_DATA_OBJECT_TYPE =
|
|
||||||
"com.arsdigita.cms.contenttypes.PublicationList";
|
|
||||||
|
|
||||||
public PublicationList() {
|
|
||||||
this(BASE_DATA_OBJECT_TYPE);
|
|
||||||
}
|
|
||||||
|
|
||||||
public PublicationList(BigDecimal id)
|
|
||||||
throws DataObjectNotFoundException {
|
|
||||||
this(new OID(BASE_DATA_OBJECT_TYPE, id));
|
|
||||||
}
|
|
||||||
|
|
||||||
public PublicationList(OID oid) throws DataObjectNotFoundException {
|
|
||||||
super(oid);
|
|
||||||
}
|
|
||||||
|
|
||||||
public PublicationList(DataObject obj) {
|
|
||||||
super(obj);
|
|
||||||
}
|
|
||||||
|
|
||||||
public PublicationList(String type) {
|
|
||||||
super(type);
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDescription() {
|
|
||||||
return (String) get(DESCRIPTION);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDescription(String desc) {
|
|
||||||
set(DESCRIPTION, desc);
|
|
||||||
}
|
|
||||||
|
|
||||||
public PublicationCollection getPublications() {
|
|
||||||
return new PublicationCollection((DataCollection) get(PUBLICATIONS));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addPublication(Publication publication) {
|
|
||||||
Assert.exists (publication, Publication.class);
|
|
||||||
|
|
||||||
add(PUBLICATIONS, publication);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void removePublication(Publication publication) {
|
|
||||||
Assert.exists (publication, Publication.class);
|
|
||||||
|
|
||||||
remove(PUBLICATIONS, publication);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean hasPublications() {
|
|
||||||
return !getPublications().isEmpty();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,39 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2010 Jens Pelzetter,
|
|
||||||
* for the Center of Social Politics of the University of Bremen
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU Lesser General Public License
|
|
||||||
* as published by the Free Software Foundation; either version 2.1 of
|
|
||||||
* the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
|
||||||
* License along with this library; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package com.arsdigita.cms.contenttypes;
|
|
||||||
|
|
||||||
import com.arsdigita.domain.DomainCollection;
|
|
||||||
import com.arsdigita.persistence.DataCollection;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Jens Pelzetter
|
|
||||||
*/
|
|
||||||
public class PublicationListCollection extends DomainCollection {
|
|
||||||
|
|
||||||
public PublicationListCollection(DataCollection dataCollection) {
|
|
||||||
super(dataCollection);
|
|
||||||
}
|
|
||||||
|
|
||||||
public PublicationList getPublicationList() {
|
|
||||||
return new PublicationList(m_dataCollection.getDataObject());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,23 +0,0 @@
|
||||||
package com.arsdigita.cms.contenttypes;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Jens Pelzetter
|
|
||||||
*/
|
|
||||||
public class PublicationListInitializer extends ContentTypeInitializer {
|
|
||||||
|
|
||||||
public PublicationListInitializer() {
|
|
||||||
super("empty.pdl.mf", PublicationList.BASE_DATA_OBJECT_TYPE);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String[] getStylesheets() {
|
|
||||||
return new String[]{"/static/content-types/com/arsdigita/cms/contenttypes/PublicationList.xsl"};
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getTraversalXML() {
|
|
||||||
return "/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/PublicationList.xml";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,19 +0,0 @@
|
||||||
package com.arsdigita.cms.contenttypes;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Jens Pelzetter
|
|
||||||
*/
|
|
||||||
public class PublicationListLoader extends AbstractContentTypeLoader {
|
|
||||||
|
|
||||||
private static final String[] TYPES = {"/WEB-INF/content-types/com/arsdigita/cms/contenttypes/PublicationList.xml"};
|
|
||||||
|
|
||||||
public PublicationListLoader() {
|
|
||||||
super();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String[] getTypes() {
|
|
||||||
return TYPES;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,122 +0,0 @@
|
||||||
package com.arsdigita.cms.contenttypes.ui;
|
|
||||||
|
|
||||||
import java.text.DateFormat;
|
|
||||||
|
|
||||||
import com.arsdigita.bebop.Component;
|
|
||||||
import com.arsdigita.bebop.Label;
|
|
||||||
import com.arsdigita.bebop.PageState;
|
|
||||||
import com.arsdigita.bebop.SegmentedPanel;
|
|
||||||
import com.arsdigita.cms.ContentPage;
|
|
||||||
import com.arsdigita.cms.ContentSection;
|
|
||||||
import com.arsdigita.cms.ItemSelectionModel;
|
|
||||||
import com.arsdigita.cms.contenttypes.PublicationList;
|
|
||||||
import com.arsdigita.cms.contenttypes.util.ContenttypesGlobalizationUtil;
|
|
||||||
import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
|
|
||||||
import com.arsdigita.cms.ui.authoring.BasicPageForm;
|
|
||||||
import com.arsdigita.cms.ui.authoring.SimpleEditStep;
|
|
||||||
import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
|
|
||||||
import com.arsdigita.domain.DomainObject;
|
|
||||||
import com.arsdigita.toolbox.ui.DomainObjectPropertySheet;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Jens Pelzetter
|
|
||||||
*/
|
|
||||||
public class PublicationListPropertiesStep extends SimpleEditStep {
|
|
||||||
|
|
||||||
public static final String EDIT_SHEET_NAME = "edit";
|
|
||||||
private SegmentedPanel segmentedPanel;
|
|
||||||
|
|
||||||
public PublicationListPropertiesStep(ItemSelectionModel itemModel,
|
|
||||||
AuthoringKitWizard parent) {
|
|
||||||
super(itemModel, parent);
|
|
||||||
|
|
||||||
segmentedPanel = new SegmentedPanel();
|
|
||||||
setDefaultEditKey(EDIT_SHEET_NAME);
|
|
||||||
|
|
||||||
addBasicProperties(itemModel, parent);
|
|
||||||
addSteps(itemModel, parent);
|
|
||||||
|
|
||||||
setDisplayComponent(segmentedPanel);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Component getPublicationListPropertySheet(
|
|
||||||
ItemSelectionModel itemModel) {
|
|
||||||
DomainObjectPropertySheet sheet =
|
|
||||||
new DomainObjectPropertySheet(itemModel);
|
|
||||||
|
|
||||||
sheet.add(PublicationGlobalizationUtil.globalize(
|
|
||||||
"publications.ui.publicationlist.name"),
|
|
||||||
PublicationList.NAME);
|
|
||||||
sheet.add(PublicationGlobalizationUtil.globalize(
|
|
||||||
"publications.ui.publicationlist.title"),
|
|
||||||
PublicationList.TITLE);
|
|
||||||
|
|
||||||
if (!ContentSection.getConfig().getHideLaunchDate()) {
|
|
||||||
sheet.add(ContenttypesGlobalizationUtil.globalize(
|
|
||||||
"cms.ui.authoring.page_launch_date"),
|
|
||||||
ContentPage.LAUNCH_DATE,
|
|
||||||
new DomainObjectPropertySheet.AttributeFormatter() {
|
|
||||||
|
|
||||||
public String format(DomainObject item,
|
|
||||||
String attribute,
|
|
||||||
PageState state) {
|
|
||||||
ContentPage page = (ContentPage) item;
|
|
||||||
if (page.getLaunchDate() != null) {
|
|
||||||
return DateFormat.getDateInstance(DateFormat.LONG).
|
|
||||||
format(page.getLaunchDate());
|
|
||||||
} else {
|
|
||||||
return (String) ContenttypesGlobalizationUtil.globalize(
|
|
||||||
"cms.ui.unknown").localize();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
return sheet;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected SegmentedPanel getSegmentedPanel() {
|
|
||||||
return segmentedPanel;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void addBasicProperties(ItemSelectionModel itemModel,
|
|
||||||
AuthoringKitWizard parent) {
|
|
||||||
SimpleEditStep basicProperties = new SimpleEditStep(itemModel,
|
|
||||||
parent,
|
|
||||||
EDIT_SHEET_NAME);
|
|
||||||
|
|
||||||
BasicPageForm editBasicSheet =
|
|
||||||
new PublicationListPropertyForm(itemModel,
|
|
||||||
this);
|
|
||||||
basicProperties.add(EDIT_SHEET_NAME,
|
|
||||||
(String) PublicationGlobalizationUtil.globalize(
|
|
||||||
"publcations.ui.publicationlist_edit_basic_sheet").
|
|
||||||
localize(), new WorkflowLockedComponentAccess(editBasicSheet,
|
|
||||||
itemModel),
|
|
||||||
editBasicSheet.getSaveCancelSection().
|
|
||||||
getCancelButton());
|
|
||||||
|
|
||||||
basicProperties.setDisplayComponent(
|
|
||||||
getPublicationListPropertySheet(itemModel));
|
|
||||||
|
|
||||||
segmentedPanel.addSegment(
|
|
||||||
new Label((String) PublicationGlobalizationUtil.globalize(
|
|
||||||
"publications.ui.publicationlist.basic_properties").
|
|
||||||
localize()), basicProperties);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void addSteps(ItemSelectionModel itemModel,
|
|
||||||
AuthoringKitWizard parent) {
|
|
||||||
addStep(new PublicationListPublicationsStep(itemModel, parent),
|
|
||||||
"publications.ui.publicationlist.publications");
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void addStep(SimpleEditStep step, String labelKey) {
|
|
||||||
segmentedPanel.addSegment(
|
|
||||||
new Label((String) PublicationGlobalizationUtil.globalize(
|
|
||||||
labelKey).localize()),
|
|
||||||
step);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,93 +0,0 @@
|
||||||
package com.arsdigita.cms.contenttypes.ui;
|
|
||||||
|
|
||||||
import com.arsdigita.bebop.FormData;
|
|
||||||
import com.arsdigita.bebop.FormProcessException;
|
|
||||||
import com.arsdigita.bebop.Label;
|
|
||||||
import com.arsdigita.bebop.event.FormInitListener;
|
|
||||||
import com.arsdigita.bebop.event.FormProcessListener;
|
|
||||||
import com.arsdigita.bebop.event.FormSectionEvent;
|
|
||||||
import com.arsdigita.bebop.event.FormSubmissionListener;
|
|
||||||
import com.arsdigita.bebop.form.TextArea;
|
|
||||||
import com.arsdigita.bebop.form.TextField;
|
|
||||||
import com.arsdigita.bebop.parameters.ParameterModel;
|
|
||||||
import com.arsdigita.bebop.parameters.StringParameter;
|
|
||||||
import com.arsdigita.cms.ItemSelectionModel;
|
|
||||||
import com.arsdigita.cms.contenttypes.PublicationList;
|
|
||||||
import com.arsdigita.cms.ui.authoring.BasicPageForm;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Jens Pelzetter
|
|
||||||
*/
|
|
||||||
public class PublicationListPropertyForm
|
|
||||||
extends BasicPageForm
|
|
||||||
implements FormProcessListener,
|
|
||||||
FormInitListener,
|
|
||||||
FormSubmissionListener {
|
|
||||||
|
|
||||||
private PublicationListPropertiesStep m_step;
|
|
||||||
public static final String ID = "PublicationList_edit";
|
|
||||||
|
|
||||||
public PublicationListPropertyForm(ItemSelectionModel itemModel) {
|
|
||||||
this(itemModel, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
public PublicationListPropertyForm(ItemSelectionModel itemModel,
|
|
||||||
PublicationListPropertiesStep step) {
|
|
||||||
super(ID, itemModel);
|
|
||||||
m_step = step;
|
|
||||||
addSubmissionListener(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void addWidgets() {
|
|
||||||
super.addWidgets();
|
|
||||||
|
|
||||||
add(new Label((String) PublicationGlobalizationUtil.globalize(
|
|
||||||
"publications.ui.publicationlist.title").localize()));
|
|
||||||
ParameterModel titleParam = new StringParameter(PublicationList.TITLE);
|
|
||||||
TextField title = new TextField(titleParam);
|
|
||||||
add(title);
|
|
||||||
|
|
||||||
add(new Label((String) PublicationGlobalizationUtil.globalize(
|
|
||||||
"publications.ui.publicationlist.description").localize()));
|
|
||||||
ParameterModel descParam =
|
|
||||||
new StringParameter(PublicationList.DESCRIPTION);
|
|
||||||
TextArea desc = new TextArea(descParam);
|
|
||||||
desc.setCols(60);
|
|
||||||
desc.setRows(16);
|
|
||||||
add(desc);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void init(FormSectionEvent fse) throws FormProcessException {
|
|
||||||
FormData data = fse.getFormData();
|
|
||||||
PublicationList list = (PublicationList) super.initBasicWidgets(fse);
|
|
||||||
|
|
||||||
data.put(PublicationList.TITLE, list.getTitle());
|
|
||||||
data.put(PublicationList.DESCRIPTION, list.getDescription());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void process(FormSectionEvent fse) throws FormProcessException {
|
|
||||||
FormData data = fse.getFormData();
|
|
||||||
PublicationList list = (PublicationList) super.processBasicWidgets(fse);
|
|
||||||
|
|
||||||
if ((list != null) && getSaveCancelSection().getSaveButton().
|
|
||||||
isSelected(fse.getPageState())) {
|
|
||||||
list.setTitle((String) data.get(PublicationList.TITLE));
|
|
||||||
list.setDescription((String) data.get(PublicationList.DESCRIPTION));
|
|
||||||
|
|
||||||
list.save();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void submitted(FormSectionEvent fse) throws FormProcessException {
|
|
||||||
if ((m_step != null) && getSaveCancelSection().getCancelButton().
|
|
||||||
isSelected(fse.getPageState())) {
|
|
||||||
m_step.cancelStreamlinedCreation(fse.getPageState());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,69 +0,0 @@
|
||||||
package com.arsdigita.cms.contenttypes.ui;
|
|
||||||
|
|
||||||
import com.arsdigita.bebop.FormData;
|
|
||||||
import com.arsdigita.bebop.FormProcessException;
|
|
||||||
import com.arsdigita.bebop.Label;
|
|
||||||
import com.arsdigita.bebop.PageState;
|
|
||||||
import com.arsdigita.bebop.event.FormInitListener;
|
|
||||||
import com.arsdigita.bebop.event.FormProcessListener;
|
|
||||||
import com.arsdigita.bebop.event.FormSectionEvent;
|
|
||||||
import com.arsdigita.cms.ContentType;
|
|
||||||
import com.arsdigita.cms.ItemSelectionModel;
|
|
||||||
import com.arsdigita.cms.contenttypes.Publication;
|
|
||||||
import com.arsdigita.cms.contenttypes.PublicationList;
|
|
||||||
import com.arsdigita.cms.ui.ItemSearchWidget;
|
|
||||||
import com.arsdigita.cms.ui.authoring.BasicItemForm;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Jens Pelzetter
|
|
||||||
*/
|
|
||||||
public class PublicationListPublicationAddForm
|
|
||||||
extends BasicItemForm
|
|
||||||
implements FormProcessListener,
|
|
||||||
FormInitListener {
|
|
||||||
|
|
||||||
private PublicationListPropertiesStep m_step;
|
|
||||||
private ItemSearchWidget m_itemSearch;
|
|
||||||
private final String ITEM_SEARCH = "publications";
|
|
||||||
private ItemSelectionModel m_itemModel;
|
|
||||||
|
|
||||||
public PublicationListPublicationAddForm(ItemSelectionModel itemModel) {
|
|
||||||
super("PublicationsEntryForm", itemModel);
|
|
||||||
m_itemModel = itemModel;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void addWidgets() {
|
|
||||||
add(new Label((String) PublicationGlobalizationUtil.globalize(
|
|
||||||
"publications.ui.publicationlist.selectPublication").
|
|
||||||
localize()));
|
|
||||||
m_itemSearch = new ItemSearchWidget(
|
|
||||||
ITEM_SEARCH,
|
|
||||||
ContentType.findByAssociatedObjectType(
|
|
||||||
Publication.class.getName()));
|
|
||||||
add(m_itemSearch);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void init(FormSectionEvent fse) throws FormProcessException {
|
|
||||||
PageState state = fse.getPageState();
|
|
||||||
setVisible(state, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void process(FormSectionEvent fse) throws FormProcessException {
|
|
||||||
FormData data = fse.getFormData();
|
|
||||||
PageState state = fse.getPageState();
|
|
||||||
PublicationList list = (PublicationList) getItemSelectionModel().
|
|
||||||
getSelectedObject(state);
|
|
||||||
|
|
||||||
if (!(this.getSaveCancelSection().getCancelButton().
|
|
||||||
isSelected(state))) {
|
|
||||||
list.addPublication(
|
|
||||||
(Publication) data.get(ITEM_SEARCH));
|
|
||||||
}
|
|
||||||
|
|
||||||
init(fse);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,40 +0,0 @@
|
||||||
package com.arsdigita.cms.contenttypes.ui;
|
|
||||||
|
|
||||||
import com.arsdigita.cms.ItemSelectionModel;
|
|
||||||
import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
|
|
||||||
import com.arsdigita.cms.ui.authoring.BasicItemForm;
|
|
||||||
import com.arsdigita.cms.ui.authoring.SimpleEditStep;
|
|
||||||
import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Jens Pelzetter
|
|
||||||
*/
|
|
||||||
public class PublicationListPublicationsStep extends SimpleEditStep {
|
|
||||||
|
|
||||||
private static final String ADD_PUBLICATION_SHEET_NAME = "addPublication";
|
|
||||||
|
|
||||||
public PublicationListPublicationsStep(ItemSelectionModel itemModel,
|
|
||||||
AuthoringKitWizard parent) {
|
|
||||||
this(itemModel, parent, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
public PublicationListPublicationsStep(ItemSelectionModel itemModel,
|
|
||||||
AuthoringKitWizard parent,
|
|
||||||
String prefix) {
|
|
||||||
super(itemModel, parent, prefix);
|
|
||||||
|
|
||||||
BasicItemForm addPublicationSheet =
|
|
||||||
new PublicationListPublicationAddForm(itemModel);
|
|
||||||
add(ADD_PUBLICATION_SHEET_NAME,
|
|
||||||
(String) PublicationGlobalizationUtil.globalize(
|
|
||||||
"publications.ui.publicationlist.add_publication").localize(),
|
|
||||||
new WorkflowLockedComponentAccess(addPublicationSheet,
|
|
||||||
itemModel),
|
|
||||||
addPublicationSheet.getSaveCancelSection().getCancelButton());
|
|
||||||
|
|
||||||
PublicationListPublicationsTable publicationsTable =
|
|
||||||
new PublicationListPublicationsTable(itemModel);
|
|
||||||
setDisplayComponent(publicationsTable);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,234 +0,0 @@
|
||||||
package com.arsdigita.cms.contenttypes.ui;
|
|
||||||
|
|
||||||
import com.arsdigita.bebop.Component;
|
|
||||||
import com.arsdigita.bebop.ControlLink;
|
|
||||||
import com.arsdigita.bebop.Label;
|
|
||||||
import com.arsdigita.bebop.PageState;
|
|
||||||
import com.arsdigita.bebop.Table;
|
|
||||||
import com.arsdigita.bebop.event.TableActionEvent;
|
|
||||||
import com.arsdigita.bebop.event.TableActionListener;
|
|
||||||
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.ItemSelectionModel;
|
|
||||||
import com.arsdigita.cms.SecurityManager;
|
|
||||||
import com.arsdigita.cms.contenttypes.Publication;
|
|
||||||
import com.arsdigita.cms.contenttypes.PublicationCollection;
|
|
||||||
import com.arsdigita.cms.contenttypes.PublicationList;
|
|
||||||
import com.arsdigita.cms.dispatcher.Utilities;
|
|
||||||
import com.arsdigita.util.LockableImpl;
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Jens Pelzetter
|
|
||||||
*/
|
|
||||||
public class PublicationListPublicationsTable
|
|
||||||
extends Table
|
|
||||||
implements TableActionListener {
|
|
||||||
|
|
||||||
private static final String TABLE_COL_EDIT = "table_col_edit";
|
|
||||||
private final String TABLE_COL_DEL = "table_col_del";
|
|
||||||
private ItemSelectionModel m_itemModel;
|
|
||||||
|
|
||||||
public PublicationListPublicationsTable(ItemSelectionModel itemModel) {
|
|
||||||
super();
|
|
||||||
m_itemModel = itemModel;
|
|
||||||
|
|
||||||
setEmptyView(
|
|
||||||
new Label(PublicationGlobalizationUtil.globalize(
|
|
||||||
"publications.ui.publicationlist.no_publications")));
|
|
||||||
|
|
||||||
TableColumnModel colModel = getColumnModel();
|
|
||||||
colModel.add(new TableColumn(
|
|
||||||
0,
|
|
||||||
PublicationGlobalizationUtil.globalize(
|
|
||||||
"publications.ui.publicationlist.publication.title").
|
|
||||||
localize(),
|
|
||||||
TABLE_COL_EDIT));
|
|
||||||
colModel.add(new TableColumn(
|
|
||||||
1,
|
|
||||||
PublicationGlobalizationUtil.globalize(
|
|
||||||
"publications.ui.publicationlist.publication.remove").
|
|
||||||
localize(),
|
|
||||||
TABLE_COL_DEL));
|
|
||||||
|
|
||||||
setModelBuilder(
|
|
||||||
new PublicationListPublicationsTableModelBuilder(itemModel));
|
|
||||||
|
|
||||||
colModel.get(0).setCellRenderer(new EditCellRenderer());
|
|
||||||
colModel.get(1).setCellRenderer(new DeleteCellRenderer());
|
|
||||||
|
|
||||||
addTableActionListener(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
private class PublicationListPublicationsTableModelBuilder
|
|
||||||
extends LockableImpl
|
|
||||||
implements TableModelBuilder {
|
|
||||||
|
|
||||||
private ItemSelectionModel m_itemModel;
|
|
||||||
|
|
||||||
public PublicationListPublicationsTableModelBuilder(
|
|
||||||
ItemSelectionModel itemModel) {
|
|
||||||
m_itemModel = itemModel;
|
|
||||||
}
|
|
||||||
|
|
||||||
public TableModel makeModel(Table table, PageState state) {
|
|
||||||
table.getRowSelectionModel().clearSelection(state);
|
|
||||||
PublicationList list = (PublicationList) m_itemModel.
|
|
||||||
getSelectedObject(state);
|
|
||||||
return new PublicationListPublicationsTableModel(table,
|
|
||||||
state,
|
|
||||||
list);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private class PublicationListPublicationsTableModel implements TableModel {
|
|
||||||
|
|
||||||
private Table m_table;
|
|
||||||
private PublicationCollection m_publicationCollection;
|
|
||||||
private Publication m_publication;
|
|
||||||
|
|
||||||
public PublicationListPublicationsTableModel(Table table,
|
|
||||||
PageState state,
|
|
||||||
PublicationList list) {
|
|
||||||
m_table = table;
|
|
||||||
m_publicationCollection = list.getPublications();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getColumnCount() {
|
|
||||||
return m_table.getColumnModel().size();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean nextRow() {
|
|
||||||
boolean ret;
|
|
||||||
|
|
||||||
if ((m_publicationCollection != null)
|
|
||||||
&& m_publicationCollection.next()) {
|
|
||||||
m_publication = m_publicationCollection.getPublication();
|
|
||||||
ret = true;
|
|
||||||
} else {
|
|
||||||
ret = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Object getElementAt(int columnIndex) {
|
|
||||||
switch (columnIndex) {
|
|
||||||
case 0:
|
|
||||||
return m_publication.getTitle();
|
|
||||||
case 1:
|
|
||||||
return PublicationGlobalizationUtil.globalize(
|
|
||||||
"publications.ui.publicationlist.publication.remove").
|
|
||||||
localize();
|
|
||||||
default:
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public Object getKeyAt(int columnIndex) {
|
|
||||||
return m_publication.getID();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private class EditCellRenderer
|
|
||||||
extends LockableImpl
|
|
||||||
implements TableCellRenderer {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Component getComponent(
|
|
||||||
Table table,
|
|
||||||
PageState state,
|
|
||||||
Object value,
|
|
||||||
boolean isSelected,
|
|
||||||
Object key,
|
|
||||||
int row,
|
|
||||||
int col) {
|
|
||||||
SecurityManager securityManager =
|
|
||||||
Utilities.getSecurityManager(state);
|
|
||||||
PublicationList list = (PublicationList) m_itemModel.
|
|
||||||
getSelectedObject(state);
|
|
||||||
|
|
||||||
boolean canEdit = securityManager.canAccess(
|
|
||||||
state.getRequest(),
|
|
||||||
SecurityManager.EDIT_ITEM,
|
|
||||||
list);
|
|
||||||
|
|
||||||
if (canEdit) {
|
|
||||||
ControlLink link = new ControlLink(value.toString());
|
|
||||||
return link;
|
|
||||||
} else {
|
|
||||||
Label label = new Label(value.toString());
|
|
||||||
return label;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private class DeleteCellRenderer
|
|
||||||
extends LockableImpl
|
|
||||||
implements TableCellRenderer {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Component getComponent(Table table,
|
|
||||||
PageState state,
|
|
||||||
Object value,
|
|
||||||
boolean isSelected,
|
|
||||||
Object key,
|
|
||||||
int row,
|
|
||||||
int col) {
|
|
||||||
|
|
||||||
SecurityManager securityManager =
|
|
||||||
Utilities.getSecurityManager(state);
|
|
||||||
PublicationList list = (PublicationList) m_itemModel.
|
|
||||||
getSelectedObject(state);
|
|
||||||
|
|
||||||
boolean canDelete = securityManager.canAccess(
|
|
||||||
state.getRequest(),
|
|
||||||
SecurityManager.DELETE_ITEM,
|
|
||||||
list);
|
|
||||||
|
|
||||||
if (canDelete) {
|
|
||||||
ControlLink link = new ControlLink(value.toString());
|
|
||||||
link.setConfirmation((String) PublicationGlobalizationUtil.
|
|
||||||
globalize(
|
|
||||||
"publications.ui.publicationlist.publication.confirm_remove").
|
|
||||||
localize());
|
|
||||||
return link;
|
|
||||||
} else {
|
|
||||||
Label label = new Label(value.toString());
|
|
||||||
return label;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void cellSelected(TableActionEvent event) {
|
|
||||||
PageState state = event.getPageState();
|
|
||||||
|
|
||||||
Publication publication = new Publication(
|
|
||||||
new BigDecimal(event.getRowKey().toString()));
|
|
||||||
|
|
||||||
PublicationList list = (PublicationList) m_itemModel.getSelectedObject(
|
|
||||||
state);
|
|
||||||
|
|
||||||
PublicationCollection publications = list.getPublications();
|
|
||||||
|
|
||||||
TableColumn column = getColumnModel().get(event.getColumn().intValue());
|
|
||||||
|
|
||||||
if (column.getHeaderKey().toString().equals(TABLE_COL_EDIT)) {
|
|
||||||
} else if (column.getHeaderKey().toString().equals(TABLE_COL_DEL)) {
|
|
||||||
list.removePublication(publication);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void headSelected(TableActionEvent event) {
|
|
||||||
//Nothing to do
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -114,8 +114,6 @@ public class PublicationPropertiesStep extends SimpleEditStep {
|
||||||
AuthoringKitWizard parent) {
|
AuthoringKitWizard parent) {
|
||||||
addStep(new PublicationAuthorsPropertyStep(itemModel, parent),
|
addStep(new PublicationAuthorsPropertyStep(itemModel, parent),
|
||||||
"publications.ui.publication.authors");
|
"publications.ui.publication.authors");
|
||||||
addStep(new PublicationPublicationListPropertyStep(itemModel, parent),
|
|
||||||
"publications.ui.publication.lists");
|
|
||||||
addStep(new PublicationSeriesPropertyStep(itemModel, parent),
|
addStep(new PublicationSeriesPropertyStep(itemModel, parent),
|
||||||
"publication.ui.publication.series");
|
"publication.ui.publication.series");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,73 +0,0 @@
|
||||||
package com.arsdigita.cms.contenttypes.ui;
|
|
||||||
|
|
||||||
import com.arsdigita.bebop.FormData;
|
|
||||||
import com.arsdigita.bebop.FormProcessException;
|
|
||||||
import com.arsdigita.bebop.Label;
|
|
||||||
import com.arsdigita.bebop.PageState;
|
|
||||||
import com.arsdigita.bebop.event.FormInitListener;
|
|
||||||
import com.arsdigita.bebop.event.FormProcessListener;
|
|
||||||
import com.arsdigita.bebop.event.FormSectionEvent;
|
|
||||||
import com.arsdigita.cms.ContentType;
|
|
||||||
import com.arsdigita.cms.ItemSelectionModel;
|
|
||||||
import com.arsdigita.cms.contenttypes.Publication;
|
|
||||||
import com.arsdigita.cms.contenttypes.PublicationList;
|
|
||||||
import com.arsdigita.cms.ui.ItemSearchWidget;
|
|
||||||
import com.arsdigita.cms.ui.authoring.BasicItemForm;
|
|
||||||
import org.apache.log4j.Logger;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Jens Pelzetter
|
|
||||||
*/
|
|
||||||
public class PublicationPublicationListAddForm
|
|
||||||
extends BasicItemForm
|
|
||||||
implements FormProcessListener,
|
|
||||||
FormInitListener {
|
|
||||||
|
|
||||||
private static final Logger s_log = Logger.getLogger(
|
|
||||||
PublicationPublicationListAddForm.class);
|
|
||||||
private PublicationPropertiesStep m_step;
|
|
||||||
private ItemSearchWidget m_itemSearch;
|
|
||||||
private final String ITEM_SEARCH = "publicationLists";
|
|
||||||
private ItemSelectionModel m_itemModel;
|
|
||||||
|
|
||||||
public PublicationPublicationListAddForm(ItemSelectionModel itemModel) {
|
|
||||||
super("PublicationListEntryForm", itemModel);
|
|
||||||
m_itemModel = itemModel;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void addWidgets() {
|
|
||||||
add(new Label((String) PublicationGlobalizationUtil.globalize(
|
|
||||||
"publications.ui.publicationlist.select_list").localize()));
|
|
||||||
m_itemSearch = new ItemSearchWidget(
|
|
||||||
ITEM_SEARCH,
|
|
||||||
ContentType.findByAssociatedObjectType(
|
|
||||||
PublicationList.class.getName()));
|
|
||||||
add(m_itemSearch);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void init(FormSectionEvent fse) throws FormProcessException {
|
|
||||||
FormData data = fse.getFormData();
|
|
||||||
PageState state = fse.getPageState();
|
|
||||||
|
|
||||||
setVisible(state, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void process(FormSectionEvent fse) throws FormProcessException {
|
|
||||||
FormData data = fse.getFormData();
|
|
||||||
PageState state = fse.getPageState();
|
|
||||||
Publication publication = (Publication) getItemSelectionModel().
|
|
||||||
getSelectedObject(state);
|
|
||||||
|
|
||||||
if (!(this.getSaveCancelSection().getCancelButton().
|
|
||||||
isSelected(state))) {
|
|
||||||
publication.addPublicationList(
|
|
||||||
(PublicationList) data.get(ITEM_SEARCH));
|
|
||||||
}
|
|
||||||
|
|
||||||
init(fse);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,42 +0,0 @@
|
||||||
package com.arsdigita.cms.contenttypes.ui;
|
|
||||||
|
|
||||||
import com.arsdigita.cms.ItemSelectionModel;
|
|
||||||
import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
|
|
||||||
import com.arsdigita.cms.ui.authoring.BasicItemForm;
|
|
||||||
import com.arsdigita.cms.ui.authoring.SimpleEditStep;
|
|
||||||
import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Jens Pelzetter
|
|
||||||
*/
|
|
||||||
public class PublicationPublicationListPropertyStep extends SimpleEditStep {
|
|
||||||
|
|
||||||
private static final String ADD_PUBLICATIONLIST_SHEET_NAME =
|
|
||||||
"addPublicationList";
|
|
||||||
|
|
||||||
public PublicationPublicationListPropertyStep(ItemSelectionModel itemModel,
|
|
||||||
AuthoringKitWizard parent) {
|
|
||||||
this(itemModel, parent, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
public PublicationPublicationListPropertyStep(ItemSelectionModel itemModel,
|
|
||||||
AuthoringKitWizard parent,
|
|
||||||
String prefix) {
|
|
||||||
super(itemModel, parent, prefix);
|
|
||||||
|
|
||||||
BasicItemForm addPublicationListSheet =
|
|
||||||
new PublicationPublicationListAddForm(itemModel);
|
|
||||||
add(ADD_PUBLICATIONLIST_SHEET_NAME,
|
|
||||||
(String) PublicationGlobalizationUtil.globalize(
|
|
||||||
"publications.ui.publicationlists.add_list").localize(),
|
|
||||||
new WorkflowLockedComponentAccess(addPublicationListSheet,
|
|
||||||
itemModel),
|
|
||||||
addPublicationListSheet.getSaveCancelSection().getCancelButton());
|
|
||||||
|
|
||||||
PublicationPublicationListsTable listsTable =
|
|
||||||
new PublicationPublicationListsTable(itemModel);
|
|
||||||
setDisplayComponent(listsTable);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,239 +0,0 @@
|
||||||
package com.arsdigita.cms.contenttypes.ui;
|
|
||||||
|
|
||||||
import com.arsdigita.bebop.Component;
|
|
||||||
import com.arsdigita.bebop.ControlLink;
|
|
||||||
import com.arsdigita.bebop.Label;
|
|
||||||
import com.arsdigita.bebop.PageState;
|
|
||||||
import com.arsdigita.bebop.Table;
|
|
||||||
import com.arsdigita.bebop.event.TableActionEvent;
|
|
||||||
import com.arsdigita.bebop.event.TableActionListener;
|
|
||||||
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.ItemSelectionModel;
|
|
||||||
import com.arsdigita.cms.SecurityManager;
|
|
||||||
import com.arsdigita.cms.contenttypes.Publication;
|
|
||||||
import com.arsdigita.cms.contenttypes.PublicationList;
|
|
||||||
import com.arsdigita.cms.contenttypes.PublicationListCollection;
|
|
||||||
import com.arsdigita.cms.dispatcher.Utilities;
|
|
||||||
import com.arsdigita.util.LockableImpl;
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import org.apache.log4j.Logger;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Jens Pelzetter
|
|
||||||
*/
|
|
||||||
public class PublicationPublicationListsTable
|
|
||||||
extends Table
|
|
||||||
implements TableActionListener {
|
|
||||||
|
|
||||||
private static final Logger s_log = Logger.getLogger(
|
|
||||||
PublicationPublicationListsTable.class);
|
|
||||||
private final String TABLE_COL_EDIT = "table_col_edit";
|
|
||||||
private final String TABLE_COL_DEL = "table_col_del";
|
|
||||||
private ItemSelectionModel m_itemModel;
|
|
||||||
|
|
||||||
public PublicationPublicationListsTable(ItemSelectionModel itemModel) {
|
|
||||||
super();
|
|
||||||
m_itemModel = itemModel;
|
|
||||||
|
|
||||||
setEmptyView(new Label(PublicationGlobalizationUtil.globalize(
|
|
||||||
"publications.ui.publicationlists.none")));
|
|
||||||
|
|
||||||
TableColumnModel colModel = getColumnModel();
|
|
||||||
colModel.add(new TableColumn(
|
|
||||||
0,
|
|
||||||
PublicationGlobalizationUtil.globalize(
|
|
||||||
"publications.ui.publicationlists.title").localize(),
|
|
||||||
TABLE_COL_EDIT));
|
|
||||||
colModel.add(new TableColumn(
|
|
||||||
1,
|
|
||||||
PublicationGlobalizationUtil.globalize(
|
|
||||||
"publications.ui.publicationlists.remove").localize(),
|
|
||||||
TABLE_COL_DEL));
|
|
||||||
|
|
||||||
setModelBuilder(
|
|
||||||
new PublicationPublicationListsTableModelBuilder(itemModel));
|
|
||||||
|
|
||||||
colModel.get(0).setCellRenderer(new EditCellRenderer());
|
|
||||||
colModel.get(1).setCellRenderer(new DeleteCellRenderer());
|
|
||||||
|
|
||||||
s_log.info("Adding table action listener...");
|
|
||||||
addTableActionListener(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
private class PublicationPublicationListsTableModelBuilder
|
|
||||||
extends LockableImpl
|
|
||||||
implements TableModelBuilder {
|
|
||||||
|
|
||||||
private ItemSelectionModel m_itemModel;
|
|
||||||
|
|
||||||
public PublicationPublicationListsTableModelBuilder(
|
|
||||||
ItemSelectionModel itemModel) {
|
|
||||||
m_itemModel = itemModel;
|
|
||||||
}
|
|
||||||
|
|
||||||
public TableModel makeModel(Table table, PageState state) {
|
|
||||||
table.getRowSelectionModel().clearSelection(state);
|
|
||||||
Publication publication =
|
|
||||||
(Publication) m_itemModel.getSelectedObject(state);
|
|
||||||
return new PublicationPublicationListsTableModel(table,
|
|
||||||
state,
|
|
||||||
publication);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private class PublicationPublicationListsTableModel implements TableModel {
|
|
||||||
|
|
||||||
private Table m_table;
|
|
||||||
private PublicationListCollection m_listsCollection;
|
|
||||||
private PublicationList m_list;
|
|
||||||
|
|
||||||
public PublicationPublicationListsTableModel(Table table,
|
|
||||||
PageState state,
|
|
||||||
Publication publication) {
|
|
||||||
m_table = table;
|
|
||||||
m_listsCollection = publication.getPublicationLists();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getColumnCount() {
|
|
||||||
return m_table.getColumnModel().size();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean nextRow() {
|
|
||||||
boolean ret;
|
|
||||||
|
|
||||||
if ((m_listsCollection != null)
|
|
||||||
&& m_listsCollection.next()) {
|
|
||||||
m_list = m_listsCollection.getPublicationList();
|
|
||||||
ret = true;
|
|
||||||
} else {
|
|
||||||
ret = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Object getElementAt(int columnIndex) {
|
|
||||||
switch (columnIndex) {
|
|
||||||
case 0:
|
|
||||||
return m_list.getTitle();
|
|
||||||
case 1:
|
|
||||||
return PublicationGlobalizationUtil.globalize(
|
|
||||||
"publications.ui.publicationlists.remove").
|
|
||||||
localize();
|
|
||||||
default:
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Object getKeyAt(int columnIndex) {
|
|
||||||
return m_list.getID();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private class EditCellRenderer
|
|
||||||
extends LockableImpl
|
|
||||||
implements TableCellRenderer {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Component getComponent(Table table,
|
|
||||||
PageState state,
|
|
||||||
Object value,
|
|
||||||
boolean isSelected,
|
|
||||||
Object key,
|
|
||||||
int row,
|
|
||||||
int col) {
|
|
||||||
SecurityManager securityManager =
|
|
||||||
Utilities.getSecurityManager(state);
|
|
||||||
Publication publication = (Publication) m_itemModel.
|
|
||||||
getSelectedObject(state);
|
|
||||||
|
|
||||||
boolean canEdit = securityManager.canAccess(
|
|
||||||
state.getRequest(),
|
|
||||||
SecurityManager.EDIT_ITEM,
|
|
||||||
publication);
|
|
||||||
|
|
||||||
if (canEdit) {
|
|
||||||
ControlLink link = new ControlLink(value.toString());
|
|
||||||
return link;
|
|
||||||
} else {
|
|
||||||
Label label = new Label(value.toString());
|
|
||||||
return label;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private class DeleteCellRenderer
|
|
||||||
extends LockableImpl
|
|
||||||
implements TableCellRenderer {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Component getComponent(Table table,
|
|
||||||
PageState state,
|
|
||||||
Object value,
|
|
||||||
boolean isSelected,
|
|
||||||
Object key,
|
|
||||||
int row,
|
|
||||||
int col) {
|
|
||||||
|
|
||||||
SecurityManager securityManager =
|
|
||||||
Utilities.getSecurityManager(state);
|
|
||||||
Publication publication = (Publication) m_itemModel.
|
|
||||||
getSelectedObject(state);
|
|
||||||
|
|
||||||
boolean canDelete = securityManager.canAccess(
|
|
||||||
state.getRequest(),
|
|
||||||
SecurityManager.DELETE_ITEM,
|
|
||||||
publication);
|
|
||||||
|
|
||||||
if (canDelete) {
|
|
||||||
ControlLink link = new ControlLink(value.toString());
|
|
||||||
link.setConfirmation((String) PublicationGlobalizationUtil.
|
|
||||||
globalize(
|
|
||||||
"publications.ui.publicationlists.confirm_remove").
|
|
||||||
localize());
|
|
||||||
return link;
|
|
||||||
} else {
|
|
||||||
Label label = new Label(value.toString());
|
|
||||||
return label;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void cellSelected(TableActionEvent event) {
|
|
||||||
PageState state = event.getPageState();
|
|
||||||
|
|
||||||
s_log.info("cellSelected!");
|
|
||||||
|
|
||||||
PublicationList list =
|
|
||||||
new PublicationList(new BigDecimal(event.getRowKey().
|
|
||||||
toString()));
|
|
||||||
|
|
||||||
Publication publication = (Publication) m_itemModel.getSelectedObject(
|
|
||||||
state);
|
|
||||||
|
|
||||||
PublicationListCollection lists = publication.getPublicationLists();
|
|
||||||
|
|
||||||
TableColumn column = getColumnModel().get(event.getColumn().intValue());
|
|
||||||
|
|
||||||
if (column.getHeaderKey().toString().equals(TABLE_COL_EDIT)) {
|
|
||||||
|
|
||||||
} else if(column.getHeaderKey().toString().equals(TABLE_COL_DEL)) {
|
|
||||||
publication.removePublicationList(list);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void headSelected(TableActionEvent event) {
|
|
||||||
//Nothing to do here.
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,19 +0,0 @@
|
||||||
<!DOCTYPE stylesheet [
|
|
||||||
<!ENTITY nbsp " " ><!-- no-break space = non-breaking space, U+00A0 ISOnum -->
|
|
||||||
]>
|
|
||||||
|
|
||||||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
|
||||||
xmlns:cms="http://www.arsdigita.com/cms/1.0"
|
|
||||||
version="1.0">
|
|
||||||
|
|
||||||
<xsl:template match="cms:item[objectType='com.arsdigita.cms.contenttypes.PublicationList']" mode="cms:CT_graphics"
|
|
||||||
name="cms:CT_graphics_com_arsdigita_cms_contenttypes_PublicationList">
|
|
||||||
<p><xsl:value-of select="./name"/></p>
|
|
||||||
</xsl:template>
|
|
||||||
|
|
||||||
<xsl:template match="cms:item[objectType='com.arsdigita.cms.contenttypes.PublicationList']" mode="cms:CT_text"
|
|
||||||
name="cms:CT_text_com_arsdigita_cms_contenttypes_PublicationList">
|
|
||||||
<p><xsl:value-of select="./name"/></p>
|
|
||||||
</xsl:template>
|
|
||||||
|
|
||||||
</xsl:stylesheet>
|
|
||||||
Loading…
Reference in New Issue