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

@ -103,7 +103,7 @@ public class TabularDataXGridPanel extends ContentPanel {
protected ToolBar toolBar;
// protected GridInlineEditing<DataRow> editing;
protected TableDefinition tableDefinition;
protected VerticalLayoutContainer container;
protected ExtendedLiveGridView liveGridView;
@ -122,6 +122,10 @@ public class TabularDataXGridPanel extends ContentPanel {
protected Map<String, ColumnKey> keys;
private String visibleOnlyColumn;
protected boolean errorNotColored=false;
/**
* @param eventBus
@ -383,6 +387,24 @@ public class TabularDataXGridPanel extends ContentPanel {
visibleOnlyColumn = columnLocalId;
}
/**
*
* @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;
}
/**
*
@ -789,7 +811,9 @@ public class TabularDataXGridPanel extends ContentPanel {
} else {
Log.debug("Use default grid View");
tableViewConfig= new TableViewConfig();
DefaultRowStyle rowStyle=new DefaultRowStyle();
Log.debug("Error Not Colored: "+errorNotColored);
DefaultRowStyle rowStyle=new DefaultRowStyle(errorNotColored);
tableViewConfig.setRowStyleProvider(rowStyle);
grid.getView().setViewConfig(
new TabularDataGridViewConfig(tableViewConfig,

View File

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

View File

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

View File

@ -18,25 +18,45 @@ import com.sencha.gxt.core.client.ValueProvider;
*/
public class DefaultRowStyle implements RowStyleProvider {
ResourceBundle res;
protected ResourceBundle res;
protected boolean errorNotColored;
/**
*
*/
public DefaultRowStyle() {
res=ResourceBundle.INSTANCE;
errorNotColored = false;
res = ResourceBundle.INSTANCE;
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
public String getRowStyle(Row row,
ArrayList<ColumnDefinition> validationColumns) {
String style = "";
for (ColumnDefinition c : validationColumns) {
String valid = row.getFieldAsText(c.getColumnLocalId());
Boolean b=new Boolean(valid);
Boolean b = new Boolean(valid);
if (!b) {
style = res.tdGridCSS().getGridRowRed();
if (errorNotColored) {
style = res.tdGridCSS().getGridRowNoColor();
} else {
style = res.tdGridCSS().getGridRowRed();
}
break;
}
@ -53,9 +73,13 @@ public class DefaultRowStyle implements RowStyleProvider {
String style = "";
for (ColumnDefinition c : validationColumns) {
String valid = row.getFieldAsText(c.getColumnLocalId());
Boolean b=new Boolean(valid);
Boolean b = new Boolean(valid);
if (!b) {
style = res.tdGridCSS().getGridRowRed();
if (errorNotColored) {
style = res.tdGridCSS().getGridRowNoColor();
} else {
style = res.tdGridCSS().getGridRowRed();
}
break;
}

View File

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