Skip to content

The Unified and Autonomous Development Platform

midwork

robin shine5ecb86527dc8
diff --git a/commons.git/src/main/java/com/pmease/commons/git/command/BlameCommand.java b/commons.git/src/main/java/com/pmease/commons/git/command/BlameCommand.java
index 24a3ecae4c..61c79033b6 100644
--- a/commons.git/src/main/java/com/pmease/commons/git/command/BlameCommand.java
+++ b/commons.git/src/main/java/com/pmease/commons/git/command/BlameCommand.java
@@ -9,8 +9,8 @@ import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;
-import org.apache.commons.collections.map.AbstractReferenceMap;
-import org.apache.commons.collections.map.ReferenceMap;
+import org.apache.commons.collections4.map.AbstractReferenceMap.ReferenceStrength;
+import org.apache.commons.collections4.map.ReferenceMap;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -28,7 +28,8 @@ public class BlameCommand extends GitCommand<Map<String, Blame>> {
private static final Logger logger = LoggerFactory.getLogger(BlameCommand.class);
- private static final ReferenceMap cache = new ReferenceMap(AbstractReferenceMap.HARD, AbstractReferenceMap.SOFT);
+ private static final ReferenceMap<String, Map<String, Blame>> cache =
+ new ReferenceMap<>(ReferenceStrength.HARD, ReferenceStrength.SOFT);
private static final int CACHE_THRESHOLD = 1000;
@@ -63,8 +64,7 @@ public class BlameCommand extends GitCommand<Map<String, Blame>> {
String cacheKey = commitHash + ":" + file;
- @SuppressWarnings("unchecked")
- Map<String, Blame> cached = (Map<String, Blame>) cache.get(cacheKey);
+ Map<String, Blame> cached = cache.get(cacheKey);
if (cached != null)
return cached;
diff --git a/commons.util/pom.xml b/commons.util/pom.xml
index e7f1b6f030..ea4a2db295 100644
--- a/commons.util/pom.xml
+++ b/commons.util/pom.xml
@@ -82,8 +82,8 @@
<artifactId>commons-email</artifactId>
</dependency>
<dependency>
- <groupId>commons-collections</groupId>
- <artifactId>commons-collections</artifactId>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-collections4</artifactId>
</dependency>
<dependency>
<groupId>org.apache.ant</groupId>
diff --git a/commons.util/src/main/java/com/pmease/commons/util/LockUtils.java b/commons.util/src/main/java/com/pmease/commons/util/LockUtils.java
index d822934681..0ae03452ba 100644
--- a/commons.util/src/main/java/com/pmease/commons/util/LockUtils.java
+++ b/commons.util/src/main/java/com/pmease/commons/util/LockUtils.java
@@ -7,17 +7,16 @@ import java.util.concurrent.locks.ReadWriteLock;
import java.util.concurrent.locks.ReentrantLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;
-import org.apache.commons.collections.map.AbstractReferenceMap;
-import org.apache.commons.collections.map.ReferenceMap;
+import org.apache.commons.collections4.map.AbstractReferenceMap.ReferenceStrength;
+import org.apache.commons.collections4.map.ReferenceMap;
-@SuppressWarnings("unchecked")
public class LockUtils {
private final static Map<String, Lock> locks =
- new ReferenceMap(AbstractReferenceMap.HARD, AbstractReferenceMap.WEAK);
+ new ReferenceMap<String, Lock>(ReferenceStrength.HARD, ReferenceStrength.WEAK);
private final static Map<String, ReadWriteLock> rwLocks =
- new ReferenceMap(AbstractReferenceMap.HARD, AbstractReferenceMap.WEAK);
+ new ReferenceMap<String, ReadWriteLock>(ReferenceStrength.HARD, ReferenceStrength.WEAK);
/**
* Get named lock.
diff --git a/commons.wicket/src/main/java/com/pmease/commons/wicket/component/DropdownLink.java b/commons.wicket/src/main/java/com/pmease/commons/wicket/component/DropdownLink.java
index d93b98a5a5..eafbbcbb7d 100644
--- a/commons.wicket/src/main/java/com/pmease/commons/wicket/component/DropdownLink.java
+++ b/commons.wicket/src/main/java/com/pmease/commons/wicket/component/DropdownLink.java
@@ -12,8 +12,8 @@ import org.apache.wicket.request.cycle.RequestCycle;
import com.pmease.commons.wicket.component.floating.AlignPlacement;
import com.pmease.commons.wicket.component.floating.AlignTarget;
import com.pmease.commons.wicket.component.floating.ComponentTarget;
-import com.pmease.commons.wicket.component.floating.RectTarget;
import com.pmease.commons.wicket.component.floating.FloatingPanel;
+import com.pmease.commons.wicket.component.floating.RectTarget;
@SuppressWarnings("serial")
public abstract class DropdownLink extends AjaxLink<Void> {
@@ -67,7 +67,9 @@ public abstract class DropdownLink extends AjaxLink<Void> {
@Override
public void onClick(AjaxRequestTarget target) {
- if (dropdown == null) {
+ // if dropdown has not been created, or has been removed from page
+ // when the same page instance is refreshed
+ if (dropdown == null || dropdown.getParent() == null) {
AlignTarget alignFloatingWith;
if (alignTargetMouse) {
int mouseX = RequestCycle.get().getRequest().getRequestParameters()
diff --git a/commons.wicket/src/main/java/com/pmease/commons/wicket/component/modal/ModalLink.java b/commons.wicket/src/main/java/com/pmease/commons/wicket/component/modal/ModalLink.java
index 288ea68c87..99580c8f87 100644
--- a/commons.wicket/src/main/java/com/pmease/commons/wicket/component/modal/ModalLink.java
+++ b/commons.wicket/src/main/java/com/pmease/commons/wicket/component/modal/ModalLink.java
@@ -15,7 +15,9 @@ public abstract class ModalLink extends AjaxLink<Void> {
@Override
public void onClick(AjaxRequestTarget target) {
- if (modal == null) {
+ // if modal has not been created, or has been removed from page
+ // when the same page instance is refreshed
+ if (modal == null || modal.getParent() == null) {
modal = new ModalPanel(target) {
@Override
diff --git a/commons.wicket/src/main/java/com/vaynberg/wicket/select2/ApplicationSettings.java b/commons.wicket/src/main/java/com/vaynberg/wicket/select2/ApplicationSettings.java
new file mode 100644
index 0000000000..043f79b0d9
--- /dev/null
+++ b/commons.wicket/src/main/java/com/vaynberg/wicket/select2/ApplicationSettings.java
@@ -0,0 +1,154 @@
+/*
+ * Copyright 2012 Igor Vaynberg
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this work except in compliance with
+ * the License. You may obtain a copy of the License in the LICENSE file, or 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 com.vaynberg.wicket.select2;
+
+import java.io.Serializable;
+
+import org.apache.wicket.Application;
+import org.apache.wicket.MetaDataKey;
+import org.apache.wicket.protocol.http.WebApplication;
+import org.apache.wicket.request.resource.PackageResourceReference;
+import org.apache.wicket.request.resource.ResourceReference;
+
+/**
+ * Application-wide settings that apply to all Select2 components.
+ *
+ * The settings object is retreived via the static {@link #get()} method and is usually configured in the
+ * {@link WebApplication#init()} method.
+ *
+ * @author igor
+ */
+public class ApplicationSettings implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ private static final MetaDataKey<ApplicationSettings> KEY = new MetaDataKey<ApplicationSettings>() {
+
+ private static final long serialVersionUID = 1L;
+
+ };
+
+ private ResourceReference javaScriptReference = new PackageResourceReference(ApplicationSettings.class,
+ "res/select2.js");
+ private ResourceReference mouseWheelReference = new PackageResourceReference(ApplicationSettings.class,
+ "res/jquery.mousewheel.js");
+ private ResourceReference cssReference = new PackageResourceReference(ApplicationSettings.class,
+ "res/select2.css");
+ private ResourceReference jqueryUIReference = new PackageResourceReference(ApplicationSettings.class,
+ "res/jquery-ui-1.9.0.min.js");
+
+ private boolean includeMouseWheel = true;
+ private boolean includeJavascript = true;
+ private boolean includeCss = true;
+ private boolean includeJqueryUI = true;
+
+ /**
+ * Private constructor, use {@link #get()} instead.
+ */
+ private ApplicationSettings() {
+ }
+
+ public boolean isIncludeJavascript() {
+ return includeJavascript;
+ }
+
+ public ApplicationSettings setIncludeJavascript(boolean includeJavascript) {
+ this.includeJavascript = includeJavascript;
+ return this;
+ }
+
+ public boolean isIncludeCss() {
+ return includeCss;
+ }
+
+ public ApplicationSettings setIncludeCss(boolean includeCss) {
+ this.includeCss = includeCss;
+ return this;
+ }
+
+ public boolean isIncludeJqueryUI() {
+ return includeJqueryUI;
+ }
+
+ public ApplicationSettings setIncludeJqueryUI(boolean includeJqueryUI) {
+ this.includeJqueryUI = includeJqueryUI;
+ return this;
+ }
+
+ public ResourceReference getJavaScriptReference() {
+ return javaScriptReference;
+ }
+
+ public ApplicationSettings setJavaScriptReference(ResourceReference javaScriptReference) {
+ this.javaScriptReference = javaScriptReference;
+ return this;
+ }
+
+ public ResourceReference getCssReference() {
+ return cssReference;
+ }
+
+ public ApplicationSettings setCssReference(ResourceReference cssReference) {
+ this.cssReference = cssReference;
+ return this;
+ }
+
+ public boolean isIncludeMouseWheel() {
+ return includeMouseWheel;
+ }
+
+ public ApplicationSettings setIncludeMouseWheel(boolean includeJqueryMouseWheelPlugin) {
+ this.includeMouseWheel = includeJqueryMouseWheelPlugin;
+ return this;
+ }
+
+ public ResourceReference getMouseWheelReference() {
+ return mouseWheelReference;
+ }
+
+ public ApplicationSettings setMouseWheelReference(ResourceReference mousewheelReference) {
+ this.mouseWheelReference = mousewheelReference;
+ return this;
+ }
+
+ public ResourceReference getJqueryUIReference() {
+ return jqueryUIReference;
+ }
+
+ public ApplicationSettings setJqueryUIReference(ResourceReference jqueryUIReference) {
+ this.jqueryUIReference = jqueryUIReference;
+ return this;
+ }
+
+ /**
+ * Retrieves the instance of settings object.
+ *
+ * @return settings instance
+ */
+ public static ApplicationSettings get() {
+ // FIXME Application should provide setMetadataIfAbsent()
+ Application application = Application.get();
+ ApplicationSettings settings = application.getMetaData(KEY);
+ if (settings == null) {
+ synchronized (application) {
+ settings = application.getMetaData(KEY);
+ if (settings == null) {
+ settings = new ApplicationSettings();
+ application.setMetaData(KEY, settings);
+ }
+ }
+ }
+ return application.getMetaData(KEY);
+ }
+
+}
diff --git a/commons.wicket/src/main/java/com/vaynberg/wicket/select2/Select2ResourcesBehavior.java b/commons.wicket/src/main/java/com/vaynberg/wicket/select2/Select2ResourcesBehavior.java
new file mode 100644
index 0000000000..85a12821f2
--- /dev/null
+++ b/commons.wicket/src/main/java/com/vaynberg/wicket/select2/Select2ResourcesBehavior.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2012 Igor Vaynberg
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this work except in compliance with
+ * the License. You may obtain a copy of the License in the LICENSE file, or 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 com.vaynberg.wicket.select2;
+
+import org.apache.wicket.Application;
+import org.apache.wicket.Component;
+import org.apache.wicket.behavior.Behavior;
+import org.apache.wicket.markup.head.CssHeaderItem;
+import org.apache.wicket.markup.head.IHeaderResponse;
+import org.apache.wicket.markup.head.JavaScriptHeaderItem;
+
+/**
+ * Adds various resources needed by Select2 such as JavaScript and CSS. Which resources are added is controlled by the
+ * {@link ApplicationSettings} object. Minified versions of JavaScript resources will be used when the application is
+ * configured in deployment mode.
+ *
+ * @author igor
+ *
+ */
+public class Select2ResourcesBehavior extends Behavior {
+
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public void renderHead(Component component, IHeaderResponse response) {
+
+ final ApplicationSettings settings = ApplicationSettings.get();
+
+ // Include Wicket's provided jQuery reference
+ response.render(JavaScriptHeaderItem.forReference(Application.get().getJavaScriptLibrarySettings()
+ .getJQueryReference()));
+
+ if (settings.isIncludeMouseWheel()) {
+ response.render(JavaScriptHeaderItem.forReference(settings.getMouseWheelReference()));
+ }
+
+ if (settings.isIncludeJavascript()) {
+ response.render(JavaScriptHeaderItem.forReference(settings.getJavaScriptReference()));
+ }
+
+ if (settings.isIncludeCss()) {
+ response.render(CssHeaderItem.forReference(settings.getCssReference()));
+ }
+ }
+
+}
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/file/ContributionPanel.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/file/ContributionPanel.html
index ad70d3a0d0..c4d2b3913e 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/file/ContributionPanel.html
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/file/ContributionPanel.html
@@ -6,7 +6,7 @@
<div wicket:id="contributor" class="pull-left contributor"></div>
<div class="pull-left message"><a wicket:id="messageLink"><span wicket:id="message"></span></a></div>
<div class="contributors pull-left">
- <a wicket:id="contributors" class="btn btn-default btn-xs">Contributors <i class="fa fa-caret-down"></i></a>
+ <a wicket:id="contributors" title="Contributors" class="btn btn-default btn-xs"><i class="fa fa-group"></i> <i class="fa fa-caret-down"></i></a>
</div>
</div>
<wicket:fragment wicket:id="contributorsFrag">
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/overview/DepotOverviewPage.html b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/overview/DepotOverviewPage.html
index 6f4e9fca9a..40a4502155 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/overview/DepotOverviewPage.html
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/overview/DepotOverviewPage.html
@@ -1,6 +1,5 @@
<wicket:extend>
<div class="depot overview">
- <div wicket:id="title" class="title"></div>
<div wicket:id="description" class="description"></div>
<div class="metrics">
<a wicket:id="commitsLink"><span wicket:id="count"></span></a>
diff --git a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/overview/DepotOverviewPage.java b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/overview/DepotOverviewPage.java
index a3b30ec53f..f602605374 100644
--- a/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/overview/DepotOverviewPage.java
+++ b/gitplex.web/src/main/java/com/pmease/gitplex/web/page/depot/overview/DepotOverviewPage.java
@@ -68,8 +68,6 @@ public class DepotOverviewPage extends DepotPage {
protected void onInitialize() {
super.onInitialize();
- add(new Label("title", getDepot().getFQN()));
-
UrlManager urlManager = GitPlex.getInstance(UrlManager.class);
Model<String> cloneUrlModel = Model.of(urlManager.urlFor(getDepot()));
add(new TextField<String>("cloneUrl", cloneUrlModel));
diff --git a/parent.general/pom.xml b/parent.general/pom.xml
index b72d5844c3..bdc4759706 100644
--- a/parent.general/pom.xml
+++ b/parent.general/pom.xml
@@ -378,9 +378,9 @@
<version>2.2</version>
</dependency>
<dependency>
- <groupId>commons-collections</groupId>
- <artifactId>commons-collections</artifactId>
- <version>3.2.1</version>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-collections4</artifactId>
+ <version>4.1</version>
</dependency>
<dependency>
<groupId>org.javassist</groupId>