diff --git a/ccm-sci-publications-dramaticarts/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/SciPublicationsMovie.xml b/ccm-sci-publications-dramaticarts/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/SciPublicationsMovie.xml
new file mode 100644
index 000000000..3e3a509cc
--- /dev/null
+++ b/ccm-sci-publications-dramaticarts/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/SciPublicationsMovie.xml
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ccm-sci-publications-dramaticarts/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/SciPublicationsPlay.xml b/ccm-sci-publications-dramaticarts/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/SciPublicationsPlay.xml
new file mode 100644
index 000000000..69c4ed9f6
--- /dev/null
+++ b/ccm-sci-publications-dramaticarts/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/SciPublicationsPlay.xml
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ccm-sci-publications-dramaticarts/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/SciPublicationsMovie.xml b/ccm-sci-publications-dramaticarts/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/SciPublicationsMovie.xml
new file mode 100644
index 000000000..04eef8a50
--- /dev/null
+++ b/ccm-sci-publications-dramaticarts/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/SciPublicationsMovie.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ccm-sci-publications-dramaticarts/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/SciPublicationsPlay.xml b/ccm-sci-publications-dramaticarts/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/SciPublicationsPlay.xml
new file mode 100644
index 000000000..64fd2a865
--- /dev/null
+++ b/ccm-sci-publications-dramaticarts/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/SciPublicationsPlay.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ccm-sci-publications-dramaticarts/src/ccm-sci-publications-dramaticarts.load b/ccm-sci-publications-dramaticarts/src/ccm-sci-publications-dramaticarts.load
index 110caa9df..9283b95a5 100644
--- a/ccm-sci-publications-dramaticarts/src/ccm-sci-publications-dramaticarts.load
+++ b/ccm-sci-publications-dramaticarts/src/ccm-sci-publications-dramaticarts.load
@@ -11,8 +11,8 @@
-
-
+
+
diff --git a/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/SciPublicationsMovie.java b/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/SciPublicationsMovie.java
index eab9c90dd..bd9116cdf 100644
--- a/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/SciPublicationsMovie.java
+++ b/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/SciPublicationsMovie.java
@@ -61,49 +61,99 @@ public class SciPublicationsMovie extends Publication {
return (SciPublicationsMovieBundle) getContentBundle();
}
- public SciPublicationsDirectorCollection getDirectors() {
- return getSciPublicationsMovieBundle().getDirectors();
+ public GenericPerson getDirector() {
+ final GenericPersonBundle bundle = getSciPublicationsMovieBundle().getDirector();
+ if (bundle == null) {
+ return null;
+ } else {
+ return (GenericPerson) bundle.getPrimaryInstance();
+ }
}
- public void addDirector(final GenericPerson director) {
+ public GenericPerson getDirector(final String language) {
+ final GenericPersonBundle bundle = getSciPublicationsMovieBundle().getDirector();
+ if (bundle == null) {
+ return null;
+ } else {
+ return (GenericPerson) bundle.getInstance(language);
+ }
+ }
+
+ public void setDirector(final GenericPerson director) {
getSciPublicationsMovieBundle().addDirector(director);
}
- public void removeDirector(final GenericPerson director) {
+ public GenericOrganizationalUnit getProductionCompany() {
+ final GenericOrganizationalUnitBundle bundle = getSciPublicationsMovieBundle()
+ .getProductionCompany();
+
+ if (bundle == null) {
+ return null;
+ } else {
+ return (GenericOrganizationalUnit) bundle.getPrimaryInstance();
+ }
+
+ }
+
+ public GenericOrganizationalUnit getProductionCompany(final String language) {
+ final GenericOrganizationalUnitBundle bundle = getSciPublicationsMovieBundle()
+ .getProductionCompany();
+
+ if (bundle == null) {
+ return null;
+ } else {
+ return (GenericOrganizationalUnit) bundle.getInstance(language);
+ }
+
+ }
+
+ public void setProductionCompany(final GenericOrganizationalUnit company) {
+ getSciPublicationsMovieBundle().setProductionCompany(company);
+ }
+
+ private SciPublicationsDirectorCollection getDirectors() {
+ return getSciPublicationsMovieBundle().getDirectors();
+ }
+
+ private void addDirector(final GenericPerson director) {
+ getSciPublicationsMovieBundle().addDirector(director);
+ }
+
+ private void removeDirector(final GenericPerson director) {
getSciPublicationsMovieBundle().removeDirector(director);
}
- public void swapWithPreviousDirector(final GenericPerson director) {
+ private void swapWithPreviousDirector(final GenericPerson director) {
getDirectors().swapWithPrevious(director);
getSciPublicationsMovieBundle().updateDirectorsStr();
}
- public void swapWithNextDirector(final GenericPerson director) {
+ private void swapWithNextDirector(final GenericPerson director) {
getDirectors().swapWithNext(director);
getSciPublicationsMovieBundle().updateDirectorsStr();
}
- public boolean hasDirectors() {
+ private boolean hasDirectors() {
return !getDirectors().isEmpty();
}
- public SciPublicationsProductionCompanyCollection getProductionCompanies() {
+ private SciPublicationsProductionCompanyCollection getProductionCompanies() {
return getSciPublicationsMovieBundle().getProductionCompanies();
}
- public void addProductionCompany(final GenericOrganizationalUnit company) {
+ private void addProductionCompany(final GenericOrganizationalUnit company) {
getSciPublicationsMovieBundle().addProducationCompany(company);
}
- public void removeProductionCompany(final GenericOrganizationalUnit company) {
+ private void removeProductionCompany(final GenericOrganizationalUnit company) {
getSciPublicationsMovieBundle().removeProductionCompany(company);
}
- public boolean hasProductionCompanies() {
+ private boolean hasProductionCompanies() {
return !getProductionCompanies().isEmpty();
}
diff --git a/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/SciPublicationsMovieBundle.java b/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/SciPublicationsMovieBundle.java
index 38eca49c4..22723f08a 100644
--- a/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/SciPublicationsMovieBundle.java
+++ b/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/SciPublicationsMovieBundle.java
@@ -196,21 +196,21 @@ public class SciPublicationsMovieBundle extends PublicationBundle {
private void createDirectorMovieAssociation(final DataCollection movies,
final GenericPersonBundle director) {
-
+
final PublicationBundle draftMovie = (PublicationBundle) DomainObjectFactory.newInstance(
movies.getDataObject());
final PublicationBundle liveMovie = (PublicationBundle) draftMovie.getLiveVersion();
-
+
if (liveMovie != null) {
final DataObject link = director.add("directedMovie", liveMovie);
link.set("directorOrder", movies.get("link.directorOrder"));
link.save();
-
+
XMLDeliveryCache.getInstance().removeFromCache(liveMovie.getOID());
}
-
+
}
-
+
private void createCompanyMovieAssociation(final DataCollection movies,
final GenericOrganizationalUnitBundle company) {
@@ -224,39 +224,72 @@ public class SciPublicationsMovieBundle extends PublicationBundle {
final DataObject link = company.add("producedMovie", liveMovie);
link.set("companyOrder", movies.get("link.companyOrder"));
link.save();
-
+
XMLDeliveryCache.getInstance().removeFromCache(liveMovie.getOID());
}
}
- public SciPublicationsDirectorCollection getDirectors() {
+ public GenericPersonBundle getDirector() {
+ final DataCollection collection = (DataCollection) get(DIRECTOR);
+
+ if (collection.size() == 0) {
+ return null;
+ } else {
+ final DataObject dataObject;
+
+ collection.next();
+ dataObject = collection.getDataObject();
+ collection.close();
+
+ return (GenericPersonBundle) DomainObjectFactory.newInstance(dataObject);
+ }
+ }
+
+ public void setDirector(final GenericPerson director) {
+ final GenericPersonBundle oldDirector = getDirector();
+
+ if (oldDirector != null) {
+ remove(DIRECTOR, oldDirector);
+ }
+
+ if (director != null) {
+ Assert.exists(director, GenericPerson.class);
+
+ final DataObject link = add(DIRECTOR,
+ director.getGenericPersonBundle());
+ link.set(DIRECTOR_ORDER, Integer.valueOf(1));
+ link.save();
+ }
+ }
+
+ protected SciPublicationsDirectorCollection getDirectors() {
return new SciPublicationsDirectorCollection((DataCollection) get(DIRECTOR));
}
-
- public void addDirector(final GenericPerson director) {
+
+ protected void addDirector(final GenericPerson director) {
Assert.exists(director, GenericPerson.class);
-
+
final DataObject link = add(DIRECTOR, director.getGenericPersonBundle());
-
+
link.set(DIRECTOR_ORDER, Integer.valueOf((int) getDirectors().size()));
-
+
updateDirectorsStr();
}
-
- public void removeDirector(final GenericPerson director) {
+
+ protected void removeDirector(final GenericPerson director) {
Assert.exists(director, GenericPerson.class);
-
+
remove(DIRECTOR, director.getContentBundle());
-
+
updateDirectorsStr();
}
-
+
protected void updateDirectorsStr() {
-
+
final SciPublicationsDirectorCollection directors = getDirectors();
final StringBuilder builder = new StringBuilder();
- while(directors.next()) {
+ while (directors.next()) {
if (builder.length() > 0) {
builder.append("; ");
}
@@ -264,78 +297,113 @@ public class SciPublicationsMovieBundle extends PublicationBundle {
builder.append(", ");
builder.append(directors.getGivenName());
}
-
+
final String directorStr = builder.toString();
-
+
final ItemCollection instances = getInstances();
-
+
SciPublicationsMovie movie;
- while(instances.next()) {
+ while (instances.next()) {
movie = (SciPublicationsMovie) instances.getDomainObject();
movie.set(SciPublicationsMovie.DIRECTORS_STR, directorStr);
}
+ }
+
+ public GenericOrganizationalUnitBundle getProductionCompany() {
+ final DataCollection collection = (DataCollection) get(PRODUCATION_COMPANY);
+ if (collection.size() == 0) {
+ return null;
+ } else {
+ final DataObject dataObject;
+
+ collection.next();
+ dataObject = collection.getDataObject();
+ collection.close();
+
+ return (GenericOrganizationalUnitBundle) DomainObjectFactory.newInstance(dataObject);
+ }
}
- public SciPublicationsProductionCompanyCollection getProductionCompanies() {
+ public void setProductionCompany(final GenericOrganizationalUnit productionCompany) {
+ final GenericOrganizationalUnitBundle oldCompany = getProductionCompany();
- return new SciPublicationsProductionCompanyCollection((DataCollection) get(PRODUCATION_COMPANY));
+ if (oldCompany != null) {
+ remove(PRODUCATION_COMPANY, oldCompany);
+ }
+ if (productionCompany != null) {
+ Assert.exists(productionCompany, GenericOrganizationalUnit.class);
+
+ final DataObject link = add(PRODUCATION_COMPANY,
+ productionCompany.getGenericOrganizationalUnitBundle());
+ link.set(PRODUCATION_COMPANY_ORDER, Integer.valueOf(1));
+ link.save();
+ }
}
- public void addProducationCompany(final GenericOrganizationalUnit company) {
-
+ protected SciPublicationsProductionCompanyCollection getProductionCompanies() {
+
+ return new SciPublicationsProductionCompanyCollection((DataCollection) get(
+ PRODUCATION_COMPANY));
+
+ }
+
+ protected void addProducationCompany(final GenericOrganizationalUnit company) {
+
Assert.exists(company, GenericOrganizationalUnit.class);
-
- final DataObject link = add(PRODUCATION_COMPANY,
+
+ final DataObject link = add(PRODUCATION_COMPANY,
company.getGenericOrganizationalUnitBundle());
link.set(PRODUCATION_COMPANY, Integer.valueOf((int) getProductionCompanies().size()));
link.save();
-
+
}
-
- public void removeProductionCompany(final GenericOrganizationalUnit company) {
-
+
+ protected void removeProductionCompany(final GenericOrganizationalUnit company) {
+
Assert.exists(company, GenericOrganizationalUnit.class);
-
+
remove(PRODUCATION_COMPANY, company.getGenericOrganizationalUnitBundle());
-
+
}
-
+
public static PublicationBundleCollection getDirectedMovies(final GenericPerson director) {
-
+
final GenericPersonBundle directorBundle = director.getGenericPersonBundle();
-
+
final DataCollection collection = (DataCollection) directorBundle.get("directedMovie");
-
+
return new PublicationBundleCollection(collection);
-
+
}
-
+
public static PublicationBundleCollection getProducedMovies(
final GenericOrganizationalUnit company) {
-
- final GenericOrganizationalUnitBundle companyBundle = company.getGenericOrganizationalUnitBundle();
-
+
+ final GenericOrganizationalUnitBundle companyBundle = company
+ .getGenericOrganizationalUnitBundle();
+
final DataCollection collection = (DataCollection) companyBundle.get("producedMovie");
-
+
return new PublicationBundleCollection(collection);
-
+
}
-
+
public SciPublicationsMovie getMovie() {
return (SciPublicationsMovie) getPrimaryInstance();
}
-
+
public SciPublicationsMovie getMovie(final String language) {
-
+
SciPublicationsMovie result = (SciPublicationsMovie) getInstance(language);
if (result == null) {
result = getMovie();
}
-
+
return result;
-
+
}
+
}
diff --git a/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/SciPublicationsMovieInitializer.java b/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/SciPublicationsMovieInitializer.java
index 8ffafa6d1..22c0c297d 100644
--- a/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/SciPublicationsMovieInitializer.java
+++ b/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/SciPublicationsMovieInitializer.java
@@ -28,7 +28,8 @@ package com.arsdigita.cms.contenttypes;
public class SciPublicationsMovieInitializer extends ContentTypeInitializer {
public SciPublicationsMovieInitializer() {
- super("empty.pdl.mf", SciPublicationsMovie.BASE_DATA_OBJECT_TYPE);
+ super("ccm-sci-publications-dramaticarts.pdl.mf",
+ SciPublicationsMovie.BASE_DATA_OBJECT_TYPE);
}
@Override
diff --git a/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/SciPublicationsPlay.java b/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/SciPublicationsPlay.java
index 023c2732b..9469fe74b 100644
--- a/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/SciPublicationsPlay.java
+++ b/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/SciPublicationsPlay.java
@@ -32,60 +32,88 @@ import java.util.List;
* @version $Id$
*/
public class SciPublicationsPlay extends PublicationWithPublisher {
-
+
public static final String BASE_DATA_OBJECT_TYPE
= "com.arsdigita.cms.contenttypes.SciPublicationsPlay";
public static final String FIRST_PRODUCTION_YEAR = "firstProductionYear";
-
+
public SciPublicationsPlay() {
super(BASE_DATA_OBJECT_TYPE);
}
-
+
public SciPublicationsPlay(final BigDecimal id) {
this(new OID(BASE_DATA_OBJECT_TYPE, id));
}
-
+
public SciPublicationsPlay(final OID oid) {
super(oid);
}
-
+
public SciPublicationsPlay(final DataObject obj) {
super(obj);
}
-
+
public SciPublicationsPlay(final String type) {
super(type);
}
-
+
public SciPublicationsPlayBundle getSciPublicationsPlayBundle() {
return (SciPublicationsPlayBundle) getContentBundle();
}
-
+
public Integer getFirstProductionYear() {
return (Integer) get(FIRST_PRODUCTION_YEAR);
}
-
+
public void setFirstProductionYear(final Integer year) {
set(FIRST_PRODUCTION_YEAR, year);
}
+
+ public GenericOrganizationalUnit getProductionTheater() {
+ final GenericOrganizationalUnitBundle bundle = getSciPublicationsPlayBundle()
+ .getProductionTheater();
+
+ if (bundle == null) {
+ return null;
+ } else {
+ return (GenericOrganizationalUnit) bundle.getPrimaryInstance();
+ }
+
+ }
- public DomainCollection getProductionTheateres() {
+ public GenericOrganizationalUnit getProductionTheater(final String language) {
+ final GenericOrganizationalUnitBundle bundle = getSciPublicationsPlayBundle()
+ .getProductionTheater();
+
+ if (bundle == null) {
+ return null;
+ } else {
+ return (GenericOrganizationalUnit) bundle.getInstance(language);
+ }
+
+ }
+
+ public void setProductionTheater(final GenericOrganizationalUnit theater) {
+ getSciPublicationsPlayBundle().setProductionTheater(theater);
+ }
+
+ private DomainCollection getProductionTheateres() {
return getSciPublicationsPlayBundle().getProductionTheateres();
}
-
- public void addProductionTheater(final GenericOrganizationalUnit theater) {
+
+ private void addProductionTheater(final GenericOrganizationalUnit theater) {
getSciPublicationsPlayBundle().addProducationTheater(theater);
}
-
- public void removeProductionTheater(final GenericOrganizationalUnit theater) {
+
+ private void removeProductionTheater(final GenericOrganizationalUnit theater) {
getSciPublicationsPlayBundle().removeProductionTheater(theater);
}
-
- public boolean hasProductionTheaters() {
+
+ private boolean hasProductionTheaters() {
return !getProductionTheateres().isEmpty();
}
-
- @Override
+
+ @Override
public List getExtraXMLGenerators() {
final List generators = super.getExtraXMLGenerators();
generators.add(new SciPublicationsPlayExtraXMLGenerator());
@@ -98,4 +126,5 @@ public class SciPublicationsPlay extends PublicationWithPublisher {
generators.add(new SciPublicationsPlayExtraXMLGenerator());
return generators;
}
+
}
diff --git a/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/SciPublicationsPlayBundle.java b/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/SciPublicationsPlayBundle.java
index 1a6d68ca8..ba6588e5b 100644
--- a/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/SciPublicationsPlayBundle.java
+++ b/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/SciPublicationsPlayBundle.java
@@ -172,13 +172,47 @@ public class SciPublicationsPlayBundle extends PublicationWithPublisherBundle {
}
- public DomainCollection getProductionTheateres() {
+ public GenericOrganizationalUnitBundle getProductionTheater() {
+ final DataCollection collection = (DataCollection) get(PRODUCTION_THEATER);
+
+ if (collection.size() == 0) {
+ return null;
+ } else {
+ final DataObject dataObject;
+
+ collection.next();
+ dataObject = collection.getDataObject();
+ collection.close();
+
+ return (GenericOrganizationalUnitBundle) DomainObjectFactory.newInstance(dataObject);
+ }
+
+ }
+
+ public void setProductionTheater(final GenericOrganizationalUnit theater) {
+ final GenericOrganizationalUnitBundle oldTheater = getProductionTheater();
+
+ if (oldTheater != null) {
+ remove(PRODUCTION_THEATER, oldTheater);
+ }
+
+ if (theater != null) {
+ Assert.exists(theater, GenericOrganizationalUnit.class);
+
+ final DataObject link = add(PRODUCTION_THEATER,
+ theater.getGenericOrganizationalUnitBundle());
+ link.set(PRODUCTION_THEATER_ORDER, Integer.valueOf(1));
+ link.save();
+ }
+ }
+
+ protected DomainCollection getProductionTheateres() {
return new DomainCollection((DataCollection) get(PRODUCTION_THEATER));
}
- public void addProducationTheater(final GenericOrganizationalUnit theater) {
+ protected void addProducationTheater(final GenericOrganizationalUnit theater) {
Assert.exists(theater, GenericOrganizationalUnit.class);
@@ -188,7 +222,7 @@ public class SciPublicationsPlayBundle extends PublicationWithPublisherBundle {
link.save();
}
- public void removeProductionTheater(final GenericOrganizationalUnit theater) {
+ protected void removeProductionTheater(final GenericOrganizationalUnit theater) {
Assert.exists(theater, GenericOrganizationalUnit.class);
diff --git a/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/ui/SciPublicationsMovieDirectorForm.java b/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/ui/SciPublicationsMovieDirectorForm.java
new file mode 100644
index 000000000..cbf054052
--- /dev/null
+++ b/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/ui/SciPublicationsMovieDirectorForm.java
@@ -0,0 +1,102 @@
+/*
+ * Copyright (c) 2014 Jens Pelzetter
+ *
+ * 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.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.GenericPerson;
+import com.arsdigita.cms.contenttypes.SciPublicationsDramaticArtsGlobalisationUtil;
+import com.arsdigita.cms.contenttypes.SciPublicationsMovie;
+import com.arsdigita.cms.ui.ItemSearchWidget;
+import com.arsdigita.cms.ui.authoring.BasicItemForm;
+
+/**
+ *
+ * @author Jens Pelzetter
+ * @version $Id$
+ */
+public class SciPublicationsMovieDirectorForm extends BasicItemForm implements FormInitListener,
+ FormProcessListener {
+
+ private ItemSearchWidget itemSearch;
+ private final String ITEM_SEARCH = "setDirector";
+
+ public SciPublicationsMovieDirectorForm(final ItemSelectionModel itemModel) {
+ super("SciPublicationsMovieSetDirector", itemModel);
+ }
+
+ @Override
+ public void addWidgets() {
+ final SciPublicationsDramaticArtsGlobalisationUtil globalisationUtil
+ = new SciPublicationsDramaticArtsGlobalisationUtil();
+ add(new Label(globalisationUtil.globalise("publications.dramaticarts.ui.movie.director")));
+ itemSearch = new ItemSearchWidget(
+ ITEM_SEARCH, ContentType.findByAssociatedObjectType(
+ GenericPerson.BASE_DATA_OBJECT_TYPE));
+ itemSearch.setEditAfterCreate(false);
+ add(itemSearch);
+ }
+
+ @Override
+ public void init(final FormSectionEvent event) throws FormProcessException {
+ final PageState state = event.getPageState();
+
+ setVisible(state, true);
+ }
+
+ @Override
+ public void process(final FormSectionEvent event) throws FormProcessException {
+ final FormData data = event.getFormData();
+ final PageState state = event.getPageState();
+
+ final SciPublicationsMovie movie = (SciPublicationsMovie) getItemSelectionModel()
+ .getSelectedObject(state);
+
+ if (getSaveCancelSection().getSaveButton().isSelected(state)) {
+ final GenericPerson director = (GenericPerson) data.get(ITEM_SEARCH);
+ movie.setDirector(director);
+ itemSearch.publishCreatedItem(data, director);
+ }
+
+ init(event);
+ }
+
+ @Override
+ public void validate(final FormSectionEvent event) throws FormProcessException {
+ //final PageState state = event.getPageState();
+ final FormData data = event.getFormData();
+ final SciPublicationsDramaticArtsGlobalisationUtil globalisationUtil
+ = new SciPublicationsDramaticArtsGlobalisationUtil();
+
+ if (data.get(ITEM_SEARCH) == null) {
+ data.addError(globalisationUtil.globalise(
+ "publications.dramaticarts.ui.movie.director.no_director_selected"));
+ }
+
+
+ }
+
+}
diff --git a/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/ui/SciPublicationsMovieDirectorSheet.java b/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/ui/SciPublicationsMovieDirectorSheet.java
new file mode 100644
index 000000000..81005bbe0
--- /dev/null
+++ b/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/ui/SciPublicationsMovieDirectorSheet.java
@@ -0,0 +1,268 @@
+/*
+ * Copyright (c) 2014 Jens Pelzetter
+ *
+ * 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.ui;
+
+import com.arsdigita.bebop.Component;
+import com.arsdigita.bebop.ControlLink;
+import com.arsdigita.bebop.Label;
+import com.arsdigita.bebop.Link;
+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.CMS;
+import com.arsdigita.cms.ContentSection;
+import com.arsdigita.cms.ItemSelectionModel;
+import com.arsdigita.cms.contenttypes.GenericPerson;
+import com.arsdigita.cms.contenttypes.SciPublicationsDramaticArtsGlobalisationUtil;
+import com.arsdigita.cms.contenttypes.SciPublicationsMovie;
+import com.arsdigita.cms.dispatcher.ItemResolver;
+import com.arsdigita.domain.DataObjectNotFoundException;
+import com.arsdigita.util.LockableImpl;
+import java.math.BigDecimal;
+
+/**
+ *
+ * @author Jens Pelzetter
+ * @version $Id$
+ */
+public class SciPublicationsMovieDirectorSheet
+ extends Table
+ implements TableActionListener {
+
+ private final String TABLE_COL_EDIT = "table_col_edit";
+ private final String TABLE_COL_DEL = "table_col_del";
+ private final SciPublicationsDramaticArtsGlobalisationUtil globalisationUtil
+ = new SciPublicationsDramaticArtsGlobalisationUtil();
+ private ItemSelectionModel itemModel;
+
+ public SciPublicationsMovieDirectorSheet(final ItemSelectionModel itemModel) {
+ super();
+
+ this.itemModel = itemModel;
+
+ setEmptyView(new Label(globalisationUtil.globalise(
+ "publications.dramaticarts.ui.movie.director.none")));
+
+ final TableColumnModel columnModel = getColumnModel();
+ columnModel.add(new TableColumn(
+ 0,
+ globalisationUtil.globalise("publications.dramaticarts.ui.movie.director"),
+ TABLE_COL_EDIT));
+ columnModel.add(new TableColumn(
+ 1,
+ globalisationUtil.globalise("publications.dramaticarts.ui.movie.director.remove"),
+ TABLE_COL_DEL));
+
+ setModelBuilder(new ModelBuilder(itemModel));
+ columnModel.get(0).setCellRenderer(new EditCellRenderer());
+ columnModel.get(1).setCellRenderer(new DeleteCellRenderer());
+
+ addTableActionListener(this);
+ }
+
+ private class ModelBuilder
+ extends LockableImpl
+ implements TableModelBuilder {
+
+ private ItemSelectionModel itemModel;
+
+ public ModelBuilder(final ItemSelectionModel itemModel) {
+ this.itemModel = itemModel;
+ }
+
+ @Override
+ public TableModel makeModel(final Table table, final PageState state) {
+ table.getRowSelectionModel().clearSelection(state);
+
+ final SciPublicationsMovie movie = (SciPublicationsMovie) itemModel.getSelectedObject(
+ state);
+ return new SheetModel(table, state, movie);
+ }
+
+ }
+
+ private class SheetModel implements TableModel {
+
+ private Table table;
+ private GenericPerson director;
+ private boolean done;
+
+ public SheetModel(final Table table,
+ final PageState state,
+ final SciPublicationsMovie movie) {
+ this.table = table;
+ director = movie.getDirector();
+ if (director == null) {
+ done = false;
+ } else {
+ done = true;
+ }
+
+ }
+
+ @Override
+ public int getColumnCount() {
+ return table.getColumnModel().size();
+ }
+
+ @Override
+ public boolean nextRow() {
+ boolean ret;
+
+ if (done) {
+ ret = true;
+ done = false;
+ } else {
+ ret = false;
+ }
+
+ return ret;
+ }
+
+ @Override
+ public Object getElementAt(final int columnIndex) {
+ switch (columnIndex) {
+ case 0:
+ return director.getFullName();
+ case 1:
+ return globalisationUtil.globalise(
+ "publications.dramaticarts.ui.movie.director.remove");
+ default:
+ return null;
+ }
+ }
+
+ @Override
+ public Object getKeyAt(final int columnIndex) {
+ return director.getID();
+ }
+
+ }
+
+ private class EditCellRenderer extends LockableImpl implements TableCellRenderer {
+
+ public EditCellRenderer() {
+ super();
+ }
+
+ @Override
+ 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 SciPublicationsMovie movie = (SciPublicationsMovie) itemModel.getSelectedObject(
+ state);
+
+ final boolean canEdit = securityManager.canAccess(state.getRequest(),
+ com.arsdigita.cms.SecurityManager.EDIT_ITEM,
+ movie);
+
+ if (canEdit) {
+ final GenericPerson director;
+ try {
+ director = new GenericPerson((BigDecimal) key);
+ } catch (DataObjectNotFoundException ex) {
+ return new Label(value.toString());
+ }
+
+ final ContentSection section = director.getContentSection();
+ final ItemResolver resolver = section.getItemResolver();
+ final Link link = new Link(value.toString(),
+ resolver.generateItemURL(state,
+ movie,
+ section,
+ director.getVersion()));
+
+ return link;
+ } else {
+ return new Label(value.toString());
+ }
+
+ }
+
+ }
+
+ private class DeleteCellRenderer extends LockableImpl implements TableCellRenderer {
+
+ public DeleteCellRenderer() {
+ super();
+ }
+
+ @Override
+ 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 SciPublicationsMovie movie = (SciPublicationsMovie) itemModel.getSelectedObject(
+ state);
+
+ final boolean canEdit = securityManager.canAccess(
+ state.getRequest(),
+ com.arsdigita.cms.SecurityManager.DELETE_ITEM,
+ movie);
+
+ if (canEdit) {
+ final ControlLink link = new ControlLink(value.toString());
+ link.setConfirmation(globalisationUtil.globalise(
+ "publications.dramaticarts.ui.movie.director.remove.confirm"));
+ return link;
+ } else {
+ return new Label(value.toString());
+ }
+ }
+
+ }
+
+ @Override
+ public void cellSelected(final TableActionEvent event) {
+ final PageState state = event.getPageState();
+
+ final SciPublicationsMovie movie = (SciPublicationsMovie) itemModel.getSelectedObject(state);
+
+ final TableColumn column = getColumnModel().get(event.getColumn().intValue());
+
+ if (TABLE_COL_EDIT.equals(column.getHeaderKey().toString())) {
+ //Nothing
+ } else if(TABLE_COL_DEL.equals(column.getHeaderKey().toString())){
+ movie.setDirector(null);
+ }
+ }
+
+ @Override
+ public void headSelected(final TableActionEvent event) {
+ //Nothing
+ }
+
+}
diff --git a/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/ui/SciPublicationsMovieDirectorStep.java b/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/ui/SciPublicationsMovieDirectorStep.java
new file mode 100644
index 000000000..2e15e6492
--- /dev/null
+++ b/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/ui/SciPublicationsMovieDirectorStep.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2014 Jens Pelzetter
+ *
+ * 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.ui;
+
+import com.arsdigita.cms.ItemSelectionModel;
+import com.arsdigita.cms.contenttypes.SciPublicationsDramaticArtsGlobalisationUtil;
+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
+ * @version $Id$
+ */
+public class SciPublicationsMovieDirectorStep extends SimpleEditStep {
+
+ private String SET_MOVIE_DIRECTOR_STEP = "setMovieDirectorStep";
+
+ public SciPublicationsMovieDirectorStep(final ItemSelectionModel itemModel,
+ final AuthoringKitWizard parent) {
+ this(itemModel, parent, null);
+ }
+
+ public SciPublicationsMovieDirectorStep(final ItemSelectionModel itemModel,
+ final AuthoringKitWizard parent,
+ final String prefix) {
+ super(itemModel, parent, prefix);
+
+ final SciPublicationsDramaticArtsGlobalisationUtil globalisationUtil
+ = new SciPublicationsDramaticArtsGlobalisationUtil();
+ final BasicItemForm setDirectorForm = new SciPublicationsMovieDirectorForm(itemModel);
+ add(SET_MOVIE_DIRECTOR_STEP,
+ globalisationUtil.globalise("publications.dramaticarts.movie.ui.director"),
+ new WorkflowLockedComponentAccess(setDirectorForm, itemModel),
+ setDirectorForm.getSaveCancelSection().getCancelButton());
+
+ final SciPublicationsMovieDirectorSheet sheet = new SciPublicationsMovieDirectorSheet(
+ itemModel);
+ setDisplayComponent(sheet);
+
+ }
+
+}
diff --git a/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/ui/SciPublicationsMovieProductionCompanyForm.java b/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/ui/SciPublicationsMovieProductionCompanyForm.java
new file mode 100644
index 000000000..ac6857598
--- /dev/null
+++ b/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/ui/SciPublicationsMovieProductionCompanyForm.java
@@ -0,0 +1,108 @@
+/*
+ * Copyright (c) 2014 Jens Pelzetter
+ *
+ * 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.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.GenericOrganizationalUnit;
+import com.arsdigita.cms.contenttypes.SciPublicationsDramaticArtsGlobalisationUtil;
+import com.arsdigita.cms.contenttypes.SciPublicationsMovie;
+import com.arsdigita.cms.ui.ItemSearchWidget;
+import com.arsdigita.cms.ui.authoring.BasicItemForm;
+
+/**
+ *
+ * @author Jens Pelzetter
+ * @version $Id$
+ */
+public class SciPublicationsMovieProductionCompanyForm
+ extends BasicItemForm
+ implements FormInitListener,
+ FormProcessListener {
+
+ private ItemSearchWidget itemSearch;
+ private final String ITEM_SEARCH = "setProductionCompany";
+
+
+ public SciPublicationsMovieProductionCompanyForm(final ItemSelectionModel itemModel) {
+ super("SciPublicationsMovieSetProductionCompany", itemModel);
+ }
+
+
+ @Override
+ public void addWidgets() {
+ final SciPublicationsDramaticArtsGlobalisationUtil globalisationUtil
+ = new SciPublicationsDramaticArtsGlobalisationUtil();
+ add(new Label(globalisationUtil.globalise(
+ "publications.dramaticarts.ui.movie.production_company")));
+ itemSearch = new ItemSearchWidget(
+ ITEM_SEARCH, ContentType.findByAssociatedObjectType(
+ GenericOrganizationalUnit.BASE_DATA_OBJECT_TYPE));
+ itemSearch.setEditAfterCreate(false);
+ add(itemSearch);
+ }
+
+ @Override
+ public void init(final FormSectionEvent event) throws FormProcessException {
+ final PageState state = event.getPageState();
+
+ setVisible(state, true);
+ }
+
+ @Override
+ public void process(final FormSectionEvent event) throws FormProcessException {
+ final FormData data = event.getFormData();
+ final PageState state = event.getPageState();
+
+ final SciPublicationsMovie movie = (SciPublicationsMovie) getItemSelectionModel()
+ .getSelectedObject(state);
+
+ if (getSaveCancelSection().getSaveButton().isSelected(state)) {
+ final GenericOrganizationalUnit productionCompany = (GenericOrganizationalUnit) data
+ .get(ITEM_SEARCH);
+ movie.setProductionCompany(productionCompany);
+ itemSearch.publishCreatedItem(data, productionCompany);
+ }
+
+ init(event);
+ }
+
+ @Override
+ public void validate(final FormSectionEvent event) throws FormProcessException {
+ //final PageState state = event.getPageState();
+ final FormData data = event.getFormData();
+ final SciPublicationsDramaticArtsGlobalisationUtil globalisationUtil
+ = new SciPublicationsDramaticArtsGlobalisationUtil();
+
+ if (data.get(ITEM_SEARCH) == null) {
+ data.addError(globalisationUtil.globalise(
+ "publications.dramaticarts.ui.movie.production_company.no_company_selected"));
+ }
+
+
+ }
+
+}
diff --git a/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/ui/SciPublicationsMovieProductionCompanySheet.java b/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/ui/SciPublicationsMovieProductionCompanySheet.java
new file mode 100644
index 000000000..8f9cd26f0
--- /dev/null
+++ b/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/ui/SciPublicationsMovieProductionCompanySheet.java
@@ -0,0 +1,267 @@
+/*
+ * Copyright (c) 2014 Jens Pelzetter
+ *
+ * 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.ui;
+
+import com.arsdigita.bebop.Component;
+import com.arsdigita.bebop.ControlLink;
+import com.arsdigita.bebop.Label;
+import com.arsdigita.bebop.Link;
+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.CMS;
+import com.arsdigita.cms.ContentSection;
+import com.arsdigita.cms.ItemSelectionModel;
+import com.arsdigita.cms.contenttypes.GenericOrganizationalUnit;
+import com.arsdigita.cms.contenttypes.SciPublicationsDramaticArtsGlobalisationUtil;
+import com.arsdigita.cms.contenttypes.SciPublicationsMovie;
+import com.arsdigita.cms.dispatcher.ItemResolver;
+import com.arsdigita.domain.DataObjectNotFoundException;
+import com.arsdigita.util.LockableImpl;
+import java.math.BigDecimal;
+
+/**
+ *
+ * @author Jens Pelzetter
+ * @version $Id$
+ */
+public class SciPublicationsMovieProductionCompanySheet
+ extends Table
+ implements TableActionListener {
+
+ private final String TABLE_COL_EDIT = "table_col_edit";
+ private final String TABLE_COL_DEL = "table_col_del";
+ private final SciPublicationsDramaticArtsGlobalisationUtil globalisationUtil
+ = new SciPublicationsDramaticArtsGlobalisationUtil();
+ private ItemSelectionModel itemModel;
+
+ public SciPublicationsMovieProductionCompanySheet(final ItemSelectionModel itemModel) {
+ super();
+
+ this.itemModel = itemModel;
+
+ setEmptyView(new Label(globalisationUtil.globalise(
+ "publications.dramaticarts.ui.movie.production_company.none")));
+
+ final TableColumnModel columnModel = getColumnModel();
+ columnModel.add(new TableColumn(
+ 0,
+ globalisationUtil.globalise("publications.dramaticarts.ui.movie.production_company"),
+ TABLE_COL_EDIT));
+ columnModel.add(new TableColumn(
+ 1,
+ globalisationUtil.globalise(
+ "publications.dramaticarts.ui.movie.production_company.remove"),
+ TABLE_COL_DEL));
+
+ setModelBuilder(new ModelBuilder(itemModel));
+ columnModel.get(0).setCellRenderer(new EditCellRenderer());
+ columnModel.get(1).setCellRenderer(new DeleteCellRenderer());
+
+ addTableActionListener(this);
+ }
+
+ private class ModelBuilder extends LockableImpl implements TableModelBuilder {
+
+ private ItemSelectionModel itemModel;
+
+ public ModelBuilder(final ItemSelectionModel itemModel) {
+ this.itemModel = itemModel;
+ }
+
+ @Override
+ public TableModel makeModel(final Table table, final PageState state) {
+ table.getRowSelectionModel().clearSelection(state);
+
+ final SciPublicationsMovie movie = (SciPublicationsMovie) itemModel.getSelectedObject(
+ state);
+ return new SheetModel(table, state, movie);
+ }
+
+ }
+
+ private class SheetModel implements TableModel {
+
+ private Table table;
+ private GenericOrganizationalUnit productionCompany;
+ private boolean done;
+
+ public SheetModel(final Table table,
+ final PageState state,
+ final SciPublicationsMovie movie) {
+ this.table = table;
+ productionCompany = movie.getProductionCompany();
+ if (productionCompany == null) {
+ done = false;
+ } else {
+ done = true;
+ }
+
+ }
+
+ @Override
+ public int getColumnCount() {
+ return table.getColumnModel().size();
+ }
+
+ @Override
+ public boolean nextRow() {
+ boolean ret;
+
+ if (done) {
+ ret = true;
+ done = false;
+ } else {
+ ret = false;
+ }
+
+ return ret;
+ }
+
+ @Override
+ public Object getElementAt(final int columnIndex) {
+ switch (columnIndex) {
+ case 0:
+ return productionCompany.getTitle();
+ case 1:
+ return globalisationUtil.globalise(
+ "publications.dramaticarts.ui.movie.production_company.remove");
+ default:
+ return null;
+ }
+ }
+
+ @Override
+ public Object getKeyAt(final int columnIndex) {
+ return productionCompany.getID();
+ }
+
+ }
+
+ private class EditCellRenderer extends LockableImpl implements TableCellRenderer {
+
+ public EditCellRenderer() {
+ super();
+ }
+
+ @Override
+ 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 SciPublicationsMovie movie = (SciPublicationsMovie) itemModel.getSelectedObject(
+ state);
+
+ final boolean canEdit = securityManager.canAccess(state.getRequest(),
+ com.arsdigita.cms.SecurityManager.EDIT_ITEM,
+ movie);
+
+ if (canEdit) {
+ final GenericOrganizationalUnit company;
+ try {
+ company = new GenericOrganizationalUnit((BigDecimal) key);
+ } catch (DataObjectNotFoundException ex) {
+ return new Label(value.toString());
+ }
+
+ final ContentSection section = company.getContentSection();
+ final ItemResolver resolver = section.getItemResolver();
+ final Link link = new Link(value.toString(),
+ resolver.generateItemURL(state,
+ company,
+ section,
+ company.getVersion()));
+
+ return link;
+ } else {
+ return new Label(value.toString());
+ }
+
+ }
+
+ }
+
+ private class DeleteCellRenderer extends LockableImpl implements TableCellRenderer {
+
+ public DeleteCellRenderer() {
+ super();
+ }
+
+ @Override
+ 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 SciPublicationsMovie movie = (SciPublicationsMovie) itemModel.getSelectedObject(
+ state);
+
+ final boolean canEdit = securityManager.canAccess(
+ state.getRequest(),
+ com.arsdigita.cms.SecurityManager.DELETE_ITEM,
+ movie);
+
+ if (canEdit) {
+ final ControlLink link = new ControlLink(value.toString());
+ link.setConfirmation(globalisationUtil.globalise(
+ "publications.dramaticarts.ui.movie.production_company.remove.confirm"));
+ return link;
+ } else {
+ return new Label(value.toString());
+ }
+ }
+
+ }
+
+ @Override
+ public void cellSelected(final TableActionEvent event) {
+ final PageState state = event.getPageState();
+
+ final SciPublicationsMovie movie = (SciPublicationsMovie) itemModel.getSelectedObject(state);
+
+ final TableColumn column = getColumnModel().get(event.getColumn().intValue());
+
+ if (TABLE_COL_EDIT.equals(column.getHeaderKey().toString())) {
+ //Nothing
+ } else if (TABLE_COL_DEL.equals(column.getHeaderKey().toString())) {
+ movie.setProductionCompany(null);
+ }
+ }
+
+ @Override
+ public void headSelected(final TableActionEvent event) {
+ //Nothing
+ }
+
+}
diff --git a/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/ui/SciPublicationsMovieProductionCompanyStep.java b/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/ui/SciPublicationsMovieProductionCompanyStep.java
new file mode 100644
index 000000000..555bc2b50
--- /dev/null
+++ b/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/ui/SciPublicationsMovieProductionCompanyStep.java
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2014 Jens Pelzetter
+ *
+ * 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.ui;
+
+import com.arsdigita.cms.ItemSelectionModel;
+import com.arsdigita.cms.contenttypes.SciPublicationsDramaticArtsGlobalisationUtil;
+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
+ * @version $Id$
+ */
+public class SciPublicationsMovieProductionCompanyStep extends SimpleEditStep {
+
+ private String SET_PRODUCTION_COMPANY_STEP = "setProductionCompanyStep";
+
+ public SciPublicationsMovieProductionCompanyStep(final ItemSelectionModel itemModel,
+ final AuthoringKitWizard parent) {
+ this(itemModel, parent, null);
+ }
+
+ public SciPublicationsMovieProductionCompanyStep(final ItemSelectionModel itemModel,
+ final AuthoringKitWizard parent,
+ final String prefix) {
+ super(itemModel, parent, prefix);
+
+ final SciPublicationsDramaticArtsGlobalisationUtil globalisationUtil
+ = new SciPublicationsDramaticArtsGlobalisationUtil();
+ final BasicItemForm setProductionCompanyForm
+ = new SciPublicationsMovieProductionCompanyForm(itemModel);
+ add(SET_PRODUCTION_COMPANY_STEP,
+ globalisationUtil.globalise("publications.ui.dramaticarts.movie.producationcompany"),
+ new WorkflowLockedComponentAccess(setProductionCompanyForm, itemModel),
+ setProductionCompanyForm.getSaveCancelSection().getCancelButton());
+
+ final SciPublicationsMovieProductionCompanySheet sheet
+ = new SciPublicationsMovieProductionCompanySheet(
+ itemModel);
+ setDisplayComponent(this);
+ }
+
+}
diff --git a/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/ui/SciPublicationsMoviePropertiesStep.java b/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/ui/SciPublicationsMoviePropertiesStep.java
index 316ee8d2b..684ca0649 100644
--- a/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/ui/SciPublicationsMoviePropertiesStep.java
+++ b/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/ui/SciPublicationsMoviePropertiesStep.java
@@ -70,8 +70,8 @@ public class SciPublicationsMoviePropertiesStep extends PublicationPropertiesSte
getSegmentedPanel().addSegment(
new Label(PublicationGlobalizationUtil.globalize(
- "publications.ui.publication.basic_properties"),
- basicProperties));
+ "publications.ui.publication.basic_properties")),
+ basicProperties);
}
@@ -84,7 +84,7 @@ public class SciPublicationsMoviePropertiesStep extends PublicationPropertiesSte
final SciPublicationsDramaticArtsGlobalisationUtil globalisationUtil = new SciPublicationsDramaticArtsGlobalisationUtil();
addStep(new SciPublicationsMovieDirectorStep(itemModel, parent),
globalisationUtil.globalise("publications.dramaticarts.ui.director"));
- addStep(new SciPublicationsMovieProducationCompanyStep(itemModel, parent),
+ addStep(new SciPublicationsMovieProductionCompanyStep(itemModel, parent),
globalisationUtil.globalise("publications.dramaticarts.ui.producationcompany"));
}
}
diff --git a/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/ui/SciPublicationsMoviePropertyForm.java b/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/ui/SciPublicationsMoviePropertyForm.java
new file mode 100644
index 000000000..08f69de62
--- /dev/null
+++ b/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/ui/SciPublicationsMoviePropertyForm.java
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2014 Jens Pelzetter
+ *
+ * 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.ui;
+
+import com.arsdigita.bebop.FormProcessException;
+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.cms.ItemSelectionModel;
+
+/**
+ *
+ * @author Jens Pelzetter
+ * @version $Id$
+ */
+public class SciPublicationsMoviePropertyForm
+ extends PublicationPropertyForm
+ implements FormProcessListener,
+ FormInitListener,
+ FormSubmissionListener {
+
+ private final SciPublicationsMoviePropertiesStep step;
+
+ public SciPublicationsMoviePropertyForm(final ItemSelectionModel itemModel) {
+ this(itemModel, null);
+ }
+
+ public SciPublicationsMoviePropertyForm(final ItemSelectionModel itemModel,
+ final SciPublicationsMoviePropertiesStep step) {
+ super(itemModel, step);
+ this.step = step;
+ addSubmissionListener(this);
+ }
+
+ @Override
+ protected void addWidgets() {
+ super.addWidgets();
+ }
+
+ @Override
+ public void init(final FormSectionEvent event) throws FormProcessException {
+ super.init(event);
+ }
+
+ @Override
+ public void process(final FormSectionEvent event) throws FormProcessException {
+ super.process(event);
+ }
+
+}
diff --git a/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/ui/SciPublicationsPlayProductionTheaterForm.java b/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/ui/SciPublicationsPlayProductionTheaterForm.java
new file mode 100644
index 000000000..752f75151
--- /dev/null
+++ b/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/ui/SciPublicationsPlayProductionTheaterForm.java
@@ -0,0 +1,107 @@
+/*
+ * Copyright (c) 2014 Jens Pelzetter
+ *
+ * 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.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.GenericOrganizationalUnit;
+import com.arsdigita.cms.contenttypes.GenericPerson;
+import com.arsdigita.cms.contenttypes.SciPublicationsDramaticArtsGlobalisationUtil;
+import com.arsdigita.cms.contenttypes.SciPublicationsMovie;
+import com.arsdigita.cms.contenttypes.SciPublicationsPlay;
+import com.arsdigita.cms.ui.ItemSearchWidget;
+import com.arsdigita.cms.ui.authoring.BasicItemForm;
+
+/**
+ *
+ * @author Jens Pelzetter
+ * @version $Id$
+ */
+public class SciPublicationsPlayProductionTheaterForm
+ extends BasicItemForm
+ implements FormInitListener,
+ FormProcessListener {
+
+ private ItemSearchWidget itemSearch;
+ private final String ITEM_SEARCH = "setProductionTheater";
+
+ public SciPublicationsPlayProductionTheaterForm(final ItemSelectionModel itemModel) {
+ super("SciPublicationsPlaySetProductionTheater", itemModel);
+ }
+
+ @Override
+ public void addWidgets() {
+ final SciPublicationsDramaticArtsGlobalisationUtil globalisationUtil
+ = new SciPublicationsDramaticArtsGlobalisationUtil();
+ add(new Label(globalisationUtil.globalise(
+ "publications.dramaticarts.ui.play.production_theater")));
+ itemSearch = new ItemSearchWidget(
+ ITEM_SEARCH, ContentType.findByAssociatedObjectType(
+ GenericOrganizationalUnit.BASE_DATA_OBJECT_TYPE));
+ itemSearch.setEditAfterCreate(false);
+ add(itemSearch);
+ }
+
+ @Override
+ public void init(final FormSectionEvent event) throws FormProcessException {
+ final PageState state = event.getPageState();
+
+ setVisible(state, true);
+ }
+
+ @Override
+ public void process(final FormSectionEvent event) throws FormProcessException {
+ final FormData data = event.getFormData();
+ final PageState state = event.getPageState();
+
+ final SciPublicationsPlay play = (SciPublicationsPlay) getItemSelectionModel()
+ .getSelectedObject(state);
+
+ if (getSaveCancelSection().getSaveButton().isSelected(state)) {
+ final GenericOrganizationalUnit theater = (GenericOrganizationalUnit) data.get(
+ ITEM_SEARCH);
+ play.setProductionTheater(theater);
+ itemSearch.publishCreatedItem(data, theater);
+ }
+
+ init(event);
+ }
+
+ @Override
+ public void validate(final FormSectionEvent event) throws FormProcessException {
+ //final PageState state = event.getPageState();
+ final FormData data = event.getFormData();
+ final SciPublicationsDramaticArtsGlobalisationUtil globalisationUtil
+ = new SciPublicationsDramaticArtsGlobalisationUtil();
+
+ if (data.get(ITEM_SEARCH) == null) {
+ data.addError(globalisationUtil.globalise(
+ "publications.dramaticarts.ui.play.production_theater.no_theater_selected"));
+ }
+
+
+ }
+}
diff --git a/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/ui/SciPublicationsPlayProductionTheaterSheet.java b/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/ui/SciPublicationsPlayProductionTheaterSheet.java
new file mode 100644
index 000000000..98c55050c
--- /dev/null
+++ b/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/ui/SciPublicationsPlayProductionTheaterSheet.java
@@ -0,0 +1,267 @@
+/*
+ * Copyright (c) 2014 Jens Pelzetter
+ *
+ * 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.ui;
+
+import com.arsdigita.bebop.Component;
+import com.arsdigita.bebop.ControlLink;
+import com.arsdigita.bebop.Label;
+import com.arsdigita.bebop.Link;
+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.CMS;
+import com.arsdigita.cms.ContentSection;
+import com.arsdigita.cms.ItemSelectionModel;
+import com.arsdigita.cms.contenttypes.GenericOrganizationalUnit;
+import com.arsdigita.cms.contenttypes.SciPublicationsDramaticArtsGlobalisationUtil;
+import com.arsdigita.cms.contenttypes.SciPublicationsPlay;
+import com.arsdigita.cms.dispatcher.ItemResolver;
+import com.arsdigita.domain.DataObjectNotFoundException;
+import com.arsdigita.util.LockableImpl;
+import java.math.BigDecimal;
+
+/**
+ *
+ * @author Jens Pelzetter
+ * @version $Id$
+ */
+public class SciPublicationsPlayProductionTheaterSheet
+ extends Table
+ implements TableActionListener {
+
+ private final String TABLE_COL_EDIT = "table_col_edit";
+ private final String TABLE_COL_DEL = "table_col_del";
+ private final SciPublicationsDramaticArtsGlobalisationUtil globalisationUtil
+ = new SciPublicationsDramaticArtsGlobalisationUtil();
+ private ItemSelectionModel itemModel;
+
+ public SciPublicationsPlayProductionTheaterSheet(final ItemSelectionModel itemModel) {
+ super();
+ this.itemModel = itemModel;
+
+ setEmptyView(new Label(globalisationUtil.globalise(
+ "publications.dramaticarts.ui.play.production_theater.none")));
+
+ final TableColumnModel columnModel = getColumnModel();
+ columnModel.add(new TableColumn(
+ 0,
+ globalisationUtil.globalise("publications.dramaticarts.ui.play.production_theater"),
+ TABLE_COL_EDIT));
+ columnModel.add(new TableColumn(
+ 1,
+ globalisationUtil.globalise(
+ "publications.dramaticarts.ui.play.production_theater.remove"),
+ TABLE_COL_DEL));
+
+ setModelBuilder(new ModelBuilder(itemModel));
+ columnModel.get(0).setCellRenderer(new EditCellRenderer());
+ columnModel.get(1).setCellRenderer(new DeleteCellRenderer());
+
+ addTableActionListener(this);
+
+ }
+
+ private class ModelBuilder extends LockableImpl implements TableModelBuilder {
+
+ private ItemSelectionModel itemModel;
+
+ public ModelBuilder(final ItemSelectionModel itemModel) {
+ this.itemModel = itemModel;
+ }
+
+ @Override
+ public TableModel makeModel(final Table table, final PageState state) {
+ table.getRowSelectionModel().clearSelection(state);
+
+ final SciPublicationsPlay play = (SciPublicationsPlay) itemModel.getSelectedObject(
+ state);
+ return new SheetModel(table, state, play);
+ }
+
+ }
+
+ private class SheetModel implements TableModel {
+
+ private Table table;
+ private GenericOrganizationalUnit productionTheater;
+ private boolean done;
+
+ public SheetModel(final Table table,
+ final PageState state,
+ final SciPublicationsPlay play) {
+ this.table = table;
+ productionTheater = play.getProductionTheater();
+ if (productionTheater == null) {
+ done = false;
+ } else {
+ done = true;
+ }
+ }
+
+ @Override
+ public int getColumnCount() {
+ return table.getColumnModel().size();
+ }
+
+ @Override
+ public boolean nextRow() {
+ boolean ret;
+
+ if (done) {
+ ret = true;
+ done = false;
+ } else {
+ ret = false;
+ }
+
+ return ret;
+ }
+
+ @Override
+ public Object getElementAt(final int columnIndex) {
+ switch (columnIndex) {
+ case 0:
+ return productionTheater.getTitle();
+ case 1:
+ return globalisationUtil.globalise(
+ "publications.dramaticarts.ui.play.production_theater.remove");
+ default:
+ return null;
+ }
+ }
+
+ @Override
+ public Object getKeyAt(final int columnIndex) {
+ return productionTheater.getID();
+ }
+
+ }
+
+ private class EditCellRenderer extends LockableImpl implements TableCellRenderer {
+
+ public EditCellRenderer() {
+ super();
+ }
+
+ @Override
+ 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 SciPublicationsPlay play = (SciPublicationsPlay) itemModel.getSelectedObject(
+ state);
+
+ final boolean canEdit = securityManager.canAccess(
+ state.getRequest(),
+ com.arsdigita.cms.SecurityManager.EDIT_ITEM,
+ play);
+
+ if (canEdit) {
+ final GenericOrganizationalUnit productionTheater;
+ try {
+ productionTheater = new GenericOrganizationalUnit((BigDecimal) key);
+ } catch (DataObjectNotFoundException ex) {
+ return new Label(value.toString());
+ }
+
+ final ContentSection section = productionTheater.getContentSection();
+ final ItemResolver resolver = section.getItemResolver();
+ final Link link = new Link(value.toString(),
+ resolver.generateItemURL(state,
+ productionTheater,
+ section,
+ productionTheater.getVersion()));
+
+ return link;
+ } else {
+ return new Label(value.toString());
+ }
+
+ }
+
+ }
+
+ private class DeleteCellRenderer extends LockableImpl implements TableCellRenderer {
+
+ public DeleteCellRenderer() {
+ super();
+ }
+
+ @Override
+ 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 SciPublicationsPlay play = (SciPublicationsPlay) itemModel.getSelectedObject(
+ state);
+
+ final boolean canEdit = securityManager.canAccess(
+ state.getRequest(),
+ com.arsdigita.cms.SecurityManager.DELETE_ITEM,
+ play);
+
+ if (canEdit) {
+ final ControlLink link = new ControlLink(value.toString());
+ link.setConfirmation(globalisationUtil.globalise(
+ "publications.dramaticarts.ui.play.production_theater.remove.confirm"));
+ return link;
+ } else {
+ return new Label(value.toString());
+ }
+ }
+
+ }
+
+ @Override
+ public void cellSelected(final TableActionEvent event) {
+ final PageState state = event.getPageState();
+
+ final SciPublicationsPlay play = (SciPublicationsPlay) itemModel.getSelectedObject(state);
+
+ final TableColumn column = getColumnModel().get(event.getColumn().intValue());
+
+ if (TABLE_COL_EDIT.equals(column.getHeaderKey().toString())) {
+ //Nothing
+ } else if (TABLE_COL_DEL.equals(column.getHeaderKey().toString())) {
+ play.setProductionTheater(null);
+ }
+ }
+
+ @Override
+ public void headSelected(final TableActionEvent event) {
+ //Nothing
+ }
+
+}
diff --git a/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/ui/SciPublicationsPlayProductionTheaterStep.java b/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/ui/SciPublicationsPlayProductionTheaterStep.java
new file mode 100644
index 000000000..8a6b0013e
--- /dev/null
+++ b/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/ui/SciPublicationsPlayProductionTheaterStep.java
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2014 Jens Pelzetter
+ *
+ * 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.ui;
+
+import com.arsdigita.cms.ItemSelectionModel;
+import com.arsdigita.cms.contenttypes.SciPublicationsDramaticArtsGlobalisationUtil;
+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
+ * @version $Id$
+ */
+public class SciPublicationsPlayProductionTheaterStep extends SimpleEditStep {
+
+ private String SET_PRODUCTION_THEATER_STEP = "setProductionTheaterStep";
+
+ public SciPublicationsPlayProductionTheaterStep(final ItemSelectionModel itemModel,
+ final AuthoringKitWizard parent) {
+ this(itemModel, parent, null);
+ }
+
+ public SciPublicationsPlayProductionTheaterStep(final ItemSelectionModel itemModel,
+ final AuthoringKitWizard parent,
+ final String prefix) {
+ super(itemModel, parent, prefix);
+
+ final SciPublicationsDramaticArtsGlobalisationUtil globalisationUtil
+ = new SciPublicationsDramaticArtsGlobalisationUtil();
+ final BasicItemForm setProductionTheaterForm = new SciPublicationsPlayProductionTheaterForm(
+ itemModel);
+ add(SET_PRODUCTION_THEATER_STEP,
+ globalisationUtil.globalise("publications.dramaticarts.play.ui.productiontheater"),
+ new WorkflowLockedComponentAccess(setProductionTheaterForm, itemModel),
+ setProductionTheaterForm.getSaveCancelSection().getCancelButton());
+
+ final SciPublicationsPlayProductionTheaterSheet sheet
+ = new SciPublicationsPlayProductionTheaterSheet(
+ itemModel);
+ setDisplayComponent(sheet);
+ }
+
+}
diff --git a/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/ui/SciPublicationsPlayPropertiesStep.java b/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/ui/SciPublicationsPlayPropertiesStep.java
index b11288560..1c81222fc 100644
--- a/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/ui/SciPublicationsPlayPropertiesStep.java
+++ b/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/ui/SciPublicationsPlayPropertiesStep.java
@@ -44,16 +44,17 @@ public class SciPublicationsPlayPropertiesStep extends PublicationWithPublisherP
}
public static Component getSciPublicationsPlayPropertySheet(
- final ItemSelectionModel itemModel) {
+ final ItemSelectionModel itemModel) {
- final DomainObjectPropertySheet sheet = (DomainObjectPropertySheet) PublicationWithPublisherPropertiesStep.
- getPublicationWithPublisherPropertySheet(itemModel);
+ final DomainObjectPropertySheet sheet
+ = (DomainObjectPropertySheet) PublicationWithPublisherPropertiesStep
+ .getPublicationWithPublisherPropertySheet(itemModel);
final SciPublicationsDramaticArtsGlobalisationUtil globalisationUtil
- = new SciPublicationsDramaticArtsGlobalisationUtil();
+ = new SciPublicationsDramaticArtsGlobalisationUtil();
sheet.add(globalisationUtil.globalise(
- "publications.dramaticarts.ui.play.first_production_year"),
+ "publications.dramaticarts.ui.play.first_production_year"),
SciPublicationsPlay.FIRST_PRODUCTION_YEAR);
return sheet;
@@ -72,15 +73,15 @@ public class SciPublicationsPlayPropertiesStep extends PublicationWithPublisherP
basicProperties.add(EDIT_SHEET_NAME,
PublicationGlobalizationUtil.globalize(
- "publications.ui.publication.edit_basic_sheet"),
+ "publications.ui.publication.edit_basic_sheet"),
new WorkflowLockedComponentAccess(editBasicSheet, itemModel),
editBasicSheet.getSaveCancelSection().getCancelButton());
basicProperties.setDisplayComponent(getSciPublicationsPlayPropertySheet(itemModel));
getSegmentedPanel().addSegment(new Label(PublicationGlobalizationUtil.globalize(
- "publications.ui.publication.basic_properties"),
- basicProperties));
+ "publications.ui.publication.basic_properties")),
+ basicProperties);
}
@@ -90,8 +91,9 @@ public class SciPublicationsPlayPropertiesStep extends PublicationWithPublisherP
super.addSteps(itemModel, parent);
- final SciPublicationsDramaticArtsGlobalisationUtil globalisationUtil = new SciPublicationsDramaticArtsGlobalisationUtil();
- addStep(new SciPublicationsPlayProducationTheaterStep(itemModel, parent),
+ final SciPublicationsDramaticArtsGlobalisationUtil globalisationUtil
+ = new SciPublicationsDramaticArtsGlobalisationUtil();
+ addStep(new SciPublicationsPlayProductionTheaterStep(itemModel, parent),
globalisationUtil.
globalise("publications.dramaticarts.ui.first_producation_theater"));
diff --git a/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/ui/SciPublicationsPlayPropertyForm.java b/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/ui/SciPublicationsPlayPropertyForm.java
new file mode 100644
index 000000000..0186a0340
--- /dev/null
+++ b/ccm-sci-publications-dramaticarts/src/com/arsdigita/cms/contenttypes/ui/SciPublicationsPlayPropertyForm.java
@@ -0,0 +1,97 @@
+/*
+ * Copyright (c) 2014 Jens Pelzetter
+ *
+ * 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.ui;
+
+import com.arsdigita.bebop.FormData;
+import com.arsdigita.bebop.FormProcessException;
+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.TextField;
+import com.arsdigita.bebop.parameters.IntegerParameter;
+import com.arsdigita.bebop.parameters.ParameterModel;
+import com.arsdigita.cms.ItemSelectionModel;
+import com.arsdigita.cms.contenttypes.SciPublicationsDramaticArtsGlobalisationUtil;
+import com.arsdigita.cms.contenttypes.SciPublicationsPlay;
+
+/**
+ *
+ * @author Jens Pelzetter
+ * @version $Id$
+ */
+public class SciPublicationsPlayPropertyForm
+ extends PublicationWithPublisherPropertyForm
+ implements FormInitListener,
+ FormProcessListener,
+ FormSubmissionListener {
+
+ private final SciPublicationsPlayPropertiesStep step;
+
+ public SciPublicationsPlayPropertyForm(final ItemSelectionModel itemModel) {
+ this(itemModel, null);
+ }
+
+ public SciPublicationsPlayPropertyForm(final ItemSelectionModel itemModel,
+ final SciPublicationsPlayPropertiesStep step) {
+ super(itemModel, step);
+ this.step = step;
+ addSubmissionListener(this);
+ }
+
+ @Override
+ protected void addWidgets() {
+ super.addWidgets();
+
+ final SciPublicationsDramaticArtsGlobalisationUtil globalisationUtil = new SciPublicationsDramaticArtsGlobalisationUtil();
+ final ParameterModel firstProdYearParam = new IntegerParameter(SciPublicationsPlay.FIRST_PRODUCTION_YEAR);
+ final TextField firstProdYear = new TextField(firstProdYearParam);
+ firstProdYear.setMaxLength(4);
+ firstProdYear.setLabel(globalisationUtil.globalise("publications.dramaticarts.ui.play.first_producation_year"));
+ add(firstProdYear);
+
+ }
+
+ @Override
+ public void init(final FormSectionEvent event) throws FormProcessException {
+ super.init(event);
+
+ final FormData data = event.getFormData();
+ final SciPublicationsPlay play = (SciPublicationsPlay) super.initBasicWidgets(event);
+
+ data.put(SciPublicationsPlay.FIRST_PRODUCTION_YEAR, play.getFirstProductionYear());
+
+ }
+
+ @Override
+ public void process(final FormSectionEvent event) throws FormProcessException {
+ super.process(event);
+
+ final FormData data = event.getFormData();
+ final SciPublicationsPlay play = (SciPublicationsPlay) super.processBasicWidgets(event);
+
+ if ((play != null)
+ && getSaveCancelSection().getSaveButton().isSelected(event.getPageState())) {
+ play.setFirstProductionYear((Integer) data.get(SciPublicationsPlay.FIRST_PRODUCTION_YEAR));
+ play.save();
+ }
+ }
+
+
+}