ImageSelectPage und ImagePane (2/2)
Weitere Änderungen. Restrukturierung, unter anderem interne Klassen aus ImageStepEdit zu normalen Klassen in cms.ui gemacht. git-svn-id: https://svn.libreccm.org/ccm/trunk@1767 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
7749c376a5
commit
9bea8c4ad1
|
|
@ -21,8 +21,6 @@ package com.arsdigita.cms.contentassets.ui;
|
||||||
import com.arsdigita.cms.contentassets.ItemImageAttachment;
|
import com.arsdigita.cms.contentassets.ItemImageAttachment;
|
||||||
|
|
||||||
import com.arsdigita.bebop.AbstractSingleSelectionModel;
|
import com.arsdigita.bebop.AbstractSingleSelectionModel;
|
||||||
import com.arsdigita.bebop.ActionLink;
|
|
||||||
import com.arsdigita.bebop.ColumnPanel;
|
|
||||||
import com.arsdigita.bebop.Page;
|
import com.arsdigita.bebop.Page;
|
||||||
import com.arsdigita.bebop.PageState;
|
import com.arsdigita.bebop.PageState;
|
||||||
import com.arsdigita.bebop.RequestLocal;
|
import com.arsdigita.bebop.RequestLocal;
|
||||||
|
|
@ -31,7 +29,7 @@ import com.arsdigita.bebop.event.ActionListener;
|
||||||
import com.arsdigita.bebop.parameters.ParameterModel;
|
import com.arsdigita.bebop.parameters.ParameterModel;
|
||||||
import com.arsdigita.cms.ContentItem;
|
import com.arsdigita.cms.ContentItem;
|
||||||
import com.arsdigita.cms.ItemSelectionModel;
|
import com.arsdigita.cms.ItemSelectionModel;
|
||||||
import com.arsdigita.cms.ui.ImageChooser;
|
import com.arsdigita.cms.ui.ImageComponent;
|
||||||
import com.arsdigita.cms.ui.SecurityPropertyEditor;
|
import com.arsdigita.cms.ui.SecurityPropertyEditor;
|
||||||
import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
|
import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
|
||||||
import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
|
import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
|
||||||
|
|
@ -83,8 +81,8 @@ public class ImageStep extends SecurityPropertyEditor {
|
||||||
|
|
||||||
Iterator imageComponents = m_add.getImageComponents();
|
Iterator imageComponents = m_add.getImageComponents();
|
||||||
while( imageComponents.hasNext() ) {
|
while( imageComponents.hasNext() ) {
|
||||||
ImageStepEdit.ImageComponent component =
|
ImageComponent component =
|
||||||
(ImageStepEdit.ImageComponent) imageComponents.next();
|
(ImageComponent) imageComponents.next();
|
||||||
|
|
||||||
addListeners( component.getForm(),
|
addListeners( component.getForm(),
|
||||||
component.getSaveCancelSection().getCancelButton() );
|
component.getSaveCancelSection().getCancelButton() );
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,6 @@
|
||||||
* License along with this library; if not, write to the Free Software
|
* License along with this library; if not, write to the Free Software
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.arsdigita.cms.contentassets.ui;
|
package com.arsdigita.cms.contentassets.ui;
|
||||||
|
|
||||||
import com.arsdigita.bebop.Component;
|
import com.arsdigita.bebop.Component;
|
||||||
|
|
@ -24,7 +23,10 @@ import com.arsdigita.bebop.MapComponentSelectionModel;
|
||||||
import com.arsdigita.bebop.Page;
|
import com.arsdigita.bebop.Page;
|
||||||
import com.arsdigita.bebop.PageState;
|
import com.arsdigita.bebop.PageState;
|
||||||
import com.arsdigita.bebop.ParameterSingleSelectionModel;
|
import com.arsdigita.bebop.ParameterSingleSelectionModel;
|
||||||
|
import com.arsdigita.bebop.Resettable;
|
||||||
import com.arsdigita.bebop.SimpleContainer;
|
import com.arsdigita.bebop.SimpleContainer;
|
||||||
|
import com.arsdigita.bebop.event.ActionEvent;
|
||||||
|
import com.arsdigita.bebop.event.ActionListener;
|
||||||
import com.arsdigita.bebop.event.FormInitListener;
|
import com.arsdigita.bebop.event.FormInitListener;
|
||||||
import com.arsdigita.bebop.event.FormProcessListener;
|
import com.arsdigita.bebop.event.FormProcessListener;
|
||||||
import com.arsdigita.bebop.event.FormSectionEvent;
|
import com.arsdigita.bebop.event.FormSectionEvent;
|
||||||
|
|
@ -49,18 +51,13 @@ import java.util.Map;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
public class ImageStepEdit extends SimpleContainer
|
public class ImageStepEdit extends SimpleContainer
|
||||||
implements FormProcessListener, FormInitListener {
|
implements Resettable, FormProcessListener, FormInitListener {
|
||||||
|
|
||||||
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 ImageStep m_imageStep;
|
||||||
|
|
||||||
private final StringParameter m_imageComponentKey;
|
private final StringParameter m_imageComponentKey;
|
||||||
private final MapComponentSelectionModel m_imageComponent;
|
private final MapComponentSelectionModel m_imageComponent;
|
||||||
|
|
||||||
private final String UPLOAD = "upload";
|
|
||||||
private final String LIBRARY = "library";
|
|
||||||
|
|
||||||
public ImageStepEdit(ImageStep step) {
|
public ImageStepEdit(ImageStep step) {
|
||||||
m_imageStep = step;
|
m_imageStep = step;
|
||||||
|
|
||||||
|
|
@ -73,17 +70,24 @@ public class ImageStepEdit extends SimpleContainer
|
||||||
|
|
||||||
Map selectors = m_imageComponent.getComponentsMap();
|
Map selectors = m_imageComponent.getComponentsMap();
|
||||||
|
|
||||||
ImageUploadComponent upload = new ImageUploadComponent();
|
|
||||||
upload.getForm().addInitListener(this);
|
|
||||||
upload.getForm().addProcessListener(this);
|
|
||||||
selectors.put( UPLOAD, upload );
|
|
||||||
add( upload );
|
|
||||||
|
|
||||||
ImageLibraryComponent library = new ImageLibraryComponent();
|
ImageLibraryComponent library = new ImageLibraryComponent();
|
||||||
library.getForm().addInitListener(this);
|
library.getForm().addInitListener(this);
|
||||||
library.getForm().addProcessListener(this);
|
library.getForm().addProcessListener(this);
|
||||||
selectors.put( LIBRARY, library );
|
library.addUploadLink(new ActionListener() {
|
||||||
|
|
||||||
|
public void actionPerformed(ActionEvent ev) {
|
||||||
|
setImageComponent(ev.getPageState(), ImageComponent.UPLOAD);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
selectors.put(ImageComponent.LIBRARY, library);
|
||||||
add(library);
|
add(library);
|
||||||
|
|
||||||
|
ImageUploadComponent upload = new ImageUploadComponent();
|
||||||
|
upload.getForm().addInitListener(this);
|
||||||
|
upload.getForm().addProcessListener(this);
|
||||||
|
selectors.put(ImageComponent.UPLOAD, upload);
|
||||||
|
add(upload);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -96,7 +100,7 @@ public class ImageStepEdit extends SimpleContainer
|
||||||
Object key = i.next();
|
Object key = i.next();
|
||||||
Component component = (Component) componentsMap.get(key);
|
Component component = (Component) componentsMap.get(key);
|
||||||
|
|
||||||
p.setVisibleDefault( component, LIBRARY.equals( key ) );
|
p.setVisibleDefault(component, ImageComponent.LIBRARY.equals(key));
|
||||||
}
|
}
|
||||||
|
|
||||||
p.addComponentStateParam(this, m_imageComponentKey);
|
p.addComponentStateParam(this, m_imageComponentKey);
|
||||||
|
|
@ -113,7 +117,7 @@ public class ImageStepEdit extends SimpleContainer
|
||||||
s_log.debug("Selected: " + m_imageComponent.getComponent(ps));
|
s_log.debug("Selected: " + m_imageComponent.getComponent(ps));
|
||||||
}
|
}
|
||||||
|
|
||||||
m_imageComponent.setSelectedKey( ps, UPLOAD );
|
m_imageComponent.setSelectedKey(ps, ImageComponent.UPLOAD);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (ImageComponent) m_imageComponent.getComponent(ps);
|
return (ImageComponent) m_imageComponent.getComponent(ps);
|
||||||
|
|
@ -188,286 +192,23 @@ public class ImageStepEdit extends SimpleContainer
|
||||||
attachment.setUseContext(component.getUseContext(event));
|
attachment.setUseContext(component.getUseContext(event));
|
||||||
}
|
}
|
||||||
|
|
||||||
// interface ImageComponent {
|
public void reset(PageState state) {
|
||||||
// ReusableImageAsset getImage( FormSectionEvent event )
|
Page p = state.getPage();
|
||||||
// throws FormProcessException;
|
|
||||||
// String getCaption( FormSectionEvent event );
|
Map componentsMap = m_imageComponent.getComponentsMap();
|
||||||
// String getDescription( FormSectionEvent event );
|
Iterator i = componentsMap.keySet().iterator();
|
||||||
// String getTitle( FormSectionEvent event );
|
while (i.hasNext()) {
|
||||||
// String getUseContext( FormSectionEvent event );
|
Object key = i.next();
|
||||||
// SaveCancelSection getSaveCancelSection();
|
Component component = (Component) componentsMap.get(key);
|
||||||
// Form getForm();
|
|
||||||
// }
|
p.setVisibleDefault(component, ImageComponent.LIBRARY.equals(key));
|
||||||
//
|
}
|
||||||
// private class ImageUploadComponent extends Form
|
}
|
||||||
// implements ImageComponent {
|
|
||||||
// private final FileUploadSection m_imageFile;
|
|
||||||
// private final TextField m_caption;
|
|
||||||
// private final TextField m_title;
|
|
||||||
// private final TextArea m_description;
|
|
||||||
// private final TextField m_useContext;
|
|
||||||
// private final SaveCancelSection m_saveCancel;
|
|
||||||
//
|
|
||||||
// public ImageUploadComponent() {
|
|
||||||
// super("imageStepEditUpload", new ColumnPanel(2));
|
|
||||||
//
|
|
||||||
// setEncType("multipart/form-data");
|
|
||||||
//
|
|
||||||
// // Ignoring deprecated constructor.
|
|
||||||
// m_imageFile = new FileUploadSection("Image Type",
|
|
||||||
// "image", ImageAsset.MIME_JPEG);
|
|
||||||
// m_imageFile.getFileUploadWidget()
|
|
||||||
// .addValidationListener(new NotNullValidationListener());
|
|
||||||
//
|
|
||||||
// add( m_imageFile, ColumnPanel.FULL_WIDTH );
|
|
||||||
//
|
|
||||||
// add(new Label("Caption"));
|
|
||||||
// m_caption = new TextField("caption");
|
|
||||||
// m_caption.addValidationListener(new NotNullValidationListener());
|
|
||||||
// m_caption.addValidationListener(new StringLengthValidationListener(40));
|
|
||||||
// m_caption.setSize(40);
|
|
||||||
// add(m_caption);
|
|
||||||
//
|
|
||||||
// m_title = new TextField("title");
|
|
||||||
// m_description = new TextArea("description");
|
|
||||||
//
|
|
||||||
// // We only show the title and description fields in the case where
|
|
||||||
// // getIsImageStepDescriptionAndTitleShown is false.
|
|
||||||
// if (ItemImageAttachment.getConfig().getIsImageStepDescriptionAndTitleShown()) {
|
|
||||||
// add(new Label("Title"));
|
|
||||||
// m_title.addValidationListener(new NotNullValidationListener());
|
|
||||||
// m_title.setSize(40);
|
|
||||||
// m_title.addValidationListener(new StringLengthValidationListener(40));
|
|
||||||
// add(m_title);
|
|
||||||
//
|
|
||||||
// add(new Label("Description"));
|
|
||||||
// m_description.addValidationListener(new NotNullValidationListener());
|
|
||||||
// m_description.addValidationListener(new StringLengthValidationListener(600));
|
|
||||||
// m_description.setCols(30);
|
|
||||||
// m_description.setRows(5);
|
|
||||||
// add(m_description);
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// add(new Label("Use Context"));
|
|
||||||
// m_useContext = new TextField("useContext");
|
|
||||||
// m_useContext.setSize(40);
|
|
||||||
//// Removed to use multiple images with fancyBox
|
|
||||||
//// m_useContext.addValidationListener( new UniqueUseContextListener() );
|
|
||||||
// add(m_useContext);
|
|
||||||
//
|
|
||||||
// m_saveCancel = new SaveCancelSection();
|
|
||||||
// add(m_saveCancel);
|
|
||||||
//
|
|
||||||
// /* Removed by Quasimodo: Changed editing workflow, so that library comes first
|
|
||||||
// * Also, library mode has now a link to upload images whixh will link to this
|
|
||||||
// * form. Consequently, this link will create a loop, which isn't fatal but
|
|
||||||
// * confusing
|
|
||||||
// ActionLink library = new ActionLink( "Select an existing image" );
|
|
||||||
// library.addActionListener( new ActionListener() {
|
|
||||||
// public void actionPerformed( ActionEvent ev ) {
|
|
||||||
// setImageComponent( ev.getPageState(), LIBRARY );
|
|
||||||
// }
|
|
||||||
// } );
|
|
||||||
// add( library, ColumnPanel.FULL_WIDTH );
|
|
||||||
// */
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public SaveCancelSection getSaveCancelSection() {
|
|
||||||
// return m_saveCancel;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public ReusableImageAsset getImage( FormSectionEvent event )
|
|
||||||
// throws FormProcessException
|
|
||||||
// {
|
|
||||||
// PageState ps = event.getPageState();
|
|
||||||
//
|
|
||||||
// String filename = (String) m_imageFile.getFileName( event );
|
|
||||||
// File imageFile = m_imageFile.getFile( event );
|
|
||||||
//
|
|
||||||
// try {
|
|
||||||
// ReusableImageAsset image = new ReusableImageAsset();
|
|
||||||
// image.loadFromFile( filename, imageFile, ImageAsset.MIME_JPEG );
|
|
||||||
// image.setDescription( ( String ) m_caption.getValue( ps ) );
|
|
||||||
//
|
|
||||||
// return image;
|
|
||||||
// } catch ( IOException ex ) {
|
|
||||||
// s_log.error( "Error loading image from file", ex );
|
|
||||||
// throw new FormProcessException( ex.getMessage() );
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public String getCaption( FormSectionEvent event ) {
|
|
||||||
// PageState ps = event.getPageState();
|
|
||||||
// return (String) m_caption.getValue( ps );
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public String getDescription( FormSectionEvent event ) {
|
|
||||||
// PageState ps = event.getPageState();
|
|
||||||
// return (String) m_description.getValue( ps );
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public String getTitle( FormSectionEvent event ) {
|
|
||||||
// PageState ps = event.getPageState();
|
|
||||||
// return (String) m_title.getValue( ps );
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public String getUseContext( FormSectionEvent event ) {
|
|
||||||
// PageState ps = event.getPageState();
|
|
||||||
// return (String) m_useContext.getValue( ps );
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public Form getForm() {
|
|
||||||
// return this;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// private class ImageLibraryComponent extends SimpleContainer
|
|
||||||
// implements ImageComponent {
|
|
||||||
// private final ImageChooser m_chooser;
|
|
||||||
// private final ItemSelectionModel m_imageModel;
|
|
||||||
// private final BigDecimalParameter m_imageID;
|
|
||||||
//
|
|
||||||
// private final Form m_form;
|
|
||||||
// private final TextField m_caption;
|
|
||||||
// private final TextField m_description;
|
|
||||||
// private final TextField m_title;
|
|
||||||
// private final TextField m_useContext;
|
|
||||||
// private final SaveCancelSection m_saveCancel;
|
|
||||||
//
|
|
||||||
// public ImageLibraryComponent() {
|
|
||||||
// m_imageID = new BigDecimalParameter( "imageID" );
|
|
||||||
// m_imageModel = new ItemSelectionModel( m_imageID );
|
|
||||||
//
|
|
||||||
// m_chooser = new ImageChooser( ContentItem.DRAFT, ImageBrowser.SELECT_IMAGE );
|
|
||||||
// m_chooser.addImageActionListener( new ImageBrowser.LinkActionListener() {
|
|
||||||
// public void deleteClicked( PageState ps, BigDecimal imageID ) {
|
|
||||||
// s_log.debug( "Clicked delete" );
|
|
||||||
//
|
|
||||||
// ReusableImageAsset image =
|
|
||||||
// new ReusableImageAsset( imageID );
|
|
||||||
// image.delete();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public void linkClicked( PageState ps, BigDecimal imageID ) {
|
|
||||||
// s_log.debug( "Clicked select" );
|
|
||||||
// try {
|
|
||||||
// ReusableImageAsset image =
|
|
||||||
// new ReusableImageAsset( imageID );
|
|
||||||
//
|
|
||||||
// m_imageModel.setSelectedObject( ps, image );
|
|
||||||
// } catch( DataObjectNotFoundException ex ) {
|
|
||||||
// s_log.error( "Selected non-existant image: " + imageID, ex );
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// } );
|
|
||||||
// // Don't display the delete links
|
|
||||||
// /*
|
|
||||||
// m_chooser.getImageBrowser().getColumn(5)
|
|
||||||
// .setCellRenderer( new TableCellRenderer() {
|
|
||||||
// public Component getComponent( Table table, PageState state,
|
|
||||||
// Object value, boolean isSelected,
|
|
||||||
// Object key, int row,
|
|
||||||
// int column ) {
|
|
||||||
// return new Label( " ", false );
|
|
||||||
// }
|
|
||||||
// } );
|
|
||||||
// */
|
|
||||||
// add( m_chooser );
|
|
||||||
//
|
|
||||||
// m_form = new Form( "imageStepEditLibrary", new ColumnPanel( 2 ) );
|
|
||||||
// add( m_form );
|
|
||||||
//
|
|
||||||
// m_form.add(new Label("Caption"));
|
|
||||||
// m_caption = new TextField("caption");
|
|
||||||
// m_caption.addValidationListener(new NotNullValidationListener());
|
|
||||||
// m_caption.setSize(40);
|
|
||||||
// m_form.add(m_caption);
|
|
||||||
//
|
|
||||||
// m_description = new TextField("description");
|
|
||||||
// m_description.addValidationListener(new NotNullValidationListener());
|
|
||||||
// m_description.setSize(40);
|
|
||||||
//
|
|
||||||
// m_title = new TextField("title");
|
|
||||||
// m_title.addValidationListener(new NotNullValidationListener());
|
|
||||||
// m_title.setSize(40);
|
|
||||||
//
|
|
||||||
// // Only show the title and description fields where these have
|
|
||||||
// // been explicitly requested.
|
|
||||||
// if (ItemImageAttachment.getConfig().getIsImageStepDescriptionAndTitleShown()) {
|
|
||||||
// m_form.add(new Label("Description"));
|
|
||||||
// m_form.add(m_description);
|
|
||||||
// m_form.add(new Label("Title"));
|
|
||||||
// m_form.add(m_title);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// m_form.add(new Label("Use Context"));
|
|
||||||
// m_useContext = new TextField("useContext");
|
|
||||||
// m_useContext.setSize(40);
|
|
||||||
//// Removed to use multiple images with fancyBox
|
|
||||||
//// m_useContext.addValidationListener( new UniqueUseContextListener() );
|
|
||||||
// m_form.add(m_useContext);
|
|
||||||
//
|
|
||||||
// m_saveCancel = new SaveCancelSection();
|
|
||||||
// m_form.add(m_saveCancel);
|
|
||||||
//
|
|
||||||
// ActionLink upload = new ActionLink( "Upload a new image" );
|
|
||||||
// upload.addActionListener( new ActionListener() {
|
|
||||||
// public void actionPerformed( ActionEvent ev ) {
|
|
||||||
// setImageComponent( ev.getPageState(), UPLOAD );
|
|
||||||
// }
|
|
||||||
// } );
|
|
||||||
// add( upload, ColumnPanel.FULL_WIDTH );
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public ReusableImageAsset getImage( FormSectionEvent event ) {
|
|
||||||
// PageState ps = event.getPageState();
|
|
||||||
//
|
|
||||||
// return (ReusableImageAsset) m_imageModel.getSelectedItem( ps );
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public void register( Page p ) {
|
|
||||||
// super.register( p );
|
|
||||||
//
|
|
||||||
// p.addComponentStateParam( this, m_imageID );
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public String getCaption( FormSectionEvent event ) {
|
|
||||||
// PageState ps = event.getPageState();
|
|
||||||
// return (String) m_caption.getValue( ps );
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public String getDescription( FormSectionEvent event ) {
|
|
||||||
// PageState ps = event.getPageState();
|
|
||||||
// return (String) m_description.getValue( ps );
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public String getTitle( FormSectionEvent event ) {
|
|
||||||
// PageState ps = event.getPageState();
|
|
||||||
// return (String) m_title.getValue( ps );
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// public String getUseContext( FormSectionEvent event ) {
|
|
||||||
// PageState ps = event.getPageState();
|
|
||||||
// return (String) m_useContext.getValue( ps );
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public Form getForm() {
|
|
||||||
// return m_form;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public SaveCancelSection getSaveCancelSection() {
|
|
||||||
// return m_saveCancel;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
private class UniqueUseContextListener implements ParameterListener {
|
private class UniqueUseContextListener implements ParameterListener {
|
||||||
|
|
||||||
public void validate(ParameterEvent ev)
|
public void validate(ParameterEvent ev)
|
||||||
throws FormProcessException
|
throws FormProcessException {
|
||||||
{
|
|
||||||
PageState ps = ev.getPageState();
|
PageState ps = ev.getPageState();
|
||||||
ParameterData data = ev.getParameterData();
|
ParameterData data = ev.getParameterData();
|
||||||
|
|
||||||
|
|
@ -483,20 +224,17 @@ public class ImageStepEdit extends SimpleContainer
|
||||||
|
|
||||||
DataCollection attachments =
|
DataCollection attachments =
|
||||||
ItemImageAttachment.getImageAttachments(item);
|
ItemImageAttachment.getImageAttachments(item);
|
||||||
attachments
|
attachments.addEqualsFilter(ItemImageAttachment.USE_CONTEXT, value);
|
||||||
.addEqualsFilter(ItemImageAttachment.USE_CONTEXT, value );
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (attachments.next()) {
|
if (attachments.next()) {
|
||||||
ItemImageAttachment attachment = m_imageStep.getAttachment(ps);
|
ItemImageAttachment attachment = m_imageStep.getAttachment(ps);
|
||||||
BigDecimal dupAttachmentID = (BigDecimal)
|
BigDecimal dupAttachmentID = (BigDecimal) attachments.get(ItemImageAttachment.ID);
|
||||||
attachments.get( ItemImageAttachment.ID );
|
|
||||||
|
|
||||||
if( null == attachment ||
|
if (null == attachment
|
||||||
!attachment.getID().equals( dupAttachmentID ) )
|
|| !attachment.getID().equals(dupAttachmentID)) {
|
||||||
{
|
data.addError("There is already an image for this "
|
||||||
data.addError( "There is already an image for this " +
|
+ "item with this context");
|
||||||
"item with this context" );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue