Added an input field for the volume of series to the PublicationSeriesForm (Ticket #1558).
git-svn-id: https://svn.libreccm.org/ccm/trunk@2081 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
d9ee3f77a8
commit
c5b9f93351
|
|
@ -260,11 +260,11 @@ public class Publication extends ContentPage {
|
||||||
return getPublicationBundle().getSeries();
|
return getPublicationBundle().getSeries();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addSeries(final Series series) {
|
public void addSeries(final Series series, final Integer volumeOfSeries) {
|
||||||
//Assert.exists(series, Series.class);
|
//Assert.exists(series, Series.class);
|
||||||
|
|
||||||
//add(SERIES, series);
|
//add(SERIES, series);
|
||||||
getPublicationBundle().addSeries(series);
|
getPublicationBundle().addSeries(series, volumeOfSeries);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeSeries(final Series series) {
|
public void removeSeries(final Series series) {
|
||||||
|
|
|
||||||
|
|
@ -333,10 +333,11 @@ public class PublicationBundle extends ContentBundle {
|
||||||
return new SeriesCollection((DataCollection) get(SERIES));
|
return new SeriesCollection((DataCollection) get(SERIES));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addSeries(final Series series) {
|
public void addSeries(final Series series, final Integer volumeOfSeries) {
|
||||||
Assert.exists(series, Series.class);
|
Assert.exists(series, Series.class);
|
||||||
|
|
||||||
add(SERIES, series.getSeriesBundle());
|
final DataObject link = add(SERIES, series.getSeriesBundle());
|
||||||
|
link.set(SeriesBundle.VOLUME_OF_SERIES, volumeOfSeries);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeSeries(final Series series) {
|
public void removeSeries(final Series series) {
|
||||||
|
|
|
||||||
|
|
@ -23,17 +23,32 @@ import com.arsdigita.cms.ContentBundle;
|
||||||
import com.arsdigita.domain.DomainCollection;
|
import com.arsdigita.domain.DomainCollection;
|
||||||
import com.arsdigita.domain.DomainObjectFactory;
|
import com.arsdigita.domain.DomainObjectFactory;
|
||||||
import com.arsdigita.persistence.DataCollection;
|
import com.arsdigita.persistence.DataCollection;
|
||||||
|
import com.arsdigita.persistence.DataObject;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author Jens Pelzetter
|
* @author Jens Pelzetter
|
||||||
|
* @version $Id$
|
||||||
*/
|
*/
|
||||||
public class SeriesCollection extends DomainCollection {
|
public class SeriesCollection extends DomainCollection {
|
||||||
|
|
||||||
|
public static final String LINK_VOLUME_OF_SERIES = "link.volumeOfSeries";
|
||||||
|
public static final String VOLUME_OF_SERIES = "volumeOfSeries";
|
||||||
|
|
||||||
public SeriesCollection(DataCollection dataCollection) {
|
public SeriesCollection(DataCollection dataCollection) {
|
||||||
super(dataCollection);
|
super(dataCollection);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Integer getVolumeOfSeries() {
|
||||||
|
return (Integer) m_dataCollection.get(LINK_VOLUME_OF_SERIES);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVolumeOfSeries(Integer volumeOfSeries) {
|
||||||
|
DataObject link = (DataObject) this.get("link");
|
||||||
|
|
||||||
|
link.set(VOLUME_OF_SERIES, volumeOfSeries);
|
||||||
|
}
|
||||||
|
|
||||||
public Series getSeries() {
|
public Series getSeries() {
|
||||||
final ContentBundle bundle = (ContentBundle) DomainObjectFactory.
|
final ContentBundle bundle = (ContentBundle) DomainObjectFactory.
|
||||||
newInstance(m_dataCollection.getDataObject());
|
newInstance(m_dataCollection.getDataObject());
|
||||||
|
|
@ -47,4 +62,5 @@ public class SeriesCollection extends DomainCollection {
|
||||||
|
|
||||||
return (Series) bundle.getInstance(language);
|
return (Series) bundle.getInstance(language);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -414,3 +414,4 @@ organization.ui.publications.columns.type=Type
|
||||||
publications.ui.journal.symbol=Symbol of the journal
|
publications.ui.journal.symbol=Symbol of the journal
|
||||||
publications.ui.publication.first_published=First published
|
publications.ui.publication.first_published=First published
|
||||||
publications.ui.publication.language=Language of publication
|
publications.ui.publication.language=Language of publication
|
||||||
|
publications.ui.series.number=Volume of series
|
||||||
|
|
|
||||||
|
|
@ -413,3 +413,4 @@ organization.ui.publications.columns.type=Typ
|
||||||
publications.ui.journal.symbol=K\u00fcrzel der Zeitschrift
|
publications.ui.journal.symbol=K\u00fcrzel der Zeitschrift
|
||||||
publications.ui.publication.first_published=Erste Ver\u00f6ffentlichung
|
publications.ui.publication.first_published=Erste Ver\u00f6ffentlichung
|
||||||
publications.ui.publication.language=Sprache der Publikation
|
publications.ui.publication.language=Sprache der Publikation
|
||||||
|
publications.ui.series.number=Band der Reihe
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,9 @@ import com.arsdigita.bebop.PageState;
|
||||||
import com.arsdigita.bebop.event.FormInitListener;
|
import com.arsdigita.bebop.event.FormInitListener;
|
||||||
import com.arsdigita.bebop.event.FormProcessListener;
|
import com.arsdigita.bebop.event.FormProcessListener;
|
||||||
import com.arsdigita.bebop.event.FormSectionEvent;
|
import com.arsdigita.bebop.event.FormSectionEvent;
|
||||||
|
import com.arsdigita.bebop.form.TextField;
|
||||||
|
import com.arsdigita.bebop.parameters.IntegerParameter;
|
||||||
|
import com.arsdigita.bebop.parameters.ParameterModel;
|
||||||
import com.arsdigita.cms.ContentType;
|
import com.arsdigita.cms.ContentType;
|
||||||
import com.arsdigita.cms.Folder;
|
import com.arsdigita.cms.Folder;
|
||||||
import com.arsdigita.cms.ItemSelectionModel;
|
import com.arsdigita.cms.ItemSelectionModel;
|
||||||
|
|
@ -33,6 +36,7 @@ import com.arsdigita.cms.contenttypes.Publication;
|
||||||
import com.arsdigita.cms.contenttypes.PublicationsConfig;
|
import com.arsdigita.cms.contenttypes.PublicationsConfig;
|
||||||
import com.arsdigita.cms.contenttypes.Series;
|
import com.arsdigita.cms.contenttypes.Series;
|
||||||
import com.arsdigita.cms.contenttypes.SeriesCollection;
|
import com.arsdigita.cms.contenttypes.SeriesCollection;
|
||||||
|
import com.arsdigita.cms.contenttypes.VolumeInSeriesCollection;
|
||||||
import com.arsdigita.cms.ui.ItemSearchWidget;
|
import com.arsdigita.cms.ui.ItemSearchWidget;
|
||||||
import com.arsdigita.cms.ui.authoring.BasicItemForm;
|
import com.arsdigita.cms.ui.authoring.BasicItemForm;
|
||||||
import com.arsdigita.kernel.Kernel;
|
import com.arsdigita.kernel.Kernel;
|
||||||
|
|
@ -55,13 +59,13 @@ public class PublicationSeriesAddForm
|
||||||
private ItemSearchWidget m_itemSearch;
|
private ItemSearchWidget m_itemSearch;
|
||||||
private final String ITEM_SEARCH = "series";
|
private final String ITEM_SEARCH = "series";
|
||||||
private ItemSelectionModel m_itemModel;
|
private ItemSelectionModel m_itemModel;
|
||||||
private final static PublicationsConfig config = new PublicationsConfig();
|
private TextField volumeOfSeries;
|
||||||
|
private final static PublicationsConfig config = new PublicationsConfig();
|
||||||
|
|
||||||
static {
|
static {
|
||||||
config.load();
|
config.load();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public PublicationSeriesAddForm(ItemSelectionModel itemModel) {
|
public PublicationSeriesAddForm(ItemSelectionModel itemModel) {
|
||||||
super("SeriesEntryForm", itemModel);
|
super("SeriesEntryForm", itemModel);
|
||||||
m_itemModel = itemModel;
|
m_itemModel = itemModel;
|
||||||
|
|
@ -78,6 +82,13 @@ public class PublicationSeriesAddForm
|
||||||
m_itemSearch.setDefaultCreationFolder(new Folder(new BigDecimal(config.getDefaultSeriesFolder())));
|
m_itemSearch.setDefaultCreationFolder(new Folder(new BigDecimal(config.getDefaultSeriesFolder())));
|
||||||
}
|
}
|
||||||
add(m_itemSearch);
|
add(m_itemSearch);
|
||||||
|
|
||||||
|
add(new Label((String) PublicationGlobalizationUtil.globalize(
|
||||||
|
"publications.ui.series.volume_of_series").localize()));
|
||||||
|
ParameterModel volumeOfSeriesParam = new IntegerParameter(
|
||||||
|
VolumeInSeriesCollection.VOLUME_OF_SERIES);
|
||||||
|
volumeOfSeries = new TextField(volumeOfSeriesParam);
|
||||||
|
add(volumeOfSeries);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -101,7 +112,7 @@ public class PublicationSeriesAddForm
|
||||||
series = (Series) series.getContentBundle().getInstance(publication.
|
series = (Series) series.getContentBundle().getInstance(publication.
|
||||||
getLanguage());
|
getLanguage());
|
||||||
|
|
||||||
publication.addSeries(series);
|
publication.addSeries(series, (Integer) data.get(VolumeInSeriesCollection.VOLUME_OF_SERIES));
|
||||||
m_itemSearch.publishCreatedItem(data, series);
|
m_itemSearch.publishCreatedItem(data, series);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -142,4 +153,5 @@ public class PublicationSeriesAddForm
|
||||||
|
|
||||||
seriesColl.close();
|
seriesColl.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -44,6 +44,7 @@ import com.arsdigita.cms.dispatcher.Utilities;
|
||||||
import com.arsdigita.dispatcher.ObjectNotFoundException;
|
import com.arsdigita.dispatcher.ObjectNotFoundException;
|
||||||
import com.arsdigita.util.LockableImpl;
|
import com.arsdigita.util.LockableImpl;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Iterator;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -54,38 +55,40 @@ public class PublicationSeriesTable
|
||||||
extends Table
|
extends Table
|
||||||
implements TableActionListener {
|
implements TableActionListener {
|
||||||
|
|
||||||
private static final Logger s_log =
|
private static final Logger LOGGER = Logger.getLogger(PublicationSeriesTable.class);
|
||||||
Logger.getLogger(PublicationSeriesTable.class);
|
private final static String TABLE_COL_EDIT = "table_col_edit";
|
||||||
private final String TABLE_COL_EDIT = "table_col_edit";
|
private final static String TABLE_COL_NUMBER = "table_col_edit";
|
||||||
private final String TABLE_COL_DEL = "table_col_del";
|
private final static String TABLE_COL_DEL = "table_col_del";
|
||||||
private ItemSelectionModel m_itemModel;
|
private final ItemSelectionModel m_itemModel;
|
||||||
|
|
||||||
public PublicationSeriesTable(ItemSelectionModel itemModel) {
|
public PublicationSeriesTable(final ItemSelectionModel itemModel) {
|
||||||
super();
|
super();
|
||||||
m_itemModel = itemModel;
|
m_itemModel = itemModel;
|
||||||
|
|
||||||
setEmptyView(new Label(PublicationGlobalizationUtil.globalize(
|
setEmptyView(new Label(PublicationGlobalizationUtil.globalize("publications.ui.series.none")));
|
||||||
"publications.ui.series.none")));
|
|
||||||
|
|
||||||
TableColumnModel colModel = getColumnModel();
|
final TableColumnModel colModel = getColumnModel();
|
||||||
colModel.add(new TableColumn(
|
colModel.add(new TableColumn(
|
||||||
0,
|
0,
|
||||||
PublicationGlobalizationUtil.globalize(
|
PublicationGlobalizationUtil.globalize("publications.ui.series.title").localize(),
|
||||||
"publications.ui.series.title").localize(),
|
|
||||||
TABLE_COL_EDIT));
|
TABLE_COL_EDIT));
|
||||||
colModel.add(new TableColumn(
|
colModel.add(new TableColumn(
|
||||||
1,
|
1,
|
||||||
PublicationGlobalizationUtil.globalize(
|
PublicationGlobalizationUtil.globalize("publications.ui.series.number").localize(),
|
||||||
"publications.ui.series.remove").localize(),
|
TABLE_COL_NUMBER));
|
||||||
|
colModel.add(new TableColumn(
|
||||||
|
2,
|
||||||
|
PublicationGlobalizationUtil.globalize("publications.ui.series.remove").localize(),
|
||||||
TABLE_COL_DEL));
|
TABLE_COL_DEL));
|
||||||
|
|
||||||
setModelBuilder(
|
setModelBuilder(
|
||||||
new PublicationSeriesTableModelBuilder(itemModel));
|
new PublicationSeriesTableModelBuilder(itemModel));
|
||||||
|
|
||||||
colModel.get(0).setCellRenderer(new EditCellRenderer());
|
colModel.get(0).setCellRenderer(new EditCellRenderer());
|
||||||
colModel.get(1).setCellRenderer(new DeleteCellRenderer());
|
colModel.get(1).setCellRenderer(new NumberCellRenderer());
|
||||||
|
colModel.get(2).setCellRenderer(new DeleteCellRenderer());
|
||||||
|
|
||||||
s_log.info("Adding table action listener...");
|
LOGGER.info("Adding table action listener...");
|
||||||
addTableActionListener(this);
|
addTableActionListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -93,7 +96,7 @@ public class PublicationSeriesTable
|
||||||
extends LockableImpl
|
extends LockableImpl
|
||||||
implements TableModelBuilder {
|
implements TableModelBuilder {
|
||||||
|
|
||||||
private ItemSelectionModel m_itemModel;
|
private final ItemSelectionModel m_itemModel;
|
||||||
|
|
||||||
public PublicationSeriesTableModelBuilder(
|
public PublicationSeriesTableModelBuilder(
|
||||||
ItemSelectionModel itemModel) {
|
ItemSelectionModel itemModel) {
|
||||||
|
|
@ -107,6 +110,7 @@ public class PublicationSeriesTable
|
||||||
getSelectedObject(state);
|
getSelectedObject(state);
|
||||||
return new PublicationSeriesTableModel(table, state, publication);
|
return new PublicationSeriesTableModel(table, state, publication);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private class PublicationSeriesTableModel implements TableModel {
|
private class PublicationSeriesTableModel implements TableModel {
|
||||||
|
|
@ -148,6 +152,8 @@ public class PublicationSeriesTable
|
||||||
case 0:
|
case 0:
|
||||||
return m_series.getTitle();
|
return m_series.getTitle();
|
||||||
case 1:
|
case 1:
|
||||||
|
return m_series.getTitle();
|
||||||
|
case 2:
|
||||||
return PublicationGlobalizationUtil.globalize(
|
return PublicationGlobalizationUtil.globalize(
|
||||||
"publications.ui.series.remove").localize();
|
"publications.ui.series.remove").localize();
|
||||||
default:
|
default:
|
||||||
|
|
@ -159,6 +165,7 @@ public class PublicationSeriesTable
|
||||||
public Object getKeyAt(int columnIndex) {
|
public Object getKeyAt(int columnIndex) {
|
||||||
return m_series.getID();
|
return m_series.getID();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private class EditCellRenderer
|
private class EditCellRenderer
|
||||||
|
|
@ -188,9 +195,9 @@ public class PublicationSeriesTable
|
||||||
try {
|
try {
|
||||||
series = new Series((BigDecimal) key);
|
series = new Series((BigDecimal) key);
|
||||||
} catch (ObjectNotFoundException ex) {
|
} catch (ObjectNotFoundException ex) {
|
||||||
s_log.warn(String.format("No object with key '%s' found.",
|
LOGGER.warn(String.format("No object with key '%s' found.",
|
||||||
key),
|
key),
|
||||||
ex);
|
ex);
|
||||||
return new Label(value.toString());
|
return new Label(value.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -211,9 +218,9 @@ public class PublicationSeriesTable
|
||||||
try {
|
try {
|
||||||
series = new Series((BigDecimal) key);
|
series = new Series((BigDecimal) key);
|
||||||
} catch (ObjectNotFoundException ex) {
|
} catch (ObjectNotFoundException ex) {
|
||||||
s_log.warn(String.format("No object with key '%s' found.",
|
LOGGER.warn(String.format("No object with key '%s' found.",
|
||||||
key),
|
key),
|
||||||
ex);
|
ex);
|
||||||
return new Label(value.toString());
|
return new Label(value.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -225,6 +232,39 @@ public class PublicationSeriesTable
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class NumberCellRenderer 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 Publication publication = (Publication) m_itemModel.getSelectedObject(state);
|
||||||
|
|
||||||
|
final BigDecimal seriesId = (BigDecimal) key;
|
||||||
|
|
||||||
|
final SeriesCollection seriesCol = publication.getSeries();
|
||||||
|
|
||||||
|
Integer volumeOfSeries = null;
|
||||||
|
while(seriesCol.next()) {
|
||||||
|
if (seriesId.equals(seriesCol.getSeries().getID())) {
|
||||||
|
volumeOfSeries = seriesCol.getVolumeOfSeries();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
seriesCol.close();
|
||||||
|
|
||||||
|
if (volumeOfSeries == null) {
|
||||||
|
return new Label("");
|
||||||
|
} else {
|
||||||
|
return new Label(volumeOfSeries.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
private class DeleteCellRenderer
|
private class DeleteCellRenderer
|
||||||
extends LockableImpl
|
extends LockableImpl
|
||||||
implements TableCellRenderer {
|
implements TableCellRenderer {
|
||||||
|
|
@ -259,13 +299,14 @@ public class PublicationSeriesTable
|
||||||
return label;
|
return label;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void cellSelected(TableActionEvent event) {
|
public void cellSelected(TableActionEvent event) {
|
||||||
PageState state = event.getPageState();
|
PageState state = event.getPageState();
|
||||||
|
|
||||||
s_log.info("cellSelected!");
|
LOGGER.info("cellSelected!");
|
||||||
|
|
||||||
Series series =
|
Series series =
|
||||||
new Series(new BigDecimal(event.getRowKey().
|
new Series(new BigDecimal(event.getRowKey().
|
||||||
|
|
@ -288,4 +329,5 @@ public class PublicationSeriesTable
|
||||||
public void headSelected(TableActionEvent event) {
|
public void headSelected(TableActionEvent event) {
|
||||||
//Nothing to do here.
|
//Nothing to do here.
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue