瀏覽代碼

Add support for changing the default row height in escalator (#12645)

Since this is quite the change, I've taken the opportunity to rewrite smaller
adjoining pieces to make more sense. Move methods from classes, and so on.
These changes are, however, only on the code level, no other functionality will
be introduced by this patch.

Change-Id: I56f19c5af7dc4ccfd2fa4c9098f06e77dbfa12fb
tags/7.2.0.beta1
Henrik Paul 10 年之前
父節點
當前提交
91559310f9

+ 454
- 121
client/src/com/vaadin/client/ui/grid/Escalator.java
文件差異過大導致無法顯示
查看文件


+ 17
- 0
client/src/com/vaadin/client/ui/grid/RowContainer.java 查看文件

@@ -123,4 +123,21 @@ public interface RowContainer {
* @return the number of rows in the current row container
*/
public int getRowCount();

/**
* The default height of the rows in this RowContainer.
*
* @param px
* the default height in pixels of the rows in this RowContainer
* @throws IllegalArgumentException
* if <code>px &lt; 1</code>
*/
public void setDefaultRowHeight(int px) throws IllegalArgumentException;

/**
* Returns the default height of the rows in this RowContainer.
*
* @return the default height of the rows in this RowContainer, in pixels
*/
public int getDefaultRowHeight();
}

+ 8
- 0
uitest/src/com/vaadin/tests/components/grid/BasicEscalator.java 查看文件

@@ -289,6 +289,14 @@ public class BasicEscalator extends AbstractTestUI {
grid.calculateColumnWidths();
}
}));

addComponent(new Button("Randomize row heights",
new Button.ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
grid.randomizeDefaultRowHeight();
}
}));
}

@Override

+ 2
- 0
uitest/src/com/vaadin/tests/widgetset/client/grid/TestGridClientRpc.java 查看文件

@@ -43,4 +43,6 @@ public interface TestGridClientRpc extends ClientRpc {
void setColumnWidth(int index, int px);

void calculateColumnWidths();

void randomRowHeight();
}

+ 11
- 0
uitest/src/com/vaadin/tests/widgetset/client/grid/TestGridConnector.java 查看文件

@@ -15,6 +15,7 @@
*/
package com.vaadin.tests.widgetset.client.grid;

import com.google.gwt.user.client.Random;
import com.vaadin.client.ui.AbstractComponentConnector;
import com.vaadin.shared.ui.Connect;
import com.vaadin.shared.ui.grid.ScrollDestination;
@@ -112,6 +113,16 @@ public class TestGridConnector extends AbstractComponentConnector {
public void calculateColumnWidths() {
getWidget().calculateColumnWidths();
}

@Override
public void randomRowHeight() {
getWidget().getHeader().setDefaultRowHeight(
Random.nextInt(20) + 20);
getWidget().getBody().setDefaultRowHeight(
Random.nextInt(20) + 20);
getWidget().getFooter().setDefaultRowHeight(
Random.nextInt(20) + 20);
}
});
}


+ 4
- 0
uitest/src/com/vaadin/tests/widgetset/client/grid/VTestGrid.java 查看文件

@@ -206,6 +206,10 @@ public class VTestGrid extends Composite {
return escalator.getHeader();
}

public RowContainer getBody() {
return escalator.getBody();
}

public RowContainer getFooter() {
return escalator.getFooter();
}

+ 4
- 0
uitest/src/com/vaadin/tests/widgetset/server/grid/TestGrid.java 查看文件

@@ -89,4 +89,8 @@ public class TestGrid extends AbstractComponent {
public void calculateColumnWidths() {
rpc().calculateColumnWidths();
}

public void randomizeDefaultRowHeight() {
rpc().randomRowHeight();
}
}

Loading…
取消
儲存