import com.google.gwt.core.client.Scheduler.ScheduledCommand;
import com.google.gwt.dom.client.Document;
import com.google.gwt.dom.client.Element;
-import com.google.gwt.dom.client.ImageElement;
import com.google.gwt.dom.client.SpanElement;
import com.google.gwt.dom.client.Style.Display;
import com.google.gwt.dom.client.Style.Unit;
.getFirstChild();
if (rowUidl.hasAttribute("icon")) {
- // icons are in first content cell in TreeTable
- ImageElement icon = Document.get().createImageElement();
- icon.setClassName("v-icon");
- icon.setAlt("icon");
- icon.setSrc(client.translateVaadinUri(rowUidl
- .getStringAttribute("icon")));
- container.insertFirst(icon);
+ Icon icon = client.getIcon(rowUidl
+ .getStringAttribute("icon"));
+ icon.setAlternateText("icon");
+ container.insertFirst(icon.getElement());
}
String classname = "v-treetable-treespacer";
--- /dev/null
+package com.vaadin.tests.components.treetable;
+
+import static com.vaadin.server.Sizeable.Unit.PIXELS;
+
+import com.vaadin.server.FontAwesome;
+import com.vaadin.server.Resource;
+import com.vaadin.server.ThemeResource;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.ui.HorizontalLayout;
+import com.vaadin.ui.TreeTable;
+
+public class TreeTableRowIcons extends AbstractTestUI {
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ HorizontalLayout layout = new HorizontalLayout();
+ layout.setSpacing(true);
+ addComponent(layout);
+
+ layout.addComponent(createTreeTableAndPopulate(new ThemeResource(
+ "../runo/icons/16/ok.png")));
+ layout.addComponent(createTreeTableAndPopulate(FontAwesome.ANDROID));
+ }
+
+ private TreeTable createTreeTableAndPopulate(Resource icon) {
+ TreeTable tt = new TreeTable();
+ tt.addContainerProperty("Foo", String.class, "");
+ tt.setColumnWidth("Foo", 100);
+ tt.addContainerProperty("Bar", String.class, "");
+ tt.setColumnWidth("Bar", 100);
+ tt.setIcon(icon);
+ tt.setHeight(400, PIXELS);
+
+ Object item1 = tt.addItem(new Object[] { "Foo", "Bar" }, null);
+ Object item2 = tt.addItem(new Object[] { "Foo2", "Bar2" }, null);
+ tt.setItemIcon(item1, icon);
+ tt.setItemIcon(item2, icon);
+
+ tt.setParent(item2, item1);
+
+ tt.setCollapsed(item1, false);
+
+ return tt;
+ }
+
+ @Override
+ protected String getTestDescription() {
+ return "TreeTable should support font icons for items";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 14077;
+ }
+
+}
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright 2000-2014 Vaadin Ltd.
+ *
+ * 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.vaadin.tests.components.treetable;
+
+import java.io.IOException;
+
+import org.junit.Test;
+
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+public class TreeTableRowIconsTest extends MultiBrowserTest {
+
+ public final String SCREENSHOT_NAME = "TreeTableRowIcons";
+
+ @Test
+ public void checkScreenshot() throws IOException {
+ openTestURL();
+ compareScreen(SCREENSHOT_NAME);
+ }
+
+}