Move resources from gerrit-gwtui to gerrit-gwtui-common

This allows plugins to use the standard Gerrit icons.

There is now a single place were icons are stored (in
com.google.gerrit.client in gerrit-gwtui-common). Before they were
distributed over different packages. An exception are a few icons in
com.google.gerrit.client.admin and com.google.gerrit.client.diff which
cannot be moved since they are referenced from a css file in the same
package (at least I don't know how to link to the icons in
gerrit-gwtui-common from the css files).

The icon names were made consistent, duplicate icons were deleted and
the icons are also moved from src/main/java/ to src/main/resources/.

In addition the only gif icon was converted to png.

Change-Id: Ibd9475ae175de6acc7c36bf2e40f96b003f2af10
This commit is contained in:
Phil Lello
2014-07-14 05:15:11 +01:00
committed by Edwin Kempin
parent 7c603dffde
commit 00d817a56a
52 changed files with 156 additions and 122 deletions

View File

@@ -1,9 +1,11 @@
SRC = 'src/main/java/com/google/gerrit/'
DIFFY = glob(['src/main/resources/com/google/gerrit/client/diffy*.png'])
gwt_module(
name = 'client',
srcs = glob([SRC + 'client/**/*.java']),
gwt_xml = SRC + 'GerritGwtUICommon.gwt.xml',
resources = glob(['src/main/**/*']),
deps = ['//lib/gwt:user'],
visibility = ['PUBLIC'],
)
@@ -28,3 +30,25 @@ java_library(
resources = glob(['src/main/**/*']),
visibility = ['PUBLIC'],
)
prebuilt_jar(
name = 'diffy_logo',
binary_jar = ':diffy_image_files_ln',
deps = [
'//lib:LICENSE-diffy',
'//lib:LICENSE-CC-BY3.0',
],
visibility = ['PUBLIC'],
)
genrule(
name = 'diffy_image_files_ln',
cmd = 'ln -s $(location :diffy_image_files) $OUT',
deps = [':diffy_image_files'],
out = 'diffy_images.jar',
)
java_library(
name = 'diffy_image_files',
resources = DIFFY,
)

View File

@@ -0,0 +1,104 @@
// 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 Resources extends ClientBundle {
@Source("arrowRight.png")
public ImageResource arrowRight();
@Source("arrowUp.png")
public ImageResource arrowUp();
@Source("arrowDown.png")
public ImageResource arrowDown();
@Source("editText.png")
public ImageResource edit();
@Source("mediaFloppy.png")
public ImageResource save();
@Source("starOpen.png")
public ImageResource starOpen();
@Source("starFilled.png")
public ImageResource starFilled();
@Source("greenCheck.png")
public ImageResource greenCheck();
@Source("redNot.png")
public ImageResource redNot();
@Source("editUndo.png")
public ImageResource editUndo();
@Source("downloadIcon.png")
public ImageResource downloadIcon();
@Source("queryIcon.png")
public ImageResource queryIcon();
@Source("addFileComment.png")
public ImageResource addFileComment();
@Source("diffy26.png")
public ImageResource gerritAvatar26();
@Source("draftComments.png")
public ImageResource draftComments();
@Source("readOnly.png")
public ImageResource readOnly();
@Source("gear.png")
public ImageResource gear();
@Source("info.png")
public ImageResource info();
@Source("warning.png")
public ImageResource warning();
@Source("listAdd.png")
public ImageResource listAdd();
@Source("merge.png")
public ImageResource merge();
@Source("removeReviewer.png")
public ImageResource removeReviewer();
@Source("deleteNormal.png")
public ImageResource deleteNormal();
@Source("deleteHover.png")
public ImageResource deleteHover();
@Source("undoNormal.png")
public ImageResource undoNormal();
@Source("goPrev.png")
public ImageResource goPrev();
@Source("goNext.png")
public ImageResource goNext();
@Source("goUp.png")
public ImageResource goUp();
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 313 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 334 B

View File

Before

Width:  |  Height:  |  Size: 4.7 KiB

After

Width:  |  Height:  |  Size: 4.7 KiB

View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

Before

Width:  |  Height:  |  Size: 863 B

After

Width:  |  Height:  |  Size: 863 B

View File

Before

Width:  |  Height:  |  Size: 710 B

After

Width:  |  Height:  |  Size: 710 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 504 B

View File

@@ -59,16 +59,14 @@ gwt_user_agent_permutations(
visibility = ['//:'],
)
DIFFY = glob(['src/main/java/com/google/gerrit/client/diffy*.png'])
gwt_module(
name = 'ui_module',
srcs = glob(['src/main/java/**/*.java']),
gwt_xml = 'src/main/java/%s.gwt.xml' % MODULE.replace('.', '/'),
resources = glob(['src/main/java/**/*'], excludes = DIFFY),
resources = glob(['src/main/java/**/*']),
deps = [
':diffy_logo',
':freebie_application_icon_set',
'//gerrit-gwtui-common:diffy_logo',
'//gerrit-gwtexpui:Clippy',
'//gerrit-gwtexpui:GlobalKey',
'//gerrit-gwtexpui:Progress',
@@ -94,15 +92,6 @@ gwt_module(
],
)
prebuilt_jar(
name = 'diffy_logo',
binary_jar = ':diffy_image_files_ln',
deps = [
'//lib:LICENSE-diffy',
'//lib:LICENSE-CC-BY3.0',
],
)
java_library(
name = 'freebie_application_icon_set',
deps = [
@@ -111,18 +100,6 @@ java_library(
],
)
genrule(
name = 'diffy_image_files_ln',
cmd = 'ln -s $(location :diffy_image_files) $OUT',
deps = [':diffy_image_files'],
out = 'diffy_images.jar',
)
java_library(
name = 'diffy_image_files',
resources = DIFFY,
)
java_test(
name = 'ui_tests',
srcs = glob(['src/test/java/**/*.java']),

View File

@@ -14,77 +14,12 @@
package com.google.gerrit.client;
import com.google.gwt.resources.client.ClientBundle;
import com.google.gwt.resources.client.CssResource;
import com.google.gwt.resources.client.ImageResource;
public interface GerritResources extends ClientBundle {
public interface GerritResources extends Resources {
@Source("gerrit.css")
GerritCss css();
@Source("gwt_override.css")
CssResource gwt_override();
@Source("arrowRight.gif")
public ImageResource arrowRight();
@Source("arrowUp.png")
public ImageResource arrowUp();
@Source("arrowDown.png")
public ImageResource arrowDown();
@Source("editText.png")
public ImageResource edit();
@Source("mediaFloppy.png")
public ImageResource save();
@Source("starOpen.gif")
public ImageResource starOpen();
@Source("starFilled.gif")
public ImageResource starFilled();
@Source("greenCheck.png")
public ImageResource greenCheck();
@Source("redNot.png")
public ImageResource redNot();
@Source("editUndo.png")
public ImageResource editUndo();
@Source("downloadIcon.png")
public ImageResource downloadIcon();
@Source("queryIcon.png")
public ImageResource queryIcon();
@Source("addFileComment.png")
public ImageResource addFileComment();
@Source("diffy26.png")
public ImageResource gerritAvatar26();
@Source("draftComments.png")
public ImageResource draftComments();
@Source("readOnly.png")
public ImageResource readOnly();
@Source("gear.png")
public ImageResource gear();
@Source("info.png")
public ImageResource info();
@Source("warning.png")
public ImageResource warning();
@Source("listAdd.png")
public ImageResource listAdd();
@Source("merge.png")
public ImageResource merge();
}

View File

@@ -24,9 +24,6 @@ public interface AdminResources extends ClientBundle {
@Source("admin.css")
AdminCss css();
@Source("editText.png")
public ImageResource editText();
@Source("deleteNormal.png")
public ImageResource deleteNormal();

View File

@@ -18,7 +18,7 @@ limitations under the License.
xmlns:ui='urn:ui:com.google.gwt.uibinder'
xmlns:g='urn:import:com.google.gwt.user.client.ui'
>
<ui:with field='res' type='com.google.gerrit.client.admin.AdminResources'/>
<ui:with field='ico' type='com.google.gerrit.client.GerritResources'/>
<ui:style>
.panel {
position: relative;
@@ -49,7 +49,7 @@ limitations under the License.
<g:HTMLPanel stylePrimaryName='{style.panel}'>
<g:Image
ui:field='editIcon'
resource='{res.editText}'
resource='{ico.edit}'
stylePrimaryName='{style.editIcon}'
title='Edit'>
<ui:attribute name='title'/>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 78 B

View File

@@ -20,7 +20,7 @@ limitations under the License.
xmlns:x='urn:import:com.google.gerrit.client.ui'
xmlns:clippy='urn:import:com.google.gwtexpui.clippy.client'>
<ui:with field='ico' type='com.google.gerrit.client.GerritResources'/>
<ui:image field="toggle" src="more_less.png"/>
<ui:image field="toggle" src="moreLess.png"/>
<ui:style type='com.google.gerrit.client.change.CommitBox.Style'>
@eval trimColor com.google.gerrit.client.Gerrit.getTheme().trimColor;

View File

@@ -171,7 +171,7 @@ public class Hashtags extends Composite {
.setAttribute("title", "Remove hashtag")
.setAttribute("onclick", REMOVE + "(event)")
.append(
new ImageResourceRenderer().render(Resources.I.remove_reviewer()))
new ImageResourceRenderer().render(Gerrit.RESOURCES.removeReviewer()))
.closeElement("button")
.closeSpan();
if (itr.hasNext()) {

View File

@@ -274,7 +274,7 @@ class Labels extends Grid {
html.openElement("button")
.setAttribute("title", Util.M.removeReviewer(name))
.setAttribute("onclick", REMOVE + "(event)")
.append(new ImageResourceRenderer().render(Resources.I.remove_reviewer()))
.append(new ImageResourceRenderer().render(Gerrit.RESOURCES.removeReviewer()))
.closeElement("button");
}
html.closeSpan();

View File

@@ -17,16 +17,12 @@ package com.google.gerrit.client.change;
import com.google.gwt.core.client.GWT;
import com.google.gwt.resources.client.ClientBundle;
import com.google.gwt.resources.client.CssResource;
import com.google.gwt.resources.client.ImageResource;
public interface Resources extends ClientBundle {
public static final Resources I = GWT.create(Resources.class);
static final ChangeConstants C = GWT.create(ChangeConstants.class);
static final ChangeMessages M = GWT.create(ChangeMessages.class);
@Source("star_open.png") ImageResource star_open();
@Source("star_filled.png") ImageResource star_filled();
@Source("remove_reviewer.png") ImageResource remove_reviewer();
@Source("common.css") Style style();
public interface Style extends CssResource {

View File

@@ -14,13 +14,14 @@
package com.google.gerrit.client.change;
import com.google.gerrit.client.Gerrit;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.ToggleButton;
class StarIcon extends ToggleButton {
StarIcon() {
super(
new Image(Resources.I.star_open()),
new Image(Resources.I.star_filled()));
new Image(Gerrit.RESOURCES.starOpen()),
new Image(Gerrit.RESOURCES.starFilled()));
}
}

View File

@@ -123,15 +123,15 @@
color: #fff;
}
@sprite .go_prev {
gwt-image: "go_prev";
@sprite .goPrev {
gwt-image: "goPrev";
display: inline-block;
}
@sprite .go_next {
gwt-image: "go_next";
@sprite .goNext {
gwt-image: "goNext";
display: inline-block;
}
@sprite .go_up {
gwt-image: "go_up";
@sprite .goUp {
gwt-image: "goUp";
display: inline-block;
}

View File

@@ -18,6 +18,7 @@ limitations under the License.
xmlns:ui='urn:ui:com.google.gwt.uibinder'
xmlns:g='urn:import:com.google.gwt.user.client.ui'
xmlns:x='urn:import:com.google.gerrit.client.ui'>
<ui:with field='ico' type='com.google.gerrit.client.GerritResources'/>
<ui:with field='res' type='com.google.gerrit.client.diff.Resources'/>
<ui:style>
.header {
@@ -60,16 +61,16 @@ limitations under the License.
<span class='{style.path}'><span ui:field='project'/> / <span ui:field='filePath'/></span>
<div class='{style.navigation}'>
<span ui:field='noDiff' class='{style.nodiff}'><ui:msg>No Differences</ui:msg></span>
<x:InlineHyperlink ui:field='prev' styleName='{res.style.go_prev}'/>
<x:InlineHyperlink ui:field='prev' styleName='{res.style.goPrev}'/>
<x:InlineHyperlink ui:field='up'
styleName='{res.style.go_up}'
styleName='{res.style.goUp}'
title='Up to change (Shortcut: u)'>
<ui:attribute name='title'/>
</x:InlineHyperlink>
<x:InlineHyperlink ui:field='next' styleName='{res.style.go_next}'/>
<x:InlineHyperlink ui:field='next' styleName='{res.style.goNext}'/>
<g:Image ui:field='preferences'
styleName='{style.preferences}'
resource='{res.gear}'
resource='{ico.gear}'
title='Diff preferences (Shortcut: ,)'>
<ui:attribute name='title'/>
</g:Image>

View File

@@ -24,10 +24,9 @@ interface Resources extends ClientBundle {
static final Resources I = GWT.create(Resources.class);
@Source("CommentBoxUi.css") Style style();
@Source("go-prev.png") ImageResource go_prev();
@Source("go-next.png") ImageResource go_next();
@Source("go-up.png") ImageResource go_up();
@Source("gear.png") ImageResource gear();
@Source("goPrev.png") ImageResource goPrev();
@Source("goNext.png") ImageResource goNext();
@Source("goUp.png") ImageResource goUp();
interface Style extends CssResource {
String commentWidgets();
@@ -38,8 +37,8 @@ interface Resources extends ClientBundle {
String summary();
String date();
String go_prev();
String go_next();
String go_up();
String goPrev();
String goNext();
String goUp();
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 623 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 609 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 637 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 409 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 246 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 171 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 179 B