Deprecate ImageBundle in favor of ClientBundle and ImageResources.
Update sample apps.
Patch by: bobv
Review by: jlabanca
git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@6578 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/samples/mail/src/com/google/gwt/sample/mail/client/Mailboxes.java b/samples/mail/src/com/google/gwt/sample/mail/client/Mailboxes.java
index 27fb3c5..4965de2 100644
--- a/samples/mail/src/com/google/gwt/sample/mail/client/Mailboxes.java
+++ b/samples/mail/src/com/google/gwt/sample/mail/client/Mailboxes.java
@@ -16,11 +16,11 @@
package com.google.gwt.sample.mail.client;
import com.google.gwt.core.client.GWT;
+import com.google.gwt.resources.client.ClientBundle;
+import com.google.gwt.resources.client.ImageResource;
import com.google.gwt.user.client.ui.AbstractImagePrototype;
import com.google.gwt.user.client.ui.Composite;
-import com.google.gwt.user.client.ui.ImageBundle;
import com.google.gwt.user.client.ui.Tree;
-import com.google.gwt.user.client.ui.TreeImages;
import com.google.gwt.user.client.ui.TreeItem;
/**
@@ -32,21 +32,21 @@
* Specifies the images that will be bundled for this Composite and specify
* that tree's images should also be included in the same bundle.
*/
- public interface Images extends ImageBundle, TreeImages {
- AbstractImagePrototype drafts();
+ public interface Images extends ClientBundle, Tree.Resources {
+ ImageResource drafts();
- AbstractImagePrototype home();
+ ImageResource home();
- AbstractImagePrototype inbox();
+ ImageResource inbox();
- AbstractImagePrototype sent();
+ ImageResource sent();
- AbstractImagePrototype templates();
+ ImageResource templates();
- AbstractImagePrototype trash();
-
- @Resource("noimage.png")
- AbstractImagePrototype treeLeaf();
+ ImageResource trash();
+
+ @Source("noimage.png")
+ ImageResource treeLeaf();
}
private Tree tree;
@@ -76,13 +76,13 @@
/**
* A helper method to simplify adding tree items that have attached images.
- * {@link #addImageItem(TreeItem, String, AbstractImagePrototype) code}
+ * {@link #addImageItem(TreeItem, String, ImageResource) code}
*
* @param root the tree item to which the new item will be added.
* @param title the text associated with this item.
*/
private TreeItem addImageItem(TreeItem root, String title,
- AbstractImagePrototype imageProto) {
+ ImageResource imageProto) {
TreeItem item = new TreeItem(imageItemHTML(imageProto, title));
root.addItem(item);
return item;
@@ -95,7 +95,7 @@
* @param title the title of the item
* @return the resultant HTML
*/
- private String imageItemHTML(AbstractImagePrototype imageProto, String title) {
- return imageProto.getHTML() + " " + title;
+ private String imageItemHTML(ImageResource imageProto, String title) {
+ return AbstractImagePrototype.create(imageProto).getHTML() + " " + title;
}
}
diff --git a/samples/showcase/src/com/google/gwt/sample/showcase/client/Application.java b/samples/showcase/src/com/google/gwt/sample/showcase/client/Application.java
index 27a7b0a..e0336fa 100644
--- a/samples/showcase/src/com/google/gwt/sample/showcase/client/Application.java
+++ b/samples/showcase/src/com/google/gwt/sample/showcase/client/Application.java
@@ -22,8 +22,8 @@
import com.google.gwt.event.logical.shared.SelectionHandler;
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.i18n.client.LocaleInfo;
+import com.google.gwt.resources.client.ImageResource;
import com.google.gwt.user.client.Window;
-import com.google.gwt.user.client.ui.AbstractImagePrototype;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.DecoratorPanel;
import com.google.gwt.user.client.ui.FlexTable;
@@ -35,7 +35,6 @@
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.SimplePanel;
import com.google.gwt.user.client.ui.Tree;
-import com.google.gwt.user.client.ui.TreeImages;
import com.google.gwt.user.client.ui.TreeItem;
import com.google.gwt.user.client.ui.Widget;
import com.google.gwt.user.client.ui.FlexTable.FlexCellFormatter;
@@ -71,14 +70,14 @@
/**
* Images used in the {@link Application}.
*/
- public interface ApplicationImages extends TreeImages {
+ public interface ApplicationImages extends Tree.Resources {
/**
* An image indicating a leaf.
*
* @return a prototype of this image
*/
- @Resource("noimage.png")
- AbstractImagePrototype treeLeaf();
+ @Source("noimage.png")
+ ImageResource treeLeaf();
}
/**
diff --git a/samples/showcase/src/com/google/gwt/sample/showcase/client/Showcase.java b/samples/showcase/src/com/google/gwt/sample/showcase/client/Showcase.java
index 18d6717..190821b 100644
--- a/samples/showcase/src/com/google/gwt/sample/showcase/client/Showcase.java
+++ b/samples/showcase/src/com/google/gwt/sample/showcase/client/Showcase.java
@@ -31,6 +31,7 @@
import com.google.gwt.event.logical.shared.ValueChangeHandler;
import com.google.gwt.http.client.UrlBuilder;
import com.google.gwt.i18n.client.LocaleInfo;
+import com.google.gwt.resources.client.ImageResource;
import com.google.gwt.sample.showcase.client.content.i18n.CwConstantsExample;
import com.google.gwt.sample.showcase.client.content.i18n.CwConstantsWithLookupExample;
import com.google.gwt.sample.showcase.client.content.i18n.CwDateTimeFormat;
@@ -77,6 +78,7 @@
import com.google.gwt.user.client.ui.HasHorizontalAlignment;
import com.google.gwt.user.client.ui.HasVerticalAlignment;
import com.google.gwt.user.client.ui.HorizontalPanel;
+import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.ListBox;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.TabBar;
@@ -390,9 +392,10 @@
* @param image the icon to display next to the {@link TreeItem}
*/
private void setupMainMenuOption(TreeItem parent, ContentWidget content,
- AbstractImagePrototype image) {
+ ImageResource image) {
// Create the TreeItem
- TreeItem option = parent.addItem(image.getHTML() + " " + content.getName());
+ TreeItem option = parent.addItem(AbstractImagePrototype.create(image).getHTML()
+ + " " + content.getName());
// Map the item to its history token and content widget
itemWidgets.put(option, content);
@@ -437,7 +440,7 @@
}
});
HorizontalPanel localeWrapper = new HorizontalPanel();
- localeWrapper.add(images.locale().createImage());
+ localeWrapper.add(new Image(images.locale()));
localeWrapper.add(localeBox);
vPanel.add(localeWrapper);
@@ -477,7 +480,7 @@
// Add the title and some images to the title bar
HorizontalPanel titlePanel = new HorizontalPanel();
titlePanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
- titlePanel.add(images.gwtLogo().createImage());
+ titlePanel.add(new Image(images.gwtLogo()));
titlePanel.add(new HTML(pageTitle));
app.setTitleWidget(titlePanel);
}
diff --git a/samples/showcase/src/com/google/gwt/sample/showcase/client/ShowcaseImages.java b/samples/showcase/src/com/google/gwt/sample/showcase/client/ShowcaseImages.java
index b141f0c..3e0b559 100644
--- a/samples/showcase/src/com/google/gwt/sample/showcase/client/ShowcaseImages.java
+++ b/samples/showcase/src/com/google/gwt/sample/showcase/client/ShowcaseImages.java
@@ -15,39 +15,39 @@
*/
package com.google.gwt.sample.showcase.client;
-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;
/**
* The images used throughout the Showcase.
*/
-public interface ShowcaseImages extends ImageBundle {
- AbstractImagePrototype catI18N();
+public interface ShowcaseImages extends ClientBundle {
+ ImageResource catI18N();
- AbstractImagePrototype catLists();
+ ImageResource catLists();
- AbstractImagePrototype catOther();
+ ImageResource catOther();
- AbstractImagePrototype catPanels();
+ ImageResource catPanels();
- AbstractImagePrototype catPopups();
+ ImageResource catPopups();
- AbstractImagePrototype catTables();
+ ImageResource catTables();
- AbstractImagePrototype catTextInput();
+ ImageResource catTextInput();
- AbstractImagePrototype catWidgets();
+ ImageResource catWidgets();
- AbstractImagePrototype gwtLogo();
+ ImageResource gwtLogo();
- AbstractImagePrototype gwtLogoThumb();
+ ImageResource gwtLogoThumb();
- AbstractImagePrototype jimmy();
+ ImageResource jimmy();
- AbstractImagePrototype jimmyThumb();
+ ImageResource jimmyThumb();
/**
* Indicates the locale selection box.
*/
- AbstractImagePrototype locale();
+ ImageResource locale();
}
\ No newline at end of file
diff --git a/samples/showcase/src/com/google/gwt/sample/showcase/client/content/lists/CwStackPanel.java b/samples/showcase/src/com/google/gwt/sample/showcase/client/content/lists/CwStackPanel.java
index 2387fab..f14c106 100644
--- a/samples/showcase/src/com/google/gwt/sample/showcase/client/content/lists/CwStackPanel.java
+++ b/samples/showcase/src/com/google/gwt/sample/showcase/client/content/lists/CwStackPanel.java
@@ -17,7 +17,10 @@
import com.google.gwt.core.client.GWT;
import com.google.gwt.core.client.RunAsyncCallback;
+import com.google.gwt.event.dom.client.ClickEvent;
+import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.i18n.client.Constants;
+import com.google.gwt.resources.client.ImageResource;
import com.google.gwt.sample.showcase.client.ContentWidget;
import com.google.gwt.sample.showcase.client.ShowcaseAnnotations.ShowcaseData;
import com.google.gwt.sample.showcase.client.ShowcaseAnnotations.ShowcaseSource;
@@ -25,15 +28,13 @@
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.AbstractImagePrototype;
import com.google.gwt.user.client.ui.CheckBox;
-import com.google.gwt.event.dom.client.ClickHandler;
-import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.user.client.ui.DecoratedStackPanel;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HasVerticalAlignment;
import com.google.gwt.user.client.ui.HorizontalPanel;
+import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.PopupPanel;
import com.google.gwt.user.client.ui.Tree;
-import com.google.gwt.user.client.ui.TreeImages;
import com.google.gwt.user.client.ui.TreeItem;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;
@@ -41,7 +42,7 @@
/**
* Example file.
*/
-@ShowcaseStyle({
+@ShowcaseStyle(value = {
".gwt-DecoratedStackPanel", "html>body .gwt-DecoratedStackPanel",
"* html .gwt-DecoratedStackPanel", ".cw-StackPanelHeader"})
public class CwStackPanel extends ContentWidget {
@@ -78,30 +79,30 @@
* space. Each TreeItem will use its own custom image.
*/
@ShowcaseSource
- public interface Images extends TreeImages {
- AbstractImagePrototype contactsgroup();
+ public interface Images extends Tree.Resources {
+ ImageResource contactsgroup();
- AbstractImagePrototype defaultContact();
+ ImageResource defaultContact();
- AbstractImagePrototype drafts();
+ ImageResource drafts();
- AbstractImagePrototype filtersgroup();
+ ImageResource filtersgroup();
- AbstractImagePrototype inbox();
+ ImageResource inbox();
- AbstractImagePrototype mailgroup();
+ ImageResource mailgroup();
- AbstractImagePrototype sent();
+ ImageResource sent();
- AbstractImagePrototype templates();
+ ImageResource templates();
- AbstractImagePrototype trash();
+ ImageResource trash();
/**
* Use noimage.png, which is a blank 1x1 image.
*/
- @Resource("noimage.png")
- AbstractImagePrototype treeLeaf();
+ @Source("noimage.png")
+ ImageResource treeLeaf();
}
/**
@@ -182,6 +183,10 @@
});
}
+ private void addItem(TreeItem root, ImageResource image, String label) {
+ root.addItem(AbstractImagePrototype.create(image).getHTML() + " " + label);
+ }
+
/**
* Create the list of Contacts.
*
@@ -193,7 +198,7 @@
// Create a popup to show the contact info when a contact is clicked
HorizontalPanel contactPopupContainer = new HorizontalPanel();
contactPopupContainer.setSpacing(5);
- contactPopupContainer.add(images.defaultContact().createImage());
+ contactPopupContainer.add(new Image(images.defaultContact()));
final HTML contactInfo = new HTML();
contactPopupContainer.add(contactInfo);
final PopupPanel contactPopup = new PopupPanel(true, false);
@@ -254,12 +259,11 @@
Tree mailPanel = new Tree(images);
TreeItem mailPanelRoot = mailPanel.addItem("foo@example.com");
String[] mailFolders = constants.cwStackPanelMailFolders();
- mailPanelRoot.addItem(images.inbox().getHTML() + " " + mailFolders[0]);
- mailPanelRoot.addItem(images.drafts().getHTML() + " " + mailFolders[1]);
- mailPanelRoot.addItem(images.templates().getHTML() + " " + mailFolders[2]);
- mailPanelRoot.addItem(images.sent().getHTML() + " " + mailFolders[3]);
- mailPanelRoot.addItem(images.trash().getHTML() + " " + mailFolders[4]);
- mailPanelRoot.setState(true);
+ addItem(mailPanelRoot, images.inbox(), mailFolders[0]);
+ addItem(mailPanelRoot, images.drafts(), mailFolders[1]);
+ addItem(mailPanelRoot, images.templates(), mailFolders[2]);
+ addItem(mailPanelRoot, images.sent(), mailFolders[3]);
+ addItem(mailPanelRoot, images.trash(), mailFolders[4]);
return mailPanel;
}
@@ -268,16 +272,16 @@
* text.
*
* @param text the header text
- * @param image the {@link AbstractImagePrototype} to add next to the header
+ * @param image the {@link ImageResource} to add next to the header
* @return the header as a string
*/
@ShowcaseSource
- private String getHeaderString(String text, AbstractImagePrototype image) {
+ private String getHeaderString(String text, ImageResource image) {
// Add the image and text to a horizontal panel
HorizontalPanel hPanel = new HorizontalPanel();
hPanel.setSpacing(0);
hPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
- hPanel.add(image.createImage());
+ hPanel.add(new Image(image));
HTML headerText = new HTML(text);
headerText.setStyleName("cw-StackPanelHeader");
hPanel.add(headerText);
diff --git a/samples/showcase/src/com/google/gwt/sample/showcase/client/content/other/CwAnimation.java b/samples/showcase/src/com/google/gwt/sample/showcase/client/content/other/CwAnimation.java
index 749d1ba..d861a59 100644
--- a/samples/showcase/src/com/google/gwt/sample/showcase/client/content/other/CwAnimation.java
+++ b/samples/showcase/src/com/google/gwt/sample/showcase/client/content/other/CwAnimation.java
@@ -18,6 +18,8 @@
import com.google.gwt.animation.client.Animation;
import com.google.gwt.core.client.GWT;
import com.google.gwt.core.client.RunAsyncCallback;
+import com.google.gwt.event.dom.client.ClickEvent;
+import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.i18n.client.Constants;
import com.google.gwt.sample.showcase.client.ContentWidget;
import com.google.gwt.sample.showcase.client.Showcase;
@@ -26,12 +28,11 @@
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.AbsolutePanel;
import com.google.gwt.user.client.ui.Button;
-import com.google.gwt.event.dom.client.ClickHandler;
-import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.user.client.ui.DecoratorPanel;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HasHorizontalAlignment;
import com.google.gwt.user.client.ui.HorizontalPanel;
+import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;
@@ -209,10 +210,10 @@
absolutePanel.ensureDebugId("cwAbsolutePanel");
// Add a widget that we will animate
- animateeTop = Showcase.images.gwtLogoThumb().createImage();
- animateeBottom = Showcase.images.gwtLogoThumb().createImage();
- animateeLeft = Showcase.images.gwtLogoThumb().createImage();
- animateeRight = Showcase.images.gwtLogoThumb().createImage();
+ animateeTop = new Image(Showcase.images.gwtLogoThumb());
+ animateeBottom = new Image(Showcase.images.gwtLogoThumb());
+ animateeLeft = new Image(Showcase.images.gwtLogoThumb());
+ animateeRight = new Image(Showcase.images.gwtLogoThumb());
absolutePanel.add(animateeTop);
absolutePanel.add(animateeBottom);
absolutePanel.add(animateeLeft);
diff --git a/samples/showcase/src/com/google/gwt/sample/showcase/client/content/panels/CwAbsolutePanel.java b/samples/showcase/src/com/google/gwt/sample/showcase/client/content/panels/CwAbsolutePanel.java
index 1c9a717..d775dcb 100644
--- a/samples/showcase/src/com/google/gwt/sample/showcase/client/content/panels/CwAbsolutePanel.java
+++ b/samples/showcase/src/com/google/gwt/sample/showcase/client/content/panels/CwAbsolutePanel.java
@@ -36,6 +36,7 @@
import com.google.gwt.user.client.ui.Grid;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HorizontalPanel;
+import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.ListBox;
import com.google.gwt.user.client.ui.TextBox;
import com.google.gwt.user.client.ui.Widget;
@@ -159,7 +160,7 @@
grid.setBorderWidth(1);
for (int i = 0; i < 3; i++) {
grid.setHTML(0, i, i + "");
- grid.setWidget(1, i, Showcase.images.gwtLogoThumb().createImage());
+ grid.setWidget(1, i, new Image(Showcase.images.gwtLogoThumb()));
}
absolutePanel.add(grid, 60, 100);
widgetMap.put(widgetNames[2], grid);
diff --git a/samples/showcase/src/com/google/gwt/sample/showcase/client/content/panels/CwTabPanel.java b/samples/showcase/src/com/google/gwt/sample/showcase/client/content/panels/CwTabPanel.java
index 5c96d24..e8c8234 100644
--- a/samples/showcase/src/com/google/gwt/sample/showcase/client/content/panels/CwTabPanel.java
+++ b/samples/showcase/src/com/google/gwt/sample/showcase/client/content/panels/CwTabPanel.java
@@ -26,6 +26,7 @@
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.DecoratedTabPanel;
import com.google.gwt.user.client.ui.HTML;
+import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;
@@ -97,7 +98,7 @@
// Add a tab with an image
VerticalPanel vPanel = new VerticalPanel();
- vPanel.add(Showcase.images.gwtLogo().createImage());
+ vPanel.add(new Image(Showcase.images.gwtLogo()));
tabPanel.add(vPanel, tabTitles[1]);
// Add a tab
diff --git a/samples/showcase/src/com/google/gwt/sample/showcase/client/content/popups/CwBasicPopup.java b/samples/showcase/src/com/google/gwt/sample/showcase/client/content/popups/CwBasicPopup.java
index 3223fc1..2f81461 100644
--- a/samples/showcase/src/com/google/gwt/sample/showcase/client/content/popups/CwBasicPopup.java
+++ b/samples/showcase/src/com/google/gwt/sample/showcase/client/content/popups/CwBasicPopup.java
@@ -37,7 +37,7 @@
/**
* Example file.
*/
-@ShowcaseStyle({
+@ShowcaseStyle(value = {
".gwt-PopupPanel", "html>body .gwt-PopupPanel", "* html .gwt-PopupPanel",
".gwt-DecoratedPopupPanel", "html>body .gwt-DecoratedPopupPanel",
"* html .gwt-DecoratedPopupPanel"})
@@ -114,7 +114,7 @@
});
// Create a popup to show the full size image
- Image jimmyFull = Showcase.images.jimmy().createImage();
+ Image jimmyFull = new Image(Showcase.images.jimmy());
final PopupPanel imagePopup = new PopupPanel(true);
imagePopup.setAnimationEnabled(true);
imagePopup.ensureDebugId("cwBasicPopup-imagePopup");
@@ -126,7 +126,7 @@
});
// Add an image thumbnail
- Image jimmyThumb = Showcase.images.jimmyThumb().createImage();
+ Image jimmyThumb = new Image(Showcase.images.jimmyThumb());
jimmyThumb.ensureDebugId("cwBasicPopup-thumb");
jimmyThumb.addStyleName("cw-BasicPopup-thumb");
jimmyThumb.addClickHandler(new ClickHandler() {
diff --git a/samples/showcase/src/com/google/gwt/sample/showcase/client/content/popups/CwDialogBox.java b/samples/showcase/src/com/google/gwt/sample/showcase/client/content/popups/CwDialogBox.java
index 69ab631..1d04d8f 100644
--- a/samples/showcase/src/com/google/gwt/sample/showcase/client/content/popups/CwDialogBox.java
+++ b/samples/showcase/src/com/google/gwt/sample/showcase/client/content/popups/CwDialogBox.java
@@ -172,7 +172,7 @@
HasHorizontalAlignment.ALIGN_CENTER);
// Add an image to the dialog
- Image image = Showcase.images.jimmy().createImage();
+ Image image = new Image(Showcase.images.jimmy());
dialogContents.add(image);
dialogContents.setCellHorizontalAlignment(image,
HasHorizontalAlignment.ALIGN_CENTER);
diff --git a/samples/showcase/src/com/google/gwt/sample/showcase/client/content/tables/CwFlexTable.java b/samples/showcase/src/com/google/gwt/sample/showcase/client/content/tables/CwFlexTable.java
index 6d13d72..7e4422a 100644
--- a/samples/showcase/src/com/google/gwt/sample/showcase/client/content/tables/CwFlexTable.java
+++ b/samples/showcase/src/com/google/gwt/sample/showcase/client/content/tables/CwFlexTable.java
@@ -30,6 +30,7 @@
import com.google.gwt.user.client.ui.FlexTable;
import com.google.gwt.user.client.ui.HasHorizontalAlignment;
import com.google.gwt.user.client.ui.HasVerticalAlignment;
+import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;
import com.google.gwt.user.client.ui.FlexTable.FlexCellFormatter;
@@ -154,8 +155,8 @@
@ShowcaseSource
private void addRow(FlexTable flexTable) {
int numRows = flexTable.getRowCount();
- flexTable.setWidget(numRows, 0, Showcase.images.gwtLogo().createImage());
- flexTable.setWidget(numRows, 1, Showcase.images.gwtLogo().createImage());
+ flexTable.setWidget(numRows, 0, new Image(Showcase.images.gwtLogo()));
+ flexTable.setWidget(numRows, 1, new Image(Showcase.images.gwtLogo()));
flexTable.getFlexCellFormatter().setRowSpan(0, 1, numRows + 1);
}
diff --git a/samples/showcase/src/com/google/gwt/sample/showcase/client/content/tables/CwGrid.java b/samples/showcase/src/com/google/gwt/sample/showcase/client/content/tables/CwGrid.java
index 2f0d1d8..beea730 100644
--- a/samples/showcase/src/com/google/gwt/sample/showcase/client/content/tables/CwGrid.java
+++ b/samples/showcase/src/com/google/gwt/sample/showcase/client/content/tables/CwGrid.java
@@ -24,6 +24,7 @@
import com.google.gwt.sample.showcase.client.ShowcaseAnnotations.ShowcaseSource;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.Grid;
+import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.Widget;
/**
@@ -86,7 +87,7 @@
int numColumns = grid.getColumnCount();
for (int row = 0; row < numRows; row++) {
for (int col = 0; col < numColumns; col++) {
- grid.setWidget(row, col, Showcase.images.gwtLogo().createImage());
+ grid.setWidget(row, col, new Image(Showcase.images.gwtLogo()));
}
}
diff --git a/samples/showcase/src/com/google/gwt/sample/showcase/client/content/text/RichTextToolbar.java b/samples/showcase/src/com/google/gwt/sample/showcase/client/content/text/RichTextToolbar.java
index 2a5816b..da6bfc9 100644
--- a/samples/showcase/src/com/google/gwt/sample/showcase/client/content/text/RichTextToolbar.java
+++ b/samples/showcase/src/com/google/gwt/sample/showcase/client/content/text/RichTextToolbar.java
@@ -23,11 +23,12 @@
import com.google.gwt.event.dom.client.KeyUpEvent;
import com.google.gwt.event.dom.client.KeyUpHandler;
import com.google.gwt.i18n.client.Constants;
+import com.google.gwt.resources.client.ClientBundle;
+import com.google.gwt.resources.client.ImageResource;
import com.google.gwt.user.client.Window;
-import com.google.gwt.user.client.ui.AbstractImagePrototype;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HorizontalPanel;
-import com.google.gwt.user.client.ui.ImageBundle;
+import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.ListBox;
import com.google.gwt.user.client.ui.PushButton;
import com.google.gwt.user.client.ui.RichTextArea;
@@ -43,47 +44,47 @@
public class RichTextToolbar extends Composite {
/**
- * This {@link ImageBundle} is used for all the button icons. Using an image
- * bundle allows all of these images to be packed into a single image, which
- * saves a lot of HTTP requests, drastically improving startup time.
+ * This {@link ClientBundle} is used for all the button icons. Using a bundle
+ * allows all of these images to be packed into a single image, which saves a
+ * lot of HTTP requests, drastically improving startup time.
*/
- public interface Images extends ImageBundle {
+ public interface Images extends ClientBundle {
- AbstractImagePrototype bold();
+ ImageResource bold();
- AbstractImagePrototype createLink();
+ ImageResource createLink();
- AbstractImagePrototype hr();
+ ImageResource hr();
- AbstractImagePrototype indent();
+ ImageResource indent();
- AbstractImagePrototype insertImage();
+ ImageResource insertImage();
- AbstractImagePrototype italic();
+ ImageResource italic();
- AbstractImagePrototype justifyCenter();
+ ImageResource justifyCenter();
- AbstractImagePrototype justifyLeft();
+ ImageResource justifyLeft();
- AbstractImagePrototype justifyRight();
+ ImageResource justifyRight();
- AbstractImagePrototype ol();
+ ImageResource ol();
- AbstractImagePrototype outdent();
+ ImageResource outdent();
- AbstractImagePrototype removeFormat();
+ ImageResource removeFormat();
- AbstractImagePrototype removeLink();
+ ImageResource removeLink();
- AbstractImagePrototype strikeThrough();
+ ImageResource strikeThrough();
- AbstractImagePrototype subscript();
+ ImageResource subscript();
- AbstractImagePrototype superscript();
+ ImageResource superscript();
- AbstractImagePrototype ul();
+ ImageResource ul();
- AbstractImagePrototype underline();
+ ImageResource underline();
}
/**
@@ -409,15 +410,15 @@
return lb;
}
- private PushButton createPushButton(AbstractImagePrototype img, String tip) {
- PushButton pb = new PushButton(img.createImage());
+ private PushButton createPushButton(ImageResource img, String tip) {
+ PushButton pb = new PushButton(new Image(img));
pb.addClickHandler(handler);
pb.setTitle(tip);
return pb;
}
- private ToggleButton createToggleButton(AbstractImagePrototype img, String tip) {
- ToggleButton tb = new ToggleButton(img.createImage());
+ private ToggleButton createToggleButton(ImageResource img, String tip) {
+ ToggleButton tb = new ToggleButton(new Image(img));
tb.addClickHandler(handler);
tb.setTitle(tip);
return tb;
diff --git a/samples/showcase/src/com/google/gwt/sample/showcase/client/content/widgets/CwCustomButton.java b/samples/showcase/src/com/google/gwt/sample/showcase/client/content/widgets/CwCustomButton.java
index 472d5de..f8ce454 100644
--- a/samples/showcase/src/com/google/gwt/sample/showcase/client/content/widgets/CwCustomButton.java
+++ b/samples/showcase/src/com/google/gwt/sample/showcase/client/content/widgets/CwCustomButton.java
@@ -26,6 +26,7 @@
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HorizontalPanel;
+import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.PushButton;
import com.google.gwt.user.client.ui.ToggleButton;
import com.google.gwt.user.client.ui.VerticalPanel;
@@ -98,26 +99,26 @@
// Add a normal PushButton
PushButton normalPushButton = new PushButton(
- Showcase.images.gwtLogo().createImage());
+ new Image(Showcase.images.gwtLogo()));
normalPushButton.ensureDebugId("cwCustomButton-push-normal");
pushPanel.add(normalPushButton);
// Add a disabled PushButton
PushButton disabledPushButton = new PushButton(
- Showcase.images.gwtLogo().createImage());
+ new Image(Showcase.images.gwtLogo()));
disabledPushButton.ensureDebugId("cwCustomButton-push-disabled");
disabledPushButton.setEnabled(false);
pushPanel.add(disabledPushButton);
// Add a normal ToggleButton
ToggleButton normalToggleButton = new ToggleButton(
- Showcase.images.gwtLogo().createImage());
+ new Image(Showcase.images.gwtLogo()));
normalToggleButton.ensureDebugId("cwCustomButton-toggle-normal");
togglePanel.add(normalToggleButton);
// Add a disabled ToggleButton
ToggleButton disabledToggleButton = new ToggleButton(
- Showcase.images.gwtLogo().createImage());
+ new Image(Showcase.images.gwtLogo()));
disabledToggleButton.ensureDebugId("cwCustomButton-toggle-disabled");
disabledToggleButton.setEnabled(false);
togglePanel.add(disabledToggleButton);
diff --git a/tools/api-checker/config/gwt16_20userApi.conf b/tools/api-checker/config/gwt16_20userApi.conf
index 04471a9..fdd17a0 100644
--- a/tools/api-checker/config/gwt16_20userApi.conf
+++ b/tools/api-checker/config/gwt16_20userApi.conf
@@ -92,3 +92,12 @@
com.google.gwt.i18n.client.LocaleInfo::isRTL() FINAL_ADDED
# added addAndReplaceElement(Widget, Element) in 2.0
com.google.gwt.user.client.ui.HTMLPanel::addAndReplaceElement(Lcom/google/gwt/user/client/ui/Widget;Ljava/lang/String;) OVERLOADED_METHOD_CALL
+
+# Deprecating ImageBundle
+com.google.gwt.user.client.ui.HorizontalSplitPanel::HorizontalSplitPanel(Lcom/google/gwt/user/client/ui/HorizontalSplitPanelImages;) OVERLOADED_METHOD_CALL
+com.google.gwt.user.client.ui.MenuBar::MenuBar(ZLcom/google/gwt/user/client/ui/MenuBar$MenuBarImages;) OVERLOADED_METHOD_CALL
+com.google.gwt.user.client.ui.Tree::Tree(Lcom/google/gwt/user/client/ui/TreeImages;) OVERLOADED_METHOD_CALL
+com.google.gwt.user.client.ui.Tree::Tree(Lcom/google/gwt/user/client/ui/TreeImages;Z) OVERLOADED_METHOD_CALL
+com.google.gwt.user.client.ui.Tree::getImageBase() MISSING
+com.google.gwt.user.client.ui.VerticalSplitPanel::VerticalSplitPanel(Lcom/google/gwt/user/client/ui/VerticalSplitPanelImages;) OVERLOADED_METHOD_CALL
+
diff --git a/user/src/com/google/gwt/user/client/ui/AbstractImagePrototype.java b/user/src/com/google/gwt/user/client/ui/AbstractImagePrototype.java
index e7e81e8..ee80f69 100644
--- a/user/src/com/google/gwt/user/client/ui/AbstractImagePrototype.java
+++ b/user/src/com/google/gwt/user/client/ui/AbstractImagePrototype.java
@@ -16,6 +16,8 @@
package com.google.gwt.user.client.ui;
import com.google.gwt.dom.client.Element;
+import com.google.gwt.resources.client.ImageResource;
+import com.google.gwt.user.client.ui.impl.ClippedImagePrototype;
/**
* An opaque representation of a particular image such that the image can be
@@ -25,10 +27,10 @@
*
* <p>
* The {@link #applyTo(Image)} method provides an efficient way to replace the
- * contents of an existing <code>Image</code>. This is useful in cases where
- * an image changes its appearance based on a user's action. Instead of creating
- * two <code>Image</code> objects then alternately hiding/showing them, one
- * can use the {@link #applyTo(Image)} method of two
+ * contents of an existing <code>Image</code>. This is useful in cases where an
+ * image changes its appearance based on a user's action. Instead of creating
+ * two <code>Image</code> objects then alternately hiding/showing them, one can
+ * use the {@link #applyTo(Image)} method of two
* <code>AbstractImagePrototype</code> objects to transform a single
* <code>Image</code> object between two (or more) visual representations. The
* use of <code>AbstractImagePrototypes</code> results in an cleaner and more
@@ -59,6 +61,20 @@
}
/**
+ * Create an AbstractImagePrototype backed by a ClientBundle ImageResource.
+ * This method provides an API compatibility mapping for the new ImageResource
+ * API.
+ *
+ * @param resource an ImageResource produced by a ClientBundle
+ * @return an AbstractImagePrototype that displays the contents of the
+ * ImageResource
+ */
+ public static AbstractImagePrototype create(ImageResource resource) {
+ return new ClippedImagePrototype(resource.getURL(), resource.getLeft(),
+ resource.getTop(), resource.getWidth(), resource.getHeight());
+ }
+
+ /**
* Transforms an existing {@link Image} into the image represented by this
* prototype.
*
diff --git a/user/src/com/google/gwt/user/client/ui/HorizontalSplitPanel.java b/user/src/com/google/gwt/user/client/ui/HorizontalSplitPanel.java
index 90522d8..aa641ec 100644
--- a/user/src/com/google/gwt/user/client/ui/HorizontalSplitPanel.java
+++ b/user/src/com/google/gwt/user/client/ui/HorizontalSplitPanel.java
@@ -16,12 +16,14 @@
package com.google.gwt.user.client.ui;
import com.google.gwt.core.client.GWT;
+import com.google.gwt.i18n.client.LocaleInfo;
+import com.google.gwt.resources.client.ClientBundle;
+import com.google.gwt.resources.client.ImageResource;
import com.google.gwt.user.client.Command;
import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.DeferredCommand;
import com.google.gwt.user.client.Element;
import com.google.gwt.user.client.Timer;
-import com.google.gwt.i18n.client.LocaleInfo;
/**
* A panel that arranges two widgets in a single horizontal row and allows the
@@ -34,12 +36,22 @@
* </p>
*
* <h3>CSS Style Rules</h3>
- * <ul class='css'>
+ * <ul>
* <li>.gwt-HorizontalSplitPanel { the panel itself }</li>
* <li>.gwt-HorizontalSplitPanel hsplitter { the splitter }</li>
* </ul>
*/
public final class HorizontalSplitPanel extends SplitPanel {
+ /**
+ * The default resources used by this widget.
+ */
+ public interface Resources extends ClientBundle {
+ /**
+ * An image representing the drag thumb.
+ */
+ @Source("splitPanelThumb.png")
+ ImageResource horizontalSplitPanelThumb();
+ }
/**
* The standard implementation for horizontal split panels.
@@ -67,17 +79,17 @@
// Right now, both panes are stacked on top of each other
// on either the left side or the right side of the containing
- // panel. This happens because both panes have position:absolute
- // and no left/top values. The panes will be on the left side
- // if the directionality is LTR, and on the right side if the
- // directionality is RTL. In the LTR case, we need to snap the
+ // panel. This happens because both panes have position:absolute
+ // and no left/top values. The panes will be on the left side
+ // if the directionality is LTR, and on the right side if the
+ // directionality is RTL. In the LTR case, we need to snap the
// right pane to the right of the container, and in the RTL case,
- // we need to snap the left pane to the left of the container.
- if (LocaleInfo.getCurrentLocale().isRTL()) {
- setLeft(panel.getElement(LEFT), "0px");
- } else {
+ // we need to snap the left pane to the left of the container.
+ if (LocaleInfo.getCurrentLocale().isRTL()) {
+ setLeft(panel.getElement(LEFT), "0px");
+ } else {
setRight(panel.getElement(RIGHT), "0px");
- }
+ }
}
public void onAttach() {
@@ -90,7 +102,7 @@
setSplitPositionUsingPixels(px);
}
- public void setSplitPosition(String pos) {
+ public void setSplitPosition(String pos) {
final Element leftElem = panel.getElement(LEFT);
setWidth(leftElem, pos);
setSplitPositionUsingPixels(getOffsetWidth(leftElem));
@@ -99,10 +111,9 @@
/**
* Set the splitter's position in units of pixels.
*
- * px represents the splitter's position as a distance
- * of px pixels from the left edge of the container. This is
- * true even in a bidi environment. Callers of this method
- * must be aware of this constraint.
+ * px represents the splitter's position as a distance of px pixels from the
+ * left edge of the container. This is true even in a bidi environment.
+ * Callers of this method must be aware of this constraint.
*/
public void setSplitPositionUsingPixels(int px) {
final Element splitElem = panel.getSplitElement();
@@ -146,7 +157,7 @@
/**
* Implemented by subclasses.
- *
+ *
* @param rightElem
* @param newRightWidth
*/
@@ -161,7 +172,8 @@
/**
* The IE6 implementation for horizontal split panels.
*/
- @SuppressWarnings("unused") // will be used by IE6 permutation
+ @SuppressWarnings("unused")
+ // will be used by IE6 permutation
private static class ImplIE6 extends Impl {
private boolean isResizeInProgress = false;
@@ -173,17 +185,17 @@
this.panel = panel;
final Element elem = panel.getElement();
-
+
// Prevents inherited text-align settings from interfering with the
// panel's layout. The setting we choose must be bidi-sensitive,
// as left-alignment is the default with LTR directionality, and
- // right-alignment is the default with RTL directionality.
+ // right-alignment is the default with RTL directionality.
if (LocaleInfo.getCurrentLocale().isRTL()) {
DOM.setStyleAttribute(elem, "textAlign", "right");
} else {
- DOM.setStyleAttribute(elem, "textAlign", "left");
+ DOM.setStyleAttribute(elem, "textAlign", "left");
}
-
+
DOM.setStyleAttribute(elem, "position", "relative");
/*
@@ -198,11 +210,11 @@
expandToFitParentUsingPercentages(panel.container);
if (LocaleInfo.getCurrentLocale().isRTL()) {
- // Snap the left pane to the left edge of the container. We
- // only need to do this when layout is RTL; if we don't, the
+ // Snap the left pane to the left edge of the container. We
+ // only need to do this when layout is RTL; if we don't, the
// left pane will overlap the right pane.
setLeft(panel.getElement(LEFT), "0px");
- }
+ }
}
@Override
@@ -262,20 +274,20 @@
// Set the width of the right side.
setWidth(panel.getElement(RIGHT), newRightWidth + "px");
-
- // Move the splitter to the right edge of the left element.
- setLeft(splitElem, px + "px");
-
- // Update the width of the left side
+
+ // Move the splitter to the right edge of the left element.
+ setLeft(splitElem, px + "px");
+
+ // Update the width of the left side
if (px == 0) {
- // This takes care of a qurky RTL layout bug with IE6.
+ // This takes care of a qurky RTL layout bug with IE6.
// During DOM construction and layout, onResize events
- // are fired, and this method is called with px == 0.
+ // are fired, and this method is called with px == 0.
// If one tries to set the width of the LEFT element to
// before layout completes, the RIGHT element will
// appear to be blanked out.
-
+
DeferredCommand.addCommand(new Command() {
public void execute() {
setWidth(panel.getElement(LEFT), "0px");
@@ -284,7 +296,7 @@
} else {
setWidth(panel.getElement(LEFT), px + "px");
}
-
+
} else {
super.setSplitPositionUsingPixels(px);
}
@@ -310,7 +322,7 @@
setHeight(rightElem, height);
setHeight(panel.getSplitElement(), height);
setHeight(leftElem, height);
- setSplitPositionUsingPixels(getOffsetWidth(leftElem));
+ setSplitPositionUsingPixels(getOffsetWidth(leftElem));
}
}
@@ -318,7 +330,8 @@
* The Safari implementation which owes its existence entirely to a single
* WebKit bug: http://bugs.webkit.org/show_bug.cgi?id=9137.
*/
- @SuppressWarnings("unused") // will be used by Safari permutation
+ @SuppressWarnings("unused")
+ // will be used by Safari permutation
private static class ImplSafari extends Impl {
@Override
public void init(HorizontalSplitPanel panel) {
@@ -360,22 +373,37 @@
private int initialLeftWidth;
public HorizontalSplitPanel() {
- this(GWT.<HorizontalSplitPanelImages>create(HorizontalSplitPanelImages.class));
+ this(GWT.<Resources> create(Resources.class));
}
/**
* Creates an empty horizontal split panel.
*
- * @param images ImageBundle containing an image for the splitter's drag
- * thumb
+ * @param images ImageBundle containing an image for the splitter's drag thumb
+ * @deprecated replaced by {@link #HorizontalSplitPanel(Resources)}
*/
+ @Deprecated
public HorizontalSplitPanel(HorizontalSplitPanelImages images) {
+ this(images.horizontalSplitPanelThumb());
+ }
+
+ /**
+ * Creates an empty horizontal split panel.
+ *
+ * @param resources ClientBundle containing an image for the splitter's drag
+ * thumb
+ */
+ public HorizontalSplitPanel(Resources resources) {
+ this(AbstractImagePrototype.create(resources.horizontalSplitPanelThumb()));
+ }
+
+ private HorizontalSplitPanel(AbstractImagePrototype thumbImage) {
super(DOM.createDiv(), DOM.createDiv(), preventBoxStyles(DOM.createDiv()),
preventBoxStyles(DOM.createDiv()));
container = preventBoxStyles(DOM.createDiv());
- buildDOM(images.horizontalSplitPanelThumb());
+ buildDOM(thumbImage);
setStyleName("gwt-HorizontalSplitPanel");
@@ -388,17 +416,16 @@
}
/**
- * Adds a widget to a pane in the HorizontalSplitPanel. The method
- * will first attempt to add the widget to the left pane. If a
- * widget is already in that position, it will attempt to add the
- * widget to the right pane. If a widget is already in that position,
- * an exception will be thrown, as a HorizontalSplitPanel can
- * contain at most two widgets.
+ * Adds a widget to a pane in the HorizontalSplitPanel. The method will first
+ * attempt to add the widget to the left pane. If a widget is already in that
+ * position, it will attempt to add the widget to the right pane. If a widget
+ * is already in that position, an exception will be thrown, as a
+ * HorizontalSplitPanel can contain at most two widgets.
*
- * Note that this method is bidi-sensitive. In an RTL environment,
- * this method will first attempt to add the widget to the right pane,
- * and if a widget is already in that position, it will attempt to add
- * the widget to the left pane.
+ * Note that this method is bidi-sensitive. In an RTL environment, this method
+ * will first attempt to add the widget to the right pane, and if a widget is
+ * already in that position, it will attempt to add the widget to the left
+ * pane.
*
* @param w the widget to be added
* @throws IllegalStateException
@@ -416,17 +443,16 @@
}
/**
- * Gets the widget in the pane that is at the end of the line
- * direction for the layout. That is, in an RTL layout, gets
- * the widget in the left pane, and in an LTR layout, gets
- * the widget in the right pane.
- *
+ * Gets the widget in the pane that is at the end of the line direction for
+ * the layout. That is, in an RTL layout, gets the widget in the left pane,
+ * and in an LTR layout, gets the widget in the right pane.
+ *
* @return the widget, <code>null</code> if there is not one.
*/
public Widget getEndOfLineWidget() {
return getWidget(getEndOfLinePos());
}
-
+
/**
* Gets the widget in the left side of the panel.
*
@@ -446,11 +472,10 @@
}
/**
- * Gets the widget in the pane that is at the start of the line
- * direction for the layout. That is, in an RTL environment, gets
- * the widget in the right pane, and in an LTR environment, gets
- * the widget in the left pane.
- *
+ * Gets the widget in the pane that is at the start of the line direction for
+ * the layout. That is, in an RTL environment, gets the widget in the right
+ * pane, and in an LTR environment, gets the widget in the left pane.
+ *
* @return the widget, <code>null</code> if there is not one.
*/
public Widget getStartOfLineWidget() {
@@ -458,11 +483,10 @@
}
/**
- * Sets the widget in the pane that is at the end of the line direction
- * for the layout. That is, in an RTL layout, sets the widget in
- * the left pane, and in and RTL layout, sets the widget in the
- * right pane.
- *
+ * Sets the widget in the pane that is at the end of the line direction for
+ * the layout. That is, in an RTL layout, sets the widget in the left pane,
+ * and in and RTL layout, sets the widget in the right pane.
+ *
* @param w the widget
*/
public void setEndOfLineWidget(Widget w) {
@@ -479,22 +503,22 @@
}
/**
- * Sets the widget in the right side of the panel.
+ * Sets the widget in the right side of the panel.
*
* @param w the widget
*/
- public void setRightWidget(Widget w) {
+ public void setRightWidget(Widget w) {
setWidget(RIGHT, w);
}
-
+
/**
* Moves the position of the splitter.
- *
- * This method is not bidi-sensitive. The size specified is always
- * the size of the left region, regardless of directionality.
- *
+ *
+ * This method is not bidi-sensitive. The size specified is always the size of
+ * the left region, regardless of directionality.
+ *
* @param pos the new size of the left region in CSS units (e.g. "10px",
- * "1em")
+ * "1em")
*/
@Override
public void setSplitPosition(String pos) {
@@ -503,11 +527,10 @@
}
/**
- * Sets the widget in the pane that is at the start of the line direction
- * for the layout. That is, in an RTL layout, sets the widget in
- * the right pane, and in and RTL layout, sets the widget in the
- * left pane.
- *
+ * Sets the widget in the pane that is at the start of the line direction for
+ * the layout. That is, in an RTL layout, sets the widget in the right pane,
+ * and in and RTL layout, sets the widget in the left pane.
+ *
* @param w the widget
*/
public void setStartOfLineWidget(Widget w) {
@@ -521,7 +544,7 @@
* <li>-right = the container on the right side of the splitter.</li>
* <li>-left = the container on the left side of the splitter.</li>
* </ul>
- *
+ *
* @see UIObject#onEnsureDebugId(String)
*/
@Override
@@ -593,7 +616,7 @@
private int getEndOfLinePos() {
return (LocaleInfo.getCurrentLocale().isRTL() ? LEFT : RIGHT);
}
-
+
private int getStartOfLinePos() {
return (LocaleInfo.getCurrentLocale().isRTL() ? RIGHT : LEFT);
}
diff --git a/user/src/com/google/gwt/user/client/ui/HorizontalSplitPanelImages.java b/user/src/com/google/gwt/user/client/ui/HorizontalSplitPanelImages.java
index cf491c9..8744263 100644
--- a/user/src/com/google/gwt/user/client/ui/HorizontalSplitPanelImages.java
+++ b/user/src/com/google/gwt/user/client/ui/HorizontalSplitPanelImages.java
@@ -18,7 +18,10 @@
/**
* An {@link ImageBundle} that provides images for
* {@link com.google.gwt.user.client.ui.HorizontalSplitPanel}.
+ *
+ * @deprecated replaced by {@link HorizontalSplitPanel.Resources}.
*/
+@Deprecated
public interface HorizontalSplitPanelImages extends ImageBundle {
/**
diff --git a/user/src/com/google/gwt/user/client/ui/ImageBundle.java b/user/src/com/google/gwt/user/client/ui/ImageBundle.java
index 203ef77..82b1f46 100644
--- a/user/src/com/google/gwt/user/client/ui/ImageBundle.java
+++ b/user/src/com/google/gwt/user/client/ui/ImageBundle.java
@@ -264,7 +264,10 @@
* @see com.google.gwt.user.client.ui.Image#setVisibleRect(int, int, int, int)
* @see com.google.gwt.user.client.ui.Image#setUrlAndVisibleRect(String, int,
* int, int, int)
+ * @deprecated replaced by {@link com.google.gwt.resources.client.ClientBundle}
+ * and {@link com.google.gwt.resources.client.ImageResource}
*/
+@Deprecated
public interface ImageBundle {
/**
diff --git a/user/src/com/google/gwt/user/client/ui/MenuBar.java b/user/src/com/google/gwt/user/client/ui/MenuBar.java
index 468120b..6f2c700 100644
--- a/user/src/com/google/gwt/user/client/ui/MenuBar.java
+++ b/user/src/com/google/gwt/user/client/ui/MenuBar.java
@@ -1,12 +1,12 @@
/*
* 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
@@ -23,6 +23,9 @@
import com.google.gwt.event.logical.shared.HasCloseHandlers;
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.i18n.client.LocaleInfo;
+import com.google.gwt.resources.client.ClientBundle;
+import com.google.gwt.resources.client.ImageResource;
+import com.google.gwt.resources.client.ImageResource.ImageOptions;
import com.google.gwt.user.client.Command;
import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.DeferredCommand;
@@ -38,11 +41,11 @@
* A standard menu bar widget. A menu bar can contain any number of menu items,
* each of which can either fire a {@link com.google.gwt.user.client.Command} or
* open a cascaded menu bar.
- *
+ *
* <p>
* <img class='gallery' src='MenuBar.png'/>
* </p>
- *
+ *
* <h3>CSS Style Rules</h3>
* <dl>
* <dt>.gwt-MenuBar</dt>
@@ -96,7 +99,7 @@
* <dt>.gwt-MenuBarPopup .menuPopupBottomRightInner</dt>
* <dd>the inner element of the cell</dd>
* </dl>
- *
+ *
* <p>
* <h3>Example</h3>
* {@example com.google.gwt.examples.MenuBarExample}
@@ -109,34 +112,28 @@
HasCloseHandlers<PopupPanel> {
/**
* An {@link ImageBundle} that provides images for {@link MenuBar}.
+ *
+ * @deprecated replaced by {@link Resources}
*/
+ @Deprecated
public interface MenuBarImages extends ImageBundle {
/**
* An image indicating a {@link MenuItem} has an associated submenu.
- *
+ *
* @return a prototype of this image
*/
AbstractImagePrototype menuBarSubMenuIcon();
}
/**
- * A bundle containing the RTL versions of the images for MenuBar.
- *
- * Notice that this interface is package protected. This interface need not be
- * publicly exposed, as it is only used by the MenuBar class to provide RTL
- * versions of the images in the case the the user does not pass in their own
- * bundle. However, we cannot make this class private, because the generated
- * class needs to be able to extend this class.
+ * A ClientBundle that contains the default resources for this widget.
*/
- interface MenuBarImagesRTL extends MenuBarImages {
+ public interface Resources extends ClientBundle {
/**
- * An image indicating a {@link MenuItem} has an associated submenu for a
- * RTL context.
- *
- * @return a prototype of this image
+ * An image indicating a {@link MenuItem} has an associated submenu.
*/
- @Resource("menuBarSubMenuIcon_rtl.gif")
- AbstractImagePrototype menuBarSubMenuIcon();
+ @ImageOptions(flipRtl = true)
+ ImageResource menuBarSubMenuIcon();
}
private static final String STYLENAME_DEFAULT = "gwt-MenuBar";
@@ -153,7 +150,7 @@
private Element body;
- private MenuBarImages images = null;
+ private AbstractImagePrototype subMenuIcon = null;
private boolean isAnimationEnabled = false;
private MenuBar parentMenu;
private PopupPanel popup;
@@ -170,46 +167,67 @@
/**
* Creates an empty menu bar.
- *
+ *
* @param vertical <code>true</code> to orient the menu bar vertically
*/
public MenuBar(boolean vertical) {
- super();
- if (LocaleInfo.getCurrentLocale().isRTL()) {
- init(vertical, GWT.<MenuBarImagesRTL> create(MenuBarImagesRTL.class));
- } else {
- init(vertical, GWT.<MenuBarImages> create(MenuBarImages.class));
- }
+ this(vertical, GWT.<Resources> create(Resources.class));
}
/**
* Creates an empty menu bar that uses the specified image bundle for menu
* images.
- *
+ *
* @param vertical <code>true</code> to orient the menu bar vertically
* @param images a bundle that provides images for this menu
+ * @deprecated replaced by {@link #MenuBar(boolean, Resources)}
*/
+ @Deprecated
public MenuBar(boolean vertical, MenuBarImages images) {
- init(vertical, images);
+ init(vertical, images.menuBarSubMenuIcon());
+ }
+
+ /**
+ * Creates an empty menu bar that uses the specified ClientBundle for menu
+ * images.
+ *
+ * @param vertical <code>true</code> to orient the menu bar vertically
+ * @param resources a bundle that provides images for this menu
+ */
+ public MenuBar(boolean vertical, Resources resources) {
+ init(vertical,
+ AbstractImagePrototype.create(resources.menuBarSubMenuIcon()));
}
/**
* Creates an empty horizontal menu bar that uses the specified image bundle
* for menu images.
- *
+ *
* @param images a bundle that provides images for this menu
+ * @deprecated replaced by {@link #MenuBar(Resources)}
*/
+ @Deprecated
public MenuBar(MenuBarImages images) {
this(false, images);
}
+ /**
+ * Creates an empty horizontal menu bar that uses the specified ClientBundle
+ * for menu images.
+ *
+ * @param resources a bundle that provides images for this menu
+ */
+ public MenuBar(Resources resources) {
+ this(false, resources);
+ }
+
public HandlerRegistration addCloseHandler(CloseHandler<PopupPanel> handler) {
return addHandler(handler, CloseEvent.getType());
}
/**
* Adds a menu item to the bar.
- *
+ *
* @param item the item to be added
* @return the {@link MenuItem} object
*/
@@ -220,7 +238,7 @@
/**
* Adds a menu item to the bar, that will fire the given command when it is
* selected.
- *
+ *
* @param text the item's text
* @param asHTML <code>true</code> to treat the specified text as html
* @param cmd the command to be fired
@@ -233,7 +251,7 @@
/**
* Adds a menu item to the bar, that will open the specified menu when it is
* selected.
- *
+ *
* @param text the item's text
* @param asHTML <code>true</code> to treat the specified text as html
* @param popup the menu to be cascaded from it
@@ -246,7 +264,7 @@
/**
* Adds a menu item to the bar, that will fire the given command when it is
* selected.
- *
+ *
* @param text the item's text
* @param cmd the command to be fired
* @return the {@link MenuItem} object created
@@ -258,7 +276,7 @@
/**
* Adds a menu item to the bar, that will open the specified menu when it is
* selected.
- *
+ *
* @param text the item's text
* @param popup the menu to be cascaded from it
* @return the {@link MenuItem} object created
@@ -270,7 +288,7 @@
/**
* Adds a thin line to the {@link MenuBar} to separate sections of
* {@link MenuItem}s.
- *
+ *
* @return the {@link MenuItemSeparator} object created
*/
public MenuItemSeparator addSeparator() {
@@ -280,7 +298,7 @@
/**
* Adds a thin line to the {@link MenuBar} to separate sections of
* {@link MenuItem}s.
- *
+ *
* @param separator the {@link MenuItemSeparator} to be added
* @return the {@link MenuItemSeparator} object
*/
@@ -325,7 +343,7 @@
/**
* Gets whether this menu bar's child menus will open when the mouse is moved
* over it.
- *
+ *
* @return <code>true</code> if child menus will auto-open
*/
public boolean getAutoOpen() {
@@ -334,7 +352,7 @@
/**
* Get the index of a {@link MenuItem}.
- *
+ *
* @return the index of the item, or -1 if it is not contained by this MenuBar
*/
public int getItemIndex(MenuItem item) {
@@ -343,7 +361,7 @@
/**
* Get the index of a {@link MenuItemSeparator}.
- *
+ *
* @return the index of the separator, or -1 if it is not contained by this
* MenuBar
*/
@@ -353,7 +371,7 @@
/**
* Adds a menu item to the bar at a specific index.
- *
+ *
* @param item the item to be inserted
* @param beforeIndex the index where the item should be inserted
* @return the {@link MenuItem} object
@@ -388,7 +406,7 @@
/**
* Adds a thin line to the {@link MenuBar} to separate sections of
* {@link MenuItem}s at the specified index.
- *
+ *
* @param beforeIndex the index where the seperator should be inserted
* @return the {@link MenuItemSeparator} object
* @throws IndexOutOfBoundsException if <code>beforeIndex</code> is out of
@@ -401,7 +419,7 @@
/**
* Adds a thin line to the {@link MenuBar} to separate sections of
* {@link MenuItem}s at the specified index.
- *
+ *
* @param separator the {@link MenuItemSeparator} to be inserted
* @param beforeIndex the index where the seperator should be inserted
* @return the {@link MenuItemSeparator} object
@@ -429,14 +447,14 @@
}
/**
- * Moves the menu selection down to the next item. If there is no selection,
- * selects the first item. If there are no items at all, does nothing.
+ * Moves the menu selection down to the next item. If there is no selection,
+ * selects the first item. If there are no items at all, does nothing.
*/
public void moveSelectionDown() {
if (selectFirstItemIfNoneSelected()) {
return;
}
-
+
if (vertical) {
selectNextItem();
} else {
@@ -458,14 +476,14 @@
}
/**
- * Moves the menu selection up to the previous item. If there is no selection,
- * selects the first item. If there are no items at all, does nothing.
+ * Moves the menu selection up to the previous item. If there is no selection,
+ * selects the first item. If there are no items at all, does nothing.
*/
public void moveSelectionUp() {
if (selectFirstItemIfNoneSelected()) {
return;
}
-
+
if ((shownChildMenu == null) && vertical) {
selectPrevItem();
} else if ((parentMenu != null) && parentMenu.vertical) {
@@ -559,7 +577,7 @@
/**
* Closes the menu bar.
- *
+ *
* @deprecated Use {@link #addCloseHandler(CloseHandler)} instead
*/
@Deprecated
@@ -582,7 +600,7 @@
/**
* Removes the specified menu item from the bar.
- *
+ *
* @param item the item to be removed
*/
public void removeItem(MenuItem item) {
@@ -600,7 +618,7 @@
/**
* Removes the specified {@link MenuItemSeparator} from the bar.
- *
+ *
* @param separator the separator to be removed
*/
public void removeSeparator(MenuItemSeparator separator) {
@@ -611,6 +629,7 @@
/**
* Select the given MenuItem, which must be a direct child of this MenuBar.
+ *
* @param item the MenuItem to select, or null to clear selection
*/
public void selectItem(MenuItem item) {
@@ -659,7 +678,7 @@
/**
* Sets whether this menu bar's child menus will open when the mouse is moved
* over it.
- *
+ *
* @param autoOpen <code>true</code> to cause child menus to auto-open
*/
public void setAutoOpen(boolean autoOpen) {
@@ -670,7 +689,7 @@
* Returns a list containing the <code>MenuItem</code> objects in the menu
* bar. If there are no items in the menu bar, then an empty <code>List</code>
* object will be returned.
- *
+ *
* @return a list containing the <code>MenuItem</code> objects in the menu bar
*/
protected List<MenuItem> getItems() {
@@ -681,7 +700,7 @@
* Returns the <code>MenuItem</code> that is currently selected (highlighted)
* by the user. If none of the items in the menu are currently selected, then
* <code>null</code> will be returned.
- *
+ *
* @return the <code>MenuItem</code> that is currently selected, or
* <code>null</code> if no items are currently selected
*/
@@ -704,7 +723,7 @@
* <ul>
* <li>-item# = the {@link MenuItem} at the specified index.</li>
* </ul>
- *
+ *
* @see UIObject#onEnsureDebugId(String)
*/
@Override
@@ -729,7 +748,7 @@
* popup associated with it, the popup will be shown. If it has a command
* associated with it, and 'fireCommand' is true, then the command will be
* fired. Popups associated with other items will be hidden.
- *
+ *
* @param item the item whose popup is to be shown. @param fireCommand
* <code>true</code> if the item's command should be fired, <code>false</code>
* otherwise.
@@ -807,7 +826,7 @@
/**
* Set the IDs of the menu items.
- *
+ *
* @param baseID the base ID
*/
void setMenuItemDebugIds(String baseID) {
@@ -820,7 +839,7 @@
/**
* Show or hide the icon used for items with a submenu.
- *
+ *
* @param item the item with or without a submenu
*/
void updateSubmenuIcon(MenuItem item) {
@@ -850,7 +869,7 @@
setItemColSpan(item, 1);
Element td = DOM.createTD();
DOM.setElementProperty(td, "vAlign", "middle");
- DOM.setInnerHTML(td, images.menuBarSubMenuIcon().getHTML());
+ DOM.setInnerHTML(td, subMenuIcon.getHTML());
setStyleName(td, "subMenuIcon");
DOM.appendChild(tr, td);
}
@@ -859,7 +878,7 @@
/**
* Physically add the td element of a {@link MenuItem} or
* {@link MenuItemSeparator} to this {@link MenuBar}.
- *
+ *
* @param beforeIndex the index where the seperator should be inserted
* @param tdElem the td element to be added
*/
@@ -905,8 +924,8 @@
}
}
- private void init(boolean vertical, MenuBarImages images) {
- this.images = images;
+ private void init(boolean vertical, AbstractImagePrototype subMenuIcon) {
+ this.subMenuIcon = subMenuIcon;
Element table = DOM.createTable();
body = DOM.createTBody();
@@ -1092,7 +1111,7 @@
/**
* Removes the specified item from the {@link MenuBar} and the physical DOM
* structure.
- *
+ *
* @param item the item to be removed
* @return true if the item was removed
*/
@@ -1109,9 +1128,9 @@
}
/**
- * Selects the first item in the menu if no items are currently selected.
- * Has no effect if there are no items.
- *
+ * Selects the first item in the menu if no items are currently selected. Has
+ * no effect if there are no items.
+ *
* @return true if no item was previously selected, false otherwise
*/
private boolean selectFirstItemIfNoneSelected() {
@@ -1177,7 +1196,7 @@
/**
* Set the colspan of a {@link MenuItem} or {@link MenuItemSeparator}.
- *
+ *
* @param item the {@link MenuItem} or {@link MenuItemSeparator}
* @param colspan the colspan
*/
diff --git a/user/src/com/google/gwt/user/client/ui/Tree.java b/user/src/com/google/gwt/user/client/ui/Tree.java
index a0afc91..ca23648 100644
--- a/user/src/com/google/gwt/user/client/ui/Tree.java
+++ b/user/src/com/google/gwt/user/client/ui/Tree.java
@@ -53,6 +53,8 @@
import com.google.gwt.event.logical.shared.SelectionHandler;
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.i18n.client.LocaleInfo;
+import com.google.gwt.resources.client.ClientBundle;
+import com.google.gwt.resources.client.ImageResource;
import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.Element;
import com.google.gwt.user.client.Event;
@@ -92,77 +94,62 @@
HasCloseHandlers<TreeItem>, SourcesMouseEvents, HasAllMouseHandlers {
/**
- * Provides images to support the the deprecated case where a url prefix is
- * passed in through {@link Tree#setImageBase(String)}. This class is used in
- * such a way that it will be completely removed by the compiler if the
- * deprecated methods, {@link Tree#setImageBase(String)} and
- * {@link Tree#getImageBase()}, are not called.
+ * A ClientBundle that provides images for this widget.
*/
- private static class ImagesFromImageBase implements TreeImages {
+ public interface Resources extends ClientBundle {
/**
- * A convenience image prototype that implements
- * {@link AbstractImagePrototype#applyTo(Image)} for a specified image name.
+ * An image indicating a closed branch.
*/
- private class Prototype extends AbstractImagePrototype {
- private final String imageUrl;
+ ImageResource treeClosed();
- Prototype(String url) {
- imageUrl = url;
- }
+ /**
+ * An image indicating a leaf.
+ */
+ ImageResource treeLeaf();
- @Override
- public void applyTo(Image image) {
- image.setUrl(baseUrl + imageUrl);
- }
+ /**
+ * An image indicating an open branch.
+ */
+ ImageResource treeOpen();
+ }
- @Override
- public void applyTo(ImagePrototypeElement img) {
- DOM.setImgSrc(img.<Element> cast(), imageUrl);
- }
+ /**
+ * There are several ways of configuring images for the Tree widget due to
+ * deprecated APIs.
+ */
+ static class ImageAdapter {
+ private static final Resources DEFAULT_RESOURCES = GWT.create(Resources.class);
+ private final AbstractImagePrototype treeClosed;
+ private final AbstractImagePrototype treeLeaf;
+ private final AbstractImagePrototype treeOpen;
- @Override
- public ImagePrototypeElement createElement() {
- Element img = DOM.createImg();
- applyTo(img.<ImagePrototypeElement> cast());
- return img.cast();
- }
-
- @Override
- public Image createImage() {
- // NOTE: This class is only used internally and, therefore only needs
- // to support applyTo(Image).
- throw new UnsupportedOperationException("createImage is unsupported.");
- }
-
- @Override
- public String getHTML() {
- // NOTE: This class is only used internally and, therefore only needs
- // to support applyTo(Image).
- throw new UnsupportedOperationException("getHTML is unsupported.");
- }
+ public ImageAdapter() {
+ this(DEFAULT_RESOURCES);
}
- private final String baseUrl;
+ public ImageAdapter(Resources resources) {
+ treeClosed = AbstractImagePrototype.create(resources.treeClosed());
+ treeLeaf = AbstractImagePrototype.create(resources.treeLeaf());
+ treeOpen = AbstractImagePrototype.create(resources.treeOpen());
+ }
- ImagesFromImageBase(String baseUrl) {
- this.baseUrl = baseUrl;
+ public ImageAdapter(TreeImages images) {
+ treeClosed = images.treeClosed();
+ treeLeaf = images.treeLeaf();
+ treeOpen = images.treeOpen();
}
public AbstractImagePrototype treeClosed() {
- return new Prototype("tree_closed.gif");
+ return treeClosed;
}
public AbstractImagePrototype treeLeaf() {
- return new Prototype("tree_white.gif");
+ return treeLeaf;
}
public AbstractImagePrototype treeOpen() {
- return new Prototype("tree_open.gif");
- }
-
- String getBaseUrl() {
- return baseUrl;
+ return treeOpen;
}
}
@@ -235,7 +222,7 @@
private Element focusable;
- private TreeImages images;
+ private ImageAdapter images;
private String indentValue;
@@ -251,20 +238,39 @@
* Constructs an empty tree.
*/
public Tree() {
- if (LocaleInfo.getCurrentLocale().isRTL()) {
- init(GWT.<TreeImagesRTL> create(TreeImagesRTL.class), false);
- } else {
- init(GWT.<TreeImages> create(TreeImages.class), false);
- }
+ init(new ImageAdapter(), false);
+ }
+
+ /**
+ * Constructs a tree that uses the specified ClientBundle for images.
+ *
+ * @param resources a bundle that provides tree specific images
+ */
+ public Tree(Resources resources) {
+ init(new ImageAdapter(resources), false);
+ }
+
+ /**
+ * Constructs a tree that uses the specified ClientBundle for images. If this
+ * tree does not use leaf images, the width of the Resources's leaf image will
+ * control the leaf indent.
+ *
+ * @param resources a bundle that provides tree specific images
+ * @param useLeafImages use leaf images from bundle
+ */
+ public Tree(Resources resources, boolean useLeafImages) {
+ init(new ImageAdapter(resources), useLeafImages);
}
/**
* Constructs a tree that uses the specified image bundle for images.
*
* @param images a bundle that provides tree specific images
+ * @deprecated replaced by {@link #Tree(Resources)}
*/
+ @Deprecated
public Tree(TreeImages images) {
- init(images, true);
+ init(new ImageAdapter(images), false);
}
/**
@@ -274,9 +280,11 @@
*
* @param images a bundle that provides tree specific images
* @param useLeafImages use leaf images from bundle
+ * @deprecated replaced by {@link #Tree(Resources, boolean)}
*/
+ @Deprecated
public Tree(TreeImages images, boolean useLeafImages) {
- init(images, useLeafImages);
+ init(new ImageAdapter(images), useLeafImages);
}
/**
@@ -342,8 +350,8 @@
}
/**
- * @deprecated Use {@link #addKeyDownHandler}, {@link
- * #addKeyUpHandler} and {@link #addKeyPressHandler} instead
+ * @deprecated Use {@link #addKeyDownHandler}, {@link #addKeyUpHandler} and
+ * {@link #addKeyPressHandler} instead
*/
@Deprecated
public void addKeyboardListener(KeyboardListener listener) {
@@ -367,9 +375,9 @@
}
/**
- * @deprecated Use {@link #addMouseOverHandler} {@link
- * #addMouseMoveHandler}, {@link #addMouseDownHandler}, {@link
- * #addMouseUpHandler} and {@link #addMouseOutHandler} instead
+ * @deprecated Use {@link #addMouseOverHandler} {@link #addMouseMoveHandler},
+ * {@link #addMouseDownHandler}, {@link #addMouseUpHandler} and
+ * {@link #addMouseOutHandler} instead
*/
@Deprecated
public void addMouseListener(MouseListener listener) {
@@ -406,8 +414,8 @@
}
/**
- * @deprecated Use {@link #addSelectionHandler}, {@link
- * #addOpenHandler}, and {@link #addCloseHandler} instead
+ * @deprecated Use {@link #addSelectionHandler}, {@link #addOpenHandler}, and
+ * {@link #addCloseHandler} instead
*/
@Deprecated
public void addTreeListener(TreeListener listener) {
@@ -441,20 +449,6 @@
}
/**
- * Gets this tree's default image package.
- *
- * @return the tree's image package
- * @deprecated Use {@link #Tree(TreeImages)} as it provides a more efficient
- * and manageable way to supply a set of images to be used within
- * a tree
- */
- @Deprecated
- public String getImageBase() {
- return (images instanceof ImagesFromImageBase)
- ? ((ImagesFromImageBase) images).getBaseUrl() : GWT.getModuleBaseURL();
- }
-
- /**
* Gets the top-level tree item at the specified index.
*
* @param index the index to be retrieved
@@ -604,8 +598,8 @@
}
/**
- * @deprecated Use the {@link HandlerRegistration#removeHandler} method on
- * the object returned by {@link #addFocusHandler} instead
+ * @deprecated Use the {@link HandlerRegistration#removeHandler} method on the
+ * object returned by {@link #addFocusHandler} instead
*/
@Deprecated
public void removeFocusListener(FocusListener listener) {
@@ -631,8 +625,8 @@
}
/**
- * @deprecated Use the {@link HandlerRegistration#removeHandler}
- * method on the object returned by an add*Handler method instead
+ * @deprecated Use the {@link HandlerRegistration#removeHandler} method on the
+ * object returned by an add*Handler method instead
*/
@Deprecated
public void removeKeyboardListener(KeyboardListener listener) {
@@ -640,8 +634,8 @@
}
/**
- * @deprecated Use the {@link HandlerRegistration#removeHandler}
- * method on the object returned by an add*Handler method instead
+ * @deprecated Use the {@link HandlerRegistration#removeHandler} method on the
+ * object returned by an add*Handler method instead
*/
@Deprecated
public void removeMouseListener(MouseListener listener) {
@@ -649,8 +643,8 @@
}
/**
- * @deprecated Use the {@link HandlerRegistration#removeHandler}
- * method on the object returned by an add*Handler method instead
+ * @deprecated Use the {@link HandlerRegistration#removeHandler} method on the
+ * object returned by an add*Handler method instead
*/
@Deprecated
public void removeTreeListener(TreeListener listener) {
@@ -791,7 +785,7 @@
return childWidgets;
}
- TreeImages getImages() {
+ ImageAdapter getImages() {
return images;
}
@@ -939,7 +933,7 @@
return topClosedParent;
}
- private void init(TreeImages images, boolean useLeafImages) {
+ private void init(ImageAdapter images, boolean useLeafImages) {
setImages(images, useLeafImages);
setElement(DOM.createDiv());
@@ -1200,7 +1194,7 @@
}
}
- private void setImages(TreeImages images, boolean useLeafImages) {
+ private void setImages(ImageAdapter images, boolean useLeafImages) {
this.images = images;
this.useLeafImages = useLeafImages;
diff --git a/user/src/com/google/gwt/user/client/ui/TreeImages.java b/user/src/com/google/gwt/user/client/ui/TreeImages.java
index 7769371..fd9f1f5 100644
--- a/user/src/com/google/gwt/user/client/ui/TreeImages.java
+++ b/user/src/com/google/gwt/user/client/ui/TreeImages.java
@@ -22,7 +22,10 @@
* <p>
* <h3>Example</h3> {@example com.google.gwt.examples.TreeImagesExample}
* </p>
+ *
+ * @deprecated replaced by {@link Tree.Resources}.
*/
+@Deprecated
public interface TreeImages extends ImageBundle {
/**
@@ -46,17 +49,3 @@
*/
AbstractImagePrototype treeLeaf();
}
-
-/**
- * A bundle containing the RTL versions of the images for Tree. Right now, there is no
- * need to override any of the methods in TreeImages and specify a different image in
- * the RTL context, because the images that we're currently using are direction-agnostic.
- *
- * Notice that this interface is package protected. This interface need not be
- * publicly exposed, as it is only used by the Tree class to provide RTL
- * versions of the images in the case the the user does not pass in their own
- * bundle. However, we cannot make this class private, because the generated
- * class needs to be able to extend this class.
- */
-interface TreeImagesRTL extends TreeImages {
-}
diff --git a/user/src/com/google/gwt/user/client/ui/VerticalSplitPanel.java b/user/src/com/google/gwt/user/client/ui/VerticalSplitPanel.java
index 739e5ca..822e02e 100644
--- a/user/src/com/google/gwt/user/client/ui/VerticalSplitPanel.java
+++ b/user/src/com/google/gwt/user/client/ui/VerticalSplitPanel.java
@@ -16,6 +16,8 @@
package com.google.gwt.user.client.ui;
import com.google.gwt.core.client.GWT;
+import com.google.gwt.resources.client.ClientBundle;
+import com.google.gwt.resources.client.ImageResource;
import com.google.gwt.user.client.Command;
import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.DeferredCommand;
@@ -34,12 +36,22 @@
* </p>
*
* <h3>CSS Style Rules</h3>
- * <ul class='css'>
+ * <ul>
* <li>.gwt-VerticalSplitPanel { the panel itself }</li>
* <li>.gwt-VerticalSplitPanel vsplitter { the splitter }</li>
* </ul>
*/
public final class VerticalSplitPanel extends SplitPanel {
+ /**
+ * The default resources used by this widget.
+ */
+ public interface Resources extends ClientBundle {
+ /**
+ * An image representing the drag thumb.
+ */
+ @Source("splitPanelThumb.png")
+ ImageResource verticalSplitPanelThumb();
+ }
/**
* Provides a base implementation for splitter layout that relies on CSS
@@ -128,7 +140,8 @@
/**
* Provides an implementation for IE6/7 that relies on 100% length in CSS.
*/
- @SuppressWarnings("unused") // will be used by IE6 permutation
+ @SuppressWarnings("unused")
+ // will be used by IE6 permutation
private static class ImplIE6 extends Impl {
private static void expandToFitParentHorizontally(Element elem) {
@@ -228,11 +241,11 @@
}
private native void addResizeListener(Element container) /*-{
- var self = this;
- container.onresize = $entry(function() {
- self.@com.google.gwt.user.client.ui.VerticalSplitPanel$ImplIE6::onResize()();
- });
- }-*/;
+ var self = this;
+ container.onresize = $entry(function() {
+ self.@com.google.gwt.user.client.ui.VerticalSplitPanel$ImplIE6::onResize()();
+ });
+ }-*/;
private void onResize() {
setSplitPosition(getOffsetHeight(panel.getElement(TOP)));
@@ -265,19 +278,29 @@
private String lastSplitPosition;
public VerticalSplitPanel() {
- this(GWT.<VerticalSplitPanelImages>create(VerticalSplitPanelImages.class));
+ this(GWT.<Resources> create(Resources.class));
}
/**
* Creates an empty vertical split panel.
+ * @deprecated replaced by {@link #VerticalSplitPanel(Resources)}
*/
+ @Deprecated
public VerticalSplitPanel(VerticalSplitPanelImages images) {
+ this(images.verticalSplitPanelThumb());
+ }
+
+ public VerticalSplitPanel(Resources resources) {
+ this(AbstractImagePrototype.create(resources.verticalSplitPanelThumb()));
+ }
+
+ private VerticalSplitPanel(AbstractImagePrototype thumbImage) {
super(DOM.createDiv(), DOM.createDiv(), preventBoxStyles(DOM.createDiv()),
preventBoxStyles(DOM.createDiv()));
container = preventBoxStyles(DOM.createDiv());
- buildDOM(images.verticalSplitPanelThumb());
+ buildDOM(thumbImage);
setStyleName("gwt-VerticalSplitPanel");
diff --git a/user/src/com/google/gwt/user/client/ui/VerticalSplitPanelImages.java b/user/src/com/google/gwt/user/client/ui/VerticalSplitPanelImages.java
index 2bfdb84..9f68952 100644
--- a/user/src/com/google/gwt/user/client/ui/VerticalSplitPanelImages.java
+++ b/user/src/com/google/gwt/user/client/ui/VerticalSplitPanelImages.java
@@ -18,7 +18,10 @@
/**
* An {@link ImageBundle} that provides images for
* {@link com.google.gwt.user.client.ui.HorizontalSplitPanel}.
+ *
+ * @deprecated replaced by {@link VerticalSplitPanel.Resources}.
*/
+@Deprecated
public interface VerticalSplitPanelImages extends ImageBundle {
/**