Kommentare und einige Aufräumarbeiten

git-svn-id: https://svn.libreccm.org/ccm/trunk@1790 8810af33-2d31-482b-a856-94f89814c4df
master
quasi 2012-07-31 05:42:04 +00:00
parent 8b3c8f37b9
commit c4969bff47
4 changed files with 51 additions and 29 deletions

View File

@ -15,6 +15,9 @@ import com.arsdigita.cms.ui.ImageComponentAbstractListener;
import org.apache.log4j.Logger;
/**
* A listener to attach an image to a content item.
*
* This listerner is used by {@link ImageStepEdit}.
*
* @author Sören Bernstein (quasimodo) <sbernstein@zes.uni-bremen.de>
*/
@ -43,6 +46,5 @@ public class ImageComponentAttachListener extends ImageComponentAbstractListener
attachment.setCaption(component.getCaption(event));
// setImageComponent(ps, ImageComponent.LIBRARY);
}
}

View File

@ -18,8 +18,6 @@
package com.arsdigita.cms.contentassets.ui;
import com.arsdigita.cms.contentassets.ItemImageAttachment;
import com.arsdigita.bebop.AbstractSingleSelectionModel;
import com.arsdigita.bebop.Page;
import com.arsdigita.bebop.PageState;
@ -29,6 +27,7 @@ import com.arsdigita.bebop.event.ActionListener;
import com.arsdigita.bebop.parameters.ParameterModel;
import com.arsdigita.cms.ContentItem;
import com.arsdigita.cms.ItemSelectionModel;
import com.arsdigita.cms.contentassets.ItemImageAttachment;
import com.arsdigita.cms.ui.ImageComponent;
import com.arsdigita.cms.ui.SecurityPropertyEditor;
import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
@ -36,15 +35,14 @@ import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
import com.arsdigita.domain.DomainObjectFactory;
import com.arsdigita.persistence.OID;
import com.arsdigita.toolbox.ui.OIDParameter;
import java.util.Iterator;
import org.apache.log4j.Logger;
/**
* Pluggable authoring step to add an ImageAsset to a content item
* Currently only supports adding one image though the PDL has
* association for multiple.
* Pluggable authoring step to add an ImageAsset to a content item.
*
* @author unknown
* @author Sören Bernstein (quasimodo) <sbernstein@quasiweb.de>
*/
public class ImageStep extends SecurityPropertyEditor {
@ -175,6 +173,13 @@ public class ImageStep extends SecurityPropertyEditor {
}
}
/**
* Show display pane.
*
* Also, reset the forms for reuse.
*
* @param state
*/
@Override
public void showDisplayPane(PageState state) {
super.showDisplayPane(state);

View File

@ -18,8 +18,6 @@
package com.arsdigita.cms.contentassets.ui;
import com.arsdigita.cms.contentassets.ItemImageAttachment;
import com.arsdigita.bebop.BoxPanel;
import com.arsdigita.bebop.Component;
import com.arsdigita.bebop.ControlLink;
@ -35,25 +33,25 @@ 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.contentassets.ItemImageAttachment;
import com.arsdigita.cms.ui.ImageDisplay;
import com.arsdigita.domain.DomainObjectFactory;
import com.arsdigita.persistence.DataCollection;
import com.arsdigita.persistence.OID;
import com.arsdigita.util.LockableImpl;
import com.arsdigita.xml.Element;
import javax.servlet.ServletException;
import org.apache.log4j.Logger;
/**
* Pluggable authoring step to add an ImageAsset to a content item
* Currently only supports adding one image though the PDL has
* association for multiple.
* Pluggable authoring step to add an ImageAsset to a content item.
*
* @author unknown
* @author Sören Bernstein (quasimodo) <sbernstein@quasiweb.de>
*/
public class ImageStepDisplay extends SimpleContainer {
private static final Logger s_log = Logger.getLogger(ImageStepDisplay.class);
private static final Logger S_LOG = Logger.getLogger(ImageStepDisplay.class);
private final ImageStep m_imageStep;
@ -69,6 +67,7 @@ public class ImageStepDisplay extends SimpleContainer {
mainLabel.setFontWeight(Label.ITALIC);
List imageList = new List( new ImageListModelBuilder() ) {
@Override
public void respond( PageState ps ) throws ServletException {
if( DELETE.equals( ps.getControlEventName() ) ) {
String attachment = ps.getControlEventValue();
@ -168,6 +167,7 @@ public class ImageStepDisplay extends SimpleContainer {
}
@Override
protected ImageAsset getImageAsset( PageState ps ) {
return attachment.getImage();
}
@ -191,6 +191,7 @@ public class ImageStepDisplay extends SimpleContainer {
container.add( useContextPanel );
ControlLink delete = new ControlLink( "Delete" ) {
@Override
public void setControlEvent( PageState ps ) {
String oid = ps.getControlEventValue();
ps.setControlEvent( list, DELETE, oid );

View File

@ -45,17 +45,26 @@ import java.util.Iterator;
import java.util.Map;
import org.apache.log4j.Logger;
/**
* Pluggable authoring step to add an ImageAsset to a content item.
*
* @author unknown
* @author Sören Bernstein (quasimodo) <sbernstein@zes.uni-bremen.de>
*/
public class ImageStepEdit extends SimpleContainer
implements Resettable/*
* , FormProcessListener, FormInitListener
*/ {
implements Resettable {
private static final Logger s_log = Logger.getLogger(ImageStepEdit.class);
private static final Logger S_LOG = Logger.getLogger(ImageStepEdit.class);
private final ImageStep m_imageStep;
private final StringParameter m_imageComponentKey;
private final MapComponentSelectionModel m_imageComponent;
private final ImageComponentAttachListener m_attachListener;
/**
* Creates a new ImageStepEidt form.
*
* @param step the parent {@link ImageStep} form
*/
public ImageStepEdit(ImageStep step) {
m_imageStep = step;
@ -73,7 +82,6 @@ public class ImageStepEdit extends SimpleContainer
library.getForm().addInitListener(m_attachListener);
library.getForm().addProcessListener(m_attachListener);
library.addUploadLink(new ActionListener() {
public void actionPerformed(ActionEvent ev) {
setImageComponent(ev.getPageState(), ImageComponent.UPLOAD);
}
@ -105,15 +113,15 @@ public class ImageStepEdit extends SimpleContainer
p.addComponentStateParam(this, m_imageComponentKey);
}
Iterator getImageComponents() {
protected Iterator getImageComponents() {
return m_imageComponent.getComponentsMap().values().iterator();
}
private void setImageComponent(PageState ps, final String activeKey) {
m_imageComponent.setSelectedKey(ps, activeKey);
if (s_log.isDebugEnabled()) {
s_log.debug("Selected component: " + activeKey);
if (S_LOG.isDebugEnabled()) {
S_LOG.debug("Selected component: " + activeKey);
}
Map componentsMap = m_imageComponent.getComponentsMap();
@ -124,15 +132,19 @@ public class ImageStepEdit extends SimpleContainer
boolean isVisible = activeKey.equals(key);
if (s_log.isDebugEnabled()) {
s_log.debug("Key: " + key + "; Visibility: " + isVisible);
if (S_LOG.isDebugEnabled()) {
S_LOG.debug("Key: " + key + "; Visibility: " + isVisible);
}
ps.setVisible(component, isVisible);
}
}
// Reset this component and all of it's resettable childs
/**
* Reset this component and all of it's resettable childs.
*
* @param ps Page state
*/
public void reset(PageState ps) {
Map componentsMap = m_imageComponent.getComponentsMap();
m_imageComponent.setSelectedKey(ps, ImageComponent.LIBRARY);
@ -160,6 +172,8 @@ public class ImageStepEdit extends SimpleContainer
// attachment.setTitle(component.getTitle(event));
// }
// attachment.setUseContext(component.getUseContext(event));
@Deprecated
private class UniqueUseContextListener implements ParameterListener {
public void validate(ParameterEvent ev)