* 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,6 +89,17 @@ public class ItemImageAttachment extends ACSObject implements CustomCopy {
|
|||
set(IMAGE, image);
|
||||
}
|
||||
|
||||
/**
|
||||
* Before saving this object, make sure SORTKEY is set
|
||||
*/
|
||||
@Override
|
||||
protected void beforeSave() {
|
||||
if(isNew() || getSortKey() == null || getSortKey() == 0) {
|
||||
setSortKey(getNextSortKey(getItem()));
|
||||
}
|
||||
super.beforeSave();
|
||||
}
|
||||
|
||||
public static ItemImageAttachment retrieve(OID oid) {
|
||||
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,9 +186,23 @@ 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) {
|
||||
|
|
@ -214,4 +252,15 @@ public class ItemImageAttachment extends ACSObject implements CustomCopy {
|
|||
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 {
|
||||
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ import org.apache.log4j.Logger;
|
|||
* content item.
|
||||
*
|
||||
* @author unknown
|
||||
* @author Sören Bernstein (quasimodo) <sbernstein@quasiweb.de>
|
||||
* @author Sören Bernstein <quasi@quasiweb.de>
|
||||
*/
|
||||
public class ImageStep extends SecurityPropertyEditor {
|
||||
|
||||
|
|
@ -58,8 +58,9 @@ public class ImageStep extends SecurityPropertyEditor {
|
|||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param itemModel
|
||||
* @param parent
|
||||
* @param itemModel The {@link ItemSelectionModel} to use with this
|
||||
* instance
|
||||
* @param parent The parent {@link AuthoringKitWizard}
|
||||
*/
|
||||
public ImageStep(ItemSelectionModel itemModel,
|
||||
AuthoringKitWizard parent) {
|
||||
|
|
@ -95,11 +96,11 @@ public class ImageStep extends SecurityPropertyEditor {
|
|||
}
|
||||
|
||||
m_parent.getList().addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent event) {
|
||||
PageState state = event.getPageState();
|
||||
showDisplayPane(state);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -151,9 +152,9 @@ public class ImageStep extends SecurityPropertyEditor {
|
|||
|
||||
return DomainObjectFactory.newInstance(oid);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
@Override
|
||||
public Object getSelectedKey(PageState ps) {
|
||||
OID oid = (OID) ps.getValue(m_attachmentOID);
|
||||
if (null == oid) {
|
||||
|
|
@ -163,6 +164,7 @@ public class ImageStep extends SecurityPropertyEditor {
|
|||
return oid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSelectedKey(PageState ps, Object oid) {
|
||||
m_attachment.set(ps, null);
|
||||
ps.setValue(m_attachmentOID, oid);
|
||||
|
|
@ -178,10 +180,10 @@ public class ImageStep extends SecurityPropertyEditor {
|
|||
m_attachment.set(ps, attachment);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ParameterModel getStateParameter() {
|
||||
return m_attachmentOID;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -196,5 +198,4 @@ public class ImageStep extends SecurityPropertyEditor {
|
|||
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,37 +32,50 @@ 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);
|
||||
|
||||
/** Represents invoking parent component */
|
||||
/**
|
||||
* Represents invoking parent component
|
||||
*/
|
||||
private final ImageStep m_imageStep;
|
||||
|
||||
/** Name of the delete event */
|
||||
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";
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
|
|
@ -80,21 +92,24 @@ public class ImageStepDisplay extends SimpleContainer {
|
|||
"cms.contentassets.ui.image_step.no_image_attached"));
|
||||
mainLabel.setFontWeight(Label.ITALIC);
|
||||
|
||||
List imageList = new List( new ImageListModelBuilder() ) {
|
||||
m_listModelBuilder = new ImageListModelBuilder();
|
||||
List imageList = new List(m_listModelBuilder) {
|
||||
@Override
|
||||
public void respond(PageState ps) throws ServletException {
|
||||
if (DELETE.equals(ps.getControlEventName())) {
|
||||
String attachment = ps.getControlEventValue();
|
||||
|
||||
OID oid = OID.valueOf( attachment );
|
||||
DomainObjectFactory.newInstance( oid ).delete();
|
||||
}
|
||||
|
||||
else {
|
||||
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);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
imageList.setCellRenderer(new ImageListCellRenderer());
|
||||
imageList.setEmptyView(mainLabel);
|
||||
|
||||
|
|
@ -106,28 +121,36 @@ public class ImageStepDisplay extends SimpleContainer {
|
|||
*/
|
||||
private class ImageListModelBuilder extends LockableImpl
|
||||
implements ListModelBuilder {
|
||||
|
||||
private ImageListModel m_listModel;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param list
|
||||
* @param ps
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
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 );
|
||||
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;
|
||||
}
|
||||
|
||||
return new ImageListModel( attachments );
|
||||
protected ImageListModel getModel() {
|
||||
return m_listModel;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -142,18 +165,133 @@ public class ImageStepDisplay extends SimpleContainer {
|
|||
m_attachments = attachments;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getElement() {
|
||||
return DomainObjectFactory.newInstance
|
||||
( m_attachments.getDataObject() );
|
||||
return DomainObjectFactory.newInstance(m_attachments.getDataObject());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getKey() {
|
||||
return m_attachments.getDataObject().getOID().toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean next() {
|
||||
return m_attachments.next();
|
||||
}
|
||||
|
||||
public boolean isFirst() {
|
||||
return m_attachments.isFirst();
|
||||
}
|
||||
|
||||
public boolean isLast() {
|
||||
return m_attachments.isLast();
|
||||
}
|
||||
|
||||
/**
|
||||
* Move an image's position inside the list.
|
||||
*
|
||||
* @param oid {@link OID} of the image to move
|
||||
* @param move position steps (positive or negative) to move
|
||||
* @param ps Current {@link PageState}
|
||||
*/
|
||||
protected void move(OID oid, int move, PageState ps) {
|
||||
// Get the current ContentItem
|
||||
ContentItem item = m_imageStep.getItem(ps);
|
||||
// Get the collection of attached images
|
||||
DataCollection attachments = ItemImageAttachment.getImageAttachments(item);
|
||||
|
||||
// Always need an oid of the image to move
|
||||
if (oid == null) {
|
||||
throw new IllegalArgumentException("OID must not be null");
|
||||
}
|
||||
|
||||
// No move, nothing to do
|
||||
if (move == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Find the image in the collection
|
||||
while (attachments.next()) {
|
||||
if (attachments.getDataObject().getOID().equals(oid)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Throw an {@link IllegalArgumentxception} if the oid was not found
|
||||
if (!attachments.getDataObject().getOID().equals(oid)) {
|
||||
throw new IllegalArgumentException("OID " + oid + " is not in collection");
|
||||
}
|
||||
|
||||
// Get the image to move and test if it is really an ItemImageAttachment
|
||||
DomainObject sortDomainObject = DomainObjectFactory.newInstance(attachments.getDataObject());
|
||||
if (sortDomainObject instanceof ItemImageAttachment) {
|
||||
|
||||
// Change the sortKey of the ItemImageAttachment to the desired
|
||||
// value but respect bounds of the current list
|
||||
int newSortKey = Math.max(1,
|
||||
Math.min((int) attachments.size(),
|
||||
((ItemImageAttachment) sortDomainObject).getSortKey() + move));
|
||||
((ItemImageAttachment) sortDomainObject).setSortKey(newSortKey);
|
||||
((ItemImageAttachment) sortDomainObject).save();
|
||||
|
||||
// Now, move all the object between the original position and the
|
||||
// new postition one step in the nessecary direction
|
||||
if (move < 0) {
|
||||
while (attachments.previous() && move < 0) {
|
||||
DomainObject domainObject = DomainObjectFactory.newInstance(attachments.getDataObject());
|
||||
if (domainObject instanceof ItemImageAttachment) {
|
||||
((ItemImageAttachment) domainObject).setSortKey(
|
||||
((ItemImageAttachment) domainObject).getSortKey() + 1);
|
||||
((ItemImageAttachment) domainObject).save();
|
||||
move++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (move > 0) {
|
||||
while (attachments.next() && move > 0) {
|
||||
DomainObject domainObject = DomainObjectFactory.newInstance(attachments.getDataObject());
|
||||
if (domainObject instanceof ItemImageAttachment) {
|
||||
((ItemImageAttachment) domainObject).setSortKey(
|
||||
((ItemImageAttachment) domainObject).getSortKey() - 1);
|
||||
((ItemImageAttachment) domainObject).save();
|
||||
move--;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// close the collection manually to avoid warnings because the list
|
||||
// will not be closed automatically
|
||||
attachments.close();
|
||||
}
|
||||
|
||||
/**
|
||||
* Reorganize the sortKeys after removing an item.
|
||||
*
|
||||
* @param ps The current {@link PageState}
|
||||
*/
|
||||
protected void regenSortKeys(PageState ps) {
|
||||
// Get the current ContentItem
|
||||
ContentItem item = m_imageStep.getItem(ps);
|
||||
// Get the collection of attached images
|
||||
DataCollection attachments = ItemImageAttachment.getImageAttachments(item);
|
||||
|
||||
// Current Position
|
||||
int pos = 0;
|
||||
// Iterate through all items and set item sortKey to pos
|
||||
while (attachments.next()) {
|
||||
pos++;
|
||||
DomainObject domainObject = DomainObjectFactory.newInstance(attachments.getDataObject());
|
||||
if (domainObject instanceof ItemImageAttachment) {
|
||||
int sortKey = ((ItemImageAttachment) domainObject).getSortKey();
|
||||
if (sortKey != pos) {
|
||||
((ItemImageAttachment) domainObject).setSortKey(pos);
|
||||
domainObject.save();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -171,6 +309,7 @@ public class ImageStepDisplay extends SimpleContainer {
|
|||
* @param isSelected
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Component getComponent(final List list, PageState state,
|
||||
Object value, String key,
|
||||
int index, boolean isSelected) {
|
||||
|
|
@ -211,6 +350,22 @@ public class ImageStepDisplay extends SimpleContainer {
|
|||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -220,49 +375,57 @@ public class ImageStepDisplay extends SimpleContainer {
|
|||
}
|
||||
});
|
||||
|
||||
/* 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 );
|
||||
/* 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);
|
||||
}
|
||||
}
|
||||
} );
|
||||
captionText.setOutputEscaping( false );
|
||||
captionPanel.add( captionText );
|
||||
container.add( captionPanel );
|
||||
|
||||
/* Create a box panel beloy the image to display use context*/
|
||||
BoxPanel useContextPanel = new BoxPanel( BoxPanel.HORIZONTAL );
|
||||
|
||||
useContextPanel.add(new Label( ImageStepGlobalizationUtil.globalize(
|
||||
"cms.contentasset.image.ui.use_context") ) );
|
||||
Label useContextLabel = new Label( new PrintListener() {
|
||||
public void prepare( PrintEvent ev ) {
|
||||
Label l = (Label) ev.getTarget();
|
||||
String useContext = attachment.getUseContext();
|
||||
if( null == useContext ) {
|
||||
l.setLabel( ImageStepGlobalizationUtil.globalize(
|
||||
"cms.ui.unknown") );
|
||||
} else {
|
||||
l.setLabel( useContext );
|
||||
// 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);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
} );
|
||||
useContextLabel.setOutputEscaping( false );
|
||||
useContextPanel.add( useContextLabel );
|
||||
container.add( useContextPanel );
|
||||
|
||||
/* Add a link to remove the image in a separate container elemet */
|
||||
ControlLink deleteLink = new ControlLink(new Label(
|
||||
ImageStepGlobalizationUtil.globalize(
|
||||
"cms.contentassets.ui.image_step.remove_attached_image"))) {
|
||||
|
|
@ -271,6 +434,18 @@ public class ImageStepDisplay extends SimpleContainer {
|
|||
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);
|
||||
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
||||
|
|
|
|||
|
|
@ -25,7 +25,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 abstract class ImageComponentAbstractListener implements FormInitListener,
|
||||
FormProcessListener,
|
||||
|
|
@ -40,6 +40,7 @@ public abstract class ImageComponentAbstractListener implements FormInitListener
|
|||
m_imageComponent = imageComponent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(FormSectionEvent event)
|
||||
throws FormProcessException {
|
||||
PageState ps = event.getPageState();
|
||||
|
|
@ -49,12 +50,13 @@ public abstract class ImageComponentAbstractListener implements FormInitListener
|
|||
}
|
||||
|
||||
/**
|
||||
* Call {@link #cancelled(com.arsdigita.bebop.PageState)} if the cancel button
|
||||
* was pressed.
|
||||
* 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);
|
||||
|
|
@ -73,6 +75,7 @@ public abstract class ImageComponentAbstractListener implements FormInitListener
|
|||
* @param event the {@link FormSectionEvent}
|
||||
* @throws FormProcessException
|
||||
*/
|
||||
@Override
|
||||
public void process(FormSectionEvent event) throws FormProcessException {
|
||||
PageState ps = event.getPageState();
|
||||
ImageComponent component = getImageComponent(ps);
|
||||
|
|
@ -86,13 +89,15 @@ public abstract class ImageComponentAbstractListener implements FormInitListener
|
|||
processImage(event, ps, component, image);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* To be overridden by child if neccessary.
|
||||
*
|
||||
* @param ps
|
||||
*/
|
||||
protected void cancelled(PageState ps) {};
|
||||
protected void cancelled(PageState ps) {
|
||||
}
|
||||
|
||||
;
|
||||
|
||||
/**
|
||||
* Process the input.
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
@ -47,8 +46,8 @@ public class ImageDisplay extends SimpleComponent {
|
|||
/**
|
||||
* Construct a new ImageDisplay
|
||||
*
|
||||
* @param m The {@link ItemSelectionModel} which will supply
|
||||
* this component with the {@link ImageAsset}
|
||||
* @param m The {@link ItemSelectionModel} which will supply this component
|
||||
* with the {@link ImageAsset}
|
||||
*/
|
||||
public ImageDisplay(ItemSelectionModel m) {
|
||||
super();
|
||||
|
|
@ -56,8 +55,8 @@ public class ImageDisplay extends SimpleComponent {
|
|||
}
|
||||
|
||||
/**
|
||||
* @return the {@link ItemSelectionModel} which supplies this
|
||||
* component with the {@link ImageAsset}
|
||||
* @return the {@link ItemSelectionModel} which supplies this component with
|
||||
* the {@link ImageAsset}
|
||||
*/
|
||||
public final ItemSelectionModel getImageSelectionModel() {
|
||||
return m_item;
|
||||
|
|
@ -104,8 +103,8 @@ public class ImageDisplay extends SimpleComponent {
|
|||
"cms.contentasset.image.ui.display.name")
|
||||
.localize());
|
||||
element.addAttribute("name", image.getName());
|
||||
element.addAttribute("src", URL.getDispatcherPath() +
|
||||
Service.getImageURL(image));
|
||||
element.addAttribute("src", URL.getDispatcherPath()
|
||||
+ Service.getImageURL(image));
|
||||
|
||||
element.addAttribute("mime_type_label", (String) GlobalizationUtil.globalize(
|
||||
"cms.contentasset.image.ui.display.type")
|
||||
|
|
@ -138,6 +137,11 @@ public class ImageDisplay extends SimpleComponent {
|
|||
"cms.ui.unknown")
|
||||
.localize());
|
||||
}
|
||||
|
||||
element.addAttribute("dimension_label", (String) GlobalizationUtil.globalize(
|
||||
"cms.contentasset.image.ui.display.dimensions")
|
||||
.localize());
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -150,5 +154,4 @@ public class ImageDisplay extends SimpleComponent {
|
|||
Assert.exists(image, "Image asset");
|
||||
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 {
|
||||
|
|
|
|||
|
|
@ -23,15 +23,15 @@ 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.
|
||||
* 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 (quasimodo) <sbernstein@zes.uni-bremen.de>
|
||||
* @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;
|
||||
|
|
@ -73,7 +73,7 @@ public class ImageSelectPage extends CMSPage {
|
|||
// 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();
|
||||
|
||||
|
|
@ -152,8 +152,8 @@ public class ImageSelectPage extends CMSPage {
|
|||
}
|
||||
|
||||
/**
|
||||
* Adds the specified component, with the specified tab name, to the tabbed
|
||||
* pane only if it is not null.
|
||||
* 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
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ 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 {
|
||||
|
|
@ -40,6 +40,13 @@ public class ImageSelectResultComponent extends SimpleContainer
|
|||
m_valid = (m_image != null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Insert a script tag to the xml output with a JavaScript function to
|
||||
* send the image information back to the Xinha plugin.
|
||||
*
|
||||
* @param state The current {@link PageState}
|
||||
* @param parent The parent {@link Element}
|
||||
*/
|
||||
@Override
|
||||
public void generateXML(PageState state, Element parent) {
|
||||
|
||||
|
|
@ -48,7 +55,7 @@ public class ImageSelectResultComponent extends SimpleContainer
|
|||
|
||||
StringBuilder script = new StringBuilder(1000);
|
||||
|
||||
// Create funtion
|
||||
// Create function
|
||||
script.append("function selectImage(button) {");
|
||||
|
||||
// If there is a valid image
|
||||
|
|
@ -100,6 +107,7 @@ public class ImageSelectResultComponent extends SimpleContainer
|
|||
*
|
||||
* @param state Page state
|
||||
*/
|
||||
@Override
|
||||
public void reset(PageState state) {
|
||||
setResult(null, null);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,12 +25,12 @@ 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 {
|
||||
|
||||
|
|
@ -112,18 +112,24 @@ public class ImageUploadComponent extends Form implements ImageComponent {
|
|||
* 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 );
|
||||
* 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 );
|
||||
*/
|
||||
}
|
||||
|
||||
@Override
|
||||
public SaveCancelSection getSaveCancelSection() {
|
||||
return m_saveCancel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ReusableImageAsset getImage(FormSectionEvent event)
|
||||
throws FormProcessException {
|
||||
PageState ps = event.getPageState();
|
||||
|
|
@ -140,28 +146,32 @@ public class ImageUploadComponent extends Form implements ImageComponent {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCaption(FormSectionEvent event) {
|
||||
PageState ps = event.getPageState();
|
||||
return (String) m_caption.getValue(ps);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription(FormSectionEvent event) {
|
||||
PageState ps = event.getPageState();
|
||||
return (String) m_description.getValue(ps);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle(FormSectionEvent event) {
|
||||
PageState ps = event.getPageState();
|
||||
return (String) m_title.getValue(ps);
|
||||
}
|
||||
|
||||
@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 {
|
||||
|
||||
|
|
|
|||
|
|
@ -84,16 +84,16 @@ public class Page extends BlockStylable implements Container {
|
|||
*/
|
||||
private static final String DELIMITER = ".";
|
||||
/**
|
||||
* The prefix that gets prepended to all state variables. Components must
|
||||
* not use variables starting with this prefix. This guarantees that the
|
||||
* page state and variables individual components wish to pass do not
|
||||
* interfere with each other.
|
||||
* The prefix that gets prepended to all state variables. Components
|
||||
* must not use variables starting with this prefix. This guarantees
|
||||
* that the page state and variables individual components wish to pass
|
||||
* do not interfere with each other.
|
||||
*/
|
||||
private static final String COMPONENT_PREFIX = "bbp" + DELIMITER;
|
||||
private static final String INTERNAL = COMPONENT_PREFIX;
|
||||
/**
|
||||
* The name of the special parameter that indicates which component has been
|
||||
* selected.
|
||||
* The name of the special parameter that indicates which component has
|
||||
* been selected.
|
||||
*/
|
||||
static final String SELECTED = INTERNAL + "s";
|
||||
static final String CONTROL_EVENT = INTERNAL + "e";
|
||||
|
|
@ -115,9 +115,9 @@ public class Page extends BlockStylable implements Container {
|
|||
static final String INVISIBLE = INTERNAL + "i";
|
||||
/**
|
||||
* Map of stateful components (id --> Component) SortedMap used because
|
||||
* component based hash for page is based on concatenation of component ids,
|
||||
* and so need to guarantee that they are returned in the same order for the
|
||||
* same page - cg.
|
||||
* component based hash for page is based on concatenation of component
|
||||
* ids, and so need to guarantee that they are returned in the same
|
||||
* order for the same page - cg.
|
||||
*/
|
||||
private SortedMap m_componentMap;
|
||||
private List m_components;
|
||||
|
|
@ -134,9 +134,9 @@ public class Page extends BlockStylable implements Container {
|
|||
private List m_actionListeners;
|
||||
private List m_requestListeners;
|
||||
/**
|
||||
* The title of the page to be added in the head of HTML output. The title
|
||||
* is wrapped in a Label to allow developers to add PrintListeners to
|
||||
* dynamically change the value of the title.
|
||||
* The title of the page to be added in the head of HTML output. The
|
||||
* title is wrapped in a Label to allow developers to add PrintListeners
|
||||
* to dynamically change the value of the title.
|
||||
*/
|
||||
private Label m_title;
|
||||
/**
|
||||
|
|
@ -145,24 +145,24 @@ public class Page extends BlockStylable implements Container {
|
|||
*/
|
||||
private RequestLocal m_currentTitle;
|
||||
/**
|
||||
* A list of all the client-side stylesheets. The elements of the list are
|
||||
* of type Page.Stylesheet, defined at the end of this file.
|
||||
* A list of all the client-side stylesheets. The elements of the list
|
||||
* are of type Page.Stylesheet, defined at the end of this file.
|
||||
*/
|
||||
private List m_clientStylesheets;
|
||||
private StringParameter m_selected;
|
||||
private StringParameter m_controlEvent;
|
||||
private StringParameter m_controlValue;
|
||||
/**
|
||||
* The default (initial) visibility of components. The encoding is identical
|
||||
* to that for PageState.m_invisible.
|
||||
* The default (initial) visibility of components. The encoding is
|
||||
* identical to that for PageState.m_invisible.
|
||||
*
|
||||
* This variable is package-friendly since it needs to be accessed by
|
||||
* PageState.
|
||||
*/
|
||||
protected BitSet m_invisible;
|
||||
/**
|
||||
* The PageErrorDisplay component that will display page state validation
|
||||
* errors on this page
|
||||
* The PageErrorDisplay component that will display page state
|
||||
* validation errors on this page
|
||||
*/
|
||||
private Component m_errorDisplay;
|
||||
/**
|
||||
|
|
@ -170,9 +170,10 @@ public class Page extends BlockStylable implements Container {
|
|||
*/
|
||||
private boolean m_finished = false;
|
||||
/**
|
||||
* indicates whether pageState.stateAsURL() should export the entire state
|
||||
* for this page, or whether it should only export the control event as a
|
||||
* URL and use the HttpSession for the rest of the page state.
|
||||
* indicates whether pageState.stateAsURL() should export the entire
|
||||
* state for this page, or whether it should only export the control
|
||||
* event as a URL and use the HttpSession for the rest of the page
|
||||
* state.
|
||||
*/
|
||||
private boolean m_useHttpSession = false;
|
||||
|
||||
|
|
@ -182,14 +183,15 @@ public class Page extends BlockStylable implements Container {
|
|||
* HttpSession instead of the URL query string. <P>If this returns
|
||||
* <code>true</code>, then PageState.stateAsURL() will only export the
|
||||
* control event as a URL query string. If this returns
|
||||
* <code>false</code>, then stateAsURL() will export the entire page state.
|
||||
* <code>false</code>, then stateAsURL() will export the entire page
|
||||
* state.
|
||||
*
|
||||
*
|
||||
* @see PageState#stateAsURL
|
||||
*
|
||||
* @return <code>true</code> if this page should export state through the
|
||||
* HttpSession; <code>false</code> if it should export using the URL query
|
||||
* string.
|
||||
* @return <code>true</code> if this page should export state through
|
||||
* the HttpSession; <code>false</code> if it should export using the URL
|
||||
* query string.
|
||||
*/
|
||||
public boolean isUsingHttpSession() {
|
||||
return m_useHttpSession;
|
||||
|
|
@ -197,15 +199,15 @@ public class Page extends BlockStylable implements Container {
|
|||
|
||||
/**
|
||||
* Indicates to this page whether it should export its entire state to
|
||||
* subsequent requests through the URL query string, or if it should use the
|
||||
* HttpSession instead and only use the URL query string for the control
|
||||
* event.
|
||||
* subsequent requests through the URL query string, or if it should use
|
||||
* the HttpSession instead and only use the URL query string for the
|
||||
* control event.
|
||||
*
|
||||
* @see PageState#stateAsURL
|
||||
*
|
||||
* @param b <code>true</code> if PageState.stateAsURL() will export only the
|
||||
* control event as a URL query string. <code>false</code> if stateAsURL()
|
||||
* will export the entire page state.
|
||||
* @param b <code>true</code> if PageState.stateAsURL() will export only
|
||||
* the control event as a URL query string. <code>false</code> if
|
||||
* stateAsURL() will export the entire page state.
|
||||
*/
|
||||
public void setUsingHttpSession(boolean b) {
|
||||
m_useHttpSession = b;
|
||||
|
|
@ -269,7 +271,8 @@ public class Page extends BlockStylable implements Container {
|
|||
}
|
||||
|
||||
/**
|
||||
* Creates an empty page with default title and implicit BoxPanel container.
|
||||
* Creates an empty page with default title and implicit BoxPanel
|
||||
* container.
|
||||
*/
|
||||
public Page() {
|
||||
this("");
|
||||
|
|
@ -302,21 +305,23 @@ public class Page extends BlockStylable implements Container {
|
|||
*
|
||||
* @param c component to add to this container
|
||||
*/
|
||||
@Override
|
||||
public void add(Component c) {
|
||||
m_panel.add(c);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a component with the specified layout constraints to this container.
|
||||
* Layout constraints are defined in each layout container as static ints.
|
||||
* To specify multiple constraints, use bitwise OR.
|
||||
* Adds a component with the specified layout constraints to this
|
||||
* container. Layout constraints are defined in each layout container as
|
||||
* static ints. To specify multiple constraints, use bitwise OR.
|
||||
*
|
||||
* @param c component to add to this container
|
||||
*
|
||||
* @param constraints layout constraints (a bitwise OR of static ints in the
|
||||
* particular layout)
|
||||
* @param constraints layout constraints (a bitwise OR of static ints in
|
||||
* the particular layout)
|
||||
*/
|
||||
@Override
|
||||
public void add(Component c, int constraints) {
|
||||
m_panel.add(c, constraints);
|
||||
}
|
||||
|
|
@ -325,11 +330,12 @@ public class Page extends BlockStylable implements Container {
|
|||
* Returns
|
||||
* <code>true</code> if this list contains the specified element. More
|
||||
* formally, returns
|
||||
* <code>true</code> if and only if this list contains at least one element
|
||||
* e such that (o==null ? e==null : o.equals(e)). <P> This method returns
|
||||
* <code>true</code> only if the component has been directly added to this
|
||||
* container. If this container contains another container that contains
|
||||
* this component, this method returns
|
||||
* <code>true</code> if and only if this list contains at least one
|
||||
* element e such that (o==null ? e==null : o.equals(e)). <P> This
|
||||
* method returns
|
||||
* <code>true</code> only if the component has been directly added to
|
||||
* this container. If this container contains another container that
|
||||
* contains this component, this method returns
|
||||
* <code>false</code>.
|
||||
*
|
||||
* @param o element whose presence in this container is to be tested
|
||||
|
|
@ -337,20 +343,23 @@ public class Page extends BlockStylable implements Container {
|
|||
* @return <code>true</code> if this Container contains the specified
|
||||
* component directly; <code>false</code> otherwise.
|
||||
*/
|
||||
@Override
|
||||
public boolean contains(Object o) {
|
||||
return m_panel.contains(o);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the component at the specified position. Each call to the add
|
||||
* method increments the index. Since the user has no control over the index
|
||||
* of added components (other than counting each call to add), this method
|
||||
* should be used in conjunction with indexOf.
|
||||
* method increments the index. Since the user has no control over the
|
||||
* index of added components (other than counting each call to add),
|
||||
* this method should be used in conjunction with indexOf.
|
||||
*
|
||||
* @param index the index of the item to be retrieved from this Container
|
||||
* @param index the index of the item to be retrieved from this
|
||||
* Container
|
||||
*
|
||||
* @return the component at the specified position in this container.
|
||||
*/
|
||||
@Override
|
||||
public Component get(int index) {
|
||||
return m_panel.get(index);
|
||||
}
|
||||
|
|
@ -360,13 +369,14 @@ public class Page extends BlockStylable implements Container {
|
|||
*
|
||||
* @param c component to search for
|
||||
*
|
||||
* @return the index in this list of the first occurrence of the specified
|
||||
* element, or -1 if this list does not contain this element.
|
||||
* @return the index in this list of the first occurrence of the
|
||||
* specified element, or -1 if this list does not contain this element.
|
||||
*
|
||||
* @pre c != null
|
||||
* @post contains(c) implies (return >= 0) && (return < size())
|
||||
* @post !contains(c) implies return == -1
|
||||
*/
|
||||
@Override
|
||||
public int indexOf(Component c) {
|
||||
return m_panel.indexOf(c);
|
||||
}
|
||||
|
|
@ -378,17 +388,19 @@ public class Page extends BlockStylable implements Container {
|
|||
* @return <code>true</code> if this container contains no * *
|
||||
* components; <code>false</code> otherwise.
|
||||
*/
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
return m_panel.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of elements in this container. This does not
|
||||
* recursively count the components that are indirectly contained in this
|
||||
* container.
|
||||
* recursively count the components that are indirectly contained in
|
||||
* this container.
|
||||
*
|
||||
* @return the number of components directly in this container.
|
||||
*/
|
||||
@Override
|
||||
public int size() {
|
||||
return m_panel.size();
|
||||
}
|
||||
|
|
@ -410,8 +422,8 @@ public class Page extends BlockStylable implements Container {
|
|||
|
||||
/**
|
||||
* Set the Container used for rendering components on this page. Caution
|
||||
* should be used with this function, as the existing container is simply
|
||||
* overwritten.
|
||||
* should be used with this function, as the existing container is
|
||||
* simply overwritten.
|
||||
*
|
||||
* @author Matthew Booth (mbooth@redhat.com)
|
||||
*/
|
||||
|
|
@ -459,11 +471,11 @@ public class Page extends BlockStylable implements Container {
|
|||
}
|
||||
|
||||
/**
|
||||
* Sets the {@link Component} that will display the validation errors in the
|
||||
* current {@link PageState}. Any validation error in the
|
||||
* Sets the {@link Component} that will display the validation errors in
|
||||
* the current {@link PageState}. Any validation error in the
|
||||
* <code>PageState</code> will cause the
|
||||
* <code>Page</code> to completely ignore all other components and render
|
||||
* only the error display component. <p> By default, a
|
||||
* <code>Page</code> to completely ignore all other components and
|
||||
* render only the error display component. <p> By default, a
|
||||
* {@link PageErrorDisplay} component is used to display the validation
|
||||
* errors.
|
||||
*
|
||||
|
|
@ -476,11 +488,11 @@ public class Page extends BlockStylable implements Container {
|
|||
}
|
||||
|
||||
/**
|
||||
* Gets the {@link Component} that will display the validation errors in the
|
||||
* current {@link PageState}. Any validation error in the
|
||||
* Gets the {@link Component} that will display the validation errors in
|
||||
* the current {@link PageState}. Any validation error in the
|
||||
* <code>PageState</code> will cause the
|
||||
* <code>Page</code> to completely ignore all other components and render
|
||||
* only the error display component. <p> By default, a
|
||||
* <code>Page</code> to completely ignore all other components and
|
||||
* render only the error display component. <p> By default, a
|
||||
* {@link PageErrorDisplay} component is used to display the validation
|
||||
* errors.
|
||||
*
|
||||
|
|
@ -493,16 +505,16 @@ public class Page extends BlockStylable implements Container {
|
|||
|
||||
/**
|
||||
* Adds a client-side stylesheet that should be used in HTML output.
|
||||
* Arbitrarily many client-side stylesheets can be added with this method.
|
||||
* To use a CSS stylesheet, call something like
|
||||
* Arbitrarily many client-side stylesheets can be added with this
|
||||
* method. To use a CSS stylesheet, call something like
|
||||
* <code>setStyleSheet("style.css", "text/css")</code>.
|
||||
*
|
||||
* <p> These values will ultimately wind up in a <tt><link></tt> tag
|
||||
* in the head of the HTML page.
|
||||
* <p> These values will ultimately wind up in a <tt><link></tt>
|
||||
* tag in the head of the HTML page.
|
||||
*
|
||||
* <p> Note that the stylesheet set with this call has nothing to do with
|
||||
* the XSLT stylesheet (transformer) that is applied to the XML generated
|
||||
* from this page!
|
||||
* <p> Note that the stylesheet set with this call has nothing to do
|
||||
* with the XSLT stylesheet (transformer) that is applied to the XML
|
||||
* generated from this page!
|
||||
*
|
||||
* @param styleSheetURI the location of the stylesheet
|
||||
* @param mimeType the MIME type of the stylesheet, usually
|
||||
|
|
@ -514,14 +526,14 @@ public class Page extends BlockStylable implements Container {
|
|||
}
|
||||
|
||||
/**
|
||||
* Adds a global state parameter to this page. Global parameters are values
|
||||
* that need to be preserved between requests, but that have no special
|
||||
* connection to any of the components on the page. For a page that displays
|
||||
* details about an item, a global parameter would be used to identify the
|
||||
* item.
|
||||
* Adds a global state parameter to this page. Global parameters are
|
||||
* values that need to be preserved between requests, but that have no
|
||||
* special connection to any of the components on the page. For a page
|
||||
* that displays details about an item, a global parameter would be used
|
||||
* to identify the item.
|
||||
*
|
||||
* <p> If the parameter was previously added as a component state parameter,
|
||||
* its name is unmangled and stays unmangled.
|
||||
* <p> If the parameter was previously added as a component state
|
||||
* parameter, its name is unmangled and stays unmangled.
|
||||
*
|
||||
* @param p the global parameter to add
|
||||
*
|
||||
|
|
@ -544,10 +556,10 @@ public class Page extends BlockStylable implements Container {
|
|||
* <bebop:title> ... value set with <i>setTitle</i> ... </bebop:title>
|
||||
* <bebop:stylesheet href='styleSheetURI' type='mimeType'>
|
||||
* ... page content gnerated by children ...
|
||||
* </bebop:page></pre> The content of the <tt><title></tt> element
|
||||
* can be set by calling {@link #setTitle setTitle}. The
|
||||
* <tt><stylesheet></tt> element will only be present if a stylesheet
|
||||
* has been set with {@link
|
||||
* </bebop:page></pre> The content of the <tt><title></tt>
|
||||
* element can be set by calling {@link #setTitle setTitle}. The
|
||||
* <tt><stylesheet></tt> element will only be present if a
|
||||
* stylesheet has been set with {@link
|
||||
* #setStyleSheet setStyleSheet}.
|
||||
*
|
||||
* @param ps the page state for the current page
|
||||
|
|
@ -575,8 +587,8 @@ public class Page extends BlockStylable implements Container {
|
|||
}
|
||||
|
||||
/**
|
||||
* Constructs a DOM or JDOM tree with all components on the page. The tree
|
||||
* represents the page that results from the
|
||||
* Constructs a DOM or JDOM tree with all components on the page. The
|
||||
* tree represents the page that results from the
|
||||
* {@link javax.servlet.http.HttpServletRequest} kept in the
|
||||
* <code>state</code>.
|
||||
*
|
||||
|
|
@ -619,16 +631,16 @@ public class Page extends BlockStylable implements Container {
|
|||
/**
|
||||
* Do nothing. Top-level add nodes is meaningless.
|
||||
*/
|
||||
@Override
|
||||
public void generateXML(PageState state, Element elt) {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a PageState object and processes it by calling the respond method
|
||||
* on the selected component. Processes a request by notifying the component
|
||||
* from which the process originated and {@link #fireActionEvent
|
||||
* broadcasts} an {@link ActionEvent} to all the listeners that registered
|
||||
* with {@link #addActionListener addActionListener}.
|
||||
* Creates a PageState object and processes it by calling the respond
|
||||
* method on the selected component. Processes a request by notifying
|
||||
* the component from which the process originated and {@link #fireActionEvent
|
||||
* broadcasts} an {@link ActionEvent} to all the listeners that
|
||||
* registered with {@link #addActionListener addActionListener}.
|
||||
*
|
||||
* @see #generateXML(PageState,Document) generateXML
|
||||
* @pre isLocked()
|
||||
|
|
@ -701,8 +713,8 @@ public class Page extends BlockStylable implements Container {
|
|||
* calling generateXML on each. Does NOT do the rendering. If the HTTP
|
||||
* response has already been committed, does not build the XML document.
|
||||
*
|
||||
* @return a DOM ready for rendering, or null if the response has already
|
||||
* been committed.
|
||||
* @return a DOM ready for rendering, or null if the response has
|
||||
* already been committed.
|
||||
* @post res.isCommitted() == (return == null)
|
||||
*/
|
||||
public Document buildDocument(HttpServletRequest req,
|
||||
|
|
@ -733,8 +745,9 @@ public class Page extends BlockStylable implements Container {
|
|||
}
|
||||
|
||||
/**
|
||||
* Finishes building the page. The tree of components is traversed and each
|
||||
* component is told to add its state parameters to the page's state model.
|
||||
* Finishes building the page. The tree of components is traversed and
|
||||
* each component is told to add its state parameters to the page's
|
||||
* state model.
|
||||
*
|
||||
* @pre ! isLocked()
|
||||
*/
|
||||
|
|
@ -743,6 +756,7 @@ public class Page extends BlockStylable implements Container {
|
|||
Assert.isUnlocked(this);
|
||||
|
||||
Traversal componentRegistrar = new Traversal() {
|
||||
@Override
|
||||
protected void act(Component c) {
|
||||
addComponent(c);
|
||||
c.register(Page.this);
|
||||
|
|
@ -764,15 +778,17 @@ public class Page extends BlockStylable implements Container {
|
|||
/**
|
||||
* Locks the page and all its components against further modifications.
|
||||
*
|
||||
* <p>Locking a page helps in finding mistakes that result from modifying a
|
||||
* page's structure.</P>
|
||||
* <p>Locking a page helps in finding mistakes that result from
|
||||
* modifying a page's structure.</P>
|
||||
*/
|
||||
@Override
|
||||
public void lock() {
|
||||
if (!m_finished) {
|
||||
finish();
|
||||
}
|
||||
m_stateModel.lock();
|
||||
Traversal componentLocker = new Traversal() {
|
||||
@Override
|
||||
protected void act(Component c) {
|
||||
c.lock();
|
||||
}
|
||||
|
|
@ -783,13 +799,14 @@ public class Page extends BlockStylable implements Container {
|
|||
super.lock();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void respond(PageState state) throws javax.servlet.ServletException {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a listener that is notified whenever a request to this page is
|
||||
* made, after the selected component has had a chance to respond.
|
||||
* Registers a listener that is notified whenever a request to this page
|
||||
* is made, after the selected component has had a chance to respond.
|
||||
*
|
||||
* @pre l != null
|
||||
* @pre ! isLocked()
|
||||
|
|
@ -811,8 +828,8 @@ public class Page extends BlockStylable implements Container {
|
|||
}
|
||||
|
||||
/**
|
||||
* Registers a listener that is notified whenever a request to this page is
|
||||
* made, before the selected component has had a chance to respond.
|
||||
* Registers a listener that is notified whenever a request to this page
|
||||
* is made, before the selected component has had a chance to respond.
|
||||
*
|
||||
* @pre l != null
|
||||
* @pre ! isLocked()
|
||||
|
|
@ -835,9 +852,9 @@ public class Page extends BlockStylable implements Container {
|
|||
}
|
||||
|
||||
/**
|
||||
* Broadcasts an {@link ActionEvent} to all registered listeners. The source
|
||||
* of the event is this page, and the state recorded in the event is the one
|
||||
* resulting from processing the current request.
|
||||
* Broadcasts an {@link ActionEvent} to all registered listeners. The
|
||||
* source of the event is this page, and the state recorded in the event
|
||||
* is the one resulting from processing the current request.
|
||||
*
|
||||
* @param the state for this event
|
||||
*
|
||||
|
|
@ -862,9 +879,9 @@ public class Page extends BlockStylable implements Container {
|
|||
}
|
||||
|
||||
/**
|
||||
* Broadcasts a {@link RequestEvent} to all registered listeners. The source
|
||||
* of the event is this page, and the state recorded in the event is the one
|
||||
* resulting from processing the current request.
|
||||
* Broadcasts a {@link RequestEvent} to all registered listeners. The
|
||||
* source of the event is this page, and the state recorded in the event
|
||||
* is the one resulting from processing the current request.
|
||||
*
|
||||
* @param state the state for this event
|
||||
*
|
||||
|
|
@ -890,8 +907,8 @@ public class Page extends BlockStylable implements Container {
|
|||
|
||||
/**
|
||||
* Export page generator information if set. The m_pageGenerator is a
|
||||
* HashMap containing the information as key value. In general this should
|
||||
* include generator name and generator version.
|
||||
* HashMap containing the information as key value. In general this
|
||||
* should include generator name and generator version.
|
||||
*
|
||||
* @param page parent element - should be bebeop:page
|
||||
*
|
||||
|
|
@ -962,10 +979,10 @@ public class Page extends BlockStylable implements Container {
|
|||
/**
|
||||
* Registers a state parameter for a component. It is permissible to
|
||||
* register the same state parameter several times, from the same or
|
||||
* different components. The name of the parameter will be changed to ensure
|
||||
* that it won't clash with any other component's parameter. If the
|
||||
* parameter is added more than once, the name is only changed the first
|
||||
* time it is added.
|
||||
* different components. The name of the parameter will be changed to
|
||||
* ensure that it won't clash with any other component's parameter. If
|
||||
* the parameter is added more than once, the name is only changed the
|
||||
* first time it is added.
|
||||
*
|
||||
* @param c the component to register the parameter for
|
||||
* @param p the state parameter to register
|
||||
|
|
@ -1007,13 +1024,13 @@ public class Page extends BlockStylable implements Container {
|
|||
}
|
||||
|
||||
/**
|
||||
* Gets the state index of a component. This is the number assigned to the
|
||||
* component in the register traveral
|
||||
* Gets the state index of a component. This is the number assigned to
|
||||
* the component in the register traveral
|
||||
*
|
||||
* @param c the component to search for
|
||||
*
|
||||
* @return the index in this list of the first occurrence of the specified
|
||||
* element, or -1 if this list does not contain this element.
|
||||
* @return the index in this list of the first occurrence of the
|
||||
* specified element, or -1 if this list does not contain this element.
|
||||
*
|
||||
* @pre c != null
|
||||
* @post contains(c) implies (return >= 0) && (return < size())
|
||||
|
|
@ -1061,7 +1078,8 @@ public class Page extends BlockStylable implements Container {
|
|||
}
|
||||
|
||||
/**
|
||||
* Gets the form model that contains the parameters for the page's state.
|
||||
* Gets the form model that contains the parameters for the page's
|
||||
* state.
|
||||
*/
|
||||
public final FormModel getStateModel() {
|
||||
return m_stateModel;
|
||||
|
|
@ -1077,7 +1095,8 @@ public class Page extends BlockStylable implements Container {
|
|||
}
|
||||
|
||||
/**
|
||||
* Checks whether the specified component is visible by default on the page.
|
||||
* Checks whether the specified component is visible by default on the
|
||||
* page.
|
||||
*
|
||||
* @param c a component contained in the page
|
||||
* @return <code>true</code> if the component is visible by default;
|
||||
|
|
@ -1092,10 +1111,10 @@ public class Page extends BlockStylable implements Container {
|
|||
}
|
||||
|
||||
/**
|
||||
* Sets whether the specified component is visible by default. The default
|
||||
* visibility is used when a page is displayed for the first time and on
|
||||
* subsequent requests until the visibility of a component is changed
|
||||
* explicitly with {@link Component#setVisible
|
||||
* Sets whether the specified component is visible by default. The
|
||||
* default visibility is used when a page is displayed for the first
|
||||
* time and on subsequent requests until the visibility of a component
|
||||
* is changed explicitly with {@link Component#setVisible
|
||||
* Component.setVisible}.
|
||||
*
|
||||
* <p> When a component is first added to a page, it is visible.
|
||||
|
|
@ -1141,6 +1160,7 @@ public class Page extends BlockStylable implements Container {
|
|||
|
||||
void reset(final PageState ps, Component cmpnt) {
|
||||
Traversal resetter = new Traversal() {
|
||||
@Override
|
||||
protected void act(Component c) {
|
||||
Collection cp = getComponentParameters(c);
|
||||
if (cp != null) {
|
||||
|
|
@ -1157,8 +1177,8 @@ public class Page extends BlockStylable implements Container {
|
|||
}
|
||||
|
||||
/**
|
||||
* Return the prefix that is prepended to each component's state parameters
|
||||
* to keep them unique.
|
||||
* Return the prefix that is prepended to each component's state
|
||||
* parameters to keep them unique.
|
||||
*/
|
||||
private final String componentPrefix(Component c) {
|
||||
if (c == null) {
|
||||
|
|
@ -1282,8 +1302,8 @@ public class Page extends BlockStylable implements Container {
|
|||
}
|
||||
|
||||
/**
|
||||
* return a string that represents an ordered list of component ids used on
|
||||
* the page. For situations where only the components present is of
|
||||
* return a string that represents an ordered list of component ids used
|
||||
* on the page. For situations where only the components present is of
|
||||
* importance, this may be used by implementations of hashCode & equals
|
||||
*
|
||||
* @return
|
||||
|
|
@ -1299,7 +1319,7 @@ public class Page extends BlockStylable implements Container {
|
|||
}*/
|
||||
Date start = new Date();
|
||||
|
||||
StringBuffer hashString = new StringBuffer();
|
||||
StringBuilder hashString = new StringBuilder();
|
||||
while (it.hasNext()) {
|
||||
String componentId = (String) it.next();
|
||||
hashString.append(componentId);
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -59,18 +59,16 @@ import org.apache.log4j.Logger;
|
|||
* DataQueryImpl
|
||||
*
|
||||
* @author Rafael H. Schloming <rhs@mit.edu>
|
||||
* @author Sören Bernstein <quasi@quasiweb.de>
|
||||
* @version $Id: DataQueryImpl.java 1304 2006-08-31 13:12:47Z sskracic $
|
||||
*/
|
||||
class DataQueryImpl implements DataQuery {
|
||||
|
||||
private static final Logger s_log = Logger.getLogger(DataQueryImpl.class);
|
||||
|
||||
private static final String s_unalias =
|
||||
"com.arsdigita.persistence.DataQueryImpl.unalias";
|
||||
|
||||
private static final String s_mapAndAddPath =
|
||||
"com.arsdigita.persistence.DataQueryImpl.mapAndAddPath";
|
||||
|
||||
private Map m_options = new HashMap();
|
||||
|
||||
private SQLParser getParser(String key, Reader reader,
|
||||
|
|
@ -86,34 +84,25 @@ class DataQueryImpl implements DataQuery {
|
|||
|
||||
return p;
|
||||
}
|
||||
|
||||
private Session m_ssn;
|
||||
private com.redhat.persistence.Session m_pssn;
|
||||
private HashMap m_bindings = new HashMap();
|
||||
|
||||
final Signature m_originalSig;
|
||||
private Signature m_signature;
|
||||
|
||||
final private Expression m_originalExpr;
|
||||
private Expression m_expr;
|
||||
|
||||
Cursor m_cursor = null;
|
||||
private CompoundFilterImpl m_filter;
|
||||
|
||||
private ArrayList m_orders = new ArrayList();
|
||||
|
||||
// This indicates the offset/limit sent of the query
|
||||
private Integer m_offset = null;
|
||||
private Integer m_limit = null;
|
||||
|
||||
// This indicates the limits on the number of rows returned by the query
|
||||
private int m_lowerBound = 0;
|
||||
private int m_upperBound = Integer.MAX_VALUE;
|
||||
|
||||
private final List m_aliases = new ArrayList();
|
||||
// used by addPath to implement addPath for paths traversing 0..n
|
||||
private HashMap m_joins = new HashMap();
|
||||
|
||||
private final FilterFactory m_factory;
|
||||
|
||||
DataQueryImpl(Session ssn, DataSet ds) {
|
||||
|
|
@ -171,8 +160,7 @@ class DataQueryImpl implements DataQuery {
|
|||
// addJoin needs to join against the static-ified version of the All.
|
||||
// this is equivalent to testing if m_originalExpr instanceof All
|
||||
if (this.getClass().equals(DataQueryImpl.class)) {
|
||||
m_expr = new Define
|
||||
(new Static(getTypeInternal().getQualifiedName(), m_bindings),
|
||||
m_expr = new Define(new Static(getTypeInternal().getQualifiedName(), m_bindings),
|
||||
"this");
|
||||
} else {
|
||||
m_expr = new Define(m_originalExpr, "this");
|
||||
|
|
@ -183,18 +171,18 @@ class DataQueryImpl implements DataQuery {
|
|||
m_joins.put(null, "this");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean first() {
|
||||
throw new Error("not implemented");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
try {
|
||||
// can not use checkCursor() because then we can't add filters
|
||||
// after calls to isEmpty
|
||||
if (m_cursor == null) {
|
||||
return new DataSet
|
||||
(m_pssn, m_signature, makeExpr()).isEmpty();
|
||||
return new DataSet(m_pssn, m_signature, makeExpr()).isEmpty();
|
||||
} else {
|
||||
return m_cursor.getDataSet().isEmpty();
|
||||
}
|
||||
|
|
@ -203,36 +191,66 @@ class DataQueryImpl implements DataQuery {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isBeforeFirst() {
|
||||
checkCursor();
|
||||
return m_cursor.isBeforeFirst();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFirst() {
|
||||
checkCursor();
|
||||
return m_cursor.isFirst();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isLast() {
|
||||
throw new Error("not implemented");
|
||||
return size() == getPosition();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isAfterLast() {
|
||||
checkCursor();
|
||||
return m_cursor.isAfterLast();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean last() {
|
||||
throw new Error("not implemented");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean previous() {
|
||||
throw new Error("not implemented");
|
||||
checkCursor();
|
||||
if (m_cursor.isClosed()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
int pre = getPosition();
|
||||
|
||||
boolean result;
|
||||
try {
|
||||
Profiler.startOp("DB");
|
||||
result = m_cursor.previous();
|
||||
} catch (ProtoException e) {
|
||||
throw PersistenceException.newInstance(e);
|
||||
} finally {
|
||||
Profiler.stopOp("DB");
|
||||
}
|
||||
|
||||
if (result) {
|
||||
if (getPosition() == m_upperBound) {
|
||||
if (m_cursor.previous()) {
|
||||
throw new PersistenceException("cursor exceeded upper bound");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (pre < m_lowerBound) {
|
||||
throw new PersistenceException("cursor failed to meet lower bound");
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public void addPath(String path) {
|
||||
|
|
@ -242,8 +260,7 @@ class DataQueryImpl implements DataQuery {
|
|||
|
||||
private void addPath(Path path, boolean requiresFetching) {
|
||||
if (m_cursor != null) {
|
||||
throw new PersistenceException
|
||||
("Paths cannot be added on an active data query.");
|
||||
throw new PersistenceException("Paths cannot be added on an active data query.");
|
||||
}
|
||||
|
||||
addJoin(path);
|
||||
|
|
@ -256,7 +273,9 @@ class DataQueryImpl implements DataQuery {
|
|||
}
|
||||
|
||||
protected Path resolvePath(Path path) {
|
||||
if (m_joins.size() == 0) { return path; }
|
||||
if (m_joins.size() == 0) {
|
||||
return path;
|
||||
}
|
||||
|
||||
Path base = path;
|
||||
for (; base != null; base = base.getParent()) {
|
||||
|
|
@ -265,8 +284,7 @@ class DataQueryImpl implements DataQuery {
|
|||
}
|
||||
}
|
||||
|
||||
Path candidate = Path.add
|
||||
((String) m_joins.get(base), Path.relative(base, path));
|
||||
Path candidate = Path.add((String) m_joins.get(base), Path.relative(base, path));
|
||||
if (m_signature.exists(candidate)) {
|
||||
return candidate;
|
||||
}
|
||||
|
|
@ -301,23 +319,17 @@ class DataQueryImpl implements DataQuery {
|
|||
|
||||
Expression prevColl;
|
||||
if (prev == null) {
|
||||
prevColl = new Define
|
||||
(Expression.valueOf(Path.add("this", coll)), "target");
|
||||
prevColl = new Define(Expression.valueOf(Path.add("this", coll)), "target");
|
||||
} else {
|
||||
Path p = Path.add
|
||||
((String) m_joins.get(prev),
|
||||
Path p = Path.add((String) m_joins.get(prev),
|
||||
Path.relative(prev, coll));
|
||||
prevColl = new Define(Expression.valueOf(p), "target");
|
||||
}
|
||||
|
||||
Expression cond = new Exists
|
||||
(new com.redhat.persistence.oql.Filter
|
||||
(prevColl,
|
||||
new Equals
|
||||
(new Variable(alias), new Variable("target"))));
|
||||
Expression cond = new Exists(new com.redhat.persistence.oql.Filter(prevColl,
|
||||
new Equals(new Variable(alias), new Variable("target"))));
|
||||
|
||||
m_expr = new LeftJoin
|
||||
(m_expr,
|
||||
m_expr = new LeftJoin(m_expr,
|
||||
new Define(new All(type.getQualifiedName()), alias),
|
||||
cond);
|
||||
m_signature.addSource(type, Path.get(alias));
|
||||
|
|
@ -328,15 +340,12 @@ class DataQueryImpl implements DataQuery {
|
|||
|
||||
if (propName.endsWith(PDL.LINK)) {
|
||||
Path rel = null;
|
||||
String assocName = propName.substring
|
||||
(0, propName.length() - PDL.LINK.length());
|
||||
String assocName = propName.substring(0, propName.length() - PDL.LINK.length());
|
||||
Path assoc = Path.add(coll.getParent(), assocName);
|
||||
|
||||
addJoin(assoc);
|
||||
Path pathThroughLink = Path.add(resolvePath(coll), assocName);
|
||||
m_expr = new com.redhat.persistence.oql.Filter
|
||||
(m_expr, new Equals
|
||||
(Expression.valueOf(pathThroughLink),
|
||||
m_expr = new com.redhat.persistence.oql.Filter(m_expr, new Equals(Expression.valueOf(pathThroughLink),
|
||||
Expression.valueOf(resolvePath(assoc))));
|
||||
}
|
||||
}
|
||||
|
|
@ -347,23 +356,19 @@ class DataQueryImpl implements DataQuery {
|
|||
return addFilter(conditions);
|
||||
}
|
||||
|
||||
|
||||
public Filter addFilter(String conditions) {
|
||||
if (m_cursor != null) {
|
||||
throw new PersistenceException
|
||||
("The filter cannot be set on an active data query. " +
|
||||
"Data query must be rewound.");
|
||||
throw new PersistenceException("The filter cannot be set on an active data query. "
|
||||
+ "Data query must be rewound.");
|
||||
}
|
||||
|
||||
return m_filter.addFilter(conditions);
|
||||
}
|
||||
|
||||
|
||||
public Filter addFilter(Filter filter) {
|
||||
if (m_cursor != null) {
|
||||
throw new PersistenceException
|
||||
("The filter cannot be set on an active data query. " +
|
||||
"Data query must be rewound.");
|
||||
throw new PersistenceException("The filter cannot be set on an active data query. "
|
||||
+ "Data query must be rewound.");
|
||||
}
|
||||
|
||||
return m_filter.addFilter(filter);
|
||||
|
|
@ -371,9 +376,8 @@ class DataQueryImpl implements DataQuery {
|
|||
|
||||
public boolean removeFilter(Filter filter) {
|
||||
if (m_cursor != null) {
|
||||
throw new PersistenceException
|
||||
("The filter cannot be removed on an active data query. " +
|
||||
"Data query must be rewound.");
|
||||
throw new PersistenceException("The filter cannot be removed on an active data query. "
|
||||
+ "Data query must be rewound.");
|
||||
}
|
||||
|
||||
return m_filter.removeFilter(filter);
|
||||
|
|
@ -384,13 +388,10 @@ class DataQueryImpl implements DataQuery {
|
|||
return addFilter(getFilterFactory().in(propertyName, subqueryName));
|
||||
}
|
||||
|
||||
|
||||
public Filter addInSubqueryFilter(String propertyName,
|
||||
String subQueryProperty,
|
||||
String queryName) {
|
||||
return addFilter
|
||||
(getFilterFactory().in
|
||||
(propertyName, subQueryProperty, queryName));
|
||||
return addFilter(getFilterFactory().in(propertyName, subQueryProperty, queryName));
|
||||
}
|
||||
|
||||
public Filter addNotInSubqueryFilter(String propertyName,
|
||||
|
|
@ -408,9 +409,8 @@ class DataQueryImpl implements DataQuery {
|
|||
|
||||
public void clearFilter() {
|
||||
if (m_cursor != null) {
|
||||
throw new PersistenceException
|
||||
("Cannot clear the filter on an active data query. " +
|
||||
"Data query must be rewound.");
|
||||
throw new PersistenceException("Cannot clear the filter on an active data query. "
|
||||
+ "Data query must be rewound.");
|
||||
}
|
||||
m_filter = (CompoundFilterImpl) getFilterFactory().and();
|
||||
}
|
||||
|
|
@ -426,14 +426,12 @@ class DataQueryImpl implements DataQuery {
|
|||
|
||||
public void addOrder(String order) {
|
||||
if (m_cursor != null) {
|
||||
throw new PersistenceException
|
||||
("Cannot order an active data query. " +
|
||||
"Data query must be rewound.");
|
||||
throw new PersistenceException("Cannot order an active data query. "
|
||||
+ "Data query must be rewound.");
|
||||
}
|
||||
order = unalias(order);
|
||||
m_orders.add(order);
|
||||
}
|
||||
|
||||
private int m_order = 0;
|
||||
|
||||
public void addOrderWithNull(String orderOne, Object orderTwo,
|
||||
|
|
@ -455,10 +453,8 @@ class DataQueryImpl implements DataQuery {
|
|||
setParameter(var, orderTwo);
|
||||
if (orderOne != null) {
|
||||
Root root = getSession().getRoot();
|
||||
ObjectType typeOne = getTypeInternal().getProperty
|
||||
(unalias(Path.get(orderOne))).getType();
|
||||
if (!root.getObjectType("global.String").equals
|
||||
(typeOne)) {
|
||||
ObjectType typeOne = getTypeInternal().getProperty(unalias(Path.get(orderOne))).getType();
|
||||
if (!root.getObjectType("global.String").equals(typeOne)) {
|
||||
// this means that there is going to be a type conflict
|
||||
// by the DB so we prevent it here
|
||||
throw new PersistenceException("type mismatch");
|
||||
|
|
@ -468,11 +464,10 @@ class DataQueryImpl implements DataQuery {
|
|||
}
|
||||
|
||||
if ((orderTwo != null) && (orderTwo instanceof Date)) {
|
||||
|
||||
}
|
||||
|
||||
addOrder("case when (" + orderOne + " is null) then " +
|
||||
secondElement + " else " + orderOne + " end " + suffix);
|
||||
addOrder("case when (" + orderOne + " is null) then "
|
||||
+ secondElement + " else " + orderOne + " end " + suffix);
|
||||
}
|
||||
|
||||
public void clearOrder() {
|
||||
|
|
@ -484,7 +479,6 @@ class DataQueryImpl implements DataQuery {
|
|||
m_bindings.put(parameterName, value);
|
||||
}
|
||||
|
||||
|
||||
public Object getParameter(String parameterName) {
|
||||
return m_bindings.get(parameterName);
|
||||
}
|
||||
|
|
@ -497,16 +491,14 @@ class DataQueryImpl implements DataQuery {
|
|||
return m_options.get(optionName);
|
||||
}
|
||||
|
||||
|
||||
public void setRange(Integer beginIndex) {
|
||||
setRange(beginIndex, null);
|
||||
}
|
||||
|
||||
public void setRange(Integer beginIndex, Integer endIndex) {
|
||||
if (endIndex != null && endIndex.compareTo(beginIndex) <= 0) {
|
||||
throw new PersistenceException
|
||||
("The beginIndex [" + beginIndex + "] must be strictly less " +
|
||||
"than the endIndex [" + endIndex + "]");
|
||||
throw new PersistenceException("The beginIndex [" + beginIndex + "] must be strictly less "
|
||||
+ "than the endIndex [" + endIndex + "]");
|
||||
}
|
||||
|
||||
m_offset = new Integer(beginIndex.intValue() - 1);
|
||||
|
|
@ -516,21 +508,17 @@ class DataQueryImpl implements DataQuery {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
public Map getPropertyValues() {
|
||||
throw new Error("not implemented");
|
||||
}
|
||||
|
||||
|
||||
public void setReturnsUpperBound(int upperBound) {
|
||||
m_upperBound = upperBound;
|
||||
}
|
||||
|
||||
|
||||
public void setReturnsLowerBound(int lowerBound) {
|
||||
if (lowerBound > 1 || lowerBound < 0) {
|
||||
throw new PersistenceException
|
||||
("The lower bound for a given query must be 0 or 1.");
|
||||
throw new PersistenceException("The lower bound for a given query must be 0 or 1.");
|
||||
}
|
||||
m_lowerBound = lowerBound;
|
||||
}
|
||||
|
|
@ -551,7 +539,6 @@ class DataQueryImpl implements DataQuery {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
public Object get(String propertyName) {
|
||||
Path path = resolvePath(unalias(Path.get(propertyName)));
|
||||
try {
|
||||
|
|
@ -561,13 +548,13 @@ class DataQueryImpl implements DataQuery {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
public int getPosition() {
|
||||
checkCursor();
|
||||
return (int) m_cursor.getPosition();
|
||||
}
|
||||
|
||||
private class AddPathMapper implements SQLParser.Mapper {
|
||||
|
||||
public Path map(Path path) {
|
||||
Path p = unalias(path);
|
||||
// XXX: hasProperty(p) does not work because you can't
|
||||
|
|
@ -579,7 +566,6 @@ class DataQueryImpl implements DataQuery {
|
|||
return resolvePath(p);
|
||||
}
|
||||
}
|
||||
|
||||
private SQLParser.Mapper m_mapper = new AddPathMapper();
|
||||
|
||||
Path mapAndAddPath(Path p) {
|
||||
|
|
@ -613,8 +599,7 @@ class DataQueryImpl implements DataQuery {
|
|||
Expression expr = m_expr;
|
||||
|
||||
if (filter != null) {
|
||||
expr = new com.redhat.persistence.oql.Filter
|
||||
(expr, filter);
|
||||
expr = new com.redhat.persistence.oql.Filter(expr, filter);
|
||||
}
|
||||
|
||||
for (int i = orders.length - 1; i >= 0; i--) {
|
||||
|
|
@ -672,14 +657,12 @@ class DataQueryImpl implements DataQuery {
|
|||
if (result) {
|
||||
if (getPosition() == m_upperBound) {
|
||||
if (m_cursor.next()) {
|
||||
throw new PersistenceException
|
||||
("cursor exceeded upper bound");
|
||||
throw new PersistenceException("cursor exceeded upper bound");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (pre < m_lowerBound) {
|
||||
throw new PersistenceException
|
||||
("cursor failed to meet lower bound");
|
||||
throw new PersistenceException("cursor failed to meet lower bound");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -691,8 +674,7 @@ class DataQueryImpl implements DataQuery {
|
|||
// can not use checkCursor() because then we can't add filters
|
||||
// after calls to size
|
||||
if (m_cursor == null) {
|
||||
return new DataSet
|
||||
(m_pssn, m_signature, makeExpr()).size();
|
||||
return new DataSet(m_pssn, m_signature, makeExpr()).size();
|
||||
} else {
|
||||
return m_cursor.getDataSet().size();
|
||||
}
|
||||
|
|
@ -702,15 +684,17 @@ class DataQueryImpl implements DataQuery {
|
|||
}
|
||||
|
||||
private class UnaliasMapper implements SQLParser.Mapper {
|
||||
|
||||
public Path map(Path path) {
|
||||
return unalias(path);
|
||||
}
|
||||
}
|
||||
|
||||
private SQLParser.Mapper m_unaliaser = new UnaliasMapper();
|
||||
|
||||
String unalias(String expr) {
|
||||
if (expr == null) { return null; }
|
||||
if (expr == null) {
|
||||
return null;
|
||||
}
|
||||
StringReader reader = new StringReader(expr);
|
||||
SQLParser p = getParser(s_unalias, reader, m_unaliaser);
|
||||
|
||||
|
|
@ -788,8 +772,12 @@ class DataQueryImpl implements DataQuery {
|
|||
}
|
||||
|
||||
public boolean isMatch(Path path) {
|
||||
if (isWildcard(m_from)) { return true; }
|
||||
if (m_from.getParent() == null) { return m_from.equals(path); }
|
||||
if (isWildcard(m_from)) {
|
||||
return true;
|
||||
}
|
||||
if (m_from.getParent() == null) {
|
||||
return m_from.equals(path);
|
||||
}
|
||||
while (path.getParent() != null) {
|
||||
path = path.getParent();
|
||||
}
|
||||
|
|
@ -819,7 +807,5 @@ class DataQueryImpl implements DataQuery {
|
|||
public String toString() {
|
||||
return m_from + " --> " + m_to;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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,15 +27,14 @@ 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);
|
||||
|
||||
final private DataSet m_ds;
|
||||
|
||||
private RecordSet m_rs = null;
|
||||
private Map m_values = null;
|
||||
private long m_position = 0;
|
||||
|
|
@ -68,7 +67,9 @@ public class Cursor {
|
|||
return m_values.get(path);
|
||||
} else {
|
||||
Object o = getInternal(path.getParent());
|
||||
if (o == null) { return null; }
|
||||
if (o == null) {
|
||||
return null;
|
||||
}
|
||||
return getSession().get(o, Path.get(path.getName()));
|
||||
}
|
||||
}
|
||||
|
|
@ -195,4 +196,44 @@ public class Cursor {
|
|||
m_closed = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* An expensive previous method, which will iterate the list from the
|
||||
* beginning to the previous to current position. Sadly, the more efficient
|
||||
* way is not possible with this persistent layer because it will only work
|
||||
* with ResultSets in FORWARD_ONLY mode.
|
||||
*
|
||||
* @return boolean true, if there is a previous element, false otherwise
|
||||
*/
|
||||
public boolean previous() {
|
||||
if (m_closed) {
|
||||
throw new ClosedException(this);
|
||||
}
|
||||
|
||||
// Make sure, we don't go before the first entry (position == 1)
|
||||
if (m_position <= 1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// If there isn't a result set, get a new one
|
||||
if (m_rs == null) {
|
||||
getSession().flush();
|
||||
m_rs = execute();
|
||||
}
|
||||
|
||||
// Have to go the long way because the persistent layer can only operate
|
||||
// with ResultSet in FORWARD_ONLY mode
|
||||
long newPosition = getPosition() - 1;
|
||||
|
||||
// Reset the list, aka rewind and get a new resultset
|
||||
rewind();
|
||||
getSession().flush();
|
||||
m_rs = execute();
|
||||
|
||||
// Iterate to new position
|
||||
while (m_position < newPosition) {
|
||||
next();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue