Reuse code that was moved to gwtexpui
All of this code has been refactored into the non-application specific
package gwtexpui. Instead of keeping our own copies lets use the more
common package version of it.
Signed-off-by: Shawn O. Pearce <sop@google.com>
diff --git a/pom.xml b/pom.xml
index cae665a..ba44425 100644
--- a/pom.xml
+++ b/pom.xml
@@ -442,6 +442,13 @@
</dependency>
<dependency>
+ <groupId>gwtexpui</groupId>
+ <artifactId>gwtexpui</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
<groupId>gerrit</groupId>
<artifactId>executablewar</artifactId>
<version>1.0</version>
diff --git a/src/main/java/com/google/gerrit/Gerrit.gwt.xml b/src/main/java/com/google/gerrit/Gerrit.gwt.xml
index 31a53ea..97f19ba 100644
--- a/src/main/java/com/google/gerrit/Gerrit.gwt.xml
+++ b/src/main/java/com/google/gerrit/Gerrit.gwt.xml
@@ -2,6 +2,10 @@
<inherits name='com.google.gwt.user.User'/>
<inherits name='com.google.gwtjsonrpc.GWTJSONRPC'/>
<inherits name='com.google.gwtorm.GWTORM'/>
+ <inherits name='com.google.gwtexpui.clippy.Clippy'/>
+ <inherits name='com.google.gwtexpui.progress.Progress'/>
+ <inherits name='com.google.gwtexpui.safehtml.SafeHtml'/>
+
<inherits name='com.google.gwt.user.theme.chrome.Chrome'/>
<inherits name='com.google.gerrit.UserAgent'/>
<extend-property name="locale" values="en"/>
diff --git a/src/main/java/com/google/gerrit/client/ErrorDialog.java b/src/main/java/com/google/gerrit/client/ErrorDialog.java
index c5467e4..a95e49d 100644
--- a/src/main/java/com/google/gerrit/client/ErrorDialog.java
+++ b/src/main/java/com/google/gerrit/client/ErrorDialog.java
@@ -15,12 +15,12 @@
package com.google.gerrit.client;
import com.google.gerrit.client.rpc.Common;
-import com.google.gerrit.client.ui.AutoCenterDialogBox;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.ClickListener;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.Widget;
+import com.google.gwtexpui.user.client.AutoCenterDialogBox;
import com.google.gwtjsonrpc.client.RemoteJsonException;
/** A dialog box showing an error message, when bad things happen. */
diff --git a/src/main/java/com/google/gerrit/client/SignInDialog.java b/src/main/java/com/google/gerrit/client/SignInDialog.java
index d7046c1..eaa61b8 100644
--- a/src/main/java/com/google/gerrit/client/SignInDialog.java
+++ b/src/main/java/com/google/gerrit/client/SignInDialog.java
@@ -20,7 +20,6 @@
import com.google.gerrit.client.reviewdb.Account;
import com.google.gerrit.client.rpc.Common;
import com.google.gerrit.client.rpc.GerritCallback;
-import com.google.gerrit.client.ui.AutoCenterDialogBox;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.Command;
import com.google.gwt.user.client.DeferredCommand;
@@ -29,6 +28,7 @@
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.Widget;
+import com.google.gwtexpui.user.client.AutoCenterDialogBox;
import com.google.gwtjsonrpc.client.CallbackHandle;
/**
diff --git a/src/main/java/com/google/gerrit/client/account/ContactPanel.java b/src/main/java/com/google/gerrit/client/account/ContactPanel.java
index 6714156..55b6681 100644
--- a/src/main/java/com/google/gerrit/client/account/ContactPanel.java
+++ b/src/main/java/com/google/gerrit/client/account/ContactPanel.java
@@ -20,7 +20,6 @@
import com.google.gerrit.client.reviewdb.ContactInformation;
import com.google.gerrit.client.rpc.Common;
import com.google.gerrit.client.rpc.GerritCallback;
-import com.google.gerrit.client.ui.AutoCenterDialogBox;
import com.google.gerrit.client.ui.TextSaveButtonListener;
import com.google.gwt.i18n.client.LocaleInfo;
import com.google.gwt.user.client.ui.Button;
@@ -40,6 +39,7 @@
import com.google.gwt.user.client.ui.TextBox;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;
+import com.google.gwtexpui.user.client.AutoCenterDialogBox;
import com.google.gwtjsonrpc.client.VoidResult;
import java.sql.Timestamp;
diff --git a/src/main/java/com/google/gerrit/client/changes/ChangeInfoBlock.java b/src/main/java/com/google/gerrit/client/changes/ChangeInfoBlock.java
index a11921b..da085e7 100644
--- a/src/main/java/com/google/gerrit/client/changes/ChangeInfoBlock.java
+++ b/src/main/java/com/google/gerrit/client/changes/ChangeInfoBlock.java
@@ -21,12 +21,12 @@
import com.google.gerrit.client.reviewdb.Change;
import com.google.gerrit.client.ui.AccountDashboardLink;
import com.google.gerrit.client.ui.ChangeLink;
-import com.google.gerrit.client.ui.CopyableText;
import com.google.gerrit.client.ui.ProjectOpenLink;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.Grid;
import com.google.gwt.user.client.ui.HTMLTable.CellFormatter;
+import com.google.gwtexpui.clippy.client.CopyableLabel;
public class ChangeInfoBlock extends Composite {
private static final int R_OWNER = 0;
@@ -84,7 +84,7 @@
final FlowPanel fp = new FlowPanel();
fp.add(new ChangeLink(Util.C.changePermalink(), chg.getId()));
- fp.add(new CopyableText(ChangeLink.permalink(chg.getId()), false));
+ fp.add(new CopyableLabel(ChangeLink.permalink(chg.getId()), false));
table.setWidget(R_PERMALINK, 1, fp);
}
}
diff --git a/src/main/java/com/google/gerrit/client/changes/PatchSetPanel.java b/src/main/java/com/google/gerrit/client/changes/PatchSetPanel.java
index af95b25..34b7c0a 100644
--- a/src/main/java/com/google/gerrit/client/changes/PatchSetPanel.java
+++ b/src/main/java/com/google/gerrit/client/changes/PatchSetPanel.java
@@ -31,7 +31,6 @@
import com.google.gerrit.client.reviewdb.UserIdentity;
import com.google.gerrit.client.rpc.Common;
import com.google.gerrit.client.rpc.GerritCallback;
-import com.google.gerrit.client.ui.CopyableText;
import com.google.gerrit.client.ui.DomUtil;
import com.google.gerrit.client.ui.RefreshListener;
import com.google.gwt.user.client.Window;
@@ -45,6 +44,7 @@
import com.google.gwt.user.client.ui.Panel;
import com.google.gwt.user.client.ui.Widget;
import com.google.gwt.user.client.ui.HTMLTable.CellFormatter;
+import com.google.gwtexpui.clippy.client.CopyableLabel;
import com.google.gwtjsonrpc.client.VoidResult;
import java.util.ArrayList;
@@ -181,7 +181,7 @@
r.append(changeDetail.getChange().getChangeId());
r.append("/");
r.append(patchSet.getPatchSetId());
- downloads.add(new CopyableText(r.toString()));
+ downloads.add(new CopyableLabel(r.toString()));
}
if (changeDetail.isAllowsAnonymous()
@@ -196,7 +196,7 @@
r.append(projectName);
r.append(" ");
r.append(patchSet.getRefName());
- downloads.add(new CopyableText(r.toString()));
+ downloads.add(new CopyableLabel(r.toString()));
} else if (Gerrit.isSignedIn() && Gerrit.getUserAccount() != null
&& Gerrit.getUserAccount().getSshUserName() != null
@@ -216,7 +216,7 @@
r.append(projectName);
r.append(" ");
r.append(patchSet.getRefName());
- downloads.add(new CopyableText(r.toString()));
+ downloads.add(new CopyableLabel(r.toString()));
}
infoTable.setWidget(R_DOWNLOAD, 1, downloads);
diff --git a/src/main/java/com/google/gerrit/client/changes/PatchTable.java b/src/main/java/com/google/gerrit/client/changes/PatchTable.java
index e5c073c..3c60775 100644
--- a/src/main/java/com/google/gerrit/client/changes/PatchTable.java
+++ b/src/main/java/com/google/gerrit/client/changes/PatchTable.java
@@ -19,12 +19,12 @@
import com.google.gerrit.client.reviewdb.PatchSet;
import com.google.gerrit.client.ui.DomUtil;
import com.google.gerrit.client.ui.FancyFlexTable;
-import com.google.gerrit.client.ui.ProgressMeter;
import com.google.gwt.user.client.DeferredCommand;
import com.google.gwt.user.client.History;
import com.google.gwt.user.client.IncrementalCommand;
import com.google.gwt.user.client.ui.SourcesTableEvents;
import com.google.gwt.user.client.ui.TableListener;
+import com.google.gwtexpui.progress.client.ProgressBar;
import java.util.List;
@@ -160,7 +160,7 @@
private int stage;
private int row;
private double start;
- private ProgressMeter meter;
+ private ProgressBar meter;
private DisplayCommand(final List<Patch> list) {
this.list = list;
@@ -216,7 +216,7 @@
void initMeter() {
if (meter == null) {
resetHtml("<tr><td></td></tr>");
- meter = new ProgressMeter(Util.M.loadingPatchSet(psid.get()));
+ meter = new ProgressBar(Util.M.loadingPatchSet(psid.get()));
table.setWidget(0, 0, meter);
}
updateMeter();
diff --git a/src/main/java/com/google/gerrit/client/ui/AutoCenterDialogBox.java b/src/main/java/com/google/gerrit/client/ui/AutoCenterDialogBox.java
deleted file mode 100644
index e10cf72..0000000
--- a/src/main/java/com/google/gerrit/client/ui/AutoCenterDialogBox.java
+++ /dev/null
@@ -1,63 +0,0 @@
-// Copyright 2008 Google Inc.
-//
-// Licensed 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 com.google.gerrit.client.ui;
-
-import com.google.gwt.user.client.Window;
-import com.google.gwt.user.client.WindowResizeListener;
-import com.google.gwt.user.client.ui.DialogBox;
-
-/** A DialogBox that automatically re-centers itself if the window changes */
-public class AutoCenterDialogBox extends DialogBox {
- private WindowResizeListener recenter;
-
- public AutoCenterDialogBox() {
- }
-
- public AutoCenterDialogBox(final boolean autoHide) {
- super(autoHide);
- }
-
- public AutoCenterDialogBox(final boolean autoHide, final boolean modal) {
- super(autoHide, modal);
- }
-
- @Override
- public void show() {
- if (recenter == null) {
- recenter = new WindowResizeListener() {
- public void onWindowResized(final int width, final int height) {
- onResize(width, height);
- }
- };
- Window.addWindowResizeListener(recenter);
- }
- super.show();
- }
-
- @Override
- protected void onUnload() {
- if (recenter != null) {
- Window.removeWindowResizeListener(recenter);
- recenter = null;
- }
- super.onUnload();
- }
-
- protected void onResize(final int width, final int height) {
- if (isAttached()) {
- center();
- }
- }
-}
diff --git a/src/main/java/com/google/gerrit/client/ui/CopyableText.java b/src/main/java/com/google/gerrit/client/ui/CopyableText.java
deleted file mode 100644
index 618a952..0000000
--- a/src/main/java/com/google/gerrit/client/ui/CopyableText.java
+++ /dev/null
@@ -1,121 +0,0 @@
-// Copyright 2009 Google Inc.
-//
-// Licensed 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 com.google.gerrit.client.ui;
-
-import com.google.gwt.user.client.Command;
-import com.google.gwt.user.client.DeferredCommand;
-import com.google.gwt.user.client.ui.ClickListener;
-import com.google.gwt.user.client.ui.Composite;
-import com.google.gwt.user.client.ui.FlowPanel;
-import com.google.gwt.user.client.ui.FocusListener;
-import com.google.gwt.user.client.ui.InlineLabel;
-import com.google.gwt.user.client.ui.KeyboardListenerAdapter;
-import com.google.gwt.user.client.ui.Label;
-import com.google.gwt.user.client.ui.TextBox;
-import com.google.gwt.user.client.ui.Widget;
-
-public class CopyableText extends Composite implements ClickListener {
- private static final CopyableTextImpl impl;
-
- static {
- if (UserAgent.hasFlash) {
- impl = new CopyableTextImplFlash();
- } else {
- impl = new CopyableTextImpl();
- }
- }
-
- private final FlowPanel content;
- private final String text;
- private Label textLabel;
- private TextBox textBox;
-
- public CopyableText(final String str) {
- this(str, true);
- }
-
- public CopyableText(final String str, final boolean showLabel) {
- content = new FlowPanel();
- content.setStyleName("gerrit-CopyableText");
- initWidget(content);
-
- text = str;
- if (showLabel) {
- textLabel = new InlineLabel(getText());
- textLabel.setStyleName("gerrit-CopyableText-Label");
- textLabel.addClickListener(this);
- content.add(textLabel);
- }
- impl.inject(this);
- }
-
- public String getText() {
- return text;
- }
-
- public void onClick(final Widget source) {
- if (textLabel == source) {
- showTextBox();
- }
- }
-
- private void showTextBox() {
- if (textBox == null) {
- textBox = new TextBox();
- textBox.setText(getText());
- textBox.setVisibleLength(getText().length());
- textBox.addKeyboardListener(new KeyboardListenerAdapter() {
- @Override
- public void onKeyPress(final Widget sender, final char kc, final int mod) {
- if ((mod & MODIFIER_CTRL) == MODIFIER_CTRL
- || (mod & MODIFIER_META) == MODIFIER_META) {
- switch (kc) {
- case 'c':
- case 'x':
- DeferredCommand.addCommand(new Command() {
- public void execute() {
- hideTextBox();
- }
- });
- break;
- }
- }
- }
- });
- textBox.addFocusListener(new FocusListener() {
- public void onFocus(Widget arg0) {
- }
-
- public void onLostFocus(Widget arg0) {
- hideTextBox();
- }
- });
- content.insert(textBox, 1);
- }
-
- textLabel.setVisible(false);
- textBox.setVisible(true);
- textBox.selectAll();
- textBox.setFocus(true);
- }
-
- private void hideTextBox() {
- if (textBox != null) {
- textBox.removeFromParent();
- textBox = null;
- }
- textLabel.setVisible(true);
- }
-}
diff --git a/src/main/java/com/google/gerrit/client/ui/CopyableTextImpl.java b/src/main/java/com/google/gerrit/client/ui/CopyableTextImpl.java
deleted file mode 100644
index 647ea95..0000000
--- a/src/main/java/com/google/gerrit/client/ui/CopyableTextImpl.java
+++ /dev/null
@@ -1,20 +0,0 @@
-// Copyright 2009 Google Inc.
-//
-// Licensed 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 com.google.gerrit.client.ui;
-
-class CopyableTextImpl {
- void inject(final CopyableText widget) {
- }
-}
diff --git a/src/main/java/com/google/gerrit/client/ui/CopyableTextImplFlash.java b/src/main/java/com/google/gerrit/client/ui/CopyableTextImplFlash.java
deleted file mode 100644
index 484e8a2..0000000
--- a/src/main/java/com/google/gerrit/client/ui/CopyableTextImplFlash.java
+++ /dev/null
@@ -1,71 +0,0 @@
-// Copyright 2009 Google Inc.
-//
-// Licensed 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 com.google.gerrit.client.ui;
-
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.http.client.URL;
-import com.google.gwt.user.client.DOM;
-import com.google.gwt.user.client.Element;
-
-class CopyableTextImplFlash extends CopyableTextImpl {
- private static final int SWF_WIDTH = 110;
- private static final int SWF_HEIGHT = 14;
- private static final String swfUrl =
- GWT.getModuleBaseURL() + "clippy1.cache.swf";
-
- @Override
- void inject(final CopyableText widget) {
- final String flashVars = "text=" + URL.encodeComponent(widget.getText());
- final StringBuilder html = new StringBuilder();
-
- final Element span = DOM.createSpan();
- DOM.setElementProperty(span, "className", "gerrit-CopyableText-SWF");
- html.append("<object");
- html.append(" classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\"");
- html.append(" width=\"" + SWF_WIDTH + "\"");
- html.append(" height=\"" + SWF_HEIGHT + "\"");
- html.append(">");
- param(html, "movie", swfUrl);
- param(html, "FlashVars", flashVars);
-
- html.append("<embed ");
- html.append(" type=\"application/x-shockwave-flash\"");
- html.append(" width=\"" + SWF_WIDTH + "\"");
- html.append(" height=\"" + SWF_HEIGHT + "\"");
- attribute(html, "src", swfUrl);
- attribute(html, "FlashVars", flashVars);
- html.append("/>");
-
- html.append("</object>");
-
- DOM.setInnerHTML(span, html.toString());
- DOM.appendChild(widget.getElement(), span);
- }
-
- private static void param(StringBuilder html, String name, String value) {
- html.append("<param");
- attribute(html, "name", name);
- attribute(html, "value", value);
- html.append("/>");
- }
-
- private static void attribute(StringBuilder html, String name, String value) {
- html.append(" ");
- html.append(name);
- html.append("=\"");
- html.append(DomUtil.escape(value));
- html.append("\"");
- }
-}
diff --git a/src/main/java/com/google/gerrit/client/ui/DomUtil.java b/src/main/java/com/google/gerrit/client/ui/DomUtil.java
index 56e147c..3ae0abf 100644
--- a/src/main/java/com/google/gerrit/client/ui/DomUtil.java
+++ b/src/main/java/com/google/gerrit/client/ui/DomUtil.java
@@ -14,92 +14,29 @@
package com.google.gerrit.client.ui;
-import com.google.gwt.core.client.GWT;
+import com.google.gwtexpui.safehtml.client.SafeHtmlBuilder;
/** Utilities for dealing with the DOM. */
public abstract class DomUtil {
- private static final Impl INSTANCE;
-
- static {
- if (GWT.isClient())
- INSTANCE = new ClientImpl();
- else
- INSTANCE = new JavaImpl();
- }
-
/** Escape XML/HTML special characters in the input string. */
public static String escape(final String in) {
- return INSTANCE.escape(in);
+ return new SafeHtmlBuilder().append(in).asString();
}
/** Convert bare URLs into <a href> tags. */
public static String linkify(final String in) {
- return INSTANCE.linkify(in);
+ return in.replaceAll("(https?://[^ \n\r\t]*)", "<a href=\"$1\">$1</a>");
}
/** Do wiki style formatting to make it pretty */
public static String wikify(String in) {
- in = INSTANCE.escape(in);
- in = INSTANCE.linkify(in);
- in = INSTANCE.wikify(in);
+ in = escape(in);
+ in = linkify(in);
+ in = in.replaceAll("(^|\n)([ \t][^\n]*)", "$1<span class=\"gerrit-preformat\">$2</span><br />");
+ in = in.replaceAll("\n\n", "<p>\n");
return in;
}
private DomUtil() {
}
-
- private static abstract class Impl {
- abstract String escape(String in);
-
- String wikify(String s) {
- s = s.replaceAll("(^|\n)([ \t][^\n]*)", "$1<span class=\"gerrit-preformat\">$2</span><br />");
- s = s.replaceAll("\n\n", "<p>\n");
- return s;
- }
-
- String linkify(String in) {
- return in.replaceAll("(https?://[^ \n\r\t]*)", "<a href=\"$1\">$1</a>");
- }
- }
-
- private static class ClientImpl extends Impl {
- @Override
- native String escape(String src)
- /*-{ return src.replace(/&/g,'&')
- .replace(/>/g,'>')
- .replace(/</g,'<')
- .replace(/"/g,'"')
- .replace(/'/g,''')
- ; }-*/;
- }
-
- private static class JavaImpl extends Impl {
- @Override
- String escape(final String in) {
- final StringBuilder r = new StringBuilder(in.length());
- for (int i = 0; i < in.length(); i++) {
- final char c = in.charAt(i);
- switch (c) {
- case '&':
- r.append("&");
- break;
- case '>':
- r.append(">");
- break;
- case '<':
- r.append("<");
- break;
- case '"':
- r.append(""");
- break;
- case '\'':
- r.append("'");
- break;
- default:
- r.append(c);
- }
- }
- return r.toString();
- }
- }
}
diff --git a/src/main/java/com/google/gerrit/client/ui/ProgressMeter.java b/src/main/java/com/google/gerrit/client/ui/ProgressMeter.java
deleted file mode 100644
index 8193d59..0000000
--- a/src/main/java/com/google/gerrit/client/ui/ProgressMeter.java
+++ /dev/null
@@ -1,55 +0,0 @@
-// Copyright 2009 Google Inc.
-//
-// Licensed 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 com.google.gerrit.client.ui;
-
-import com.google.gwt.user.client.ui.Composite;
-import com.google.gwt.user.client.ui.FlowPanel;
-import com.google.gwt.user.client.ui.Label;
-
-public class ProgressMeter extends Composite {
- private final String callerText;
- private final Label bar;
- private final Label msg;
-
- public ProgressMeter() {
- this("");
- }
-
- public ProgressMeter(final String text) {
- if (text == null || text.length() == 0) {
- callerText = "";
- } else {
- callerText = text + " ";
- }
-
- final FlowPanel body = new FlowPanel();
- body.setStyleName("gerrit-ProgressMeter");
-
- msg = new Label(callerText);
- msg.setStyleName("gerrit-ProgressMeterText");
- body.add(msg);
-
- bar = new Label("");
- bar.setStyleName("gerrit-ProgressMeterBar");
- body.add(bar);
-
- initWidget(body);
- }
-
- public void setValue(final int v) {
- bar.setWidth("" + (2 * v) + "px");
- msg.setText(callerText + v + "%");
- }
-}
diff --git a/src/main/java/com/google/gerrit/client/ui/UserAgent.java b/src/main/java/com/google/gerrit/client/ui/UserAgent.java
deleted file mode 100644
index 5b6e193..0000000
--- a/src/main/java/com/google/gerrit/client/ui/UserAgent.java
+++ /dev/null
@@ -1,50 +0,0 @@
-// Copyright 2009 Google Inc.
-//
-// Licensed 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 com.google.gerrit.client.ui;
-
-/**
- * User agent feature tests we don't create permutations for.
- * <p>
- * Some features aren't worth creating full permutations in GWT for, as it each
- * new boolean permutation (only two settings) doubles the compile time
- * required. If the setting only affects a couple of lines of JavaScript code,
- * the slightly larger cache files for user agents that lack the functionality
- * requested is trivial compared to the time developers lose building Gerrit.
- */
-public class UserAgent {
- /** Does the browser have ShockwaveFlash plugin enabled? */
- public static final boolean hasFlash = hasFlash();
-
- private static native boolean hasFlash()
- /*-{
- if (navigator.plugins && navigator.plugins.length) {
- if (navigator.plugins['Shockwave Flash']) return true;
- if (navigator.plugins['Shockwave Flash 2.0']) return true;
-
- } else if (navigator.mimeTypes && navigator.mimeTypes.length) {
- var mimeType = navigator.mimeTypes['application/x-shockwave-flash'];
- if (mimeType && mimeType.enabledPlugin) return true;
-
- } else {
- try { new ActiveXObject('ShockwaveFlash.ShockwaveFlash.7'); return true; } catch (e) {}
- try { new ActiveXObject('ShockwaveFlash.ShockwaveFlash.6'); return true; } catch (e) {}
- try { new ActiveXObject('ShockwaveFlash.ShockwaveFlash'); return true; } catch (e) {}
- }
- return false;
- }-*/;
-
- private UserAgent() {
- }
-}
diff --git a/src/main/java/com/google/gerrit/public/Gerrit.css b/src/main/java/com/google/gerrit/public/Gerrit.css
index c219cd1..59d1f4f 100644
--- a/src/main/java/com/google/gerrit/public/Gerrit.css
+++ b/src/main/java/com/google/gerrit/public/Gerrit.css
@@ -72,42 +72,6 @@
font-weight: bold;
}
-.gerrit-ProgressMeter {
- position: relative;
- border: 1px solid #6B90DA;
- height: 20px;
- width: 200px;
-}
-.gerrit-ProgressMeterText {
- position: absolute;
- bottom: 0;
- left: 0;
- z-index: 2;
- width: 200px;
- padding-bottom: 3px;
- text-align: center;
- font-weight: bold;
- font-style: italic;
- font-size: smaller;
-}
-.gerrit-ProgressMeterBar {
- background: #F0F7F9;
- border-right: 1px solid #D0D7D9;
- position: absolute;
- top: 0;
- left: 0;
- height: 20px;
-}
-
-.gerrit-CopyableText {
-}
-.gerrit-CopyableText-Label {
- vertical-align: top;
-}
-.gerrit-CopyableText-SWF {
- margin-left: 5px;
-}
-
/** Menu **/
.gwt-MenuItem a,
diff --git a/src/main/java/com/google/gerrit/public/clippy1.cache.swf b/src/main/java/com/google/gerrit/public/clippy1.cache.swf
deleted file mode 100644
index e46886c..0000000
--- a/src/main/java/com/google/gerrit/public/clippy1.cache.swf
+++ /dev/null
Binary files differ
diff --git a/src/main/java/com/google/gerrit/server/CacheControlFilter.java b/src/main/java/com/google/gerrit/server/CacheControlFilter.java
deleted file mode 100644
index 32fba5d..0000000
--- a/src/main/java/com/google/gerrit/server/CacheControlFilter.java
+++ /dev/null
@@ -1,93 +0,0 @@
-// Copyright 2008 Google Inc.
-//
-// Licensed 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 com.google.gerrit.server;
-
-import java.io.IOException;
-
-import javax.servlet.Filter;
-import javax.servlet.FilterChain;
-import javax.servlet.FilterConfig;
-import javax.servlet.ServletException;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-/**
- * Forces GWT resources to cache for a very long time.
- * <p>
- * GWT compiled JavaScript and ImageBundles can be cached indefinitely by a
- * browser and/or an edge proxy, as they never contain user-specific data and
- * are named by a unique checksum. If their content is ever modified then the
- * URL changes, so user agents would request a different resource. We force
- * these resources to have very long expiration times.
- */
-public class CacheControlFilter implements Filter {
- public void init(final FilterConfig config) {
- }
-
- public void destroy() {
- }
-
- public void doFilter(final ServletRequest sreq, final ServletResponse srsp,
- final FilterChain chain) throws IOException, ServletException {
- final HttpServletRequest req = (HttpServletRequest) sreq;
- final HttpServletResponse rsp = (HttpServletResponse) srsp;
- final String pathInfo = pathInfo(req);
-
- if (cacheForever(pathInfo)) {
- rsp.setHeader("Cache-Control", "max-age=31536000,public");
- rsp.setDateHeader("Expires", System.currentTimeMillis() + 31536000000L);
- } else if (nocache(pathInfo)) {
- rsp.setHeader("Expires", "Fri, 01 Jan 1980 00:00:00 GMT");
- rsp.setHeader("Pragma", "no-cache");
- rsp.setHeader("Cache-Control", "no-cache, must-revalidate");
- }
-
- chain.doFilter(req, rsp);
- }
-
- private static boolean cacheForever(final String pathInfo) {
- if (pathInfo.endsWith(".cache.gif")) {
- return true;
- }
- if (pathInfo.endsWith(".cache.html")) {
- return true;
- }
- if (pathInfo.endsWith(".cache.png")) {
- return true;
- }
- if (pathInfo.endsWith(".cache.jar")) {
- return true;
- }
- if (pathInfo.endsWith(".cache.swf")) {
- return true;
- }
- return false;
- }
-
- private static boolean nocache(final String pathInfo) {
- if (pathInfo.endsWith(".nocache.js")) {
- return true;
- }
- return false;
- }
-
- private static String pathInfo(final HttpServletRequest req) {
- final String uri = req.getRequestURI();
- final String ctx = req.getContextPath();
- return uri.startsWith(ctx) ? uri.substring(ctx.length()) : uri;
- }
-}
diff --git a/src/main/webapp/WEB-INF/web.xml b/src/main/webapp/WEB-INF/web.xml
index 5d78cbc..eea4a20 100644
--- a/src/main/webapp/WEB-INF/web.xml
+++ b/src/main/webapp/WEB-INF/web.xml
@@ -23,7 +23,7 @@
<filter>
<filter-name>CacheControl</filter-name>
- <filter-class>com.google.gerrit.server.CacheControlFilter</filter-class>
+ <filter-class>com.google.gwtexpui.server.CacheControlFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>CacheControl</filter-name>