Updated Mapping

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-widgetx@98239 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2014-07-01 17:02:47 +00:00 committed by Giancarlo Panichi
parent 370d18d51c
commit 80e069d1d6
5 changed files with 69 additions and 13 deletions

View File

@ -123,6 +123,10 @@ public class TabularDataXGridPanel extends ContentPanel {
private String visibleOnlyColumn; private String visibleOnlyColumn;
protected boolean errorNotColored=false;
/** /**
* @param eventBus * @param eventBus
*/ */
@ -384,6 +388,24 @@ public class TabularDataXGridPanel extends ContentPanel {
} }
/**
*
* @return
*/
public boolean isErrorNotColored() {
return errorNotColored;
}
/**
*
* @param errorNotColored if true set background withe for rows with error
*/
public void setErrorNotColored(boolean errorNotColored) {
Log.debug("ErrorNotColored set :"+errorNotColored);
this.errorNotColored = errorNotColored;
}
/** /**
* *
* @param columnModel * @param columnModel
@ -789,7 +811,9 @@ public class TabularDataXGridPanel extends ContentPanel {
} else { } else {
Log.debug("Use default grid View"); Log.debug("Use default grid View");
tableViewConfig= new TableViewConfig(); tableViewConfig= new TableViewConfig();
DefaultRowStyle rowStyle=new DefaultRowStyle(); Log.debug("Error Not Colored: "+errorNotColored);
DefaultRowStyle rowStyle=new DefaultRowStyle(errorNotColored);
tableViewConfig.setRowStyleProvider(rowStyle); tableViewConfig.setRowStyleProvider(rowStyle);
grid.getView().setViewConfig( grid.getView().setViewConfig(
new TabularDataGridViewConfig(tableViewConfig, new TabularDataGridViewConfig(tableViewConfig,

View File

@ -17,4 +17,6 @@ public interface ResourceBundle extends ClientBundle {
@Source("TDGrid.css") @Source("TDGrid.css")
TDGridCSS tdGridCSS(); TDGridCSS tdGridCSS();
} }

View File

@ -13,4 +13,7 @@ public interface TDGridCSS extends CssResource {
@ClassName("grid-row-red") @ClassName("grid-row-red")
public String getGridRowRed(); public String getGridRowRed();
@ClassName("grid-row-no-color")
public String getGridRowNoColor();
} }

View File

@ -18,14 +18,30 @@ import com.sencha.gxt.core.client.ValueProvider;
*/ */
public class DefaultRowStyle implements RowStyleProvider { public class DefaultRowStyle implements RowStyleProvider {
ResourceBundle res; protected ResourceBundle res;
protected boolean errorNotColored;
/**
*
*/
public DefaultRowStyle() { public DefaultRowStyle() {
errorNotColored = false;
res = ResourceBundle.INSTANCE; res = ResourceBundle.INSTANCE;
res.tdGridCSS().ensureInjected(); res.tdGridCSS().ensureInjected();
} }
/**
*
* @param errorRed
* true if you want error rows white
*/
public DefaultRowStyle(boolean errorNotColored) {
this.errorNotColored = errorNotColored;
res = ResourceBundle.INSTANCE;
res.tdGridCSS().ensureInjected();
}
@Override @Override
public String getRowStyle(Row row, public String getRowStyle(Row row,
@ -36,7 +52,11 @@ public class DefaultRowStyle implements RowStyleProvider {
String valid = row.getFieldAsText(c.getColumnLocalId()); String valid = row.getFieldAsText(c.getColumnLocalId());
Boolean b = new Boolean(valid); Boolean b = new Boolean(valid);
if (!b) { if (!b) {
if (errorNotColored) {
style = res.tdGridCSS().getGridRowNoColor();
} else {
style = res.tdGridCSS().getGridRowRed(); style = res.tdGridCSS().getGridRowRed();
}
break; break;
} }
@ -55,7 +75,11 @@ public class DefaultRowStyle implements RowStyleProvider {
String valid = row.getFieldAsText(c.getColumnLocalId()); String valid = row.getFieldAsText(c.getColumnLocalId());
Boolean b = new Boolean(valid); Boolean b = new Boolean(valid);
if (!b) { if (!b) {
if (errorNotColored) {
style = res.tdGridCSS().getGridRowNoColor();
} else {
style = res.tdGridCSS().getGridRowRed(); style = res.tdGridCSS().getGridRowRed();
}
break; break;
} }

View File

@ -4,3 +4,6 @@
background-color: #FF8989 !important; background-color: #FF8989 !important;
} }
.grid-row-no-color{
background-color: #FFFFFF !important;
}