package com.vaadin.tests.components.table;
import com.vaadin.data.Item;
import com.vaadin.data.Property.ValueChangeEvent;
import com.vaadin.data.Property.ValueChangeListener;
import com.vaadin.tests.components.TestBase;
import com.vaadin.ui.CheckBox;
import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.Select;
import com.vaadin.ui.Table;
@SuppressWarnings("serial")
public class ColumnHeaderAlignments extends TestBase {
private static final String BAZ = "Baz (right)";
private static final String BAR = "Bar (center)";
private static final String FOO = "Foo (left)";
private Table fooTable;
private Table barTable;
private Table bazTable;
@Override
protected void setup() {
Select theme = new Select();
theme.addItem("reindeer");
theme.addItem("runo");
theme.addItem("base");
theme.addItem("liferay");
theme.setValue("reindeer");
theme.setNullSelectionAllowed(false);
theme.setImmediate(true);
theme.addListener(new ValueChangeListener() {
@Override
public void valueChange(ValueChangeEvent event) {
setTheme(String.valueOf(event.getProperty().getValue()));
}
});
addComponent(theme);
CheckBox footers = new CheckBox("Show footers");
footers.addListener(new ValueChangeListener() {
@Override
public void valueChange(ValueChangeEvent event) {
boolean visible = (Boolean) event.getProperty().getValue();
fooTable.setFooterVisible(visible);
barTable.setFooterVisible(visible);
bazTable.setFooterVisible(visible);
}
});
footers.setImmediate(true);
addComponent(footers);
HorizontalLayout tables = new HorizontalLayout();
fooTable = createTable(null);
tables.addComponent(fooTable);
barTable = createTable("strong");
tables.addComponent(barTable);
bazTable = createTable("black");
tables.addComponent(bazTable);
addComponent(tables);
}
private Table createTable(String style) {
Table table = new Table();
table.addContainerProperty(FOO, String.class, "");
table.addContainerProperty(BAR, String.class, "");
table.addContainerProperty(BAZ, String.class, "");
table.setColumnAlignment(FOO, Table.ALIGN_LEFT);
table.setColumnAlignment(BAR, Table.ALIGN_CENTER);
table.setColumnAlignment(BAZ, Table.ALIGN_RIGHT);
if (style != null) {
table.setStyleName(style);
}
for (int i = 0; i < 100; i++) {
Item item = table.addItem(i);
item.getItemProperty(FOO).setValue("foo");
item.getItemProperty(BAR).setValue("bar");
item.getItemProperty(BAZ).setValue("baz");
}
return table;
}
@Override
protected String getDescription() {
return "Aligned column headers should have style names telling the alignment";
}
@Override
protected Integer getTicketNumber() {
return 5066;
}
}
/github_actions/github-actions-f50e11107c'>summaryrefslogtreecommitdiffstats
blob: 496a5fdb793a6cae72a02b769577dab5326e4366 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
/*
* tooltip_methods.js
*/
(function($) {
module("tooltip: methods");
test("destroy", function() {
var beforeHtml = $("#tooltipped1").parent().html();
var afterHtml = $("#tooltipped1").tooltip().tooltip("destroy").parent().html();
equal( afterHtml, beforeHtml );
});
test("open", function() {
var e = $("#tooltipped1").tooltip();
e.tooltip("open");
ok( $(".ui-tooltip").is(":visible") );
$(":ui-tooltip").tooltip("destroy");
});
/*
TODO currently tooltip doesn't override widget
can't return anything useful if no element is kept around and there's no useful reference
test("widget", function() {
var tooltip = $("#tooltipped1").tooltip();
same(tooltip.tooltip("widget")[0], $(".ui-tooltip")[0]);
same(tooltip.tooltip("widget").end()[0], tooltip[0]);
});
*/
})(jQuery);
|