Sfoglia il codice sorgente

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 anni fa
parent
commit
91559310f9

+ 454
- 121
client/src/com/vaadin/client/ui/grid/Escalator.java
File diff soppresso perché troppo grande
Vedi File


+ 17
- 0
client/src/com/vaadin/client/ui/grid/RowContainer.java Vedi File

@@ -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 Vedi File

@@ -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 Vedi File

@@ -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 Vedi File

@@ -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 Vedi File

@@ -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 Vedi File

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

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

Loading…
Annulla
Salva