Added rows colored

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-widgetx@97438 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2014-06-13 17:53:08 +00:00 committed by Giancarlo Panichi
parent a5047b2c65
commit 3589a66200
4 changed files with 16 additions and 9 deletions

View File

@ -38,12 +38,13 @@ public class TabularDataGridViewConfig implements GridViewConfig<DataRow> {
Map<String, ColumnKey> keys = new HashMap<String, ColumnKey>(); Map<String, ColumnKey> keys = new HashMap<String, ColumnKey>();
for (ColumnDefinition column : definition.getColumnsAsList()) { for (ColumnDefinition column : definition.getColumnsAsList()) {
keys.put(column.getLabel(), column.getKey()); keys.put(column.getColumnLocalId(), column.getKey());
if (column.getType() == ColumnType.VALIDATION){ if (column.getType() == ColumnType.VALIDATION){
validationColumns.add(column); validationColumns.add(column);
} }
} }
row = new Row(keys); row = new Row(keys);
} }
/** /**

View File

@ -51,7 +51,7 @@ public class ColumnConfigGenerator {
//int rowIndex = context.getIndex(); //int rowIndex = context.getIndex();
//store.get(rowIndex); //store.get(rowIndex);
String style = "style='color: " + (value ? "green" : "red") String style = "style='color: " + (value ? "green" : "black")
+ "'"; + "'";
String v = String.valueOf(value); String v = String.valueOf(value);
sb.appendHtmlConstant("<span " + style sb.appendHtmlConstant("<span " + style

View File

@ -18,8 +18,13 @@ import com.sencha.gxt.core.client.ValueProvider;
*/ */
public class DefaultRowStyle implements RowStyleProvider { public class DefaultRowStyle implements RowStyleProvider {
ResourceBundle res=ResourceBundle.INSTANCE; ResourceBundle res;
public DefaultRowStyle() {
res=ResourceBundle.INSTANCE;
res.tdGridCSS().ensureInjected();
}
@Override @Override
@ -27,10 +32,10 @@ public class DefaultRowStyle implements RowStyleProvider {
ArrayList<ColumnDefinition> validationColumns) { ArrayList<ColumnDefinition> validationColumns) {
String style = ""; String style = "";
for (ColumnDefinition c : validationColumns) { for (ColumnDefinition c : validationColumns) {
Boolean valid = row.getField(c.getColumnLocalId()); String valid = row.getFieldAsText(c.getColumnLocalId());
if (valid != null && valid == false) { Boolean b=new Boolean(valid);
if (!b) {
style = res.tdGridCSS().getGridRowRed(); style = res.tdGridCSS().getGridRowRed();
break; break;
} }
@ -47,8 +52,9 @@ public class DefaultRowStyle implements RowStyleProvider {
int colIndex) { int colIndex) {
String style = ""; String style = "";
for (ColumnDefinition c : validationColumns) { for (ColumnDefinition c : validationColumns) {
Boolean valid = row.getField(c.getColumnLocalId()); String valid = row.getFieldAsText(c.getColumnLocalId());
if (valid != null && valid == false) { Boolean b=new Boolean(valid);
if (!b) {
style = res.tdGridCSS().getGridRowRed(); style = res.tdGridCSS().getGridRowRed();
break; break;
} }

View File

@ -1,6 +1,6 @@
@CHARSET "UTF-8"; @CHARSET "UTF-8";
.grid-row-red { .grid-row-red {
background-color: #FFAFAF !important; background-color: #FF3333 !important;
} }