Jeroen Hoffman pushed to branch release/4.2 at cms-community / hippo-cms

Commits:
964df615 by Jeroen Hoffman at 2017-09-06T10:34:52+02:00
CMS-10892 (back port CMS 10836 to 11.2) new constructor that accepts context 
and config for crop dialog

(cherry picked from commit 9f1766134b57aace9248188ba928b6319c13bacf)

- - - - -


2 changed files:

- 
gallery/frontend/src/main/java/org/hippoecm/frontend/plugins/gallery/editor/ImageCropEditorDialog.java
- 
gallery/frontend/src/main/java/org/hippoecm/frontend/plugins/gallery/editor/ImageCropPlugin.java


Changes:

=====================================
gallery/frontend/src/main/java/org/hippoecm/frontend/plugins/gallery/editor/ImageCropEditorDialog.java
=====================================
--- 
a/gallery/frontend/src/main/java/org/hippoecm/frontend/plugins/gallery/editor/ImageCropEditorDialog.java
+++ 
b/gallery/frontend/src/main/java/org/hippoecm/frontend/plugins/gallery/editor/ImageCropEditorDialog.java
@@ -1,5 +1,5 @@
 /*
- *  Copyright 2011-2016 Hippo B.V. (http://www.onehippo.com)
+ *  Copyright 2011-2017 Hippo B.V. (http://www.onehippo.com)
  *
  *  Licensed under the Apache License, Version 2.0 (the "License");
  *  you may not use this file except in compliance with the License.
@@ -49,6 +49,8 @@ import org.apache.wicket.util.value.ValueMap;
 import org.hippoecm.frontend.dialog.Dialog;
 import org.hippoecm.frontend.editor.plugins.resource.ResourceHelper;
 import org.hippoecm.frontend.model.JcrNodeModel;
+import org.hippoecm.frontend.plugin.IPluginContext;
+import org.hippoecm.frontend.plugin.config.IPluginConfig;
 import org.hippoecm.frontend.plugins.gallery.editor.crop.ImageCropBehavior;
 import org.hippoecm.frontend.plugins.gallery.editor.crop.ImageCropSettings;
 import org.hippoecm.frontend.plugins.gallery.imageutil.ImageUtils;
@@ -91,10 +93,25 @@ public class ImageCropEditorDialog extends Dialog<Node> {
     private Dimension thumbnailDimension;
     private float compressionQuality;
     private final ImageCropSettings cropSettings;
+    @SuppressWarnings("unused")
+    private IPluginConfig config;
+    @SuppressWarnings("unused")
+    private IPluginContext context;
 
-    public ImageCropEditorDialog(IModel<Node> jcrImageNodeModel, 
GalleryProcessor galleryProcessor) {
+    /**
+     * A dialog to crop an image variant.
+     *
+     * @param jcrImageNodeModel node where the variant to be cropped is stored.
+     * @param galleryProcessor with configuration for scaling parameters and 
dimensions.
+     * @param config Config of the instantiating Plugin.
+     * @param context Context of the instantiating Plugin.
+     */
+    public ImageCropEditorDialog(final IModel<Node> jcrImageNodeModel, final 
GalleryProcessor galleryProcessor, final IPluginConfig config, final 
IPluginContext context) {
         super(jcrImageNodeModel);
 
+        this.config = config;
+        this.context = context;
+
         setSize(DIALOG_SIZE);
         setTitleKey(DIALOG_TITLE);
 
@@ -202,6 +219,15 @@ public class ImageCropEditorDialog extends Dialog<Node> {
         } catch (RepositoryException e) {
             log.info("Cannot retrieve compression quality.", e);
         }
+
+    }
+
+    /**
+     * @deprecated use {@link ImageCropEditorDialog(IModel, GalleryProcessor, 
IPluginConfig, IPluginContext)} instead.
+     */
+    @Deprecated
+    public ImageCropEditorDialog(IModel<Node> jcrImageNodeModel, 
GalleryProcessor galleryProcessor) {
+        this(jcrImageNodeModel, galleryProcessor, null, null);
     }
 
     /**


=====================================
gallery/frontend/src/main/java/org/hippoecm/frontend/plugins/gallery/editor/ImageCropPlugin.java
=====================================
--- 
a/gallery/frontend/src/main/java/org/hippoecm/frontend/plugins/gallery/editor/ImageCropPlugin.java
+++ 
b/gallery/frontend/src/main/java/org/hippoecm/frontend/plugins/gallery/editor/ImageCropPlugin.java
@@ -1,5 +1,5 @@
 /*
- *  Copyright 2011-2016 Hippo B.V. (http://www.onehippo.com)
+ *  Copyright 2011-2017 Hippo B.V. (http://www.onehippo.com)
  *
  *  Licensed under the Apache License, Version 2.0 (the "License");
  *  you may not use this file except in compliance with the License.
@@ -47,7 +47,7 @@ public class ImageCropPlugin extends RenderPlugin<Node> {
 
     private static final long serialVersionUID = 1L;
 
-    static final Logger log = LoggerFactory.getLogger(ImageCropPlugin.class);
+    private static final Logger log = 
LoggerFactory.getLogger(ImageCropPlugin.class);
 
     private static final CssResourceReference CROP_SKIN = new 
CssResourceReference(ImageCropPlugin.class, "crop-plugin.css");
 
@@ -110,7 +110,7 @@ public class ImageCropPlugin extends RenderPlugin<Node> {
                     @Override
                     protected void onEvent(final AjaxRequestTarget target) {
                         IDialogService dialogService = 
context.getService(IDialogService.class.getName(), IDialogService.class);
-                        dialogService.show(new 
ImageCropEditorDialog(jcrImageNodeModel, processor));
+                        dialogService.show(new 
ImageCropEditorDialog(jcrImageNodeModel, processor, config, context));
                     }
                 });
             }



View it on GitLab: 
https://code.onehippo.org/cms-community/hippo-cms/commit/964df6156b916ddcac05c9f7c49ace33d81a18e1

---
View it on GitLab: 
https://code.onehippo.org/cms-community/hippo-cms/commit/964df6156b916ddcac05c9f7c49ace33d81a18e1
You're receiving this email because of your account on code.onehippo.org.
_______________________________________________
Hippocms-svn mailing list
Hippocms-svn@lists.onehippo.org
https://lists.onehippo.org/mailman/listinfo/hippocms-svn

Reply via email to