Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into openlayers3_enhan…
Browse files Browse the repository at this point in the history
…cements
  • Loading branch information
ageery committed Aug 3, 2017
2 parents 0f13b8f + c2590ce commit 24a454e
Show file tree
Hide file tree
Showing 749 changed files with 8,065 additions and 8,025 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.metadata
.settings
.project
target/
Expand Down
10 changes: 2 additions & 8 deletions annotation/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.wicketstuff</groupId>
<artifactId>wicketstuff-core</artifactId>
<version>7.4.0-SNAPSHOT</version>
<version>8.0.0-SNAPSHOT</version>
</parent>

<artifactId>wicketstuff-annotation</artifactId>
Expand Down Expand Up @@ -35,18 +35,12 @@
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<scope>test</scope>
<artifactId>slf4j-simple</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>org.wicketstuff</groupId>
<artifactId>wicketstuff-annotationeventdispatcher-parent</artifactId>
<version>7.4.0-SNAPSHOT</version>
<version>8.0.0-SNAPSHOT</version>
</parent>

<artifactId>wicketstuff-annotationeventdispatcher</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import org.apache.wicket.Application;
import org.apache.wicket.Component;
import org.apache.wicket.event.IEvent;
import org.apache.wicket.request.RequestHandlerStack.ReplaceHandlerException;
import org.apache.wicket.request.RequestHandlerExecutor;
import org.apache.wicket.util.collections.ClassMetaCache;
import org.apache.wicket.util.visit.Visit;

Expand Down Expand Up @@ -135,7 +135,7 @@ private void onEvent(final Set<Method> onEventMethods, final Object sink, final
{
for (Method method : onEventMethods)
{
if (canCallListenerInterface(sink, method))
if (canCallListenerInterface(sink))
{
OnEvent onEvent = method.getAnnotation(OnEvent.class);
if (isPayloadApplicableToHandler(onEvent, payload))
Expand Down Expand Up @@ -164,9 +164,9 @@ else if (onEvent.stop())
}
} catch (InvocationTargetException e)
{
if (e.getCause() instanceof ReplaceHandlerException)
if (e.getCause() instanceof RequestHandlerExecutor.ReplaceHandlerException)
{
throw ((ReplaceHandlerException)e.getCause());
throw ((RequestHandlerExecutor.ReplaceHandlerException)e.getCause());
}
else
{
Expand All @@ -178,13 +178,13 @@ else if (onEvent.stop())
}
}

private boolean canCallListenerInterface(final Object obj, final Method method)
private boolean canCallListenerInterface(final Object obj)
{
boolean canCall = true;
if (obj instanceof Component)
{
Component c = (Component) obj;
canCall = c.canCallListenerInterface(method);
canCall = c.canCallListener();
}
return canCall;
}
Expand Down
2 changes: 1 addition & 1 deletion annotationeventdispatcher-parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.wicketstuff</groupId>
<artifactId>wicketstuff-core</artifactId>
<version>7.4.0-SNAPSHOT</version>
<version>8.0.0-SNAPSHOT</version>
</parent>
<artifactId>wicketstuff-annotationeventdispatcher-parent</artifactId>
<name>Annotation Event Dispatcher - Parent</name>
Expand Down
4 changes: 2 additions & 2 deletions async-tasks-parent/async-tasks-demo/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>org.wicketstuff</groupId>
<artifactId>async-tasks-parent</artifactId>
<version>7.4.0-SNAPSHOT</version>
<version>8.0.0-SNAPSHOT</version>
</parent>

<artifactId>async-task-demo</artifactId>
Expand Down Expand Up @@ -48,7 +48,7 @@
</plugin>
<!-- Jetty configuration -->
<plugin>
<groupId>org.mortbay.jetty</groupId>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<configuration>
<connectors>
Expand Down
2 changes: 1 addition & 1 deletion async-tasks-parent/async-tasks-impl/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.wicketstuff</groupId>
<artifactId>async-tasks-parent</artifactId>
<version>7.4.0-SNAPSHOT</version>
<version>8.0.0-SNAPSHOT</version>
</parent>

<artifactId>async-task-impl</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
import org.apache.wicket.util.time.Duration;
import org.wicketstuff.async.task.AbstractTaskContainer;

import java.lang.reflect.Method;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Optional;

/**
* A progress button which allows to control a {@link Runnable}. Each such button will refresh itself as given by
Expand All @@ -34,7 +34,7 @@ public class ProgressButton extends AjaxFallbackButton {
private final IRunnableFactory runnableFactory;
private final RefreshBehavior refreshBehavior;

private IModel<? extends AbstractTaskContainer> taskContainerModel;
private volatile IModel<? extends AbstractTaskContainer> taskContainerModel;

public ProgressButton(String id, Form<?> form, IModel<? extends AbstractTaskContainer> taskContainerModel, Duration duration) {
this(id, null, form, taskContainerModel, null, duration);
Expand Down Expand Up @@ -129,32 +129,28 @@ boolean canInterrupt() {
}

@Override
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
super.onSubmit(target, form);
protected void onSubmit(Optional<AjaxRequestTarget> targetOptional) {
super.onSubmit(targetOptional);

if (canStart() || canRestart()) {
getTaskContainer().submit(runnableFactory.getRunnable());
onTaskStart(target);
onTaskStart(targetOptional);
} else if (canInterrupt()) {
getTaskContainer().cancel();
} else {
return;
}

if (target != null) {
targetOptional.ifPresent(target -> {
activateRefresh(target);
renderAll(target);
}
});

concludeIfApplicable(target);
concludeIfApplicable(targetOptional);
}

private void activateRefresh(AjaxRequestTarget target) {
if (!getTaskContainer().isRunning()) {
if (getBehaviors(RefreshBehavior.class).size() > 0) {
refreshBehavior.stop(target);
}
} else if (getBehaviors(RefreshBehavior.class).size() == 0) {
if (getBehaviors(RefreshBehavior.class).size() == 0) {
add(refreshBehavior);
} else {
refreshBehavior.restart(target);
Expand All @@ -167,21 +163,21 @@ private void activateRefresh(AjaxRequestTarget target) {
* @param target The Ajax request target.
*/
protected void refresh(AjaxRequestTarget target) {
concludeIfApplicable(target);
concludeIfApplicable(Optional.of(target));
renderAll(target);
}

private void concludeIfApplicable(AjaxRequestTarget target) {
private void concludeIfApplicable(Optional<AjaxRequestTarget> targetOptional) {
if (!getTaskContainer().isRunning()) {
if (target != null) {
targetOptional.ifPresent(target -> {
refreshBehavior.stop(target);
}
});
if (getTaskContainer().isFailed()) {
onTaskError(target);
onTaskError(targetOptional);
} else if (!getTaskContainer().isCancelled()) {
onTaskSuccess(target);
onTaskSuccess(targetOptional);
} else {
onTaskCancel(target);
onTaskCancel(targetOptional);
}
}
}
Expand Down Expand Up @@ -209,7 +205,7 @@ protected void onTimer(AjaxRequestTarget target) {
}

@Override
public boolean canCallListenerInterface(Component component, Method method) {
public boolean canCallListener(Component component) {
// Skip check for the component being enabled
return component.isVisibleInHierarchy();
}
Expand Down Expand Up @@ -357,7 +353,7 @@ public void removeRefreshDependant(Component refreshDependant) {
*
* @param ajaxRequestTarget The Ajax request target. Might be {@code null}.
*/
protected void onTaskStart(AjaxRequestTarget ajaxRequestTarget) {
protected void onTaskStart(Optional<AjaxRequestTarget> ajaxRequestTarget) {
}

/**
Expand All @@ -367,7 +363,7 @@ protected void onTaskStart(AjaxRequestTarget ajaxRequestTarget) {
*
* @param ajaxRequestTarget The Ajax request target.
*/
protected void onTaskSuccess(AjaxRequestTarget ajaxRequestTarget) {
protected void onTaskSuccess(Optional<AjaxRequestTarget> ajaxRequestTarget) {
}

/**
Expand All @@ -377,7 +373,7 @@ protected void onTaskSuccess(AjaxRequestTarget ajaxRequestTarget) {
*
* @param ajaxRequestTarget The Ajax request target. Might be {@code null}.
*/
protected void onTaskCancel(AjaxRequestTarget ajaxRequestTarget) {
protected void onTaskCancel(Optional<AjaxRequestTarget> ajaxRequestTarget) {
}

/**
Expand All @@ -387,6 +383,6 @@ protected void onTaskCancel(AjaxRequestTarget ajaxRequestTarget) {
*
* @param ajaxRequestTarget The Ajax request target.
*/
protected void onTaskError(AjaxRequestTarget ajaxRequestTarget) {
protected void onTaskError(Optional<AjaxRequestTarget> ajaxRequestTarget) {
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,7 @@ public void testException() throws Exception {
formTester.submit("button");

assertTrue(page.isTaskStart());
// assertFalse(page.isTaskSuccess());
assertFalse(page.isTaskCancel());
// assertTrue(page.isTaskError());
}

@Test
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.wicketstuff.async.components;

import java.util.Optional;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;

Expand All @@ -18,7 +19,7 @@ public class TestPage extends WebPage implements IRunnableFactory {
private final ProgressButton button;
private final ProgressBar bar;
private final CountDownLatch latch = new CountDownLatch(1);
private Runnable runnable;
private volatile Runnable runnable;

private boolean taskStart, taskSuccess, taskCancel, taskError;

Expand All @@ -29,22 +30,22 @@ public TestPage() {
form = new Form<Void>("form");
button = new ProgressButton("button", form, Model.of(taskContainer), this, Duration.milliseconds(300L)) {
@Override
protected void onTaskStart(AjaxRequestTarget ajaxRequestTarget) {
protected void onTaskStart(Optional<AjaxRequestTarget> ajaxRequestTarget) {
taskStart = true;
}

@Override
protected void onTaskSuccess(AjaxRequestTarget ajaxRequestTarget) {
protected void onTaskSuccess(Optional<AjaxRequestTarget> ajaxRequestTarget) {
taskSuccess = true;
}

@Override
protected void onTaskCancel(AjaxRequestTarget ajaxRequestTarget) {
protected void onTaskCancel(Optional<AjaxRequestTarget> ajaxRequestTarget) {
taskCancel = true;
}

@Override
protected void onTaskError(AjaxRequestTarget ajaxRequestTarget) {
protected void onTaskError(Optional<AjaxRequestTarget> ajaxRequestTarget) {
taskError = true;
}
};
Expand Down
2 changes: 1 addition & 1 deletion async-tasks-parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.wicketstuff</groupId>
<artifactId>wicketstuff-core</artifactId>
<version>7.4.0-SNAPSHOT</version>
<version>8.0.0-SNAPSHOT</version>
</parent>

<artifactId>async-tasks-parent</artifactId>
Expand Down
7 changes: 4 additions & 3 deletions autocomplete-tagit-parent/autocomplete-tagit-examples/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>org.wicketstuff</groupId>
<artifactId>wicketstuff-autocomplete-tagit-parent</artifactId>
<version>7.4.0-SNAPSHOT</version>
<version>8.0.0-SNAPSHOT</version>
</parent>

<artifactId>wicketstuff-autocomplete-tagit-examples</artifactId>
Expand Down Expand Up @@ -43,13 +43,14 @@
<!-- JETTY DEPENDENCIES FOR TESTING -->
<dependency>
<groupId>org.eclipse.jetty.aggregate</groupId>
<artifactId>jetty-all-server</artifactId>
<artifactId>jetty-all</artifactId>
<classifier>uber</classifier>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
</plugin>
</plugins>
Expand Down
Loading

0 comments on commit 24a454e

Please sign in to comment.