You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by mg...@apache.org on 2014/11/27 16:15:20 UTC

[1/2] wicket git commit: Non functional:

Repository: wicket
Updated Branches:
  refs/heads/master cf008bfd9 -> 5e0752602


Non functional:

- Java 7 diamonds
- inline member field as a local


Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/fbcb606f
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/fbcb606f
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/fbcb606f

Branch: refs/heads/master
Commit: fbcb606fbabecc82df34b231fafa75ae52dad0d7
Parents: cf008bf
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
Authored: Thu Nov 27 15:44:29 2014 +0100
Committer: Martin Tzvetanov Grigorov <mg...@apache.org>
Committed: Thu Nov 27 15:44:29 2014 +0100

----------------------------------------------------------------------
 .../org/apache/wicket/application/ReloadingClassLoader.java   | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/fbcb606f/wicket-core/src/main/java/org/apache/wicket/application/ReloadingClassLoader.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/application/ReloadingClassLoader.java b/wicket-core/src/main/java/org/apache/wicket/application/ReloadingClassLoader.java
index e31c915..83c413b 100644
--- a/wicket-core/src/main/java/org/apache/wicket/application/ReloadingClassLoader.java
+++ b/wicket-core/src/main/java/org/apache/wicket/application/ReloadingClassLoader.java
@@ -46,14 +46,12 @@ public class ReloadingClassLoader extends URLClassLoader
 {
 	private static final Logger log = LoggerFactory.getLogger(ReloadingClassLoader.class);
 
-	private static final Set<URL> urls = new TreeSet<URL>(new UrlExternalFormComparator());
+	private static final Set<URL> urls = new TreeSet<>(new UrlExternalFormComparator());
 
-	private static final List<String> patterns = new ArrayList<String>();
+	private static final List<String> patterns = new ArrayList<>();
 
 	private IChangeListener listener;
 
-	private final Duration pollFrequency = Duration.seconds(3);
-
 	private final IModificationWatcher watcher;
 
 	static
@@ -204,6 +202,7 @@ public class ReloadingClassLoader extends URLClassLoader
 		{
 			addURL(url);
 		}
+		Duration pollFrequency = Duration.seconds(3);
 		watcher = new ModificationWatcher(pollFrequency);
 	}
 


[2/2] wicket git commit: WICKET-5778 Pass the IModifiable to the IChangeListener in ModificationWatcher

Posted by mg...@apache.org.
WICKET-5778 Pass the IModifiable to the IChangeListener in ModificationWatcher

Introduce temporary interface IChangeListener2 that can be used when one needs the changed object as a parameter


Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/5e075260
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/5e075260
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/5e075260

Branch: refs/heads/master
Commit: 5e0752602cb96ef3786e4e15acabbe12e4e0df28
Parents: fbcb606
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
Authored: Thu Nov 27 15:45:17 2014 +0100
Committer: Martin Tzvetanov Grigorov <mg...@apache.org>
Committed: Thu Nov 27 16:15:01 2014 +0100

----------------------------------------------------------------------
 .../wicket/util/listener/ChangeListenerSet.java | 24 ++++++++++++--
 .../wicket/util/listener/IChangeListener2.java  | 34 ++++++++++++++++++++
 .../wicket/util/watch/ModificationWatcher.java  |  2 +-
 3 files changed, 56 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/5e075260/wicket-util/src/main/java/org/apache/wicket/util/listener/ChangeListenerSet.java
----------------------------------------------------------------------
diff --git a/wicket-util/src/main/java/org/apache/wicket/util/listener/ChangeListenerSet.java b/wicket-util/src/main/java/org/apache/wicket/util/listener/ChangeListenerSet.java
index 761d18e..add35e6 100644
--- a/wicket-util/src/main/java/org/apache/wicket/util/listener/ChangeListenerSet.java
+++ b/wicket-util/src/main/java/org/apache/wicket/util/listener/ChangeListenerSet.java
@@ -16,6 +16,8 @@
  */
 package org.apache.wicket.util.listener;
 
+import org.apache.wicket.util.watch.IModifiable;
+
 /**
  * Holds a set of IChangeListeners.
  * 
@@ -28,9 +30,6 @@ public final class ChangeListenerSet extends ListenerCollection<IChangeListener>
 {
 	private static final long serialVersionUID = 1L;
 
-	/**
-	 * 
-	 */
 	public void notifyListeners()
 	{
 		notify(new INotifier<IChangeListener>()
@@ -42,4 +41,23 @@ public final class ChangeListenerSet extends ListenerCollection<IChangeListener>
 			}
 		});
 	}
+
+	public void notifyListeners(final IModifiable modifiable)
+	{
+		notify(new INotifier<IChangeListener>()
+		{
+			@Override
+			public void notify(final IChangeListener listener)
+			{
+				if (listener instanceof IChangeListener2)
+				{
+					((IChangeListener2) listener).onChange(modifiable);
+				}
+				else
+				{
+					listener.onChange();
+				}
+			}
+		});
+	}
 }

http://git-wip-us.apache.org/repos/asf/wicket/blob/5e075260/wicket-util/src/main/java/org/apache/wicket/util/listener/IChangeListener2.java
----------------------------------------------------------------------
diff --git a/wicket-util/src/main/java/org/apache/wicket/util/listener/IChangeListener2.java b/wicket-util/src/main/java/org/apache/wicket/util/listener/IChangeListener2.java
new file mode 100644
index 0000000..d6ffa35
--- /dev/null
+++ b/wicket-util/src/main/java/org/apache/wicket/util/listener/IChangeListener2.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wicket.util.listener;
+
+import org.apache.wicket.util.watch.IModifiable;
+
+/**
+ * Generic "something changed" listener interface that also provides the
+ * changed object as an argument.
+ */
+// TODO Wicket 8: Rename to IChangeListener and remove the old one
+public interface IChangeListener2<T extends IModifiable> extends IChangeListener
+{
+	/**
+	 * Client method that is called to indicate that something changed.
+	 *
+	 * @param modifiable The object that has changed
+	 */
+	void onChange(T modifiable);
+}

http://git-wip-us.apache.org/repos/asf/wicket/blob/5e075260/wicket-util/src/main/java/org/apache/wicket/util/watch/ModificationWatcher.java
----------------------------------------------------------------------
diff --git a/wicket-util/src/main/java/org/apache/wicket/util/watch/ModificationWatcher.java b/wicket-util/src/main/java/org/apache/wicket/util/watch/ModificationWatcher.java
index 8af963d..4f260fa 100644
--- a/wicket-util/src/main/java/org/apache/wicket/util/watch/ModificationWatcher.java
+++ b/wicket-util/src/main/java/org/apache/wicket/util/watch/ModificationWatcher.java
@@ -159,7 +159,7 @@ public class ModificationWatcher implements IModificationWatcher
 					modifiableLastModified.after(entry.lastModifiedTime))
 			{
 				// Notify all listeners that the modifiable was modified
-				entry.listeners.notifyListeners();
+				entry.listeners.notifyListeners(entry.modifiable);
 
 				// Update timestamp
 				entry.lastModifiedTime = modifiableLastModified;