* Meine Author Angaben korrigiert

* Sortierung der angehängten Bilder ist nun möglich
* Cursor kann sich nun auch rückwärts bewegen


* wahrscheinlich noch mehr, daß mir gerade nicht einfällt

git-svn-id: https://svn.libreccm.org/ccm/trunk@2418 8810af33-2d31-482b-a856-94f89814c4df
master
quasi 2013-11-07 12:04:11 +00:00
parent 136b1a072d
commit 86beaa1ec7
96 changed files with 3271 additions and 2949 deletions

View File

@ -3,3 +3,5 @@ com.arsdigita.cms.contentassets.image_step_description=Add Images
cms.contentassets.ui.image_step.add_image=Add Image cms.contentassets.ui.image_step.add_image=Add Image
cms.contentassets.ui.image_step.no_image_attached=This item does not have any associated images. cms.contentassets.ui.image_step.no_image_attached=This item does not have any associated images.
cms.contentassets.ui.image_step.remove_attached_image=Remove image attachment cms.contentassets.ui.image_step.remove_attached_image=Remove image attachment
cms.contentassets.ui.image_step.move_attached_image_down=Move down
cms.contentassets.ui.image_step.move_attached_image_up=Move up

View File

@ -3,3 +3,5 @@ com.arsdigita.cms.contentassets.image_step_description=Bild hinzuf\u00fcgen
cms.contentassets.ui.image_step.add_image=Bild hinzuf\u00fcgen cms.contentassets.ui.image_step.add_image=Bild hinzuf\u00fcgen
cms.contentassets.ui.image_step.no_image_attached=Diesem Dokument ist noch kein Bild zugeordnet. cms.contentassets.ui.image_step.no_image_attached=Diesem Dokument ist noch kein Bild zugeordnet.
cms.contentassets.ui.image_step.remove_attached_image=Aus der Liste entfernen cms.contentassets.ui.image_step.remove_attached_image=Aus der Liste entfernen
cms.contentassets.ui.image_step.move_attached_image_down=Nach unten verschieben
cms.contentassets.ui.image_step.move_attached_image_up=Nach oben verschieben

View File

@ -3,3 +3,5 @@ com.arsdigita.cms.contentassets.image_step_description=Add Images
cms.contentassets.ui.image_step.add_image=Add Image cms.contentassets.ui.image_step.add_image=Add Image
cms.contentassets.ui.image_step.no_image_attached=This item does not have any associated images. cms.contentassets.ui.image_step.no_image_attached=This item does not have any associated images.
cms.contentassets.ui.image_step.remove_attached_image=Remove image attachment cms.contentassets.ui.image_step.remove_attached_image=Remove image attachment
cms.contentassets.ui.image_step.move_attached_image_down=Move down
cms.contentassets.ui.image_step.move_attached_image_up=Move up

View File

@ -32,30 +32,38 @@ import com.arsdigita.persistence.OID;
import com.arsdigita.persistence.SessionManager; import com.arsdigita.persistence.SessionManager;
import com.arsdigita.persistence.metadata.Property; import com.arsdigita.persistence.metadata.Property;
import com.arsdigita.util.Assert; import com.arsdigita.util.Assert;
import java.math.BigDecimal;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
/** /**
* @version $Revision: #3 $ $Date: 2004/04/08 $ * @version $Revision: #3 $ $Date: 2004/04/08 $
* @version $Id: $ * @version $Id: $
**/ *
* @author unknown
* @author Sören Bernstein <quasi@quasiweb.de>
*
*/
public class ItemImageAttachment extends ACSObject implements CustomCopy { public class ItemImageAttachment extends ACSObject implements CustomCopy {
/** PDL property name for contact details */ /**
* PDL property name for contact details
*/
public static final String IMAGE = "image"; public static final String IMAGE = "image";
public static final String ITEM = "item"; public static final String ITEM = "item";
public static final String USE_CONTEXT = "useContext"; public static final String USE_CONTEXT = "useContext";
public static final String CAPTION = "caption"; public static final String CAPTION = "caption";
public static final String DESCRIPTION = "description"; public static final String DESCRIPTION = "description";
public static final String TITLE = "title"; public static final String TITLE = "title";
public static final String SORTKEY = "sortKey";
public static final String IMAGE_ATTACHMENTS = "imageAttachments"; public static final String IMAGE_ATTACHMENTS = "imageAttachments";
public static final String ITEM_ATTACHMENTS = "itemAttachments"; public static final String ITEM_ATTACHMENTS = "itemAttachments";
public static final String IMAGE_LINK = "imageLink"; public static final String IMAGE_LINK = "imageLink";
/** Data object type for this domain object */ /**
* Data object type for this domain object
*/
public static final String BASE_DATA_OBJECT_TYPE = "com.arsdigita.cms.contentassets.ItemImageAttachment"; public static final String BASE_DATA_OBJECT_TYPE = "com.arsdigita.cms.contentassets.ItemImageAttachment";
private static final Logger s_log = Logger.getLogger(ItemImageAttachment.class); private static final Logger s_log = Logger.getLogger(ItemImageAttachment.class);
private static final ItemImageAttachmentConfig s_config = ItemImageAttachmentConfig.instanceOf();
private static final ItemImageAttachmentConfig
s_config = ItemImageAttachmentConfig.instanceOf();
private ItemImageAttachment() { private ItemImageAttachment() {
this(BASE_DATA_OBJECT_TYPE); this(BASE_DATA_OBJECT_TYPE);
@ -69,6 +77,7 @@ public class ItemImageAttachment extends ACSObject implements CustomCopy {
super(type); super(type);
} }
@Override
public String getBaseDataObjectType() { public String getBaseDataObjectType() {
return BASE_DATA_OBJECT_TYPE; return BASE_DATA_OBJECT_TYPE;
} }
@ -80,6 +89,17 @@ public class ItemImageAttachment extends ACSObject implements CustomCopy {
set(IMAGE, image); set(IMAGE, image);
} }
/**
* Before saving this object, make sure SORTKEY is set
*/
@Override
protected void beforeSave() {
if(isNew() || getSortKey() == null || getSortKey() == 0) {
setSortKey(getNextSortKey(getItem()));
}
super.beforeSave();
}
public static ItemImageAttachment retrieve(OID oid) { public static ItemImageAttachment retrieve(OID oid) {
return (ItemImageAttachment) DomainObjectFactory.newInstance(oid); return (ItemImageAttachment) DomainObjectFactory.newInstance(oid);
} }
@ -116,7 +136,9 @@ public class ItemImageAttachment extends ACSObject implements CustomCopy {
set(ITEM, item); set(ITEM, item);
} }
/** Retrieves links for a content item */ /**
* Retrieves links for a content item
*/
public static DataCollection getImageAttachments(ContentItem item) { public static DataCollection getImageAttachments(ContentItem item) {
Assert.exists(item, ContentItem.class); Assert.exists(item, ContentItem.class);
@ -126,6 +148,8 @@ public class ItemImageAttachment extends ACSObject implements CustomCopy {
DataCollection attachments = SessionManager.getSession().retrieve(BASE_DATA_OBJECT_TYPE); DataCollection attachments = SessionManager.getSession().retrieve(BASE_DATA_OBJECT_TYPE);
attachments.addEqualsFilter(ITEM + ".id", item.getID()); attachments.addEqualsFilter(ITEM + ".id", item.getID());
// Order by SORTKEY
attachments.addOrder(SORTKEY);
return attachments; return attachments;
} }
@ -162,9 +186,23 @@ public class ItemImageAttachment extends ACSObject implements CustomCopy {
return (String) get(DESCRIPTION); return (String) get(DESCRIPTION);
} }
public void setSortKey(Integer sortkey) {
set(SORTKEY, new BigDecimal(sortkey));
}
public Integer getSortKey() {
BigDecimal sortkey = ((BigDecimal) get(SORTKEY));
if (sortkey != null) {
return sortkey.intValue();
} else {
return 0;
}
}
/** /**
* Automatically publish an unpublished image * Automatically publish an unpublished image
*/ */
@Override
public boolean copyProperty(final CustomCopy source, public boolean copyProperty(final CustomCopy source,
final Property property, final Property property,
final ItemCopier copier) { final ItemCopier copier) {
@ -208,10 +246,21 @@ public class ItemImageAttachment extends ACSObject implements CustomCopy {
// when we delete the link, the image still references it in DB // when we delete the link, the image still references it in DB
// can't make it composite because then image is deleted if we delete // can't make it composite because then image is deleted if we delete
// link. Have to set link to null first (I think) // link. Have to set link to null first (I think)
DomainObject link = DomainObjectFactory.newInstance((DataObject)get(IMAGE_LINK)); DomainObject link = DomainObjectFactory.newInstance((DataObject) get(IMAGE_LINK));
set(IMAGE_LINK, null); set(IMAGE_LINK, null);
save(); save();
link.delete(); link.delete();
} }
/**
* Get the next sort key for the list of {@link ItemImageAttachment}s for an
* item.
*
* @param item The {@link ContentItem} the list of images is looked up for
* @return the next sortkey, basically length of the list + 1
*/
public static Integer getNextSortKey(ContentItem item) {
return new Integer((int) ItemImageAttachment.getImageAttachments(item).size() + 1);
}
} }

View File

@ -53,6 +53,7 @@ public class ItemImageAttachmentInitializer extends ContentAssetInitializer {
DomainObjectFactory.registerInstantiator( DomainObjectFactory.registerInstantiator(
ItemImageAttachment.BASE_DATA_OBJECT_TYPE, ItemImageAttachment.BASE_DATA_OBJECT_TYPE,
new DomainObjectInstantiator() { new DomainObjectInstantiator() {
@Override
protected DomainObject doNewInstance(DataObject obj) { protected DomainObject doNewInstance(DataObject obj) {
return new ItemImageAttachment(obj); return new ItemImageAttachment(obj);
} }
@ -70,6 +71,7 @@ public class ItemImageAttachmentInitializer extends ContentAssetInitializer {
* The base type against which the asset is defined, * The base type against which the asset is defined,
* typically com.arsdigita.cms.ContentPage * typically com.arsdigita.cms.ContentPage
*/ */
@Override
public String getBaseType() { public String getBaseType() {
return ContentPage.BASE_DATA_OBJECT_TYPE; return ContentPage.BASE_DATA_OBJECT_TYPE;
} }
@ -78,6 +80,7 @@ public class ItemImageAttachmentInitializer extends ContentAssetInitializer {
* Returns the path to the XML file defintions for the asset, eg: * Returns the path to the XML file defintions for the asset, eg:
* /WEB-INF/traversal-adapters/com/arsdigita/cms/contentassets/FileAttachments.xml * /WEB-INF/traversal-adapters/com/arsdigita/cms/contentassets/FileAttachments.xml
*/ */
@Override
public String getTraversalXML() { public String getTraversalXML() {
return "/WEB-INF/traversal-adapters/com/arsdigita/" + return "/WEB-INF/traversal-adapters/com/arsdigita/" +
"cms/contentassets/ItemImageAttachment.xml"; "cms/contentassets/ItemImageAttachment.xml";
@ -87,6 +90,7 @@ public class ItemImageAttachmentInitializer extends ContentAssetInitializer {
* The name of the association between the item * The name of the association between the item
* and the asset, eg 'fileAttachments'. * and the asset, eg 'fileAttachments'.
*/ */
@Override
public String getProperty() { public String getProperty() {
return "imageAttachments"; return "imageAttachments";
} }
@ -94,6 +98,7 @@ public class ItemImageAttachmentInitializer extends ContentAssetInitializer {
/** /**
* The class of the authoring kit step * The class of the authoring kit step
*/ */
@Override
public Class getAuthoringStep() { public Class getAuthoringStep() {
return ImageStep.class; return ImageStep.class;
} }
@ -101,6 +106,7 @@ public class ItemImageAttachmentInitializer extends ContentAssetInitializer {
/** /**
* The label for the authoring step * The label for the authoring step
*/ */
@Override
public GlobalizedMessage getAuthoringStepLabel() { public GlobalizedMessage getAuthoringStepLabel() {
return new GlobalizedMessage("com.arsdigita.cms.contentassets.image_step_label", return new GlobalizedMessage("com.arsdigita.cms.contentassets.image_step_label",
"com.arsdigita.cms.contentassets.ImageStepResources"); "com.arsdigita.cms.contentassets.ImageStepResources");
@ -109,6 +115,7 @@ public class ItemImageAttachmentInitializer extends ContentAssetInitializer {
/** /**
* The description for the authoring step * The description for the authoring step
*/ */
@Override
public GlobalizedMessage getAuthoringStepDescription() { public GlobalizedMessage getAuthoringStepDescription() {
return new GlobalizedMessage("com.arsdigita.cms.contentassets.image_step_description", return new GlobalizedMessage("com.arsdigita.cms.contentassets.image_step_description",
"com.arsdigita.cms.contentassets.ImageStepResources"); "com.arsdigita.cms.contentassets.ImageStepResources");
@ -117,6 +124,7 @@ public class ItemImageAttachmentInitializer extends ContentAssetInitializer {
/** /**
* The sort key for the authoring step * The sort key for the authoring step
*/ */
@Override
public int getAuthoringStepSortKey() { public int getAuthoringStepSortKey() {
return ItemImageAttachmentConfig.instanceOf().getImageStepSortKey(); return ItemImageAttachmentConfig.instanceOf().getImageStepSortKey();
} }

View File

@ -34,7 +34,7 @@ import org.apache.log4j.Logger;
* *
* This listerner is used by {@link ImageStepEdit}. * This listerner is used by {@link ImageStepEdit}.
* *
* @author Sören Bernstein (quasimodo) <sbernstein@zes.uni-bremen.de> * @author Sören Bernstein <quasi@quasiweb.de>
*/ */
public class ImageComponentAttachListener extends ImageComponentAbstractListener { public class ImageComponentAttachListener extends ImageComponentAbstractListener {

View File

@ -43,7 +43,7 @@ import org.apache.log4j.Logger;
* content item. * content item.
* *
* @author unknown * @author unknown
* @author Sören Bernstein (quasimodo) <sbernstein@quasiweb.de> * @author Sören Bernstein <quasi@quasiweb.de>
*/ */
public class ImageStep extends SecurityPropertyEditor { public class ImageStep extends SecurityPropertyEditor {
@ -58,8 +58,9 @@ public class ImageStep extends SecurityPropertyEditor {
/** /**
* Constructor. * Constructor.
* *
* @param itemModel * @param itemModel The {@link ItemSelectionModel} to use with this
* @param parent * instance
* @param parent The parent {@link AuthoringKitWizard}
*/ */
public ImageStep(ItemSelectionModel itemModel, public ImageStep(ItemSelectionModel itemModel,
AuthoringKitWizard parent) { AuthoringKitWizard parent) {
@ -95,11 +96,11 @@ public class ImageStep extends SecurityPropertyEditor {
} }
m_parent.getList().addActionListener(new ActionListener() { m_parent.getList().addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent event) { public void actionPerformed(ActionEvent event) {
PageState state = event.getPageState(); PageState state = event.getPageState();
showDisplayPane(state); showDisplayPane(state);
} }
}); });
} }
@ -151,9 +152,9 @@ public class ImageStep extends SecurityPropertyEditor {
return DomainObjectFactory.newInstance(oid); return DomainObjectFactory.newInstance(oid);
} }
}; };
@Override
public Object getSelectedKey(PageState ps) { public Object getSelectedKey(PageState ps) {
OID oid = (OID) ps.getValue(m_attachmentOID); OID oid = (OID) ps.getValue(m_attachmentOID);
if (null == oid) { if (null == oid) {
@ -163,6 +164,7 @@ public class ImageStep extends SecurityPropertyEditor {
return oid; return oid;
} }
@Override
public void setSelectedKey(PageState ps, Object oid) { public void setSelectedKey(PageState ps, Object oid) {
m_attachment.set(ps, null); m_attachment.set(ps, null);
ps.setValue(m_attachmentOID, oid); ps.setValue(m_attachmentOID, oid);
@ -178,10 +180,10 @@ public class ImageStep extends SecurityPropertyEditor {
m_attachment.set(ps, attachment); m_attachment.set(ps, attachment);
} }
@Override
public ParameterModel getStateParameter() { public ParameterModel getStateParameter() {
return m_attachmentOID; return m_attachmentOID;
} }
} }
/** /**
@ -196,5 +198,4 @@ public class ImageStep extends SecurityPropertyEditor {
super.showDisplayPane(state); super.showDisplayPane(state);
m_add.reset(state); m_add.reset(state);
} }
} }

View File

@ -15,7 +15,6 @@
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
package com.arsdigita.cms.contentassets.ui; package com.arsdigita.cms.contentassets.ui;
import com.arsdigita.bebop.BoxPanel; import com.arsdigita.bebop.BoxPanel;
@ -33,44 +32,57 @@ import com.arsdigita.bebop.list.ListModelBuilder;
import com.arsdigita.cms.ContentItem; import com.arsdigita.cms.ContentItem;
import com.arsdigita.cms.ImageAsset; import com.arsdigita.cms.ImageAsset;
import com.arsdigita.cms.ReusableImageAsset; import com.arsdigita.cms.ReusableImageAsset;
import com.arsdigita.cms.Service;
import com.arsdigita.cms.contentassets.ItemImageAttachment; import com.arsdigita.cms.contentassets.ItemImageAttachment;
import com.arsdigita.cms.contentassets.util.ImageStepGlobalizationUtil; import com.arsdigita.cms.contentassets.util.ImageStepGlobalizationUtil;
import com.arsdigita.cms.ui.ImageDisplay; import com.arsdigita.cms.ui.ImageDisplay;
import com.arsdigita.cms.util.GlobalizationUtil;
import com.arsdigita.domain.DomainObject;
import com.arsdigita.domain.DomainObjectFactory; import com.arsdigita.domain.DomainObjectFactory;
import com.arsdigita.persistence.DataCollection; import com.arsdigita.persistence.DataCollection;
import com.arsdigita.persistence.DataObject;
import com.arsdigita.persistence.OID; import com.arsdigita.persistence.OID;
import com.arsdigita.util.LockableImpl; import com.arsdigita.util.LockableImpl;
import com.arsdigita.web.URL;
import com.arsdigita.xml.Element; import com.arsdigita.xml.Element;
import java.io.IOException;
import javax.servlet.ServletException; import javax.servlet.ServletException;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
/** /**
* Component displays the currently attached images for an content item. It is * Component displays the currently attached images for an content item. It is
* part of the entry point image authoring step {@see ImageStep}. * part of the entry point image authoring step {
*
* @see ImageStep}.
* *
* It creates a list of images including meta information (name, type, width, * It creates a list of images including meta information (name, type, width,
* etc.), a link to remove from the list for each image and at the bottom a * etc.), a link to remove from the list for each image and at the bottom a link
* link to add another image. * to add another image.
* *
* @author unknown * @author unknown
* @author Sören Bernstein (quasimodo) <sbernstein@quasiweb.de> * @author Sören Bernstein <quasi@quasiweb.de>
*/ */
public class ImageStepDisplay extends SimpleContainer { public class ImageStepDisplay extends SimpleContainer {
private static final Logger S_LOG = Logger.getLogger(ImageStepDisplay.class); private static final Logger S_LOG = Logger.getLogger(ImageStepDisplay.class);
/**
/** Represents invoking parent component */ * Represents invoking parent component
*/
private final ImageStep m_imageStep; private final ImageStep m_imageStep;
private ImageListModelBuilder m_listModelBuilder;
/** Name of the delete event */ /**
* Name of the delete event
*/
private final static String DELETE = "deleteAttachment"; private final static String DELETE = "deleteAttachment";
private final static String MOVEUP = "moveAttachmentUp";
private final static String MOVEDOWN = "moveAttachmentDown";
/** /**
* Constructor. * Constructor.
* *
* @param step * @param step
*/ */
public ImageStepDisplay( ImageStep step ) { public ImageStepDisplay(ImageStep step) {
super(); super();
m_imageStep = step; m_imageStep = step;
@ -80,25 +92,28 @@ public class ImageStepDisplay extends SimpleContainer {
"cms.contentassets.ui.image_step.no_image_attached")); "cms.contentassets.ui.image_step.no_image_attached"));
mainLabel.setFontWeight(Label.ITALIC); mainLabel.setFontWeight(Label.ITALIC);
List imageList = new List( new ImageListModelBuilder() ) { m_listModelBuilder = new ImageListModelBuilder();
List imageList = new List(m_listModelBuilder) {
@Override @Override
public void respond( PageState ps ) throws ServletException { public void respond(PageState ps) throws ServletException {
if( DELETE.equals( ps.getControlEventName() ) ) { if (DELETE.equals(ps.getControlEventName())) {
String attachment = ps.getControlEventValue(); DomainObjectFactory.newInstance(OID.valueOf(ps.getControlEventValue())).delete();
// Regenerate sortkeys
OID oid = OID.valueOf( attachment ); m_listModelBuilder.getModel().regenSortKeys(ps);
DomainObjectFactory.newInstance( oid ).delete(); } else if (MOVEUP.equals(ps.getControlEventName())) {
} m_listModelBuilder.getModel().move(OID.valueOf(ps.getControlEventValue()), -1, ps);
} else if (MOVEDOWN.equals(ps.getControlEventName())) {
else { m_listModelBuilder.getModel().move(OID.valueOf(ps.getControlEventValue()), 1, ps);
super.respond( ps ); } else {
super.respond(ps);
} }
} }
}; };
imageList.setCellRenderer( new ImageListCellRenderer() );
imageList.setEmptyView( mainLabel );
add( imageList ); // finally add the component imageList.setCellRenderer(new ImageListCellRenderer());
imageList.setEmptyView(mainLabel);
add(imageList); // finally add the component
} }
/** /**
@ -106,28 +121,36 @@ public class ImageStepDisplay extends SimpleContainer {
*/ */
private class ImageListModelBuilder extends LockableImpl private class ImageListModelBuilder extends LockableImpl
implements ListModelBuilder { implements ListModelBuilder {
private ImageListModel m_listModel;
/** /**
* *
* @param list * @param list
* @param ps * @param ps
* @return * @return
*/ */
public ListModel makeModel( List list, PageState ps ) { @Override
ContentItem item = m_imageStep.getItem( ps ); public ListModel makeModel(List list, PageState ps) {
ContentItem item = m_imageStep.getItem(ps);
DataCollection attachments = DataCollection attachments =
ItemImageAttachment.getImageAttachments( item ); ItemImageAttachment.getImageAttachments(item);
attachments.addPath( ItemImageAttachment.IMAGE + "." + attachments.addPath(ItemImageAttachment.IMAGE + "."
ReusableImageAsset.ID ); + ReusableImageAsset.ID);
attachments.addPath( ItemImageAttachment.IMAGE + "." + attachments.addPath(ItemImageAttachment.IMAGE + "."
ReusableImageAsset.OBJECT_TYPE ); + ReusableImageAsset.OBJECT_TYPE);
attachments.addPath( ItemImageAttachment.IMAGE + "." + attachments.addPath(ItemImageAttachment.IMAGE + "."
ReusableImageAsset.HEIGHT ); + ReusableImageAsset.HEIGHT);
attachments.addPath( ItemImageAttachment.IMAGE + "." + attachments.addPath(ItemImageAttachment.IMAGE + "."
ReusableImageAsset.WIDTH ); + ReusableImageAsset.WIDTH);
m_listModel = new ImageListModel(attachments);
return m_listModel;
}
return new ImageListModel( attachments ); protected ImageListModel getModel() {
return m_listModel;
} }
} }
@ -138,22 +161,137 @@ public class ImageStepDisplay extends SimpleContainer {
private final DataCollection m_attachments; private final DataCollection m_attachments;
ImageListModel( DataCollection attachments ) { ImageListModel(DataCollection attachments) {
m_attachments = attachments; m_attachments = attachments;
} }
@Override
public Object getElement() { public Object getElement() {
return DomainObjectFactory.newInstance return DomainObjectFactory.newInstance(m_attachments.getDataObject());
( m_attachments.getDataObject() );
} }
@Override
public String getKey() { public String getKey() {
return m_attachments.getDataObject().getOID().toString(); return m_attachments.getDataObject().getOID().toString();
} }
@Override
public boolean next() { public boolean next() {
return m_attachments.next(); return m_attachments.next();
} }
public boolean isFirst() {
return m_attachments.isFirst();
}
public boolean isLast() {
return m_attachments.isLast();
}
/**
* Move an image's position inside the list.
*
* @param oid {@link OID} of the image to move
* @param move position steps (positive or negative) to move
* @param ps Current {@link PageState}
*/
protected void move(OID oid, int move, PageState ps) {
// Get the current ContentItem
ContentItem item = m_imageStep.getItem(ps);
// Get the collection of attached images
DataCollection attachments = ItemImageAttachment.getImageAttachments(item);
// Always need an oid of the image to move
if (oid == null) {
throw new IllegalArgumentException("OID must not be null");
}
// No move, nothing to do
if (move == 0) {
return;
}
// Find the image in the collection
while (attachments.next()) {
if (attachments.getDataObject().getOID().equals(oid)) {
break;
}
}
// Throw an {@link IllegalArgumentxception} if the oid was not found
if (!attachments.getDataObject().getOID().equals(oid)) {
throw new IllegalArgumentException("OID " + oid + " is not in collection");
}
// Get the image to move and test if it is really an ItemImageAttachment
DomainObject sortDomainObject = DomainObjectFactory.newInstance(attachments.getDataObject());
if (sortDomainObject instanceof ItemImageAttachment) {
// Change the sortKey of the ItemImageAttachment to the desired
// value but respect bounds of the current list
int newSortKey = Math.max(1,
Math.min((int) attachments.size(),
((ItemImageAttachment) sortDomainObject).getSortKey() + move));
((ItemImageAttachment) sortDomainObject).setSortKey(newSortKey);
((ItemImageAttachment) sortDomainObject).save();
// Now, move all the object between the original position and the
// new postition one step in the nessecary direction
if (move < 0) {
while (attachments.previous() && move < 0) {
DomainObject domainObject = DomainObjectFactory.newInstance(attachments.getDataObject());
if (domainObject instanceof ItemImageAttachment) {
((ItemImageAttachment) domainObject).setSortKey(
((ItemImageAttachment) domainObject).getSortKey() + 1);
((ItemImageAttachment) domainObject).save();
move++;
}
}
}
if (move > 0) {
while (attachments.next() && move > 0) {
DomainObject domainObject = DomainObjectFactory.newInstance(attachments.getDataObject());
if (domainObject instanceof ItemImageAttachment) {
((ItemImageAttachment) domainObject).setSortKey(
((ItemImageAttachment) domainObject).getSortKey() - 1);
((ItemImageAttachment) domainObject).save();
move--;
}
}
}
}
// close the collection manually to avoid warnings because the list
// will not be closed automatically
attachments.close();
}
/**
* Reorganize the sortKeys after removing an item.
*
* @param ps The current {@link PageState}
*/
protected void regenSortKeys(PageState ps) {
// Get the current ContentItem
ContentItem item = m_imageStep.getItem(ps);
// Get the collection of attached images
DataCollection attachments = ItemImageAttachment.getImageAttachments(item);
// Current Position
int pos = 0;
// Iterate through all items and set item sortKey to pos
while (attachments.next()) {
pos++;
DomainObject domainObject = DomainObjectFactory.newInstance(attachments.getDataObject());
if (domainObject instanceof ItemImageAttachment) {
int sortKey = ((ItemImageAttachment) domainObject).getSortKey();
if (sortKey != pos) {
((ItemImageAttachment) domainObject).setSortKey(pos);
domainObject.save();
}
}
}
}
} }
/** /**
@ -171,21 +309,22 @@ public class ImageStepDisplay extends SimpleContainer {
* @param isSelected * @param isSelected
* @return * @return
*/ */
public Component getComponent( final List list, PageState state, @Override
public Component getComponent(final List list, PageState state,
Object value, String key, Object value, String key,
int index, boolean isSelected ) { int index, boolean isSelected) {
final ItemImageAttachment attachment = (ItemImageAttachment) value; final ItemImageAttachment attachment = (ItemImageAttachment) value;
BoxPanel container = new BoxPanel( BoxPanel.VERTICAL ); BoxPanel container = new BoxPanel(BoxPanel.VERTICAL);
container.setBorder( 1 ); container.setBorder(1);
// Add CMS ImageDisplay element to BoxPanel container an overwrite // Add CMS ImageDisplay element to BoxPanel container an overwrite
// generateImagePropertiesXM to add attachment's meta data. // generateImagePropertiesXM to add attachment's meta data.
container.add( new ImageDisplay(null) { container.add(new ImageDisplay(null) {
@Override @Override
protected void generateImagePropertiesXML( ImageAsset image, protected void generateImagePropertiesXML(ImageAsset image,
PageState state, PageState state,
Element element ) { Element element) {
/* Use CMS ImageDisplay to display the image including * /* Use CMS ImageDisplay to display the image including *
* metadata as name, type, widht, height etc. */ * metadata as name, type, widht, height etc. */
super.generateImagePropertiesXML(image, state, element); super.generateImagePropertiesXML(image, state, element);
@ -198,7 +337,7 @@ public class ImageStepDisplay extends SimpleContainer {
// provide labels in Java (including localization). // provide labels in Java (including localization).
// Title and description - if displayed - have to be // Title and description - if displayed - have to be
// positioned above the image and its metadata. // positioned above the image and its metadata.
if(ItemImageAttachment.getConfig() if (ItemImageAttachment.getConfig()
.getIsImageStepDescriptionAndTitleShown()) { .getIsImageStepDescriptionAndTitleShown()) {
String description = attachment.getDescription(); String description = attachment.getDescription();
if (description != null) { if (description != null) {
@ -206,73 +345,109 @@ public class ImageStepDisplay extends SimpleContainer {
} }
String title = attachment.getTitle(); String title = attachment.getTitle();
if (title!= null) { if (title != null) {
element.addAttribute("title", title); element.addAttribute("title", title);
} }
} }
element.addAttribute("caption_label", (String) GlobalizationUtil.globalize(
"cms.contentasset.image.ui.caption")
.localize());
element.addAttribute("caption", attachment.getCaption());
element.addAttribute("context_label", (String) GlobalizationUtil.globalize(
"cms.contentasset.image.ui.use_context")
.localize());
String useContext = attachment.getUseContext();
if (null == useContext) {
element.addAttribute("context", (String) GlobalizationUtil.globalize(
"cms.ui.unknown")
.localize());
} else {
element.addAttribute("context", useContext);
}
} }
@Override @Override
protected ImageAsset getImageAsset( PageState ps ) { protected ImageAsset getImageAsset(PageState ps) {
return attachment.getImage(); return attachment.getImage();
} }
} ); });
/* Create a box panel beloy the image to display the caption */ /* Adds links to move and remove the image in a separate container element */
BoxPanel captionPanel = new BoxPanel( BoxPanel.HORIZONTAL ); if (!((ImageListModel) list.getModel(state)).isFirst()) {
ControlLink moveUpLink = new ControlLink(new Label(
captionPanel.add(new Label(ImageStepGlobalizationUtil.globalize(
"cms.contentasset.image.ui.caption")));
Label captionText = new Label( new PrintListener() {
public void prepare( PrintEvent ev ) {
Label l = (Label) ev.getTarget();
String caption = attachment.getCaption();
if( null == caption ) {
l.setLabel( ImageStepGlobalizationUtil.globalize(
"cms.ui.unknown") );
} else {
l.setLabel( caption );
}
}
} );
captionText.setOutputEscaping( false );
captionPanel.add( captionText );
container.add( captionPanel );
/* Create a box panel beloy the image to display use context*/
BoxPanel useContextPanel = new BoxPanel( BoxPanel.HORIZONTAL );
useContextPanel.add(new Label( ImageStepGlobalizationUtil.globalize(
"cms.contentasset.image.ui.use_context") ) );
Label useContextLabel = new Label( new PrintListener() {
public void prepare( PrintEvent ev ) {
Label l = (Label) ev.getTarget();
String useContext = attachment.getUseContext();
if( null == useContext ) {
l.setLabel( ImageStepGlobalizationUtil.globalize(
"cms.ui.unknown") );
} else {
l.setLabel( useContext );
}
}
} );
useContextLabel.setOutputEscaping( false );
useContextPanel.add( useContextLabel );
container.add( useContextPanel );
/* Add a link to remove the image in a separate container elemet */
ControlLink deleteLink = new ControlLink(new Label(
ImageStepGlobalizationUtil.globalize( ImageStepGlobalizationUtil.globalize(
"cms.contentassets.ui.image_step.remove_attached_image") )) { "cms.contentassets.ui.image_step.move_attached_image_up"))) {
@Override @Override
public void setControlEvent( PageState ps ) { public void setControlEvent(PageState ps) {
String oid = ps.getControlEventValue(); String oid = ps.getControlEventValue();
ps.setControlEvent( list, DELETE, oid ); ps.setControlEvent(list, MOVEUP, oid);
}
// Override generateURL to prevent deleting of the page state
@Override
protected void generateURL(PageState state, Element parent) {
setControlEvent(state);
try {
parent.addAttribute("href", state.stateAsURL());
} catch (IOException e) {
parent.addAttribute("href", "");
}
exportAttributes(parent);
} }
}; };
container.add( deleteLink ); container.add(moveUpLink);
}
if (!((ImageListModel) list.getModel(state)).isLast()) {
ControlLink moveDownLink = new ControlLink(new Label(
ImageStepGlobalizationUtil.globalize(
"cms.contentassets.ui.image_step.move_attached_image_down"))) {
@Override
public void setControlEvent(PageState ps) {
String oid = ps.getControlEventValue();
ps.setControlEvent(list, MOVEDOWN, oid);
}
// Override generateURL to prevent deleting of the page state
@Override
protected void generateURL(PageState state, Element parent) {
setControlEvent(state);
try {
parent.addAttribute("href", state.stateAsURL());
} catch (IOException e) {
parent.addAttribute("href", "");
}
exportAttributes(parent);
}
};
container.add(moveDownLink);
}
ControlLink deleteLink = new ControlLink(new Label(
ImageStepGlobalizationUtil.globalize(
"cms.contentassets.ui.image_step.remove_attached_image"))) {
@Override
public void setControlEvent(PageState ps) {
String oid = ps.getControlEventValue();
ps.setControlEvent(list, DELETE, oid);
}
// Override generateURL to prevent deleting of the page state
@Override
protected void generateURL(PageState state, Element parent) {
setControlEvent(state);
try {
parent.addAttribute("href", state.stateAsURL());
} catch (IOException e) {
parent.addAttribute("href", "");
}
exportAttributes(parent);
}
};
container.add(deleteLink);
return container; return container;
} }

View File

@ -53,7 +53,7 @@ import org.apache.log4j.Logger;
* It doesn't engage a lot of its own logik but uses CMS default image classes. * It doesn't engage a lot of its own logik but uses CMS default image classes.
* *
* @author unknown * @author unknown
* @author Sören Bernstein (quasimodo) <sbernstein@zes.uni-bremen.de> * @author Sören Bernstein <quasi@quasiweb.de>
*/ */
public class ImageStepEdit extends SimpleContainer public class ImageStepEdit extends SimpleContainer
implements Resettable { implements Resettable {

View File

@ -1062,3 +1062,4 @@ cms.ui.images=Images
cms.ui.folder.additionalInfo=Info cms.ui.folder.additionalInfo=Info
cms.ui.section.new_section_root_category=Root category of the new Content Section cms.ui.section.new_section_root_category=Root category of the new Content Section
cms.ui.admin_center=Admin Center cms.ui.admin_center=Admin Center
cms.contentasset.image.ui.display.dimensions=Dimensions (width x height):

View File

@ -1042,7 +1042,7 @@ cms.contentasset.image.ui.table.header_action_select=Aktion
cms.contentasset.image.ui.table.link_delete=Aus dem System endg\u00fcltig l\u00f6schen cms.contentasset.image.ui.table.link_delete=Aus dem System endg\u00fcltig l\u00f6schen
cms.contentasset.image.ui.table.header_action_delete=Aus dem System l\u00f6schen cms.contentasset.image.ui.table.header_action_delete=Aus dem System l\u00f6schen
cms.contentasset.image.ui.display.name=Name: cms.contentasset.image.ui.display.name=Name:
cms.contentasset.image.ui.display.type=Bild Typ: cms.contentasset.image.ui.display.type=Bild-Typ:
cms.contentasset.image.ui.display.width=Breite: cms.contentasset.image.ui.display.width=Breite:
cms.contentasset.image.ui.display.height=H\u00f6he: cms.contentasset.image.ui.display.height=H\u00f6he:
cms.ui.description_hint=Eine kurze Charakterisierung des Dokumentes, nach M\u00f6glichkeit nicht l\u00e4nger als 2-3 S\u00e4tze. Standardm\u00e4\u00dfig wird die Beschreibung zusammen mit dem Titel in allen Dokumentenliste angezeigt, um so Seiten mit hohem Informationsgehalt zu erzeugen. cms.ui.description_hint=Eine kurze Charakterisierung des Dokumentes, nach M\u00f6glichkeit nicht l\u00e4nger als 2-3 S\u00e4tze. Standardm\u00e4\u00dfig wird die Beschreibung zusammen mit dem Titel in allen Dokumentenliste angezeigt, um so Seiten mit hohem Informationsgehalt zu erzeugen.
@ -1056,3 +1056,4 @@ cms.ui.images=Bilder
cms.ui.folder.additionalInfo=Info cms.ui.folder.additionalInfo=Info
cms.ui.section.new_section_root_category=Kategoriensystem der neuen Content Section cms.ui.section.new_section_root_category=Kategoriensystem der neuen Content Section
cms.ui.admin_center=Admin Center cms.ui.admin_center=Admin Center
cms.contentasset.image.ui.display.dimensions=Ma\u00dfe (Breite x H\u00f6he):

View File

@ -110,3 +110,4 @@ cms.ui.images=Images
cms.ui.folder.additionalInfo= cms.ui.folder.additionalInfo=
cms.ui.section.new_section_root_category= cms.ui.section.new_section_root_category=
cms.ui.admin_center=Admin Center cms.ui.admin_center=Admin Center
cms.contentasset.image.ui.display.dimensions=Dimensions (width x height):

View File

@ -584,3 +584,4 @@ cms.ui.images=Images
cms.ui.folder.additionalInfo= cms.ui.folder.additionalInfo=
cms.ui.section.new_section_root_category= cms.ui.section.new_section_root_category=
cms.ui.admin_center=Admin Center cms.ui.admin_center=Admin Center
cms.contentasset.image.ui.display.dimensions=Dimensions (width x height):

View File

@ -22,7 +22,7 @@ import org.imgscalr.Scalr;
* cache of {@link BaseImage}. Also, this class is able to create server-side * cache of {@link BaseImage}. Also, this class is able to create server-side
* resized versions of ImageAssets. * resized versions of ImageAssets.
* *
* @author Sören Bernstein (quasimodo) <sbernstein@zes.uni-bremen.de> * @author Sören Bernstein <quasi@quasiweb.de>
*/ */
public class CachedImage { public class CachedImage {

View File

@ -90,7 +90,7 @@ import org.apache.log4j.Logger;
* *
* @author <a href="mailto:pihman@arsdigita.com">Michael Pih</a> * @author <a href="mailto:pihman@arsdigita.com">Michael Pih</a>
* @author <a href="mailto:flattop@arsdigita.com">Jack Chung</a> * @author <a href="mailto:flattop@arsdigita.com">Jack Chung</a>
* @author Sören Bernstein (quasi@barkhof.uni-bremen.de) * @author Sören Bernstein <quasi@quasiweb.de>
* @version $Revision: #37 $ $DateTime: 2004/08/17 23:15:09 $ * @version $Revision: #37 $ $DateTime: 2004/08/17 23:15:09 $
* @version $Id: ContentSection.java 2305 2012-05-01 12:26:33Z pboy $ * @version $Id: ContentSection.java 2305 2012-05-01 12:26:33Z pboy $
*/ */

View File

@ -97,7 +97,7 @@ import org.apache.log4j.Logger;
* folders to jsp templates. * folders to jsp templates.
* *
* @author unknown * @author unknown
* @author Sören Bernstein <sbernstein@quasiweb.de> * @author Sören Bernstein <quasi@quasiweb.de>
* @author Peter Boy <pboy@barkhof.uni-bremen.de> * @author Peter Boy <pboy@barkhof.uni-bremen.de>
*/ */
public class ContentSectionServlet extends BaseApplicationServlet { public class ContentSectionServlet extends BaseApplicationServlet {

View File

@ -52,7 +52,7 @@ import org.apache.log4j.Logger;
* *
* @author Jack Chung * @author Jack Chung
* @author Stanislav Freidin * @author Stanislav Freidin
* @author Sören Bernstein <sbernstein@quasiweb.de> * @author Sören Bernstein <quasi@quasiweb.de>
* *
* @version $Id: ImageAsset.java 2225 2011-08-02 18:53:56Z pboy $ * @version $Id: ImageAsset.java 2225 2011-08-02 18:53:56Z pboy $
*/ */

View File

@ -9,7 +9,7 @@ package com.arsdigita.cms;
* Content Items implementing this interface are be language invariant, if * Content Items implementing this interface are be language invariant, if
* isLanguageInvariant returns true * isLanguageInvariant returns true
* *
* @author Sören Bernstein (quasimodo) <sbernstein@zes.uni-bremen.de> * @author Sören Bernstein <quasi@quasiweb.de>
*/ */
public interface LanguageInvariantContentItem { public interface LanguageInvariantContentItem {

View File

@ -40,7 +40,7 @@ import org.apache.log4j.Logger;
* to be modifiable must be included in Loader class itself! * to be modifiable must be included in Loader class itself!
* *
* @author pb * @author pb
* @author Sören Bernstein (quasi@barkhof.uni-bremen.de) * @author Sören Bernstein <quasi@quasiweb.de>
* @version $Id: LoaderConfig.java $ * @version $Id: LoaderConfig.java $
*/ */
public final class LoaderConfig extends AbstractConfig { public final class LoaderConfig extends AbstractConfig {

View File

@ -33,7 +33,7 @@ import org.apache.log4j.Logger;
* Configures parameter which are not persisted in the database and may be * Configures parameter which are not persisted in the database and may be
* changes during each startup of the system. * changes during each startup of the system.
* @author pb * @author pb
* @author Sören Bernstein (quasi@barkhof.uni-bremen.de) * @author Sören Bernstein <quasi@quasiweb.de>
*/ */
public final class ContentSectionConfig extends AbstractConfig { public final class ContentSectionConfig extends AbstractConfig {

View File

@ -63,7 +63,7 @@ import org.xml.sax.helpers.DefaultHandler;
* into the database. * into the database.
* *
* @author Peter Boy (pboy@barkhof.uni-bremen.de) * @author Peter Boy (pboy@barkhof.uni-bremen.de)
* @author Sören Bernstein (quasi@barkhof.uni-bremen.de) * @author Sören Bernstein <quasi@quasiweb.de>
* @author Jon Orris (jorris@redhat.com) * @author Jon Orris (jorris@redhat.com)
* @version $Id: $ * @version $Id: $
*/ */

View File

@ -61,7 +61,7 @@ import org.apache.log4j.Logger;
* registry object (file). * registry object (file).
* *
* @author Rafael H. Schloming &lt;rhs@mit.edu&gt; * @author Rafael H. Schloming &lt;rhs@mit.edu&gt;
* @authro Sören Bernstein (quasi@barkhof.uni-bremen.de) * @author Sören Bernstein <quasi@quasiweb.de>
* @version $Revision: #754 $ $Date: 2005/09/02 $ $Author: pboy $ * @version $Revision: #754 $ $Date: 2005/09/02 $ $Author: pboy $
**/ **/
public abstract class AbstractContentTypeLoader extends PackageLoader { public abstract class AbstractContentTypeLoader extends PackageLoader {

View File

@ -40,7 +40,7 @@ import org.apache.log4j.Logger;
* <p>This class extends {@link com.arsdigita.cms.ContentItem content item} and * <p>This class extends {@link com.arsdigita.cms.ContentItem content item} and
* adds extended attributes specific for an not country specific address:</p> * adds extended attributes specific for an not country specific address:</p>
* *
* @author Sören Bernstein * @author Sören Bernstein <quasi@quasiweb.de>
**/ **/
public class GenericAddress extends ContentPage { public class GenericAddress extends ContentPage {

View File

@ -11,7 +11,7 @@ import org.apache.log4j.Logger;
/** /**
* Stores the configuration record for the generic contact. * Stores the configuration record for the generic contact.
* *
* @author Sören Bernstein (quasimodo) quasi@zes.uni-bremen.de * @author Sören Bernstein <quasi@quasiweb.de>
*/ */
public final class GenericContactConfig extends AbstractConfig { public final class GenericContactConfig extends AbstractConfig {

View File

@ -10,7 +10,7 @@ import com.arsdigita.persistence.DataCollection;
/** /**
* *
* @author Sören Bernstein (quasimodo) <sbernstein@zes.uni-bremen.de> * @author Sören Bernstein <quasi@quasiweb.de>
*/ */
public class GenericContactEntryKeys extends RelationAttributeCollection { public class GenericContactEntryKeys extends RelationAttributeCollection {

View File

@ -37,7 +37,7 @@ import java.util.StringTokenizer;
/** /**
* Basic GenericPerson Contenttype for OpenCCM. * Basic GenericPerson Contenttype for OpenCCM.
* *
* @author Sören Bernstein * @author Sören Bernstein <quasi@quasiweb.de>
* @author Jens Pelzetter * @author Jens Pelzetter
*/ */
public class GenericPerson extends ContentPage implements public class GenericPerson extends ContentPage implements

View File

@ -50,7 +50,7 @@ import org.apache.log4j.Logger;
* *
* @version $Revision: #7 $ $Date: 2004/08/17 $ * @version $Revision: #7 $ $Date: 2004/08/17 $
* @author Nobuko Asakai (nasakai@redhat.com) * @author Nobuko Asakai (nasakai@redhat.com)
* @author Sören Bernstein (Quasimodo) * @author Sören Bernstein <quasi@quasiweb.de>
*/ */
public class Link extends ACSObject { public class Link extends ACSObject {

View File

@ -32,7 +32,7 @@ import com.arsdigita.globalization.GlobalizationHelper;
* This is a modified copy of ContentItemTraversalAdapter to make the * This is a modified copy of ContentItemTraversalAdapter to make the
* Link-Objects aware of multilingual items (ContentBundle) * Link-Objects aware of multilingual items (ContentBundle)
* *
* @author Sören Bernstein (Quasimodo) * @author Sören Bernstein <quasi@quasiweb.de>
*/ */
public class LinkTraversalAdapter public class LinkTraversalAdapter
extends ContentItemTraversalAdapter { extends ContentItemTraversalAdapter {

View File

@ -49,7 +49,7 @@ import org.apache.log4j.Logger;
* Form to edit the properties of a address. * Form to edit the properties of a address.
* *
* @author: Jens Pelzetter * @author: Jens Pelzetter
* @author: Sören Bernstein * @author Sören Bernstein <quasi@quasiweb.de>
*/ */
public class GenericAddressPropertyForm extends BasicPageForm public class GenericAddressPropertyForm extends BasicPageForm
implements FormProcessListener, implements FormProcessListener,

View File

@ -46,7 +46,7 @@ import java.math.BigDecimal;
/** /**
* Lists all existing contact entries for a selected contact. * Lists all existing contact entries for a selected contact.
* *
* @author Sören Bernstein (quasimodo) quasi@barkhof.uni-bremen.de * @author Sören Bernstein <quasi@quasiweb.de>
*/ */
public class GenericContactEntriesTable extends Table implements TableActionListener { public class GenericContactEntriesTable extends Table implements TableActionListener {

View File

@ -40,7 +40,7 @@ import com.arsdigita.globalization.GlobalizationHelper;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
/** /**
* @author Sören Bernstein (quasimodo) quasi@barkhof.uni-bremen.de * @author Sören Bernstein <quasi@quasiweb.de>
*/ */
public class GenericContactEntryAddForm extends BasicItemForm { public class GenericContactEntryAddForm extends BasicItemForm {
private static final Logger s_log = Logger.getLogger(GenericContactEntryAddForm.class); private static final Logger s_log = Logger.getLogger(GenericContactEntryAddForm.class);

View File

@ -47,7 +47,7 @@ import org.apache.log4j.Logger;
* - Address * - Address
* - Various contact entries. * - Various contact entries.
* *
* @author quasi <quasi@barkhof.uni-bremen.de> * @author quasi <quasi@quasiweb.de>
*/ */
public class GenericContactPropertiesStep extends SimpleEditStep { public class GenericContactPropertiesStep extends SimpleEditStep {

View File

@ -48,7 +48,7 @@ import org.apache.log4j.Logger;
* This class is part of the admin GUI of CCM and extends the standard form * This class is part of the admin GUI of CCM and extends the standard form
* in order to present forms for managing the multi-language categories. * in order to present forms for managing the multi-language categories.
* *
* @author Sören Bernstein (quasimodo) quasi@zes.uni-bremen.de * @author Sören Bernstein <quasi@quasiweb.de>
*/ */
public class GenericContactTypeAddForm extends BasicItemForm { public class GenericContactTypeAddForm extends BasicItemForm {

View File

@ -26,7 +26,7 @@ import com.arsdigita.cms.ui.authoring.SimpleEditStep;
import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess; import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
/** /**
* @author Sören Bernstein * @author Sören Bernstein <quasi@quasiweb.de>
*/ */
public class GenericContactTypePropertiesStep extends SimpleEditStep { public class GenericContactTypePropertiesStep extends SimpleEditStep {

View File

@ -43,7 +43,7 @@ import java.math.BigDecimal;
/** /**
* *
* *
* @author Sören Bernstein (quasimodo) quasi@barkhof.uni-bremen.de * @author Sören Bernstein <quasi@quasiweb.de>
*/ */
public class GenericContactTypeTable extends Table implements TableActionListener { public class GenericContactTypeTable extends Table implements TableActionListener {

View File

@ -52,7 +52,7 @@ import org.apache.log4j.Logger;
* This class is part of the admin GUI of CCM and extends the standard form * This class is part of the admin GUI of CCM and extends the standard form
* in order to present forms for managing the multi-language categories. * in order to present forms for managing the multi-language categories.
* *
* @author Sören Bernstein (quasimodo) quasi@zes.uni-bremen.de * @author Sören Bernstein <quasi@quasiweb.de>
*/ */
public class GenericPersonContactAddForm extends BasicItemForm { public class GenericPersonContactAddForm extends BasicItemForm {

View File

@ -26,7 +26,7 @@ import com.arsdigita.cms.ui.authoring.SimpleEditStep;
import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess; import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
/** /**
* @author Sören Bernstein * @author Sören Bernstein <quasi@quasiweb.de>
*/ */
public class GenericPersonContactPropertiesStep extends SimpleEditStep { public class GenericPersonContactPropertiesStep extends SimpleEditStep {

View File

@ -52,7 +52,7 @@ import org.apache.log4j.Logger;
/** /**
* Lists all existing contact entries for a selected contact. * Lists all existing contact entries for a selected contact.
* *
* @author Sören Bernstein (quasimodo) quasi@barkhof.uni-bremen.de * @author Sören Bernstein <quasi@quasiweb.de>
*/ */
public class GenericPersonContactTable extends Table implements public class GenericPersonContactTable extends Table implements
TableActionListener { TableActionListener {

View File

@ -43,7 +43,7 @@ import java.util.Date;
/** /**
* *
* @author Sören Bernstein (quasimodo) <sbernstein@zes.uni-bremen.de> * @author Sören Bernstein <quasi@quasiweb.de>
*/ */
public class GenericPersonCreate extends PageCreate { public class GenericPersonCreate extends PageCreate {

View File

@ -63,7 +63,7 @@ import org.apache.log4j.Logger;
* *
* @version $Revision: #5 $ $Date: 2004/08/17 $ * @version $Revision: #5 $ $Date: 2004/08/17 $
* @author Nobuko Asakai (nasakai@redhat.com) * @author Nobuko Asakai (nasakai@redhat.com)
* @author Sören Bernstein (sbernstein@zes.uni-bremen.de) * @author Sören Bernstein <quasi@quasiweb.de>
*/ */
public class LinkPropertyForm extends FormSection public class LinkPropertyForm extends FormSection
implements FormInitListener, FormProcessListener, implements FormInitListener, FormProcessListener,

View File

@ -48,7 +48,7 @@ import org.apache.log4j.Logger;
* *
* @author Stanislav Freidin (sfreidin@arsdigita.com) * @author Stanislav Freidin (sfreidin@arsdigita.com)
* @author Michael Pih (pihman@arsdigita.com) * @author Michael Pih (pihman@arsdigita.com)
* @author Sören Bernstein <sbernstein@zes.uni-bremen.de> * @author Sören Bernstein <quasi@quasiweb.de>
* @version $Revision: #20 $ $DateTime: 2004/08/17 23:15:09 $ * @version $Revision: #20 $ $DateTime: 2004/08/17 23:15:09 $
* @version $Id: BaseImage.java 1571 2007-04-20 15:57:54Z apevec $ * @version $Id: BaseImage.java 1571 2007-04-20 15:57:54Z apevec $
*/ */

View File

@ -7,7 +7,7 @@ package com.arsdigita.cms.dispatcher;
/** /**
* *
* @author Sören Bernstein (quasimodo) <sbernstein@zes.uni-bremen.de> * @author Sören Bernstein <quasi@quasiweb.de>
*/ */
public class DownloadImage extends BaseImage { public class DownloadImage extends BaseImage {

View File

@ -6,7 +6,7 @@ package com.arsdigita.cms.dispatcher;
/** /**
* *
* @author Sören Bernstein (quasimodo) <sbernstein@zes.uni-bremen.de> * @author Sören Bernstein <quasi@quasiweb.de>
*/ */
public class StreamImage extends BaseImage { public class StreamImage extends BaseImage {

View File

@ -51,7 +51,7 @@ import javax.servlet.http.HttpServletResponse;
* The Item Search page. * The Item Search page.
* *
* @author Scott Seago (scott@arsdigita.com) * @author Scott Seago (scott@arsdigita.com)
* @author Sören Bernstein (sbernstein@quasiweb.de) * @author Sören Bernstein <quasi@quasiweb.de>
* @author Jens Pelzetter (jens@jp-digital.de) * @author Jens Pelzetter (jens@jp-digital.de)
*/ */
public class CMSItemSearchPage extends CMSApplicationPage { public class CMSItemSearchPage extends CMSApplicationPage {

View File

@ -69,7 +69,7 @@ import org.apache.log4j.Logger;
* @author Michael Pih * @author Michael Pih
* @author Stanislav Freidin &lt;sfreidin@redhat.com&gt; * @author Stanislav Freidin &lt;sfreidin@redhat.com&gt;
* @author Jack Chung * @author Jack Chung
* @author Sören Bernstein (quasimodo) <sbernstein@zes.uni-bremen.de> * @author Sören Bernstein <quasi@quasiweb.de>
* *
* @version $Id: ContentItemPage.java 2245 2011-11-15 08:03:57Z pboy $ * @version $Id: ContentItemPage.java 2245 2011-11-15 08:03:57Z pboy $
*/ */
@ -339,7 +339,7 @@ public class ContentItemPage extends CMSPage implements ActionListener {
getConfig().getHideTemplatesTab()); getConfig().getHideTemplatesTab());
} }
// Added by: Sören Bernstein <sbernstein@zes.uni-bremen.de> // Added by: Sören Bernstein <quasi@quasiweb.de>
// If the content item is a language invariant content item, don't show // If the content item is a language invariant content item, don't show
// the language pane // the language pane
if (item instanceof LanguageInvariantContentItem) { if (item instanceof LanguageInvariantContentItem) {

View File

@ -37,7 +37,7 @@ import com.arsdigita.util.LockableImpl;
* builder will return an {@link EmptyImageBrowserModel} * builder will return an {@link EmptyImageBrowserModel}
* *
* @author Stanislav Freidin (sfreidin@arsdigita.com) * @author Stanislav Freidin (sfreidin@arsdigita.com)
* @author Sören Bernstein (quasimodo) <sbernstein@zes.uni-bremen.de> * @author Sören Bernstein <quasi@quasiweb.de>
* @version $Id: DefaultImageBrowserModelBuilder.java 1940 2009-05-29 07:15:05Z * @version $Id: DefaultImageBrowserModelBuilder.java 1940 2009-05-29 07:15:05Z
* terry $ * terry $
*/ */

View File

@ -63,7 +63,7 @@ import org.apache.log4j.Logger;
* </code></pre></blockquote> * </code></pre></blockquote>
* *
* @author Stanislav Freidin * @author Stanislav Freidin
* @author Sören Bernstein (quasimodo) <sbernstein@quasiweb.de> * @author Sören Bernstein <quasi@quasiweb.de>
* @version $Id: ImageBrowser.java 1940 2009-05-29 07:15:05Z terry $ * @version $Id: ImageBrowser.java 1940 2009-05-29 07:15:05Z terry $
*/ */
public class ImageBrowser extends Table { public class ImageBrowser extends Table {

View File

@ -45,7 +45,7 @@ import com.arsdigita.cms.util.GlobalizationUtil;
* by keyword * by keyword
* *
* @author Stanislav Freidin (sfreidin@arsdigita.com) * @author Stanislav Freidin (sfreidin@arsdigita.com)
* @author Sören Bernstein (quasimodo) <sbernstein@zes.uni-bremen.de> * @author Sören Bernstein <quasi@quasiweb.de>
* @version $Id: ImageChooser.java 1940 2009-05-29 07:15:05Z terry $ * @version $Id: ImageChooser.java 1940 2009-05-29 07:15:05Z terry $
*/ */
public class ImageChooser extends BoxPanel { public class ImageChooser extends BoxPanel {

View File

@ -15,7 +15,7 @@ import com.arsdigita.cms.ReusableImageAsset;
* All components for image handling (like {@link ImageLibraryComponent} or * All components for image handling (like {@link ImageLibraryComponent} or
* {@link ImageUploadComponent}) should implement this interface. * {@link ImageUploadComponent}) should implement this interface.
* *
* @author Sören Bernstein (quasimodo) <sbernstein@zes.uni-bremen.de> * @author Sören Bernstein <quasi@quasiweb.de>
*/ */
public interface ImageComponent { public interface ImageComponent {

View File

@ -25,7 +25,7 @@ import org.apache.log4j.Logger;
* *
* This listerner is used by {@link ImageSelectPage}. * This listerner is used by {@link ImageSelectPage}.
* *
* @author Sören Bernstein (quasimodo) <sbernstein@zes.uni-bremen.de> * @author Sören Bernstein <quasi@quasiweb.de>
*/ */
public abstract class ImageComponentAbstractListener implements FormInitListener, public abstract class ImageComponentAbstractListener implements FormInitListener,
FormProcessListener, FormProcessListener,
@ -40,6 +40,7 @@ public abstract class ImageComponentAbstractListener implements FormInitListener
m_imageComponent = imageComponent; m_imageComponent = imageComponent;
} }
@Override
public void init(FormSectionEvent event) public void init(FormSectionEvent event)
throws FormProcessException { throws FormProcessException {
PageState ps = event.getPageState(); PageState ps = event.getPageState();
@ -49,17 +50,18 @@ public abstract class ImageComponentAbstractListener implements FormInitListener
} }
/** /**
* Call {@link #cancelled(com.arsdigita.bebop.PageState)} if the cancel button * Call {@link #cancelled(com.arsdigita.bebop.PageState)} if the cancel
* was pressed. * button was pressed.
* *
* @param event the {@link FormSectionEvent} * @param event the {@link FormSectionEvent}
* @throws FormProcessException * @throws FormProcessException
*/ */
@Override
public void submitted(FormSectionEvent event) throws FormProcessException { public void submitted(FormSectionEvent event) throws FormProcessException {
PageState ps = event.getPageState(); PageState ps = event.getPageState();
ImageComponent component = getImageComponent(ps); ImageComponent component = getImageComponent(ps);
if(component.getSaveCancelSection().getCancelButton().isSelected(ps)) { if (component.getSaveCancelSection().getCancelButton().isSelected(ps)) {
cancelled(ps); cancelled(ps);
} }
} }
@ -73,6 +75,7 @@ public abstract class ImageComponentAbstractListener implements FormInitListener
* @param event the {@link FormSectionEvent} * @param event the {@link FormSectionEvent}
* @throws FormProcessException * @throws FormProcessException
*/ */
@Override
public void process(FormSectionEvent event) throws FormProcessException { public void process(FormSectionEvent event) throws FormProcessException {
PageState ps = event.getPageState(); PageState ps = event.getPageState();
ImageComponent component = getImageComponent(ps); ImageComponent component = getImageComponent(ps);
@ -86,13 +89,15 @@ public abstract class ImageComponentAbstractListener implements FormInitListener
processImage(event, ps, component, image); processImage(event, ps, component, image);
} }
/** /**
* To be overridden by child if neccessary. * To be overridden by child if neccessary.
* *
* @param ps * @param ps
*/ */
protected void cancelled(PageState ps) {}; protected void cancelled(PageState ps) {
}
;
/** /**
* Process the input. * Process the input.

View File

@ -17,7 +17,7 @@ import com.arsdigita.toolbox.ui.ComponentMap;
* *
* This listerner is used by {@link ImagesPane}. * This listerner is used by {@link ImagesPane}.
* *
* @author Sören Bernstein (quasimodo) <sbernstein@zes.uni-bremen.de> * @author Sören Bernstein <quasi@quasiweb.de>
*/ */
class ImageComponentAdminListener extends ImageComponentAbstractListener implements ActionListener { class ImageComponentAdminListener extends ImageComponentAbstractListener implements ActionListener {

View File

@ -15,7 +15,7 @@ import org.apache.log4j.Logger;
* *
* This listerner is used by {@link ImageSelectPage}. * This listerner is used by {@link ImageSelectPage}.
* *
* @author Sören Bernstein (quasimodo) <sbernstein@zes.uni-bremen.de> * @author Sören Bernstein <quasi@quasiweb.de>
*/ */
public class ImageComponentSelectListener extends ImageComponentAbstractListener { public class ImageComponentSelectListener extends ImageComponentAbstractListener {

View File

@ -31,10 +31,9 @@ import com.arsdigita.web.URL;
import com.arsdigita.xml.Element; import com.arsdigita.xml.Element;
import java.math.BigDecimal; import java.math.BigDecimal;
/** /**
* Displays a single ImageAsset, showing its image, width, height, * Displays a single ImageAsset, showing its image, width, height, name and
* name and mime-type. * mime-type.
* *
* @author Michael Pih (pihman@arsdigita.com) * @author Michael Pih (pihman@arsdigita.com)
* @author Stanislav Freidin (sfreidin@arsdigita.com) * @author Stanislav Freidin (sfreidin@arsdigita.com)
@ -47,8 +46,8 @@ public class ImageDisplay extends SimpleComponent {
/** /**
* Construct a new ImageDisplay * Construct a new ImageDisplay
* *
* @param m The {@link ItemSelectionModel} which will supply * @param m The {@link ItemSelectionModel} which will supply this component
* this component with the {@link ImageAsset} * with the {@link ImageAsset}
*/ */
public ImageDisplay(ItemSelectionModel m) { public ImageDisplay(ItemSelectionModel m) {
super(); super();
@ -56,8 +55,8 @@ public class ImageDisplay extends SimpleComponent {
} }
/** /**
* @return the {@link ItemSelectionModel} which supplies this * @return the {@link ItemSelectionModel} which supplies this component with
* component with the {@link ImageAsset} * the {@link ImageAsset}
*/ */
public final ItemSelectionModel getImageSelectionModel() { public final ItemSelectionModel getImageSelectionModel() {
return m_item; return m_item;
@ -70,7 +69,7 @@ public class ImageDisplay extends SimpleComponent {
*/ */
@Override @Override
public void generateXML(PageState state, Element parent) { public void generateXML(PageState state, Element parent) {
if ( isVisible(state) ) { if (isVisible(state)) {
ImageAsset image = getImageAsset(state); ImageAsset image = getImageAsset(state);
@ -100,44 +99,49 @@ public class ImageDisplay extends SimpleComponent {
PageState state, PageState state,
Element element) { Element element) {
element.addAttribute("name_label", (String)GlobalizationUtil.globalize( element.addAttribute("name_label", (String) GlobalizationUtil.globalize(
"cms.contentasset.image.ui.display.name") "cms.contentasset.image.ui.display.name")
.localize()); .localize());
element.addAttribute("name", image.getName()); element.addAttribute("name", image.getName());
element.addAttribute("src", URL.getDispatcherPath() + element.addAttribute("src", URL.getDispatcherPath()
Service.getImageURL(image)); + Service.getImageURL(image));
element.addAttribute("mime_type_label", (String)GlobalizationUtil.globalize( element.addAttribute("mime_type_label", (String) GlobalizationUtil.globalize(
"cms.contentasset.image.ui.display.type") "cms.contentasset.image.ui.display.type")
.localize()); .localize());
MimeType mimeType = image.getMimeType(); MimeType mimeType = image.getMimeType();
if ( mimeType != null ) { if (mimeType != null) {
element.addAttribute("mime_type", mimeType.getLabel()); element.addAttribute("mime_type", mimeType.getLabel());
} }
element.addAttribute("width_label", (String)GlobalizationUtil.globalize( element.addAttribute("width_label", (String) GlobalizationUtil.globalize(
"cms.contentasset.image.ui.display.width") "cms.contentasset.image.ui.display.width")
.localize()); .localize());
BigDecimal width = image.getWidth(); BigDecimal width = image.getWidth();
if ( width != null ) { if (width != null) {
element.addAttribute("width", width.toString()); element.addAttribute("width", width.toString());
} else { } else {
element.addAttribute("width", (String)GlobalizationUtil.globalize( element.addAttribute("width", (String) GlobalizationUtil.globalize(
"cms.ui.unknown") "cms.ui.unknown")
.localize()); .localize());
} }
element.addAttribute("height_label", (String)GlobalizationUtil.globalize( element.addAttribute("height_label", (String) GlobalizationUtil.globalize(
"cms.contentasset.image.ui.display.height") "cms.contentasset.image.ui.display.height")
.localize()); .localize());
BigDecimal height = image.getHeight(); BigDecimal height = image.getHeight();
if ( height != null ) { if (height != null) {
element.addAttribute("height", height.toString()); element.addAttribute("height", height.toString());
} else { } else {
element.addAttribute("height", (String)GlobalizationUtil.globalize( element.addAttribute("height", (String) GlobalizationUtil.globalize(
"cms.ui.unknown") "cms.ui.unknown")
.localize()); .localize());
} }
element.addAttribute("dimension_label", (String) GlobalizationUtil.globalize(
"cms.contentasset.image.ui.display.dimensions")
.localize());
} }
/** /**
@ -150,5 +154,4 @@ public class ImageDisplay extends SimpleComponent {
Assert.exists(image, "Image asset"); Assert.exists(image, "Image asset");
return image; return image;
} }
} }

View File

@ -34,7 +34,7 @@ import java.math.BigDecimal;
* extended from {@link ImageComponentAbstractListener}. * extended from {@link ImageComponentAbstractListener}.
* *
* @author unknown * @author unknown
* @author Sören Bernstein (quasimodo) <sbernstein@zes.uni-bremen.de> * @author Sören Bernstein <quasi@quasiweb.de>
*/ */
public class ImageLibraryComponent extends SimpleContainer public class ImageLibraryComponent extends SimpleContainer
implements ImageComponent, Resettable { implements ImageComponent, Resettable {

View File

@ -23,15 +23,15 @@ import org.apache.log4j.Logger;
/** /**
* A {@link CMSPage} to select and upload images. * A {@link CMSPage} to select and upload images.
* *
* This page is used by /web/templates/ccm-cms/content-section/admin/image_select.jsp * This page is used by
* which is used by the OpenCCM plugin for Xihna editor. * /web/templates/ccm-cms/content-section/admin/image_select.jsp which is used
* by the OpenCCM plugin for Xinha editor.
* *
* @author Sören Bernstein (quasimodo) <sbernstein@zes.uni-bremen.de> * @author Sören Bernstein <quasi@quasiweb.de>
*/ */
public class ImageSelectPage extends CMSPage { public class ImageSelectPage extends CMSPage {
private static final Logger S_LOG = Logger.getLogger(ImagesPane.class); private static final Logger S_LOG = Logger.getLogger(ImagesPane.class);
private final static String XSL_CLASS = "CMS Admin"; private final static String XSL_CLASS = "CMS Admin";
private TabbedPane m_tabbedPane; private TabbedPane m_tabbedPane;
private ImageLibraryComponent m_imageLibrary; private ImageLibraryComponent m_imageLibrary;
@ -73,7 +73,7 @@ public class ImageSelectPage extends CMSPage {
// ActionListener to change the image component state param to the // ActionListener to change the image component state param to the
// right value // right value
addActionListener(new ActionListener() { addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent event) { public void actionPerformed(ActionEvent event) {
final PageState ps = event.getPageState(); final PageState ps = event.getPageState();
@ -152,8 +152,8 @@ public class ImageSelectPage extends CMSPage {
} }
/** /**
* Adds the specified component, with the specified tab name, to the tabbed * Adds the specified component, with the specified tab name, to the
* pane only if it is not null. * tabbed pane only if it is not null.
* *
* @param pane The pane to which to add the tab * @param pane The pane to which to add the tab
* @param tabName The name of the tab if it's added * @param tabName The name of the tab if it's added

View File

@ -16,7 +16,7 @@ import com.arsdigita.xml.Element;
* A component which will insert a javascript to the xml output with the image * A component which will insert a javascript to the xml output with the image
* information for the OpenCCM plugin for Xinha editor. * information for the OpenCCM plugin for Xinha editor.
* *
* @author Sören Bernstein (quasimodo) <sbernstein@zes.uni-bremen.de> * @author Sören Bernstein <quasi@quasiweb.de>
*/ */
public class ImageSelectResultComponent extends SimpleContainer public class ImageSelectResultComponent extends SimpleContainer
implements Resettable { implements Resettable {
@ -40,6 +40,13 @@ public class ImageSelectResultComponent extends SimpleContainer
m_valid = (m_image != null); m_valid = (m_image != null);
} }
/**
* Insert a script tag to the xml output with a JavaScript function to
* send the image information back to the Xinha plugin.
*
* @param state The current {@link PageState}
* @param parent The parent {@link Element}
*/
@Override @Override
public void generateXML(PageState state, Element parent) { public void generateXML(PageState state, Element parent) {
@ -48,7 +55,7 @@ public class ImageSelectResultComponent extends SimpleContainer
StringBuilder script = new StringBuilder(1000); StringBuilder script = new StringBuilder(1000);
// Create funtion // Create function
script.append("function selectImage(button) {"); script.append("function selectImage(button) {");
// If there is a valid image // If there is a valid image
@ -100,6 +107,7 @@ public class ImageSelectResultComponent extends SimpleContainer
* *
* @param state Page state * @param state Page state
*/ */
@Override
public void reset(PageState state) { public void reset(PageState state) {
setResult(null, null); setResult(null, null);
} }

View File

@ -25,12 +25,12 @@ import java.io.IOException;
/** /**
* An image upload component. * An image upload component.
* *
* This component can be used in different places to add image upload capabilities * This component can be used in different places to add image upload
* in a convinient way. This class uses a listener class which should be extended * capabilities in a convinient way. This class uses a listener class which
* from {@link ImageComponentAbstractListener}. * should be extended from {@link ImageComponentAbstractListener}.
* *
* @author unknown * @author unknown
* @author Sören Bernstein (quasimodo) <sbernstein@zes.uni-bremen.de> * @author Sören Bernstein <quasi@quasiweb.de>
*/ */
public class ImageUploadComponent extends Form implements ImageComponent { public class ImageUploadComponent extends Form implements ImageComponent {
@ -112,18 +112,24 @@ public class ImageUploadComponent extends Form implements ImageComponent {
* Removed by Quasimodo: Changed editing workflow, so that library comes * Removed by Quasimodo: Changed editing workflow, so that library comes
* first Also, library mode has now a link to upload images which will * first Also, library mode has now a link to upload images which will
* link to this form. Consequently, this link will create a loop, which * link to this form. Consequently, this link will create a loop, which
* isn't fatal but confusing. ActionLink library = new ActionLink( * isn't fatal but confusing.
* "Select an existing image" ); library.addActionListener( new *
* ActionListener() { public void actionPerformed( ActionEvent ev ) { * ActionLink library = new ActionLink("Select an existing image" );
* setImageComponent( ev.getPageState(), LIBRARY ); } } ); add( library, * library.addActionListener( new ActionListener() {
* ColumnPanel.FULL_WIDTH ); * public void actionPerformed( ActionEvent ev ) {
* setImageComponent( ev.getPageState(), LIBRARY );
* }
* } );
* add( library, ColumnPanel.FULL_WIDTH );
*/ */
} }
@Override
public SaveCancelSection getSaveCancelSection() { public SaveCancelSection getSaveCancelSection() {
return m_saveCancel; return m_saveCancel;
} }
@Override
public ReusableImageAsset getImage(FormSectionEvent event) public ReusableImageAsset getImage(FormSectionEvent event)
throws FormProcessException { throws FormProcessException {
PageState ps = event.getPageState(); PageState ps = event.getPageState();
@ -140,28 +146,32 @@ public class ImageUploadComponent extends Form implements ImageComponent {
} }
} }
@Override
public String getCaption(FormSectionEvent event) { public String getCaption(FormSectionEvent event) {
PageState ps = event.getPageState(); PageState ps = event.getPageState();
return (String) m_caption.getValue(ps); return (String) m_caption.getValue(ps);
} }
@Override
public String getDescription(FormSectionEvent event) { public String getDescription(FormSectionEvent event) {
PageState ps = event.getPageState(); PageState ps = event.getPageState();
return (String) m_description.getValue(ps); return (String) m_description.getValue(ps);
} }
@Override
public String getTitle(FormSectionEvent event) { public String getTitle(FormSectionEvent event) {
PageState ps = event.getPageState(); PageState ps = event.getPageState();
return (String) m_title.getValue(ps); return (String) m_title.getValue(ps);
} }
@Override
public String getUseContext(FormSectionEvent event) { public String getUseContext(FormSectionEvent event) {
PageState ps = event.getPageState(); PageState ps = event.getPageState();
return (String) m_useContext.getValue(ps); return (String) m_useContext.getValue(ps);
} }
@Override
public Form getForm() { public Form getForm() {
return this; return this;
} }
} }

View File

@ -37,7 +37,7 @@ import org.apache.log4j.Logger;
/** /**
* A {@link LayoutPanel} to insert into {@link ContentSectionPage}. * A {@link LayoutPanel} to insert into {@link ContentSectionPage}.
* *
* @author Sören Bernstein (quasimodo) <sbernstein@zes.uni-bremen.de> * @author Sören Bernstein <quasi@quasiweb.de>
*/ */
public class ImagesPane extends LayoutPanel implements Resettable { public class ImagesPane extends LayoutPanel implements Resettable {

View File

@ -53,7 +53,7 @@ import java.math.BigDecimal;
/** /**
* *
* @author Sören Bernstein (quasimodo) <sbernstein@zes.uni-bremen.de> * @author Sören Bernstein <quasi@quasiweb.de>
* @author Jens Pelzetter <jens@jp-digital.de> * @author Jens Pelzetter <jens@jp-digital.de>
*/ */
class ItemSearchCreateItemPane extends CMSContainer class ItemSearchCreateItemPane extends CMSContainer

View File

@ -51,7 +51,7 @@ import javax.servlet.http.HttpServletResponse;
* <p>The Item Search page.</p> * <p>The Item Search page.</p>
* *
* @author Scott Seago (scott@arsdigita.com) * @author Scott Seago (scott@arsdigita.com)
* @author Sören Bernstein (sbernstein@quasiweb.de) * @author Sören Bernstein <quasi@quasiweb.de>
* @author Jens Pelzetter (jens@jp-digital.de) * @author Jens Pelzetter (jens@jp-digital.de)
*/ */
public class ItemSearchPage extends CMSPage { public class ItemSearchPage extends CMSPage {

View File

@ -75,7 +75,7 @@ import org.apache.log4j.Logger;
* Edits a single category. * Edits a single category.
* *
* @author Justin Ross &lt;jross@redhat.com&gt; * @author Justin Ross &lt;jross@redhat.com&gt;
* @author Sören Bernstein (quasimodo) quasi@zes.uni-bremen.de * @author Sören Bernstein <quasi@quasiweb.de>
* @version $Id: CategoryItemPane.java 1967 2009-08-29 21:05:51Z pboy $ * @version $Id: CategoryItemPane.java 1967 2009-08-29 21:05:51Z pboy $
*/ */
class CategoryItemPane extends BaseItemPane { class CategoryItemPane extends BaseItemPane {

View File

@ -41,7 +41,7 @@ import org.apache.log4j.Logger;
* This class is part of the admin GUI of CCM and extends the standard form * This class is part of the admin GUI of CCM and extends the standard form
* in order to present forms for managing the multi-language categories. * in order to present forms for managing the multi-language categories.
* *
* @author Sören Bernstein (quasimodo) quasi@zes.uni-bremen.de * @author Sören Bernstein <quasi@quasiweb.de>
* @version $Id: CategoryLocalizationAddForm.java 287 2005-02-22 00:29:02Z sskracic $ * @version $Id: CategoryLocalizationAddForm.java 287 2005-02-22 00:29:02Z sskracic $
*/ */
public class CategoryLocalizationAddForm extends CategoryLocalizationForm { public class CategoryLocalizationAddForm extends CategoryLocalizationForm {

View File

@ -37,7 +37,7 @@ import org.apache.log4j.Logger;
* This class is part of the admin GUI of CCM and extends the standard form * This class is part of the admin GUI of CCM and extends the standard form
* in order to present forms for managing the multi-language categories. * in order to present forms for managing the multi-language categories.
* *
* @author Sören Bernstein (quasimodo) quasi@zes.uni-bremen.de * @author Sören Bernstein <quasi@quasiweb.de>
* @version $Id: CategoryLocalizationEditForm.java $ * @version $Id: CategoryLocalizationEditForm.java $
*/ */
public class CategoryLocalizationEditForm extends CategoryLocalizationForm { public class CategoryLocalizationEditForm extends CategoryLocalizationForm {

View File

@ -48,7 +48,7 @@ import com.arsdigita.xml.Element;
* This class is part of the admin GUI of CCM and extends the standard form * This class is part of the admin GUI of CCM and extends the standard form
* in order to present forms for managing the multi-language categories. * in order to present forms for managing the multi-language categories.
* *
* @author Sören Bernstein (quasimodo) quasi@zes.uni-bremen.de * @author Sören Bernstein <quasi@quasiweb.de>
* @version $Id: $ * @version $Id: $
*/ */
public class CategoryLocalizationForm extends BaseForm { public class CategoryLocalizationForm extends BaseForm {

View File

@ -45,7 +45,7 @@ import java.util.Locale;
* This class is part of the admin GUI of CCM and extends the standard form in * This class is part of the admin GUI of CCM and extends the standard form in
* order to present forms for managing the multi-language categories. * order to present forms for managing the multi-language categories.
* *
* @author Sören Bernstein (quasimodo) quasi@zes.uni-bremen.de * @author Sören Bernstein <quasi@quasiweb.de>
*/ */
public class CategoryLocalizationTable extends Table implements TableActionListener { public class CategoryLocalizationTable extends Table implements TableActionListener {

View File

@ -16,7 +16,7 @@ import java.util.TooManyListenersException;
/** /**
* *
* @author Sören Bernstein (quasimodo) <sbernstein@zes.uni-bremen.de> * @author Sören Bernstein <quasi@quasiweb.de>
*/ */
public abstract class AbstractFolderPicker extends SingleSelect { public abstract class AbstractFolderPicker extends SingleSelect {

View File

@ -14,7 +14,7 @@ import com.arsdigita.cms.ItemCollection;
/** /**
* *
* @author Sören Bernstein (quasimodo) <sbernstein@zes.uni-bremen.de> * @author Sören Bernstein <quasi@quasiweb.de>
* @author Jens Pelzetter <jens@jp-digital.de> * @author Jens Pelzetter <jens@jp-digital.de>
* @version $Id$ * @version $Id$
*/ */

View File

@ -70,7 +70,7 @@ import javax.servlet.ServletException;
* item selection model is updated. * item selection model is updated.
* *
* @author <a href="mailto:lutter@arsdigita.com">David Lutterkort</a> * @author <a href="mailto:lutter@arsdigita.com">David Lutterkort</a>
* @author Sören Bernstein <sbernstein@zes.uni-bremen.de> * @author Sören Bernstein <quasi@quasiweb.de>
* @version $Id: FolderBrowser.java 2017 2009-10-04 09:03:45Z pboy $ * @version $Id: FolderBrowser.java 2017 2009-10-04 09:03:45Z pboy $
*/ */
public class FolderBrowser extends Table { public class FolderBrowser extends Table {
@ -509,7 +509,7 @@ public class FolderBrowser extends Table {
} }
/** /**
* Added by: Sören Bernstein <sbernstein@zes.uni-bremen.de> * Added by: Sören Bernstein <quasi@quasiweb.de>
* *
* Produce links to view an item in a specific language and show all * Produce links to view an item in a specific language and show all
* existing language version and the live status in the folder browser. * existing language version and the live status in the folder browser.

View File

@ -82,6 +82,7 @@ public class BaseRoleForm extends BaseForm {
} }
private class PrivilegePrinter implements PrintListener { private class PrivilegePrinter implements PrintListener {
@Override
public final void prepare(final PrintEvent e) { public final void prepare(final PrintEvent e) {
final CheckboxGroup target = (CheckboxGroup) e.getTarget(); final CheckboxGroup target = (CheckboxGroup) e.getTarget();
final PageState state = e.getPageState(); final PageState state = e.getPageState();
@ -107,6 +108,7 @@ public class BaseRoleForm extends BaseForm {
m_role = role; m_role = role;
} }
@Override
public final void validate(final ParameterEvent e) public final void validate(final ParameterEvent e)
throws FormProcessException { throws FormProcessException {
final PageState state = e.getPageState(); final PageState state = e.getPageState();

View File

@ -48,7 +48,7 @@ import java.util.List;
* search query engine. * search query engine.
* *
* @author unknown * @author unknown
* @author Sören Bernstein (sbernstein@quasiweb.de) * @author Sören Bernstein <quasi@quasiweb.de>
* @author Jens Pelzetter (jens@jp-digital.de) * @author Jens Pelzetter (jens@jp-digital.de)
*/ */
public class ItemQueryComponent extends BaseQueryComponent { public class ItemQueryComponent extends BaseQueryComponent {

View File

@ -41,7 +41,7 @@ import org.apache.log4j.Logger;
/** /**
* @author unknown * @author unknown
* @author Sören Bernstein * @author Sören Bernstein <quasi@quasiweb.de>
* @version $Id: AssignedTaskSection.java 1280 2006-07-27 09:12:09Z cgyg9330 $ * @version $Id: AssignedTaskSection.java 1280 2006-07-27 09:12:09Z cgyg9330 $
*/ */
public final class AssignedTaskSection extends Section { public final class AssignedTaskSection extends Section {

View File

@ -38,7 +38,7 @@ import java.util.StringTokenizer;
* Utility methods for dealing with the multilingual items. * Utility methods for dealing with the multilingual items.
* *
* @author Shashin Shinde (sshinde@redhat.com) * @author Shashin Shinde (sshinde@redhat.com)
* @author Sören Bernstein * @author Sören Bernstein <quasi@quasiweb.de>
*/ */
public class LanguageUtil { public class LanguageUtil {

View File

@ -84,16 +84,16 @@ public class Page extends BlockStylable implements Container {
*/ */
private static final String DELIMITER = "."; private static final String DELIMITER = ".";
/** /**
* The prefix that gets prepended to all state variables. Components must * The prefix that gets prepended to all state variables. Components
* not use variables starting with this prefix. This guarantees that the * must not use variables starting with this prefix. This guarantees
* page state and variables individual components wish to pass do not * that the page state and variables individual components wish to pass
* interfere with each other. * do not interfere with each other.
*/ */
private static final String COMPONENT_PREFIX = "bbp" + DELIMITER; private static final String COMPONENT_PREFIX = "bbp" + DELIMITER;
private static final String INTERNAL = COMPONENT_PREFIX; private static final String INTERNAL = COMPONENT_PREFIX;
/** /**
* The name of the special parameter that indicates which component has been * The name of the special parameter that indicates which component has
* selected. * been selected.
*/ */
static final String SELECTED = INTERNAL + "s"; static final String SELECTED = INTERNAL + "s";
static final String CONTROL_EVENT = INTERNAL + "e"; static final String CONTROL_EVENT = INTERNAL + "e";
@ -115,9 +115,9 @@ public class Page extends BlockStylable implements Container {
static final String INVISIBLE = INTERNAL + "i"; static final String INVISIBLE = INTERNAL + "i";
/** /**
* Map of stateful components (id --> Component) SortedMap used because * Map of stateful components (id --> Component) SortedMap used because
* component based hash for page is based on concatenation of component ids, * component based hash for page is based on concatenation of component
* and so need to guarantee that they are returned in the same order for the * ids, and so need to guarantee that they are returned in the same
* same page - cg. * order for the same page - cg.
*/ */
private SortedMap m_componentMap; private SortedMap m_componentMap;
private List m_components; private List m_components;
@ -134,9 +134,9 @@ public class Page extends BlockStylable implements Container {
private List m_actionListeners; private List m_actionListeners;
private List m_requestListeners; private List m_requestListeners;
/** /**
* The title of the page to be added in the head of HTML output. The title * The title of the page to be added in the head of HTML output. The
* is wrapped in a Label to allow developers to add PrintListeners to * title is wrapped in a Label to allow developers to add PrintListeners
* dynamically change the value of the title. * to dynamically change the value of the title.
*/ */
private Label m_title; private Label m_title;
/** /**
@ -145,24 +145,24 @@ public class Page extends BlockStylable implements Container {
*/ */
private RequestLocal m_currentTitle; private RequestLocal m_currentTitle;
/** /**
* A list of all the client-side stylesheets. The elements of the list are * A list of all the client-side stylesheets. The elements of the list
* of type Page.Stylesheet, defined at the end of this file. * are of type Page.Stylesheet, defined at the end of this file.
*/ */
private List m_clientStylesheets; private List m_clientStylesheets;
private StringParameter m_selected; private StringParameter m_selected;
private StringParameter m_controlEvent; private StringParameter m_controlEvent;
private StringParameter m_controlValue; private StringParameter m_controlValue;
/** /**
* The default (initial) visibility of components. The encoding is identical * The default (initial) visibility of components. The encoding is
* to that for PageState.m_invisible. * identical to that for PageState.m_invisible.
* *
* This variable is package-friendly since it needs to be accessed by * This variable is package-friendly since it needs to be accessed by
* PageState. * PageState.
*/ */
protected BitSet m_invisible; protected BitSet m_invisible;
/** /**
* The PageErrorDisplay component that will display page state validation * The PageErrorDisplay component that will display page state
* errors on this page * validation errors on this page
*/ */
private Component m_errorDisplay; private Component m_errorDisplay;
/** /**
@ -170,9 +170,10 @@ public class Page extends BlockStylable implements Container {
*/ */
private boolean m_finished = false; private boolean m_finished = false;
/** /**
* indicates whether pageState.stateAsURL() should export the entire state * indicates whether pageState.stateAsURL() should export the entire
* for this page, or whether it should only export the control event as a * state for this page, or whether it should only export the control
* URL and use the HttpSession for the rest of the page state. * event as a URL and use the HttpSession for the rest of the page
* state.
*/ */
private boolean m_useHttpSession = false; private boolean m_useHttpSession = false;
@ -182,14 +183,15 @@ public class Page extends BlockStylable implements Container {
* HttpSession instead of the URL query string. <P>If this returns * HttpSession instead of the URL query string. <P>If this returns
* <code>true</code>, then PageState.stateAsURL() will only export the * <code>true</code>, then PageState.stateAsURL() will only export the
* control event as a URL query string. If this returns * control event as a URL query string. If this returns
* <code>false</code>, then stateAsURL() will export the entire page state. * <code>false</code>, then stateAsURL() will export the entire page
* state.
* *
* *
* @see PageState#stateAsURL * @see PageState#stateAsURL
* *
* @return <code>true</code> if this page should export state through the * @return <code>true</code> if this page should export state through
* HttpSession; <code>false</code> if it should export using the URL query * the HttpSession; <code>false</code> if it should export using the URL
* string. * query string.
*/ */
public boolean isUsingHttpSession() { public boolean isUsingHttpSession() {
return m_useHttpSession; return m_useHttpSession;
@ -197,15 +199,15 @@ public class Page extends BlockStylable implements Container {
/** /**
* Indicates to this page whether it should export its entire state to * Indicates to this page whether it should export its entire state to
* subsequent requests through the URL query string, or if it should use the * subsequent requests through the URL query string, or if it should use
* HttpSession instead and only use the URL query string for the control * the HttpSession instead and only use the URL query string for the
* event. * control event.
* *
* @see PageState#stateAsURL * @see PageState#stateAsURL
* *
* @param b <code>true</code> if PageState.stateAsURL() will export only the * @param b <code>true</code> if PageState.stateAsURL() will export only
* control event as a URL query string. <code>false</code> if stateAsURL() * the control event as a URL query string. <code>false</code> if
* will export the entire page state. * stateAsURL() will export the entire page state.
*/ */
public void setUsingHttpSession(boolean b) { public void setUsingHttpSession(boolean b) {
m_useHttpSession = b; m_useHttpSession = b;
@ -269,7 +271,8 @@ public class Page extends BlockStylable implements Container {
} }
/** /**
* Creates an empty page with default title and implicit BoxPanel container. * Creates an empty page with default title and implicit BoxPanel
* container.
*/ */
public Page() { public Page() {
this(""); this("");
@ -302,21 +305,23 @@ public class Page extends BlockStylable implements Container {
* *
* @param c component to add to this container * @param c component to add to this container
*/ */
@Override
public void add(Component c) { public void add(Component c) {
m_panel.add(c); m_panel.add(c);
} }
/** /**
* Adds a component with the specified layout constraints to this container. * Adds a component with the specified layout constraints to this
* Layout constraints are defined in each layout container as static ints. * container. Layout constraints are defined in each layout container as
* To specify multiple constraints, use bitwise OR. * static ints. To specify multiple constraints, use bitwise OR.
* *
* @param c component to add to this container * @param c component to add to this container
* *
* @param constraints layout constraints (a bitwise OR of static ints in the * @param constraints layout constraints (a bitwise OR of static ints in
* particular layout) * the particular layout)
*/ */
@Override
public void add(Component c, int constraints) { public void add(Component c, int constraints) {
m_panel.add(c, constraints); m_panel.add(c, constraints);
} }
@ -325,11 +330,12 @@ public class Page extends BlockStylable implements Container {
* Returns * Returns
* <code>true</code> if this list contains the specified element. More * <code>true</code> if this list contains the specified element. More
* formally, returns * formally, returns
* <code>true</code> if and only if this list contains at least one element * <code>true</code> if and only if this list contains at least one
* e such that (o==null ? e==null : o.equals(e)). <P> This method returns * element e such that (o==null ? e==null : o.equals(e)). <P> This
* <code>true</code> only if the component has been directly added to this * method returns
* container. If this container contains another container that contains * <code>true</code> only if the component has been directly added to
* this component, this method returns * this container. If this container contains another container that
* contains this component, this method returns
* <code>false</code>. * <code>false</code>.
* *
* @param o element whose presence in this container is to be tested * @param o element whose presence in this container is to be tested
@ -337,20 +343,23 @@ public class Page extends BlockStylable implements Container {
* @return <code>true</code> if this Container contains the specified * @return <code>true</code> if this Container contains the specified
* component directly; <code>false</code> otherwise. * component directly; <code>false</code> otherwise.
*/ */
@Override
public boolean contains(Object o) { public boolean contains(Object o) {
return m_panel.contains(o); return m_panel.contains(o);
} }
/** /**
* Returns the component at the specified position. Each call to the add * Returns the component at the specified position. Each call to the add
* method increments the index. Since the user has no control over the index * method increments the index. Since the user has no control over the
* of added components (other than counting each call to add), this method * index of added components (other than counting each call to add),
* should be used in conjunction with indexOf. * this method should be used in conjunction with indexOf.
* *
* @param index the index of the item to be retrieved from this Container * @param index the index of the item to be retrieved from this
* Container
* *
* @return the component at the specified position in this container. * @return the component at the specified position in this container.
*/ */
@Override
public Component get(int index) { public Component get(int index) {
return m_panel.get(index); return m_panel.get(index);
} }
@ -360,13 +369,14 @@ public class Page extends BlockStylable implements Container {
* *
* @param c component to search for * @param c component to search for
* *
* @return the index in this list of the first occurrence of the specified * @return the index in this list of the first occurrence of the
* element, or -1 if this list does not contain this element. * specified element, or -1 if this list does not contain this element.
* *
* @pre c != null * @pre c != null
* @post contains(c) implies (return >= 0) && (return < size()) * @post contains(c) implies (return >= 0) && (return < size())
* @post !contains(c) implies return == -1 * @post !contains(c) implies return == -1
*/ */
@Override
public int indexOf(Component c) { public int indexOf(Component c) {
return m_panel.indexOf(c); return m_panel.indexOf(c);
} }
@ -378,17 +388,19 @@ public class Page extends BlockStylable implements Container {
* @return <code>true</code> if this container contains no * * * @return <code>true</code> if this container contains no * *
* components; <code>false</code> otherwise. * components; <code>false</code> otherwise.
*/ */
@Override
public boolean isEmpty() { public boolean isEmpty() {
return m_panel.isEmpty(); return m_panel.isEmpty();
} }
/** /**
* Returns the number of elements in this container. This does not * Returns the number of elements in this container. This does not
* recursively count the components that are indirectly contained in this * recursively count the components that are indirectly contained in
* container. * this container.
* *
* @return the number of components directly in this container. * @return the number of components directly in this container.
*/ */
@Override
public int size() { public int size() {
return m_panel.size(); return m_panel.size();
} }
@ -410,8 +422,8 @@ public class Page extends BlockStylable implements Container {
/** /**
* Set the Container used for rendering components on this page. Caution * Set the Container used for rendering components on this page. Caution
* should be used with this function, as the existing container is simply * should be used with this function, as the existing container is
* overwritten. * simply overwritten.
* *
* @author Matthew Booth (mbooth@redhat.com) * @author Matthew Booth (mbooth@redhat.com)
*/ */
@ -459,11 +471,11 @@ public class Page extends BlockStylable implements Container {
} }
/** /**
* Sets the {@link Component} that will display the validation errors in the * Sets the {@link Component} that will display the validation errors in
* current {@link PageState}. Any validation error in the * the current {@link PageState}. Any validation error in the
* <code>PageState</code> will cause the * <code>PageState</code> will cause the
* <code>Page</code> to completely ignore all other components and render * <code>Page</code> to completely ignore all other components and
* only the error display component. <p> By default, a * render only the error display component. <p> By default, a
* {@link PageErrorDisplay} component is used to display the validation * {@link PageErrorDisplay} component is used to display the validation
* errors. * errors.
* *
@ -476,11 +488,11 @@ public class Page extends BlockStylable implements Container {
} }
/** /**
* Gets the {@link Component} that will display the validation errors in the * Gets the {@link Component} that will display the validation errors in
* current {@link PageState}. Any validation error in the * the current {@link PageState}. Any validation error in the
* <code>PageState</code> will cause the * <code>PageState</code> will cause the
* <code>Page</code> to completely ignore all other components and render * <code>Page</code> to completely ignore all other components and
* only the error display component. <p> By default, a * render only the error display component. <p> By default, a
* {@link PageErrorDisplay} component is used to display the validation * {@link PageErrorDisplay} component is used to display the validation
* errors. * errors.
* *
@ -493,16 +505,16 @@ public class Page extends BlockStylable implements Container {
/** /**
* Adds a client-side stylesheet that should be used in HTML output. * Adds a client-side stylesheet that should be used in HTML output.
* Arbitrarily many client-side stylesheets can be added with this method. * Arbitrarily many client-side stylesheets can be added with this
* To use a CSS stylesheet, call something like * method. To use a CSS stylesheet, call something like
* <code>setStyleSheet("style.css", "text/css")</code>. * <code>setStyleSheet("style.css", "text/css")</code>.
* *
* <p> These values will ultimately wind up in a <tt>&lt;link&gt;</tt> tag * <p> These values will ultimately wind up in a <tt>&lt;link&gt;</tt>
* in the head of the HTML page. * tag in the head of the HTML page.
* *
* <p> Note that the stylesheet set with this call has nothing to do with * <p> Note that the stylesheet set with this call has nothing to do
* the XSLT stylesheet (transformer) that is applied to the XML generated * with the XSLT stylesheet (transformer) that is applied to the XML
* from this page! * generated from this page!
* *
* @param styleSheetURI the location of the stylesheet * @param styleSheetURI the location of the stylesheet
* @param mimeType the MIME type of the stylesheet, usually * @param mimeType the MIME type of the stylesheet, usually
@ -514,14 +526,14 @@ public class Page extends BlockStylable implements Container {
} }
/** /**
* Adds a global state parameter to this page. Global parameters are values * Adds a global state parameter to this page. Global parameters are
* that need to be preserved between requests, but that have no special * values that need to be preserved between requests, but that have no
* connection to any of the components on the page. For a page that displays * special connection to any of the components on the page. For a page
* details about an item, a global parameter would be used to identify the * that displays details about an item, a global parameter would be used
* item. * to identify the item.
* *
* <p> If the parameter was previously added as a component state parameter, * <p> If the parameter was previously added as a component state
* its name is unmangled and stays unmangled. * parameter, its name is unmangled and stays unmangled.
* *
* @param p the global parameter to add * @param p the global parameter to add
* *
@ -544,10 +556,10 @@ public class Page extends BlockStylable implements Container {
* &lt;bebop:title> ... value set with <i>setTitle</i> ... &lt;/bebop:title> * &lt;bebop:title> ... value set with <i>setTitle</i> ... &lt;/bebop:title>
* &lt;bebop:stylesheet href='styleSheetURI' type='mimeType'> * &lt;bebop:stylesheet href='styleSheetURI' type='mimeType'>
* ... page content gnerated by children ... * ... page content gnerated by children ...
* &lt;/bebop:page></pre> The content of the <tt>&lt;title&gt;</tt> element * &lt;/bebop:page></pre> The content of the <tt>&lt;title&gt;</tt>
* can be set by calling {@link #setTitle setTitle}. The * element can be set by calling {@link #setTitle setTitle}. The
* <tt>&lt;stylesheet&gt;</tt> element will only be present if a stylesheet * <tt>&lt;stylesheet&gt;</tt> element will only be present if a
* has been set with {@link * stylesheet has been set with {@link
* #setStyleSheet setStyleSheet}. * #setStyleSheet setStyleSheet}.
* *
* @param ps the page state for the current page * @param ps the page state for the current page
@ -575,8 +587,8 @@ public class Page extends BlockStylable implements Container {
} }
/** /**
* Constructs a DOM or JDOM tree with all components on the page. The tree * Constructs a DOM or JDOM tree with all components on the page. The
* represents the page that results from the * tree represents the page that results from the
* {@link javax.servlet.http.HttpServletRequest} kept in the * {@link javax.servlet.http.HttpServletRequest} kept in the
* <code>state</code>. * <code>state</code>.
* *
@ -619,16 +631,16 @@ public class Page extends BlockStylable implements Container {
/** /**
* Do nothing. Top-level add nodes is meaningless. * Do nothing. Top-level add nodes is meaningless.
*/ */
@Override
public void generateXML(PageState state, Element elt) { public void generateXML(PageState state, Element elt) {
return;
} }
/** /**
* Creates a PageState object and processes it by calling the respond method * Creates a PageState object and processes it by calling the respond
* on the selected component. Processes a request by notifying the component * method on the selected component. Processes a request by notifying
* from which the process originated and {@link #fireActionEvent * the component from which the process originated and {@link #fireActionEvent
* broadcasts} an {@link ActionEvent} to all the listeners that registered * broadcasts} an {@link ActionEvent} to all the listeners that
* with {@link #addActionListener addActionListener}. * registered with {@link #addActionListener addActionListener}.
* *
* @see #generateXML(PageState,Document) generateXML * @see #generateXML(PageState,Document) generateXML
* @pre isLocked() * @pre isLocked()
@ -701,8 +713,8 @@ public class Page extends BlockStylable implements Container {
* calling generateXML on each. Does NOT do the rendering. If the HTTP * calling generateXML on each. Does NOT do the rendering. If the HTTP
* response has already been committed, does not build the XML document. * response has already been committed, does not build the XML document.
* *
* @return a DOM ready for rendering, or null if the response has already * @return a DOM ready for rendering, or null if the response has
* been committed. * already been committed.
* @post res.isCommitted() == (return == null) * @post res.isCommitted() == (return == null)
*/ */
public Document buildDocument(HttpServletRequest req, public Document buildDocument(HttpServletRequest req,
@ -733,8 +745,9 @@ public class Page extends BlockStylable implements Container {
} }
/** /**
* Finishes building the page. The tree of components is traversed and each * Finishes building the page. The tree of components is traversed and
* component is told to add its state parameters to the page's state model. * each component is told to add its state parameters to the page's
* state model.
* *
* @pre ! isLocked() * @pre ! isLocked()
*/ */
@ -743,6 +756,7 @@ public class Page extends BlockStylable implements Container {
Assert.isUnlocked(this); Assert.isUnlocked(this);
Traversal componentRegistrar = new Traversal() { Traversal componentRegistrar = new Traversal() {
@Override
protected void act(Component c) { protected void act(Component c) {
addComponent(c); addComponent(c);
c.register(Page.this); c.register(Page.this);
@ -764,15 +778,17 @@ public class Page extends BlockStylable implements Container {
/** /**
* Locks the page and all its components against further modifications. * Locks the page and all its components against further modifications.
* *
* <p>Locking a page helps in finding mistakes that result from modifying a * <p>Locking a page helps in finding mistakes that result from
* page's structure.</P> * modifying a page's structure.</P>
*/ */
@Override
public void lock() { public void lock() {
if (!m_finished) { if (!m_finished) {
finish(); finish();
} }
m_stateModel.lock(); m_stateModel.lock();
Traversal componentLocker = new Traversal() { Traversal componentLocker = new Traversal() {
@Override
protected void act(Component c) { protected void act(Component c) {
c.lock(); c.lock();
} }
@ -783,13 +799,14 @@ public class Page extends BlockStylable implements Container {
super.lock(); super.lock();
} }
@Override
public void respond(PageState state) throws javax.servlet.ServletException { public void respond(PageState state) throws javax.servlet.ServletException {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
/** /**
* Registers a listener that is notified whenever a request to this page is * Registers a listener that is notified whenever a request to this page
* made, after the selected component has had a chance to respond. * is made, after the selected component has had a chance to respond.
* *
* @pre l != null * @pre l != null
* @pre ! isLocked() * @pre ! isLocked()
@ -811,8 +828,8 @@ public class Page extends BlockStylable implements Container {
} }
/** /**
* Registers a listener that is notified whenever a request to this page is * Registers a listener that is notified whenever a request to this page
* made, before the selected component has had a chance to respond. * is made, before the selected component has had a chance to respond.
* *
* @pre l != null * @pre l != null
* @pre ! isLocked() * @pre ! isLocked()
@ -835,9 +852,9 @@ public class Page extends BlockStylable implements Container {
} }
/** /**
* Broadcasts an {@link ActionEvent} to all registered listeners. The source * Broadcasts an {@link ActionEvent} to all registered listeners. The
* of the event is this page, and the state recorded in the event is the one * source of the event is this page, and the state recorded in the event
* resulting from processing the current request. * is the one resulting from processing the current request.
* *
* @param the state for this event * @param the state for this event
* *
@ -862,9 +879,9 @@ public class Page extends BlockStylable implements Container {
} }
/** /**
* Broadcasts a {@link RequestEvent} to all registered listeners. The source * Broadcasts a {@link RequestEvent} to all registered listeners. The
* of the event is this page, and the state recorded in the event is the one * source of the event is this page, and the state recorded in the event
* resulting from processing the current request. * is the one resulting from processing the current request.
* *
* @param state the state for this event * @param state the state for this event
* *
@ -890,8 +907,8 @@ public class Page extends BlockStylable implements Container {
/** /**
* Export page generator information if set. The m_pageGenerator is a * Export page generator information if set. The m_pageGenerator is a
* HashMap containing the information as key value. In general this should * HashMap containing the information as key value. In general this
* include generator name and generator version. * should include generator name and generator version.
* *
* @param page parent element - should be bebeop:page * @param page parent element - should be bebeop:page
* *
@ -962,10 +979,10 @@ public class Page extends BlockStylable implements Container {
/** /**
* Registers a state parameter for a component. It is permissible to * Registers a state parameter for a component. It is permissible to
* register the same state parameter several times, from the same or * register the same state parameter several times, from the same or
* different components. The name of the parameter will be changed to ensure * different components. The name of the parameter will be changed to
* that it won't clash with any other component's parameter. If the * ensure that it won't clash with any other component's parameter. If
* parameter is added more than once, the name is only changed the first * the parameter is added more than once, the name is only changed the
* time it is added. * first time it is added.
* *
* @param c the component to register the parameter for * @param c the component to register the parameter for
* @param p the state parameter to register * @param p the state parameter to register
@ -1007,13 +1024,13 @@ public class Page extends BlockStylable implements Container {
} }
/** /**
* Gets the state index of a component. This is the number assigned to the * Gets the state index of a component. This is the number assigned to
* component in the register traveral * the component in the register traveral
* *
* @param c the component to search for * @param c the component to search for
* *
* @return the index in this list of the first occurrence of the specified * @return the index in this list of the first occurrence of the
* element, or -1 if this list does not contain this element. * specified element, or -1 if this list does not contain this element.
* *
* @pre c != null * @pre c != null
* @post contains(c) implies (return >= 0) && (return < size()) * @post contains(c) implies (return >= 0) && (return < size())
@ -1061,7 +1078,8 @@ public class Page extends BlockStylable implements Container {
} }
/** /**
* Gets the form model that contains the parameters for the page's state. * Gets the form model that contains the parameters for the page's
* state.
*/ */
public final FormModel getStateModel() { public final FormModel getStateModel() {
return m_stateModel; return m_stateModel;
@ -1077,7 +1095,8 @@ public class Page extends BlockStylable implements Container {
} }
/** /**
* Checks whether the specified component is visible by default on the page. * Checks whether the specified component is visible by default on the
* page.
* *
* @param c a component contained in the page * @param c a component contained in the page
* @return <code>true</code> if the component is visible by default; * @return <code>true</code> if the component is visible by default;
@ -1092,10 +1111,10 @@ public class Page extends BlockStylable implements Container {
} }
/** /**
* Sets whether the specified component is visible by default. The default * Sets whether the specified component is visible by default. The
* visibility is used when a page is displayed for the first time and on * default visibility is used when a page is displayed for the first
* subsequent requests until the visibility of a component is changed * time and on subsequent requests until the visibility of a component
* explicitly with {@link Component#setVisible * is changed explicitly with {@link Component#setVisible
* Component.setVisible}. * Component.setVisible}.
* *
* <p> When a component is first added to a page, it is visible. * <p> When a component is first added to a page, it is visible.
@ -1141,6 +1160,7 @@ public class Page extends BlockStylable implements Container {
void reset(final PageState ps, Component cmpnt) { void reset(final PageState ps, Component cmpnt) {
Traversal resetter = new Traversal() { Traversal resetter = new Traversal() {
@Override
protected void act(Component c) { protected void act(Component c) {
Collection cp = getComponentParameters(c); Collection cp = getComponentParameters(c);
if (cp != null) { if (cp != null) {
@ -1157,8 +1177,8 @@ public class Page extends BlockStylable implements Container {
} }
/** /**
* Return the prefix that is prepended to each component's state parameters * Return the prefix that is prepended to each component's state
* to keep them unique. * parameters to keep them unique.
*/ */
private final String componentPrefix(Component c) { private final String componentPrefix(Component c) {
if (c == null) { if (c == null) {
@ -1282,8 +1302,8 @@ public class Page extends BlockStylable implements Container {
} }
/** /**
* return a string that represents an ordered list of component ids used on * return a string that represents an ordered list of component ids used
* the page. For situations where only the components present is of * on the page. For situations where only the components present is of
* importance, this may be used by implementations of hashCode & equals * importance, this may be used by implementations of hashCode & equals
* *
* @return * @return
@ -1299,7 +1319,7 @@ public class Page extends BlockStylable implements Container {
}*/ }*/
Date start = new Date(); Date start = new Date();
StringBuffer hashString = new StringBuffer(); StringBuilder hashString = new StringBuilder();
while (it.hasNext()) { while (it.hasNext()) {
String componentId = (String) it.next(); String componentId = (String) it.next();
hashString.append(componentId); hashString.append(componentId);

View File

@ -26,7 +26,7 @@ import com.arsdigita.bebop.util.GlobalizationUtil;
* the right. * the right.
* *
* @author Stanislav Freidin * @author Stanislav Freidin
* @author Sören Bernstein (sbernstein@quasiweb.de) * @author Sören Bernstein <quasi@quasiweb.de>
* @version $Id: SaveCancelSection.java 287 2005-02-22 00:29:02Z sskracic $ * @version $Id: SaveCancelSection.java 287 2005-02-22 00:29:02Z sskracic $
*/ */
public class SaveCancelSection extends FormSection { public class SaveCancelSection extends FormSection {

View File

@ -48,7 +48,7 @@ import java.util.Locale;
* @author Karl Goldstein * @author Karl Goldstein
* @author Uday Mathur * @author Uday Mathur
* @author Michael Pih * @author Michael Pih
* @author Sören Bernstein * @author Sören Bernstein <quasi@quasiweb.de>
* @version $Id: Date.java 288 2010-02-20 07:29:00Z sbernstein $ * @version $Id: Date.java 288 2010-02-20 07:29:00Z sbernstein $
*/ */
public class Date extends Widget implements BebopConstants { public class Date extends Widget implements BebopConstants {

View File

@ -30,7 +30,7 @@ import com.arsdigita.xml.Element;
* A class representing a date and time field in an HTML form. * A class representing a date and time field in an HTML form.
* (based on the code in Date.java) * (based on the code in Date.java)
* *
* @author Sören Bernstein * @author Sören Bernstein <quasi@quasiweb.de>
* @version $Id: DateTime.java 288 2010-02-20 07:29:00Z ssbernstein $ * @version $Id: DateTime.java 288 2010-02-20 07:29:00Z ssbernstein $
*/ */
public class DateTime extends Widget implements BebopConstants { public class DateTime extends Widget implements BebopConstants {

View File

@ -38,7 +38,7 @@ import java.util.Locale;
* *
* @see com.arsdigita.bebop.form.DateTime * @see com.arsdigita.bebop.form.DateTime
* @author Dave Turner * @author Dave Turner
* @author Sören Bernstein * @author Sören Bernstein <quasi@quasiweb.de>
* @version $Id: Time.java 288 2010-02-20 07:29:00Z sbernstein $ * @version $Id: Time.java 288 2010-02-20 07:29:00Z sbernstein $
*/ */
public class Time extends Widget implements BebopConstants { public class Time extends Widget implements BebopConstants {

View File

@ -28,7 +28,7 @@ import javax.servlet.http.HttpServletRequest;
* combination with an additional Boolean DB field to keep track * combination with an additional Boolean DB field to keep track
* of the incomplete entry. * of the incomplete entry.
* *
* @author Sören Bernstein * @author Sören Bernstein <quasi@quasiweb.de>
*/ */
public class IncompleteDateParameter extends DateParameter { public class IncompleteDateParameter extends DateParameter {

View File

@ -27,7 +27,7 @@ import org.apache.log4j.Logger;
/** /**
* Stores the configuration record for the Categorization functionality. * Stores the configuration record for the Categorization functionality.
* *
* @author Sören Bernstein (quasimodo) quasi@zes.uni-bremen.de * @author Sören Bernstein <quasi@quasiweb.de>
* @version $Id: CategorizationConfig.java 1169 2008-06-05 16:08:25Z quasimodo $ * @version $Id: CategorizationConfig.java 1169 2008-06-05 16:08:25Z quasimodo $
*/ */
public final class CategorizationConfig extends AbstractConfig { public final class CategorizationConfig extends AbstractConfig {

View File

@ -27,7 +27,7 @@ import java.math.BigDecimal;
/** /**
* *
* @author Sören Bernstein (quasimodo) quasi@zes.uni-bremen.de * @author Sören Bernstein <quasi@quasiweb.de>
*/ */
public class CategoryLocalization extends ACSObject { public class CategoryLocalization extends ACSObject {

View File

@ -29,7 +29,7 @@ import com.arsdigita.persistence.DataCollection;
* Category} and other classes. See, for example, {@link Category#getChildren()} * Category} and other classes. See, for example, {@link Category#getChildren()}
* or {@link Category#getDescendants()}.</p> * or {@link Category#getDescendants()}.</p>
* *
* @author Sören Bernstein (quasimodo) quasi@zes.uni-bremen.de * @author Sören Bernstein <quasi@quasiweb.de>
**/ **/
public class CategoryLocalizationCollection extends ACSObjectCollection { public class CategoryLocalizationCollection extends ACSObjectCollection {

View File

@ -16,7 +16,7 @@ import javax.servlet.http.HttpSession;
/** /**
* *
* @author Sören Bernstein * @author Sören Bernstein <quasi@quasiweb.de>
*/ */
public class GlobalizationHelper { public class GlobalizationHelper {

View File

@ -193,6 +193,7 @@ public class PermissionManager {
// to know that there is an assertion in the save() method in // to know that there is an assertion in the save() method in
// the Permission class. // the Permission class.
new KernelExcursion() { new KernelExcursion() {
@Override
public void excurse() { public void excurse() {
setEffectiveParty(Kernel.getSystemParty()); setEffectiveParty(Kernel.getSystemParty());
p.save(); p.save();

View File

@ -59,18 +59,16 @@ import org.apache.log4j.Logger;
* DataQueryImpl * DataQueryImpl
* *
* @author Rafael H. Schloming &lt;rhs@mit.edu&gt; * @author Rafael H. Schloming &lt;rhs@mit.edu&gt;
* @author Sören Bernstein <quasi@quasiweb.de>
* @version $Id: DataQueryImpl.java 1304 2006-08-31 13:12:47Z sskracic $ * @version $Id: DataQueryImpl.java 1304 2006-08-31 13:12:47Z sskracic $
*/ */
class DataQueryImpl implements DataQuery { class DataQueryImpl implements DataQuery {
private static final Logger s_log = Logger.getLogger(DataQueryImpl.class); private static final Logger s_log = Logger.getLogger(DataQueryImpl.class);
private static final String s_unalias = private static final String s_unalias =
"com.arsdigita.persistence.DataQueryImpl.unalias"; "com.arsdigita.persistence.DataQueryImpl.unalias";
private static final String s_mapAndAddPath = private static final String s_mapAndAddPath =
"com.arsdigita.persistence.DataQueryImpl.mapAndAddPath"; "com.arsdigita.persistence.DataQueryImpl.mapAndAddPath";
private Map m_options = new HashMap(); private Map m_options = new HashMap();
private SQLParser getParser(String key, Reader reader, private SQLParser getParser(String key, Reader reader,
@ -86,34 +84,25 @@ class DataQueryImpl implements DataQuery {
return p; return p;
} }
private Session m_ssn; private Session m_ssn;
private com.redhat.persistence.Session m_pssn; private com.redhat.persistence.Session m_pssn;
private HashMap m_bindings = new HashMap(); private HashMap m_bindings = new HashMap();
final Signature m_originalSig; final Signature m_originalSig;
private Signature m_signature; private Signature m_signature;
final private Expression m_originalExpr; final private Expression m_originalExpr;
private Expression m_expr; private Expression m_expr;
Cursor m_cursor = null; Cursor m_cursor = null;
private CompoundFilterImpl m_filter; private CompoundFilterImpl m_filter;
private ArrayList m_orders = new ArrayList(); private ArrayList m_orders = new ArrayList();
// This indicates the offset/limit sent of the query // This indicates the offset/limit sent of the query
private Integer m_offset = null; private Integer m_offset = null;
private Integer m_limit = null; private Integer m_limit = null;
// This indicates the limits on the number of rows returned by the query // This indicates the limits on the number of rows returned by the query
private int m_lowerBound = 0; private int m_lowerBound = 0;
private int m_upperBound = Integer.MAX_VALUE; private int m_upperBound = Integer.MAX_VALUE;
private final List m_aliases = new ArrayList(); private final List m_aliases = new ArrayList();
// used by addPath to implement addPath for paths traversing 0..n // used by addPath to implement addPath for paths traversing 0..n
private HashMap m_joins = new HashMap(); private HashMap m_joins = new HashMap();
private final FilterFactory m_factory; private final FilterFactory m_factory;
DataQueryImpl(Session ssn, DataSet ds) { DataQueryImpl(Session ssn, DataSet ds) {
@ -171,8 +160,7 @@ class DataQueryImpl implements DataQuery {
// addJoin needs to join against the static-ified version of the All. // addJoin needs to join against the static-ified version of the All.
// this is equivalent to testing if m_originalExpr instanceof All // this is equivalent to testing if m_originalExpr instanceof All
if (this.getClass().equals(DataQueryImpl.class)) { if (this.getClass().equals(DataQueryImpl.class)) {
m_expr = new Define m_expr = new Define(new Static(getTypeInternal().getQualifiedName(), m_bindings),
(new Static(getTypeInternal().getQualifiedName(), m_bindings),
"this"); "this");
} else { } else {
m_expr = new Define(m_originalExpr, "this"); m_expr = new Define(m_originalExpr, "this");
@ -183,18 +171,18 @@ class DataQueryImpl implements DataQuery {
m_joins.put(null, "this"); m_joins.put(null, "this");
} }
@Override
public boolean first() { public boolean first() {
throw new Error("not implemented"); throw new Error("not implemented");
} }
@Override
public boolean isEmpty() { public boolean isEmpty() {
try { try {
// can not use checkCursor() because then we can't add filters // can not use checkCursor() because then we can't add filters
// after calls to isEmpty // after calls to isEmpty
if (m_cursor == null) { if (m_cursor == null) {
return new DataSet return new DataSet(m_pssn, m_signature, makeExpr()).isEmpty();
(m_pssn, m_signature, makeExpr()).isEmpty();
} else { } else {
return m_cursor.getDataSet().isEmpty(); return m_cursor.getDataSet().isEmpty();
} }
@ -203,36 +191,66 @@ class DataQueryImpl implements DataQuery {
} }
} }
@Override
public boolean isBeforeFirst() { public boolean isBeforeFirst() {
checkCursor(); checkCursor();
return m_cursor.isBeforeFirst(); return m_cursor.isBeforeFirst();
} }
@Override
public boolean isFirst() { public boolean isFirst() {
checkCursor(); checkCursor();
return m_cursor.isFirst(); return m_cursor.isFirst();
} }
@Override
public boolean isLast() { public boolean isLast() {
throw new Error("not implemented"); return size() == getPosition();
} }
@Override
public boolean isAfterLast() { public boolean isAfterLast() {
checkCursor(); checkCursor();
return m_cursor.isAfterLast(); return m_cursor.isAfterLast();
} }
@Override
public boolean last() { public boolean last() {
throw new Error("not implemented"); throw new Error("not implemented");
} }
@Override
public boolean previous() { public boolean previous() {
throw new Error("not implemented"); checkCursor();
if (m_cursor.isClosed()) {
return false;
}
int pre = getPosition();
boolean result;
try {
Profiler.startOp("DB");
result = m_cursor.previous();
} catch (ProtoException e) {
throw PersistenceException.newInstance(e);
} finally {
Profiler.stopOp("DB");
}
if (result) {
if (getPosition() == m_upperBound) {
if (m_cursor.previous()) {
throw new PersistenceException("cursor exceeded upper bound");
}
}
} else {
if (pre < m_lowerBound) {
throw new PersistenceException("cursor failed to meet lower bound");
}
}
return result;
} }
public void addPath(String path) { public void addPath(String path) {
@ -242,8 +260,7 @@ class DataQueryImpl implements DataQuery {
private void addPath(Path path, boolean requiresFetching) { private void addPath(Path path, boolean requiresFetching) {
if (m_cursor != null) { if (m_cursor != null) {
throw new PersistenceException throw new PersistenceException("Paths cannot be added on an active data query.");
("Paths cannot be added on an active data query.");
} }
addJoin(path); addJoin(path);
@ -256,7 +273,9 @@ class DataQueryImpl implements DataQuery {
} }
protected Path resolvePath(Path path) { protected Path resolvePath(Path path) {
if (m_joins.size() == 0) { return path; } if (m_joins.size() == 0) {
return path;
}
Path base = path; Path base = path;
for (; base != null; base = base.getParent()) { for (; base != null; base = base.getParent()) {
@ -265,8 +284,7 @@ class DataQueryImpl implements DataQuery {
} }
} }
Path candidate = Path.add Path candidate = Path.add((String) m_joins.get(base), Path.relative(base, path));
((String) m_joins.get(base), Path.relative(base, path));
if (m_signature.exists(candidate)) { if (m_signature.exists(candidate)) {
return candidate; return candidate;
} }
@ -301,23 +319,17 @@ class DataQueryImpl implements DataQuery {
Expression prevColl; Expression prevColl;
if (prev == null) { if (prev == null) {
prevColl = new Define prevColl = new Define(Expression.valueOf(Path.add("this", coll)), "target");
(Expression.valueOf(Path.add("this", coll)), "target");
} else { } else {
Path p = Path.add Path p = Path.add((String) m_joins.get(prev),
((String) m_joins.get(prev),
Path.relative(prev, coll)); Path.relative(prev, coll));
prevColl = new Define(Expression.valueOf(p), "target"); prevColl = new Define(Expression.valueOf(p), "target");
} }
Expression cond = new Exists Expression cond = new Exists(new com.redhat.persistence.oql.Filter(prevColl,
(new com.redhat.persistence.oql.Filter new Equals(new Variable(alias), new Variable("target"))));
(prevColl,
new Equals
(new Variable(alias), new Variable("target"))));
m_expr = new LeftJoin m_expr = new LeftJoin(m_expr,
(m_expr,
new Define(new All(type.getQualifiedName()), alias), new Define(new All(type.getQualifiedName()), alias),
cond); cond);
m_signature.addSource(type, Path.get(alias)); m_signature.addSource(type, Path.get(alias));
@ -328,15 +340,12 @@ class DataQueryImpl implements DataQuery {
if (propName.endsWith(PDL.LINK)) { if (propName.endsWith(PDL.LINK)) {
Path rel = null; Path rel = null;
String assocName = propName.substring String assocName = propName.substring(0, propName.length() - PDL.LINK.length());
(0, propName.length() - PDL.LINK.length());
Path assoc = Path.add(coll.getParent(), assocName); Path assoc = Path.add(coll.getParent(), assocName);
addJoin(assoc); addJoin(assoc);
Path pathThroughLink = Path.add(resolvePath(coll), assocName); Path pathThroughLink = Path.add(resolvePath(coll), assocName);
m_expr = new com.redhat.persistence.oql.Filter m_expr = new com.redhat.persistence.oql.Filter(m_expr, new Equals(Expression.valueOf(pathThroughLink),
(m_expr, new Equals
(Expression.valueOf(pathThroughLink),
Expression.valueOf(resolvePath(assoc)))); Expression.valueOf(resolvePath(assoc))));
} }
} }
@ -347,23 +356,19 @@ class DataQueryImpl implements DataQuery {
return addFilter(conditions); return addFilter(conditions);
} }
public Filter addFilter(String conditions) { public Filter addFilter(String conditions) {
if (m_cursor != null) { if (m_cursor != null) {
throw new PersistenceException throw new PersistenceException("The filter cannot be set on an active data query. "
("The filter cannot be set on an active data query. " + + "Data query must be rewound.");
"Data query must be rewound.");
} }
return m_filter.addFilter(conditions); return m_filter.addFilter(conditions);
} }
public Filter addFilter(Filter filter) { public Filter addFilter(Filter filter) {
if (m_cursor != null) { if (m_cursor != null) {
throw new PersistenceException throw new PersistenceException("The filter cannot be set on an active data query. "
("The filter cannot be set on an active data query. " + + "Data query must be rewound.");
"Data query must be rewound.");
} }
return m_filter.addFilter(filter); return m_filter.addFilter(filter);
@ -371,9 +376,8 @@ class DataQueryImpl implements DataQuery {
public boolean removeFilter(Filter filter) { public boolean removeFilter(Filter filter) {
if (m_cursor != null) { if (m_cursor != null) {
throw new PersistenceException throw new PersistenceException("The filter cannot be removed on an active data query. "
("The filter cannot be removed on an active data query. " + + "Data query must be rewound.");
"Data query must be rewound.");
} }
return m_filter.removeFilter(filter); return m_filter.removeFilter(filter);
@ -384,13 +388,10 @@ class DataQueryImpl implements DataQuery {
return addFilter(getFilterFactory().in(propertyName, subqueryName)); return addFilter(getFilterFactory().in(propertyName, subqueryName));
} }
public Filter addInSubqueryFilter(String propertyName, public Filter addInSubqueryFilter(String propertyName,
String subQueryProperty, String subQueryProperty,
String queryName) { String queryName) {
return addFilter return addFilter(getFilterFactory().in(propertyName, subQueryProperty, queryName));
(getFilterFactory().in
(propertyName, subQueryProperty, queryName));
} }
public Filter addNotInSubqueryFilter(String propertyName, public Filter addNotInSubqueryFilter(String propertyName,
@ -408,9 +409,8 @@ class DataQueryImpl implements DataQuery {
public void clearFilter() { public void clearFilter() {
if (m_cursor != null) { if (m_cursor != null) {
throw new PersistenceException throw new PersistenceException("Cannot clear the filter on an active data query. "
("Cannot clear the filter on an active data query. " + + "Data query must be rewound.");
"Data query must be rewound.");
} }
m_filter = (CompoundFilterImpl) getFilterFactory().and(); m_filter = (CompoundFilterImpl) getFilterFactory().and();
} }
@ -426,14 +426,12 @@ class DataQueryImpl implements DataQuery {
public void addOrder(String order) { public void addOrder(String order) {
if (m_cursor != null) { if (m_cursor != null) {
throw new PersistenceException throw new PersistenceException("Cannot order an active data query. "
("Cannot order an active data query. " + + "Data query must be rewound.");
"Data query must be rewound.");
} }
order = unalias(order); order = unalias(order);
m_orders.add(order); m_orders.add(order);
} }
private int m_order = 0; private int m_order = 0;
public void addOrderWithNull(String orderOne, Object orderTwo, public void addOrderWithNull(String orderOne, Object orderTwo,
@ -455,10 +453,8 @@ class DataQueryImpl implements DataQuery {
setParameter(var, orderTwo); setParameter(var, orderTwo);
if (orderOne != null) { if (orderOne != null) {
Root root = getSession().getRoot(); Root root = getSession().getRoot();
ObjectType typeOne = getTypeInternal().getProperty ObjectType typeOne = getTypeInternal().getProperty(unalias(Path.get(orderOne))).getType();
(unalias(Path.get(orderOne))).getType(); if (!root.getObjectType("global.String").equals(typeOne)) {
if (!root.getObjectType("global.String").equals
(typeOne)) {
// this means that there is going to be a type conflict // this means that there is going to be a type conflict
// by the DB so we prevent it here // by the DB so we prevent it here
throw new PersistenceException("type mismatch"); throw new PersistenceException("type mismatch");
@ -468,11 +464,10 @@ class DataQueryImpl implements DataQuery {
} }
if ((orderTwo != null) && (orderTwo instanceof Date)) { if ((orderTwo != null) && (orderTwo instanceof Date)) {
} }
addOrder("case when (" + orderOne + " is null) then " + addOrder("case when (" + orderOne + " is null) then "
secondElement + " else " + orderOne + " end " + suffix); + secondElement + " else " + orderOne + " end " + suffix);
} }
public void clearOrder() { public void clearOrder() {
@ -484,7 +479,6 @@ class DataQueryImpl implements DataQuery {
m_bindings.put(parameterName, value); m_bindings.put(parameterName, value);
} }
public Object getParameter(String parameterName) { public Object getParameter(String parameterName) {
return m_bindings.get(parameterName); return m_bindings.get(parameterName);
} }
@ -497,16 +491,14 @@ class DataQueryImpl implements DataQuery {
return m_options.get(optionName); return m_options.get(optionName);
} }
public void setRange(Integer beginIndex) { public void setRange(Integer beginIndex) {
setRange(beginIndex, null); setRange(beginIndex, null);
} }
public void setRange(Integer beginIndex, Integer endIndex) { public void setRange(Integer beginIndex, Integer endIndex) {
if (endIndex != null && endIndex.compareTo(beginIndex) <= 0) { if (endIndex != null && endIndex.compareTo(beginIndex) <= 0) {
throw new PersistenceException throw new PersistenceException("The beginIndex [" + beginIndex + "] must be strictly less "
("The beginIndex [" + beginIndex + "] must be strictly less " + + "than the endIndex [" + endIndex + "]");
"than the endIndex [" + endIndex + "]");
} }
m_offset = new Integer(beginIndex.intValue() - 1); m_offset = new Integer(beginIndex.intValue() - 1);
@ -516,21 +508,17 @@ class DataQueryImpl implements DataQuery {
} }
} }
public Map getPropertyValues() { public Map getPropertyValues() {
throw new Error("not implemented"); throw new Error("not implemented");
} }
public void setReturnsUpperBound(int upperBound) { public void setReturnsUpperBound(int upperBound) {
m_upperBound = upperBound; m_upperBound = upperBound;
} }
public void setReturnsLowerBound(int lowerBound) { public void setReturnsLowerBound(int lowerBound) {
if (lowerBound > 1 || lowerBound < 0) { if (lowerBound > 1 || lowerBound < 0) {
throw new PersistenceException throw new PersistenceException("The lower bound for a given query must be 0 or 1.");
("The lower bound for a given query must be 0 or 1.");
} }
m_lowerBound = lowerBound; m_lowerBound = lowerBound;
} }
@ -551,7 +539,6 @@ class DataQueryImpl implements DataQuery {
} }
} }
public Object get(String propertyName) { public Object get(String propertyName) {
Path path = resolvePath(unalias(Path.get(propertyName))); Path path = resolvePath(unalias(Path.get(propertyName)));
try { try {
@ -561,13 +548,13 @@ class DataQueryImpl implements DataQuery {
} }
} }
public int getPosition() { public int getPosition() {
checkCursor(); checkCursor();
return (int) m_cursor.getPosition(); return (int) m_cursor.getPosition();
} }
private class AddPathMapper implements SQLParser.Mapper { private class AddPathMapper implements SQLParser.Mapper {
public Path map(Path path) { public Path map(Path path) {
Path p = unalias(path); Path p = unalias(path);
// XXX: hasProperty(p) does not work because you can't // XXX: hasProperty(p) does not work because you can't
@ -579,7 +566,6 @@ class DataQueryImpl implements DataQuery {
return resolvePath(p); return resolvePath(p);
} }
} }
private SQLParser.Mapper m_mapper = new AddPathMapper(); private SQLParser.Mapper m_mapper = new AddPathMapper();
Path mapAndAddPath(Path p) { Path mapAndAddPath(Path p) {
@ -613,8 +599,7 @@ class DataQueryImpl implements DataQuery {
Expression expr = m_expr; Expression expr = m_expr;
if (filter != null) { if (filter != null) {
expr = new com.redhat.persistence.oql.Filter expr = new com.redhat.persistence.oql.Filter(expr, filter);
(expr, filter);
} }
for (int i = orders.length - 1; i >= 0; i--) { for (int i = orders.length - 1; i >= 0; i--) {
@ -672,14 +657,12 @@ class DataQueryImpl implements DataQuery {
if (result) { if (result) {
if (getPosition() == m_upperBound) { if (getPosition() == m_upperBound) {
if (m_cursor.next()) { if (m_cursor.next()) {
throw new PersistenceException throw new PersistenceException("cursor exceeded upper bound");
("cursor exceeded upper bound");
} }
} }
} else { } else {
if (pre < m_lowerBound) { if (pre < m_lowerBound) {
throw new PersistenceException throw new PersistenceException("cursor failed to meet lower bound");
("cursor failed to meet lower bound");
} }
} }
@ -691,8 +674,7 @@ class DataQueryImpl implements DataQuery {
// can not use checkCursor() because then we can't add filters // can not use checkCursor() because then we can't add filters
// after calls to size // after calls to size
if (m_cursor == null) { if (m_cursor == null) {
return new DataSet return new DataSet(m_pssn, m_signature, makeExpr()).size();
(m_pssn, m_signature, makeExpr()).size();
} else { } else {
return m_cursor.getDataSet().size(); return m_cursor.getDataSet().size();
} }
@ -702,15 +684,17 @@ class DataQueryImpl implements DataQuery {
} }
private class UnaliasMapper implements SQLParser.Mapper { private class UnaliasMapper implements SQLParser.Mapper {
public Path map(Path path) { public Path map(Path path) {
return unalias(path); return unalias(path);
} }
} }
private SQLParser.Mapper m_unaliaser = new UnaliasMapper(); private SQLParser.Mapper m_unaliaser = new UnaliasMapper();
String unalias(String expr) { String unalias(String expr) {
if (expr == null) { return null; } if (expr == null) {
return null;
}
StringReader reader = new StringReader(expr); StringReader reader = new StringReader(expr);
SQLParser p = getParser(s_unalias, reader, m_unaliaser); SQLParser p = getParser(s_unalias, reader, m_unaliaser);
@ -741,7 +725,7 @@ class DataQueryImpl implements DataQuery {
Path result = path; Path result = path;
for (Iterator it = m_aliases.iterator(); it.hasNext(); ) { for (Iterator it = m_aliases.iterator(); it.hasNext();) {
Alias alias = (Alias) it.next(); Alias alias = (Alias) it.next();
if (alias.isMatch(path)) { if (alias.isMatch(path)) {
if (s_log.isDebugEnabled()) { if (s_log.isDebugEnabled()) {
@ -788,8 +772,12 @@ class DataQueryImpl implements DataQuery {
} }
public boolean isMatch(Path path) { public boolean isMatch(Path path) {
if (isWildcard(m_from)) { return true; } if (isWildcard(m_from)) {
if (m_from.getParent() == null) { return m_from.equals(path); } return true;
}
if (m_from.getParent() == null) {
return m_from.equals(path);
}
while (path.getParent() != null) { while (path.getParent() != null) {
path = path.getParent(); path = path.getParent();
} }
@ -819,7 +807,5 @@ class DataQueryImpl implements DataQuery {
public String toString() { public String toString() {
return m_from + " --> " + m_to; return m_from + " --> " + m_to;
} }
} }
} }

View File

@ -42,7 +42,7 @@ import java.util.Locale;
* Effect will be visible in Mandalay beginning with r163. * Effect will be visible in Mandalay beginning with r163.
* *
* @author unknown... * @author unknown...
* @author Sören Bernstein (quasimodo) <sbernstein@zes.uni-bremen.de> * @author Sören Bernstein <quasi@quasiweb.de>
*/ */
public class DateRangeFilterWidget extends FilterWidget { public class DateRangeFilterWidget extends FilterWidget {

View File

@ -56,15 +56,15 @@ interface AdminConstants {
/** Administration main tab names. */ /** Administration main tab names. */
Label USER_TAB_TITLE = new Label Label USER_TAB_TITLE = new Label
(new GlobalizedMessage("ui.admin.tab.user.title", (new GlobalizedMessage("ui.admin.tab.user",
BUNDLE_NAME)); BUNDLE_NAME));
Label GROUP_TAB_TITLE = new Label Label GROUP_TAB_TITLE = new Label
(new GlobalizedMessage("ui.admin.tab.group.title", (new GlobalizedMessage("ui.admin.tab.group",
BUNDLE_NAME)); BUNDLE_NAME));
Label APPLICATIONS_TAB_TITLE = new Label Label APPLICATIONS_TAB_TITLE = new Label
(new GlobalizedMessage("ui.admin.tab.applications.title", (new GlobalizedMessage("ui.admin.tab.applications",
BUNDLE_NAME)); BUNDLE_NAME));
Label INFO_TAB_TITLE = new Label(new GlobalizedMessage("ui.admin.tab.info.title", BUNDLE_NAME)); Label INFO_TAB_TITLE = new Label(new GlobalizedMessage("ui.admin.tab.info.title", BUNDLE_NAME));

View File

@ -34,13 +34,13 @@ ui.admin.nav.logout=Log out
ui.admin.nav.workspace=Workspace ui.admin.nav.workspace=Workspace
ui.admin.searchAndList.submit=Search ui.admin.searchAndList.submit=Search
ui.admin.searchAndList.submitAgain=Search Again ui.admin.searchAndList.submitAgain=Search Again
ui.admin.tab.group.title=Groups ui.admin.tab.group=Groups
ui.admin.tab.user.browse=Browse ui.admin.tab.user.browse=Browse
ui.admin.tab.user.createuser=Create new user ui.admin.tab.user.createuser=Create new user
ui.admin.tab.user.navbartitle=User Administration ui.admin.tab.user.navbartitle=User Administration
ui.admin.tab.user.search=Search ui.admin.tab.user.search=Search
ui.admin.tab.user.summary=Summary ui.admin.tab.user.summary=Summary
ui.admin.tab.user.title=Users ui.admin.tab.user=Users
ui.admin.user.action.continue=Continue ui.admin.user.action.continue=Continue
ui.admin.user.action.delete.failed.header=Unable to delete user ui.admin.user.action.delete.failed.header=Unable to delete user
ui.admin.user.action.header=Actions ui.admin.user.action.header=Actions
@ -90,7 +90,7 @@ ui.admin.user.userpasswordform.confirmpasswordlabel=Confirm password:
ui.admin.user.userpasswordform.passwordlabel=Password: ui.admin.user.userpasswordform.passwordlabel=Password:
ui.admin.user.userpasswordform.question=Question: ui.admin.user.userpasswordform.question=Question:
ui.admin.user.userpasswordform.submit=Change ui.admin.user.userpasswordform.submit=Change
ui.admin.tab.applications.title=Applications ui.admin.tab.applications=Applications
ui.admin.applications.tree.heading=Applications ui.admin.applications.tree.heading=Applications
ui.admin.applications.url.validation.not_blank=The URL of an application instance can is mandatory. ui.admin.applications.url.validation.not_blank=The URL of an application instance can is mandatory.
ui.admin.applications.url.valiation.minmaxlength=The length of an URL of an application instance must be between 1 and 100 characters. ui.admin.applications.url.valiation.minmaxlength=The length of an URL of an application instance must be between 1 and 100 characters.

View File

@ -34,13 +34,13 @@ ui.admin.nav.logout=Abmelden
ui.admin.nav.workspace=Workspace ui.admin.nav.workspace=Workspace
ui.admin.searchAndList.submit=Suchen ui.admin.searchAndList.submit=Suchen
ui.admin.searchAndList.submitAgain=Erneut suchen ui.admin.searchAndList.submitAgain=Erneut suchen
ui.admin.tab.group.title=Gruppen ui.admin.tab.group=Gruppen
ui.admin.tab.user.browse=Bl\u00e4ttern ui.admin.tab.user.browse=Bl\u00e4ttern
ui.admin.tab.user.createuser=Neuen Benutzer erstellen ui.admin.tab.user.createuser=Neuen Benutzer erstellen
ui.admin.tab.user.navbartitle=Benutzerverwaltung ui.admin.tab.user.navbartitle=Benutzerverwaltung
ui.admin.tab.user.search=Suche ui.admin.tab.user.search=Suche
ui.admin.tab.user.summary=Zusammenfassung ui.admin.tab.user.summary=Zusammenfassung
ui.admin.tab.user.title=Benutzer ui.admin.tab.user=Benutzer
ui.admin.user.action.continue=Fortfahren ui.admin.user.action.continue=Fortfahren
ui.admin.user.action.delete.failed.header=Benutzer kann nicht gel\u00f6scht werden ui.admin.user.action.delete.failed.header=Benutzer kann nicht gel\u00f6scht werden
ui.admin.user.action.header=Aktionen ui.admin.user.action.header=Aktionen
@ -90,7 +90,7 @@ ui.admin.user.userpasswordform.confirmpasswordlabel=Passwort best\u00e4tigen\:
ui.admin.user.userpasswordform.passwordlabel=Passwort\: ui.admin.user.userpasswordform.passwordlabel=Passwort\:
ui.admin.user.userpasswordform.question=Frage\: ui.admin.user.userpasswordform.question=Frage\:
ui.admin.user.userpasswordform.submit=\u00c4ndern ui.admin.user.userpasswordform.submit=\u00c4ndern
ui.admin.tab.applications.title=Applikationen ui.admin.tab.applications=Applikationen
ui.admin.applications.tree.heading=Applikationen ui.admin.applications.tree.heading=Applikationen
ui.admin.applications.url.validation.not_blank=Die Angabe einer URL ist erforderlich ui.admin.applications.url.validation.not_blank=Die Angabe einer URL ist erforderlich
ui.admin.applications.url.valiation.minmaxlength=Die URL einer Applikations-Instanz muss zwischen einem und 100 Zeichen lang sein ui.admin.applications.url.valiation.minmaxlength=Die URL einer Applikations-Instanz muss zwischen einem und 100 Zeichen lang sein

View File

@ -34,13 +34,13 @@ ui.admin.nav.logout=Log out
ui.admin.nav.workspace=Workspace ui.admin.nav.workspace=Workspace
ui.admin.searchAndList.submit=Search ui.admin.searchAndList.submit=Search
ui.admin.searchAndList.submitAgain=Search Again ui.admin.searchAndList.submitAgain=Search Again
ui.admin.tab.group.title=Groups ui.admin.tab.group=Groups
ui.admin.tab.user.browse=Browse ui.admin.tab.user.browse=Browse
ui.admin.tab.user.createuser=Create new user ui.admin.tab.user.createuser=Create new user
ui.admin.tab.user.navbartitle=User Administration ui.admin.tab.user.navbartitle=User Administration
ui.admin.tab.user.search=Search ui.admin.tab.user.search=Search
ui.admin.tab.user.summary=Summary ui.admin.tab.user.summary=Summary
ui.admin.tab.user.title=Users ui.admin.tab.user=Users
ui.admin.user.action.continue=Continue ui.admin.user.action.continue=Continue
ui.admin.user.action.delete.failed.header=Unable to delete user ui.admin.user.action.delete.failed.header=Unable to delete user
ui.admin.user.action.header=Actions ui.admin.user.action.header=Actions
@ -90,7 +90,7 @@ ui.admin.user.userpasswordform.confirmpasswordlabel=Confirm password:
ui.admin.user.userpasswordform.passwordlabel=Password: ui.admin.user.userpasswordform.passwordlabel=Password:
ui.admin.user.userpasswordform.question=Question: ui.admin.user.userpasswordform.question=Question:
ui.admin.user.userpasswordform.submit=Change ui.admin.user.userpasswordform.submit=Change
ui.admin.tab.applications.title=Applications ui.admin.tab.applications=Applications
ui.admin.applications.tree.heading=Applications ui.admin.applications.tree.heading=Applications
ui.admin.applications.url.validation.not_blank= ui.admin.applications.url.validation.not_blank=
ui.admin.applications.url.valiation.minmaxlength= ui.admin.applications.url.valiation.minmaxlength=

View File

@ -25,13 +25,13 @@ ui.admin.nav.logout=D\u00e9connexion
ui.admin.nav.workspace=Espace de travail ui.admin.nav.workspace=Espace de travail
ui.admin.searchAndList.submit=Rechercher ui.admin.searchAndList.submit=Rechercher
ui.admin.searchAndList.submitAgain=Rechercher suivant ui.admin.searchAndList.submitAgain=Rechercher suivant
ui.admin.tab.group.title=Groupe ui.admin.tab.group=Groupe
ui.admin.tab.user.browse=Parcourir ui.admin.tab.user.browse=Parcourir
ui.admin.tab.user.createuser=Cr\u00e9er un nouvel utilisateur ui.admin.tab.user.createuser=Cr\u00e9er un nouvel utilisateur
ui.admin.tab.user.navbartitle=Gestion de l'utilisateur ui.admin.tab.user.navbartitle=Gestion de l'utilisateur
ui.admin.tab.user.search=Rechercher ui.admin.tab.user.search=Rechercher
ui.admin.tab.user.summary=Table des mati\u00e8res ui.admin.tab.user.summary=Table des mati\u00e8res
ui.admin.tab.user.title=Utilisateurs ui.admin.tab.user=Utilisateurs
ui.admin.user.action.continue=Continuer ui.admin.user.action.continue=Continuer
ui.admin.user.action.delete.failed.header=Impossible de supprimer l'utiisateur ui.admin.user.action.delete.failed.header=Impossible de supprimer l'utiisateur
ui.admin.user.action.header=Actions ui.admin.user.action.header=Actions
@ -76,7 +76,7 @@ ui.admin.user.userpasswordform.confirmpasswordlabel=Confirmer le mot de passe:
ui.admin.user.userpasswordform.passwordlabel=Mot de passe: ui.admin.user.userpasswordform.passwordlabel=Mot de passe:
ui.admin.user.userpasswordform.question=Question: ui.admin.user.userpasswordform.question=Question:
ui.admin.user.userpasswordform.submit=Changer ui.admin.user.userpasswordform.submit=Changer
ui.admin.tab.applications.title= ui.admin.tab.applications=
ui.admin.applications.tree.heading= ui.admin.applications.tree.heading=
ui.admin.applications.url.validation.not_blank= ui.admin.applications.url.validation.not_blank=
ui.admin.applications.url.valiation.minmaxlength= ui.admin.applications.url.valiation.minmaxlength=

View File

@ -11,7 +11,7 @@ import java.util.Set;
/** /**
* *
* @author Sören Bernstein (quasimodo) <sbernstein@zes.uni-bremen.de> * @author Sören Bernstein <quasi@quasiweb.de>
*/ */
public class SystemInformation implements Lockable { public class SystemInformation implements Lockable {

View File

@ -56,6 +56,7 @@ public class ConfigParameterList extends SimpleContainer {
XML_NS); XML_NS);
} }
@Override
public void generateXML(PageState state, public void generateXML(PageState state,
Element parent) { Element parent) {
Element content = generateParent(parent); Element content = generateParent(parent);
@ -117,6 +118,7 @@ public class ConfigParameterList extends SimpleContainer {
p.addAttribute("isRequired", XML.format(new Boolean(param.isRequired()))); p.addAttribute("isRequired", XML.format(new Boolean(param.isRequired())));
param.write(new ParameterWriter() { param.write(new ParameterWriter() {
@Override
public void write(Parameter param, String value) { public void write(Parameter param, String value) {
if (value != null) { if (value != null) {
p.addAttribute("value", value); p.addAttribute("value", value);
@ -152,6 +154,7 @@ public class ConfigParameterList extends SimpleContainer {
m_contexts = contexts; m_contexts = contexts;
} }
@Override
public void startElement(String uri, String localName, String qn, public void startElement(String uri, String localName, String qn,
Attributes attrs) { Attributes attrs) {
if (localName.equals("config")) { if (localName.equals("config")) {

View File

@ -30,7 +30,7 @@ import java.text.DateFormat;
* is ommitted. * is ommitted.
* *
* @author unkknown * @author unkknown
* @author Sören Bernstein * @author Sören Bernstein <quasi@quasiweb.de>
*/ */
public class DateFormatter implements Formatter { public class DateFormatter implements Formatter {

View File

@ -29,7 +29,7 @@ import java.text.DateFormat;
* 'medium' format and the time in 'short' format. * 'medium' format and the time in 'short' format.
* *
* @author unknown * @author unknown
* @author Sören Bernstein * @author Sören Bernstein <quasi@quasiweb.de>
*/ */
public class DateTimeFormatter implements Formatter { public class DateTimeFormatter implements Formatter {

View File

@ -30,7 +30,7 @@ import java.text.DateFormat;
* is ommitted. * is ommitted.
* *
* @author unknown * @author unknown
* @author Sören Bernstein * @author Sören Bernstein <quasi@quasiweb.de>
*/ */
public class TimeFormatter implements Formatter { public class TimeFormatter implements Formatter {

View File

@ -27,15 +27,14 @@ import org.apache.log4j.Logger;
* Cursor * Cursor
* *
* @author <a href="mailto:rhs@mit.edu">rhs@mit.edu</a> * @author <a href="mailto:rhs@mit.edu">rhs@mit.edu</a>
* @author Sören Bernstein <quasi@quasiweb.de>
* @version $Id: Cursor.java 1393 2006-11-28 09:12:32Z sskracic $ * @version $Id: Cursor.java 1393 2006-11-28 09:12:32Z sskracic $
**/ *
*/
public class Cursor { public class Cursor {
private static final Logger s_log = Logger.getLogger(Cursor.class); private static final Logger s_log = Logger.getLogger(Cursor.class);
final private DataSet m_ds; final private DataSet m_ds;
private RecordSet m_rs = null; private RecordSet m_rs = null;
private Map m_values = null; private Map m_values = null;
private long m_position = 0; private long m_position = 0;
@ -68,7 +67,9 @@ public class Cursor {
return m_values.get(path); return m_values.get(path);
} else { } else {
Object o = getInternal(path.getParent()); Object o = getInternal(path.getParent());
if (o == null) { return null; } if (o == null) {
return null;
}
return getSession().get(o, Path.get(path.getName())); return getSession().get(o, Path.get(path.getName()));
} }
} }
@ -195,4 +196,44 @@ public class Cursor {
m_closed = true; m_closed = true;
} }
/**
* An expensive previous method, which will iterate the list from the
* beginning to the previous to current position. Sadly, the more efficient
* way is not possible with this persistent layer because it will only work
* with ResultSets in FORWARD_ONLY mode.
*
* @return boolean true, if there is a previous element, false otherwise
*/
public boolean previous() {
if (m_closed) {
throw new ClosedException(this);
}
// Make sure, we don't go before the first entry (position == 1)
if (m_position <= 1) {
return false;
}
// If there isn't a result set, get a new one
if (m_rs == null) {
getSession().flush();
m_rs = execute();
}
// Have to go the long way because the persistent layer can only operate
// with ResultSet in FORWARD_ONLY mode
long newPosition = getPosition() - 1;
// Reset the list, aka rewind and get a new resultset
rewind();
getSession().flush();
m_rs = execute();
// Iterate to new position
while (m_position < newPosition) {
next();
}
return true;
}
} }