import com.google.gwt.query.client.plugins.widgets.ButtonWidgetFactory;
import com.google.gwt.query.client.plugins.widgets.CheckBoxWidgetFactory;
import com.google.gwt.query.client.plugins.widgets.DateBoxWidgetFactory;
+import com.google.gwt.query.client.plugins.widgets.DecoratorPanelWidgetFactory;
import com.google.gwt.query.client.plugins.widgets.DisclosurePanelWidgetFactory;
import com.google.gwt.query.client.plugins.widgets.ListBoxWidgetFactory;
import com.google.gwt.query.client.plugins.widgets.PasswordTextBoxWidgetFactory;
import com.google.gwt.query.client.plugins.widgets.TabPanelWidgetFactory.TabPanelOptions;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.CheckBox;
+import com.google.gwt.user.client.ui.DecoratorPanel;
import com.google.gwt.user.client.ui.DisclosurePanel;
import com.google.gwt.user.client.ui.ListBox;
import com.google.gwt.user.client.ui.PasswordTextBox;
*/
LazyWidgets<T> textArea(WidgetInitializer<TextArea> initializers);
+ /**
+ * Create a {@link DecoratorPanel} widget for each selected element.
+ */
+ LazyWidgets<T> decoratorPanel();
+
+ /**
+ * Create a {@link DecoratorPanel} widget for each selected element. The
+ * <code>initializers</code> will be called on each new {@link DecoratorPanel}
+ * created by passing them in parameter.
+ *
+ */
+ LazyWidgets<T> decoratorPanel(WidgetInitializer<DecoratorPanel> initializers);
+
/**
* Try to create a widget using the given factory and the given options for
* each element of the query. Returns a new gquery set of elements with the
import com.google.gwt.query.client.plugins.widgets.ButtonWidgetFactory;\r
import com.google.gwt.query.client.plugins.widgets.CheckBoxWidgetFactory;\r
import com.google.gwt.query.client.plugins.widgets.DateBoxWidgetFactory;\r
+import com.google.gwt.query.client.plugins.widgets.DecoratorPanelWidgetFactory;\r
import com.google.gwt.query.client.plugins.widgets.DisclosurePanelWidgetFactory;\r
import com.google.gwt.query.client.plugins.widgets.ListBoxWidgetFactory;\r
import com.google.gwt.query.client.plugins.widgets.PasswordTextBoxWidgetFactory;\r
import com.google.gwt.query.client.plugins.widgets.TabPanelWidgetFactory.TabPanelOptions;\r
import com.google.gwt.user.client.ui.Button;\r
import com.google.gwt.user.client.ui.CheckBox;\r
+import com.google.gwt.user.client.ui.DecoratorPanel;\r
import com.google.gwt.user.client.ui.DisclosurePanel;\r
import com.google.gwt.user.client.ui.ListBox;\r
import com.google.gwt.user.client.ui.PasswordTextBox;\r
return widgets(new TextAreaWidgetFactory(), initializers);\r
}\r
\r
+ /**\r
+ * Create a {@link DecoratorPanel} widget for each selected element. \r
+ */\r
+ public Widgets decoratorPanel() {\r
+ return widgets(new DecoratorPanelWidgetFactory(), null);\r
+ }\r
+\r
+ /**\r
+ * Create a {@link DecoratorPanel} widget for each selected element. The\r
+ * <code>initializers</code> will be called on each new {@link DecoratorPanel}\r
+ * created by passing them in parameter.\r
+ * \r
+ */\r
+ public Widgets decoratorPanel(WidgetInitializer<DecoratorPanel> initializers) {\r
+ return widgets(new DecoratorPanelWidgetFactory(), initializers);\r
+ }\r
+\r
+ \r
/**\r
* Try to create a widget using the given factory and the given options for\r
* each element of the query. Returns a new gquery set of elements with the\r
--- /dev/null
+/*
+ * Copyright 2011, The gwtquery team.
+ *
+ * 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.gwt.query.client.plugins.widgets;
+
+import com.google.gwt.dom.client.Element;
+import com.google.gwt.user.client.ui.DecoratorPanel;
+
+public class DecoratorPanelWidgetFactory implements
+ WidgetFactory<DecoratorPanel> {
+
+ public DecoratorPanelWidgetFactory() {
+ }
+
+ public DecoratorPanel create(Element e) {
+
+ DecoratorPanel decoratorPanel = new DecoratorPanel();
+
+ WidgetsUtils.replaceOrAppend(e, decoratorPanel);
+
+ decoratorPanel.add(new WidgetsHtmlPanel(e));
+
+ return decoratorPanel;
+ }
+
+}
public class WidgetsUtils {
- private static final String[] appendingTags = {
+ static final String[] appendingTags = {
"td", "th", "li"};
$(".stack").as(Widgets).stackPanel();\r
$(".checkBox").as(Widgets).checkBox();\r
$(".radio").as(Widgets).radioButton();\r
+ \r
+ $("body > div").as(Widgets).decoratorPanel();\r
\r
GWT.log("Found " + $(".btn").widgets().size() + " buttons widget");\r
\r