Asset für Art der Publikation/zusätzliche Ausgaben (Softcover, Hardcover, E-Book etc.). Datenbanktechnisch hoffentlich fertig, UI ist noch nicht getestet!
git-svn-id: https://svn.libreccm.org/ccm/trunk@2260 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
c5cb863d9e
commit
bc07eaacfc
|
|
@ -0,0 +1,29 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<ccm:application xmlns:ccm="http://ccm.redhat.com/ccm-project"
|
||||||
|
name="ccm-sci-publications-publicationtype"
|
||||||
|
prettyName="ScientificCMS Publications module providing an asset for describing different types of publication of a publication, e.g. ebook"
|
||||||
|
version="6.6.5"
|
||||||
|
release="1"
|
||||||
|
webapp="ROOT">
|
||||||
|
|
||||||
|
<ccm:dependencies>
|
||||||
|
<ccm:requires name="ccm-core" version="6.6.0" release="ge"/>
|
||||||
|
<ccm:requires name="ccm-cms" version="6.6.0" release="ge"/>
|
||||||
|
<ccm:requires name="ccm-sci-publications" version="6.6.5" relation="ge"/>
|
||||||
|
</ccm:dependencies>
|
||||||
|
|
||||||
|
<ccm:directories>
|
||||||
|
<ccm:directory name="pdl"/>
|
||||||
|
<ccm:directory name="sql"/>
|
||||||
|
<ccm:directory name="src"/>
|
||||||
|
</ccm:directories>
|
||||||
|
|
||||||
|
<ccm:contacts>
|
||||||
|
<ccm:contact uri="http://www.scientificcms.org" type="website"/>
|
||||||
|
<ccm:contact uri="mailto:info@scientificcms.org" type="support"/>
|
||||||
|
</ccm:contacts>
|
||||||
|
<ccm:description>
|
||||||
|
An asset for for describing different types of publication of a publication, e.g. ebook"
|
||||||
|
</ccm:description>
|
||||||
|
|
||||||
|
</ccm:application>
|
||||||
|
|
@ -0,0 +1,43 @@
|
||||||
|
//
|
||||||
|
// Copyright (C) 2013 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
|
||||||
|
//
|
||||||
|
//
|
||||||
|
|
||||||
|
model com.arsdigita.cms.contentassets;
|
||||||
|
|
||||||
|
import com.arsdigita.cms.contenttypes.Publication;
|
||||||
|
import com.arsdigita.kernel.ACSObject;
|
||||||
|
|
||||||
|
object type PublicationTypeAsset extends ACSObject {
|
||||||
|
|
||||||
|
String[1..1] publicationType = ca_publications_publicationtype.publicationtype VARCHAR(512);
|
||||||
|
String[0..1] isbn = ca_publications_publicationtype.isbn VARCHAR(17);
|
||||||
|
String[0..1] misc = ca_publications_publicationtype.misc VARCHAR(4096);
|
||||||
|
|
||||||
|
reference key(ca_publications_publicationtype.type_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
association {
|
||||||
|
|
||||||
|
composite Publication[1..1] publication = join ca_publications_publicationtype.publication_id
|
||||||
|
to ct_publications.publication_id;
|
||||||
|
|
||||||
|
component PublicationTypeAsset[0..n] publicationtypes = join ct_publications.publication_id
|
||||||
|
to ca_publications_publicationtype.publication_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
@@ ddl/oracle-se/create.sql
|
||||||
|
@@ ddl/oracle-se/deferred.sql
|
||||||
|
|
@ -0,0 +1,4 @@
|
||||||
|
begin;
|
||||||
|
\i ddl/postgres/create.sql
|
||||||
|
\i ddl/postgres/deferred.sql
|
||||||
|
commit;
|
||||||
|
|
@ -0,0 +1,37 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ddenums>
|
||||||
|
|
||||||
|
<ddenum name="PublicationTypeAssetTypeValues">
|
||||||
|
<entry key="book" lang="en">
|
||||||
|
<value>Book</value>
|
||||||
|
</entry>
|
||||||
|
<entry key="book" lang="de">
|
||||||
|
<value>Buch</value>
|
||||||
|
</entry>
|
||||||
|
<entry key="hardcover" lang="en">
|
||||||
|
<value>Hardcover</value>
|
||||||
|
</entry>
|
||||||
|
<entry key="hardcover" lang="de">
|
||||||
|
<value>Hardcover</value>
|
||||||
|
</entry>
|
||||||
|
<entry key="softcover" lang="en">
|
||||||
|
<value>Softcover</value>
|
||||||
|
</entry>
|
||||||
|
<entry key="softcover" lang="de">
|
||||||
|
<value>Softcover</value>
|
||||||
|
</entry>
|
||||||
|
<entry key="paperback" lang="en">
|
||||||
|
<value>Paperback</value>
|
||||||
|
</entry>
|
||||||
|
<entry key="paperback" lang="de">
|
||||||
|
<value>Taschenbuch</value>
|
||||||
|
</entry>
|
||||||
|
<entry key="ebook" lang="en">
|
||||||
|
<value>E-Book</value>
|
||||||
|
</entry>
|
||||||
|
<entry key="ebook" lang="de">
|
||||||
|
<value>E-Book</value>
|
||||||
|
</entry>
|
||||||
|
</ddenum>
|
||||||
|
|
||||||
|
</ddenums>
|
||||||
|
|
@ -0,0 +1,13 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<xrd:adapters
|
||||||
|
xmlns:xrd="http://xmlns.redhat.com/schemas/waf/xml-renderer-rules"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://rhea.redhat.com/schemas/waf/xml-renderer-rules xml-renderer-rules.xsd">
|
||||||
|
|
||||||
|
<xrd:context name="com.arsdigita.cms.dispatcher.SimpleXMLGenerator">
|
||||||
|
<xrd:adapter objectType="com.arsdigita.cms.contentassets.LibrarySignatures">
|
||||||
|
|
||||||
|
</xrd:adapter>
|
||||||
|
</xrd:context>
|
||||||
|
|
||||||
|
</xrd:adapters>
|
||||||
|
|
@ -0,0 +1,4 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<registry>
|
||||||
|
<!--Nothing yet-->
|
||||||
|
</registry>
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
<load>
|
||||||
|
<requires>
|
||||||
|
<table name="inits"/>
|
||||||
|
<table name="acs_objects"/>
|
||||||
|
<table name="cms_items"/>
|
||||||
|
<table name="ct_publications"/>
|
||||||
|
|
||||||
|
<initializer class="com.arsdigita.cms.Initializer"/>
|
||||||
|
<initializer class="com.arsdigita.cms.contenttypes.PublicationInitializer"/>
|
||||||
|
</requires>
|
||||||
|
|
||||||
|
<provides>
|
||||||
|
<table name="ca_publications_publicationtype"/>
|
||||||
|
<initializer class="com.arsdigita.cms.contentassets.PublicationTypeAssetInitializer"/>
|
||||||
|
</provides>
|
||||||
|
|
||||||
|
<scripts>
|
||||||
|
<schema directory="ccm-sci-publications-publicationtype"/>
|
||||||
|
<data class="com.arsdigita.cms.contentassets.PublicationTypeAssetLoader"/>
|
||||||
|
</scripts>
|
||||||
|
</load>
|
||||||
|
|
@ -0,0 +1,110 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2013 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.contentassets;
|
||||||
|
|
||||||
|
import com.arsdigita.cms.contenttypes.Publication;
|
||||||
|
import com.arsdigita.domain.DomainObjectFactory;
|
||||||
|
import com.arsdigita.kernel.ACSObject;
|
||||||
|
import com.arsdigita.persistence.DataCollection;
|
||||||
|
import com.arsdigita.persistence.DataObject;
|
||||||
|
import com.arsdigita.persistence.OID;
|
||||||
|
import com.arsdigita.persistence.SessionManager;
|
||||||
|
import com.arsdigita.util.Assert;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Jens Pelzetter <jens@jp-digital.de>
|
||||||
|
* @version $Id$
|
||||||
|
*/
|
||||||
|
public class PublicationTypeAsset extends ACSObject {
|
||||||
|
|
||||||
|
public static final String BASE_DATA_OBJECT_TYPE = "com.arsdigita.cms.contentassets.PublicationTypeAsset";
|
||||||
|
|
||||||
|
public static final String PUBLICATION_TYPE = "publicationType";
|
||||||
|
public static final String ISBN = "isbn";
|
||||||
|
public static final String MISC = "misc";
|
||||||
|
public static final String PUBLICATION = "publication";
|
||||||
|
|
||||||
|
public PublicationTypeAsset() {
|
||||||
|
super(BASE_DATA_OBJECT_TYPE);
|
||||||
|
}
|
||||||
|
|
||||||
|
public PublicationTypeAsset(final BigDecimal publicationTypeId) {
|
||||||
|
super(new OID(BASE_DATA_OBJECT_TYPE, publicationTypeId));
|
||||||
|
}
|
||||||
|
|
||||||
|
public PublicationTypeAsset(final String type) {
|
||||||
|
super(type);
|
||||||
|
}
|
||||||
|
|
||||||
|
public PublicationTypeAsset(final DataObject dataObject) {
|
||||||
|
super(dataObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static PublicationTypeAsset create(final Publication publication) {
|
||||||
|
final PublicationTypeAsset type = new PublicationTypeAsset();
|
||||||
|
type.set(PUBLICATION, publication);
|
||||||
|
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static DataCollection getPublicationTypeAssets(final Publication publication) {
|
||||||
|
Assert.exists(publication, Publication.class);
|
||||||
|
|
||||||
|
final DataCollection types = SessionManager.getSession().retrieve(BASE_DATA_OBJECT_TYPE);
|
||||||
|
|
||||||
|
types.addEqualsFilter(PUBLICATION, publication.getID());
|
||||||
|
types.addOrder(PUBLICATION_TYPE);
|
||||||
|
types.addOrder(ISBN);
|
||||||
|
|
||||||
|
return types;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPublicationType() {
|
||||||
|
return (String) get(PUBLICATION_TYPE);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPublicationType(final String type) {
|
||||||
|
set(PUBLICATION_TYPE, type);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getIsbn() {
|
||||||
|
return (String) get(ISBN);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIsbn(final String isbn) {
|
||||||
|
set(ISBN, isbn);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMisc() {
|
||||||
|
return (String) get(MISC);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMisc(final String misc) {
|
||||||
|
set(MISC, misc);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Publication getPublication() {
|
||||||
|
final DataObject dataObject = (DataObject) get(PUBLICATION);
|
||||||
|
|
||||||
|
return (Publication) DomainObjectFactory.newInstance(dataObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,91 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2013 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.contentassets;
|
||||||
|
|
||||||
|
import com.arsdigita.cms.RelationAttributeImportTool;
|
||||||
|
import com.arsdigita.cms.contentassets.ui.PublicationTypeAssetStep;
|
||||||
|
import com.arsdigita.cms.contenttypes.ContentAssetInitializer;
|
||||||
|
import com.arsdigita.cms.contenttypes.Publication;
|
||||||
|
import com.arsdigita.cms.dispatcher.SimpleXMLGenerator;
|
||||||
|
import com.arsdigita.domain.DomainObjectTraversal;
|
||||||
|
import com.arsdigita.domain.SimpleDomainObjectTraversalAdapter;
|
||||||
|
import com.arsdigita.globalization.GlobalizedMessage;
|
||||||
|
import com.arsdigita.runtime.DomainInitEvent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Jens Pelzetter <jens@jp-digital.de>
|
||||||
|
* @version $Id$
|
||||||
|
*/
|
||||||
|
public class PublicationTypeAssetInitializer extends ContentAssetInitializer {
|
||||||
|
|
||||||
|
public PublicationTypeAssetInitializer() {
|
||||||
|
super("ccm-sci-publications-publicationtype.pdl.mf");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init(final DomainInitEvent event) {
|
||||||
|
super.init(event);
|
||||||
|
|
||||||
|
DomainObjectTraversal.registerAdapter(PublicationTypeAsset.BASE_DATA_OBJECT_TYPE,
|
||||||
|
new SimpleDomainObjectTraversalAdapter(),
|
||||||
|
SimpleXMLGenerator.ADAPTER_CONTEXT);
|
||||||
|
|
||||||
|
final RelationAttributeImportTool importTool = new RelationAttributeImportTool();
|
||||||
|
importTool.loadData("WEB-INF/resources/publication_types.xml");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getBaseType() {
|
||||||
|
return Publication.BASE_DATA_OBJECT_TYPE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getTraversalXML() {
|
||||||
|
return TRAVERSAL_ADAPTER_BASE_DIR + "PublicationTypeAsset.xml";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getProperty() {
|
||||||
|
return "publicationtypes";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Class getAuthoringStep() {
|
||||||
|
return PublicationTypeAssetStep.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public GlobalizedMessage getAuthoringStepLabel() {
|
||||||
|
return new GlobalizedMessage("com.arsdigita.cms.contentassets.publicationtypes.label",
|
||||||
|
"com.arsdigita.cms.contentassets.PublicationTypeAssetResources");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public GlobalizedMessage getAuthoringStepDescription() {
|
||||||
|
return new GlobalizedMessage("com.arsdigita.cms.contentassets.publicationtypes.description",
|
||||||
|
"com.arsdigita.cms.contentassets.PublicationTypeAssetResources");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getAuthoringStepSortKey() {
|
||||||
|
return 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,35 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2013 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.contentassets;
|
||||||
|
|
||||||
|
import com.arsdigita.loader.PackageLoader;
|
||||||
|
import com.arsdigita.runtime.ScriptContext;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Jens Pelzetter <jens@jp-digital.de>
|
||||||
|
* @version $Id$
|
||||||
|
*/
|
||||||
|
public class PublicationTypeAssetLoader extends PackageLoader {
|
||||||
|
|
||||||
|
public void run(final ScriptContext ctx) {
|
||||||
|
//Nothing
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,45 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2013 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.contentassets;
|
||||||
|
|
||||||
|
import com.arsdigita.cms.RelationAttributeCollection;
|
||||||
|
import com.arsdigita.persistence.DataCollection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Jens Pelzetter <jens@jp-digital.de>
|
||||||
|
* @version $Id$
|
||||||
|
*/
|
||||||
|
public class PublicationTypeValuesCollection extends RelationAttributeCollection {
|
||||||
|
|
||||||
|
public static final String ATTRIBUTE_NAME = "PublicationTypeAssetTypeValues";
|
||||||
|
|
||||||
|
public PublicationTypeValuesCollection() {
|
||||||
|
super(ATTRIBUTE_NAME);
|
||||||
|
}
|
||||||
|
|
||||||
|
public PublicationTypeValuesCollection(final String key) {
|
||||||
|
super(ATTRIBUTE_NAME, key);
|
||||||
|
}
|
||||||
|
|
||||||
|
public PublicationTypeValuesCollection(final DataCollection dataCollection) {
|
||||||
|
super(dataCollection);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,130 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2013 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.contentassets.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.FormSectionEvent;
|
||||||
|
import com.arsdigita.bebop.form.Option;
|
||||||
|
import com.arsdigita.bebop.form.SingleSelect;
|
||||||
|
import com.arsdigita.bebop.form.TextArea;
|
||||||
|
import com.arsdigita.bebop.form.TextField;
|
||||||
|
import com.arsdigita.bebop.parameters.NotEmptyValidationListener;
|
||||||
|
import com.arsdigita.bebop.parameters.NotNullValidationListener;
|
||||||
|
import com.arsdigita.cms.ItemSelectionModel;
|
||||||
|
import com.arsdigita.cms.RelationAttribute;
|
||||||
|
import com.arsdigita.cms.contentassets.PublicationTypeAsset;
|
||||||
|
import com.arsdigita.cms.contentassets.PublicationTypeValuesCollection;
|
||||||
|
import com.arsdigita.cms.contenttypes.Publication;
|
||||||
|
import com.arsdigita.cms.ui.authoring.BasicItemForm;
|
||||||
|
import com.arsdigita.globalization.GlobalizationHelper;
|
||||||
|
import com.arsdigita.kernel.ui.ACSObjectSelectionModel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Jens Pelzetter <jens@jp-digital.de>
|
||||||
|
* @version $Id$
|
||||||
|
*/
|
||||||
|
public class PublicationTypeAssetAddForm extends BasicItemForm {
|
||||||
|
|
||||||
|
private final static String PUB_TYPE = "publicationType";
|
||||||
|
private final static String ISBN = "isbn";
|
||||||
|
private final static String MISC = "misc";
|
||||||
|
private final ItemSelectionModel itemModel;
|
||||||
|
private final ACSObjectSelectionModel typeModel;
|
||||||
|
|
||||||
|
public PublicationTypeAssetAddForm(final ItemSelectionModel itemModel, final ACSObjectSelectionModel typeModel) {
|
||||||
|
super("PublicationTypeAssetAddForm", itemModel);
|
||||||
|
|
||||||
|
this.itemModel = itemModel;
|
||||||
|
this.typeModel = typeModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addWidgets() {
|
||||||
|
add(new Label(PublicationTypeAssetGlobalizationUtil.
|
||||||
|
globalize("scipublications.publication_type_asset.form.type")));
|
||||||
|
final SingleSelect type = new SingleSelect(PUB_TYPE);
|
||||||
|
type.addValidationListener(new NotNullValidationListener());
|
||||||
|
type.addValidationListener(new NotEmptyValidationListener());
|
||||||
|
type.addOption(new Option("", new Label(PublicationTypeAssetGlobalizationUtil.globalize(
|
||||||
|
"scipublications.publication_type_asset.form.type.select_one"))));
|
||||||
|
final PublicationTypeValuesCollection values = new PublicationTypeValuesCollection();
|
||||||
|
values.addLanguageFilter(GlobalizationHelper.getNegotiatedLocale().getLanguage());
|
||||||
|
|
||||||
|
while (values.next()) {
|
||||||
|
final RelationAttribute value = values.getRelationAttribute();
|
||||||
|
type.addOption(new Option(value.getKey(), value.getName()));
|
||||||
|
}
|
||||||
|
add(type);
|
||||||
|
|
||||||
|
add(new Label(PublicationTypeAssetGlobalizationUtil.
|
||||||
|
globalize("scipublications.publication_type_asset.form.isbn")));
|
||||||
|
add(new TextField(ISBN));
|
||||||
|
|
||||||
|
add(new Label(PublicationTypeAssetGlobalizationUtil.
|
||||||
|
globalize("scipublications.publication_type_asset.form.misc")));
|
||||||
|
final TextArea misc = new TextArea(MISC);
|
||||||
|
misc.setRows(12);
|
||||||
|
misc.setCols(60);
|
||||||
|
add(misc);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init(final FormSectionEvent event) throws FormProcessException {
|
||||||
|
final PageState state = event.getPageState();
|
||||||
|
|
||||||
|
if (typeModel.getSelectedObject(state) != null) {
|
||||||
|
final PublicationTypeAsset typeAsset = (PublicationTypeAsset) typeModel.getSelectedObject(state);
|
||||||
|
final FormData data = event.getFormData();
|
||||||
|
|
||||||
|
data.put(PUB_TYPE, typeAsset.getPublicationType());
|
||||||
|
data.put(ISBN, typeAsset.getIsbn());
|
||||||
|
data.put(MISC, typeAsset.getMisc());
|
||||||
|
}
|
||||||
|
|
||||||
|
setVisible(state, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void process(final FormSectionEvent event) throws FormProcessException {
|
||||||
|
final FormData data = event.getFormData();
|
||||||
|
final PageState state = event.getPageState();
|
||||||
|
|
||||||
|
final PublicationTypeAsset typeAsset;
|
||||||
|
if (typeModel.getSelectedObject(state) == null) {
|
||||||
|
final Publication publication = (Publication) itemModel.getSelectedItem(state);
|
||||||
|
|
||||||
|
typeAsset = PublicationTypeAsset.create(publication);
|
||||||
|
} else {
|
||||||
|
typeAsset = (PublicationTypeAsset) typeModel.getSelectedObject(state);
|
||||||
|
|
||||||
|
typeModel.setSelectedObject(state, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
typeAsset.setPublicationType(data.getString(PUB_TYPE));
|
||||||
|
typeAsset.setIsbn(data.getString(ISBN));
|
||||||
|
typeAsset.setMisc(data.getString(MISC));
|
||||||
|
|
||||||
|
typeAsset.save();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,44 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2013 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.contentassets.ui;
|
||||||
|
|
||||||
|
import com.arsdigita.globalization.GlobalizedMessage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Jens Pelzetter <jens@jp-digital.de>
|
||||||
|
* @version $Id$
|
||||||
|
*/
|
||||||
|
public class PublicationTypeAssetGlobalizationUtil {
|
||||||
|
|
||||||
|
private PublicationTypeAssetGlobalizationUtil() {
|
||||||
|
//Nothing
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final String BUNDLE_NAME = "com.arsdigita.cms.contentassets.PublicationTypeAssetResources";
|
||||||
|
|
||||||
|
public static GlobalizedMessage globalize(final String key) {
|
||||||
|
return new GlobalizedMessage(key, BUNDLE_NAME);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static GlobalizedMessage globalize(final String key, final Object[] args) {
|
||||||
|
return new GlobalizedMessage(key, BUNDLE_NAME, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,74 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2013 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.contentassets.ui;
|
||||||
|
|
||||||
|
import com.arsdigita.bebop.Page;
|
||||||
|
import com.arsdigita.bebop.PageState;
|
||||||
|
import com.arsdigita.bebop.parameters.BigDecimalParameter;
|
||||||
|
import com.arsdigita.cms.ItemSelectionModel;
|
||||||
|
import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
|
||||||
|
import com.arsdigita.cms.ui.authoring.SimpleEditStep;
|
||||||
|
import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
|
||||||
|
import com.arsdigita.kernel.ui.ACSObjectSelectionModel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Jens Pelzetter <jens@jp-digital.de>
|
||||||
|
* @version $Id$
|
||||||
|
*/
|
||||||
|
public class PublicationTypeAssetStep extends SimpleEditStep {
|
||||||
|
|
||||||
|
protected static final String EDIT = "edit";
|
||||||
|
protected static final String PUB_TYPE_PARAM = "publication_type";
|
||||||
|
|
||||||
|
private final static String FORM_KEY = "PublicationTypesAdd";
|
||||||
|
|
||||||
|
private final BigDecimalParameter typeParameter;
|
||||||
|
final PublicationTypeAssetAddForm addForm;
|
||||||
|
|
||||||
|
public PublicationTypeAssetStep(final ItemSelectionModel itemModel,
|
||||||
|
final AuthoringKitWizard parent,
|
||||||
|
final String prefix) {
|
||||||
|
super(itemModel, parent, prefix);
|
||||||
|
|
||||||
|
typeParameter = new BigDecimalParameter(PUB_TYPE_PARAM);
|
||||||
|
final ACSObjectSelectionModel typeModel = new ACSObjectSelectionModel(typeParameter);
|
||||||
|
|
||||||
|
addForm = new PublicationTypeAssetAddForm(itemModel, typeModel);
|
||||||
|
add(FORM_KEY,
|
||||||
|
PublicationTypeAssetGlobalizationUtil.globalize("scipublications.publicationtypeasset.add"),
|
||||||
|
new WorkflowLockedComponentAccess(addForm, itemModel),
|
||||||
|
addForm.getSaveCancelSection().getCancelButton());
|
||||||
|
|
||||||
|
final PublicationTypeAssetTable table = new PublicationTypeAssetTable(itemModel, typeModel, this);
|
||||||
|
setDisplayComponent(table);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void register(final Page page) {
|
||||||
|
super.register(page);
|
||||||
|
|
||||||
|
page.addComponentStateParam(this, typeParameter);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void setAddVisible(final PageState state) {
|
||||||
|
showComponent(state, FORM_KEY);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,290 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2013 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.contentassets.ui;
|
||||||
|
|
||||||
|
import com.arsdigita.bebop.Component;
|
||||||
|
import com.arsdigita.bebop.ControlLink;
|
||||||
|
import com.arsdigita.bebop.Label;
|
||||||
|
import com.arsdigita.bebop.PageState;
|
||||||
|
import com.arsdigita.bebop.Table;
|
||||||
|
import com.arsdigita.bebop.event.TableActionEvent;
|
||||||
|
import com.arsdigita.bebop.event.TableActionListener;
|
||||||
|
import com.arsdigita.bebop.table.TableCellRenderer;
|
||||||
|
import com.arsdigita.bebop.table.TableColumn;
|
||||||
|
import com.arsdigita.bebop.table.TableColumnModel;
|
||||||
|
import com.arsdigita.bebop.table.TableModel;
|
||||||
|
import com.arsdigita.bebop.table.TableModelBuilder;
|
||||||
|
import com.arsdigita.cms.CMS;
|
||||||
|
import com.arsdigita.cms.ContentItem;
|
||||||
|
import com.arsdigita.cms.ItemSelectionModel;
|
||||||
|
import com.arsdigita.cms.contentassets.PublicationTypeAsset;
|
||||||
|
import com.arsdigita.cms.contenttypes.Publication;
|
||||||
|
import com.arsdigita.globalization.GlobalizedMessage;
|
||||||
|
import com.arsdigita.kernel.ui.ACSObjectSelectionModel;
|
||||||
|
import com.arsdigita.persistence.DataCollection;
|
||||||
|
import com.arsdigita.util.LockableImpl;
|
||||||
|
import com.sun.org.apache.xml.internal.resolver.helpers.PublicId;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Jens Pelzetter <jens@jp-digital.de>
|
||||||
|
* @version $Id$
|
||||||
|
*/
|
||||||
|
public class PublicationTypeAssetTable extends Table {
|
||||||
|
|
||||||
|
private final static String TABLE_COL_TYPE = "table_col_type";
|
||||||
|
private final static String TABLE_COL_ISBN = "table_col_isbn";
|
||||||
|
private final static String TABLE_COL_MISC = "table_col_misc";
|
||||||
|
private final static String TABLE_COL_EDIT = "table_col_edit";
|
||||||
|
private final static String TABLE_COL_DEL = "table_col_del";
|
||||||
|
private final PublicationTypeAssetStep parent;
|
||||||
|
private final ItemSelectionModel itemModel;
|
||||||
|
private final ACSObjectSelectionModel typeModel;
|
||||||
|
|
||||||
|
public PublicationTypeAssetTable(final ItemSelectionModel itemModel,
|
||||||
|
final ACSObjectSelectionModel typeModel,
|
||||||
|
final PublicationTypeAssetStep parent) {
|
||||||
|
super();
|
||||||
|
|
||||||
|
this.parent = parent;
|
||||||
|
this.itemModel = itemModel;
|
||||||
|
this.typeModel = typeModel;
|
||||||
|
|
||||||
|
setEmptyView(new Label(PublicationTypeAssetGlobalizationUtil.globalize(
|
||||||
|
"scipublications.publication_type_asset.none")));
|
||||||
|
|
||||||
|
final TableColumnModel columnModel = getColumnModel();
|
||||||
|
|
||||||
|
columnModel.add(new TableColumn(
|
||||||
|
0,
|
||||||
|
PublicationTypeAssetGlobalizationUtil.globalize("scipublications.publication_type_asset.type"),
|
||||||
|
TABLE_COL_TYPE));
|
||||||
|
columnModel.add(new TableColumn(
|
||||||
|
1,
|
||||||
|
PublicationTypeAssetGlobalizationUtil.globalize("scipublications.publication_type_asset.isbn"),
|
||||||
|
TABLE_COL_ISBN));
|
||||||
|
columnModel.add(new TableColumn(
|
||||||
|
2,
|
||||||
|
PublicationTypeAssetGlobalizationUtil.globalize("scipublications.publication_type_asset.misc"),
|
||||||
|
TABLE_COL_MISC));
|
||||||
|
columnModel.add(new TableColumn(
|
||||||
|
3,
|
||||||
|
PublicationTypeAssetGlobalizationUtil.globalize("scipublications.publication_type_asset.edit"),
|
||||||
|
TABLE_COL_EDIT));
|
||||||
|
columnModel.add(new TableColumn(
|
||||||
|
4,
|
||||||
|
PublicationTypeAssetGlobalizationUtil.globalize("scipublications.publication_type_asset.delete"),
|
||||||
|
TABLE_COL_DEL));
|
||||||
|
|
||||||
|
setModelBuilder(new ModelBuilder(itemModel));
|
||||||
|
|
||||||
|
columnModel.get(3).setCellRenderer(new EditCellRenderer());
|
||||||
|
columnModel.get(4).setCellRenderer(new DeleteCellRenderer());
|
||||||
|
|
||||||
|
addTableActionListener(new ActionListener());
|
||||||
|
}
|
||||||
|
|
||||||
|
private class ModelBuilder extends LockableImpl implements TableModelBuilder {
|
||||||
|
|
||||||
|
private final 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 Publication publication = (Publication) itemModel.getSelectedItem(state);
|
||||||
|
|
||||||
|
return new Model(table, state, publication);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private class Model implements TableModel {
|
||||||
|
|
||||||
|
private final Table table;
|
||||||
|
private final DataCollection typeAssets;
|
||||||
|
|
||||||
|
public Model(final Table table, final PageState state, final Publication publication) {
|
||||||
|
this.table = table;
|
||||||
|
|
||||||
|
typeAssets = PublicationTypeAsset.getPublicationTypeAssets(publication);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getColumnCount() {
|
||||||
|
return table.getColumnModel().size();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean nextRow() {
|
||||||
|
return (typeAssets != null) && typeAssets.next();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object getElementAt(final int columnIndex) {
|
||||||
|
switch (columnIndex) {
|
||||||
|
case 0:
|
||||||
|
return typeAssets.get(PublicationTypeAsset.PUBLICATION_TYPE);
|
||||||
|
case 1:
|
||||||
|
return typeAssets.get(PublicationTypeAsset.ISBN);
|
||||||
|
case 2:
|
||||||
|
return typeAssets.get(PublicationTypeAsset.MISC);
|
||||||
|
case 3:
|
||||||
|
return PublicationTypeAssetGlobalizationUtil.globalize(
|
||||||
|
"scipublications.publication_type_asset.edit");
|
||||||
|
case 4:
|
||||||
|
return PublicationTypeAssetGlobalizationUtil.globalize(
|
||||||
|
"scipublications.publication_type_asset.delete");
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object getKeyAt(final int columnIndex) {
|
||||||
|
return typeAssets.get(ContentItem.ID);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private class EditCellRenderer extends LockableImpl implements TableCellRenderer {
|
||||||
|
|
||||||
|
public EditCellRenderer() {
|
||||||
|
//Nothing
|
||||||
|
}
|
||||||
|
|
||||||
|
@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 Publication publication = (Publication) itemModel.getSelectedItem(state);
|
||||||
|
|
||||||
|
final boolean canEdit = securityManager.canAccess(state.getRequest(),
|
||||||
|
com.arsdigita.cms.SecurityManager.EDIT_ITEM,
|
||||||
|
publication);
|
||||||
|
|
||||||
|
if (canEdit) {
|
||||||
|
final ControlLink link;
|
||||||
|
if (value instanceof GlobalizedMessage) {
|
||||||
|
link = new ControlLink(new Label((GlobalizedMessage) value));
|
||||||
|
} else if (value == null) {
|
||||||
|
return new Label("???");
|
||||||
|
} else {
|
||||||
|
link = new ControlLink(value.toString());
|
||||||
|
}
|
||||||
|
return link;
|
||||||
|
} else {
|
||||||
|
final Label label;
|
||||||
|
if (value instanceof GlobalizedMessage) {
|
||||||
|
label = new Label((GlobalizedMessage) value);
|
||||||
|
} else if (value == null) {
|
||||||
|
return new Label("???");
|
||||||
|
} else {
|
||||||
|
label = new Label(value.toString());
|
||||||
|
}
|
||||||
|
return label;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private class DeleteCellRenderer extends LockableImpl implements TableCellRenderer {
|
||||||
|
|
||||||
|
public DeleteCellRenderer() {
|
||||||
|
//Nothing
|
||||||
|
}
|
||||||
|
|
||||||
|
@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 Publication publication = (Publication) itemModel.getSelectedItem(state);
|
||||||
|
|
||||||
|
final boolean canEdit = securityManager.canAccess(state.getRequest(),
|
||||||
|
com.arsdigita.cms.SecurityManager.EDIT_ITEM,
|
||||||
|
publication);
|
||||||
|
|
||||||
|
if (canEdit) {
|
||||||
|
final ControlLink link;
|
||||||
|
if (value instanceof GlobalizedMessage) {
|
||||||
|
link = new ControlLink(new Label((GlobalizedMessage) value));
|
||||||
|
} else {
|
||||||
|
link = new ControlLink(value.toString());
|
||||||
|
}
|
||||||
|
link.setConfirmation(PublicationTypeAssetGlobalizationUtil.globalize(
|
||||||
|
"scipublications.publication_type_asset.delete.confirm"));
|
||||||
|
return link;
|
||||||
|
} else {
|
||||||
|
final Label label;
|
||||||
|
if (value instanceof GlobalizedMessage) {
|
||||||
|
label = new Label((GlobalizedMessage) value);
|
||||||
|
} else {
|
||||||
|
label = new Label(value.toString());
|
||||||
|
}
|
||||||
|
return label;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private class ActionListener implements TableActionListener {
|
||||||
|
|
||||||
|
public ActionListener() {
|
||||||
|
//Nothing for now
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void cellSelected(final TableActionEvent event) {
|
||||||
|
final PageState state = event.getPageState();
|
||||||
|
|
||||||
|
final PublicationTypeAsset asset = new PublicationTypeAsset(new BigDecimal(event.getRowKey().toString()));
|
||||||
|
|
||||||
|
final TableColumn column = getColumnModel().get(event.getColumn().intValue());
|
||||||
|
|
||||||
|
if (TABLE_COL_EDIT.equals(column.getHeaderKey().toString())) {
|
||||||
|
typeModel.setSelectedObject(state, asset);
|
||||||
|
parent.setAddVisible(state);
|
||||||
|
} else if (TABLE_COL_EDIT.equals(column.getHeaderKey().toString())) {
|
||||||
|
asset.delete();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void headSelected(final TableActionEvent event) {
|
||||||
|
//Nothing
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue