* 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-94f89814c4dfmaster
parent
136b1a072d
commit
86beaa1ec7
|
|
@ -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.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.move_attached_image_down=Move down
|
||||
cms.contentassets.ui.image_step.move_attached_image_up=Move up
|
||||
|
|
|
|||
|
|
@ -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.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.move_attached_image_down=Nach unten verschieben
|
||||
cms.contentassets.ui.image_step.move_attached_image_up=Nach oben verschieben
|
||||
|
|
|
|||
|
|
@ -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.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.move_attached_image_down=Move down
|
||||
cms.contentassets.ui.image_step.move_attached_image_up=Move up
|
||||
|
|
|
|||
|
|
@ -32,30 +32,38 @@ import com.arsdigita.persistence.OID;
|
|||
import com.arsdigita.persistence.SessionManager;
|
||||
import com.arsdigita.persistence.metadata.Property;
|
||||
import com.arsdigita.util.Assert;
|
||||
import java.math.BigDecimal;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
* @version $Revision: #3 $ $Date: 2004/04/08 $
|
||||
* @version $Id: $
|
||||
**/
|
||||
*
|
||||
* @author unknown
|
||||
* @author Sören Bernstein <quasi@quasiweb.de>
|
||||
*
|
||||
*/
|
||||
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 ITEM = "item";
|
||||
public static final String USE_CONTEXT = "useContext";
|
||||
public static final String CAPTION = "caption";
|
||||
public static final String DESCRIPTION = "description";
|
||||
public static final String TITLE = "title";
|
||||
public static final String SORTKEY = "sortKey";
|
||||
public static final String IMAGE_ATTACHMENTS = "imageAttachments";
|
||||
public static final String ITEM_ATTACHMENTS = "itemAttachments";
|
||||
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";
|
||||
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() {
|
||||
this(BASE_DATA_OBJECT_TYPE);
|
||||
|
|
@ -69,6 +77,7 @@ public class ItemImageAttachment extends ACSObject implements CustomCopy {
|
|||
super(type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBaseDataObjectType() {
|
||||
return BASE_DATA_OBJECT_TYPE;
|
||||
}
|
||||
|
|
@ -80,7 +89,18 @@ public class ItemImageAttachment extends ACSObject implements CustomCopy {
|
|||
set(IMAGE, image);
|
||||
}
|
||||
|
||||
public static ItemImageAttachment retrieve(OID oid) {
|
||||
/**
|
||||
* 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) {
|
||||
return (ItemImageAttachment) DomainObjectFactory.newInstance(oid);
|
||||
}
|
||||
|
||||
|
|
@ -116,7 +136,9 @@ public class ItemImageAttachment extends ACSObject implements CustomCopy {
|
|||
set(ITEM, item);
|
||||
}
|
||||
|
||||
/** Retrieves links for a content item */
|
||||
/**
|
||||
* Retrieves links for a content item
|
||||
*/
|
||||
public static DataCollection getImageAttachments(ContentItem item) {
|
||||
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);
|
||||
attachments.addEqualsFilter(ITEM + ".id", item.getID());
|
||||
// Order by SORTKEY
|
||||
attachments.addOrder(SORTKEY);
|
||||
|
||||
return attachments;
|
||||
}
|
||||
|
|
@ -162,20 +186,34 @@ public class ItemImageAttachment extends ACSObject implements CustomCopy {
|
|||
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
|
||||
*/
|
||||
@Override
|
||||
public boolean copyProperty(final CustomCopy source,
|
||||
final Property property,
|
||||
final ItemCopier copier) {
|
||||
final Property property,
|
||||
final ItemCopier copier) {
|
||||
String attribute = property.getName();
|
||||
if (ItemCopier.VERSION_COPY == copier.getCopyType()
|
||||
&& IMAGE.equals(attribute)) {
|
||||
&& IMAGE.equals(attribute)) {
|
||||
ItemImageAttachment attachment = (ItemImageAttachment) source;
|
||||
ReusableImageAsset image = attachment.getImage();
|
||||
|
||||
ReusableImageAsset liveImage =
|
||||
(ReusableImageAsset) image.getLiveVersion();
|
||||
(ReusableImageAsset) image.getLiveVersion();
|
||||
|
||||
if (null == liveImage) {
|
||||
liveImage = (ReusableImageAsset) image.createLiveVersion();
|
||||
|
|
@ -208,10 +246,21 @@ public class ItemImageAttachment extends ACSObject implements CustomCopy {
|
|||
// 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
|
||||
// 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);
|
||||
save();
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,6 +53,7 @@ public class ItemImageAttachmentInitializer extends ContentAssetInitializer {
|
|||
DomainObjectFactory.registerInstantiator(
|
||||
ItemImageAttachment.BASE_DATA_OBJECT_TYPE,
|
||||
new DomainObjectInstantiator() {
|
||||
@Override
|
||||
protected DomainObject doNewInstance(DataObject obj) {
|
||||
return new ItemImageAttachment(obj);
|
||||
}
|
||||
|
|
@ -70,6 +71,7 @@ public class ItemImageAttachmentInitializer extends ContentAssetInitializer {
|
|||
* The base type against which the asset is defined,
|
||||
* typically com.arsdigita.cms.ContentPage
|
||||
*/
|
||||
@Override
|
||||
public String getBaseType() {
|
||||
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:
|
||||
* /WEB-INF/traversal-adapters/com/arsdigita/cms/contentassets/FileAttachments.xml
|
||||
*/
|
||||
@Override
|
||||
public String getTraversalXML() {
|
||||
return "/WEB-INF/traversal-adapters/com/arsdigita/" +
|
||||
"cms/contentassets/ItemImageAttachment.xml";
|
||||
|
|
@ -87,6 +90,7 @@ public class ItemImageAttachmentInitializer extends ContentAssetInitializer {
|
|||
* The name of the association between the item
|
||||
* and the asset, eg 'fileAttachments'.
|
||||
*/
|
||||
@Override
|
||||
public String getProperty() {
|
||||
return "imageAttachments";
|
||||
}
|
||||
|
|
@ -94,6 +98,7 @@ public class ItemImageAttachmentInitializer extends ContentAssetInitializer {
|
|||
/**
|
||||
* The class of the authoring kit step
|
||||
*/
|
||||
@Override
|
||||
public Class getAuthoringStep() {
|
||||
return ImageStep.class;
|
||||
}
|
||||
|
|
@ -101,6 +106,7 @@ public class ItemImageAttachmentInitializer extends ContentAssetInitializer {
|
|||
/**
|
||||
* The label for the authoring step
|
||||
*/
|
||||
@Override
|
||||
public GlobalizedMessage getAuthoringStepLabel() {
|
||||
return new GlobalizedMessage("com.arsdigita.cms.contentassets.image_step_label",
|
||||
"com.arsdigita.cms.contentassets.ImageStepResources");
|
||||
|
|
@ -109,6 +115,7 @@ public class ItemImageAttachmentInitializer extends ContentAssetInitializer {
|
|||
/**
|
||||
* The description for the authoring step
|
||||
*/
|
||||
@Override
|
||||
public GlobalizedMessage getAuthoringStepDescription() {
|
||||
return new GlobalizedMessage("com.arsdigita.cms.contentassets.image_step_description",
|
||||
"com.arsdigita.cms.contentassets.ImageStepResources");
|
||||
|
|
@ -117,6 +124,7 @@ public class ItemImageAttachmentInitializer extends ContentAssetInitializer {
|
|||
/**
|
||||
* The sort key for the authoring step
|
||||
*/
|
||||
@Override
|
||||
public int getAuthoringStepSortKey() {
|
||||
return ItemImageAttachmentConfig.instanceOf().getImageStepSortKey();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ import org.apache.log4j.Logger;
|
|||
*
|
||||
* 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 {
|
||||
|
||||
|
|
|
|||
|
|
@ -39,162 +39,163 @@ import java.util.Iterator;
|
|||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
* Pluggable authoring step as the main entry point to add an ImageAsset to a
|
||||
* Pluggable authoring step as the main entry point to add an ImageAsset to a
|
||||
* content item.
|
||||
*
|
||||
*
|
||||
* @author unknown
|
||||
* @author Sören Bernstein (quasimodo) <sbernstein@quasiweb.de>
|
||||
* @author Sören Bernstein <quasi@quasiweb.de>
|
||||
*/
|
||||
public class ImageStep extends SecurityPropertyEditor {
|
||||
|
||||
private static final Logger s_log = Logger.getLogger(ImageStep.class);
|
||||
private final ItemSelectionModel m_itemSelection;
|
||||
private final AttachmentSelectionModel m_attachmentSelection;
|
||||
private final AuthoringKitWizard m_parent;
|
||||
private final ImageStepDisplay m_display;
|
||||
private final ImageStepEdit m_add;
|
||||
private final OIDParameter m_attachmentOID;
|
||||
private static final Logger s_log = Logger.getLogger(ImageStep.class);
|
||||
private final ItemSelectionModel m_itemSelection;
|
||||
private final AttachmentSelectionModel m_attachmentSelection;
|
||||
private final AuthoringKitWizard m_parent;
|
||||
private final ImageStepDisplay m_display;
|
||||
private final ImageStepEdit m_add;
|
||||
private final OIDParameter m_attachmentOID;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param itemModel
|
||||
* @param parent
|
||||
*/
|
||||
public ImageStep(ItemSelectionModel itemModel,
|
||||
AuthoringKitWizard parent) {
|
||||
super();
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param itemModel The {@link ItemSelectionModel} to use with this
|
||||
* instance
|
||||
* @param parent The parent {@link AuthoringKitWizard}
|
||||
*/
|
||||
public ImageStep(ItemSelectionModel itemModel,
|
||||
AuthoringKitWizard parent) {
|
||||
super();
|
||||
|
||||
m_itemSelection = itemModel;
|
||||
m_parent = parent;
|
||||
m_itemSelection = itemModel;
|
||||
m_parent = parent;
|
||||
|
||||
m_attachmentOID = new OIDParameter("attachmentID");
|
||||
m_attachmentSelection = new AttachmentSelectionModel();
|
||||
m_attachmentOID = new OIDParameter("attachmentID");
|
||||
m_attachmentSelection = new AttachmentSelectionModel();
|
||||
|
||||
|
||||
/* Create ImageEditStep to add images to the current item */
|
||||
m_add = new ImageStepEdit(this);
|
||||
WorkflowLockedComponentAccess addCA =
|
||||
new WorkflowLockedComponentAccess(m_add, m_itemSelection);
|
||||
addComponent("add",
|
||||
ImageStepGlobalizationUtil.globalize(
|
||||
"cms.contentassets.ui.image_step.add_image"),
|
||||
addCA);
|
||||
/* Create ImageEditStep to add images to the current item */
|
||||
m_add = new ImageStepEdit(this);
|
||||
WorkflowLockedComponentAccess addCA =
|
||||
new WorkflowLockedComponentAccess(m_add, m_itemSelection);
|
||||
addComponent("add",
|
||||
ImageStepGlobalizationUtil.globalize(
|
||||
"cms.contentassets.ui.image_step.add_image"),
|
||||
addCA);
|
||||
|
||||
/* ImageDisplayStep to display all already attached images */
|
||||
m_display = new ImageStepDisplay(this); // Component to display
|
||||
setDisplayComponent(m_display); // all attached images.
|
||||
/* ImageDisplayStep to display all already attached images */
|
||||
m_display = new ImageStepDisplay(this); // Component to display
|
||||
setDisplayComponent(m_display); // all attached images.
|
||||
|
||||
Iterator imageComponents = m_add.getImageComponents();
|
||||
while (imageComponents.hasNext()) {
|
||||
ImageComponent component =
|
||||
(ImageComponent) imageComponents.next();
|
||||
Iterator imageComponents = m_add.getImageComponents();
|
||||
while (imageComponents.hasNext()) {
|
||||
ImageComponent component =
|
||||
(ImageComponent) imageComponents.next();
|
||||
|
||||
addListeners(component.getForm(),
|
||||
component.getSaveCancelSection().getCancelButton());
|
||||
}
|
||||
addListeners(component.getForm(),
|
||||
component.getSaveCancelSection().getCancelButton());
|
||||
}
|
||||
|
||||
m_parent.getList().addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent event) {
|
||||
PageState state = event.getPageState();
|
||||
showDisplayPane(state);
|
||||
}
|
||||
m_parent.getList().addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent event) {
|
||||
PageState state = event.getPageState();
|
||||
showDisplayPane(state);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
@Override
|
||||
public void register(Page p) {
|
||||
super.register(p);
|
||||
|
||||
@Override
|
||||
public void register(Page p) {
|
||||
super.register(p);
|
||||
p.addComponentStateParam(this, m_attachmentOID);
|
||||
}
|
||||
|
||||
p.addComponentStateParam(this, m_attachmentOID);
|
||||
}
|
||||
/**
|
||||
* @return the parent wizard
|
||||
*/
|
||||
public AuthoringKitWizard getParentWizard() {
|
||||
return m_parent;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the parent wizard
|
||||
*/
|
||||
public AuthoringKitWizard getParentWizard() {
|
||||
return m_parent;
|
||||
}
|
||||
/**
|
||||
* @return The item selection model
|
||||
*/
|
||||
public ItemSelectionModel getItemSelectionModel() {
|
||||
return m_itemSelection;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The item selection model
|
||||
*/
|
||||
public ItemSelectionModel getItemSelectionModel() {
|
||||
return m_itemSelection;
|
||||
}
|
||||
/**
|
||||
* @return The currently selected item, null if there isn't one.
|
||||
*/
|
||||
public ContentItem getItem(PageState ps) {
|
||||
return m_itemSelection.getSelectedItem(ps);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The currently selected item, null if there isn't one.
|
||||
*/
|
||||
public ContentItem getItem(PageState ps) {
|
||||
return m_itemSelection.getSelectedItem(ps);
|
||||
}
|
||||
/**
|
||||
* @return The currently selected item, null if there isn't one.
|
||||
*/
|
||||
public ItemImageAttachment getAttachment(PageState ps) {
|
||||
return (ItemImageAttachment) m_attachmentSelection.getSelectedAttachment(ps);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The currently selected item, null if there isn't one.
|
||||
*/
|
||||
public ItemImageAttachment getAttachment(PageState ps) {
|
||||
return (ItemImageAttachment) m_attachmentSelection.getSelectedAttachment(ps);
|
||||
}
|
||||
private class AttachmentSelectionModel
|
||||
extends AbstractSingleSelectionModel {
|
||||
|
||||
private class AttachmentSelectionModel
|
||||
extends AbstractSingleSelectionModel {
|
||||
private final RequestLocal m_attachment = new RequestLocal() {
|
||||
@Override
|
||||
protected Object initialValue(PageState ps) {
|
||||
OID oid = (OID) getSelectedKey(ps);
|
||||
if (null == oid) {
|
||||
return null;
|
||||
}
|
||||
|
||||
private final RequestLocal m_attachment = new RequestLocal() {
|
||||
@Override
|
||||
protected Object initialValue(PageState ps) {
|
||||
OID oid = (OID) getSelectedKey(ps);
|
||||
if (null == oid) {
|
||||
return null;
|
||||
}
|
||||
return DomainObjectFactory.newInstance(oid);
|
||||
}
|
||||
};
|
||||
|
||||
return DomainObjectFactory.newInstance(oid);
|
||||
}
|
||||
@Override
|
||||
public Object getSelectedKey(PageState ps) {
|
||||
OID oid = (OID) ps.getValue(m_attachmentOID);
|
||||
if (null == oid) {
|
||||
return null;
|
||||
}
|
||||
|
||||
};
|
||||
return oid;
|
||||
}
|
||||
|
||||
public Object getSelectedKey(PageState ps) {
|
||||
OID oid = (OID) ps.getValue(m_attachmentOID);
|
||||
if (null == oid) {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public void setSelectedKey(PageState ps, Object oid) {
|
||||
m_attachment.set(ps, null);
|
||||
ps.setValue(m_attachmentOID, oid);
|
||||
}
|
||||
|
||||
return oid;
|
||||
}
|
||||
public ItemImageAttachment getSelectedAttachment(PageState ps) {
|
||||
return (ItemImageAttachment) m_attachment.get(ps);
|
||||
}
|
||||
|
||||
public void setSelectedKey(PageState ps, Object oid) {
|
||||
m_attachment.set(ps, null);
|
||||
ps.setValue(m_attachmentOID, oid);
|
||||
}
|
||||
public void setSelectedAttachment(PageState ps,
|
||||
ItemImageAttachment attachment) {
|
||||
setSelectedKey(ps, attachment);
|
||||
m_attachment.set(ps, attachment);
|
||||
}
|
||||
|
||||
public ItemImageAttachment getSelectedAttachment(PageState ps) {
|
||||
return (ItemImageAttachment) m_attachment.get(ps);
|
||||
}
|
||||
|
||||
public void setSelectedAttachment(PageState ps,
|
||||
ItemImageAttachment attachment) {
|
||||
setSelectedKey(ps, attachment);
|
||||
m_attachment.set(ps, attachment);
|
||||
}
|
||||
|
||||
public ParameterModel getStateParameter() {
|
||||
return m_attachmentOID;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Show display pane.
|
||||
*
|
||||
* Also, reset the forms for reuse.
|
||||
*
|
||||
* @param state
|
||||
*/
|
||||
@Override
|
||||
public void showDisplayPane(PageState state) {
|
||||
super.showDisplayPane(state);
|
||||
m_add.reset(state);
|
||||
}
|
||||
@Override
|
||||
public ParameterModel getStateParameter() {
|
||||
return m_attachmentOID;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Show display pane.
|
||||
*
|
||||
* Also, reset the forms for reuse.
|
||||
*
|
||||
* @param state
|
||||
*/
|
||||
@Override
|
||||
public void showDisplayPane(PageState state) {
|
||||
super.showDisplayPane(state);
|
||||
m_add.reset(state);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@
|
|||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
package com.arsdigita.cms.contentassets.ui;
|
||||
|
||||
import com.arsdigita.bebop.BoxPanel;
|
||||
|
|
@ -33,248 +32,424 @@ import com.arsdigita.bebop.list.ListModelBuilder;
|
|||
import com.arsdigita.cms.ContentItem;
|
||||
import com.arsdigita.cms.ImageAsset;
|
||||
import com.arsdigita.cms.ReusableImageAsset;
|
||||
import com.arsdigita.cms.Service;
|
||||
import com.arsdigita.cms.contentassets.ItemImageAttachment;
|
||||
import com.arsdigita.cms.contentassets.util.ImageStepGlobalizationUtil;
|
||||
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.persistence.DataCollection;
|
||||
import com.arsdigita.persistence.DataObject;
|
||||
import com.arsdigita.persistence.OID;
|
||||
import com.arsdigita.util.LockableImpl;
|
||||
import com.arsdigita.web.URL;
|
||||
import com.arsdigita.xml.Element;
|
||||
import java.io.IOException;
|
||||
import javax.servlet.ServletException;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
* 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,
|
||||
* etc.), a link to remove from the list for each image and at the bottom a
|
||||
* link to add another image.
|
||||
*
|
||||
* etc.), a link to remove from the list for each image and at the bottom a link
|
||||
* to add another image.
|
||||
*
|
||||
* @author unknown
|
||||
* @author Sören Bernstein (quasimodo) <sbernstein@quasiweb.de>
|
||||
* @author Sören Bernstein <quasi@quasiweb.de>
|
||||
*/
|
||||
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
|
||||
*/
|
||||
private final ImageStep m_imageStep;
|
||||
private ImageListModelBuilder m_listModelBuilder;
|
||||
/**
|
||||
* Name of the delete event
|
||||
*/
|
||||
private final static String DELETE = "deleteAttachment";
|
||||
private final static String MOVEUP = "moveAttachmentUp";
|
||||
private final static String MOVEDOWN = "moveAttachmentDown";
|
||||
|
||||
/** Represents invoking parent component */
|
||||
private final ImageStep m_imageStep;
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param step
|
||||
*/
|
||||
public ImageStepDisplay(ImageStep step) {
|
||||
super();
|
||||
|
||||
/** Name of the delete event */
|
||||
private final static String DELETE = "deleteAttachment";
|
||||
m_imageStep = step;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param step
|
||||
*/
|
||||
public ImageStepDisplay( ImageStep step ) {
|
||||
super();
|
||||
/* Message to show in case no image has been attached yet. */
|
||||
Label mainLabel = new Label(ImageStepGlobalizationUtil.globalize(
|
||||
"cms.contentassets.ui.image_step.no_image_attached"));
|
||||
mainLabel.setFontWeight(Label.ITALIC);
|
||||
|
||||
m_imageStep = step;
|
||||
m_listModelBuilder = new ImageListModelBuilder();
|
||||
List imageList = new List(m_listModelBuilder) {
|
||||
@Override
|
||||
public void respond(PageState ps) throws ServletException {
|
||||
if (DELETE.equals(ps.getControlEventName())) {
|
||||
DomainObjectFactory.newInstance(OID.valueOf(ps.getControlEventValue())).delete();
|
||||
// Regenerate sortkeys
|
||||
m_listModelBuilder.getModel().regenSortKeys(ps);
|
||||
} else if (MOVEUP.equals(ps.getControlEventName())) {
|
||||
m_listModelBuilder.getModel().move(OID.valueOf(ps.getControlEventValue()), -1, ps);
|
||||
} else if (MOVEDOWN.equals(ps.getControlEventName())) {
|
||||
m_listModelBuilder.getModel().move(OID.valueOf(ps.getControlEventValue()), 1, ps);
|
||||
} else {
|
||||
super.respond(ps);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/* Message to show in case no image has been attached yet. */
|
||||
Label mainLabel = new Label(ImageStepGlobalizationUtil.globalize(
|
||||
"cms.contentassets.ui.image_step.no_image_attached"));
|
||||
mainLabel.setFontWeight(Label.ITALIC);
|
||||
imageList.setCellRenderer(new ImageListCellRenderer());
|
||||
imageList.setEmptyView(mainLabel);
|
||||
|
||||
List imageList = new List( new ImageListModelBuilder() ) {
|
||||
@Override
|
||||
public void respond( PageState ps ) throws ServletException {
|
||||
if( DELETE.equals( ps.getControlEventName() ) ) {
|
||||
String attachment = ps.getControlEventValue();
|
||||
add(imageList); // finally add the component
|
||||
}
|
||||
|
||||
OID oid = OID.valueOf( attachment );
|
||||
DomainObjectFactory.newInstance( oid ).delete();
|
||||
}
|
||||
/**
|
||||
* Inner class
|
||||
*/
|
||||
private class ImageListModelBuilder extends LockableImpl
|
||||
implements ListModelBuilder {
|
||||
|
||||
else {
|
||||
super.respond( ps );
|
||||
}
|
||||
}
|
||||
};
|
||||
imageList.setCellRenderer( new ImageListCellRenderer() );
|
||||
imageList.setEmptyView( mainLabel );
|
||||
private ImageListModel m_listModel;
|
||||
|
||||
add( imageList ); // finally add the component
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param list
|
||||
* @param ps
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public ListModel makeModel(List list, PageState ps) {
|
||||
ContentItem item = m_imageStep.getItem(ps);
|
||||
|
||||
/**
|
||||
* Inner class
|
||||
*/
|
||||
private class ImageListModelBuilder extends LockableImpl
|
||||
implements ListModelBuilder {
|
||||
/**
|
||||
*
|
||||
* @param list
|
||||
* @param ps
|
||||
* @return
|
||||
*/
|
||||
public ListModel makeModel( List list, PageState ps ) {
|
||||
ContentItem item = m_imageStep.getItem( ps );
|
||||
DataCollection attachments =
|
||||
ItemImageAttachment.getImageAttachments(item);
|
||||
attachments.addPath(ItemImageAttachment.IMAGE + "."
|
||||
+ ReusableImageAsset.ID);
|
||||
attachments.addPath(ItemImageAttachment.IMAGE + "."
|
||||
+ ReusableImageAsset.OBJECT_TYPE);
|
||||
attachments.addPath(ItemImageAttachment.IMAGE + "."
|
||||
+ ReusableImageAsset.HEIGHT);
|
||||
attachments.addPath(ItemImageAttachment.IMAGE + "."
|
||||
+ ReusableImageAsset.WIDTH);
|
||||
|
||||
DataCollection attachments =
|
||||
ItemImageAttachment.getImageAttachments( item );
|
||||
attachments.addPath( ItemImageAttachment.IMAGE + "." +
|
||||
ReusableImageAsset.ID );
|
||||
attachments.addPath( ItemImageAttachment.IMAGE + "." +
|
||||
ReusableImageAsset.OBJECT_TYPE );
|
||||
attachments.addPath( ItemImageAttachment.IMAGE + "." +
|
||||
ReusableImageAsset.HEIGHT );
|
||||
attachments.addPath( ItemImageAttachment.IMAGE + "." +
|
||||
ReusableImageAsset.WIDTH );
|
||||
m_listModel = new ImageListModel(attachments);
|
||||
return m_listModel;
|
||||
}
|
||||
|
||||
protected ImageListModel getModel() {
|
||||
return m_listModel;
|
||||
}
|
||||
}
|
||||
|
||||
return new ImageListModel( attachments );
|
||||
}
|
||||
}
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private class ImageListModel implements ListModel {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private class ImageListModel implements ListModel {
|
||||
private final DataCollection m_attachments;
|
||||
|
||||
private final DataCollection m_attachments;
|
||||
ImageListModel(DataCollection attachments) {
|
||||
m_attachments = attachments;
|
||||
}
|
||||
|
||||
ImageListModel( DataCollection attachments ) {
|
||||
m_attachments = attachments;
|
||||
}
|
||||
@Override
|
||||
public Object getElement() {
|
||||
return DomainObjectFactory.newInstance(m_attachments.getDataObject());
|
||||
}
|
||||
|
||||
public Object getElement() {
|
||||
return DomainObjectFactory.newInstance
|
||||
( m_attachments.getDataObject() );
|
||||
}
|
||||
@Override
|
||||
public String getKey() {
|
||||
return m_attachments.getDataObject().getOID().toString();
|
||||
}
|
||||
|
||||
public String getKey() {
|
||||
return m_attachments.getDataObject().getOID().toString();
|
||||
}
|
||||
@Override
|
||||
public boolean next() {
|
||||
return m_attachments.next();
|
||||
}
|
||||
|
||||
public boolean next() {
|
||||
return m_attachments.next();
|
||||
}
|
||||
}
|
||||
public boolean isFirst() {
|
||||
return m_attachments.isFirst();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private class ImageListCellRenderer implements ListCellRenderer {
|
||||
public boolean isLast() {
|
||||
return m_attachments.isLast();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param list
|
||||
* @param state
|
||||
* @param value
|
||||
* @param key
|
||||
* @param index
|
||||
* @param isSelected
|
||||
* @return
|
||||
*/
|
||||
public Component getComponent( final List list, PageState state,
|
||||
Object value, String key,
|
||||
int index, boolean isSelected ) {
|
||||
final ItemImageAttachment attachment = (ItemImageAttachment) value;
|
||||
/**
|
||||
* 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);
|
||||
|
||||
BoxPanel container = new BoxPanel( BoxPanel.VERTICAL );
|
||||
container.setBorder( 1 );
|
||||
// Always need an oid of the image to move
|
||||
if (oid == null) {
|
||||
throw new IllegalArgumentException("OID must not be null");
|
||||
}
|
||||
|
||||
// Add CMS ImageDisplay element to BoxPanel container an overwrite
|
||||
// generateImagePropertiesXM to add attachment's meta data.
|
||||
container.add( new ImageDisplay(null) {
|
||||
@Override
|
||||
protected void generateImagePropertiesXML( ImageAsset image,
|
||||
PageState state,
|
||||
Element element ) {
|
||||
/* Use CMS ImageDisplay to display the image including *
|
||||
* metadata as name, type, widht, height etc. */
|
||||
super.generateImagePropertiesXML(image, state, element);
|
||||
// No move, nothing to do
|
||||
if (move == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
// We check config here to see whether additional meta data
|
||||
// as title and description are configured to be displayed.
|
||||
// If it is, we display the description and title options
|
||||
// TODO: Currently without Label, labels for each attribut
|
||||
// are provided by the theme. Has to be refactored to
|
||||
// provide labels in Java (including localization).
|
||||
// Title and description - if displayed - have to be
|
||||
// positioned above the image and its metadata.
|
||||
if(ItemImageAttachment.getConfig()
|
||||
.getIsImageStepDescriptionAndTitleShown()) {
|
||||
// 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private class ImageListCellRenderer implements ListCellRenderer {
|
||||
|
||||
/**
|
||||
*
|
||||
* @param list
|
||||
* @param state
|
||||
* @param value
|
||||
* @param key
|
||||
* @param index
|
||||
* @param isSelected
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Component getComponent(final List list, PageState state,
|
||||
Object value, String key,
|
||||
int index, boolean isSelected) {
|
||||
final ItemImageAttachment attachment = (ItemImageAttachment) value;
|
||||
|
||||
BoxPanel container = new BoxPanel(BoxPanel.VERTICAL);
|
||||
container.setBorder(1);
|
||||
|
||||
// Add CMS ImageDisplay element to BoxPanel container an overwrite
|
||||
// generateImagePropertiesXM to add attachment's meta data.
|
||||
container.add(new ImageDisplay(null) {
|
||||
@Override
|
||||
protected void generateImagePropertiesXML(ImageAsset image,
|
||||
PageState state,
|
||||
Element element) {
|
||||
/* Use CMS ImageDisplay to display the image including *
|
||||
* metadata as name, type, widht, height etc. */
|
||||
super.generateImagePropertiesXML(image, state, element);
|
||||
|
||||
// We check config here to see whether additional meta data
|
||||
// as title and description are configured to be displayed.
|
||||
// If it is, we display the description and title options
|
||||
// TODO: Currently without Label, labels for each attribut
|
||||
// are provided by the theme. Has to be refactored to
|
||||
// provide labels in Java (including localization).
|
||||
// Title and description - if displayed - have to be
|
||||
// positioned above the image and its metadata.
|
||||
if (ItemImageAttachment.getConfig()
|
||||
.getIsImageStepDescriptionAndTitleShown()) {
|
||||
String description = attachment.getDescription();
|
||||
if (description != null) {
|
||||
element.addAttribute("description", description);
|
||||
}
|
||||
|
||||
String title = attachment.getTitle();
|
||||
if (title!= null) {
|
||||
if (title != null) {
|
||||
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
|
||||
protected ImageAsset getImageAsset( PageState ps ) {
|
||||
return attachment.getImage();
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
/* Create a box panel beloy the image to display the caption */
|
||||
BoxPanel captionPanel = new BoxPanel( BoxPanel.HORIZONTAL );
|
||||
|
||||
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 );
|
||||
@Override
|
||||
protected ImageAsset getImageAsset(PageState ps) {
|
||||
return attachment.getImage();
|
||||
}
|
||||
});
|
||||
|
||||
/* 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 );
|
||||
/* Adds links to move and remove the image in a separate container element */
|
||||
if (!((ImageListModel) list.getModel(state)).isFirst()) {
|
||||
ControlLink moveUpLink = new ControlLink(new Label(
|
||||
ImageStepGlobalizationUtil.globalize(
|
||||
"cms.contentassets.ui.image_step.move_attached_image_up"))) {
|
||||
@Override
|
||||
public void setControlEvent(PageState ps) {
|
||||
String oid = ps.getControlEventValue();
|
||||
ps.setControlEvent(list, MOVEUP, oid);
|
||||
}
|
||||
|
||||
/* Add a link to remove the image in a separate container elemet */
|
||||
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 );
|
||||
}
|
||||
};
|
||||
container.add( deleteLink );
|
||||
// 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(moveUpLink);
|
||||
}
|
||||
|
||||
return container;
|
||||
}
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
*
|
||||
* @author unknown
|
||||
* @author Sören Bernstein (quasimodo) <sbernstein@zes.uni-bremen.de>
|
||||
* @author Sören Bernstein <quasi@quasiweb.de>
|
||||
*/
|
||||
public class ImageStepEdit extends SimpleContainer
|
||||
implements Resettable {
|
||||
|
|
|
|||
|
|
@ -1062,3 +1062,4 @@ cms.ui.images=Images
|
|||
cms.ui.folder.additionalInfo=Info
|
||||
cms.ui.section.new_section_root_category=Root category of the new Content Section
|
||||
cms.ui.admin_center=Admin Center
|
||||
cms.contentasset.image.ui.display.dimensions=Dimensions (width x height):
|
||||
|
|
|
|||
|
|
@ -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.header_action_delete=Aus dem System l\u00f6schen
|
||||
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.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.
|
||||
|
|
@ -1056,3 +1056,4 @@ cms.ui.images=Bilder
|
|||
cms.ui.folder.additionalInfo=Info
|
||||
cms.ui.section.new_section_root_category=Kategoriensystem der neuen Content Section
|
||||
cms.ui.admin_center=Admin Center
|
||||
cms.contentasset.image.ui.display.dimensions=Ma\u00dfe (Breite x H\u00f6he):
|
||||
|
|
|
|||
|
|
@ -110,3 +110,4 @@ cms.ui.images=Images
|
|||
cms.ui.folder.additionalInfo=
|
||||
cms.ui.section.new_section_root_category=
|
||||
cms.ui.admin_center=Admin Center
|
||||
cms.contentasset.image.ui.display.dimensions=Dimensions (width x height):
|
||||
|
|
|
|||
|
|
@ -584,3 +584,4 @@ cms.ui.images=Images
|
|||
cms.ui.folder.additionalInfo=
|
||||
cms.ui.section.new_section_root_category=
|
||||
cms.ui.admin_center=Admin Center
|
||||
cms.contentasset.image.ui.display.dimensions=Dimensions (width x height):
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ import org.imgscalr.Scalr;
|
|||
* cache of {@link BaseImage}. Also, this class is able to create server-side
|
||||
* resized versions of ImageAssets.
|
||||
*
|
||||
* @author Sören Bernstein (quasimodo) <sbernstein@zes.uni-bremen.de>
|
||||
* @author Sören Bernstein <quasi@quasiweb.de>
|
||||
*/
|
||||
public class CachedImage {
|
||||
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ import org.apache.log4j.Logger;
|
|||
*
|
||||
* @author <a href="mailto:pihman@arsdigita.com">Michael Pih</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 $Id: ContentSection.java 2305 2012-05-01 12:26:33Z pboy $
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ import org.apache.log4j.Logger;
|
|||
* folders to jsp templates.
|
||||
*
|
||||
* @author unknown
|
||||
* @author Sören Bernstein <sbernstein@quasiweb.de>
|
||||
* @author Sören Bernstein <quasi@quasiweb.de>
|
||||
* @author Peter Boy <pboy@barkhof.uni-bremen.de>
|
||||
*/
|
||||
public class ContentSectionServlet extends BaseApplicationServlet {
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ import org.apache.log4j.Logger;
|
|||
*
|
||||
* @author Jack Chung
|
||||
* @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 $
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ package com.arsdigita.cms;
|
|||
* Content Items implementing this interface are be language invariant, if
|
||||
* isLanguageInvariant returns true
|
||||
*
|
||||
* @author Sören Bernstein (quasimodo) <sbernstein@zes.uni-bremen.de>
|
||||
* @author Sören Bernstein <quasi@quasiweb.de>
|
||||
*/
|
||||
public interface LanguageInvariantContentItem {
|
||||
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ import org.apache.log4j.Logger;
|
|||
* to be modifiable must be included in Loader class itself!
|
||||
*
|
||||
* @author pb
|
||||
* @author Sören Bernstein (quasi@barkhof.uni-bremen.de)
|
||||
* @author Sören Bernstein <quasi@quasiweb.de>
|
||||
* @version $Id: LoaderConfig.java $
|
||||
*/
|
||||
public final class LoaderConfig extends AbstractConfig {
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ import org.apache.log4j.Logger;
|
|||
* Configures parameter which are not persisted in the database and may be
|
||||
* changes during each startup of the system.
|
||||
* @author pb
|
||||
* @author Sören Bernstein (quasi@barkhof.uni-bremen.de)
|
||||
* @author Sören Bernstein <quasi@quasiweb.de>
|
||||
*/
|
||||
public final class ContentSectionConfig extends AbstractConfig {
|
||||
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ import org.xml.sax.helpers.DefaultHandler;
|
|||
* into the database.
|
||||
*
|
||||
* @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)
|
||||
* @version $Id: $
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ import org.apache.log4j.Logger;
|
|||
* registry object (file).
|
||||
*
|
||||
* @author Rafael H. Schloming <rhs@mit.edu>
|
||||
* @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 $
|
||||
**/
|
||||
public abstract class AbstractContentTypeLoader extends PackageLoader {
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ import org.apache.log4j.Logger;
|
|||
* <p>This class extends {@link com.arsdigita.cms.ContentItem content item} and
|
||||
* 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 {
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ import org.apache.log4j.Logger;
|
|||
/**
|
||||
* 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 {
|
||||
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ import java.util.StringTokenizer;
|
|||
/**
|
||||
* Basic GenericPerson Contenttype for OpenCCM.
|
||||
*
|
||||
* @author Sören Bernstein
|
||||
* @author Sören Bernstein <quasi@quasiweb.de>
|
||||
* @author Jens Pelzetter
|
||||
*/
|
||||
public class GenericPerson extends ContentPage implements
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ import org.apache.log4j.Logger;
|
|||
*
|
||||
* @version $Revision: #7 $ $Date: 2004/08/17 $
|
||||
* @author Nobuko Asakai (nasakai@redhat.com)
|
||||
* @author Sören Bernstein (Quasimodo)
|
||||
* @author Sören Bernstein <quasi@quasiweb.de>
|
||||
*/
|
||||
public class Link extends ACSObject {
|
||||
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ import com.arsdigita.globalization.GlobalizationHelper;
|
|||
* This is a modified copy of ContentItemTraversalAdapter to make the
|
||||
* Link-Objects aware of multilingual items (ContentBundle)
|
||||
*
|
||||
* @author Sören Bernstein (Quasimodo)
|
||||
* @author Sören Bernstein <quasi@quasiweb.de>
|
||||
*/
|
||||
public class LinkTraversalAdapter
|
||||
extends ContentItemTraversalAdapter {
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ import org.apache.log4j.Logger;
|
|||
* Form to edit the properties of a address.
|
||||
*
|
||||
* @author: Jens Pelzetter
|
||||
* @author: Sören Bernstein
|
||||
* @author Sören Bernstein <quasi@quasiweb.de>
|
||||
*/
|
||||
public class GenericAddressPropertyForm extends BasicPageForm
|
||||
implements FormProcessListener,
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ import java.math.BigDecimal;
|
|||
/**
|
||||
* 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 {
|
||||
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ import com.arsdigita.globalization.GlobalizationHelper;
|
|||
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 {
|
||||
private static final Logger s_log = Logger.getLogger(GenericContactEntryAddForm.class);
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ import org.apache.log4j.Logger;
|
|||
* - Address
|
||||
* - Various contact entries.
|
||||
*
|
||||
* @author quasi <quasi@barkhof.uni-bremen.de>
|
||||
* @author quasi <quasi@quasiweb.de>
|
||||
*/
|
||||
public class GenericContactPropertiesStep extends SimpleEditStep {
|
||||
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ import org.apache.log4j.Logger;
|
|||
* 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.
|
||||
*
|
||||
* @author Sören Bernstein (quasimodo) quasi@zes.uni-bremen.de
|
||||
* @author Sören Bernstein <quasi@quasiweb.de>
|
||||
*/
|
||||
public class GenericContactTypeAddForm extends BasicItemForm {
|
||||
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ import com.arsdigita.cms.ui.authoring.SimpleEditStep;
|
|||
import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
|
||||
|
||||
/**
|
||||
* @author Sören Bernstein
|
||||
* @author Sören Bernstein <quasi@quasiweb.de>
|
||||
*/
|
||||
public class GenericContactTypePropertiesStep extends SimpleEditStep {
|
||||
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ import org.apache.log4j.Logger;
|
|||
* 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.
|
||||
*
|
||||
* @author Sören Bernstein (quasimodo) quasi@zes.uni-bremen.de
|
||||
* @author Sören Bernstein <quasi@quasiweb.de>
|
||||
*/
|
||||
public class GenericPersonContactAddForm extends BasicItemForm {
|
||||
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ import com.arsdigita.cms.ui.authoring.SimpleEditStep;
|
|||
import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
|
||||
|
||||
/**
|
||||
* @author Sören Bernstein
|
||||
* @author Sören Bernstein <quasi@quasiweb.de>
|
||||
*/
|
||||
public class GenericPersonContactPropertiesStep extends SimpleEditStep {
|
||||
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ import org.apache.log4j.Logger;
|
|||
/**
|
||||
* 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
|
||||
TableActionListener {
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ import org.apache.log4j.Logger;
|
|||
*
|
||||
* @version $Revision: #5 $ $Date: 2004/08/17 $
|
||||
* @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
|
||||
implements FormInitListener, FormProcessListener,
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ import org.apache.log4j.Logger;
|
|||
*
|
||||
* @author Stanislav Freidin (sfreidin@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 $Id: BaseImage.java 1571 2007-04-20 15:57:54Z apevec $
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ import javax.servlet.http.HttpServletResponse;
|
|||
* The Item Search page.
|
||||
*
|
||||
* @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)
|
||||
*/
|
||||
public class CMSItemSearchPage extends CMSApplicationPage {
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ import org.apache.log4j.Logger;
|
|||
* @author Michael Pih
|
||||
* @author Stanislav Freidin <sfreidin@redhat.com>
|
||||
* @author Jack Chung
|
||||
* @author Sören Bernstein (quasimodo) <sbernstein@zes.uni-bremen.de>
|
||||
* @author Sören Bernstein <quasi@quasiweb.de>
|
||||
*
|
||||
* @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());
|
||||
}
|
||||
|
||||
// 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
|
||||
// the language pane
|
||||
if (item instanceof LanguageInvariantContentItem) {
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ import com.arsdigita.util.LockableImpl;
|
|||
* builder will return an {@link EmptyImageBrowserModel}
|
||||
*
|
||||
* @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
|
||||
* terry $
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ import org.apache.log4j.Logger;
|
|||
* </code></pre></blockquote>
|
||||
*
|
||||
* @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 $
|
||||
*/
|
||||
public class ImageBrowser extends Table {
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ import com.arsdigita.cms.util.GlobalizationUtil;
|
|||
* by keyword
|
||||
*
|
||||
* @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 $
|
||||
*/
|
||||
public class ImageChooser extends BoxPanel {
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ import com.arsdigita.cms.ReusableImageAsset;
|
|||
* All components for image handling (like {@link ImageLibraryComponent} or
|
||||
* {@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 {
|
||||
|
||||
|
|
|
|||
|
|
@ -19,80 +19,85 @@ import org.apache.log4j.Logger;
|
|||
|
||||
/**
|
||||
* An abstract listener for {@link ImageComponent}.
|
||||
*
|
||||
* This listener provides the base implementation which is shared between all
|
||||
*
|
||||
* This listener provides the base implementation which is shared between all
|
||||
* listeners of this kind.
|
||||
*
|
||||
*
|
||||
* 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,
|
||||
FormProcessListener,
|
||||
FormSubmissionListener {
|
||||
public abstract class ImageComponentAbstractListener implements FormInitListener,
|
||||
FormProcessListener,
|
||||
FormSubmissionListener {
|
||||
|
||||
private static final Logger s_log = Logger.getLogger(
|
||||
ImageComponentSelectListener.class);
|
||||
MapComponentSelectionModel m_imageComponent;
|
||||
private static final Logger s_log = Logger.getLogger(
|
||||
ImageComponentSelectListener.class);
|
||||
MapComponentSelectionModel m_imageComponent;
|
||||
|
||||
public ImageComponentAbstractListener(MapComponentSelectionModel imageComponent) {
|
||||
super();
|
||||
m_imageComponent = imageComponent;
|
||||
}
|
||||
public ImageComponentAbstractListener(MapComponentSelectionModel imageComponent) {
|
||||
super();
|
||||
m_imageComponent = imageComponent;
|
||||
}
|
||||
|
||||
public void init(FormSectionEvent event)
|
||||
throws FormProcessException {
|
||||
PageState ps = event.getPageState();
|
||||
if (!m_imageComponent.isSelected(ps)) {
|
||||
setImageComponent(ps, ImageComponent.LIBRARY);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void init(FormSectionEvent event)
|
||||
throws FormProcessException {
|
||||
PageState ps = event.getPageState();
|
||||
if (!m_imageComponent.isSelected(ps)) {
|
||||
setImageComponent(ps, ImageComponent.LIBRARY);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Call {@link #cancelled(com.arsdigita.bebop.PageState)} if the cancel button
|
||||
* was pressed.
|
||||
*
|
||||
* @param event the {@link FormSectionEvent}
|
||||
* @throws FormProcessException
|
||||
*/
|
||||
public void submitted(FormSectionEvent event) throws FormProcessException {
|
||||
PageState ps = event.getPageState();
|
||||
ImageComponent component = getImageComponent(ps);
|
||||
/**
|
||||
* Call {@link #cancelled(com.arsdigita.bebop.PageState)} if the cancel
|
||||
* button was pressed.
|
||||
*
|
||||
* @param event the {@link FormSectionEvent}
|
||||
* @throws FormProcessException
|
||||
*/
|
||||
@Override
|
||||
public void submitted(FormSectionEvent event) throws FormProcessException {
|
||||
PageState ps = event.getPageState();
|
||||
ImageComponent component = getImageComponent(ps);
|
||||
|
||||
if(component.getSaveCancelSection().getCancelButton().isSelected(ps)) {
|
||||
cancelled(ps);
|
||||
}
|
||||
}
|
||||
if (component.getSaveCancelSection().getCancelButton().isSelected(ps)) {
|
||||
cancelled(ps);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Call {@link #processImage(com.arsdigita.bebop.event.FormSectionEvent,
|
||||
* com.arsdigita.bebop.PageState, com.arsdigita.cms.ui.ImageComponent,
|
||||
* com.arsdigita.cms.ReusableImageAsset) }
|
||||
* if the save button was pressed.
|
||||
*
|
||||
* @param event the {@link FormSectionEvent}
|
||||
* @throws FormProcessException
|
||||
*/
|
||||
public void process(FormSectionEvent event) throws FormProcessException {
|
||||
PageState ps = event.getPageState();
|
||||
ImageComponent component = getImageComponent(ps);
|
||||
/**
|
||||
* Call {@link #processImage(com.arsdigita.bebop.event.FormSectionEvent,
|
||||
* com.arsdigita.bebop.PageState, com.arsdigita.cms.ui.ImageComponent,
|
||||
* com.arsdigita.cms.ReusableImageAsset) }
|
||||
* if the save button was pressed.
|
||||
*
|
||||
* @param event the {@link FormSectionEvent}
|
||||
* @throws FormProcessException
|
||||
*/
|
||||
@Override
|
||||
public void process(FormSectionEvent event) throws FormProcessException {
|
||||
PageState ps = event.getPageState();
|
||||
ImageComponent component = getImageComponent(ps);
|
||||
|
||||
if (!component.getSaveCancelSection().getSaveButton().isSelected(ps)) {
|
||||
return;
|
||||
}
|
||||
if (!component.getSaveCancelSection().getSaveButton().isSelected(ps)) {
|
||||
return;
|
||||
}
|
||||
|
||||
ReusableImageAsset image = component.getImage(event);
|
||||
ReusableImageAsset image = component.getImage(event);
|
||||
|
||||
processImage(event, ps, component, image);
|
||||
}
|
||||
processImage(event, ps, component, image);
|
||||
}
|
||||
|
||||
/**
|
||||
* To be overridden by child if neccessary.
|
||||
*
|
||||
* @param ps
|
||||
*/
|
||||
protected void cancelled(PageState ps) {
|
||||
}
|
||||
|
||||
/**
|
||||
* To be overridden by child if neccessary.
|
||||
*
|
||||
* @param ps
|
||||
*/
|
||||
protected void cancelled(PageState ps) {};
|
||||
;
|
||||
|
||||
/**
|
||||
* Process the input.
|
||||
|
|
@ -104,45 +109,45 @@ public abstract class ImageComponentAbstractListener implements FormInitListener
|
|||
*/
|
||||
protected abstract void processImage(FormSectionEvent event, PageState ps, ImageComponent component, ReusableImageAsset image);
|
||||
|
||||
protected ImageComponent getImageComponent(PageState ps) {
|
||||
if (!m_imageComponent.isSelected(ps)) {
|
||||
if (s_log.isDebugEnabled()) {
|
||||
s_log.debug("No component selected");
|
||||
s_log.debug("Selected: " + m_imageComponent.getComponent(ps));
|
||||
}
|
||||
protected ImageComponent getImageComponent(PageState ps) {
|
||||
if (!m_imageComponent.isSelected(ps)) {
|
||||
if (s_log.isDebugEnabled()) {
|
||||
s_log.debug("No component selected");
|
||||
s_log.debug("Selected: " + m_imageComponent.getComponent(ps));
|
||||
}
|
||||
|
||||
m_imageComponent.setSelectedKey(ps, ImageComponent.UPLOAD);
|
||||
}
|
||||
m_imageComponent.setSelectedKey(ps, ImageComponent.UPLOAD);
|
||||
}
|
||||
|
||||
return (ImageComponent) m_imageComponent.getComponent(ps);
|
||||
return (ImageComponent) m_imageComponent.getComponent(ps);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the active component
|
||||
*
|
||||
* @param ps Page state
|
||||
* @param activeKey the key of the active component
|
||||
*/
|
||||
protected void setImageComponent(PageState ps, final String activeKey) {
|
||||
/**
|
||||
* Sets the active component
|
||||
*
|
||||
* @param ps Page state
|
||||
* @param activeKey the key of the active component
|
||||
*/
|
||||
protected void setImageComponent(PageState ps, final String activeKey) {
|
||||
|
||||
if (s_log.isDebugEnabled()) {
|
||||
s_log.debug("Selected component: " + activeKey);
|
||||
}
|
||||
if (s_log.isDebugEnabled()) {
|
||||
s_log.debug("Selected component: " + activeKey);
|
||||
}
|
||||
|
||||
Map componentsMap = m_imageComponent.getComponentsMap();
|
||||
Iterator i = componentsMap.keySet().iterator();
|
||||
while (i.hasNext()) {
|
||||
Object key = i.next();
|
||||
Component component = (Component) componentsMap.get(key);
|
||||
Map componentsMap = m_imageComponent.getComponentsMap();
|
||||
Iterator i = componentsMap.keySet().iterator();
|
||||
while (i.hasNext()) {
|
||||
Object key = i.next();
|
||||
Component component = (Component) componentsMap.get(key);
|
||||
|
||||
boolean isVisible = activeKey.equals(key);
|
||||
boolean isVisible = activeKey.equals(key);
|
||||
|
||||
if (s_log.isDebugEnabled()) {
|
||||
s_log.debug("Key: " + key + "; Visibility: " + isVisible);
|
||||
}
|
||||
if (s_log.isDebugEnabled()) {
|
||||
s_log.debug("Key: " + key + "; Visibility: " + isVisible);
|
||||
}
|
||||
|
||||
ps.setVisible(component, isVisible);
|
||||
}
|
||||
}
|
||||
ps.setVisible(component, isVisible);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ import com.arsdigita.toolbox.ui.ComponentMap;
|
|||
*
|
||||
* 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 {
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ import org.apache.log4j.Logger;
|
|||
*
|
||||
* 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 {
|
||||
|
||||
|
|
|
|||
|
|
@ -31,10 +31,9 @@ import com.arsdigita.web.URL;
|
|||
import com.arsdigita.xml.Element;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
|
||||
/**
|
||||
* Displays a single ImageAsset, showing its image, width, height,
|
||||
* name and mime-type.
|
||||
* Displays a single ImageAsset, showing its image, width, height, name and
|
||||
* mime-type.
|
||||
*
|
||||
* @author Michael Pih (pihman@arsdigita.com)
|
||||
* @author Stanislav Freidin (sfreidin@arsdigita.com)
|
||||
|
|
@ -42,113 +41,117 @@ import java.math.BigDecimal;
|
|||
*/
|
||||
public class ImageDisplay extends SimpleComponent {
|
||||
|
||||
private final ItemSelectionModel m_item;
|
||||
private final ItemSelectionModel m_item;
|
||||
|
||||
/**
|
||||
* Construct a new ImageDisplay
|
||||
*
|
||||
* @param m The {@link ItemSelectionModel} which will supply
|
||||
* this component with the {@link ImageAsset}
|
||||
*/
|
||||
public ImageDisplay(ItemSelectionModel m) {
|
||||
super();
|
||||
m_item = m;
|
||||
}
|
||||
/**
|
||||
* Construct a new ImageDisplay
|
||||
*
|
||||
* @param m The {@link ItemSelectionModel} which will supply this component
|
||||
* with the {@link ImageAsset}
|
||||
*/
|
||||
public ImageDisplay(ItemSelectionModel m) {
|
||||
super();
|
||||
m_item = m;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the {@link ItemSelectionModel} which supplies this
|
||||
* component with the {@link ImageAsset}
|
||||
*/
|
||||
public final ItemSelectionModel getImageSelectionModel() {
|
||||
return m_item;
|
||||
}
|
||||
/**
|
||||
* @return the {@link ItemSelectionModel} which supplies this component with
|
||||
* the {@link ImageAsset}
|
||||
*/
|
||||
public final ItemSelectionModel getImageSelectionModel() {
|
||||
return m_item;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param state
|
||||
* @param parent
|
||||
*/
|
||||
@Override
|
||||
public void generateXML(PageState state, Element parent) {
|
||||
if ( isVisible(state) ) {
|
||||
/**
|
||||
*
|
||||
* @param state
|
||||
* @param parent
|
||||
*/
|
||||
@Override
|
||||
public void generateXML(PageState state, Element parent) {
|
||||
if (isVisible(state)) {
|
||||
|
||||
ImageAsset image = getImageAsset(state);
|
||||
ImageAsset image = getImageAsset(state);
|
||||
|
||||
if (image == null) {
|
||||
return;
|
||||
}
|
||||
if (image == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
Element element = new Element("cms:imageDisplay", CMS.CMS_XML_NS);
|
||||
Element element = new Element("cms:imageDisplay", CMS.CMS_XML_NS);
|
||||
|
||||
if (image != null) {
|
||||
generateImagePropertiesXML(image, state, element);
|
||||
}
|
||||
if (image != null) {
|
||||
generateImagePropertiesXML(image, state, element);
|
||||
}
|
||||
|
||||
exportAttributes(element);
|
||||
parent.addContent(element);
|
||||
}
|
||||
}
|
||||
exportAttributes(element);
|
||||
parent.addContent(element);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates the property xml.
|
||||
*
|
||||
* @param image
|
||||
* @param state
|
||||
* @param element
|
||||
*/
|
||||
protected void generateImagePropertiesXML(ImageAsset image,
|
||||
PageState state,
|
||||
Element element) {
|
||||
/**
|
||||
* Generates the property xml.
|
||||
*
|
||||
* @param image
|
||||
* @param state
|
||||
* @param element
|
||||
*/
|
||||
protected void generateImagePropertiesXML(ImageAsset image,
|
||||
PageState state,
|
||||
Element element) {
|
||||
|
||||
element.addAttribute("name_label", (String)GlobalizationUtil.globalize(
|
||||
"cms.contentasset.image.ui.display.name")
|
||||
.localize());
|
||||
element.addAttribute("name", image.getName());
|
||||
element.addAttribute("src", URL.getDispatcherPath() +
|
||||
Service.getImageURL(image));
|
||||
element.addAttribute("name_label", (String) GlobalizationUtil.globalize(
|
||||
"cms.contentasset.image.ui.display.name")
|
||||
.localize());
|
||||
element.addAttribute("name", image.getName());
|
||||
element.addAttribute("src", URL.getDispatcherPath()
|
||||
+ Service.getImageURL(image));
|
||||
|
||||
element.addAttribute("mime_type_label", (String)GlobalizationUtil.globalize(
|
||||
"cms.contentasset.image.ui.display.type")
|
||||
.localize());
|
||||
MimeType mimeType = image.getMimeType();
|
||||
if ( mimeType != null ) {
|
||||
element.addAttribute("mime_type", mimeType.getLabel());
|
||||
}
|
||||
element.addAttribute("mime_type_label", (String) GlobalizationUtil.globalize(
|
||||
"cms.contentasset.image.ui.display.type")
|
||||
.localize());
|
||||
MimeType mimeType = image.getMimeType();
|
||||
if (mimeType != null) {
|
||||
element.addAttribute("mime_type", mimeType.getLabel());
|
||||
}
|
||||
|
||||
element.addAttribute("width_label", (String)GlobalizationUtil.globalize(
|
||||
"cms.contentasset.image.ui.display.width")
|
||||
.localize());
|
||||
BigDecimal width = image.getWidth();
|
||||
if ( width != null ) {
|
||||
element.addAttribute("width", width.toString());
|
||||
} else {
|
||||
element.addAttribute("width", (String)GlobalizationUtil.globalize(
|
||||
"cms.ui.unknown")
|
||||
.localize());
|
||||
}
|
||||
element.addAttribute("width_label", (String) GlobalizationUtil.globalize(
|
||||
"cms.contentasset.image.ui.display.width")
|
||||
.localize());
|
||||
BigDecimal width = image.getWidth();
|
||||
if (width != null) {
|
||||
element.addAttribute("width", width.toString());
|
||||
} else {
|
||||
element.addAttribute("width", (String) GlobalizationUtil.globalize(
|
||||
"cms.ui.unknown")
|
||||
.localize());
|
||||
}
|
||||
|
||||
element.addAttribute("height_label", (String)GlobalizationUtil.globalize(
|
||||
"cms.contentasset.image.ui.display.height")
|
||||
.localize());
|
||||
BigDecimal height = image.getHeight();
|
||||
if ( height != null ) {
|
||||
element.addAttribute("height", height.toString());
|
||||
} else {
|
||||
element.addAttribute("height", (String)GlobalizationUtil.globalize(
|
||||
"cms.ui.unknown")
|
||||
.localize());
|
||||
}
|
||||
}
|
||||
element.addAttribute("height_label", (String) GlobalizationUtil.globalize(
|
||||
"cms.contentasset.image.ui.display.height")
|
||||
.localize());
|
||||
BigDecimal height = image.getHeight();
|
||||
if (height != null) {
|
||||
element.addAttribute("height", height.toString());
|
||||
} else {
|
||||
element.addAttribute("height", (String) GlobalizationUtil.globalize(
|
||||
"cms.ui.unknown")
|
||||
.localize());
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param state
|
||||
* @return
|
||||
*/
|
||||
protected ImageAsset getImageAsset(PageState state) {
|
||||
ImageAsset image = (ImageAsset) m_item.getSelectedObject(state);
|
||||
Assert.exists(image, "Image asset");
|
||||
return image;
|
||||
}
|
||||
element.addAttribute("dimension_label", (String) GlobalizationUtil.globalize(
|
||||
"cms.contentasset.image.ui.display.dimensions")
|
||||
.localize());
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param state
|
||||
* @return
|
||||
*/
|
||||
protected ImageAsset getImageAsset(PageState state) {
|
||||
ImageAsset image = (ImageAsset) m_item.getSelectedObject(state);
|
||||
Assert.exists(image, "Image asset");
|
||||
return image;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ import java.math.BigDecimal;
|
|||
* extended from {@link ImageComponentAbstractListener}.
|
||||
*
|
||||
* @author unknown
|
||||
* @author Sören Bernstein (quasimodo) <sbernstein@zes.uni-bremen.de>
|
||||
* @author Sören Bernstein <quasi@quasiweb.de>
|
||||
*/
|
||||
public class ImageLibraryComponent extends SimpleContainer
|
||||
implements ImageComponent, Resettable {
|
||||
|
|
|
|||
|
|
@ -22,149 +22,149 @@ import org.apache.log4j.Logger;
|
|||
|
||||
/**
|
||||
* A {@link CMSPage} to select and upload images.
|
||||
*
|
||||
* This page is used by /web/templates/ccm-cms/content-section/admin/image_select.jsp
|
||||
* which is used by the OpenCCM plugin for Xihna editor.
|
||||
*
|
||||
* @author Sören Bernstein (quasimodo) <sbernstein@zes.uni-bremen.de>
|
||||
*
|
||||
* This page is used by
|
||||
* /web/templates/ccm-cms/content-section/admin/image_select.jsp which is used
|
||||
* by the OpenCCM plugin for Xinha editor.
|
||||
*
|
||||
* @author Sören Bernstein <quasi@quasiweb.de>
|
||||
*/
|
||||
public class ImageSelectPage extends CMSPage {
|
||||
|
||||
private static final Logger S_LOG = Logger.getLogger(ImagesPane.class);
|
||||
|
||||
private final static String XSL_CLASS = "CMS Admin";
|
||||
private TabbedPane m_tabbedPane;
|
||||
private ImageLibraryComponent m_imageLibrary;
|
||||
private ImageUploadComponent m_imageUpload;
|
||||
private ImageSelectResultComponent m_result;
|
||||
private BigDecimalParameter m_sectionId;
|
||||
private final StringParameter m_imageComponentKey;
|
||||
private final MapComponentSelectionModel m_imageComponent;
|
||||
private final ImageComponentSelectListener m_selectListener;
|
||||
private static final CMSConfig s_conf = CMSConfig.getInstance();
|
||||
public static final String CONTENT_SECTION = "section_id";
|
||||
public static final String RESULT = "result";
|
||||
private static final Logger S_LOG = Logger.getLogger(ImagesPane.class);
|
||||
private final static String XSL_CLASS = "CMS Admin";
|
||||
private TabbedPane m_tabbedPane;
|
||||
private ImageLibraryComponent m_imageLibrary;
|
||||
private ImageUploadComponent m_imageUpload;
|
||||
private ImageSelectResultComponent m_result;
|
||||
private BigDecimalParameter m_sectionId;
|
||||
private final StringParameter m_imageComponentKey;
|
||||
private final MapComponentSelectionModel m_imageComponent;
|
||||
private final ImageComponentSelectListener m_selectListener;
|
||||
private static final CMSConfig s_conf = CMSConfig.getInstance();
|
||||
public static final String CONTENT_SECTION = "section_id";
|
||||
public static final String RESULT = "result";
|
||||
|
||||
public ImageSelectPage() {
|
||||
super(GlobalizationUtil.globalize(
|
||||
"cms.ui.image_select.page_title")
|
||||
.localize().toString(),
|
||||
new SimpleContainer());
|
||||
public ImageSelectPage() {
|
||||
super(GlobalizationUtil.globalize(
|
||||
"cms.ui.image_select.page_title")
|
||||
.localize().toString(),
|
||||
new SimpleContainer());
|
||||
|
||||
setClassAttr("cms-admin");
|
||||
setClassAttr("cms-admin");
|
||||
|
||||
m_sectionId = new BigDecimalParameter(CONTENT_SECTION);
|
||||
addGlobalStateParam(m_sectionId);
|
||||
m_sectionId = new BigDecimalParameter(CONTENT_SECTION);
|
||||
addGlobalStateParam(m_sectionId);
|
||||
|
||||
m_imageComponentKey = new StringParameter("imageComponent");
|
||||
m_imageComponentKey = new StringParameter("imageComponent");
|
||||
|
||||
ParameterSingleSelectionModel componentModel =
|
||||
new ParameterSingleSelectionModel(m_imageComponentKey);
|
||||
m_imageComponent =
|
||||
new MapComponentSelectionModel(componentModel, new HashMap());
|
||||
|
||||
m_selectListener = new ImageComponentSelectListener(m_imageComponent,
|
||||
getResultComponent());
|
||||
ParameterSingleSelectionModel componentModel =
|
||||
new ParameterSingleSelectionModel(m_imageComponentKey);
|
||||
m_imageComponent =
|
||||
new MapComponentSelectionModel(componentModel, new HashMap());
|
||||
|
||||
m_tabbedPane = createTabbedPane();
|
||||
m_tabbedPane.setIdAttr("page-body");
|
||||
m_selectListener = new ImageComponentSelectListener(m_imageComponent,
|
||||
getResultComponent());
|
||||
|
||||
add(m_tabbedPane);
|
||||
// ActionListener to change the image component state param to the
|
||||
// right value
|
||||
addActionListener(new ActionListener() {
|
||||
m_tabbedPane = createTabbedPane();
|
||||
m_tabbedPane.setIdAttr("page-body");
|
||||
|
||||
public void actionPerformed(ActionEvent event) {
|
||||
final PageState ps = event.getPageState();
|
||||
add(m_tabbedPane);
|
||||
// ActionListener to change the image component state param to the
|
||||
// right value
|
||||
addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent event) {
|
||||
final PageState ps = event.getPageState();
|
||||
|
||||
if (m_tabbedPane.getCurrentPane(ps).equals(m_imageLibrary)) {
|
||||
m_imageComponent.setSelectedKey(ps, ImageComponent.LIBRARY);
|
||||
}
|
||||
if (m_tabbedPane.getCurrentPane(ps).equals(m_imageUpload)) {
|
||||
m_imageComponent.setSelectedKey(ps, ImageComponent.UPLOAD);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
add(m_result);
|
||||
|
||||
addGlobalStateParam(m_imageComponentKey);
|
||||
}
|
||||
if (m_tabbedPane.getCurrentPane(ps).equals(m_imageLibrary)) {
|
||||
m_imageComponent.setSelectedKey(ps, ImageComponent.LIBRARY);
|
||||
}
|
||||
if (m_tabbedPane.getCurrentPane(ps).equals(m_imageUpload)) {
|
||||
m_imageComponent.setSelectedKey(ps, ImageComponent.UPLOAD);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Create the image library pane
|
||||
*
|
||||
* @return m_imageLibrary
|
||||
*/
|
||||
protected ImageLibraryComponent getImageLibraryPane() {
|
||||
if (m_imageLibrary == null) {
|
||||
m_imageLibrary = new ImageLibraryComponent(ImageComponent.SELECT_IMAGE,
|
||||
this);
|
||||
m_imageLibrary.getForm().addInitListener(m_selectListener);
|
||||
m_imageLibrary.getForm().addProcessListener(m_selectListener);
|
||||
m_imageComponent.getComponentsMap().put(ImageComponent.LIBRARY,
|
||||
m_imageLibrary);
|
||||
}
|
||||
return m_imageLibrary;
|
||||
}
|
||||
add(m_result);
|
||||
|
||||
/**
|
||||
* Create the image upload pane
|
||||
*
|
||||
* @return m_imageUpload
|
||||
*/
|
||||
protected ImageUploadComponent getImageUploadPane() {
|
||||
addGlobalStateParam(m_imageComponentKey);
|
||||
}
|
||||
|
||||
if (m_imageUpload == null) {
|
||||
m_imageUpload = new ImageUploadComponent(ImageComponent.SELECT_IMAGE);
|
||||
m_imageUpload.getForm().addInitListener(m_selectListener);
|
||||
m_imageUpload.getForm().addProcessListener(m_selectListener);
|
||||
m_imageComponent.getComponentsMap().put(ImageComponent.UPLOAD,
|
||||
m_imageUpload);
|
||||
}
|
||||
return m_imageUpload;
|
||||
}
|
||||
/**
|
||||
* Create the image library pane
|
||||
*
|
||||
* @return m_imageLibrary
|
||||
*/
|
||||
protected ImageLibraryComponent getImageLibraryPane() {
|
||||
if (m_imageLibrary == null) {
|
||||
m_imageLibrary = new ImageLibraryComponent(ImageComponent.SELECT_IMAGE,
|
||||
this);
|
||||
m_imageLibrary.getForm().addInitListener(m_selectListener);
|
||||
m_imageLibrary.getForm().addProcessListener(m_selectListener);
|
||||
m_imageComponent.getComponentsMap().put(ImageComponent.LIBRARY,
|
||||
m_imageLibrary);
|
||||
}
|
||||
return m_imageLibrary;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an {@link ImageSelectResultComponent}
|
||||
*
|
||||
* @return m_resultPane
|
||||
*/
|
||||
protected ImageSelectResultComponent getResultComponent() {
|
||||
if (m_result == null) {
|
||||
m_result = new ImageSelectResultComponent();
|
||||
}
|
||||
return m_result;
|
||||
}
|
||||
/**
|
||||
* Create the image upload pane
|
||||
*
|
||||
* @return m_imageUpload
|
||||
*/
|
||||
protected ImageUploadComponent getImageUploadPane() {
|
||||
|
||||
/**
|
||||
* Create the tabbed pane
|
||||
*/
|
||||
protected TabbedPane createTabbedPane() {
|
||||
TabbedPane pane = new TabbedPane();
|
||||
pane.setClassAttr(XSL_CLASS);
|
||||
if (m_imageUpload == null) {
|
||||
m_imageUpload = new ImageUploadComponent(ImageComponent.SELECT_IMAGE);
|
||||
m_imageUpload.getForm().addInitListener(m_selectListener);
|
||||
m_imageUpload.getForm().addProcessListener(m_selectListener);
|
||||
m_imageComponent.getComponentsMap().put(ImageComponent.UPLOAD,
|
||||
m_imageUpload);
|
||||
}
|
||||
return m_imageUpload;
|
||||
}
|
||||
|
||||
addToPane(pane, ImageComponent.LIBRARY, getImageLibraryPane());
|
||||
addToPane(pane, ImageComponent.UPLOAD, getImageUploadPane());
|
||||
pane.setDefaultPane(m_imageLibrary);
|
||||
/**
|
||||
* Creates an {@link ImageSelectResultComponent}
|
||||
*
|
||||
* @return m_resultPane
|
||||
*/
|
||||
protected ImageSelectResultComponent getResultComponent() {
|
||||
if (m_result == null) {
|
||||
m_result = new ImageSelectResultComponent();
|
||||
}
|
||||
return m_result;
|
||||
}
|
||||
|
||||
return pane;
|
||||
}
|
||||
/**
|
||||
* Create the tabbed pane
|
||||
*/
|
||||
protected TabbedPane createTabbedPane() {
|
||||
TabbedPane pane = new TabbedPane();
|
||||
pane.setClassAttr(XSL_CLASS);
|
||||
|
||||
/**
|
||||
* Adds the specified component, with the specified tab name, to the tabbed
|
||||
* pane only if it is not null.
|
||||
*
|
||||
* @param pane The pane to which to add the tab
|
||||
* @param tabName The name of the tab if it's added
|
||||
* @param comp The component to add to the pane
|
||||
*/
|
||||
protected void addToPane(final TabbedPane pane,
|
||||
final String tabName,
|
||||
final Component comp) {
|
||||
if (comp != null) {
|
||||
pane.addTab(GlobalizationUtil.globalize("cms.ui.image_" + tabName)
|
||||
.localize().toString(), comp);
|
||||
}
|
||||
}
|
||||
addToPane(pane, ImageComponent.LIBRARY, getImageLibraryPane());
|
||||
addToPane(pane, ImageComponent.UPLOAD, getImageUploadPane());
|
||||
pane.setDefaultPane(m_imageLibrary);
|
||||
|
||||
return pane;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the specified component, with the specified tab name, to the
|
||||
* tabbed pane only if it is not null.
|
||||
*
|
||||
* @param pane The pane to which to add the tab
|
||||
* @param tabName The name of the tab if it's added
|
||||
* @param comp The component to add to the pane
|
||||
*/
|
||||
protected void addToPane(final TabbedPane pane,
|
||||
final String tabName,
|
||||
final Component comp) {
|
||||
if (comp != null) {
|
||||
pane.addTab(GlobalizationUtil.globalize("cms.ui.image_" + tabName)
|
||||
.localize().toString(), comp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,91 +16,99 @@ import com.arsdigita.xml.Element;
|
|||
* A component which will insert a javascript to the xml output with the image
|
||||
* 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
|
||||
implements Resettable {
|
||||
implements Resettable {
|
||||
|
||||
boolean m_valid = false;
|
||||
ImageAsset m_image;
|
||||
String m_lastImageComponent;
|
||||
boolean m_valid = false;
|
||||
ImageAsset m_image;
|
||||
String m_lastImageComponent;
|
||||
|
||||
public ImageSelectResultComponent() {
|
||||
super();
|
||||
}
|
||||
public ImageSelectResultComponent() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Save image imformation
|
||||
*
|
||||
* @param image an {@link ImageAsset}
|
||||
*/
|
||||
public void setResult(final ImageAsset image, final String lastComponent) {
|
||||
m_image = image;
|
||||
m_lastImageComponent = lastComponent;
|
||||
m_valid = (m_image != null);
|
||||
}
|
||||
/**
|
||||
* Save image imformation
|
||||
*
|
||||
* @param image an {@link ImageAsset}
|
||||
*/
|
||||
public void setResult(final ImageAsset image, final String lastComponent) {
|
||||
m_image = image;
|
||||
m_lastImageComponent = lastComponent;
|
||||
m_valid = (m_image != null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void generateXML(PageState state, Element parent) {
|
||||
/**
|
||||
* 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
|
||||
public void generateXML(PageState state, Element parent) {
|
||||
|
||||
Element scriptElem = parent.newChildElement("script");
|
||||
scriptElem.addAttribute("type", "text/javascript");
|
||||
Element scriptElem = parent.newChildElement("script");
|
||||
scriptElem.addAttribute("type", "text/javascript");
|
||||
|
||||
StringBuilder script = new StringBuilder(1000);
|
||||
StringBuilder script = new StringBuilder(1000);
|
||||
|
||||
// Create funtion
|
||||
script.append("function selectImage(button) {");
|
||||
// Create function
|
||||
script.append("function selectImage(button) {");
|
||||
|
||||
// If there is a valid image
|
||||
if (m_valid) {
|
||||
// If there is a valid image
|
||||
if (m_valid) {
|
||||
|
||||
// If in library mode, only listen to save button
|
||||
if (m_lastImageComponent.equals(ImageComponent.LIBRARY)) {
|
||||
script.append("if(button.id != \"save\" ) { return false; } ");
|
||||
}
|
||||
// If in library mode, only listen to save button
|
||||
if (m_lastImageComponent.equals(ImageComponent.LIBRARY)) {
|
||||
script.append("if(button.id != \"save\" ) { return false; } ");
|
||||
}
|
||||
|
||||
// Send image parameters to xinha plugin
|
||||
script.append("window.opener.openCCM.imageSet({");
|
||||
script.append(" src : \"");
|
||||
script.append(URL.getDispatcherPath());
|
||||
script.append(Service.getImageURL(m_image));
|
||||
script.append("\", ");
|
||||
script.append(" name : \"");
|
||||
script.append(m_image.getDisplayName());
|
||||
script.append("\", ");
|
||||
script.append(" width : \"");
|
||||
script.append(m_image.getWidth());
|
||||
script.append("\", ");
|
||||
script.append(" height : \"");
|
||||
script.append(m_image.getHeight());
|
||||
script.append("\"");
|
||||
script.append("});");
|
||||
// Send image parameters to xinha plugin
|
||||
script.append("window.opener.openCCM.imageSet({");
|
||||
script.append(" src : \"");
|
||||
script.append(URL.getDispatcherPath());
|
||||
script.append(Service.getImageURL(m_image));
|
||||
script.append("\", ");
|
||||
script.append(" name : \"");
|
||||
script.append(m_image.getDisplayName());
|
||||
script.append("\", ");
|
||||
script.append(" width : \"");
|
||||
script.append(m_image.getWidth());
|
||||
script.append("\", ");
|
||||
script.append(" height : \"");
|
||||
script.append(m_image.getHeight());
|
||||
script.append("\"");
|
||||
script.append("});");
|
||||
|
||||
// Close window
|
||||
script.append("self.close();");
|
||||
// Close window
|
||||
script.append("self.close();");
|
||||
|
||||
}
|
||||
script.append("return false;");
|
||||
script.append("}");
|
||||
}
|
||||
script.append("return false;");
|
||||
script.append("}");
|
||||
|
||||
// If in upload mode and if there is a valid image, execute the
|
||||
// javascript function
|
||||
if (m_valid && ImageComponent.UPLOAD.equals(m_lastImageComponent)) {
|
||||
script.append("selectImage();");
|
||||
}
|
||||
// If in upload mode and if there is a valid image, execute the
|
||||
// javascript function
|
||||
if (m_valid && ImageComponent.UPLOAD.equals(m_lastImageComponent)) {
|
||||
script.append("selectImage();");
|
||||
}
|
||||
|
||||
scriptElem.setText(script.toString());
|
||||
scriptElem.setText(script.toString());
|
||||
|
||||
// Reset ImageSelectResultComponent
|
||||
reset(state);
|
||||
}
|
||||
// Reset ImageSelectResultComponent
|
||||
reset(state);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset this component.
|
||||
*
|
||||
* @param state Page state
|
||||
*/
|
||||
public void reset(PageState state) {
|
||||
setResult(null, null);
|
||||
}
|
||||
/**
|
||||
* Reset this component.
|
||||
*
|
||||
* @param state Page state
|
||||
*/
|
||||
@Override
|
||||
public void reset(PageState state) {
|
||||
setResult(null, null);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,64 +25,64 @@ import java.io.IOException;
|
|||
/**
|
||||
* An image upload component.
|
||||
*
|
||||
* This component can be used in different places to add image upload capabilities
|
||||
* in a convinient way. This class uses a listener class which should be extended
|
||||
* from {@link ImageComponentAbstractListener}.
|
||||
*
|
||||
* This component can be used in different places to add image upload
|
||||
* capabilities in a convinient way. This class uses a listener class which
|
||||
* should be extended from {@link ImageComponentAbstractListener}.
|
||||
*
|
||||
* @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 {
|
||||
|
||||
private final FileUploadSection m_imageFile;
|
||||
private final TextField m_caption;
|
||||
private final TextField m_title;
|
||||
private final TextArea m_description;
|
||||
private final TextField m_useContext;
|
||||
private final SaveCancelSection m_saveCancel;
|
||||
private int m_mode;
|
||||
private final FileUploadSection m_imageFile;
|
||||
private final TextField m_caption;
|
||||
private final TextField m_title;
|
||||
private final TextArea m_description;
|
||||
private final TextField m_useContext;
|
||||
private final SaveCancelSection m_saveCancel;
|
||||
private int m_mode;
|
||||
|
||||
/**
|
||||
* Creates an ImageUploadComponent in attach mode.
|
||||
*/
|
||||
public ImageUploadComponent() {
|
||||
this(ImageComponent.ATTACH_IMAGE);
|
||||
}
|
||||
/**
|
||||
* Creates an ImageUploadComponent in attach mode.
|
||||
*/
|
||||
public ImageUploadComponent() {
|
||||
this(ImageComponent.ATTACH_IMAGE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an ImageUploadComponent with the selected mode.
|
||||
*
|
||||
* @param mode The operation mode (see {@link ImageComponent)
|
||||
*/
|
||||
public ImageUploadComponent(int mode) {
|
||||
super("imageUploadComponent", new ColumnPanel(2));
|
||||
m_mode = mode;
|
||||
setEncType("multipart/form-data");
|
||||
m_imageFile = new FileUploadSection(GlobalizationUtil.globalize(
|
||||
"cms.contentasset.image.ui.type"),
|
||||
"image",
|
||||
ImageAsset.MIME_JPEG);
|
||||
m_imageFile.getFileUploadWidget()
|
||||
.addValidationListener(new NotNullValidationListener());
|
||||
add(m_imageFile, ColumnPanel.FULL_WIDTH);
|
||||
/**
|
||||
* Creates an ImageUploadComponent with the selected mode.
|
||||
*
|
||||
* @param mode The operation mode (see {@link ImageComponent)
|
||||
*/
|
||||
public ImageUploadComponent(int mode) {
|
||||
super("imageUploadComponent", new ColumnPanel(2));
|
||||
m_mode = mode;
|
||||
setEncType("multipart/form-data");
|
||||
m_imageFile = new FileUploadSection(GlobalizationUtil.globalize(
|
||||
"cms.contentasset.image.ui.type"),
|
||||
"image",
|
||||
ImageAsset.MIME_JPEG);
|
||||
m_imageFile.getFileUploadWidget()
|
||||
.addValidationListener(new NotNullValidationListener());
|
||||
add(m_imageFile, ColumnPanel.FULL_WIDTH);
|
||||
|
||||
// Initialize all widgets
|
||||
m_caption = new TextField("caption");
|
||||
m_title = new TextField("title");
|
||||
m_description = new TextArea("description");
|
||||
m_useContext = new TextField("useContext");
|
||||
// Initialize all widgets
|
||||
m_caption = new TextField("caption");
|
||||
m_title = new TextField("title");
|
||||
m_description = new TextArea("description");
|
||||
m_useContext = new TextField("useContext");
|
||||
|
||||
// add widget only if we are in attach mode
|
||||
if (m_mode == ImageComponent.ATTACH_IMAGE) {
|
||||
add(new Label(GlobalizationUtil
|
||||
.globalize("cms.contentasset.image.ui.caption")));
|
||||
m_caption.addValidationListener(new NotNullValidationListener());
|
||||
m_caption.addValidationListener(new StringLengthValidationListener(40));
|
||||
m_caption.setSize(40);
|
||||
add(m_caption);
|
||||
// add widget only if we are in attach mode
|
||||
if (m_mode == ImageComponent.ATTACH_IMAGE) {
|
||||
add(new Label(GlobalizationUtil
|
||||
.globalize("cms.contentasset.image.ui.caption")));
|
||||
m_caption.addValidationListener(new NotNullValidationListener());
|
||||
m_caption.addValidationListener(new StringLengthValidationListener(40));
|
||||
m_caption.setSize(40);
|
||||
add(m_caption);
|
||||
|
||||
// We only show the title and description fields in the case where
|
||||
// getIsImageStepDescriptionAndTitleShown is false.
|
||||
// We only show the title and description fields in the case where
|
||||
// getIsImageStepDescriptionAndTitleShown is false.
|
||||
|
||||
// if (ItemImageAttachment.getConfig().getIsImageStepDescriptionAndTitleShown()) {
|
||||
// add(new Label("Title"));
|
||||
|
|
@ -100,68 +100,78 @@ public class ImageUploadComponent extends Form implements ImageComponent {
|
|||
//
|
||||
// }
|
||||
|
||||
add(new Label(GlobalizationUtil
|
||||
.globalize("cms.contentasset.image.ui.use_context")));
|
||||
m_useContext.setSize(40);
|
||||
add(m_useContext);
|
||||
}
|
||||
m_saveCancel = new SaveCancelSection();
|
||||
add(m_saveCancel);
|
||||
add(new Label(GlobalizationUtil
|
||||
.globalize("cms.contentasset.image.ui.use_context")));
|
||||
m_useContext.setSize(40);
|
||||
add(m_useContext);
|
||||
}
|
||||
m_saveCancel = new SaveCancelSection();
|
||||
add(m_saveCancel);
|
||||
|
||||
/*
|
||||
* Removed by Quasimodo: Changed editing workflow, so that library comes
|
||||
* 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
|
||||
* isn't fatal but confusing. ActionLink library = new ActionLink(
|
||||
* "Select an existing image" ); library.addActionListener( new
|
||||
* ActionListener() { public void actionPerformed( ActionEvent ev ) {
|
||||
* setImageComponent( ev.getPageState(), LIBRARY ); } } ); add( library,
|
||||
* ColumnPanel.FULL_WIDTH );
|
||||
*/
|
||||
}
|
||||
/*
|
||||
* Removed by Quasimodo: Changed editing workflow, so that library comes
|
||||
* 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
|
||||
* isn't fatal but confusing.
|
||||
*
|
||||
* ActionLink library = new ActionLink("Select an existing image" );
|
||||
* library.addActionListener( new ActionListener() {
|
||||
* public void actionPerformed( ActionEvent ev ) {
|
||||
* setImageComponent( ev.getPageState(), LIBRARY );
|
||||
* }
|
||||
* } );
|
||||
* add( library, ColumnPanel.FULL_WIDTH );
|
||||
*/
|
||||
}
|
||||
|
||||
public SaveCancelSection getSaveCancelSection() {
|
||||
return m_saveCancel;
|
||||
}
|
||||
@Override
|
||||
public SaveCancelSection getSaveCancelSection() {
|
||||
return m_saveCancel;
|
||||
}
|
||||
|
||||
public ReusableImageAsset getImage(FormSectionEvent event)
|
||||
throws FormProcessException {
|
||||
PageState ps = event.getPageState();
|
||||
String filename = (String) m_imageFile.getFileName(event);
|
||||
File imageFile = m_imageFile.getFile(event);
|
||||
try {
|
||||
ReusableImageAsset image = new ReusableImageAsset();
|
||||
image.loadFromFile(filename, imageFile, ImageAsset.MIME_JPEG);
|
||||
@Override
|
||||
public ReusableImageAsset getImage(FormSectionEvent event)
|
||||
throws FormProcessException {
|
||||
PageState ps = event.getPageState();
|
||||
String filename = (String) m_imageFile.getFileName(event);
|
||||
File imageFile = m_imageFile.getFile(event);
|
||||
try {
|
||||
ReusableImageAsset image = new ReusableImageAsset();
|
||||
image.loadFromFile(filename, imageFile, ImageAsset.MIME_JPEG);
|
||||
// image.setDescription((String) m_caption.getValue(ps));
|
||||
return image;
|
||||
} catch (IOException ex) {
|
||||
ImagesPane.S_LOG.error("Error loading image from file", ex);
|
||||
throw new FormProcessException(ex.getMessage());
|
||||
}
|
||||
}
|
||||
return image;
|
||||
} catch (IOException ex) {
|
||||
ImagesPane.S_LOG.error("Error loading image from file", ex);
|
||||
throw new FormProcessException(ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public String getCaption(FormSectionEvent event) {
|
||||
PageState ps = event.getPageState();
|
||||
return (String) m_caption.getValue(ps);
|
||||
}
|
||||
@Override
|
||||
public String getCaption(FormSectionEvent event) {
|
||||
PageState ps = event.getPageState();
|
||||
return (String) m_caption.getValue(ps);
|
||||
}
|
||||
|
||||
public String getDescription(FormSectionEvent event) {
|
||||
PageState ps = event.getPageState();
|
||||
return (String) m_description.getValue(ps);
|
||||
}
|
||||
@Override
|
||||
public String getDescription(FormSectionEvent event) {
|
||||
PageState ps = event.getPageState();
|
||||
return (String) m_description.getValue(ps);
|
||||
}
|
||||
|
||||
public String getTitle(FormSectionEvent event) {
|
||||
PageState ps = event.getPageState();
|
||||
return (String) m_title.getValue(ps);
|
||||
}
|
||||
@Override
|
||||
public String getTitle(FormSectionEvent event) {
|
||||
PageState ps = event.getPageState();
|
||||
return (String) m_title.getValue(ps);
|
||||
}
|
||||
|
||||
public String getUseContext(FormSectionEvent event) {
|
||||
PageState ps = event.getPageState();
|
||||
return (String) m_useContext.getValue(ps);
|
||||
}
|
||||
|
||||
public Form getForm() {
|
||||
return this;
|
||||
}
|
||||
@Override
|
||||
public String getUseContext(FormSectionEvent event) {
|
||||
PageState ps = event.getPageState();
|
||||
return (String) m_useContext.getValue(ps);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Form getForm() {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ import org.apache.log4j.Logger;
|
|||
/**
|
||||
* 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 {
|
||||
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
*/
|
||||
class ItemSearchCreateItemPane extends CMSContainer
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ import javax.servlet.http.HttpServletResponse;
|
|||
* <p>The Item Search page.</p>
|
||||
*
|
||||
* @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)
|
||||
*/
|
||||
public class ItemSearchPage extends CMSPage {
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ import org.apache.log4j.Logger;
|
|||
* Edits a single category.
|
||||
*
|
||||
* @author Justin Ross <jross@redhat.com>
|
||||
* @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 $
|
||||
*/
|
||||
class CategoryItemPane extends BaseItemPane {
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ import org.apache.log4j.Logger;
|
|||
* 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.
|
||||
*
|
||||
* @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 $
|
||||
*/
|
||||
public class CategoryLocalizationAddForm extends CategoryLocalizationForm {
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ import org.apache.log4j.Logger;
|
|||
* 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.
|
||||
*
|
||||
* @author Sören Bernstein (quasimodo) quasi@zes.uni-bremen.de
|
||||
* @author Sören Bernstein <quasi@quasiweb.de>
|
||||
* @version $Id: CategoryLocalizationEditForm.java $
|
||||
*/
|
||||
public class CategoryLocalizationEditForm extends CategoryLocalizationForm {
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ import com.arsdigita.xml.Element;
|
|||
* 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.
|
||||
*
|
||||
* @author Sören Bernstein (quasimodo) quasi@zes.uni-bremen.de
|
||||
* @author Sören Bernstein <quasi@quasiweb.de>
|
||||
* @version $Id: $
|
||||
*/
|
||||
public class CategoryLocalizationForm extends BaseForm {
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ import java.util.Locale;
|
|||
* 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.
|
||||
*
|
||||
* @author Sören Bernstein (quasimodo) quasi@zes.uni-bremen.de
|
||||
* @author Sören Bernstein <quasi@quasiweb.de>
|
||||
*/
|
||||
public class CategoryLocalizationTable extends Table implements TableActionListener {
|
||||
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
* @version $Id$
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ import javax.servlet.ServletException;
|
|||
* item selection model is updated.
|
||||
*
|
||||
* @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 $
|
||||
*/
|
||||
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
|
||||
* existing language version and the live status in the folder browser.
|
||||
|
|
|
|||
|
|
@ -82,6 +82,7 @@ public class BaseRoleForm extends BaseForm {
|
|||
}
|
||||
|
||||
private class PrivilegePrinter implements PrintListener {
|
||||
@Override
|
||||
public final void prepare(final PrintEvent e) {
|
||||
final CheckboxGroup target = (CheckboxGroup) e.getTarget();
|
||||
final PageState state = e.getPageState();
|
||||
|
|
@ -107,6 +108,7 @@ public class BaseRoleForm extends BaseForm {
|
|||
m_role = role;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void validate(final ParameterEvent e)
|
||||
throws FormProcessException {
|
||||
final PageState state = e.getPageState();
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ import java.util.List;
|
|||
* search query engine.
|
||||
*
|
||||
* @author unknown
|
||||
* @author Sören Bernstein (sbernstein@quasiweb.de)
|
||||
* @author Sören Bernstein <quasi@quasiweb.de>
|
||||
* @author Jens Pelzetter (jens@jp-digital.de)
|
||||
*/
|
||||
public class ItemQueryComponent extends BaseQueryComponent {
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ import org.apache.log4j.Logger;
|
|||
|
||||
/**
|
||||
* @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 $
|
||||
*/
|
||||
public final class AssignedTaskSection extends Section {
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ import java.util.StringTokenizer;
|
|||
* Utility methods for dealing with the multilingual items.
|
||||
*
|
||||
* @author Shashin Shinde (sshinde@redhat.com)
|
||||
* @author Sören Bernstein
|
||||
* @author Sören Bernstein <quasi@quasiweb.de>
|
||||
*/
|
||||
public class LanguageUtil {
|
||||
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -26,7 +26,7 @@ import com.arsdigita.bebop.util.GlobalizationUtil;
|
|||
* the right.
|
||||
*
|
||||
* @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 $
|
||||
*/
|
||||
public class SaveCancelSection extends FormSection {
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ import java.util.Locale;
|
|||
* @author Karl Goldstein
|
||||
* @author Uday Mathur
|
||||
* @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 $
|
||||
*/
|
||||
public class Date extends Widget implements BebopConstants {
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ import com.arsdigita.xml.Element;
|
|||
* A class representing a date and time field in an HTML form.
|
||||
* (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 $
|
||||
*/
|
||||
public class DateTime extends Widget implements BebopConstants {
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ import java.util.Locale;
|
|||
*
|
||||
* @see com.arsdigita.bebop.form.DateTime
|
||||
* @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 $
|
||||
*/
|
||||
public class Time extends Widget implements BebopConstants {
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ import javax.servlet.http.HttpServletRequest;
|
|||
* combination with an additional Boolean DB field to keep track
|
||||
* of the incomplete entry.
|
||||
*
|
||||
* @author Sören Bernstein
|
||||
* @author Sören Bernstein <quasi@quasiweb.de>
|
||||
*/
|
||||
public class IncompleteDateParameter extends DateParameter {
|
||||
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ import org.apache.log4j.Logger;
|
|||
/**
|
||||
* 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 $
|
||||
*/
|
||||
public final class CategorizationConfig extends AbstractConfig {
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ import com.arsdigita.persistence.DataCollection;
|
|||
* Category} and other classes. See, for example, {@link Category#getChildren()}
|
||||
* 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 {
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ import javax.servlet.http.HttpSession;
|
|||
|
||||
/**
|
||||
*
|
||||
* @author Sören Bernstein
|
||||
* @author Sören Bernstein <quasi@quasiweb.de>
|
||||
*/
|
||||
public class GlobalizationHelper {
|
||||
|
||||
|
|
|
|||
|
|
@ -193,6 +193,7 @@ public class PermissionManager {
|
|||
// to know that there is an assertion in the save() method in
|
||||
// the Permission class.
|
||||
new KernelExcursion() {
|
||||
@Override
|
||||
public void excurse() {
|
||||
setEffectiveParty(Kernel.getSystemParty());
|
||||
p.save();
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -42,7 +42,7 @@ import java.util.Locale;
|
|||
* Effect will be visible in Mandalay beginning with r163.
|
||||
*
|
||||
* @author unknown...
|
||||
* @author Sören Bernstein (quasimodo) <sbernstein@zes.uni-bremen.de>
|
||||
* @author Sören Bernstein <quasi@quasiweb.de>
|
||||
*/
|
||||
public class DateRangeFilterWidget extends FilterWidget {
|
||||
|
||||
|
|
|
|||
|
|
@ -56,15 +56,15 @@ interface AdminConstants {
|
|||
|
||||
/** Administration main tab names. */
|
||||
Label USER_TAB_TITLE = new Label
|
||||
(new GlobalizedMessage("ui.admin.tab.user.title",
|
||||
(new GlobalizedMessage("ui.admin.tab.user",
|
||||
BUNDLE_NAME));
|
||||
|
||||
Label GROUP_TAB_TITLE = new Label
|
||||
(new GlobalizedMessage("ui.admin.tab.group.title",
|
||||
(new GlobalizedMessage("ui.admin.tab.group",
|
||||
BUNDLE_NAME));
|
||||
|
||||
Label APPLICATIONS_TAB_TITLE = new Label
|
||||
(new GlobalizedMessage("ui.admin.tab.applications.title",
|
||||
(new GlobalizedMessage("ui.admin.tab.applications",
|
||||
BUNDLE_NAME));
|
||||
|
||||
Label INFO_TAB_TITLE = new Label(new GlobalizedMessage("ui.admin.tab.info.title", BUNDLE_NAME));
|
||||
|
|
|
|||
|
|
@ -34,13 +34,13 @@ ui.admin.nav.logout=Log out
|
|||
ui.admin.nav.workspace=Workspace
|
||||
ui.admin.searchAndList.submit=Search
|
||||
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.createuser=Create new user
|
||||
ui.admin.tab.user.navbartitle=User Administration
|
||||
ui.admin.tab.user.search=Search
|
||||
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.delete.failed.header=Unable to delete user
|
||||
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.question=Question:
|
||||
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.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.
|
||||
|
|
|
|||
|
|
@ -34,13 +34,13 @@ ui.admin.nav.logout=Abmelden
|
|||
ui.admin.nav.workspace=Workspace
|
||||
ui.admin.searchAndList.submit=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.createuser=Neuen Benutzer erstellen
|
||||
ui.admin.tab.user.navbartitle=Benutzerverwaltung
|
||||
ui.admin.tab.user.search=Suche
|
||||
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.delete.failed.header=Benutzer kann nicht gel\u00f6scht werden
|
||||
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.question=Frage\:
|
||||
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.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
|
||||
|
|
|
|||
|
|
@ -34,13 +34,13 @@ ui.admin.nav.logout=Log out
|
|||
ui.admin.nav.workspace=Workspace
|
||||
ui.admin.searchAndList.submit=Search
|
||||
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.createuser=Create new user
|
||||
ui.admin.tab.user.navbartitle=User Administration
|
||||
ui.admin.tab.user.search=Search
|
||||
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.delete.failed.header=Unable to delete user
|
||||
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.question=Question:
|
||||
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.url.validation.not_blank=
|
||||
ui.admin.applications.url.valiation.minmaxlength=
|
||||
|
|
|
|||
|
|
@ -25,13 +25,13 @@ ui.admin.nav.logout=D\u00e9connexion
|
|||
ui.admin.nav.workspace=Espace de travail
|
||||
ui.admin.searchAndList.submit=Rechercher
|
||||
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.createuser=Cr\u00e9er un nouvel utilisateur
|
||||
ui.admin.tab.user.navbartitle=Gestion de l'utilisateur
|
||||
ui.admin.tab.user.search=Rechercher
|
||||
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.delete.failed.header=Impossible de supprimer l'utiisateur
|
||||
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.question=Question:
|
||||
ui.admin.user.userpasswordform.submit=Changer
|
||||
ui.admin.tab.applications.title=
|
||||
ui.admin.tab.applications=
|
||||
ui.admin.applications.tree.heading=
|
||||
ui.admin.applications.url.validation.not_blank=
|
||||
ui.admin.applications.url.valiation.minmaxlength=
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
||||
|
|
|
|||
|
|
@ -56,6 +56,7 @@ public class ConfigParameterList extends SimpleContainer {
|
|||
XML_NS);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void generateXML(PageState state,
|
||||
Element parent) {
|
||||
Element content = generateParent(parent);
|
||||
|
|
@ -117,6 +118,7 @@ public class ConfigParameterList extends SimpleContainer {
|
|||
p.addAttribute("isRequired", XML.format(new Boolean(param.isRequired())));
|
||||
|
||||
param.write(new ParameterWriter() {
|
||||
@Override
|
||||
public void write(Parameter param, String value) {
|
||||
if (value != null) {
|
||||
p.addAttribute("value", value);
|
||||
|
|
@ -152,6 +154,7 @@ public class ConfigParameterList extends SimpleContainer {
|
|||
m_contexts = contexts;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startElement(String uri, String localName, String qn,
|
||||
Attributes attrs) {
|
||||
if (localName.equals("config")) {
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ import java.text.DateFormat;
|
|||
* is ommitted.
|
||||
*
|
||||
* @author unkknown
|
||||
* @author Sören Bernstein
|
||||
* @author Sören Bernstein <quasi@quasiweb.de>
|
||||
*/
|
||||
public class DateFormatter implements Formatter {
|
||||
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ import java.text.DateFormat;
|
|||
* 'medium' format and the time in 'short' format.
|
||||
*
|
||||
* @author unknown
|
||||
* @author Sören Bernstein
|
||||
* @author Sören Bernstein <quasi@quasiweb.de>
|
||||
*/
|
||||
public class DateTimeFormatter implements Formatter {
|
||||
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ import java.text.DateFormat;
|
|||
* is ommitted.
|
||||
*
|
||||
* @author unknown
|
||||
* @author Sören Bernstein
|
||||
* @author Sören Bernstein <quasi@quasiweb.de>
|
||||
*/
|
||||
public class TimeFormatter implements Formatter {
|
||||
|
||||
|
|
|
|||
|
|
@ -27,172 +27,213 @@ import org.apache.log4j.Logger;
|
|||
* Cursor
|
||||
*
|
||||
* @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 $
|
||||
**/
|
||||
|
||||
*
|
||||
*/
|
||||
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;
|
||||
private RecordSet m_rs = null;
|
||||
private Map m_values = null;
|
||||
private long m_position = 0;
|
||||
private boolean m_closed = false;
|
||||
private Map m_options = new HashMap();
|
||||
|
||||
final private DataSet m_ds;
|
||||
protected Cursor(DataSet ds) {
|
||||
m_ds = ds;
|
||||
}
|
||||
|
||||
private RecordSet m_rs = null;
|
||||
private Map m_values = null;
|
||||
private long m_position = 0;
|
||||
private boolean m_closed = false;
|
||||
private Map m_options = new HashMap();
|
||||
public void setOptions(Map options) {
|
||||
m_options.clear();
|
||||
m_options.putAll(options);
|
||||
}
|
||||
|
||||
protected Cursor(DataSet ds) {
|
||||
m_ds = ds;
|
||||
}
|
||||
public DataSet getDataSet() {
|
||||
return m_ds;
|
||||
}
|
||||
|
||||
public void setOptions(Map options) {
|
||||
m_options.clear();
|
||||
m_options.putAll(options);
|
||||
}
|
||||
public Session getSession() {
|
||||
return m_ds.getSession();
|
||||
}
|
||||
|
||||
public DataSet getDataSet() {
|
||||
return m_ds;
|
||||
}
|
||||
public boolean isClosed() {
|
||||
return m_closed;
|
||||
}
|
||||
|
||||
public Session getSession() {
|
||||
return m_ds.getSession();
|
||||
}
|
||||
private Object getInternal(Path path) {
|
||||
if (m_values.containsKey(path)) {
|
||||
return m_values.get(path);
|
||||
} else {
|
||||
Object o = getInternal(path.getParent());
|
||||
if (o == null) {
|
||||
return null;
|
||||
}
|
||||
return getSession().get(o, Path.get(path.getName()));
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isClosed() {
|
||||
return m_closed;
|
||||
}
|
||||
public Object get(Path path) {
|
||||
if (m_closed) {
|
||||
throw new ClosedException(this);
|
||||
}
|
||||
|
||||
private Object getInternal(Path path) {
|
||||
if (m_values.containsKey(path)) {
|
||||
return m_values.get(path);
|
||||
} else {
|
||||
Object o = getInternal(path.getParent());
|
||||
if (o == null) { return null; }
|
||||
return getSession().get(o, Path.get(path.getName()));
|
||||
}
|
||||
}
|
||||
if (m_position <= 0) {
|
||||
throw new NoRowException(this);
|
||||
}
|
||||
|
||||
public Object get(Path path) {
|
||||
if (m_closed) {
|
||||
throw new ClosedException(this);
|
||||
}
|
||||
if (!m_rs.isFetched(path)) {
|
||||
if (s_log.isDebugEnabled()) {
|
||||
s_log.debug("path " + path + " is not fetched"
|
||||
+ " in signature " + m_ds.getSignature());
|
||||
}
|
||||
throw new NotFetchedException(this, path);
|
||||
}
|
||||
|
||||
if (m_position <= 0) {
|
||||
throw new NoRowException(this);
|
||||
}
|
||||
return getInternal(path);
|
||||
}
|
||||
|
||||
if (!m_rs.isFetched(path)) {
|
||||
if (s_log.isDebugEnabled()) {
|
||||
s_log.debug("path " + path + " is not fetched"
|
||||
+ " in signature " + m_ds.getSignature());
|
||||
}
|
||||
throw new NotFetchedException(this, path);
|
||||
}
|
||||
public Object get(String path) {
|
||||
if (m_closed) {
|
||||
throw new ClosedException(this);
|
||||
}
|
||||
|
||||
return getInternal(path);
|
||||
}
|
||||
return get(Path.get(path));
|
||||
}
|
||||
|
||||
public Object get(String path) {
|
||||
if (m_closed) {
|
||||
throw new ClosedException(this);
|
||||
}
|
||||
public Object get() {
|
||||
if (m_closed) {
|
||||
throw new ClosedException(this);
|
||||
}
|
||||
|
||||
return get(Path.get(path));
|
||||
}
|
||||
return m_values.get(null);
|
||||
}
|
||||
|
||||
public Object get() {
|
||||
if (m_closed) {
|
||||
throw new ClosedException(this);
|
||||
}
|
||||
public boolean next() {
|
||||
if (m_closed) {
|
||||
throw new ClosedException(this);
|
||||
}
|
||||
|
||||
return m_values.get(null);
|
||||
}
|
||||
if (m_position == -1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean next() {
|
||||
if (m_closed) {
|
||||
throw new ClosedException(this);
|
||||
}
|
||||
if (m_rs == null) {
|
||||
getSession().flush();
|
||||
m_rs = execute();
|
||||
}
|
||||
|
||||
if (m_position == -1) {
|
||||
return false;
|
||||
}
|
||||
if (m_rs.next()) {
|
||||
m_values = m_rs.load(getSession());
|
||||
|
||||
if (m_rs == null) {
|
||||
getSession().flush();
|
||||
m_rs = execute();
|
||||
}
|
||||
m_position++;
|
||||
return true;
|
||||
} else {
|
||||
m_position = -1;
|
||||
free();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (m_rs.next()) {
|
||||
m_values = m_rs.load(getSession());
|
||||
protected RecordSet execute() {
|
||||
return getSession().getEngine().execute(m_ds.getSignature(),
|
||||
m_ds.getExpression(),
|
||||
m_options);
|
||||
}
|
||||
|
||||
m_position++;
|
||||
return true;
|
||||
} else {
|
||||
m_position = -1;
|
||||
free();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
public boolean isBeforeFirst() {
|
||||
if (m_closed) {
|
||||
throw new ClosedException(this);
|
||||
}
|
||||
|
||||
protected RecordSet execute() {
|
||||
return getSession().getEngine().execute(m_ds.getSignature(),
|
||||
m_ds.getExpression(),
|
||||
m_options);
|
||||
}
|
||||
return m_position == 0;
|
||||
}
|
||||
|
||||
public boolean isBeforeFirst() {
|
||||
if (m_closed) {
|
||||
throw new ClosedException(this);
|
||||
}
|
||||
public boolean isFirst() {
|
||||
if (m_closed) {
|
||||
throw new ClosedException(this);
|
||||
}
|
||||
|
||||
return m_position == 0;
|
||||
}
|
||||
return m_position == 1;
|
||||
}
|
||||
|
||||
public boolean isFirst() {
|
||||
if (m_closed) {
|
||||
throw new ClosedException(this);
|
||||
}
|
||||
public boolean isAfterLast() {
|
||||
if (m_closed) {
|
||||
throw new ClosedException(this);
|
||||
}
|
||||
|
||||
return m_position == 1;
|
||||
}
|
||||
return m_position == -1;
|
||||
}
|
||||
|
||||
public boolean isAfterLast() {
|
||||
if (m_closed) {
|
||||
throw new ClosedException(this);
|
||||
}
|
||||
public long getPosition() {
|
||||
if (m_closed) {
|
||||
throw new ClosedException(this);
|
||||
}
|
||||
|
||||
return m_position == -1;
|
||||
}
|
||||
if (m_position > 0) {
|
||||
return m_position;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public long getPosition() {
|
||||
if (m_closed) {
|
||||
throw new ClosedException(this);
|
||||
}
|
||||
public void rewind() {
|
||||
close();
|
||||
m_position = 0;
|
||||
m_closed = false;
|
||||
}
|
||||
|
||||
if (m_position > 0) {
|
||||
return m_position;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
private void free() {
|
||||
if (m_rs != null) {
|
||||
m_rs.close();
|
||||
m_rs = null;
|
||||
}
|
||||
}
|
||||
|
||||
public void rewind() {
|
||||
close();
|
||||
m_position = 0;
|
||||
m_closed = false;
|
||||
}
|
||||
public void close() {
|
||||
free();
|
||||
m_closed = true;
|
||||
}
|
||||
|
||||
private void free() {
|
||||
if (m_rs != null) {
|
||||
m_rs.close();
|
||||
m_rs = null;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 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);
|
||||
}
|
||||
|
||||
public void close() {
|
||||
free();
|
||||
m_closed = true;
|
||||
}
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue