Browse Source

Merge branch '6.8'

Conflicts:
	WebContent/VAADIN/themes/base/treetable/treetable.css
	WebContent/release-notes.html
	src/com/vaadin/terminal/gwt/client/VUIDLBrowser.java
	src/com/vaadin/terminal/gwt/client/ui/textfield/VTextField.java
tags/7.0.0.beta1
Johannes Dahlström 12 years ago
parent
commit
52d8abf71b

+ 5
- 0
WebContent/VAADIN/themes/base/table/table.css View File

@@ -241,6 +241,11 @@
.v-off {
color: #ddd;
}

.v-table .v-checkbox {
display: inline-block;
}

/*************************************
* Drag'n'drop styles
*************************************/

+ 9
- 2
WebContent/VAADIN/themes/base/treetable/treetable.css View File

@@ -4,14 +4,17 @@
height: 10px;
/* defines the amount of indent per level */
width: 18px;
position: absolute;
left: 0;
top: 5px;
}

.v-treetable-node-closed {
background: url(../treetable/img/arrow-right.png) right center no-repeat;
background: url(../treetable/img/arrow-right.png) right top no-repeat;
}

.v-treetable-node-open {
background: url(../treetable/img/arrow-down.png) right center no-repeat;
background: url(../treetable/img/arrow-down.png) right top no-repeat;
}

.v-treetable .v-checkbox {
@@ -25,6 +28,10 @@
z-index: 10;
}

.v-treetable .v-table-cell-wrapper {
position: relative;
}

.v-treetable .v-table-body .v-table-table .v-table-row-animating {
zoom:1;
z-index:1;

+ 3
- 3
WebContent/VAADIN/themes/reindeer/table/table.css View File

@@ -112,9 +112,9 @@
text-shadow: #f3f5f8 0 1px 0;
line-height: normal;
}
.v-table-generated-row .v-table-cell-content {
padding-top: 1px;
padding-bottom: 2px;
.v-table-generated-row .v-table-cell-wrapper {
padding-top: 4px;
padding-bottom: 5px;
}
.v-table-cell-content:last-child {
border-right-color: transparent;

+ 6
- 1
src/com/vaadin/terminal/gwt/client/ui/textfield/VTextField.java View File

@@ -301,7 +301,7 @@ public class VTextField extends TextBoxBase implements Field, ChangeHandler,
if (!prompting && newText != null
&& !newText.equals(valueBeforeEdit)) {
sendValueChange = immediate;
client.updateVariable(paintableId, "text", getText(), false);
client.updateVariable(paintableId, "text", newText, false);
valueBeforeEdit = newText;
valueBeforeEditIsSynced = true;
}
@@ -366,6 +366,11 @@ public class VTextField extends TextBoxBase implements Field, ChangeHandler,

@Override
public void onBlur(BlurEvent event) {
// this is called twice on Chrome when e.g. changing tab while prompting
// field focused - do not change settings on the second time
if (focusedTextField != this) {
return;
}
removeStyleDependentName(CLASSNAME_FOCUS);
focusedTextField = null;
String text = getText();

+ 29
- 15
src/com/vaadin/terminal/gwt/client/ui/treetable/VTreeTable.java View File

@@ -97,7 +97,7 @@ public class VTreeTable extends VScrollTable {
}

class VTreeTableScrollBody extends VScrollTable.VScrollTableBody {
private int identWidth = -1;
private int indentWidth = -1;

VTreeTableScrollBody() {
super();
@@ -165,7 +165,7 @@ public class VTreeTable extends VScrollTable {
container.insertFirst(treeSpacer);
depth = rowUidl.hasAttribute("depth") ? rowUidl
.getIntAttribute("depth") : 0;
setIdent();
setIndent();
isTreeCellAdded = true;
return true;
}
@@ -202,18 +202,19 @@ public class VTreeTable extends VScrollTable {

}

private void setIdent() {
if (getIdentWidth() > 0 && depth != 0) {
treeSpacer.getStyle().setWidth(
(depth + 1) * getIdentWidth(), Unit.PX);
private void setIndent() {
if (getIndentWidth() > 0) {
treeSpacer.getParentElement().getStyle()
.setPaddingLeft(getIndent(), Unit.PX);
treeSpacer.getStyle().setWidth(getIndent(), Unit.PX);
}
}

@Override
protected void onAttach() {
super.onAttach();
if (getIdentWidth() < 0) {
detectIdent(this);
if (getIndentWidth() < 0) {
detectIndent(this);
}
}

@@ -227,6 +228,19 @@ public class VTreeTable extends VScrollTable {
return consumedSpace;
}

@Override
protected void setCellWidth(int cellIx, int width) {
if (cellIx == colIndexOfHierarchy + (showRowHeaders ? 1 : 0)) {
// take indentation padding into account if this is the
// hierarchy column
width = Math.max(width - getIndent(), 0);
}
super.setCellWidth(cellIx, width);
}

private int getIndent() {
return (depth + 1) * getIndentWidth();
}
}

protected class VTreeTableGeneratedRow extends VTreeTableRow {
@@ -354,20 +368,20 @@ public class VTreeTable extends VScrollTable {
}
}

private int getIdentWidth() {
return identWidth;
private int getIndentWidth() {
return indentWidth;
}

private void detectIdent(VTreeTableRow vTreeTableRow) {
identWidth = vTreeTableRow.treeSpacer.getOffsetWidth();
if (identWidth == 0) {
identWidth = -1;
private void detectIndent(VTreeTableRow vTreeTableRow) {
indentWidth = vTreeTableRow.treeSpacer.getOffsetWidth();
if (indentWidth == 0) {
indentWidth = -1;
return;
}
Iterator<Widget> iterator = iterator();
while (iterator.hasNext()) {
VTreeTableRow next = (VTreeTableRow) iterator.next();
next.setIdent();
next.setIndent();
}
}


+ 2
- 1
src/com/vaadin/ui/Table.java View File

@@ -1587,9 +1587,10 @@ public class Table extends AbstractSelect implements Action.Container,

// Collects the basic facts about the table page
final int pagelen = getPageLength();
int firstIndex = getCurrentPageFirstItemIndex();
int rows, totalRows;
rows = totalRows = size();
int firstIndex = Math
.min(getCurrentPageFirstItemIndex(), totalRows - 1);
if (rows > 0 && firstIndex >= 0) {
rows -= firstIndex;
}

+ 75
- 0
tests/testbench/com/vaadin/tests/components/popupview/PopupViewClickShortcut.java View File

@@ -0,0 +1,75 @@
package com.vaadin.tests.components.popupview;

import com.vaadin.event.ShortcutAction.KeyCode;
import com.vaadin.event.ShortcutAction.ModifierKey;
import com.vaadin.tests.components.TestBase;
import com.vaadin.tests.util.Log;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.ComponentContainer;
import com.vaadin.ui.Layout;
import com.vaadin.ui.PopupView;
import com.vaadin.ui.Table;
import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.Window;

public class PopupViewClickShortcut extends TestBase {

private Window sub = new Window("Table", makeTable("Subwindow", KeyCode.S));

private Log log = new Log(5);

@Override
protected void setup() {
sub.center();
getMainWindow().addWindow(sub);
addComponent(log);
addComponent(new PopupView("Show popup table", makeTable("Popup",
KeyCode.P)));
addComponent(makeTable("Main window", KeyCode.M));
sub.addComponent(new PopupView("Show popup table", makeTable(
"Subwindow popup", KeyCode.U)));
}

private ComponentContainer makeTable(final String caption, int keyCode) {
final Table t = new Table();
t.setSelectable(true);
t.setHeight("200px");
t.setWidth("200px");
t.addContainerProperty("foo", String.class, "foo");
for (int i = 0; i < 5; i++) {
t.addItem(new String[] { "foo " + i }, i);
}

final Layout l = new VerticalLayout();
l.setCaption(caption);
l.setWidth(null);

Button b = new Button("Submit " + caption, new Button.ClickListener() {
private int i = 5;

public void buttonClick(ClickEvent event) {
log.log("Submitted from "
+ event.getButton().getParent().getCaption());
t.addItem(new String[] { "added " + i++ }, i);
}
});
b.setClickShortcut(keyCode, ModifierKey.ALT);

l.addComponent(t);
l.addComponent(b);

return l;
}

@Override
protected String getDescription() {
return "Enter ClickShortcut does not work with PopupView";
}

@Override
protected Integer getTicketNumber() {
return 8193;
}

}

+ 32
- 0
tests/testbench/com/vaadin/tests/components/table/SelectableEditable.html View File

@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head profile="http://selenium-ide.openqa.org/profiles/test-case">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="selenium.base" href="" />
<title>SelectableEditable</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">SelectableEditable</td></tr>
</thead><tbody>
<tr>
<td>open</td>
<td>/run/com.vaadin.tests.components.table.SelectableEditable?restartApplication</td>
<td></td>
</tr>
<tr>
<td>mouseClick</td>
<td>vaadin=runcomvaadintestscomponentstableSelectableEditable::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[1]/domChild[0]</td>
<td>70,12</td>
</tr>
<tr>
<td>assertCSSClass</td>
<td>vaadin=runcomvaadintestscomponentstableSelectableEditable::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]</td>
<td>v-selected</td>
</tr>

</tbody></table>
</body>
</html>

+ 37
- 0
tests/testbench/com/vaadin/tests/components/table/SelectableEditable.java View File

@@ -0,0 +1,37 @@
package com.vaadin.tests.components.table;

import com.vaadin.tests.components.TestBase;
import com.vaadin.ui.Table;

public class SelectableEditable extends TestBase {

@Override
protected void setup() {
// TODO Auto-generated method stub

final Table table = new Table();
table.setWidth("500px");
table.setSelectable(true);
table.setEditable(true);

table.addContainerProperty("name", String.class, null);
table.addContainerProperty("alive", Boolean.class, false);
for (int i = 0; i < 10; ++i) {
table.addItem(new Object[] { "Person " + i, false }, i);
}

addComponent(table);
}

@Override
protected String getDescription() {
// TODO Auto-generated method stub
return "It is difficult to select rows of an editable Table, especially columns with checkboxes.";
}

@Override
protected Integer getTicketNumber() {
// TODO Auto-generated method stub
return 9064;
}
}

+ 3
- 2
tests/testbench/com/vaadin/tests/components/treetable/AddNodesOnExpand.java View File

@@ -23,7 +23,8 @@ public class AddNodesOnExpand extends TestBase {
Object openedItemId = event.getItemId();
if (!treetable.hasChildren(openedItemId)) {
for (int j = 0; j < 3; j++) {
treetable.addItem(openedItemId + "-" + j);
treetable.addItem(new String[] { "Subitem " + j },
openedItemId + "-" + j);
treetable.setParent(openedItemId + "-" + j,
openedItemId);
}
@@ -39,7 +40,7 @@ public class AddNodesOnExpand extends TestBase {
});

for (int i = 0; i < 3; i++) {
treetable.addItem(Integer.valueOf(i));
treetable.addItem(new String[] { "Item " + i }, Integer.valueOf(i));
}

addComponent(treetable);

+ 32
- 0
tests/testbench/com/vaadin/tests/components/treetable/ComponentsInTreeTable.html View File

@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head profile="http://selenium-ide.openqa.org/profiles/test-case">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="selenium.base" href="" />
<title>ComponentsInTreeTable</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">ComponentsInTreeTable</td></tr>
</thead><tbody>
<tr>
<td>open</td>
<td>/run/com.vaadin.tests.components.treetable.ComponentsInTreeTable?restartApplication</td>
<td></td>
</tr>
<tr>
<td>mouseClick</td>
<td>vaadin=runcomvaadintestscomponentstreetableComponentsInTreeTable::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTreeTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[2]/domChild[0]/domChild[0]/domChild[0]</td>
<td>15,7</td>
</tr>
<tr>
<td>screenCapture</td>
<td></td>
<td></td>
</tr>

</tbody></table>
</body>
</html>

+ 13
- 12
tests/testbench/com/vaadin/tests/components/treetable/ComponentsInTreeTable.java View File

@@ -7,6 +7,7 @@ import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.Label;
import com.vaadin.ui.Layout;
import com.vaadin.ui.TreeTable;
import com.vaadin.ui.VerticalLayout;

public class ComponentsInTreeTable extends TestBase {

@@ -14,28 +15,28 @@ public class ComponentsInTreeTable extends TestBase {
protected void setup() {
TreeTable tt = new TreeTable();
tt.setWidth("300px");
tt.setHeight("300px");
addComponent(tt);

Object id, id2;
tt.addContainerProperty("component", Component.class, "");
tt.addContainerProperty("type", String.class, "bar");

tt.addContainerProperty("foo", Component.class, "");
tt.addContainerProperty("bar", String.class, "bar");
tt.addContainerProperty("baz", String.class, "baz");

id = tt.addItem();
Layout l = new HorizontalLayout();
l.addComponent(new Label("bar"));
l.addComponent(new Label("bar"));
tt.getContainerProperty(id, "foo").setValue(l);
tt.addItem(new Object[] { l, "HorizontalLayout" }, 1);

l = new VerticalLayout();
l.addComponent(new Label("baz"));
l.addComponent(new Label("baz"));
tt.addItem(new Object[] { l, "VerticalLayout" }, 2);

id = tt.addItem();
Label lbl = new Label("<b>foo</b><br/><i>bar</i>");
lbl.setContentMode(Label.CONTENT_XHTML);
tt.getContainerProperty(id, "foo").setValue(lbl);
tt.addItem(new Object[] { lbl, "Label" }, 3);

id2 = tt.addItem();
tt.setParent(id2, id);
tt.getContainerProperty(id2, "foo").setValue(new Button("Test"));
tt.addItem(new Object[] { new Button("Test"), "Button" }, 4);
tt.setParent(4, 3);
}

@Override

+ 121
- 0
tests/testbench/com/vaadin/tests/tickets/Ticket8291.java View File

@@ -0,0 +1,121 @@
package com.vaadin.tests.tickets;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import com.vaadin.Application;
import com.vaadin.data.Container.Filter;
import com.vaadin.data.Item;
import com.vaadin.data.util.BeanItemContainer;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.Table;
import com.vaadin.ui.Window;

/**
* Test for #8291 and #7666: NegativeArraySizeException when Table scrolled to
* the end and its size reduced.
*/
public class Ticket8291 extends Application {

@Override
public void init() {
setMainWindow(new Window("", new TestView()));
}

private static class DecimateFilter implements Filter {
public boolean passesFilter(Object itemId, Item item)
throws UnsupportedOperationException {
return ((((TestObject) itemId).property3 % 10) == 0);
}

public boolean appliesToProperty(Object propertyId) {
return true;
}
}

private static class TestView extends HorizontalLayout {

private Filter filter = null;

private boolean reduceData;

private TestView() {
final Table table = new Table();
List<TestObject> data = createData(1000);
final BeanItemContainer<TestObject> container = new BeanItemContainer<TestObject>(
TestObject.class, data) {

@Override
public int size() {
if (reduceData) {
return 100;
} else {
return super.size();
}
}
};
table.setContainerDataSource(container);
addComponent(table);
Button button = new Button("Click");
button.addListener(new Button.ClickListener() {
public void buttonClick(ClickEvent event) {
reduceData = !reduceData;
table.refreshRowCache();
}
});
addComponent(button);
Button button2 = new Button("Filter");
button2.addListener(new Button.ClickListener() {
public void buttonClick(ClickEvent event) {
if (filter != null) {
container.removeAllContainerFilters();
filter = null;
} else {
filter = new DecimateFilter();
container.addContainerFilter(filter);
}
table.refreshRowCache();
}
});
addComponent(button2);
}
}

private static List<TestObject> createData(int count) {
ArrayList<TestObject> data = new ArrayList<TestObject>(count);
for (int i = 0; i < count; i++) {
data.add(new TestObject("string-" + i, new Date(), i));
}
return data;
}

public static class TestObject {

private String property1;
private Date property2;
private Integer property3;

public TestObject(String property1, Date property2, Integer property3) {
this.property1 = property1;
this.property2 = property2;
this.property3 = property3;
}

public String getProperty1() {
return property1;
}

public Date getProperty2() {
return property2;
}

public Integer getProperty3() {
return property3;
}

}

}

Loading…
Cancel
Save