aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--client/src/com/vaadin/client/ui/grid/Grid.java16
-rw-r--r--server/src/com/vaadin/ui/Grid.java4
-rw-r--r--uitest/src/com/vaadin/tests/components/grid/basicfeatures/client/GridCellStyleGeneratorTest.java51
-rw-r--r--uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridCellStyleGeneratorTest.java39
4 files changed, 33 insertions, 77 deletions
diff --git a/client/src/com/vaadin/client/ui/grid/Grid.java b/client/src/com/vaadin/client/ui/grid/Grid.java
index 91d796692c..c6d7e22d3b 100644
--- a/client/src/com/vaadin/client/ui/grid/Grid.java
+++ b/client/src/com/vaadin/client/ui/grid/Grid.java
@@ -166,10 +166,6 @@ public class Grid<T> extends ResizeComposite implements
* Called by Grid to generate a style name for a row or cell element.
* Row styles are generated when the column parameter is
* <code>null</code>, otherwise a cell style is generated.
- * <p>
- * The returned style name is prefixed so that the actual style for
- * cells will be <tt>v-grid-cell-content-[style name]</tt>, and the row
- * style will be <tt>v-grid-row-[style name]</tt>.
*
* @param grid
* the source grid
@@ -2046,9 +2042,7 @@ public class Grid<T> extends ResizeComposite implements
private String rowStripeStyleName;
private String rowHasDataStyleName;
- private String rowGeneratedStylePrefix;
private String rowSelectedStyleName;
- private String cellGeneratedStylePrefix;
private String cellFocusStyleName;
private String rowFocusStyleName;
private String headerFooterFocusStyleName;
@@ -2601,10 +2595,6 @@ public class Grid<T> extends ResizeComposite implements
try {
String rowStylename = cellStyleGenerator.getStyle(
Grid.this, rowData, rowIndex, null, -1);
- if (rowStylename != null) {
- rowStylename = rowGeneratedStylePrefix
- + rowStylename;
- }
setCustomStyleName(rowElement, rowStylename);
} catch (RuntimeException e) {
getLogger().log(
@@ -2638,10 +2628,6 @@ public class Grid<T> extends ResizeComposite implements
String generatedStyle = cellStyleGenerator.getStyle(
Grid.this, rowData, rowIndex, column,
cell.getColumn());
- if (generatedStyle != null) {
- generatedStyle = cellGeneratedStylePrefix
- + generatedStyle;
- }
setCustomStyleName(cell.getElement(), generatedStyle);
} catch (RuntimeException e) {
getLogger().log(
@@ -2988,14 +2974,12 @@ public class Grid<T> extends ResizeComposite implements
rowHasDataStyleName = rowStyle + "-has-data";
rowSelectedStyleName = rowStyle + "-selected";
rowStripeStyleName = rowStyle + "-stripe";
- rowGeneratedStylePrefix = rowStyle + "-";
/*
* TODO rename CSS "active" to "focused" once Valo theme has been
* merged.
*/
cellFocusStyleName = getStylePrimaryName() + "-cell-active";
- cellGeneratedStylePrefix = getStylePrimaryName() + "-cell-content-";
headerFooterFocusStyleName = getStylePrimaryName() + "-header-active";
rowFocusStyleName = getStylePrimaryName() + "-row-active";
diff --git a/server/src/com/vaadin/ui/Grid.java b/server/src/com/vaadin/ui/Grid.java
index 49c082b0b2..838829b9cc 100644
--- a/server/src/com/vaadin/ui/Grid.java
+++ b/server/src/com/vaadin/ui/Grid.java
@@ -787,10 +787,6 @@ public class Grid extends AbstractComponent implements SelectionChangeNotifier,
* Called by Grid to generate a style name for a row or cell element.
* Row styles are generated when the column parameter is
* <code>null</code>, otherwise a cell style is generated.
- * <p>
- * The returned style name is prefixed so that the actual style for
- * cells will be <tt>v-grid-cell-content-[style name]</tt>, and the row
- * style will be <tt>v-grid-row-[style name]</tt>.
*
* @param grid
* the source grid
diff --git a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/client/GridCellStyleGeneratorTest.java b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/client/GridCellStyleGeneratorTest.java
index d3b7c400b6..cd9d4497c4 100644
--- a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/client/GridCellStyleGeneratorTest.java
+++ b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/client/GridCellStyleGeneratorTest.java
@@ -33,18 +33,16 @@ public class GridCellStyleGeneratorTest extends GridBasicClientFeaturesTest {
GridRowElement row2 = getGridElement().getRow(2);
GridCellElement cell4_2 = getGridElement().getCell(4, 2);
- Assert.assertTrue(row2.getAttribute("class").contains("v-grid-row-2"));
- Assert.assertTrue(cell4_2.getAttribute("class").contains(
- "v-grid-cell-content-4_2"));
+ Assert.assertTrue(hasCssClass(row2, "2"));
+ Assert.assertTrue(hasCssClass(cell4_2, "4_2"));
// Scroll down and verify that the old elements don't have the
// stylename any more
getGridElement().getRow(350);
- Assert.assertFalse(row2.getAttribute("class").contains("v-grid-row-2"));
- Assert.assertFalse(cell4_2.getAttribute("class").contains(
- "v-grid-cell-content-4_2"));
+ Assert.assertFalse(hasCssClass(row2, "2"));
+ Assert.assertFalse(hasCssClass(cell4_2, "4_2"));
}
@Test
@@ -57,16 +55,14 @@ public class GridCellStyleGeneratorTest extends GridBasicClientFeaturesTest {
GridRowElement row2 = getGridElement().getRow(2);
GridCellElement cell4_2 = getGridElement().getCell(4, 2);
- Assert.assertTrue(row2.getAttribute("class").contains("v-grid-row-2"));
- Assert.assertTrue(cell4_2.getAttribute("class").contains(
- "v-grid-cell-content-4_2"));
+ Assert.assertTrue(hasCssClass(row2, "2"));
+ Assert.assertTrue(hasCssClass(cell4_2, "4_2"));
// Disable the generator and check again
selectStyleNameGenerator("None");
- Assert.assertFalse(row2.getAttribute("class").contains("v-grid-row-2"));
- Assert.assertFalse(cell4_2.getAttribute("class").contains(
- "v-grid-cell-content-4_2"));
+ Assert.assertFalse(hasCssClass(row2, "2"));
+ Assert.assertFalse(hasCssClass(cell4_2, "4_2"));
}
@Test
@@ -79,21 +75,18 @@ public class GridCellStyleGeneratorTest extends GridBasicClientFeaturesTest {
GridRowElement row2 = getGridElement().getRow(2);
GridCellElement cell4_2 = getGridElement().getCell(4, 2);
- Assert.assertTrue(row2.getAttribute("class").contains("v-grid-row-2"));
- Assert.assertTrue(cell4_2.getAttribute("class").contains(
- "v-grid-cell-content-4_2"));
+ Assert.assertTrue(hasCssClass(row2, "2"));
+ Assert.assertTrue(hasCssClass(cell4_2, "4_2"));
// Change the generator and check again
selectStyleNameGenerator("Cell only");
// Old styles removed?
- Assert.assertFalse(row2.getAttribute("class").contains("v-grid-row-2"));
- Assert.assertFalse(cell4_2.getAttribute("class").contains(
- "v-grid-cell-content-4_2"));
+ Assert.assertFalse(hasCssClass(row2, "2"));
+ Assert.assertFalse(hasCssClass(cell4_2, "4_2"));
// New style present?
- Assert.assertTrue(cell4_2.getAttribute("class").contains(
- "v-grid-cell-content-two"));
+ Assert.assertTrue(hasCssClass(cell4_2, "two"));
}
@Test
@@ -106,23 +99,19 @@ public class GridCellStyleGeneratorTest extends GridBasicClientFeaturesTest {
GridRowElement row2 = getGridElement().getRow(2);
GridCellElement cell4_2 = getGridElement().getCell(4, 2);
- Assert.assertTrue(row2.getAttribute("class").contains("v-grid-row-2"));
- Assert.assertTrue(cell4_2.getAttribute("class").contains(
- "v-grid-cell-content-4_2"));
+ Assert.assertTrue(hasCssClass(row2, "2"));
+ Assert.assertTrue(hasCssClass(cell4_2, "4_2"));
// Change primary stylename
selectMenuPath("Component", "State", "Primary Stylename", "v-escalator");
- // Old styles removed?
- Assert.assertFalse(row2.getAttribute("class").contains("v-grid-row-2"));
- Assert.assertFalse(cell4_2.getAttribute("class").contains(
- "v-grid-cell-content-4_2"));
+ // Styles still present
+ Assert.assertTrue(hasCssClass(row2, "2"));
+ Assert.assertTrue(hasCssClass(cell4_2, "4_2"));
// New styles present?
- Assert.assertTrue(row2.getAttribute("class").contains(
- "v-escalator-row-2"));
- Assert.assertTrue(cell4_2.getAttribute("class").contains(
- "v-escalator-cell-content-4_2"));
+ Assert.assertFalse(hasCssClass(row2, "v-escalator-row-2"));
+ Assert.assertFalse(hasCssClass(cell4_2, "v-escalator-cell-content-4_2"));
}
private void selectStyleNameGenerator(String name) {
diff --git a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridCellStyleGeneratorTest.java b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridCellStyleGeneratorTest.java
index 29a3d0ad6d..4064657a6f 100644
--- a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridCellStyleGeneratorTest.java
+++ b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridCellStyleGeneratorTest.java
@@ -32,10 +32,8 @@ public class GridCellStyleGeneratorTest extends GridBasicFeaturesTest {
GridRowElement row2 = getGridElement().getRow(2);
GridCellElement cell3_2 = getGridElement().getCell(3, 2);
- Assert.assertTrue(row2.getAttribute("class")
- .contains("v-grid-row-row2"));
- Assert.assertTrue(cell3_2.getAttribute("class").contains(
- "v-grid-cell-content-Column_2"));
+ Assert.assertTrue(hasCssClass(row2, "row2"));
+ Assert.assertTrue(hasCssClass(cell3_2, "Column_2"));
// Scroll down and verify that the old elements don't have the
// stylename any more
@@ -43,10 +41,8 @@ public class GridCellStyleGeneratorTest extends GridBasicFeaturesTest {
// Carefully chosen offset to hit an index % 4 without cell style
getGridElement().getRow(352);
- Assert.assertFalse(row2.getAttribute("class").contains(
- "v-grid-row-row2"));
- Assert.assertFalse(cell3_2.getAttribute("class").contains(
- "v-grid-cell-content-Column_2"));
+ Assert.assertFalse(hasCssClass(row2, "row2"));
+ Assert.assertFalse(hasCssClass(cell3_2, "Column_2"));
}
@Test
@@ -59,18 +55,14 @@ public class GridCellStyleGeneratorTest extends GridBasicFeaturesTest {
GridRowElement row2 = getGridElement().getRow(2);
GridCellElement cell3_2 = getGridElement().getCell(3, 2);
- Assert.assertTrue(row2.getAttribute("class")
- .contains("v-grid-row-row2"));
- Assert.assertTrue(cell3_2.getAttribute("class").contains(
- "v-grid-cell-content-Column_2"));
+ Assert.assertTrue(hasCssClass(row2, "row2"));
+ Assert.assertTrue(hasCssClass(cell3_2, "Column_2"));
// Disable the generator and check again
selectStyleNameGenerator("None");
- Assert.assertFalse(row2.getAttribute("class").contains(
- "v-grid-row-row2"));
- Assert.assertFalse(cell3_2.getAttribute("class").contains(
- "v-grid-cell-content-Column_2"));
+ Assert.assertFalse(hasCssClass(row2, "row2"));
+ Assert.assertFalse(hasCssClass(cell3_2, "Column_2"));
}
@Test
@@ -83,23 +75,18 @@ public class GridCellStyleGeneratorTest extends GridBasicFeaturesTest {
GridRowElement row2 = getGridElement().getRow(2);
GridCellElement cell3_2 = getGridElement().getCell(3, 2);
- Assert.assertTrue(row2.getAttribute("class")
- .contains("v-grid-row-row2"));
- Assert.assertTrue(cell3_2.getAttribute("class").contains(
- "v-grid-cell-content-Column_2"));
+ Assert.assertTrue(hasCssClass(row2, "row2"));
+ Assert.assertTrue(hasCssClass(cell3_2, "Column_2"));
// Change the generator and check again
selectStyleNameGenerator("Cell only");
// Old styles removed?
- Assert.assertFalse(row2.getAttribute("class").contains(
- "v-grid-row-row2"));
- Assert.assertFalse(cell3_2.getAttribute("class").contains(
- "v-grid-cell-content-Column_2"));
+ Assert.assertFalse(hasCssClass(row2, "row2"));
+ Assert.assertFalse(hasCssClass(cell3_2, "Column_2"));
// New style present?
- Assert.assertTrue(cell3_2.getAttribute("class").contains(
- "v-grid-cell-content-Column-2"));
+ Assert.assertTrue(hasCssClass(cell3_2, "Column-2"));
}
private void selectStyleNameGenerator(String name) {