From: <pb...@fe...> - 2012-12-16 18:26:40
|
Author: pboy Date: 2012-12-16 18:26:28 +0000 (Sun, 16 Dec 2012) New Revision: 2382 Added: trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageSelectResultComponent.java Removed: trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageSelectResultPane.java Modified: trunk/ccm-cms-assets-imagestep/src/com/arsdigita/cms/contentassets/ui/ImageComponentAttachListener.java trunk/ccm-cms-assets-imagestep/src/com/arsdigita/cms/contentassets/ui/ImageStep.java trunk/ccm-cms-assets-imagestep/src/com/arsdigita/cms/contentassets/ui/ImageStepDisplay.java trunk/ccm-cms-assets-imagestep/src/com/arsdigita/cms/contentassets/ui/ImageStepEdit.java trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/ContenttypesResources_de.properties trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericPersonAliasSetForm.java trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericPersonContactAddForm.java trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageBrowser.java trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageComponent.java trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageComponentAbstractListener.java trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageComponentAdminListener.java trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageComponentSelectListener.java trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageLibraryComponent.java trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageSelectPage.java trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageUploadComponent.java trunk/ccm-cms/src/com/arsdigita/cms/ui/ImagesPane.java trunk/ccm-cms/src/com/arsdigita/cms/ui/category/CategoryItemPane.java trunk/ccm-cms/src/com/arsdigita/cms/ui/category/CategoryLocalizationTable.java trunk/ccm-core/src/com/arsdigita/bebop/SaveCancelSection.java trunk/ccm-core/src/com/arsdigita/bebop/TabbedPane.java trunk/ccm-core/src/com/arsdigita/dispatcher/DispatcherConfig.java trunk/ccm-core/src/com/arsdigita/kernel/security/SecurityConfig.java Log: Fixed various formattings, added documentation, code consolidation. Modified: trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/ContenttypesResources_de.properties =================================================================== --- trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/ContenttypesResources_de.properties 2012-12-16 18:17:07 UTC (rev 2381) +++ trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/ContenttypesResources_de.properties 2012-12-16 18:26:28 UTC (rev 2382) @@ -15,7 +15,7 @@ cms.contenttypes.ui.person.surname=Nachname cms.contenttypes.ui.person.givenname=Vorname cms.contenttypes.ui.person.titlepre=Titel -cms.contenttypes.ui.person.titlepost=Namesanhang +cms.contenttypes.ui.person.titlepost=Namensanhang cms.contenttypes.ui.person.birthdate=Geburtstag cms.contenttypes.ui.person.description=Beschreibung Modified: trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericPersonAliasSetForm.java =================================================================== --- trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericPersonAliasSetForm.java 2012-12-16 18:17:07 UTC (rev 2381) +++ trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericPersonAliasSetForm.java 2012-12-16 18:26:28 UTC (rev 2382) @@ -55,7 +55,8 @@ "cms.contenttypes.ui.person.alias.select").localize())); itemSearch = new ItemSearchWidget(ITEM_SEARCH, ContentType. findByAssociatedObjectType( - "com.arsdigita.cms.contenttypes.GenericPerson")); + "com.arsdigita.cms.contenttypes.GenericPerson")); + itemSearch.setEditAfterCreate(false); add(itemSearch); } Modified: trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericPersonContactAddForm.java =================================================================== --- trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericPersonContactAddForm.java 2012-12-16 18:17:07 UTC (rev 2381) +++ trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericPersonContactAddForm.java 2012-12-16 18:26:28 UTC (rev 2382) @@ -134,6 +134,7 @@ person.addContact(contact, (String) data.get( GenericPersonContactCollection.CONTACTS_KEY)); + m_itemSearch.publishCreatedItem(data, contact); } init(fse); Modified: trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageBrowser.java =================================================================== --- trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageBrowser.java 2012-12-16 18:17:07 UTC (rev 2381) +++ trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageBrowser.java 2012-12-16 18:26:28 UTC (rev 2382) @@ -34,7 +34,6 @@ import com.arsdigita.cms.ImageAsset; import com.arsdigita.cms.SecurityManager; import com.arsdigita.cms.Service; -import com.arsdigita.cms.ui.ImageComponent; import com.arsdigita.domain.DataObjectNotFoundException; import com.arsdigita.domain.DomainObjectFactory; import com.arsdigita.mimetypes.MimeType; @@ -62,6 +61,7 @@ * </code></pre></blockquote> * * @author Stanislav Freidin + * @author Sören Bernstein (quasimodo) <sbe...@qu...> * @version $Id$ */ public class ImageBrowser extends Table { @@ -80,7 +80,7 @@ private static final Logger s_log = Logger.getLogger(ImageBrowser.class); /** - * Construct a new ImageBrowser + * Construct a new ImageBrowser with default mode. * * @param builder the {@link ImageBrowserModelBuilder} that will supply this * component with its {@link ImageBrowserModel} during each request @@ -90,6 +90,13 @@ this(b, ImageComponent.ATTACH_IMAGE); } + /** + * Construct a new ImageBrowser with requested mode. + * + * @param builder the {@link ImageBrowserModelBuilder} that will supply this + * component with its {@link ImageBrowserModel} during each request + * @param mode the component mode (see {@link ImageComponent}) + */ public ImageBrowser(ImageBrowserModelBuilder b, int mode) { super(new BuilderAdapter(b), HEADERS); m_mode = mode; Modified: trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageComponent.java =================================================================== --- trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageComponent.java 2012-12-16 18:17:07 UTC (rev 2381) +++ trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageComponent.java 2012-12-16 18:26:28 UTC (rev 2382) @@ -1,6 +1,5 @@ /* - * To change this template, choose Tools | Templates - * and open the template in the editor. + * */ package com.arsdigita.cms.ui; @@ -11,11 +10,18 @@ import com.arsdigita.cms.ReusableImageAsset; /** - * + * Interface for ImageCompnents. + * + * All components for image handling (like {@link ImageLibraryComponent} or + * {@link ImageUploadComponent}) should implement this interface. + * * @author Sören Bernstein (quasimodo) <sbe...@ze...> */ public interface ImageComponent { + /** + * The modes + */ public static final int DISPLAY_ONLY = 0; public static final int SELECT_IMAGE = 1; public static final int ATTACH_IMAGE = 2; Modified: trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageComponentAbstractListener.java =================================================================== --- trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageComponentAbstractListener.java 2012-12-16 18:17:07 UTC (rev 2381) +++ trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageComponentAbstractListener.java 2012-12-16 18:26:28 UTC (rev 2382) @@ -18,7 +18,13 @@ import org.apache.log4j.Logger; /** - * + * An abstract listener for {@link ImageComponent}. + * + * This listener provides the base implementation which is shared between all + * listeners of this kind. + * + * This listerner is used by {@link ImageSelectPage}. + * * @author Sören Bernstein (quasimodo) <sbe...@ze...> */ public abstract class ImageComponentAbstractListener implements FormInitListener, FormProcessListener, FormSubmissionListener { @@ -39,6 +45,13 @@ } } + /** + * Call {@link #cancelled(com.arsdigita.bebop.PageState)} if the cancel button + * was pressed. + * + * @param event the {@link FormSectionEvent} + * @throws FormProcessException + */ public void submitted(FormSectionEvent event) throws FormProcessException { PageState ps = event.getPageState(); ImageComponent component = getImageComponent(ps); @@ -48,6 +61,13 @@ } } + /** + * Call {@link #processImage(com.arsdigita.bebop.event.FormSectionEvent, com.arsdigita.bebop.PageState, com.arsdigita.cms.ui.ImageComponent, com.arsdigita.cms.ReusableImageAsset) } + * if the save button was pressed. + * + * @param event the {@link FormSectionEvent} + * @throws FormProcessException + */ public void process(FormSectionEvent event) throws FormProcessException { PageState ps = event.getPageState(); ImageComponent component = getImageComponent(ps); @@ -62,8 +82,21 @@ } + /** + * To be overridden by child if neccessary. + * + * @param ps + */ protected void cancelled(PageState ps) {}; + /** + * Process the input. + * + * @param event the {@link FormSectionEvent} + * @param ps {@link PageState} + * @param component an {@link ImageComponent} + * @param image the {@link ReusableImageAsset} + */ protected abstract void processImage(FormSectionEvent event, PageState ps, ImageComponent component, ReusableImageAsset image); protected ImageComponent getImageComponent(PageState ps) { @@ -80,6 +113,12 @@ } + /** + * Sets the active component + * + * @param ps Page state + * @param activeKey the key of the active component + */ protected void setImageComponent(PageState ps, final String activeKey) { if (s_log.isDebugEnabled()) { Modified: trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageComponentAdminListener.java =================================================================== --- trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageComponentAdminListener.java 2012-12-16 18:17:07 UTC (rev 2381) +++ trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageComponentAdminListener.java 2012-12-16 18:26:28 UTC (rev 2382) @@ -13,7 +13,10 @@ import com.arsdigita.toolbox.ui.ComponentMap; /** - * + * A listener to administer images. + * + * This listerner is used by {@link ImagesPane}. + * * @author Sören Bernstein (quasimodo) <sbe...@ze...> */ class ImageComponentAdminListener extends ImageComponentAbstractListener implements ActionListener { Modified: trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageComponentSelectListener.java =================================================================== --- trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageComponentSelectListener.java 2012-12-16 18:17:07 UTC (rev 2381) +++ trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageComponentSelectListener.java 2012-12-16 18:26:28 UTC (rev 2382) @@ -4,7 +4,6 @@ */ package com.arsdigita.cms.ui; -import com.arsdigita.bebop.FormProcessException; import com.arsdigita.bebop.MapComponentSelectionModel; import com.arsdigita.bebop.PageState; import com.arsdigita.bebop.event.FormSectionEvent; @@ -12,15 +11,18 @@ import org.apache.log4j.Logger; /** - * + * A listener to select an image and save it for later use. + * + * This listerner is used by {@link ImageSelectPage}. + * * @author Sören Bernstein (quasimodo) <sbe...@ze...> */ public class ImageComponentSelectListener extends ImageComponentAbstractListener { private static final Logger S_LOG = Logger.getLogger(ImageComponentSelectListener.class); - private final ImageSelectResultPane m_resultPane; + private final ImageSelectResultComponent m_resultPane; - public ImageComponentSelectListener(MapComponentSelectionModel imageComponent, ImageSelectResultPane resultPane) { + public ImageComponentSelectListener(MapComponentSelectionModel imageComponent, ImageSelectResultComponent resultPane) { super(imageComponent); m_resultPane = resultPane; } Modified: trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageLibraryComponent.java =================================================================== --- trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageLibraryComponent.java 2012-12-16 18:17:07 UTC (rev 2381) +++ trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageLibraryComponent.java 2012-12-16 18:26:28 UTC (rev 2382) @@ -25,7 +25,13 @@ import java.math.BigDecimal; /** + * An image library component. * + * This component can be used in different places to add an image library + * in a convinient way. This class uses a listener class which should be extended + * from {@link ImageComponentAbstractListener}. + * + * @author unknown * @author Sören Bernstein (quasimodo) <sbe...@ze...> */ public class ImageLibraryComponent extends SimpleContainer implements ImageComponent, Resettable { @@ -67,7 +73,7 @@ try { final ReusableImageAsset image = new ReusableImageAsset(imageID); if(m_mode == ImageComponent.SELECT_IMAGE) { - parent.getResultPane().setResult(image.getDisplayName(), image.getID(), image.getWidth(), image.getHeight()); + parent.getResultComponent().setResult(image); } m_imageModel.setSelectedObject(state, image); } catch (DataObjectNotFoundException ex) { @@ -164,6 +170,11 @@ return m_saveCancel; } + /** + * Add a link to an {@link ImageUploadComponent} + * + * @param actionListener + */ public void addUploadLink(final ActionListener actionListener) { // Add action link to image upload component if (m_mode != ImageComponent.DISPLAY_ONLY) { @@ -173,7 +184,9 @@ } } - // Reset this component + /** + * Reset this component. + */ public void reset(final PageState state) { // clear selection m_imageModel.clearSelection(state); Modified: trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageSelectPage.java =================================================================== --- trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageSelectPage.java 2012-12-16 18:17:07 UTC (rev 2381) +++ trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageSelectPage.java 2012-12-16 18:26:28 UTC (rev 2382) @@ -21,7 +21,11 @@ import org.apache.log4j.Logger; /** - * + * A {@link CMSPage} to select and upload images. + * + * This page is used by /web/templates/ccm-cms/content-section/admin/image_select.jsp + * which is used by the OpenCCM plugin for Xihna editor. + * * @author Sören Bernstein (quasimodo) <sbe...@ze...> */ public class ImageSelectPage extends CMSPage { @@ -32,7 +36,7 @@ private TabbedPane m_tabbedPane; private ImageLibraryComponent m_imageLibrary; private ImageUploadComponent m_imageUpload; - private ImageSelectResultPane m_resultPane; + private ImageSelectResultComponent m_result; private BigDecimalParameter m_sectionId; private final StringParameter m_imageComponentKey; private final MapComponentSelectionModel m_imageComponent; @@ -56,7 +60,7 @@ m_imageComponent = new MapComponentSelectionModel(componentModel, new HashMap()); - m_selectListener = new ImageComponentSelectListener(m_imageComponent, getResultPane()); + m_selectListener = new ImageComponentSelectListener(m_imageComponent, getResultComponent()); m_tabbedPane = createTabbedPane(); m_tabbedPane.setIdAttr("page-body"); @@ -77,11 +81,16 @@ } }); - add(m_resultPane); + add(m_result); addGlobalStateParam(m_imageComponentKey); } + /** + * Create the image library pane + * + * @return m_imageLibrary + */ protected ImageLibraryComponent getImageLibraryPane() { if (m_imageLibrary == null) { m_imageLibrary = new ImageLibraryComponent(ImageComponent.SELECT_IMAGE, this); @@ -92,6 +101,11 @@ return m_imageLibrary; } + /** + * Create the image upload pane + * + * @return m_imageUpload + */ protected ImageUploadComponent getImageUploadPane() { if (m_imageUpload == null) { @@ -103,13 +117,21 @@ return m_imageUpload; } - protected ImageSelectResultPane getResultPane() { - if (m_resultPane == null) { - m_resultPane = new ImageSelectResultPane(); + /** + * Creates an {@link ImageSelectResultComponent} + * + * @return m_resultPane + */ + protected ImageSelectResultComponent getResultComponent() { + if (m_result == null) { + m_result = new ImageSelectResultComponent(); } - return m_resultPane; + return m_result; } + /** + * Create the tabbed pane + */ protected TabbedPane createTabbedPane() { TabbedPane pane = new TabbedPane(); pane.setClassAttr(XSL_CLASS); Added: trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageSelectResultComponent.java =================================================================== --- trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageSelectResultComponent.java (rev 0) +++ trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageSelectResultComponent.java 2012-12-16 18:26:28 UTC (rev 2382) @@ -0,0 +1,84 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.arsdigita.cms.ui; + +import com.arsdigita.bebop.PageState; +import com.arsdigita.bebop.Resettable; +import com.arsdigita.bebop.SimpleContainer; +import com.arsdigita.cms.ImageAsset; +import com.arsdigita.cms.Service; +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) <sbe...@ze...> + */ +public class ImageSelectResultComponent extends SimpleContainer implements Resettable { + + boolean m_valid = false; + ImageAsset m_image; + + public ImageSelectResultComponent() { + super(); + } + + /** + * Save image imformation + * + * @param iamge an {@link ImageAsset} + */ + public void setResult(final ImageAsset image/*, final String name, final BigDecimal id, final BigDecimal width, final BigDecimal height*/) { + m_image = image; + m_valid = (m_image != null); + } + + @Override + public void generateXML(PageState state, Element parent) { + + Element scriptElem = parent.newChildElement("script"); + scriptElem.addAttribute("type", "text/javascript"); + + StringBuilder script = new StringBuilder(1000); + + script.append("function selectImage(button) {"); + if (m_valid) { + + script.append("if(button.id == \"save\" ) {"); + + script.append("window.opener.openCCM.imageSet({"); + script.append(" src : \""); + script.append(Service.getImageURL(m_image)); + script.append("\", "); + script.append(" name : \""); + script.append(m_image.getDisplayName()); + script.append("\", "); + script.append(" width : \""); + script.append(m_image.getWidth()); + script.append("\", "); + script.append(" height : \""); + script.append(m_image.getHeight()); + script.append("\""); + script.append("});"); + script.append("}"); + + script.append("self.close();"); + + } + script.append("return false;"); + script.append("}"); + scriptElem.setText(script.toString()); + } + + /** + * Reset this component. + * + * @param state Page state + */ + public void reset(PageState state) { + setResult(null); + } +} Deleted: trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageSelectResultPane.java =================================================================== --- trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageSelectResultPane.java 2012-12-16 18:17:07 UTC (rev 2381) +++ trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageSelectResultPane.java 2012-12-16 18:26:28 UTC (rev 2382) @@ -1,81 +0,0 @@ -/* - * To change this template, choose Tools | Templates - * and open the template in the editor. - */ -package com.arsdigita.cms.ui; - -import com.arsdigita.bebop.PageState; -import com.arsdigita.bebop.Resettable; -import com.arsdigita.bebop.SimpleContainer; -import com.arsdigita.xml.Element; -import java.math.BigDecimal; - -/** - * - * @author Sören Bernstein (quasimodo) <sbe...@ze...> - */ -public class ImageSelectResultPane extends SimpleContainer implements Resettable { - - boolean m_valid = false; - String m_name; - BigDecimal m_id; - BigDecimal m_width; - BigDecimal m_height; - - public ImageSelectResultPane() { - super(); - } - - public void setResult(final String name, final BigDecimal id, final BigDecimal width, final BigDecimal height) { - m_name = name; - m_id = id; - m_width = width; - m_height = height; - m_valid = true; - } - - @Override - public void generateXML(PageState state, Element parent) { - - Element scriptElem = parent.newChildElement("script"); - scriptElem.addAttribute("type", "text/javascript"); - - StringBuilder script = new StringBuilder(1000); - - script.append("function selectImage(button) {"); - if (m_valid) { - - script.append("if(button.id == \"save\" ) {"); - - script.append("window.opener.openCCM.imageSet({"); - script.append(" src : \"/ccm/cms-service/stream/image/?image_id="); - script.append(m_id); - script.append("\", "); - script.append(" name : \""); - script.append(m_name); - script.append("\", "); - script.append(" width : \""); - script.append(m_width); - script.append("\", "); - script.append(" height : \""); - script.append(m_height); - script.append("\""); - script.append("});"); - script.append("}"); - - script.append("self.close();"); - - } - script.append("return false;"); - script.append("}"); - scriptElem.setText(script.toString()); - } - - public void reset(PageState state) { - m_name = null; - m_id = null; - m_width = null; - m_height = null; - m_valid = false; - } -} Modified: trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageUploadComponent.java =================================================================== --- trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageUploadComponent.java 2012-12-16 18:17:07 UTC (rev 2381) +++ trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageUploadComponent.java 2012-12-16 18:26:28 UTC (rev 2382) @@ -21,7 +21,13 @@ 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}. + * + * @author unknown * @author Sören Bernstein (quasimodo) <sbe...@ze...> */ public class ImageUploadComponent extends Form implements ImageComponent { @@ -34,10 +40,18 @@ private final SaveCancelSection m_saveCancel; private int m_mode; + /** + * Creates an ImageUploadComponent in attach mode. + */ public ImageUploadComponent() { this(ImageComponent.ATTACH_IMAGE); } + /** + * Creates an ImageUploadComponent with the selected mode. + * + * @param mode The operation mode (see {@link ImageComponent) + */ public ImageUploadComponent(int mode) { super("imageUploadComponent", new ColumnPanel(2)); m_mode = mode; Modified: trunk/ccm-cms/src/com/arsdigita/cms/ui/ImagesPane.java =================================================================== --- trunk/ccm-cms/src/com/arsdigita/cms/ui/ImagesPane.java 2012-12-16 18:17:07 UTC (rev 2381) +++ trunk/ccm-cms/src/com/arsdigita/cms/ui/ImagesPane.java 2012-12-16 18:26:28 UTC (rev 2382) @@ -34,7 +34,7 @@ import org.apache.log4j.Logger; /** - * A LayoutPanel to insert into ContentSectionPage or ImageSelectPage + * A {@link LayoutPanel} to insert into {@link ContentSectionPage}. * * @author Sören Bernstein (quasimodo) <sbe...@ze...> */ @@ -77,6 +77,7 @@ final Map selectors = m_imageComponent.getComponentsMap(); m_adminListener = new ImageComponentAdminListener(m_imageComponent, this); + // Image library component final ImageLibraryComponent library = new ImageLibraryComponent(ImageComponent.ADMIN_IMAGES); library.getForm().addInitListener(m_adminListener); library.getForm().addProcessListener(m_adminListener); @@ -86,6 +87,7 @@ new Label(GlobalizationUtil.globalize("cms.ui.image_library")), library)); + // Image upload component final ImageUploadComponent upload = new ImageUploadComponent(ImageComponent.ADMIN_IMAGES); upload.getForm().addInitListener(m_adminListener); upload.getForm().addSubmissionListener(m_adminListener); @@ -126,6 +128,11 @@ page.addComponentStateParam(this, m_imageComponentKey); } + /** + * Resets this pane and all its resettable components. + * + * @param state Page state + */ @Override public final void reset(final PageState state) { super.reset(state); Modified: trunk/ccm-cms/src/com/arsdigita/cms/ui/category/CategoryItemPane.java =================================================================== --- trunk/ccm-cms/src/com/arsdigita/cms/ui/category/CategoryItemPane.java 2012-12-16 18:17:07 UTC (rev 2381) +++ trunk/ccm-cms/src/com/arsdigita/cms/ui/category/CategoryItemPane.java 2012-12-16 18:26:28 UTC (rev 2382) @@ -75,20 +75,17 @@ * @version $Id$ */ class CategoryItemPane extends BaseItemPane { - - private static final Logger s_log = Logger.getLogger - (CategoryItemPane.class); - + + private static final Logger s_log = Logger.getLogger(CategoryItemPane.class); private final SingleSelectionModel m_model; private final CategoryRequestLocal m_category; - private final SimpleContainer m_detailPane; public CategoryItemPane(final SingleSelectionModel model, - final CategoryRequestLocal category, - final ActionLink addLink, - final ActionLink editLink, - final ActionLink deleteLink) { + final CategoryRequestLocal category, + final ActionLink addLink, + final ActionLink editLink, + final ActionLink deleteLink) { m_model = model; m_category = category; @@ -99,16 +96,15 @@ setDefault(m_detailPane); final ActionLink orderItemsLink = new ActionLink(new Label( - gz("cms.ui.category.categorized_objects"))) { + gz("cms.ui.category.categorized_objects"))) { @Override public boolean isVisible(PageState state) { // update for live items only if (!super.isVisible(state)) { return false; } - CategorizedCollection items = m_category.getCategory - (state).getObjects(ContentItem.BASE_DATA_OBJECT_TYPE); - items.addEqualsFilter(ContentItem.VERSION,ContentItem.LIVE); + CategorizedCollection items = m_category.getCategory(state).getObjects(ContentItem.BASE_DATA_OBJECT_TYPE); + items.addEqualsFilter(ContentItem.VERSION, ContentItem.LIVE); boolean canOrder = items.size() > 1; items.close(); return canOrder; @@ -123,55 +119,53 @@ // Change index item final ActionLink indexLink = new ActionLink(new Label(gz( - "cms.ui.category.change_index_item"))); + "cms.ui.category.change_index_item"))); final Form indexForm = new IndexItemSelectionForm(m_category); add(indexForm); ViewItemLink viewIndexLink = new ViewItemLink(new Label(gz( - "cms.ui.category.view_index_item")),""); + "cms.ui.category.view_index_item")), ""); EditItemLink editIndexLink = new EditItemLink(new Label(gz( - "cms.ui.category.edit_index_item")),""); + "cms.ui.category.edit_index_item")), ""); // Summary m_detailPane.add(new SummarySection(editLink, deleteLink, indexLink, - viewIndexLink, editIndexLink, orderItemsLink)); - + viewIndexLink, editIndexLink, orderItemsLink)); + // Quasimodo: BEGIN // Localizations ActionLink addCategoryLocalizationLink = new ActionLink(new Label(gz( - "cms.ui.category.localization_add"))) { + "cms.ui.category.localization_add"))) { @Override public boolean isVisible(PageState state) { // Only show addLanguage button, if there are langauges to add - int countSupportedLanguages = ( - Kernel.getConfig()).getSupportedLanguagesTokenizer() - .countTokens(); - long countLanguages = + int countSupportedLanguages = (Kernel.getConfig()).getSupportedLanguagesTokenizer() + .countTokens(); + long countLanguages = m_category.getCategory(state) - .getCategoryLocalizationCollection().size(); - - if(countLanguages < countSupportedLanguages) { + .getCategoryLocalizationCollection().size(); + + if (countLanguages < countSupportedLanguages) { return true; } else { return false; } } }; - + CategoryLocalizationAddForm addCategoryLocalizationForm = - new CategoryLocalizationAddForm(m_category); + new CategoryLocalizationAddForm(m_category); m_detailPane.add(new CategoryLocalizationSection(addCategoryLocalizationLink)); add(addCategoryLocalizationForm); connect(addCategoryLocalizationLink, addCategoryLocalizationForm); connect(addCategoryLocalizationForm); // Quasimodo: END - + // Subcategories m_detailPane.add(new SubcategorySection(addLink)); // Linked categories - final ActionLink linkAddLink = new ActionLink - (new Label(gz("cms.ui.category.linked_add"))); + final ActionLink linkAddLink = new ActionLink(new Label(gz("cms.ui.category.linked_add"))); final Form linkForm = new LinkForm(m_category); add(linkForm); @@ -196,6 +190,7 @@ } private class EditVisible extends VisibilityComponent { + EditVisible(final Component child) { super(child, null); } @@ -207,6 +202,7 @@ } private class AdminVisible extends VisibilityComponent { + AdminVisible(final Component child) { super(child, null); } @@ -220,9 +216,9 @@ private class SummarySection extends Section { SummarySection(final ActionLink editLink, - final ActionLink deleteLink, - final ActionLink indexLink, - final ActionLink orderItemsLink) { + final ActionLink deleteLink, + final ActionLink indexLink, + final ActionLink orderItemsLink) { setHeading(new Label(gz("cms.ui.category.details"))); final ActionGroup group = new ActionGroup(); @@ -241,11 +237,11 @@ * the user to view and edit the content index item. */ SummarySection(final ActionLink editLink, - final ActionLink deleteLink, - final ActionLink indexLink, - final BaseLink viewIndexItem, - final BaseLink editIndexItem, - final ActionLink orderItemsLink) { + final ActionLink deleteLink, + final ActionLink indexLink, + final BaseLink viewIndexItem, + final BaseLink editIndexItem, + final ActionLink orderItemsLink) { setHeading(new Label(gz("cms.ui.category.details"))); final ActionGroup group = new ActionGroup(); @@ -262,6 +258,7 @@ } private class Properties extends PropertyList { + @Override protected final java.util.List properties(final PageState state) { final java.util.List props = super.properties(state); @@ -272,20 +269,19 @@ if (item != null) { itemTitle = item.getDisplayName(); - } else if (!category.ignoreParentIndexItem() - && category.getParentCategoryCount() > 0) - { - Category ancestor = findParentCategoryWithNonInheritedIndexItem(category); - if (ancestor != null) { - if (ancestor.getIndexObject() != null) { - itemTitle = ancestor.getIndexObject().getDisplayName(); - } - itemTitle += " (Inherited from " - + ancestor.getDisplayName() + ")"; - } else { - // The complete hierarchy is set to inherit. - // Just leave the itemTitle as None. - } + } else if (!category.ignoreParentIndexItem() + && category.getParentCategoryCount() > 0) { + Category ancestor = findParentCategoryWithNonInheritedIndexItem(category); + if (ancestor != null) { + if (ancestor.getIndexObject() != null) { + itemTitle = ancestor.getIndexObject().getDisplayName(); + } + itemTitle += " (Inherited from " + + ancestor.getDisplayName() + ")"; + } else { + // The complete hierarchy is set to inherit. + // Just leave the itemTitle as None. + } } props.add(new Property(gz("cms.ui.name"), @@ -295,57 +291,67 @@ props.add(new Property(gz("cms.ui.category.url"), category.getURL(""))); props.add(new Property(gz("cms.ui.category.is_not_abstract"), - category.isAbstract() ? - gz("cms.ui.no") : - gz("cms.ui.yes"))); + category.isAbstract() + ? gz("cms.ui.no") + : gz("cms.ui.yes"))); props.add(new Property(gz("cms.ui.category.is_enabled"), - category.isEnabled("") ? - gz("cms.ui.yes") : - gz("cms.ui.no"))); + category.isEnabled("") + ? gz("cms.ui.yes") + : gz("cms.ui.no"))); props.add(new Property(gz("cms.ui.category.index_item"), - itemTitle)); + itemTitle)); return props; } } } - + // Loop over the parents and recurse up the hierarchy the find the first // parent with an explicit index item ignoreParentIndexItem is true. private Category findParentCategoryWithNonInheritedIndexItem(Category c) { - if (c.getParentCategoryCount() == 0) { - return null; - } - CategoryCollection parents = c.getParents(); - while (parents.next()) { - Category p = parents.getCategory(); - if (p.getDirectIndexObject() != null || p.ignoreParentIndexItem()) { - return p; - } - // Try the parents of this parent. - Category gp = findParentCategoryWithNonInheritedIndexItem(p); - if (gp != null) { - return gp; - } - } - return null; + if (c.getParentCategoryCount() == 0) { + return null; + } + CategoryCollection parents = c.getParents(); + while (parents.next()) { + Category p = parents.getCategory(); + if (p.getDirectIndexObject() != null || p.ignoreParentIndexItem()) { + return p; + } + // Try the parents of this parent. + Category gp = findParentCategoryWithNonInheritedIndexItem(p); + if (gp != null) { + return gp; + } + } + return null; } - + // Quasimodo: BEGIN // CategoryLocalizationSection private class CategoryLocalizationSection extends Section { + + private CategoryLocalizationTable m_catLocalizationTable; + private CategoryLocalizationEditForm m_editCategoryLocalizationForm; + CategoryLocalizationSection(ActionLink addLink) { setHeading(new Label(gz("cms.ui.category.localizations"))); - + final ActionGroup group = new ActionGroup(); setBody(group); - - group.setSubject(new CategoryLocalizationTable(m_category, m_model)); + m_catLocalizationTable = new CategoryLocalizationTable(m_category, m_model); + group.setSubject(m_catLocalizationTable); group.addAction(new AdminVisible(addLink), ActionGroup.ADD); + + m_editCategoryLocalizationForm = new CategoryLocalizationEditForm(m_category, "de"); + connect(m_editCategoryLocalizationForm); + connect(m_catLocalizationTable, 0, m_editCategoryLocalizationForm); + } } private class SubcategorySection extends Section { + SubcategorySection(final ActionLink addLink) { setHeading(new Label(gz("cms.ui.category.subcategories"))); @@ -358,6 +364,7 @@ } private class LinkedCategorySection extends Section { + LinkedCategorySection(final ActionLink linkAddLink) { setHeading(new Label(gz("cms.ui.category.linked"))); @@ -375,6 +382,7 @@ } private class CategoryTemplateSection extends Section { + CategoryTemplateSection() { setHeading(new Label(gz("cms.ui.category.templates"))); @@ -388,6 +396,7 @@ } private class PermissionsSection extends Section { + @Override public boolean isVisible(PageState ps) { Category cat = m_category.getCategory(ps); @@ -400,7 +409,7 @@ final ActionGroup group = new ActionGroup(); setBody(group); - PrivilegeDescriptor[] privs = new PrivilegeDescriptor[] { + PrivilegeDescriptor[] privs = new PrivilegeDescriptor[]{ PrivilegeDescriptor.EDIT, Category.MAP_DESCRIPTOR, PrivilegeDescriptor.DELETE, @@ -413,8 +422,7 @@ privMap.put(Category.MAP_DESCRIPTOR.getName(), "Categorize Items"); privMap.put("admin", "Admin"); - final CMSPermissionsPane permPane = new CMSPermissionsPane - (privs, privMap, new ACSObjectSelectionModel(m_model)) { + final CMSPermissionsPane permPane = new CMSPermissionsPane(privs, privMap, new ACSObjectSelectionModel(m_model)) { @Override public void showAdmin(PageState ps) { Assert.exists(m_model.getSelectedKey(ps)); @@ -425,7 +433,7 @@ }; final ActionLink restoreDefault = new ActionLink(new Label(gz( - "cms.ui.restore_default_permissions"))) { + "cms.ui.restore_default_permissions"))) { @Override public boolean isVisible(PageState ps) { Category cat = m_category.getCategory(ps); @@ -434,7 +442,7 @@ }; final ActionLink useCustom = new ActionLink(new Label(gz( - "cms.ui.use_custom_permissions"))) { + "cms.ui.use_custom_permissions"))) { @Override public boolean isVisible(PageState ps) { Category cat = m_category.getCategory(ps); @@ -460,18 +468,18 @@ parent = cat.getDefaultParentCategory(); } catch (CategoryNotFoundException ce) { throw new IllegalStateException( - "link shouldn't exist for root categories"); + "link shouldn't exist for root categories"); } PermissionService.setContext(cat, parent); // revoke all direct permissions so category will only // have inherited permissions ObjectPermissionCollection perms = - PermissionService.getDirectGrantedPermissions( + PermissionService.getDirectGrantedPermissions( cat.getOID()); while (perms.next()) { PermissionService.revokePermission( - new PermissionDescriptor( + new PermissionDescriptor( perms.getPrivilege(), cat.getOID(), perms.getGranteeOID())); } @@ -510,15 +518,15 @@ add(new Submit("Done")); } - } /* * This private class creates a link to the index item for a category. */ private class ViewItemLink extends Link { + ViewItemLink(Component c, String s) { - super(c,s); + super(c, s); } // Build the preview link. This uses a standard redirect link to find @@ -526,10 +534,10 @@ @Override protected String prepareURL(final PageState state, String location) { - ContentItem indexItem = ((ContentBundle)(m_category.getCategory(state) - .getDirectIndexObject())) - .getPrimaryInstance(); - if(indexItem==null) { + ContentItem indexItem = ((ContentBundle) (m_category.getCategory(state) + .getDirectIndexObject())) + .getPrimaryInstance(); + if (indexItem == null) { return ""; } else { return "/redirect/?oid=" + URLEncoder.encode(indexItem.getOID().toString()); @@ -543,7 +551,7 @@ return false; } ACSObject indexItem = m_category.getCategory(state).getDirectIndexObject(); - if(indexItem==null) { + if (indexItem == null) { return false; } else { return true; @@ -552,36 +560,38 @@ }; private class EditItemLink extends Link { + EditItemLink(Component c, String s) { - super(c,s); + super(c, s); } /** - * Build the preview link. This is based on code in the - * ContentSoonExpiredPane class. The prepareURL method of the parent - * is overwritten. This method is called by the printwriter + * Build the preview link. This is based on code in the + * ContentSoonExpiredPane class. The prepareURL method of the parent is + * overwritten. This method is called by the printwriter */ @Override protected String prepareURL(final PageState state, String location) { boolean canEdit = false; - ContentItem indexItem = ((ContentBundle)(m_category.getCategory(state) - .getDirectIndexObject())) - .getPrimaryInstance(); - if(indexItem==null) { + ContentItem indexItem = ((ContentBundle) (m_category.getCategory(state) + .getDirectIndexObject())) + .getPrimaryInstance(); + if (indexItem == null) { return ""; } - if (!isItemEditable(indexItem,state)) { + if (!isItemEditable(indexItem, state)) { return ""; } else { BigDecimal draftID = indexItem.getDraftVersion().getID(); - return "item.jsp?item_id=" + draftID + "&set_tab=" + - ContentItemPage.AUTHORING_TAB; + return "item.jsp?item_id=" + draftID + "&set_tab=" + + ContentItemPage.AUTHORING_TAB; } } /** * We only show this link when an index item exists for this category * and the user is allowed to edit this item. + * * @param state * @return */ @@ -591,16 +601,16 @@ return false; } ACSObject indexItem = m_category.getCategory(state).getDirectIndexObject(); - if(indexItem==null) { + if (indexItem == null) { return false; } else { - return isItemEditable((ContentItem)indexItem,state); + return isItemEditable((ContentItem) indexItem, state); } } /** - * This method checks whether a usern is allowed to edit a - * particular item. + * This method checks whether a usern is allowed to edit a particular + * item. * * @param item * @param state @@ -610,13 +620,13 @@ BigDecimal id = item.getID(); User user = Web.getContext().getUser(); ContentItem ci = new ContentItem(new OID(ContentItem.class.getName(), - Integer.parseInt(id.toString()))); + Integer.parseInt(id.toString()))); Iterator permissions = PermissionService.getImpliedPrivileges( - ci.getOID(), user.getOID()); + ci.getOID(), user.getOID()); while (permissions.hasNext()) { - PrivilegeDescriptor permission = (PrivilegeDescriptor)permissions.next(); - if (permission.equals(PrivilegeDescriptor.ADMIN) || - permission.equals(PrivilegeDescriptor.EDIT)) { + PrivilegeDescriptor permission = (PrivilegeDescriptor) permissions.next(); + if (permission.equals(PrivilegeDescriptor.ADMIN) + || permission.equals(PrivilegeDescriptor.EDIT)) { return true; } } Modified: trunk/ccm-cms/src/com/arsdigita/cms/ui/category/CategoryLocalizationTable.java =================================================================== --- trunk/ccm-cms/src/com/arsdigita/cms/ui/category/CategoryLocalizationTable.java 2012-12-16 18:17:07 UTC (rev 2381) +++ trunk/ccm-cms/src/com/arsdigita/cms/ui/category/CategoryLocalizationTable.java 2012-12-16 18:26:28 UTC (rev 2382) @@ -27,6 +27,7 @@ import com.arsdigita.bebop.Table; import com.arsdigita.bebop.event.TableActionEvent; import com.arsdigita.bebop.event.TableActionListener; +import com.arsdigita.bebop.table.DefaultTableCellRenderer; import com.arsdigita.bebop.table.TableCellRenderer; import com.arsdigita.bebop.table.TableColumn; import com.arsdigita.bebop.table.TableColumnModel; @@ -49,8 +50,8 @@ /** * Lists all existing localizations for a selected category. * - * 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. + * 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) qu...@ze... */ @@ -75,7 +76,7 @@ // if table is empty: setEmptyView(new Label(GlobalizationUtil.globalize( "cms.ui.category.localization_none"))); - TableColumnModel tab_model = getColumnModel(); +TableColumnModel tab_model = getColumnModel(); // define columns // XXX globalize @@ -139,7 +140,7 @@ /** * Check collection for the existence of another row. - * + * * If exists, fetch the value of current CategoryLocalization object * into m_categoryLocalization class variable. */ @@ -158,6 +159,7 @@ /** * Return the + * * @see com.arsdigita.bebop.table.TableModel#getElementAt(int) */ public Object getElementAt(int columnIndex) { @@ -197,22 +199,22 @@ boolean isSelected, Object key, int row, int column) { -// + // if (canEdit) { -// CategoryLocalization cl; -// -// try { -// cl = new CategoryLocalization((BigDecimal) key); -// } catch (DataObjectNotFoundException ex) { -// return new Label(value.toString()); -// } -// -// ContentSection section = CMS.getContext().getContentSection(); -// ItemResolver resolver = section.getItemResolver(); -// +// CategoryLocalization cl; + +// try { +// cl = new CategoryLocalization((BigDecimal) key); +// } catch (DataObjectNotFoundException ex) { +// return new Label(value.toString()); +// } + +// ContentSection section = CMS.getContext().getContentSection(); +// ItemResolver resolver = section.getItemResolver(); + // return new Link(value.toString(), resolver.generateItemURL(state, cl, section, cl.getVersion())); - ControlLink link = new ControlLink(value.toString()); - return link; + ControlLink link = new ControlLink(value.toString()); + return link; } } @@ -230,9 +232,9 @@ } /** - * Provide implementation to TableActionListener method. - * Code that comes into picture when a link on the table is clicked. - * Handles edit and delete event. + * Provide implementation to TableActionListener method. Code that comes + * into picture when a link on the table is clicked. Handles edit and delete + * event. */ public void cellSelected(TableActionEvent evt) { @@ -260,8 +262,8 @@ } /** - * provide Implementation to TableActionListener method. - * Does nothing in our case. + * provide Implementation to TableActionListener method. Does nothing in our + * case. */ public void headSelected(TableActionEvent e) { throw new UnsupportedOperationException("Not Implemented"); Modified: trunk/ccm-cms-assets-imagestep/src/com/arsdigita/cms/contentassets/ui/ImageComponentAttachListener.java =================================================================== --- trunk/ccm-cms-assets-imagestep/src/com/arsdigita/cms/contentassets/ui/ImageComponentAttachListener.java 2012-12-16 18:17:07 UTC (rev 2381) +++ trunk/ccm-cms-assets-imagestep/src/com/arsdigita/cms/contentassets/ui/ImageComponentAttachListener.java 2012-12-16 18:26:28 UTC (rev 2382) @@ -15,7 +15,10 @@ 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) <sbe...@ze...> */ public class ImageComponentAttachListener extends ImageComponentAbstractListener { @@ -43,6 +46,5 @@ attachment.setCaption(component.getCaption(event)); -// setImageComponent(ps, ImageComponent.LIBRARY); } } Modified: trunk/ccm-cms-assets-imagestep/src/com/arsdigita/cms/contentassets/ui/ImageStep.java =================================================================== --- trunk/ccm-cms-assets-imagestep/src/com/arsdigita/cms/contentassets/ui/ImageStep.java 2012-12-16 18:17:07 UTC (rev 2381) +++ trunk/ccm-cms-assets-imagestep/src/com/arsdigita/cms/contentassets/ui/ImageStep.java 2012-12-16 18:26:28 UTC (rev 2382) @@ -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.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.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) <sbe...@qu...> */ public class ImageStep extends SecurityPropertyEditor { @@ -175,6 +173,13 @@ } } + /** + * Show display pane. + * + * Also, reset the forms for reuse. + * + * @param state + */ @Override public void showDisplayPane(PageState state) { super.showDisplayPane(state); Modified: trunk/ccm-cms-assets-imagestep/src/com/arsdigita/cms/contentassets/ui/ImageStepDisplay.java =================================================================== --- trunk/ccm-cms-assets-imagestep/src/com/arsdigita/cms/contentassets/ui/ImageStepDisplay.java 2012-12-16 18:17:07 UTC (rev 2381) +++ trunk/ccm-cms-assets-imagestep/src/com/arsdigita/cms/contentassets/ui/ImageStepDisplay.java 2012-12-16 18:26:28 UTC (rev 2382) @@ -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.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) <sbe...@qu...> */ 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 @@ 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 @@ } + @Override protected ImageAsset getImageAsset( PageState ps ) { return attachment.getImage(); } @@ -191,6 +191,7 @@ container.add( useContextPanel ); ControlLink delete = new ControlLink( "Delete" ) { + @Override public void setControlEvent( PageState ps ) { String oid = ps.getControlEventValue(); ps.setControlEvent( list, DELETE, oid ); Modified: trunk/ccm-cms-assets-imagestep/src/com/arsdigita/cms/contentassets/ui/ImageStepEdit.java =================================================================== --- trunk/ccm-cms-assets-imagestep/src/com/arsdigita/cms/contentassets/ui/ImageStepEdit.java 2012-12-16 18:17:07 UTC (rev 2381) +++ trunk/ccm-cms-assets-imagestep/src/com/arsdigita/cms/contentassets/ui/ImageStepEdit.java 2012-12-16 18:26:28 UTC (rev 2382) @@ -45,17 +45,26 @@ 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) <sbe...@ze...> + */ 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 @@ 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 @@ 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 @@ boolean isVisible = activeKey.equals(key); - if (s_log.isDebugEnabled()) { - s_log.debug("Key: " + key + "; Visibility: " + isVisible); + if (S_LOG.isDebugEnabled()) ... [truncated message content] |