Enhancement on file versioning #7006
git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace@144199 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
09876a6ee0
commit
f4f000dded
|
@ -29,9 +29,12 @@ import com.extjs.gxt.ui.client.widget.LayoutContainer;
|
|||
import com.extjs.gxt.ui.client.widget.MessageBox;
|
||||
import com.extjs.gxt.ui.client.widget.button.Button;
|
||||
import com.extjs.gxt.ui.client.widget.grid.ColumnConfig;
|
||||
import com.extjs.gxt.ui.client.widget.grid.ColumnData;
|
||||
import com.extjs.gxt.ui.client.widget.grid.ColumnModel;
|
||||
import com.extjs.gxt.ui.client.widget.grid.Grid;
|
||||
import com.extjs.gxt.ui.client.widget.grid.GridCellRenderer;
|
||||
import com.extjs.gxt.ui.client.widget.grid.GroupingView;
|
||||
import com.extjs.gxt.ui.client.widget.grid.filters.BooleanFilter;
|
||||
import com.extjs.gxt.ui.client.widget.grid.filters.DateFilter;
|
||||
import com.extjs.gxt.ui.client.widget.grid.filters.GridFilters;
|
||||
import com.extjs.gxt.ui.client.widget.grid.filters.StringFilter;
|
||||
|
@ -267,7 +270,7 @@ public class VersioningInfoContainer extends LayoutContainer {
|
|||
public void initGrid() {
|
||||
|
||||
//ColumnConfig icon = new ColumnConfig(FileGridModel.ICON, "", 25);
|
||||
ColumnConfig name = createSortableColumnConfig(FileModel.NAME, FileModel.NAME, 200);
|
||||
ColumnConfig name = createSortableColumnConfig(FileModel.NAME, "Version Id", 150);
|
||||
//ColumnConfig type = createSortableColumnConfig(FileModel.TYPE, FileModel.TYPE, 80);
|
||||
//ColumnConfig originalPath = createSortableColumnConfig(FileVersionModel.PATH, "Original Path", 200);
|
||||
ColumnConfig created = createSortableColumnConfig(FileVersionModel.CREATED, "Created", 100);
|
||||
|
@ -275,9 +278,11 @@ public class VersioningInfoContainer extends LayoutContainer {
|
|||
//deleteDate.setDateTimeFormat(DateTimeFormat.getFormat("dd MMM hh:mm aaa yyyy"));
|
||||
ColumnConfig user = createSortableColumnConfig(FileVersionModel.USER_VERSIONING, "User", 150);
|
||||
|
||||
ColumnConfig currVersion = createSortableColumnConfig(FileVersionModel.IS_CURRENT_VERSION, "Current Version", 50);
|
||||
|
||||
//ColumnModel cm = new ColumnModel(Arrays.asList(icon, name, type, originalPath, deleteDate, deleteUser));
|
||||
|
||||
ColumnModel cm = new ColumnModel(Arrays.asList(name, created, user));
|
||||
ColumnModel cm = new ColumnModel(Arrays.asList(name, created, user, currVersion));
|
||||
|
||||
grid = new Grid<FileVersionModel>(this.store, cm);
|
||||
|
||||
|
@ -293,10 +298,33 @@ public class VersioningInfoContainer extends LayoutContainer {
|
|||
StringFilter nameFilter = new StringFilter(FileModel.NAME);
|
||||
DateFilter dateFilter = new DateFilter(FileVersionModel.CREATED);
|
||||
StringFilter userFilter = new StringFilter(FileVersionModel.USER_VERSIONING);
|
||||
BooleanFilter currVersionFilter = new BooleanFilter(FileVersionModel.IS_CURRENT_VERSION);
|
||||
|
||||
final ColumnModel columnModel = cm;
|
||||
|
||||
GridCellRenderer<FileVersionModel> nameRender = new GridCellRenderer<FileVersionModel>() {
|
||||
@Override
|
||||
public String render(FileVersionModel model, String property, ColumnData config, int rowIndex, int colIndex, ListStore<FileVersionModel> store, Grid<FileVersionModel> grid) {
|
||||
Boolean isCurrVersion = model.isCurrentVersion();
|
||||
String val = model.get(property);
|
||||
String color = "black";
|
||||
|
||||
if(val!=null && isCurrVersion != null && isCurrVersion){
|
||||
// color = "#EEC900";
|
||||
return "<span qtitle='" + columnModel.getColumnById(property).getHeader() + "' qtip='" + val + "' style='font-weight: bold;color:" + color + "'>" + val + "</span>";
|
||||
}else{
|
||||
if(val==null)
|
||||
val = "";
|
||||
return "<span qtitle='" + columnModel.getColumnById(property).getHeader() + "' qtip='" + val + "' style='color:" + color + "'>" + val + "</span>";
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
name.setRenderer(nameRender);
|
||||
filters.addFilter(nameFilter);
|
||||
filters.addFilter(dateFilter);
|
||||
filters.addFilter(userFilter);
|
||||
filters.addFilter(currVersionFilter);
|
||||
|
||||
grid.addPlugin(filters);
|
||||
|
||||
|
|
Loading…
Reference in New Issue