Sprachunabhängige Content Items
* Interface LanguageInvariantContentItem hinzugefügt * GenericPerson implementiert dieses Interface und liefert mit isLanguageInvariant() true zurück * ContentItemPage so angepaßt, daß der LanguageTab bei sprachunabhängigen Content Items ausgeblendet wird. Um Content Items als sprachunabhängig zu kennzeichnen, muß das Interface implementiert werden und die Methode isLanguageIndependent() true zurückliefern. Dieser Ansatz wurde gewählt, so daß man von sprachunabhängigen Content Items auch sprachabhängige Content Items ableiten kann. Da man das Interface später nicht entfernen kann, muß die Entscheidung über die Methode laufen. Eine Anpassung von ContentItem kommt nicht in frage, da man dann immer die Methode von ContentItem ausführt, es sei denn man macht jedesmal, wenn man diese Information abfragen möchte, einen sehr umständlichen Cast auf die konkrete Klasse des ContentItems. git-svn-id: https://svn.libreccm.org/ccm/trunk@1438 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
64325afcdc
commit
2e67f1bd21
|
|
@ -0,0 +1,17 @@
|
|||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package com.arsdigita.cms;
|
||||
|
||||
/**
|
||||
*
|
||||
* Content Items implementing this interface are be language invariant, if
|
||||
* isLanguageInvariant returns true
|
||||
*
|
||||
* @author Sören Bernstein (quasimodo) <sbernstein@zes.uni-bremen.de>
|
||||
*/
|
||||
public interface LanguageInvariantContentItem {
|
||||
|
||||
public abstract boolean isLanguageInvariant();
|
||||
}
|
||||
|
|
@ -20,6 +20,7 @@ package com.arsdigita.cms.contenttypes;
|
|||
|
||||
import com.arsdigita.cms.ContentType;
|
||||
import com.arsdigita.cms.ContentPage;
|
||||
import com.arsdigita.cms.LanguageInvariantContentItem;
|
||||
import com.arsdigita.cms.RelationAttributeInterface;
|
||||
import com.arsdigita.domain.DataObjectNotFoundException;
|
||||
import com.arsdigita.domain.DomainObjectFactory;
|
||||
|
|
@ -38,7 +39,8 @@ import java.util.Date;
|
|||
* @author Jens Pelzetter
|
||||
*/
|
||||
public class GenericPerson extends ContentPage implements
|
||||
RelationAttributeInterface {
|
||||
RelationAttributeInterface,
|
||||
LanguageInvariantContentItem {
|
||||
|
||||
public static final String PERSON = "person";
|
||||
public static final String SURNAME = "surname";
|
||||
|
|
@ -311,4 +313,8 @@ public class GenericPerson extends ContentPage implements
|
|||
public String getSearchSummary() {
|
||||
return getFullName();
|
||||
}
|
||||
|
||||
public boolean isLanguageInvariant() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,13 +36,7 @@ import com.arsdigita.bebop.event.PrintListener;
|
|||
import com.arsdigita.bebop.parameters.BigDecimalParameter;
|
||||
import com.arsdigita.bebop.parameters.NotNullValidationListener;
|
||||
import com.arsdigita.bebop.parameters.StringParameter;
|
||||
import com.arsdigita.cms.CMS;
|
||||
import com.arsdigita.cms.ContentItem;
|
||||
import com.arsdigita.cms.ContentSection;
|
||||
import com.arsdigita.cms.ContentType;
|
||||
import com.arsdigita.cms.ItemSelectionModel;
|
||||
import com.arsdigita.cms.PageLocations;
|
||||
import com.arsdigita.cms.Template;
|
||||
import com.arsdigita.cms.*;
|
||||
import com.arsdigita.cms.contenttypes.CustomizedPreviewLink;
|
||||
import com.arsdigita.cms.dispatcher.CMSDispatcher;
|
||||
import com.arsdigita.cms.dispatcher.CMSPage;
|
||||
|
|
@ -73,6 +67,8 @@ import org.apache.log4j.Logger;
|
|||
* @author Michael Pih
|
||||
* @author Stanislav Freidin <sfreidin@redhat.com>
|
||||
* @author Jack Chung
|
||||
* @author Sören Bernstein (quasimodo) <sbernstein@zes.uni-bremen.de>
|
||||
*
|
||||
* @version $Id: ContentItemPage.java 754 2005-09-02 13:26:17Z sskracic $
|
||||
*/
|
||||
public class ContentItemPage extends CMSPage implements ActionListener {
|
||||
|
|
@ -338,6 +334,16 @@ public class ContentItemPage extends CMSPage implements ActionListener {
|
|||
getConfig().getHideTemplatesTab());
|
||||
}
|
||||
|
||||
// Added by: Sören Bernstein <sbernstein@zes.uni-bremen.de>
|
||||
// If the content item is a language invariant content item, don't show
|
||||
// the language pane
|
||||
if (item instanceof LanguageInvariantContentItem) {
|
||||
LanguageInvariantContentItem li_item = (LanguageInvariantContentItem) item;
|
||||
if(li_item.isLanguageInvariant()) {
|
||||
m_tabbedPane.setTabVisible(state, m_languagesPane, false);
|
||||
}
|
||||
}
|
||||
|
||||
// Set the current tab based on parameters
|
||||
if (setTab != null) {
|
||||
Integer tab = null;
|
||||
|
|
|
|||
Loading…
Reference in New Issue