Object propertyId = column.getPropertyId();
cellReference.set(propertyId);
String style = generator.getStyle(cellReference);
- if (style != null) {
+ if (style != null && !style.isEmpty()) {
if (cellStyles == null) {
cellStyles = Json.createObject();
}
private void setGeneratedRowStyles(RowStyleGenerator generator,
JsonObject rowObject) {
String rowStyle = generator.getStyle(rowReference);
- if (rowStyle != null) {
+ if (rowStyle != null && !rowStyle.isEmpty()) {
rowObject.put(GridState.JSONKEY_ROWSTYLE, rowStyle);
}
}
public static final String ROW_STYLE_GENERATOR_ROW_NUMBERS_FOR_3_OF_4 = "Row numbers for 3/4";
public static final String ROW_STYLE_GENERATOR_NONE = "None";
public static final String ROW_STYLE_GENERATOR_ROW_NUMBERS = "Row numbers";
+ public static final String ROW_STYLE_GENERATOR_EMPTY = "Empty string";
+ public static final String ROW_STYLE_GENERATOR_NULL = "Null";
public static final String CELL_STYLE_GENERATOR_NONE = "None";
public static final String CELL_STYLE_GENERATOR_PROPERTY_TO_STRING = "Property to string";
public static final String CELL_STYLE_GENERATOR_SPECIAL = "Special for 1/4 Column 1";
+ public static final String CELL_STYLE_GENERATOR_EMPTY = "Empty string";
+ public static final String CELL_STYLE_GENERATOR_NULL = "Null";
private static final int MANUALLY_FORMATTED_COLUMNS = 5;
public static final int COLUMNS = 12;
public static final int EDITABLE_COLUMNS = COLUMNS - 1;
}
}
});
+ rowStyleGenerators.put(ROW_STYLE_GENERATOR_EMPTY,
+ new RowStyleGenerator() {
+
+ @Override
+ public String getStyle(RowReference rowReference) {
+ return "";
+ }
+ });
+ rowStyleGenerators.put(ROW_STYLE_GENERATOR_NULL,
+ new RowStyleGenerator() {
+
+ @Override
+ public String getStyle(RowReference rowReference) {
+ return null;
+ }
+ });
cellStyleGenerators.put(CELL_STYLE_GENERATOR_NONE, null);
cellStyleGenerators.put(CELL_STYLE_GENERATOR_PROPERTY_TO_STRING,
new CellStyleGenerator() {
return propertyId.toString().replace(' ', '_');
}
});
+ cellStyleGenerators.put(CELL_STYLE_GENERATOR_EMPTY,
+ new CellStyleGenerator() {
+ @Override
+ public String getStyle(CellReference cellReference) {
+ return "";
+ }
+ });
+ cellStyleGenerators.put(CELL_STYLE_GENERATOR_NULL,
+ new CellStyleGenerator() {
+ @Override
+ public String getStyle(CellReference cellReference) {
+ return null;
+ }
+ });
createSelectAction("Row style generator", "State", rowStyleGenerators,
CELL_STYLE_GENERATOR_NONE,
private void selectCellStyleNameGenerator(String name) {
selectMenuPath("Component", "State", "Cell style generator", name);
}
+
+ @Test
+ public void testEmptyStringStyleGenerator() {
+ setDebug(true);
+ openTestURL();
+ selectCellStyleNameGenerator(GridBasicFeatures.CELL_STYLE_GENERATOR_EMPTY);
+ selectRowStyleNameGenerator(GridBasicFeatures.ROW_STYLE_GENERATOR_EMPTY);
+
+ assertFalse("Error notification was present",
+ isElementPresent(NotificationElement.class));
+ }
+
+ @Test
+ public void testNullStringStyleGenerator() {
+ setDebug(true);
+ openTestURL();
+ selectCellStyleNameGenerator(GridBasicFeatures.CELL_STYLE_GENERATOR_NULL);
+ selectRowStyleNameGenerator(GridBasicFeatures.ROW_STYLE_GENERATOR_NULL);
+
+ assertFalse("Error notification was present",
+ isElementPresent(NotificationElement.class));
+ }
}