Enhancements for localisation in several authoring step

git-svn-id: https://svn.libreccm.org/ccm/trunk@2763 8810af33-2d31-482b-a856-94f89814c4df
master
jensp 2014-07-17 13:47:03 +00:00
parent 4cdc5b3cd5
commit bca01fc9ee
32 changed files with 890 additions and 975 deletions

View File

@ -39,9 +39,9 @@ import javax.imageio.ImageIO;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
/** /**
* <p>An {@link com.arsdigita.cms.Asset asset} representing an image. An * <p>
* ImageAsset is deleted when its parent content item is deleted and is not * An {@link com.arsdigita.cms.Asset asset} representing an image. An ImageAsset is deleted when its
* intended to be reused between content items..</p> * parent content item is deleted and is not intended to be reused between content items..</p>
* *
* @see com.arsdigita.cms.ReusableImageAsset * @see com.arsdigita.cms.ReusableImageAsset
* @see com.arsdigita.cms.BinaryAsset * @see com.arsdigita.cms.BinaryAsset
@ -54,8 +54,7 @@ import org.apache.log4j.Logger;
*/ */
public class ImageAsset extends BinaryAsset { public class ImageAsset extends BinaryAsset {
public static final String BASE_DATA_OBJECT_TYPE = public static final String BASE_DATA_OBJECT_TYPE = "com.arsdigita.cms.ImageAsset";
"com.arsdigita.cms.ImageAsset";
public static final String CONTENT = "content"; public static final String CONTENT = "content";
public static final String HEIGHT = "height"; public static final String HEIGHT = "height";
public static final String WIDTH = "width"; public static final String WIDTH = "width";
@ -71,23 +70,18 @@ public class ImageAsset extends BinaryAsset {
} }
/** /**
* Constructor. The contained * Constructor. The contained <code>DataObject</code> is retrieved from the persistent storage
* <code>DataObject</code> is retrieved from the persistent storage * mechanism with an <code>OID</code> specified by <i>oid</i>.
* mechanism with an
* <code>OID</code> specified by <i>oid</i>.
* *
* @param oid The <code>OID</code> for the retrieved * @param oid The <code>OID</code> for the retrieved <code>DataObject</code>.
* <code>DataObject</code>.
*/ */
public ImageAsset(OID oid) throws DataObjectNotFoundException { public ImageAsset(OID oid) throws DataObjectNotFoundException {
super(oid); super(oid);
} }
/** /**
* Constructor. The contained * Constructor. The contained <code>DataObject</code> is retrieved from the persistent storage
* <code>DataObject</code> is retrieved from the persistent storage * mechanism with an <code>OID</code> specified by <i>id</i> and
* mechanism with an
* <code>OID</code> specified by <i>id</i> and
* <code>ImageAsset.BASE_DATA_OBJECT_TYPE</code>. * <code>ImageAsset.BASE_DATA_OBJECT_TYPE</code>.
* *
* @param id The <code>id</code> for the retrieved <code>DataObject</code>. * @param id The <code>id</code> for the retrieved <code>DataObject</code>.
@ -106,8 +100,8 @@ public class ImageAsset extends BinaryAsset {
} }
/** /**
* @return the base PDL object type for this item. Child classes should * @return the base PDL object type for this item. Child classes should override this method to
* override this method to return the correct value * return the correct value
*/ */
@Override @Override
public String getBaseDataObjectType() { public String getBaseDataObjectType() {
@ -149,9 +143,8 @@ public class ImageAsset extends BinaryAsset {
} }
/** /**
* Load the image asset from the specified file. Automatically guesses the * Load the image asset from the specified file. Automatically guesses the mime type of the
* mime type of the file. If the file is a jpeg, tries to automatically * file. If the file is a jpeg, tries to automatically determine width and height, as well.
* determine width and height, as well.
* *
* @param fileName The original name of the file * @param fileName The original name of the file
* @param file The actual file on the server * @param file The actual file on the server
@ -226,8 +219,9 @@ public class ImageAsset extends BinaryAsset {
* Find all images whose name matches the specified keyword * Find all images whose name matches the specified keyword
* *
* @param keyword a String keyword * @param keyword a String keyword
* @param context the context for the retrieved items. Should be * @param context the context for the retrieved items. Should be {@link ContentItem#DRAFT} or
* {@link ContentItem#DRAFT} or {@link ContentItem#LIVE} * {@link ContentItem#LIVE}
*
* @return a collection of images whose name matches the keyword * @return a collection of images whose name matches the keyword
*/ */
public static ImageAssetCollection getImagesByKeyword( public static ImageAssetCollection getImagesByKeyword(
@ -246,6 +240,7 @@ public class ImageAsset extends BinaryAsset {
* Find all images whose name matches the specified keyword * Find all images whose name matches the specified keyword
* *
* @param keyword a String keyword * @param keyword a String keyword
*
* @return a collection of images whose name matches the keyword * @return a collection of images whose name matches the keyword
*/ */
public static ImageAssetCollection getImagesByKeyword(String keyword) { public static ImageAssetCollection getImagesByKeyword(String keyword) {
@ -253,11 +248,11 @@ public class ImageAsset extends BinaryAsset {
} }
/** /**
* Resize this ImageAsset proportional to maxThumbnailWidth, if this * Resize this ImageAsset proportional to maxThumbnailWidth, if this ImageAsset is wider then
* ImageAsset is wider then maxThumbnailWidth. Else just return this * maxThumbnailWidth. Else just return this ImageAsset.
* ImageAsset.
* *
* @param maxThumbnailWidth max image width * @param maxThumbnailWidth max image width
*
* @return * @return
*/ */
public ImageAsset proportionalResizeToWidth(int maxThumbnailWidth) { public ImageAsset proportionalResizeToWidth(int maxThumbnailWidth) {
@ -278,12 +273,16 @@ public class ImageAsset extends BinaryAsset {
ByteArrayOutputStream scaledImageBuffer = new ByteArrayOutputStream(); ByteArrayOutputStream scaledImageBuffer = new ByteArrayOutputStream();
java.awt.Image scaledImage = origImage.getScaledInstance(maxThumbnailWidth, -1, java.awt.Image.SCALE_SMOOTH); java.awt.Image scaledImage = origImage.getScaledInstance(maxThumbnailWidth, -1,
java.awt.Image.SCALE_SMOOTH);
BufferedImage scaledBufImage = new BufferedImage(scaledImage.getWidth(null), scaledImage.getHeight(null), origImage.getType()); BufferedImage scaledBufImage = new BufferedImage(scaledImage.getWidth(null),
scaledImage.getHeight(null),
origImage.getType());
scaledBufImage.getGraphics().drawImage(scaledImage, 0, 0, null); scaledBufImage.getGraphics().drawImage(scaledImage, 0, 0, null);
ImageIO.write(scaledBufImage, this.getMimeType().getFileExtension(), scaledImageBuffer); ImageIO.write(scaledBufImage, this.getMimeType().getFileExtension(),
scaledImageBuffer);
imageAsset.setContent(scaledImageBuffer.toByteArray()); imageAsset.setContent(scaledImageBuffer.toByteArray());
imageAsset.setWidth(new BigDecimal(scaledImage.getWidth(null))); imageAsset.setWidth(new BigDecimal(scaledImage.getWidth(null)));
@ -303,6 +302,7 @@ public class ImageAsset extends BinaryAsset {
* Extract filename from path * Extract filename from path
* *
* @param fileName * @param fileName
*
* @return filename * @return filename
*/ */
protected String extractFilename(String fileName) { protected String extractFilename(String fileName) {
@ -326,4 +326,5 @@ public class ImageAsset extends BinaryAsset {
setWidth(new BigDecimal(image.getWidth())); setWidth(new BigDecimal(image.getWidth()));
setHeight(new BigDecimal(image.getHeight())); setHeight(new BigDecimal(image.getHeight()));
} }
} }

View File

@ -128,8 +128,8 @@ public class GenericContactAddressSheet extends Table implements TableActionList
case 0: case 0:
return address.getTitle(); return address.getTitle();
case 1: case 1:
return ContenttypesGlobalizationUtil.globalize( return new Label(ContenttypesGlobalizationUtil.globalize(
"cms.contenttypes.ui.contact.delete_address.button_label"); "cms.contenttypes.ui.contact.delete_address.button_label"));
default: default:
return null; return null;
} }
@ -208,7 +208,7 @@ public class GenericContactAddressSheet extends Table implements TableActionList
contact); contact);
if (canEdit) { if (canEdit) {
final ControlLink link = new ControlLink(new Label((GlobalizedMessage) value)); final ControlLink link = new ControlLink((Label) value);
link.setConfirmation(ContenttypesGlobalizationUtil.globalize( link.setConfirmation(ContenttypesGlobalizationUtil.globalize(
"cms.contenttypes.ui.contact.person.confirm_remove")); "cms.contenttypes.ui.contact.person.confirm_remove"));
return link; return link;

View File

@ -156,8 +156,8 @@ public class GenericContactPersonSheet extends Table implements TableActionListe
case 0: case 0:
return m_person.getFullName(); return m_person.getFullName();
case 1: case 1:
return ContenttypesGlobalizationUtil.globalize( return new Label(ContenttypesGlobalizationUtil.globalize(
"cms.contenttypes.ui.genericcontact.delete_person").localize(); "cms.contenttypes.ui.genericcontact.delete_person"));
default: default:
return null; return null;
} }
@ -238,14 +238,13 @@ public class GenericContactPersonSheet extends Table implements TableActionListe
contact); contact);
if (canEdit) { if (canEdit) {
ControlLink link = new ControlLink(value.toString()); ControlLink link = new ControlLink((Label)value);
link.setConfirmation(ContenttypesGlobalizationUtil.globalize( link.setConfirmation(ContenttypesGlobalizationUtil.globalize(
"cms.contenttypes.ui.contact.person" "cms.contenttypes.ui.contact.person"
+ ".confirm_remove")); + ".confirm_remove"));
return link; return link;
} else { } else {
Label label = new Label(value.toString()); return (Label) value;
return label;
} }
} }

View File

@ -109,6 +109,7 @@ public class GenericContactTypeTable extends Table implements TableActionListene
.getSelectedObject(state); .getSelectedObject(state);
return new GenericContactTypeTableModel(table, state, contacttype); return new GenericContactTypeTableModel(table, state, contacttype);
} }
} }
/** /**
@ -120,8 +121,8 @@ public class GenericContactTypeTable extends Table implements TableActionListene
final private int MAX_DESC_LENGTH = 25; final private int MAX_DESC_LENGTH = 25;
private Table m_table; private Table m_table;
private RelationAttribute m_contacttype; private RelationAttribute m_contacttype;
private GenericContactTypeCollection m_contacttypeCollection = new private GenericContactTypeCollection m_contacttypeCollection
GenericContactTypeCollection(); = new GenericContactTypeCollection();
private GenericContactTypeTableModel(Table t, private GenericContactTypeTableModel(Table t,
PageState ps, PageState ps,
@ -139,8 +140,8 @@ public class GenericContactTypeTable extends Table implements TableActionListene
/** /**
* Check collection for the existence of another row. * Check collection for the existence of another row.
* *
* If exists, fetch the value of current GenericPersonEntryCollection object * If exists, fetch the value of current GenericPersonEntryCollection object into m_comntact
* into m_comntact class variable. * class variable.
*/ */
public boolean nextRow() { public boolean nextRow() {
@ -157,6 +158,7 @@ public class GenericContactTypeTable extends Table implements TableActionListene
/** /**
* Return the * Return the
*
* @see com.arsdigita.bebop.table.TableModel#getElementAt(int) * @see com.arsdigita.bebop.table.TableModel#getElementAt(int)
*/ */
public Object getElementAt(int columnIndex) { public Object getElementAt(int columnIndex) {
@ -166,8 +168,7 @@ public class GenericContactTypeTable extends Table implements TableActionListene
case 1: case 1:
return m_contacttypeCollection.getName(); return m_contacttypeCollection.getName();
case 2: case 2:
return new Label(GlobalizationUtil.globalize("cms.ui.delete") return new Label(GlobalizationUtil.globalize("cms.ui.delete"));
);
default: default:
return null; return null;
} }
@ -180,11 +181,11 @@ public class GenericContactTypeTable extends Table implements TableActionListene
public Object getKeyAt(int columnIndex) { public Object getKeyAt(int columnIndex) {
return m_contacttype.getKey(); return m_contacttype.getKey();
} }
} }
/** /**
* Check for the permissions to edit item and put either a Label or * Check for the permissions to edit item and put either a Label or a ControlLink accordingly.
* a ControlLink accordingly.
*/ */
private class EditCellRenderer extends LockableImpl implements TableCellRenderer { private class EditCellRenderer extends LockableImpl implements TableCellRenderer {
@ -193,8 +194,7 @@ public class GenericContactTypeTable extends Table implements TableActionListene
int row, int column) { int row, int column) {
SecurityManager sm = Utilities.getSecurityManager(state); SecurityManager sm = Utilities.getSecurityManager(state);
RelationAttribute contacttype = (RelationAttribute) RelationAttribute contacttype = (RelationAttribute) m_itemModel.getSelectedObject(state);
m_itemModel.getSelectedObject(state);
// boolean canEdit = sm.canAccess(state.getRequest(), // boolean canEdit = sm.canAccess(state.getRequest(),
// SecurityManager.EDIT_ITEM, // SecurityManager.EDIT_ITEM,
@ -206,11 +206,11 @@ public class GenericContactTypeTable extends Table implements TableActionListene
// return new Label(value.toString()); // return new Label(value.toString());
// } // }
} }
} }
/** /**
* Check for the permissions to delete item and put either a Label or * Check for the permissions to delete item and put either a Label or a ControlLink accordingly.
* a ControlLink accordingly.
*/ */
private class DeleteCellRenderer extends LockableImpl implements TableCellRenderer { private class DeleteCellRenderer extends LockableImpl implements TableCellRenderer {
@ -219,14 +219,13 @@ public class GenericContactTypeTable extends Table implements TableActionListene
int row, int column) { int row, int column) {
SecurityManager sm = Utilities.getSecurityManager(state); SecurityManager sm = Utilities.getSecurityManager(state);
RelationAttribute contacttype = (RelationAttribute) RelationAttribute contacttype = (RelationAttribute) m_itemModel.getSelectedObject(state);
m_itemModel.getSelectedObject(state);
// boolean canDelete = sm.canAccess(state.getRequest(), // boolean canDelete = sm.canAccess(state.getRequest(),
// SecurityManager.DELETE_ITEM, // SecurityManager.DELETE_ITEM,
// contacttype); // contacttype);
// if (canDelete) { // if (canDelete) {
ControlLink link = new ControlLink(value.toString()); ControlLink link = new ControlLink((Label)value);
link.setConfirmation(ContenttypesGlobalizationUtil link.setConfirmation(ContenttypesGlobalizationUtil
.globalize( .globalize(
"cms.contenttypes.ui.contacttype.confirm_delete") "cms.contenttypes.ui.contacttype.confirm_delete")
@ -236,20 +235,20 @@ public class GenericContactTypeTable extends Table implements TableActionListene
// return new Label(value.toString()); // return new Label(value.toString());
// } // }
} }
} }
/** /**
* Provide implementation to TableActionListener method. * Provide implementation to TableActionListener method. Code that comes into picture when a
* Code that comes into picture when a link on the table is clicked. * link on the table is clicked. Handles edit and delete event.
* Handles edit and delete event.
*/ */
public void cellSelected(TableActionEvent evt) { public void cellSelected(TableActionEvent evt) {
PageState state = evt.getPageState(); PageState state = evt.getPageState();
// Get selected GenericContactType // Get selected GenericContactType
RelationAttribute contacttype = new RelationAttribute(new RelationAttribute contacttype = new RelationAttribute(new BigDecimal(evt.getRowKey()
BigDecimal(evt.getRowKey().toString())); .toString()));
// Get selected column // Get selected column
TableColumn col = getColumnModel().get(evt.getColumn().intValue()); TableColumn col = getColumnModel().get(evt.getColumn().intValue());
@ -266,10 +265,10 @@ public class GenericContactTypeTable extends Table implements TableActionListene
} }
/** /**
* provide Implementation to TableActionListener method. * provide Implementation to TableActionListener method. Does nothing in our case.
* Does nothing in our case.
*/ */
public void headSelected(TableActionEvent e) { public void headSelected(TableActionEvent e) {
throw new UnsupportedOperationException("Not Implemented"); throw new UnsupportedOperationException("Not Implemented");
} }
} }

View File

@ -313,10 +313,10 @@ public class GenericOrganizationalUnitContactTable extends Table implements
SecurityManager.EDIT_ITEM, SecurityManager.EDIT_ITEM,
orgaunit); orgaunit);
if (canEdit) { if (canEdit) {
ControlLink link = new ControlLink(value.toString()); ControlLink link = new ControlLink((Label) value);
return link; return link;
} else { } else {
return new Label(value.toString()); return new Label("");
} }
} }
} }
@ -344,14 +344,14 @@ public class GenericOrganizationalUnitContactTable extends Table implements
SecurityManager.DELETE_ITEM, SecurityManager.DELETE_ITEM,
orgaunit); orgaunit);
if (canDelete) { if (canDelete) {
ControlLink link = new ControlLink(value.toString()); ControlLink link = new ControlLink((Label) value);
link.setConfirmation(ContenttypesGlobalizationUtil. link.setConfirmation(ContenttypesGlobalizationUtil.
globalize( globalize(
"cms.contenttypes.ui.genericorgaunit.confirm_delete") "cms.contenttypes.ui.genericorgaunit.confirm_delete")
); );
return link; return link;
} else { } else {
return new Label(value.toString()); return new Label("");
} }
} }
} }

View File

@ -174,7 +174,7 @@ public class GenericOrganizationalUnitSubordinateOrgaUnitsTable
GlobalizationHelper.getNegotiatedLocale(). GlobalizationHelper.getNegotiatedLocale().
getLanguage()).getTitle(); getLanguage()).getTitle();
case 1: case 1:
return customizer.getDeleteLabel(); return new Label(customizer.getDeleteLabel());
case 2: case 2:
return customizer.getUpLabel(); return customizer.getUpLabel();
case 3: case 3:
@ -254,7 +254,7 @@ public class GenericOrganizationalUnitSubordinateOrgaUnitsTable
orgaunit); orgaunit);
if (canEdit) { if (canEdit) {
final ControlLink link = new ControlLink(value.toString()); final ControlLink link = new ControlLink((Label) value);
link.setConfirmation(customizer.getConfirmRemoveLabel()); link.setConfirmation(customizer.getConfirmRemoveLabel());
return link; return link;
} else { } else {

View File

@ -160,7 +160,7 @@ public class GenericOrganizationalUnitSuperiorOrgaUnitsTable extends Table {
case 0: case 0:
return superiorOrgaUnits.getTitle(); return superiorOrgaUnits.getTitle();
case 1: case 1:
return customizer.getDeleteLabel(); return new Label(customizer.getDeleteLabel());
case 2: case 2:
return customizer.getUpLabel(); return customizer.getUpLabel();
case 3: case 3:
@ -236,12 +236,11 @@ public class GenericOrganizationalUnitSuperiorOrgaUnitsTable extends Table {
orgaunit); orgaunit);
if (canEdit) { if (canEdit) {
final ControlLink link = new ControlLink(value.toString()); final ControlLink link = new ControlLink((Label) value);
link.setConfirmation(customizer.getConfirmRemoveLabel()); link.setConfirmation(customizer.getConfirmRemoveLabel());
return link; return link;
} else { } else {
final Label label = new Label(""); return new Label("");
return label;
} }
} }

View File

@ -314,12 +314,12 @@ public class GenericPersonContactTable extends Table implements
SecurityManager.DELETE_ITEM, SecurityManager.DELETE_ITEM,
person); person);
if (canDelete) { if (canDelete) {
ControlLink link = new ControlLink(value.toString()); ControlLink link = new ControlLink((Label) value);
link.setConfirmation(ContenttypesGlobalizationUtil. link.setConfirmation(ContenttypesGlobalizationUtil.
globalize("cms.contenttypes.ui.person.confirm_delete")); globalize("cms.contenttypes.ui.person.confirm_delete"));
return link; return link;
} else { } else {
return new Label((GlobalizedMessage) value); return new Label("");
} }
} }
} }

View File

@ -141,8 +141,8 @@ public class SciPublicationsAboutDiscussesTable extends Table implements TableAc
case 0: case 0:
return discussed.getTitle(); return discussed.getTitle();
case 1: case 1:
return SciPublicationsAboutGlobalizationUtil.globalize( return new Label(SciPublicationsAboutGlobalizationUtil.globalize(
"com.arsdigita.cms.contentassets.about.discusses.publication.remove"); "com.arsdigita.cms.contentassets.about.discusses.publication.remove"));
default: default:
return null; return null;
} }
@ -215,12 +215,12 @@ public class SciPublicationsAboutDiscussesTable extends Table implements TableAc
discussing); discussing);
if (canEdit) { if (canEdit) {
final ControlLink link = new ControlLink(new Label((GlobalizedMessage) value)); final ControlLink link = new ControlLink((Label) value);
link.setConfirmation(SciPublicationsAboutGlobalizationUtil.globalize( link.setConfirmation(SciPublicationsAboutGlobalizationUtil.globalize(
"com.arsdigita.cms.contentassets.about.discusses.publication.remove.confirm")); "com.arsdigita.cms.contentassets.about.discusses.publication.remove.confirm"));
return link; return link;
} else { } else {
return new Label(value.toString()); return new Label("");
} }
} }

View File

@ -141,8 +141,8 @@ public class SciPublicationsAboutDiscussingTable extends Table implements TableA
case 0: case 0:
return discussing.getTitle(); return discussing.getTitle();
case 1: case 1:
return SciPublicationsAboutGlobalizationUtil.globalize( return new Label(SciPublicationsAboutGlobalizationUtil.globalize(
"com.arsdigita.cms.contentassets.about.discussing.publication.remove"); "com.arsdigita.cms.contentassets.about.discussing.publication.remove"));
default: default:
return null; return null;
} }
@ -152,6 +152,7 @@ public class SciPublicationsAboutDiscussingTable extends Table implements TableA
public Object getKeyAt(final int columnIndex) { public Object getKeyAt(final int columnIndex) {
return discussing.getID(); return discussing.getID();
} }
} }
private class PublicationCellRenderer extends LockableImpl implements TableCellRenderer { private class PublicationCellRenderer extends LockableImpl implements TableCellRenderer {
@ -214,12 +215,12 @@ public class SciPublicationsAboutDiscussingTable extends Table implements TableA
discussed); discussed);
if (canEdit) { if (canEdit) {
final ControlLink link = new ControlLink(new Label((GlobalizedMessage) value)); final ControlLink link = new ControlLink((Label) value);
link.setConfirmation(SciPublicationsAboutGlobalizationUtil.globalize( link.setConfirmation(SciPublicationsAboutGlobalizationUtil.globalize(
"com.arsdigita.cms.contentassets.about.discussing.publication.remove.confirm")); "com.arsdigita.cms.contentassets.about.discussing.publication.remove.confirm"));
return link; return link;
} else { } else {
return new Label(value.toString()); return new Label("");
} }
} }

View File

@ -156,9 +156,9 @@ public class LibrarySignaturesTable extends Table {
case 2: case 2:
return librarySignatures.get(LibrarySignature.LIBRARY_LINK); return librarySignatures.get(LibrarySignature.LIBRARY_LINK);
case 3: case 3:
return LibrarySignaturesGlobalizationUtil.globalize("scipublications.librarysignatures.edit"); return new Label(LibrarySignaturesGlobalizationUtil.globalize("scipublications.librarysignatures.edit"));
case 4: case 4:
return LibrarySignaturesGlobalizationUtil.globalize("scipublications.librarysignatures.delete"); return new Label(LibrarySignaturesGlobalizationUtil.globalize("scipublications.librarysignatures.delete"));
default: default:
return null; return null;
} }
@ -193,25 +193,10 @@ public class LibrarySignaturesTable extends Table {
publication); publication);
if (canEdit) { if (canEdit) {
final ControlLink link; final ControlLink link= new ControlLink((Label) value);
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; return link;
} else { } else {
final Label label; return new 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;
} }
} }
@ -239,23 +224,12 @@ public class LibrarySignaturesTable extends Table {
publication); publication);
if (canEdit) { if (canEdit) {
final ControlLink link; final ControlLink link = new ControlLink((Label) value);
if (value instanceof GlobalizedMessage) {
link = new ControlLink(new Label((GlobalizedMessage) value));
} else {
link = new ControlLink(value.toString());
}
link.setConfirmation(LibrarySignaturesGlobalizationUtil.globalize( link.setConfirmation(LibrarySignaturesGlobalizationUtil.globalize(
"scipublications.librarysignatures.delete.confirm")); "scipublications.librarysignatures.delete.confirm"));
return link; return link;
} else { } else {
final Label label; return new Label("");
if (value instanceof GlobalizedMessage) {
label = new Label((GlobalizedMessage) value);
} else {
label = new Label(value.toString());
}
return label;
} }
} }

View File

@ -161,8 +161,8 @@ public class SciPublicationsPersonsPersonTable extends Table implements TableAct
case 1: case 1:
return relation; return relation;
case 2: case 2:
return globalisationUtil.globalize( return new Label(globalisationUtil.globalize(
"com.arsdigita.cms.contentassets.publication_persons.person.remove"); "com.arsdigita.cms.contentassets.publication_persons.person.remove"));
default: default:
return null; return null;
} }
@ -230,28 +230,12 @@ public class SciPublicationsPersonsPersonTable extends Table implements TableAct
final int row, final int row,
final int column) { final int column) {
final GlobalizedMessage relation = new GlobalizedMessage((String) value, final GlobalizedMessage relation = new GlobalizedMessage(
(String) value,
SciPublicationsPersonsService.RELATION_ATTRIBUTE, SciPublicationsPersonsService.RELATION_ATTRIBUTE,
new RelationAttributeResourceBundleControl()); new RelationAttributeResourceBundleControl());
return new Label(relation); return new Label(relation);
// final String relation = (String) value;
//
// final RelationAttributeCollection relations = new RelationAttributeCollection(
// SciPublicationsPersonsService.RELATION_ATTRIBUTE,
// relation);
// relations.addLanguageFilter(GlobalizationHelper.getNegotiatedLocale().getLanguage());
// if (relations.isEmpty()) {
// return new Label(relation);
// } else {
// relations.next();
// final String label = relations.getName();
// relations.close();
// return new Label(label);
// }
//return new Label(value.toString());
} }
} }
@ -275,12 +259,12 @@ public class SciPublicationsPersonsPersonTable extends Table implements TableAct
publication); publication);
if (canEdit) { if (canEdit) {
final ControlLink link = new ControlLink(new Label((GlobalizedMessage) value)); final ControlLink link = new ControlLink((Label) value);
link.setConfirmation(globalisationUtil.globalize( link.setConfirmation(globalisationUtil.globalize(
"com.arsdigita.cms.contentassets.publications_persons.person.remove.confirm")); "com.arsdigita.cms.contentassets.publications_persons.person.remove.confirm"));
return link; return link;
} else { } else {
return new Label((GlobalizedMessage) value); return new Label("");
} }
} }

View File

@ -73,23 +73,28 @@ public class PublicationTypeAssetTable extends Table {
columnModel.add(new TableColumn( columnModel.add(new TableColumn(
0, 0,
PublicationTypeAssetGlobalizationUtil.globalize("scipublications.publication_type_asset.type"), PublicationTypeAssetGlobalizationUtil.globalize(
"scipublications.publication_type_asset.type"),
TABLE_COL_TYPE)); TABLE_COL_TYPE));
columnModel.add(new TableColumn( columnModel.add(new TableColumn(
1, 1,
PublicationTypeAssetGlobalizationUtil.globalize("scipublications.publication_type_asset.isbn"), PublicationTypeAssetGlobalizationUtil.globalize(
"scipublications.publication_type_asset.isbn"),
TABLE_COL_ISBN)); TABLE_COL_ISBN));
columnModel.add(new TableColumn( columnModel.add(new TableColumn(
2, 2,
PublicationTypeAssetGlobalizationUtil.globalize("scipublications.publication_type_asset.misc"), PublicationTypeAssetGlobalizationUtil.globalize(
"scipublications.publication_type_asset.misc"),
TABLE_COL_MISC)); TABLE_COL_MISC));
columnModel.add(new TableColumn( columnModel.add(new TableColumn(
3, 3,
PublicationTypeAssetGlobalizationUtil.globalize("scipublications.publication_type_asset.edit"), PublicationTypeAssetGlobalizationUtil.globalize(
"scipublications.publication_type_asset.edit"),
TABLE_COL_EDIT)); TABLE_COL_EDIT));
columnModel.add(new TableColumn( columnModel.add(new TableColumn(
4, 4,
PublicationTypeAssetGlobalizationUtil.globalize("scipublications.publication_type_asset.delete"), PublicationTypeAssetGlobalizationUtil.globalize(
"scipublications.publication_type_asset.delete"),
TABLE_COL_DEL)); TABLE_COL_DEL));
setModelBuilder(new ModelBuilder(itemModel)); setModelBuilder(new ModelBuilder(itemModel));
@ -150,11 +155,11 @@ public class PublicationTypeAssetTable extends Table {
case 2: case 2:
return typeAssets.get(PublicationTypeAsset.MISC); return typeAssets.get(PublicationTypeAsset.MISC);
case 3: case 3:
return PublicationTypeAssetGlobalizationUtil.globalize( return new Label(PublicationTypeAssetGlobalizationUtil.globalize(
"scipublications.publication_type_asset.edit"); "scipublications.publication_type_asset.edit"));
case 4: case 4:
return PublicationTypeAssetGlobalizationUtil.globalize( return new Label(PublicationTypeAssetGlobalizationUtil.globalize(
"scipublications.publication_type_asset.delete"); "scipublications.publication_type_asset.delete"));
default: default:
return null; return null;
} }
@ -189,25 +194,11 @@ public class PublicationTypeAssetTable extends Table {
publication); publication);
if (canEdit) { if (canEdit) {
final ControlLink link; final ControlLink link = new ControlLink((Label) value);
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; return link;
} else { } else {
final Label label; final Label label;
if (value instanceof GlobalizedMessage) { return new Label("");
label = new Label((GlobalizedMessage) value);
} else if (value == null) {
return new Label("???");
} else {
label = new Label(value.toString());
}
return label;
} }
} }
@ -235,23 +226,12 @@ public class PublicationTypeAssetTable extends Table {
publication); publication);
if (canEdit) { if (canEdit) {
final ControlLink link; final ControlLink link = new ControlLink((Label) value);
if (value instanceof GlobalizedMessage) {
link = new ControlLink(new Label((GlobalizedMessage) value));
} else {
link = new ControlLink(value.toString());
}
link.setConfirmation(PublicationTypeAssetGlobalizationUtil.globalize( link.setConfirmation(PublicationTypeAssetGlobalizationUtil.globalize(
"scipublications.publication_type_asset.delete.confirm")); "scipublications.publication_type_asset.delete.confirm"));
return link; return link;
} else { } else {
final Label label; return new Label("");
if (value instanceof GlobalizedMessage) {
label = new Label((GlobalizedMessage) value);
} else {
label = new Label(value.toString());
}
return label;
} }
} }
@ -268,7 +248,8 @@ public class PublicationTypeAssetTable extends Table {
public void cellSelected(final TableActionEvent event) { public void cellSelected(final TableActionEvent event) {
final PageState state = event.getPageState(); final PageState state = event.getPageState();
final PublicationTypeAsset asset = new PublicationTypeAsset(new BigDecimal(event.getRowKey().toString())); final PublicationTypeAsset asset = new PublicationTypeAsset(new BigDecimal(event
.getRowKey().toString()));
final TableColumn column = getColumnModel().get(event.getColumn().intValue()); final TableColumn column = getColumnModel().get(event.getColumn().intValue());
@ -286,4 +267,5 @@ public class PublicationTypeAssetTable extends Table {
} }
} }
} }

View File

@ -234,7 +234,7 @@ public class SciPublicationsMovieDirectorSheet
movie); movie);
if (canEdit) { if (canEdit) {
final ControlLink link = new ControlLink((Label)value); final ControlLink link = new ControlLink((Label) value);
link.setConfirmation(globalisationUtil.globalize( link.setConfirmation(globalisationUtil.globalize(
"publications.dramaticarts.ui.movie.director.remove.confirm")); "publications.dramaticarts.ui.movie.director.remove.confirm"));
return link; return link;

View File

@ -152,9 +152,8 @@ public class ArticleInCollectedVolumeCollectedVolumeSheet
case 0: case 0:
return collectedVolume.getTitle(); return collectedVolume.getTitle();
case 1: case 1:
return PublicationGlobalizationUtil.globalize( return new Label(PublicationGlobalizationUtil.globalize(
"publications.ui.articleInCollectedVolume.collectedVolume.remove"). "publications.ui.articleInCollectedVolume.collectedVolume.remove"));
localize();
default: default:
return null; return null;
} }
@ -244,15 +243,14 @@ public class ArticleInCollectedVolumeCollectedVolumeSheet
article); article);
if (canEdit) { if (canEdit) {
ControlLink link = new ControlLink(value.toString()); ControlLink link = new ControlLink((Label) value);
link.setConfirmation( link.setConfirmation(
PublicationGlobalizationUtil.globalize( PublicationGlobalizationUtil.globalize(
"publications.ui.articleInCollectedVolume.collectedVolume." "publications.ui.articleInCollectedVolume.collectedVolume."
+ "confirm_remove")); + "confirm_remove"));
return link; return link;
} else { } else {
Label label = new Label(value.toString()); return new Label("");
return label;
} }
} }

View File

@ -142,9 +142,8 @@ public class ArticleInJournalJournalSheet
case 0: case 0:
return journal.getTitle(); return journal.getTitle();
case 1: case 1:
return PublicationGlobalizationUtil.globalize( return new Label(PublicationGlobalizationUtil.globalize(
"publications.ui.articleInCollectedVolume.collectedVolume.remove"). "publications.ui.articleInCollectedVolume.collectedVolume.remove"));
localize();
default: default:
return null; return null;
} }
@ -227,15 +226,13 @@ public class ArticleInJournalJournalSheet
article); article);
if (canEdit) { if (canEdit) {
ControlLink link = new ControlLink(value.toString()); ControlLink link = new ControlLink((Label) value);
link.setConfirmation( link.setConfirmation(
(String) PublicationGlobalizationUtil.globalize( PublicationGlobalizationUtil.globalize(
"publication.ui.articleInJournal.journal.confirm_remove"). "publication.ui.articleInJournal.journal.confirm_remove"));
localize());
return link; return link;
} else { } else {
Label label = new Label(value.toString()); return new Label("");
return label;
} }
} }
} }

View File

@ -53,8 +53,7 @@ public class CollectedVolumeArticlesTable
extends Table extends Table
implements TableActionListener { implements TableActionListener {
private static final Logger s_log = private static final Logger s_log = Logger.getLogger(
Logger.getLogger(
CollectedVolumeArticlesTable.class); CollectedVolumeArticlesTable.class);
private final String TABLE_COL_EDIT = "table_col_edit"; private final String TABLE_COL_EDIT = "table_col_edit";
private final String TABLE_COL_DEL = "table_col_del"; private final String TABLE_COL_DEL = "table_col_del";
@ -117,13 +116,13 @@ public class CollectedVolumeArticlesTable
@Override @Override
public TableModel makeModel(Table table, PageState state) { public TableModel makeModel(Table table, PageState state) {
table.getRowSelectionModel().clearSelection(state); table.getRowSelectionModel().clearSelection(state);
CollectedVolume collectedVolume = CollectedVolume collectedVolume = (CollectedVolume) m_itemModel.getSelectedObject(
(CollectedVolume) m_itemModel.getSelectedObject(
state); state);
return new CollectedVolumeArticlesTableModel(table, return new CollectedVolumeArticlesTableModel(table,
state, state,
collectedVolume); collectedVolume);
} }
} }
private class CollectedVolumeArticlesTableModel implements TableModel { private class CollectedVolumeArticlesTableModel implements TableModel {
@ -176,6 +175,7 @@ public class CollectedVolumeArticlesTable
public Object getKeyAt(int columnIndex) { public Object getKeyAt(int columnIndex) {
return m_article.getID(); return m_article.getID();
} }
} }
private class EditCellRenderer private class EditCellRenderer
@ -190,8 +190,7 @@ public class CollectedVolumeArticlesTable
Object key, Object key,
int row, int row,
int col) { int col) {
SecurityManager securityManager = SecurityManager securityManager = Utilities.getSecurityManager(state);
Utilities.getSecurityManager(state);
CollectedVolume collectedVolume = (CollectedVolume) m_itemModel. CollectedVolume collectedVolume = (CollectedVolume) m_itemModel.
getSelectedObject(state); getSelectedObject(state);
@ -213,8 +212,7 @@ public class CollectedVolumeArticlesTable
ContentSection section = article.getContentSection();//CMS.getContext().getContentSection(); ContentSection section = article.getContentSection();//CMS.getContext().getContentSection();
ItemResolver resolver = section.getItemResolver(); ItemResolver resolver = section.getItemResolver();
Link link = Link link = new Link(value.toString(),
new Link(value.toString(),
resolver.generateItemURL(state, resolver.generateItemURL(state,
article, article,
section, section,
@ -236,6 +234,7 @@ public class CollectedVolumeArticlesTable
return label; return label;
} }
} }
} }
private class DeleteCellRenderer private class DeleteCellRenderer
@ -250,10 +249,8 @@ public class CollectedVolumeArticlesTable
Object key, Object key,
int row, int row,
int col) { int col) {
SecurityManager securityManager = SecurityManager securityManager = Utilities.getSecurityManager(state);
Utilities.getSecurityManager(state); CollectedVolume collectedVolume = (CollectedVolume) m_itemModel.getSelectedObject(
CollectedVolume collectedVolume =
(CollectedVolume) m_itemModel.getSelectedObject(
state); state);
boolean canEdit = securityManager.canAccess( boolean canEdit = securityManager.canAccess(
@ -262,15 +259,15 @@ public class CollectedVolumeArticlesTable
collectedVolume); collectedVolume);
if (canEdit) { if (canEdit) {
ControlLink link = new ControlLink(value.toString()); ControlLink link = new ControlLink((Label) value);
link.setConfirmation(PublicationGlobalizationUtil.globalize( link.setConfirmation(PublicationGlobalizationUtil.globalize(
"publications.ui.collected_volume.articles.confirm_remove")); "publications.ui.collected_volume.articles.confirm_remove"));
return link; return link;
} else { } else {
Label label = new Label(value.toString()); return new Label("");
return label;
} }
} }
} }
private class UpCellRenderer private class UpCellRenderer
@ -296,6 +293,7 @@ public class CollectedVolumeArticlesTable
return link; return link;
} }
} }
} }
private class DownCellRenderer private class DownCellRenderer
@ -312,11 +310,9 @@ public class CollectedVolumeArticlesTable
int row, int row,
int col) { int col) {
CollectedVolume collectedVolume = CollectedVolume collectedVolume = (CollectedVolume) m_itemModel.getSelectedObject(
(CollectedVolume) m_itemModel.getSelectedObject(
state); state);
ArticleInCollectedVolumeCollection articles = ArticleInCollectedVolumeCollection articles = collectedVolume.getArticles();
collectedVolume.getArticles();
if ((articles.size() - 1) == row) { if ((articles.size() - 1) == row) {
s_log.debug("Row is last row in table, don't show down link"); s_log.debug("Row is last row in table, don't show down link");
@ -327,21 +323,19 @@ public class CollectedVolumeArticlesTable
return link; return link;
} }
} }
} }
@Override @Override
public void cellSelected(TableActionEvent event) { public void cellSelected(TableActionEvent event) {
PageState state = event.getPageState(); PageState state = event.getPageState();
ArticleInCollectedVolume article = ArticleInCollectedVolume article = new ArticleInCollectedVolume(
new ArticleInCollectedVolume(
new BigDecimal(event.getRowKey().toString())); new BigDecimal(event.getRowKey().toString()));
CollectedVolume collectedVolume = CollectedVolume collectedVolume = (CollectedVolume) m_itemModel.getSelectedObject(state);
(CollectedVolume) m_itemModel.getSelectedObject(state);
ArticleInCollectedVolumeCollection articles = ArticleInCollectedVolumeCollection articles = collectedVolume.getArticles();
collectedVolume.getArticles();
TableColumn column = getColumnModel().get(event.getColumn().intValue()); TableColumn column = getColumnModel().get(event.getColumn().intValue());
@ -359,4 +353,5 @@ public class CollectedVolumeArticlesTable
public void headSelected(TableActionEvent event) { public void headSelected(TableActionEvent event) {
//Nothing to do. //Nothing to do.
} }
} }

View File

@ -231,13 +231,12 @@ public class ExpertiseOrdererSheet
expertise); expertise);
if (canEdit) { if (canEdit) {
ControlLink link = new ControlLink(value.toString()); ControlLink link = new ControlLink((Label) value);
link.setConfirmation(PublicationGlobalizationUtil.globalize( link.setConfirmation(PublicationGlobalizationUtil.globalize(
"publication.ui.expertise.orderer.remove.confirm")); "publication.ui.expertise.orderer.remove.confirm"));
return link; return link;
} else { } else {
Label label = new Label(value.toString()); return new Label("");
return label;
} }
} }
} }

View File

@ -231,13 +231,12 @@ public class ExpertiseOrganizationSheet
expertise); expertise);
if (canEdit) { if (canEdit) {
ControlLink link = new ControlLink(value.toString()); ControlLink link = new ControlLink((Label) value);
link.setConfirmation(PublicationGlobalizationUtil.globalize( link.setConfirmation(PublicationGlobalizationUtil.globalize(
"publication.ui.expertise.organization.remove.confirm")); "publication.ui.expertise.organization.remove.confirm"));
return link; return link;
} else { } else {
Label label = new Label(value.toString()); return new Label("");
return label;
} }
} }
} }

View File

@ -142,9 +142,8 @@ public class GenericOrganizationalUnitPublicationsTable
case 0: case 0:
return publications.getPublication().getTitle(); return publications.getPublication().getTitle();
case 1: case 1:
return PublicationGlobalizationUtil.globalize( return new Label(PublicationGlobalizationUtil.globalize(
"genericorganizationalunit.ui.publications.remove"). "genericorganizationalunit.ui.publications.remove"));
localize();
default: default:
return null; return null;
} }
@ -219,13 +218,12 @@ public class GenericOrganizationalUnitPublicationsTable
orgaunit); orgaunit);
if (canEdit) { if (canEdit) {
final ControlLink link = new ControlLink(value.toString()); final ControlLink link = new ControlLink((Label) value);
link.setConfirmation(PublicationGlobalizationUtil.globalize( link.setConfirmation(PublicationGlobalizationUtil.globalize(
"genericorganizationalunit.ui.publications.remove.confirm")); "genericorganizationalunit.ui.publications.remove.confirm"));
return link; return link;
} else { } else {
final Label label = new Label(value.toString()); return new Label("");
return label;
} }
} }

View File

@ -242,13 +242,12 @@ public class InProceedingsProceedingsSheet
inProceedings); inProceedings);
if (canEdit) { if (canEdit) {
ControlLink link = new ControlLink(value.toString()); ControlLink link = new ControlLink((Label) value);
link.setConfirmation(PublicationGlobalizationUtil.globalize( link.setConfirmation(PublicationGlobalizationUtil.globalize(
"publications.ui.inProceedings.proceedings.confirm_remove")); "publications.ui.inProceedings.proceedings.confirm_remove"));
return link; return link;
} else { } else {
Label label = new Label(value.toString()); return new Label("");
return label;
} }
} }
} }

View File

@ -242,13 +242,12 @@ public class InternetArticleOrganizationSheet
article); article);
if (canEdit) { if (canEdit) {
ControlLink link = new ControlLink(value.toString()); ControlLink link = new ControlLink((Label) value);
link.setConfirmation(PublicationGlobalizationUtil.globalize( link.setConfirmation(PublicationGlobalizationUtil.globalize(
"publications.ui.internetarticle.organization.remove.confirm")); "publications.ui.internetarticle.organization.remove.confirm"));
return link; return link;
} else { } else {
Label label = new Label(value.toString()); return new Label("");
return label;
} }
} }
} }

View File

@ -112,13 +112,13 @@ public class JournalArticlesTable
@Override @Override
public TableModel makeModel(Table table, PageState state) { public TableModel makeModel(Table table, PageState state) {
table.getRowSelectionModel().clearSelection(state); table.getRowSelectionModel().clearSelection(state);
Journal collectedVolume = Journal collectedVolume = (Journal) m_itemModel.getSelectedObject(
(Journal) m_itemModel.getSelectedObject(
state); state);
return new JournalArticlesTableModel(table, return new JournalArticlesTableModel(table,
state, state,
collectedVolume); collectedVolume);
} }
} }
private class JournalArticlesTableModel implements TableModel { private class JournalArticlesTableModel implements TableModel {
@ -170,6 +170,7 @@ public class JournalArticlesTable
public Object getKeyAt(int columnIndex) { public Object getKeyAt(int columnIndex) {
return m_article.getID(); return m_article.getID();
} }
} }
private class EditCellRenderer private class EditCellRenderer
@ -184,8 +185,7 @@ public class JournalArticlesTable
Object key, Object key,
int row, int row,
int col) { int col) {
com.arsdigita.cms.SecurityManager securityManager = com.arsdigita.cms.SecurityManager securityManager = Utilities.getSecurityManager(state);
Utilities.getSecurityManager(state);
Journal journal = (Journal) m_itemModel.getSelectedObject(state); Journal journal = (Journal) m_itemModel.getSelectedObject(state);
boolean canEdit = securityManager.canAccess( boolean canEdit = securityManager.canAccess(
@ -205,8 +205,7 @@ public class JournalArticlesTable
} }
ContentSection section = article.getContentSection();//CMS.getContext().getContentSection(); ContentSection section = article.getContentSection();//CMS.getContext().getContentSection();
ItemResolver resolver = section.getItemResolver(); ItemResolver resolver = section.getItemResolver();
Link link = Link link = new Link(String.format("%s (%s)",
new Link(String.format("%s (%s)",
value.toString(), value.toString(),
article.getLanguage()), article.getLanguage()),
resolver.generateItemURL(state, resolver.generateItemURL(state,
@ -231,6 +230,7 @@ public class JournalArticlesTable
return label; return label;
} }
} }
} }
private class DeleteCellRenderer extends LockableImpl implements private class DeleteCellRenderer extends LockableImpl implements
@ -255,14 +255,15 @@ public class JournalArticlesTable
com.arsdigita.cms.SecurityManager.DELETE_ITEM, com.arsdigita.cms.SecurityManager.DELETE_ITEM,
journal); journal);
if (canEdit) { if (canEdit) {
ControlLink link = new ControlLink(value.toString()); ControlLink link = new ControlLink((Label) value);
link.setConfirmation(PublicationGlobalizationUtil.globalize( link.setConfirmation(PublicationGlobalizationUtil.globalize(
"cms.contenttypes.ui.journal.articles.confirm_delete")); "cms.contenttypes.ui.journal.articles.confirm_delete"));
return link; return link;
} else { } else {
return new Label(value.toString()); return new Label("");
} }
} }
} }
private class UpCellRenderer private class UpCellRenderer
@ -289,6 +290,7 @@ public class JournalArticlesTable
return link; return link;
} }
} }
} }
private class DownCellRenderer private class DownCellRenderer
@ -318,6 +320,7 @@ public class JournalArticlesTable
return link; return link;
} }
} }
} }
@Override @Override
@ -353,4 +356,5 @@ public class JournalArticlesTable
public void headSelected(TableActionEvent event) { public void headSelected(TableActionEvent event) {
//Nothing to do //Nothing to do
} }
} }

View File

@ -234,13 +234,12 @@ public class ProceedingsOrganizerSheet
proceedings); proceedings);
if (canEdit) { if (canEdit) {
ControlLink link = new ControlLink(value.toString()); ControlLink link = new ControlLink((Label) value);
link.setConfirmation(PublicationGlobalizationUtil.globalize( link.setConfirmation(PublicationGlobalizationUtil.globalize(
"publications.ui.proceedings.organizer.remove.confirm")); "publications.ui.proceedings.organizer.remove.confirm"));
return link; return link;
} else { } else {
Label label = new Label(value.toString()); return new Label("");
return label;
} }
} }
} }

View File

@ -269,13 +269,12 @@ public class ProceedingsPapersTable
proceedings); proceedings);
if (canEdit) { if (canEdit) {
ControlLink link = new ControlLink(value.toString()); ControlLink link = new ControlLink((Label) value);
link.setConfirmation(PublicationGlobalizationUtil.globalize( link.setConfirmation(PublicationGlobalizationUtil.globalize(
"publications.ui.proceedings.paper.confirm_remove")); "publications.ui.proceedings.paper.confirm_remove"));
return link; return link;
} else { } else {
Label label = new Label(value.toString()); return new Label("");
return label;
} }
} }
} }

View File

@ -309,7 +309,7 @@ public class PublicationAuthorsTable
ControlLink link = new ControlLink((Label) value); ControlLink link = new ControlLink((Label) value);
return link; return link;
} else { } else {
return (Label) value; return new Label("");
} }
} }
@ -342,7 +342,7 @@ public class PublicationAuthorsTable
"publications.ui.authors.author.confirm_remove")); "publications.ui.authors.author.confirm_remove"));
return link; return link;
} else { } else {
return (Label) value; return new Label("");
} }
} }

View File

@ -167,8 +167,7 @@ public class PublicationGenericOrganizationalUnitsTable extends Table {
final int row, final int row,
final int column) { final int column) {
final com.arsdigita.cms.SecurityManager securityManager = CMS.getSecurityManager(state); final com.arsdigita.cms.SecurityManager securityManager = CMS.getSecurityManager(state);
final GenericOrganizationalUnit orgaunit = final GenericOrganizationalUnit orgaunit = new GenericOrganizationalUnit(
new GenericOrganizationalUnit(
(BigDecimal) key); (BigDecimal) key);
final boolean canEdit = securityManager.canAccess( final boolean canEdit = securityManager.canAccess(
@ -211,9 +210,7 @@ public class PublicationGenericOrganizationalUnitsTable extends Table {
final int row, final int row,
final int column) { final int column) {
final com.arsdigita.cms.SecurityManager securityManager = CMS.getSecurityManager(state); final com.arsdigita.cms.SecurityManager securityManager = CMS.getSecurityManager(state);
final Publication publication = final Publication publication = (Publication) itemModel.getSelectedObject(state);
(Publication) itemModel.getSelectedObject(state);
boolean canEdit = securityManager.canAccess( boolean canEdit = securityManager.canAccess(
state.getRequest(), state.getRequest(),
@ -221,13 +218,12 @@ public class PublicationGenericOrganizationalUnitsTable extends Table {
publication); publication);
if (canEdit) { if (canEdit) {
final ControlLink link = new ControlLink(value.toString()); final ControlLink link = new ControlLink((Label) value);
link.setConfirmation(PublicationGlobalizationUtil.globalize( link.setConfirmation(PublicationGlobalizationUtil.globalize(
"publications.ui.orgaunits.remove.confirm")); "publications.ui.orgaunits.remove.confirm"));
return link; return link;
} else { } else {
final Label label = new Label(""); return new Label("");
return label;
} }
} }
@ -239,8 +235,7 @@ public class PublicationGenericOrganizationalUnitsTable extends Table {
public void cellSelected(final TableActionEvent event) { public void cellSelected(final TableActionEvent event) {
final PageState state = event.getPageState(); final PageState state = event.getPageState();
final GenericOrganizationalUnit orgaunit = final GenericOrganizationalUnit orgaunit = new GenericOrganizationalUnit(
new GenericOrganizationalUnit(
new BigDecimal(event.getRowKey().toString())); new BigDecimal(event.getRowKey().toString()));
final Publication publication = (Publication) itemModel. final Publication publication = (Publication) itemModel.
getSelectedObject(state); getSelectedObject(state);
@ -264,4 +259,5 @@ public class PublicationGenericOrganizationalUnitsTable extends Table {
} }
} }
} }

View File

@ -95,13 +95,13 @@ public class PublicationWithPublisherSetPublisherSheet
@Override @Override
public TableModel makeModel(final Table table, final PageState state) { public TableModel makeModel(final Table table, final PageState state) {
table.getRowSelectionModel().clearSelection(state); table.getRowSelectionModel().clearSelection(state);
PublicationWithPublisher publication = PublicationWithPublisher publication = (PublicationWithPublisher) itemModel.
(PublicationWithPublisher) itemModel.
getSelectedObject(state); getSelectedObject(state);
return new PublicationWithPublisherSetPublisherSheetModel(table, return new PublicationWithPublisherSetPublisherSheetModel(table,
state, state,
publication); publication);
} }
} }
private class PublicationWithPublisherSetPublisherSheetModel private class PublicationWithPublisherSetPublisherSheetModel
@ -159,6 +159,7 @@ public class PublicationWithPublisherSetPublisherSheet
public Object getKeyAt(final int columnIndex) { public Object getKeyAt(final int columnIndex) {
return publisher.getID(); return publisher.getID();
} }
} }
private class EditCellRenderer private class EditCellRenderer
@ -173,10 +174,8 @@ public class PublicationWithPublisherSetPublisherSheet
Object key, Object key,
int row, int row,
int column) { int column) {
com.arsdigita.cms.SecurityManager securityManager = com.arsdigita.cms.SecurityManager securityManager = CMS.getSecurityManager(state);
CMS.getSecurityManager(state); PublicationWithPublisher publication = (PublicationWithPublisher) itemModel.
PublicationWithPublisher publication =
(PublicationWithPublisher) itemModel.
getSelectedObject(state); getSelectedObject(state);
boolean canEdit = securityManager.canAccess(state.getRequest(), boolean canEdit = securityManager.canAccess(state.getRequest(),
@ -193,8 +192,7 @@ public class PublicationWithPublisherSetPublisherSheet
ContentSection section = publisher.getContentSection();//CMS.getContext().getContentSection(); ContentSection section = publisher.getContentSection();//CMS.getContext().getContentSection();
ItemResolver resolver = section.getItemResolver(); ItemResolver resolver = section.getItemResolver();
Link link = Link link = new Link(value.toString(),
new Link(value.toString(),
resolver.generateItemURL(state, resolver.generateItemURL(state,
publisher, publisher,
section, section,
@ -214,6 +212,7 @@ public class PublicationWithPublisherSetPublisherSheet
return label; return label;
} }
} }
} }
private class DeleteCellRenderer private class DeleteCellRenderer
@ -228,10 +227,8 @@ public class PublicationWithPublisherSetPublisherSheet
Object key, Object key,
int row, int row,
int col) { int col) {
com.arsdigita.cms.SecurityManager securityManager = com.arsdigita.cms.SecurityManager securityManager = CMS.getSecurityManager(state);
CMS.getSecurityManager(state); PublicationWithPublisher publication = (PublicationWithPublisher) itemModel.
PublicationWithPublisher publication =
(PublicationWithPublisher) itemModel.
getSelectedObject( getSelectedObject(
state); state);
@ -241,23 +238,22 @@ public class PublicationWithPublisherSetPublisherSheet
publication); publication);
if (canEdit) { if (canEdit) {
ControlLink link = new ControlLink(value.toString()); ControlLink link = new ControlLink((Label) value);
link.setConfirmation(PublicationGlobalizationUtil.globalize( link.setConfirmation(PublicationGlobalizationUtil.globalize(
"publications.ui.with_publisher.publisher.remove.confirm")); "publications.ui.with_publisher.publisher.remove.confirm"));
return link; return link;
} else { } else {
Label label = new Label(value.toString()); return new Label("");
return label;
} }
} }
} }
@Override @Override
public void cellSelected(final TableActionEvent event) { public void cellSelected(final TableActionEvent event) {
PageState state = event.getPageState(); PageState state = event.getPageState();
PublicationWithPublisher publication = PublicationWithPublisher publication = (PublicationWithPublisher) itemModel.
(PublicationWithPublisher) itemModel.
getSelectedObject(state); getSelectedObject(state);
TableColumn column = getColumnModel().get(event.getColumn().intValue()); TableColumn column = getColumnModel().get(event.getColumn().intValue());
@ -273,4 +269,5 @@ public class PublicationWithPublisherSetPublisherSheet
public void headSelected(final TableActionEvent event) { public void headSelected(final TableActionEvent event) {
//Nothing to do //Nothing to do
} }
} }

View File

@ -52,10 +52,11 @@ import org.apache.log4j.Logger;
* *
* @author Jens Pelzetter * @author Jens Pelzetter
*/ */
public class SeriesEditshipTable extends Table implements TableActionListener { public class SeriesEditshipTable extends Table implements TableActionListener {
private static final Logger s_log = private static final Logger s_log = Logger.getLogger(SeriesEditshipTable.class);
Logger.getLogger(SeriesEditshipTable.class);
private final String TABLE_COL_EDIT = "table_col_edit"; private final String TABLE_COL_EDIT = "table_col_edit";
private final String TABLE_COL_EDIT_EDITSHIP = "table_col_edit_editship"; private final String TABLE_COL_EDIT_EDITSHIP = "table_col_edit_editship";
private final String TABLE_COL_DEL = "table_col_del"; private final String TABLE_COL_DEL = "table_col_del";
@ -134,10 +135,10 @@ public class SeriesEditshipTable extends Table implements TableActionListener {
public TableModel makeModel(Table table, PageState state) { public TableModel makeModel(Table table, PageState state) {
table.getRowSelectionModel().clearSelection(state); table.getRowSelectionModel().clearSelection(state);
Series series = Series series = (Series) m_itemModel.getSelectedObject(state);
(Series) m_itemModel.getSelectedObject(state);
return new SeriesEditshipTableModel(table, state, series); return new SeriesEditshipTableModel(table, state, series);
} }
} }
private class SeriesEditshipTableModel implements TableModel { private class SeriesEditshipTableModel implements TableModel {
@ -211,6 +212,7 @@ public class SeriesEditshipTable extends Table implements TableActionListener {
public Object getKeyAt(int columnIndex) { public Object getKeyAt(int columnIndex) {
return m_editor.getID(); return m_editor.getID();
} }
} }
private class EditCellRenderer private class EditCellRenderer
@ -226,8 +228,7 @@ public class SeriesEditshipTable extends Table implements TableActionListener {
Object key, Object key,
int row, int row,
int col) { int col) {
SecurityManager securityManager = SecurityManager securityManager = CMS.getSecurityManager(state);
CMS.getSecurityManager(state);
Series series = (Series) m_itemModel.getSelectedObject(state); Series series = (Series) m_itemModel.getSelectedObject(state);
boolean canEdit = securityManager.canAccess( boolean canEdit = securityManager.canAccess(
@ -247,8 +248,7 @@ public class SeriesEditshipTable extends Table implements TableActionListener {
} }
ContentSection section = editor.getContentSection();//CMS.getContext().getContentSection(); ContentSection section = editor.getContentSection();//CMS.getContext().getContentSection();
ItemResolver resolver = section.getItemResolver(); ItemResolver resolver = section.getItemResolver();
Link link = Link link = new Link(String.format("%s",
new Link(String.format("%s",
value.toString(), value.toString(),
editor.getLanguage()), editor.getLanguage()),
resolver.generateItemURL(state, resolver.generateItemURL(state,
@ -273,6 +273,7 @@ public class SeriesEditshipTable extends Table implements TableActionListener {
return label; return label;
} }
} }
} }
private class EditEditshipCellRenderer private class EditEditshipCellRenderer
@ -287,8 +288,7 @@ public class SeriesEditshipTable extends Table implements TableActionListener {
Object key, Object key,
int row, int row,
int col) { int col) {
SecurityManager securityManager = SecurityManager securityManager = CMS.getSecurityManager(state);
CMS.getSecurityManager(state);
Series series = (Series) m_itemModel.getSelectedObject(state); Series series = (Series) m_itemModel.getSelectedObject(state);
boolean canEdit = securityManager.canAccess( boolean canEdit = securityManager.canAccess(
@ -297,13 +297,13 @@ public class SeriesEditshipTable extends Table implements TableActionListener {
series); series);
if (canEdit) { if (canEdit) {
ControlLink link = new ControlLink(value.toString()); ControlLink link = new ControlLink((Label) value);
return link; return link;
} else { } else {
Label label = new Label(value.toString()); return new Label("");
return label;
} }
} }
} }
private class DeleteCellRenderer private class DeleteCellRenderer
@ -319,8 +319,7 @@ public class SeriesEditshipTable extends Table implements TableActionListener {
Object key, Object key,
int row, int row,
int col) { int col) {
SecurityManager securityManager = SecurityManager securityManager = Utilities.getSecurityManager(state);
Utilities.getSecurityManager(state);
Series series = (Series) m_itemModel.getSelectedObject(state); Series series = (Series) m_itemModel.getSelectedObject(state);
boolean canDelete = securityManager.canAccess( boolean canDelete = securityManager.canAccess(
@ -329,15 +328,15 @@ public class SeriesEditshipTable extends Table implements TableActionListener {
series); series);
if (canDelete) { if (canDelete) {
ControlLink link = new ControlLink(value.toString()); ControlLink link = new ControlLink((Label) value);
link.setConfirmation(PublicationGlobalizationUtil.globalize( link.setConfirmation(PublicationGlobalizationUtil.globalize(
"publications.ui.series.editship.remove.confirm")); "publications.ui.series.editship.remove.confirm"));
return link; return link;
} else { } else {
Label label = new Label(value.toString()); return new Label("");
return label;
} }
} }
} }
/* /*
@ -400,8 +399,7 @@ public class SeriesEditshipTable extends Table implements TableActionListener {
public void cellSelected(TableActionEvent event) { public void cellSelected(TableActionEvent event) {
PageState state = event.getPageState(); PageState state = event.getPageState();
GenericPerson editor = GenericPerson editor = new GenericPerson(new BigDecimal(event.getRowKey().
new GenericPerson(new BigDecimal(event.getRowKey().
toString())); toString()));
Series series = (Series) m_itemModel.getSelectedObject(state); Series series = (Series) m_itemModel.getSelectedObject(state);
@ -443,4 +441,5 @@ public class SeriesEditshipTable extends Table implements TableActionListener {
public void headSelected(TableActionEvent event) { public void headSelected(TableActionEvent event) {
//Nothing to do here. //Nothing to do here.
} }
} }

View File

@ -257,9 +257,9 @@ public class SeriesVolumesTable extends Table {
series); series);
if (canEdit) { if (canEdit) {
return new ControlLink(value.toString()); return new ControlLink((Label)value);
} else { } else {
return new Label(value.toString()); return new Label("");
} }
} }
@ -284,13 +284,12 @@ public class SeriesVolumesTable extends Table {
series); series);
if (canDelete) { if (canDelete) {
final ControlLink link = new ControlLink(value.toString()); final ControlLink link = new ControlLink((Label) value);
link.setConfirmation(PublicationGlobalizationUtil.globalize( link.setConfirmation(PublicationGlobalizationUtil.globalize(
"publications.ui.series.volumes.remove.confirm")); "publications.ui.series.volumes.remove.confirm"));
return link; return link;
} else { } else {
final Label label = new Label(value.toString()); return new Label("");
return label;
} }
} }

View File

@ -234,13 +234,12 @@ public class UnPublishedOrganizationSheet
unPublished); unPublished);
if (canEdit) { if (canEdit) {
ControlLink link = new ControlLink(value.toString()); ControlLink link = new ControlLink((Label)value);
link.setConfirmation(PublicationGlobalizationUtil.globalize( link.setConfirmation(PublicationGlobalizationUtil.globalize(
"publications.ui.unpublished.organization.confirm_remove")); "publications.ui.unpublished.organization.confirm_remove"));
return link; return link;
} else { } else {
Label label = new Label(value.toString()); return new Label("");
return label;
} }
} }
} }

View File

@ -171,8 +171,8 @@ public class SciProjectSponsorSheet extends Table {
final int row, final int row,
final int column) { final int column) {
final com.arsdigita.cms.SecurityManager securityManager = CMS.getSecurityManager(state); final com.arsdigita.cms.SecurityManager securityManager = CMS.getSecurityManager(state);
final GenericOrganizationalUnit sponsor = final GenericOrganizationalUnit sponsor
new GenericOrganizationalUnit((BigDecimal) key); = new GenericOrganizationalUnit((BigDecimal) key);
final boolean canEdit = securityManager.canAccess( final boolean canEdit = securityManager.canAccess(
state.getRequest(), state.getRequest(),
@ -220,11 +220,10 @@ public class SciProjectSponsorSheet extends Table {
project); project);
if (canEdit) { if (canEdit) {
final ControlLink link = new ControlLink(value.toString()); final ControlLink link = new ControlLink((Label) value);
return link; return link;
} else { } else {
final Label label = new Label(value.toString()); return (Label) value;
return label;
} }
} }
@ -242,15 +241,15 @@ public class SciProjectSponsorSheet extends Table {
final int row, final int row,
final int column) { final int column) {
final com.arsdigita.cms.SecurityManager securityManager = CMS.getSecurityManager(state); final com.arsdigita.cms.SecurityManager securityManager = CMS.getSecurityManager(state);
final GenericOrganizationalUnit sponsor = final GenericOrganizationalUnit sponsor
new GenericOrganizationalUnit((BigDecimal) key); = new GenericOrganizationalUnit((BigDecimal) key);
final boolean canEdit = securityManager.canAccess( final boolean canEdit = securityManager.canAccess(
state.getRequest(), state.getRequest(),
com.arsdigita.cms.SecurityManager.EDIT_ITEM, com.arsdigita.cms.SecurityManager.EDIT_ITEM,
sponsor); sponsor);
if (canEdit) { if (canEdit) {
final ControlLink link = new ControlLink(value.toString()); final ControlLink link = new ControlLink((Label)value);
link.setConfirmation(SciProjectGlobalizationUtil.globalize( link.setConfirmation(SciProjectGlobalizationUtil.globalize(
"sciproject.ui.sponsor.remove.confirm")); "sciproject.ui.sponsor.remove.confirm"));
return link; return link;
@ -360,4 +359,5 @@ public class SciProjectSponsorSheet extends Table {
} }
} }
} }