Author: solomax
Date: Sun Mar  6 10:21:42 2016
New Revision: 1733800

URL: http://svn.apache.org/viewvc?rev=1733800&view=rev
Log:
[item.add(new ConfirmableAjaxBorder(delete, getString(80), getString(833)) {]

Modified:
    
openmeetings/application/branches/3.1.x/openmeetings-web/src/main/java/org/apache/openmeetings/web/common/ConfirmableAjaxBorder.java
    
openmeetings/application/branches/3.1.x/openmeetings-web/src/main/java/org/apache/openmeetings/web/user/profile/MessagesContactsPanel.java
    
openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/common/ConfirmableAjaxBorder.java
    
openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/user/profile/MessagesContactsPanel.java

Modified: 
openmeetings/application/branches/3.1.x/openmeetings-web/src/main/java/org/apache/openmeetings/web/common/ConfirmableAjaxBorder.java
URL: 
http://svn.apache.org/viewvc/openmeetings/application/branches/3.1.x/openmeetings-web/src/main/java/org/apache/openmeetings/web/common/ConfirmableAjaxBorder.java?rev=1733800&r1=1733799&r2=1733800&view=diff
==============================================================================
--- 
openmeetings/application/branches/3.1.x/openmeetings-web/src/main/java/org/apache/openmeetings/web/common/ConfirmableAjaxBorder.java
 (original)
+++ 
openmeetings/application/branches/3.1.x/openmeetings-web/src/main/java/org/apache/openmeetings/web/common/ConfirmableAjaxBorder.java
 Sun Mar  6 10:21:42 2016
@@ -20,6 +20,7 @@ package org.apache.openmeetings.web.comm
 
 import org.apache.wicket.ajax.AjaxEventBehavior;
 import org.apache.wicket.ajax.AjaxRequestTarget;
+import org.apache.wicket.ajax.attributes.AjaxRequestAttributes;
 import org.apache.wicket.markup.html.border.Border;
 import org.apache.wicket.markup.html.form.Form;
 import org.apache.wicket.model.IModel;
@@ -62,6 +63,12 @@ public abstract class ConfirmableAjaxBor
                        private static final long serialVersionUID = 1L;
 
                        @Override
+                       protected void 
updateAjaxAttributes(AjaxRequestAttributes attributes) {
+                               super.updateAjaxAttributes(attributes);
+                               
ConfirmableAjaxBorder.this.updateAjaxAttributes(attributes);
+                       }
+                       
+                       @Override
                        protected void onEvent(AjaxRequestTarget target) {
                                dialog.open(target);
                        }
@@ -70,6 +77,14 @@ public abstract class ConfirmableAjaxBor
        }
 
        /**
+        * Gives a chance to the specializations to modify the attributes.
+        * 
+        * @param attributes attributes
+        */
+       protected void updateAjaxAttributes(AjaxRequestAttributes attributes) {
+       }
+       
+       /**
         * Triggered when the form is submitted, but the validation failed
         *
         * @param target the {@link AjaxRequestTarget}

Modified: 
openmeetings/application/branches/3.1.x/openmeetings-web/src/main/java/org/apache/openmeetings/web/user/profile/MessagesContactsPanel.java
URL: 
http://svn.apache.org/viewvc/openmeetings/application/branches/3.1.x/openmeetings-web/src/main/java/org/apache/openmeetings/web/user/profile/MessagesContactsPanel.java?rev=1733800&r1=1733799&r2=1733800&view=diff
==============================================================================
--- 
openmeetings/application/branches/3.1.x/openmeetings-web/src/main/java/org/apache/openmeetings/web/user/profile/MessagesContactsPanel.java
 (original)
+++ 
openmeetings/application/branches/3.1.x/openmeetings-web/src/main/java/org/apache/openmeetings/web/user/profile/MessagesContactsPanel.java
 Sun Mar  6 10:21:42 2016
@@ -45,6 +45,7 @@ import org.apache.openmeetings.db.entity
 import org.apache.openmeetings.web.admin.SearchableDataView;
 import org.apache.openmeetings.web.app.Application;
 import org.apache.openmeetings.web.common.AddFolderDialog;
+import org.apache.openmeetings.web.common.ConfirmableAjaxBorder;
 import org.apache.openmeetings.web.common.PagedEntityListPanel;
 import org.apache.openmeetings.web.common.UserPanel;
 import org.apache.openmeetings.web.data.DataViewContainer;
@@ -58,6 +59,7 @@ import org.apache.wicket.ajax.AbstractDe
 import org.apache.wicket.ajax.AjaxEventBehavior;
 import org.apache.wicket.ajax.AjaxRequestTarget;
 import org.apache.wicket.ajax.attributes.AjaxRequestAttributes;
+import 
org.apache.wicket.ajax.attributes.AjaxRequestAttributes.EventPropagation;
 import org.apache.wicket.ajax.form.OnChangeAjaxBehavior;
 import org.apache.wicket.behavior.AttributeAppender;
 import org.apache.wicket.core.request.handler.IPartialPageRequestHandler;
@@ -68,6 +70,7 @@ import org.apache.wicket.markup.html.bas
 import org.apache.wicket.markup.html.form.Button;
 import org.apache.wicket.markup.html.form.ChoiceRenderer;
 import org.apache.wicket.markup.html.form.DropDownChoice;
+import org.apache.wicket.markup.html.form.Form;
 import org.apache.wicket.markup.html.list.ListItem;
 import org.apache.wicket.markup.html.list.ListView;
 import org.apache.wicket.markup.repeater.Item;
@@ -81,8 +84,6 @@ import com.googlecode.wicket.jquery.core
 import com.googlecode.wicket.jquery.core.Options;
 import 
com.googlecode.wicket.jquery.ui.plugins.fixedheadertable.FixedHeaderTableBehavior;
 
-import ro.fortsoft.wicket.dashboard.web.util.ConfirmAjaxCallListener;
-
 public class MessagesContactsPanel extends UserPanel {
        private static final long serialVersionUID = 1L;
        private final static long MOVE_CHOOSE = -1;
@@ -314,24 +315,23 @@ public class MessagesContactsPanel exten
                        @Override
                        protected void populateItem(final 
ListItem<PrivateMessageFolder> item) {
                                item.add(new Label("name", 
item.getModelObject().getFolderName()));
-                               item.add(new 
WebMarkupContainer("delete").add(new AjaxEventBehavior("click") {
+                               item.add(new ConfirmableAjaxBorder("delete", 
getString("80"), getString("833")) {
                                        private static final long 
serialVersionUID = 1L;
-
+                                       
                                        @Override
-                                       protected void 
onEvent(AjaxRequestTarget target) {
+                                       protected void 
updateAjaxAttributes(AjaxRequestAttributes attributes) {
+                                               
attributes.setEventPropagation(EventPropagation.STOP_IMMEDIATE);
+                                       }
+                                       
+                                       @Override
+                                       protected void 
onSubmit(AjaxRequestTarget target, Form<?> form) {
                                                PrivateMessageFolderDao fDao = 
getBean(PrivateMessageFolderDao.class);
                                                
fDao.delete(item.getModelObject(), getUserId());
                                                
foldersModel.setObject(fDao.get(0, Integer.MAX_VALUE));
                                                updateMoveModel();
                                                target.add(folders, 
moveDropDown);
                                        }
-                                       
-                                       @Override
-                                       protected void 
updateAjaxAttributes(AjaxRequestAttributes attributes) {
-                                               
super.updateAjaxAttributes(attributes);
-                                               
attributes.getAjaxCallListeners().add(new 
ConfirmAjaxCallListener(Application.getString(713)));
-                                       }
-                               }));
+                               });
                                item.add(new AjaxEventBehavior("click") {
                                        private static final long 
serialVersionUID = 1L;
 

Modified: 
openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/common/ConfirmableAjaxBorder.java
URL: 
http://svn.apache.org/viewvc/openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/common/ConfirmableAjaxBorder.java?rev=1733800&r1=1733799&r2=1733800&view=diff
==============================================================================
--- 
openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/common/ConfirmableAjaxBorder.java
 (original)
+++ 
openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/common/ConfirmableAjaxBorder.java
 Sun Mar  6 10:21:42 2016
@@ -20,6 +20,7 @@ package org.apache.openmeetings.web.comm
 
 import org.apache.wicket.ajax.AjaxEventBehavior;
 import org.apache.wicket.ajax.AjaxRequestTarget;
+import org.apache.wicket.ajax.attributes.AjaxRequestAttributes;
 import org.apache.wicket.markup.html.border.Border;
 import org.apache.wicket.markup.html.form.Form;
 import org.apache.wicket.model.IModel;
@@ -62,6 +63,12 @@ public abstract class ConfirmableAjaxBor
                        private static final long serialVersionUID = 1L;
 
                        @Override
+                       protected void 
updateAjaxAttributes(AjaxRequestAttributes attributes) {
+                               super.updateAjaxAttributes(attributes);
+                               
ConfirmableAjaxBorder.this.updateAjaxAttributes(attributes);
+                       }
+                       
+                       @Override
                        protected void onEvent(AjaxRequestTarget target) {
                                dialog.open(target);
                        }
@@ -70,6 +77,14 @@ public abstract class ConfirmableAjaxBor
        }
 
        /**
+        * Gives a chance to the specializations to modify the attributes.
+        * 
+        * @param attributes attributes
+        */
+       protected void updateAjaxAttributes(AjaxRequestAttributes attributes) {
+       }
+       
+       /**
         * Triggered when the form is submitted, but the validation failed
         *
         * @param target the {@link AjaxRequestTarget}

Modified: 
openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/user/profile/MessagesContactsPanel.java
URL: 
http://svn.apache.org/viewvc/openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/user/profile/MessagesContactsPanel.java?rev=1733800&r1=1733799&r2=1733800&view=diff
==============================================================================
--- 
openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/user/profile/MessagesContactsPanel.java
 (original)
+++ 
openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/user/profile/MessagesContactsPanel.java
 Sun Mar  6 10:21:42 2016
@@ -45,6 +45,7 @@ import org.apache.openmeetings.db.entity
 import org.apache.openmeetings.web.admin.SearchableDataView;
 import org.apache.openmeetings.web.app.Application;
 import org.apache.openmeetings.web.common.AddFolderDialog;
+import org.apache.openmeetings.web.common.ConfirmableAjaxBorder;
 import org.apache.openmeetings.web.common.PagedEntityListPanel;
 import org.apache.openmeetings.web.common.UserPanel;
 import org.apache.openmeetings.web.data.DataViewContainer;
@@ -58,6 +59,7 @@ import org.apache.wicket.ajax.AbstractDe
 import org.apache.wicket.ajax.AjaxEventBehavior;
 import org.apache.wicket.ajax.AjaxRequestTarget;
 import org.apache.wicket.ajax.attributes.AjaxRequestAttributes;
+import 
org.apache.wicket.ajax.attributes.AjaxRequestAttributes.EventPropagation;
 import org.apache.wicket.ajax.form.OnChangeAjaxBehavior;
 import org.apache.wicket.behavior.AttributeAppender;
 import org.apache.wicket.core.request.handler.IPartialPageRequestHandler;
@@ -68,6 +70,7 @@ import org.apache.wicket.markup.html.bas
 import org.apache.wicket.markup.html.form.Button;
 import org.apache.wicket.markup.html.form.ChoiceRenderer;
 import org.apache.wicket.markup.html.form.DropDownChoice;
+import org.apache.wicket.markup.html.form.Form;
 import org.apache.wicket.markup.html.list.ListItem;
 import org.apache.wicket.markup.html.list.ListView;
 import org.apache.wicket.markup.repeater.Item;
@@ -81,8 +84,6 @@ import com.googlecode.wicket.jquery.core
 import com.googlecode.wicket.jquery.core.Options;
 import 
com.googlecode.wicket.jquery.ui.plugins.fixedheadertable.FixedHeaderTableBehavior;
 
-import ro.fortsoft.wicket.dashboard.web.util.ConfirmAjaxCallListener;
-
 public class MessagesContactsPanel extends UserPanel {
        private static final long serialVersionUID = 1L;
        private final static long MOVE_CHOOSE = -1;
@@ -314,24 +315,23 @@ public class MessagesContactsPanel exten
                        @Override
                        protected void populateItem(final 
ListItem<PrivateMessageFolder> item) {
                                item.add(new Label("name", 
item.getModelObject().getFolderName()));
-                               item.add(new 
WebMarkupContainer("delete").add(new AjaxEventBehavior("click") {
+                               item.add(new ConfirmableAjaxBorder("delete", 
getString("80"), getString("833")) {
                                        private static final long 
serialVersionUID = 1L;
-
+                                       
                                        @Override
-                                       protected void 
onEvent(AjaxRequestTarget target) {
+                                       protected void 
updateAjaxAttributes(AjaxRequestAttributes attributes) {
+                                               
attributes.setEventPropagation(EventPropagation.STOP_IMMEDIATE);
+                                       }
+                                       
+                                       @Override
+                                       protected void 
onSubmit(AjaxRequestTarget target, Form<?> form) {
                                                PrivateMessageFolderDao fDao = 
getBean(PrivateMessageFolderDao.class);
                                                
fDao.delete(item.getModelObject(), getUserId());
                                                
foldersModel.setObject(fDao.get(0, Integer.MAX_VALUE));
                                                updateMoveModel();
                                                target.add(folders, 
moveDropDown);
                                        }
-                                       
-                                       @Override
-                                       protected void 
updateAjaxAttributes(AjaxRequestAttributes attributes) {
-                                               
super.updateAjaxAttributes(attributes);
-                                               
attributes.getAjaxCallListeners().add(new 
ConfirmAjaxCallListener(Application.getString(713)));
-                                       }
-                               }));
+                               });
                                item.add(new AjaxEventBehavior("click") {
                                        private static final long 
serialVersionUID = 1L;
 


Reply via email to