Switch to ClientBundle
Instead of using the deprecated ImageBundle, we now use ClientBundle and its newer method of image spriting. Change-Id: Ic3de44d0a34c3f909964ef658ed2027eaac1cc4b Signed-off-by: Shawn O. Pearce <sop@google.com>
This commit is contained in:
parent
d554cc21ad
commit
e5ea78a7f7
@ -15,6 +15,7 @@
|
||||
-->
|
||||
<module rename-to="gerrit">
|
||||
<inherits name='com.google.gwt.user.User'/>
|
||||
<inherits name='com.google.gwt.resources.Resources'/>
|
||||
<inherits name='com.google.gwt.user.theme.chrome.Chrome'/>
|
||||
<inherits name='com.google.gwtexpui.css.CSS'/>
|
||||
<inherits name='com.google.gwtexpui.clippy.Clippy'/>
|
||||
|
@ -60,7 +60,7 @@ import java.util.ArrayList;
|
||||
public class Gerrit implements EntryPoint {
|
||||
public static final GerritConstants C = GWT.create(GerritConstants.class);
|
||||
public static final GerritMessages M = GWT.create(GerritMessages.class);
|
||||
public static final GerritIcons ICONS = GWT.create(GerritIcons.class);
|
||||
public static final GerritResources RESOURCES = GWT.create(GerritResources.class);
|
||||
public static final SystemInfoService SYSTEM_SVC;
|
||||
|
||||
private static String myHost;
|
||||
@ -156,6 +156,7 @@ public class Gerrit implements EntryPoint {
|
||||
|
||||
public void onModuleLoad() {
|
||||
UserAgent.assertNotInIFrame();
|
||||
RESOURCES.css().ensureInjected();
|
||||
initHostname();
|
||||
Window.setTitle(M.windowTitle1(myHost));
|
||||
initHistoryHooks();
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright (C) 2008 The Android Open Source Project
|
||||
// Copyright (C) 2009 The Android Open Source Project
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
@ -14,17 +14,8 @@
|
||||
|
||||
package com.google.gerrit.client;
|
||||
|
||||
import com.google.gwt.user.client.ui.AbstractImagePrototype;
|
||||
import com.google.gwt.user.client.ui.ImageBundle;
|
||||
import com.google.gwt.resources.client.CssResource;
|
||||
|
||||
public interface GerritIcons extends ImageBundle {
|
||||
public AbstractImagePrototype arrowRight();
|
||||
|
||||
public AbstractImagePrototype starOpen();
|
||||
|
||||
public AbstractImagePrototype starFilled();
|
||||
|
||||
public AbstractImagePrototype greenCheck();
|
||||
|
||||
public AbstractImagePrototype redNot();
|
||||
public interface GerritCssResource extends CssResource {
|
||||
String greenCheckClass();
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
// Copyright (C) 2008 The Android Open Source Project
|
||||
//
|
||||
// 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;
|
||||
|
||||
import com.google.gwt.resources.client.ClientBundle;
|
||||
import com.google.gwt.resources.client.ImageResource;
|
||||
|
||||
public interface GerritResources extends ClientBundle {
|
||||
@Source("gerrit2.css")
|
||||
GerritCssResource css();
|
||||
|
||||
@Source("arrowRight.gif")
|
||||
public ImageResource arrowRight();
|
||||
|
||||
@Source("starOpen.gif")
|
||||
public ImageResource starOpen();
|
||||
|
||||
@Source("starFilled.gif")
|
||||
public ImageResource starFilled();
|
||||
|
||||
@Source("greenCheck.png")
|
||||
public ImageResource greenCheck();
|
||||
|
||||
@Source("redNot.png")
|
||||
public ImageResource redNot();
|
||||
}
|
@ -14,13 +14,16 @@
|
||||
|
||||
package com.google.gerrit.client.auth.openid;
|
||||
|
||||
import com.google.gwt.user.client.ui.AbstractImagePrototype;
|
||||
import com.google.gwt.user.client.ui.ImageBundle;
|
||||
import com.google.gwt.resources.client.ClientBundle;
|
||||
import com.google.gwt.resources.client.ImageResource;
|
||||
|
||||
public interface LoginIcons extends ImageBundle {
|
||||
public AbstractImagePrototype openidLogo();
|
||||
public interface LoginResources extends ClientBundle {
|
||||
@Source("openidLogo.png")
|
||||
public ImageResource openidLogo();
|
||||
|
||||
public AbstractImagePrototype iconGoogle();
|
||||
@Source("iconGoogle.gif")
|
||||
public ImageResource iconGoogle();
|
||||
|
||||
public AbstractImagePrototype iconYahoo();
|
||||
@Source("iconYahoo.gif")
|
||||
public ImageResource iconYahoo();
|
||||
}
|
@ -27,13 +27,13 @@ import com.google.gwt.event.dom.client.ClickHandler;
|
||||
import com.google.gwt.event.dom.client.KeyCodes;
|
||||
import com.google.gwt.event.dom.client.KeyPressEvent;
|
||||
import com.google.gwt.event.dom.client.KeyPressHandler;
|
||||
import com.google.gwt.resources.client.ImageResource;
|
||||
import com.google.gwt.user.client.Command;
|
||||
import com.google.gwt.user.client.Cookies;
|
||||
import com.google.gwt.user.client.DOM;
|
||||
import com.google.gwt.user.client.DeferredCommand;
|
||||
import com.google.gwt.user.client.History;
|
||||
import com.google.gwt.user.client.Window;
|
||||
import com.google.gwt.user.client.ui.AbstractImagePrototype;
|
||||
import com.google.gwt.user.client.ui.Button;
|
||||
import com.google.gwt.user.client.ui.CheckBox;
|
||||
import com.google.gwt.user.client.ui.FlowPanel;
|
||||
@ -50,7 +50,7 @@ import java.util.Map;
|
||||
|
||||
public class OpenIdSignInDialog extends SignInDialog implements
|
||||
FormPanel.SubmitHandler {
|
||||
private final LoginIcons icons;
|
||||
private final LoginResources icons;
|
||||
private final FlowPanel panelWidget;
|
||||
private final FormPanel form;
|
||||
private final FlowPanel formBody;
|
||||
@ -69,7 +69,7 @@ public class OpenIdSignInDialog extends SignInDialog implements
|
||||
final String initialErrorMsg) {
|
||||
super(requestedMode);
|
||||
|
||||
icons = GWT.create(LoginIcons.class);
|
||||
icons = GWT.create(LoginResources.class);
|
||||
|
||||
formBody = new FlowPanel();
|
||||
formBody.setStyleName("gerrit-OpenID-loginform");
|
||||
@ -118,7 +118,7 @@ public class OpenIdSignInDialog extends SignInDialog implements
|
||||
private void createHeaderLogo() {
|
||||
final FlowPanel headerLogo = new FlowPanel();
|
||||
headerLogo.setStyleName("gerrit-OpenID-logobox");
|
||||
headerLogo.add(icons.openidLogo().createImage());
|
||||
headerLogo.add(new Image(icons.openidLogo()));
|
||||
formBody.add(headerLogo);
|
||||
}
|
||||
|
||||
@ -221,7 +221,7 @@ public class OpenIdSignInDialog extends SignInDialog implements
|
||||
}
|
||||
|
||||
private void link(final String identUrl, final String who,
|
||||
final AbstractImagePrototype icon) {
|
||||
final ImageResource icon) {
|
||||
final ClickHandler i = new ClickHandler() {
|
||||
@Override
|
||||
public void onClick(final ClickEvent event) {
|
||||
@ -235,7 +235,7 @@ public class OpenIdSignInDialog extends SignInDialog implements
|
||||
final FlowPanel line = new FlowPanel();
|
||||
line.addStyleName("gerrit-OpenID-directlink");
|
||||
|
||||
final Image img = icon.createImage();
|
||||
final Image img = new Image(icon);
|
||||
img.addClickHandler(i);
|
||||
line.add(img);
|
||||
|
||||
|
@ -37,6 +37,7 @@ import com.google.gwt.user.client.Element;
|
||||
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.Image;
|
||||
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;
|
||||
@ -258,10 +259,10 @@ public class ApprovalTable extends Composite {
|
||||
}
|
||||
|
||||
if (type.isMaxNegative(ca)) {
|
||||
table.setWidget(row, col, Gerrit.ICONS.redNot().createImage());
|
||||
table.setWidget(row, col, new Image(Gerrit.RESOURCES.redNot()));
|
||||
|
||||
} else if (type.isMaxPositive(ca)) {
|
||||
table.setWidget(row, col, Gerrit.ICONS.greenCheck().createImage());
|
||||
table.setWidget(row, col, new Image(Gerrit.RESOURCES.greenCheck()));
|
||||
|
||||
} else {
|
||||
String vstr = String.valueOf(ca.getValue());
|
||||
|
@ -132,9 +132,9 @@ public class ChangeScreen extends Screen {
|
||||
|
||||
private void setStarred(final boolean s) {
|
||||
if (s) {
|
||||
Gerrit.ICONS.starFilled().applyTo(starChange);
|
||||
starChange.setResource(Gerrit.RESOURCES.starFilled());
|
||||
} else {
|
||||
Gerrit.ICONS.starOpen().applyTo(starChange);
|
||||
starChange.setResource(Gerrit.RESOURCES.starOpen());
|
||||
}
|
||||
starred = s;
|
||||
}
|
||||
@ -153,7 +153,7 @@ public class ChangeScreen extends Screen {
|
||||
keysAction.add(new PublishCommentsKeyCommand(0, 'r', Util.C
|
||||
.keyPublishComments()));
|
||||
|
||||
starChange = Gerrit.ICONS.starOpen().createImage();
|
||||
starChange = new Image(Gerrit.RESOURCES.starOpen());
|
||||
starChange.setStyleName("gerrit-ChangeScreen-StarIcon");
|
||||
starChange.setVisible(Gerrit.isSignedIn());
|
||||
starChange.addClickHandler(new ClickHandler() {
|
||||
|
@ -43,8 +43,8 @@ import com.google.gwt.event.dom.client.ClickEvent;
|
||||
import com.google.gwt.event.dom.client.ClickHandler;
|
||||
import com.google.gwt.event.dom.client.KeyCodes;
|
||||
import com.google.gwt.event.dom.client.KeyPressEvent;
|
||||
import com.google.gwt.resources.client.ImageResource;
|
||||
import com.google.gwt.user.client.DOM;
|
||||
import com.google.gwt.user.client.ui.AbstractImagePrototype;
|
||||
import com.google.gwt.user.client.ui.Image;
|
||||
import com.google.gwt.user.client.ui.UIObject;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
@ -245,18 +245,18 @@ public class ChangeTable extends NavigationTable<ChangeInfo> {
|
||||
}
|
||||
|
||||
private void setStar(final int row, final ChangeInfo c) {
|
||||
final AbstractImagePrototype star;
|
||||
final ImageResource star;
|
||||
if (c.isStarred()) {
|
||||
star = Gerrit.ICONS.starFilled();
|
||||
star = Gerrit.RESOURCES.starFilled();
|
||||
} else {
|
||||
star = Gerrit.ICONS.starOpen();
|
||||
star = Gerrit.RESOURCES.starOpen();
|
||||
}
|
||||
|
||||
final Widget i = table.getWidget(row, C_STAR);
|
||||
if (i instanceof Image) {
|
||||
star.applyTo((Image) i);
|
||||
((Image) i).setResource(star);
|
||||
} else {
|
||||
table.setWidget(row, C_STAR, star.createImage());
|
||||
table.setWidget(row, C_STAR, new Image(star));
|
||||
}
|
||||
}
|
||||
|
||||
@ -329,10 +329,10 @@ public class ChangeTable extends NavigationTable<ChangeInfo> {
|
||||
haveReview = true;
|
||||
|
||||
if (type.isMaxNegative(ca)) {
|
||||
table.setWidget(row, col, Gerrit.ICONS.redNot().createImage());
|
||||
table.setWidget(row, col, new Image(Gerrit.RESOURCES.redNot()));
|
||||
|
||||
} else if (type.isMaxPositive(ca)) {
|
||||
table.setWidget(row, col, Gerrit.ICONS.greenCheck().createImage());
|
||||
table.setWidget(row, col, new Image(Gerrit.RESOURCES.greenCheck()));
|
||||
|
||||
} else {
|
||||
String vstr = String.valueOf(ca.getValue());
|
||||
|
@ -31,6 +31,7 @@ import com.google.gwt.user.client.DeferredCommand;
|
||||
import com.google.gwt.user.client.IncrementalCommand;
|
||||
import com.google.gwt.user.client.ui.Composite;
|
||||
import com.google.gwt.user.client.ui.FlowPanel;
|
||||
import com.google.gwt.user.client.ui.Image;
|
||||
import com.google.gwt.user.client.ui.Label;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
import com.google.gwt.user.client.ui.HTMLTable.Cell;
|
||||
@ -202,7 +203,7 @@ public class PatchTable extends Composite {
|
||||
}
|
||||
|
||||
if (reviewed) {
|
||||
table.setWidget(row, col, Gerrit.ICONS.greenCheck().createImage());
|
||||
table.setWidget(row, col, new Image(Gerrit.RESOURCES.greenCheck()));
|
||||
} else {
|
||||
table.clearCell(row, col);
|
||||
}
|
||||
@ -399,7 +400,9 @@ public class PatchTable extends Composite {
|
||||
m.openTd();
|
||||
m.setStyleName(S_DATA_CELL);
|
||||
if (p.isReviewedByCurrentUser()) {
|
||||
m.append(SafeHtml.asis(Gerrit.ICONS.greenCheck().getHTML()));
|
||||
m.openDiv();
|
||||
m.setStyleName(Gerrit.RESOURCES.css().greenCheckClass());
|
||||
m.closeSelf();
|
||||
}
|
||||
m.closeTd();
|
||||
}
|
||||
|
@ -0,0 +1,18 @@
|
||||
/* Copyright (C) 2009 The Android Open Source Project
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
@sprite .greenCheckClass {
|
||||
gwt-image: "greenCheck";
|
||||
}
|
@ -55,7 +55,7 @@ public abstract class NavigationTable<RowItem> extends FancyFlexTable<RowItem> {
|
||||
private ScrollPanel parentScrollPanel;
|
||||
|
||||
protected NavigationTable() {
|
||||
pointer = Gerrit.ICONS.arrowRight().createImage();
|
||||
pointer = new Image(Gerrit.RESOURCES.arrowRight());
|
||||
keysNavigation = new KeyCommandSet(Gerrit.C.sectionNavigation());
|
||||
keysAction = new KeyCommandSet(Gerrit.C.sectionActions());
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user