Working on Pagination
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/widgets/workspace-explorer@150997 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
101fe8786a
commit
4a45f4bf85
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
package org.gcube.portlets.widgets.wsexplorer.client;
|
||||
|
||||
|
@ -18,7 +18,7 @@ import com.google.gwt.user.client.ui.SimplePanel;
|
|||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it Jun 18, 2015
|
||||
*/
|
||||
public class Util {
|
||||
|
||||
|
||||
// public static final NumberFormat numberFormatterKB = NumberFormat.getFormat("#,##0 KB;(#,##0 KB)");
|
||||
|
||||
public static final ItemType[] FOLDERS = new ItemType[] {ItemType.FOLDER};
|
||||
|
@ -60,7 +60,7 @@ public class Util {
|
|||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns the image based on the item type.
|
||||
|
@ -69,6 +69,9 @@ public class Util {
|
|||
*/
|
||||
public static ImageResource getImage(Item item)
|
||||
{
|
||||
if(item==null)
|
||||
return null;
|
||||
|
||||
switch (item.getType()) {
|
||||
// case ROOT: return WorkspaceLightTreeResources.INSTANCE.root();
|
||||
case FOLDER: {
|
||||
|
@ -95,9 +98,9 @@ public class Util {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param value
|
||||
* @return
|
||||
*/
|
||||
|
@ -114,17 +117,17 @@ public class Util {
|
|||
}else
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
public static void adjustSize(Element el, SimplePanel panel, int offset){
|
||||
if(el!=null){
|
||||
int heigth = el.getClientHeight();
|
||||
GWT.log("getClientHeight adjustSize el: "+heigth);
|
||||
heigth = (heigth-offset>100)?heigth-offset:0;
|
||||
heigth = heigth-offset>100?heigth-offset:0;
|
||||
if(heigth>0){
|
||||
GWT.log("set new Explorer size: "+heigth);
|
||||
panel.setHeight(heigth+"px");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ import org.gcube.portlets.widgets.wsexplorer.client.rpc.WorkspaceExplorerService
|
|||
import com.google.gwt.core.client.GWT;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* The Class WorkspaceExplorerConstants.
|
||||
*
|
||||
|
@ -38,5 +39,6 @@ public class WorkspaceExplorerConstants {
|
|||
|
||||
public static final WorkspaceExplorerServiceAsync workspaceNavigatorService = GWT.create(WorkspaceExplorerService.class);
|
||||
|
||||
public static int ITEMS_PER_PAGE = 10;
|
||||
public static int ITEMS_PER_PAGE = 20;
|
||||
public static int ITEM_START_INDEX = 0;
|
||||
}
|
||||
|
|
|
@ -69,8 +69,9 @@ public class WorkspaceExplorerController implements EventHandler {
|
|||
public WorkspaceExplorerController(String heightPanel){
|
||||
bindEvents();
|
||||
//As default all items are showable and selectable
|
||||
wsExplorer = new WorkspaceExplorer(eventBus, ItemType.values(), ItemType.values(), new ListDataProvider<Item>());
|
||||
workspaceExplorerPanel = new WorkspaceExplorerPanel(5, wsExplorer.getPanel(), breadcrumbs, navigation, heightPanel);
|
||||
wsExplorer = new WorkspaceExplorer(eventBus, ItemType.values(), ItemType.values());
|
||||
wsExplorer.initTable(new ListDataProvider<Item>());
|
||||
initExplorerPanel(heightPanel);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -84,8 +85,9 @@ public class WorkspaceExplorerController implements EventHandler {
|
|||
public WorkspaceExplorerController(FilterCriteria filterCriteria, String heightPanel) {
|
||||
bindEvents();
|
||||
//As default all items are showable and selectable
|
||||
wsExplorer = new WorkspaceExplorer(eventBus, filterCriteria, ItemType.values(), ItemType.values(), null, false, null, new ListDataProvider<Item>());
|
||||
workspaceExplorerPanel = new WorkspaceExplorerPanel(5, wsExplorer.getPanel(), breadcrumbs, navigation, heightPanel);
|
||||
wsExplorer = new WorkspaceExplorer(eventBus, filterCriteria, ItemType.values(), ItemType.values(), null, false, null);
|
||||
wsExplorer.initTable(new ListDataProvider<Item>());
|
||||
initExplorerPanel(heightPanel);
|
||||
}
|
||||
|
||||
|
||||
|
@ -102,8 +104,21 @@ public class WorkspaceExplorerController implements EventHandler {
|
|||
public WorkspaceExplorerController(FilterCriteria filterCriteria, List<String> showProperties, String heightPanel) {
|
||||
bindEvents();
|
||||
//As default all items are showable and selectable
|
||||
wsExplorer = new WorkspaceExplorer(eventBus, filterCriteria, ItemType.values(), ItemType.values(), showProperties, false, null, new ListDataProvider<Item>());
|
||||
wsExplorer = new WorkspaceExplorer(eventBus, filterCriteria, ItemType.values(), ItemType.values(), showProperties, false, null);
|
||||
wsExplorer.initTable(new ListDataProvider<Item>());
|
||||
initExplorerPanel(heightPanel);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Inits the explorer panel.
|
||||
*
|
||||
* @param heightPanel the height panel
|
||||
*/
|
||||
private void initExplorerPanel(String heightPanel){
|
||||
workspaceExplorerPanel = new WorkspaceExplorerPanel(5, wsExplorer.getPanel(), breadcrumbs, navigation, heightPanel);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -123,7 +138,7 @@ public class WorkspaceExplorerController implements EventHandler {
|
|||
|
||||
if(item.isFolder()){
|
||||
try {
|
||||
wsExplorer.loadFolder(item, false);
|
||||
wsExplorer.loadFolder(item, false, -1, -1, true);
|
||||
loadParentBreadcrumbByItemId(item.getId(), true);
|
||||
|
||||
if(item.isSpecialFolder())
|
||||
|
@ -465,6 +480,8 @@ public class WorkspaceExplorerController implements EventHandler {
|
|||
}
|
||||
|
||||
/**
|
||||
* Gets the event bus.
|
||||
*
|
||||
* @return the eventBus
|
||||
*/
|
||||
public HandlerManager getEventBus() {
|
||||
|
|
|
@ -32,15 +32,17 @@ import com.google.gwt.user.client.ui.DockPanel;
|
|||
import com.google.gwt.user.client.ui.VerticalPanel;
|
||||
import com.google.gwt.view.client.ListDataProvider;
|
||||
|
||||
|
||||
/**
|
||||
* The Class WorkspaceResourcesExplorerPanel.
|
||||
*
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||
* Dec 3, 2015
|
||||
* Jul 11, 2017
|
||||
*/
|
||||
public class WorkspaceResourcesExplorerPanel extends DockPanel implements HasWorskpaceExplorerSelectNotificationListener{
|
||||
|
||||
protected static final int ITEMS_PER_PAGE = WorkspaceExplorerConstants.ITEMS_PER_PAGE;
|
||||
protected static final int ITEM_START_INDEX = WorkspaceExplorerConstants.ITEM_START_INDEX;
|
||||
|
||||
public final HandlerManager eventBus = new HandlerManager(null);
|
||||
protected Breadcrumbs breadcrumbs = new Breadcrumbs(eventBus);
|
||||
protected boolean isSelect = false;
|
||||
|
@ -188,9 +190,10 @@ public class WorkspaceResourcesExplorerPanel extends DockPanel implements HasWor
|
|||
protected void initExplorer(String folderId, String folderName, ItemType[] selectableTypes, ItemType[] showableTypes, List<String> showProperties, FilterCriteria filter, boolean showGcubeInfo, DISPLAY_FIELD sortByColumn) throws Exception{
|
||||
setParameters(folderId, folderName, showProperties, filter);
|
||||
bindEvents();
|
||||
wsExplorer = new WorkspaceExplorer(eventBus, filter, showableTypes, selectableTypes, showProperties, showGcubeInfo, sortByColumn, new ListDataProvider<Item>(), new DISPLAY_FIELD[]{DISPLAY_FIELD.ICON, DISPLAY_FIELD.NAME,DISPLAY_FIELD.CREATION_DATE});
|
||||
wsExplorer = new WorkspaceExplorer(eventBus, filter, showableTypes, selectableTypes, showProperties, showGcubeInfo, sortByColumn, new DISPLAY_FIELD[]{DISPLAY_FIELD.ICON, DISPLAY_FIELD.NAME,DISPLAY_FIELD.CREATION_DATE});
|
||||
wsExplorer.initTable(new ListDataProvider<Item>());
|
||||
Item item = new Item(folderId, folderName, true);
|
||||
wsExplorer.loadFolder(item, true);
|
||||
wsExplorer.loadFolder(item, true, -1, -1, false);
|
||||
initPanel("");
|
||||
}
|
||||
|
||||
|
@ -245,7 +248,7 @@ public class WorkspaceResourcesExplorerPanel extends DockPanel implements HasWor
|
|||
Item item = (Item) loadFolderEvent.getTargetItem();
|
||||
if(item.isFolder()){
|
||||
try {
|
||||
wsExplorer.loadFolder(item, true);
|
||||
wsExplorer.loadFolder(item, true, ITEM_START_INDEX, ITEMS_PER_PAGE, true);
|
||||
loadParentBreadcrumbByItemId(item.getId(), true);
|
||||
clearMoreInfo();
|
||||
} catch (Exception e) {
|
||||
|
@ -460,7 +463,7 @@ public class WorkspaceResourcesExplorerPanel extends DockPanel implements HasWor
|
|||
this.filterCriteria = filterCriteria;
|
||||
wsExplorer.setNewFilterCriteria(filterCriteria);
|
||||
try {
|
||||
wsExplorer.loadFolder(wsExplorer.getDisplayingFolderItem(), true);
|
||||
wsExplorer.loadFolder(wsExplorer.getDisplayingFolderItem(), true, ITEM_START_INDEX, ITEMS_PER_PAGE, true);
|
||||
}
|
||||
catch (Exception e) {
|
||||
wsExplorer.setAlert("Sorry, an error occurred during filter update", AlertType.ERROR);
|
||||
|
@ -477,7 +480,7 @@ public class WorkspaceResourcesExplorerPanel extends DockPanel implements HasWor
|
|||
this.showProperties = showProperties;
|
||||
wsExplorer.setNewShowProperties(showProperties);
|
||||
try {
|
||||
wsExplorer.loadFolder(wsExplorer.getDisplayingFolderItem(), true);
|
||||
wsExplorer.loadFolder(wsExplorer.getDisplayingFolderItem(), true, ITEM_START_INDEX, ITEMS_PER_PAGE, true);
|
||||
}
|
||||
catch (Exception e) {
|
||||
wsExplorer.setAlert("Sorry, an error occurred during show properties update", AlertType.ERROR);
|
||||
|
@ -497,7 +500,7 @@ public class WorkspaceResourcesExplorerPanel extends DockPanel implements HasWor
|
|||
wsExplorer.setNewFilterCriteria(filterCriteria);
|
||||
wsExplorer.setNewShowProperties(showProperties);
|
||||
try {
|
||||
wsExplorer.loadFolder(wsExplorer.getDisplayingFolderItem(), true);
|
||||
wsExplorer.loadFolder(wsExplorer.getDisplayingFolderItem(), true, ITEM_START_INDEX, ITEMS_PER_PAGE, true);
|
||||
}
|
||||
catch (Exception e) {
|
||||
wsExplorer.setAlert("Sorry, an error occurred during filters or properties update", AlertType.ERROR);
|
||||
|
|
|
@ -3,9 +3,11 @@
|
|||
*/
|
||||
package org.gcube.portlets.widgets.wsexplorer.client.explore;
|
||||
|
||||
import static org.gcube.portlets.widgets.wsexplorer.client.explore.WorkspaceResourcesExplorerPanel.ITEMS_PER_PAGE;
|
||||
import static org.gcube.portlets.widgets.wsexplorer.client.explore.WorkspaceResourcesExplorerPanel.ITEM_START_INDEX;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.portlets.widgets.wsexplorer.client.WorkspaceExplorerConstants;
|
||||
import org.gcube.portlets.widgets.wsexplorer.client.event.BreadcrumbClickEvent;
|
||||
import org.gcube.portlets.widgets.wsexplorer.client.event.BreadcrumbClickEventHandler;
|
||||
import org.gcube.portlets.widgets.wsexplorer.client.event.ClickItemEvent;
|
||||
|
@ -30,9 +32,8 @@ import com.google.gwt.user.client.ui.DockPanel;
|
|||
*/
|
||||
public class WorkspaceResourcesExplorerPanelPaginated extends WorkspaceResourcesExplorerPanel {
|
||||
|
||||
private static final int ITEMS_PER_PAGE = WorkspaceExplorerConstants.ITEMS_PER_PAGE;
|
||||
protected WorkspaceExplorerPaginated wsExplorer;
|
||||
public static int ITEM_START_INDEX = 0;
|
||||
|
||||
|
||||
/**
|
||||
* Instantiates a new workspace resources explorer panel paginated.
|
||||
|
@ -71,22 +72,6 @@ public class WorkspaceResourcesExplorerPanelPaginated extends WorkspaceResources
|
|||
super(folderId, showOnlyFolders, showProperties, filter);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Instantiates a new workspace resources explorer panel paginated.
|
||||
*
|
||||
* @param folderId the folder id
|
||||
* @param showOnlyFolders the show only folders
|
||||
* @param showProperties the show properties
|
||||
* @param filter the filter
|
||||
* @param showGcubeInfo the show gcube info
|
||||
* @param sortByColumn the sort by column
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
public WorkspaceResourcesExplorerPanelPaginated(String folderId, boolean showOnlyFolders, List<String> showProperties, FilterCriteria filter, boolean showGcubeInfo, DISPLAY_FIELD sortByColumn) throws Exception {
|
||||
super(folderId, showOnlyFolders, showProperties, filter, showGcubeInfo, sortByColumn);
|
||||
}
|
||||
|
||||
/**
|
||||
* Inits the explorer.
|
||||
*
|
||||
|
@ -107,7 +92,7 @@ public class WorkspaceResourcesExplorerPanelPaginated extends WorkspaceResources
|
|||
wsExplorer = new WorkspaceExplorerPaginated(eventBus, filter, showableTypes, selectableTypes, showProperties, showGcubeInfo, sortByColumn, new DISPLAY_FIELD[]{DISPLAY_FIELD.ICON, DISPLAY_FIELD.NAME, DISPLAY_FIELD.CREATION_DATE});
|
||||
wsExplorer.initPagination(ITEMS_PER_PAGE);
|
||||
Item item = new Item(folderId, folderName, true);
|
||||
wsExplorer.loadFolder(item, true, ITEM_START_INDEX, ITEMS_PER_PAGE);
|
||||
wsExplorer.loadFolder(item, true, ITEM_START_INDEX, ITEMS_PER_PAGE, true);
|
||||
initPanel("");
|
||||
}
|
||||
|
||||
|
@ -160,7 +145,7 @@ public class WorkspaceResourcesExplorerPanelPaginated extends WorkspaceResources
|
|||
Item item = (Item) loadFolderEvent.getTargetItem();
|
||||
if(item.isFolder()){
|
||||
try {
|
||||
wsExplorer.loadFolder(item, true, ITEM_START_INDEX, ITEMS_PER_PAGE);
|
||||
wsExplorer.loadFolder(item, true, ITEM_START_INDEX, ITEMS_PER_PAGE, true);
|
||||
loadParentBreadcrumbByItemId(item.getId(), true);
|
||||
clearMoreInfo();
|
||||
} catch (Exception e) {
|
||||
|
|
|
@ -6,12 +6,11 @@ package org.gcube.portlets.widgets.wsexplorer.client.view;
|
|||
import org.gcube.portlets.widgets.wsexplorer.shared.Item;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* The Interface FolderLoader.
|
||||
*
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||
* Jul 5, 2017
|
||||
* Jul 11, 2017
|
||||
*/
|
||||
public interface FolderLoader {
|
||||
|
||||
|
@ -20,18 +19,10 @@ public interface FolderLoader {
|
|||
*
|
||||
* @param item the item
|
||||
* @param loadGcubeProperties the load gcube properties
|
||||
* @param startIdx the start idx. Used for pagination
|
||||
* @param limit the limit. Used for pagination
|
||||
* @param resetStore the reset store. Used for pagination
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
public void loadFolder(final Item item, boolean loadGcubeProperties) throws Exception;
|
||||
|
||||
/**
|
||||
* Load folder.
|
||||
*
|
||||
* @param item the item
|
||||
* @param loadGcubeProperties the load gcube properties
|
||||
* @param startIdx the start idx
|
||||
* @param limit the limit
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
public void loadFolder(final Item item, boolean loadGcubeProperties, int startIdx, int limit) throws Exception;
|
||||
public void loadFolder(final Item item, boolean loadGcubeProperties, int startIdx, int limit, boolean resetStore) throws Exception;
|
||||
}
|
||||
|
|
|
@ -76,19 +76,28 @@ public class WorkspaceExplorer implements ShowableTypes, SelectableTypes, Folder
|
|||
* @param showGcubeInfo the show gcube info
|
||||
* @param sortByColumn the sort by column
|
||||
* @param fields the columns to display
|
||||
* @param dataProvider the data provider
|
||||
*/
|
||||
private WorkspaceExplorer(HandlerManager eventBus, ItemType[] showableTypes, ItemType[] selectableTypes, List<String> displayProperties, boolean showGcubeInfo, DISPLAY_FIELD sortByColumn, DISPLAY_FIELD[] fields, AbstractDataProvider<Item> dataProvider){
|
||||
private WorkspaceExplorer(HandlerManager eventBus, ItemType[] showableTypes, ItemType[] selectableTypes, List<String> displayProperties, boolean showGcubeInfo, DISPLAY_FIELD sortByColumn, DISPLAY_FIELD[] fields){
|
||||
this.eventBus = eventBus;
|
||||
this.showGcubeItemsInfo = showGcubeInfo;
|
||||
this.displayFields = fields;
|
||||
this.sortByColumn = sortByColumn;
|
||||
this.displayProperties = displayProperties;
|
||||
this.dataProvider = dataProvider;
|
||||
this.explorerPanel = new ScrollPanel();
|
||||
setShowableTypes(showableTypes);
|
||||
setSelectableTypes(selectableTypes);
|
||||
this.itTables = new ItemsTable<Item>(eventBus, true, displayFields, displayProperties, showGcubeItemsInfo, sortByColumn, dataProvider);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the data provider table.
|
||||
*
|
||||
* @param dataProvider the new data provider table
|
||||
*/
|
||||
public void initTable(AbstractDataProvider<Item> dataProvider){
|
||||
this.dataProvider = dataProvider;
|
||||
this.itTables = new ItemsTable<Item>(eventBus, true, displayFields, displayProperties, showGcubeItemsInfo, sortByColumn);
|
||||
this.itTables.initTable(null, null, dataProvider);
|
||||
}
|
||||
|
||||
|
||||
|
@ -98,12 +107,10 @@ public class WorkspaceExplorer implements ShowableTypes, SelectableTypes, Folder
|
|||
* @param eventBus the event bus
|
||||
* @param showableTypes the showable types
|
||||
* @param selectableTypes the selectable types
|
||||
* @param dataProvider the data provider
|
||||
* @param fields the fields
|
||||
*/
|
||||
public WorkspaceExplorer(HandlerManager eventBus, ItemType[] showableTypes, ItemType[] selectableTypes, AbstractDataProvider<Item> dataProvider, DISPLAY_FIELD...fields) {
|
||||
this(eventBus, showableTypes, selectableTypes, null, false, null, fields, dataProvider);
|
||||
// itTables = new ItemsTable<Item>(eventBus, true, fields, null, showGcubeItemsInfo);
|
||||
public WorkspaceExplorer(HandlerManager eventBus, ItemType[] showableTypes, ItemType[] selectableTypes, DISPLAY_FIELD...fields) {
|
||||
this(eventBus, showableTypes, selectableTypes, null, false, null, fields);
|
||||
}
|
||||
|
||||
|
||||
|
@ -114,11 +121,10 @@ public class WorkspaceExplorer implements ShowableTypes, SelectableTypes, Folder
|
|||
* @param showableTypes the showable types
|
||||
* @param selectableTypes the selectable types
|
||||
* @param displayProperties the display properties
|
||||
* @param dataProvider the data provider
|
||||
* @param fields the fields
|
||||
*/
|
||||
public WorkspaceExplorer(HandlerManager eventBus, ItemType[] showableTypes, ItemType[] selectableTypes, List<String> displayProperties, AbstractDataProvider<Item> dataProvider, DISPLAY_FIELD...fields) {
|
||||
this(eventBus, showableTypes, selectableTypes, displayProperties, false, null, fields, dataProvider);
|
||||
public WorkspaceExplorer(HandlerManager eventBus, ItemType[] showableTypes, ItemType[] selectableTypes, List<String> displayProperties, DISPLAY_FIELD...fields) {
|
||||
this(eventBus, showableTypes, selectableTypes, displayProperties, false, null, fields);
|
||||
}
|
||||
|
||||
|
||||
|
@ -133,11 +139,10 @@ public class WorkspaceExplorer implements ShowableTypes, SelectableTypes, Folder
|
|||
* @param displayProperties the display properties
|
||||
* @param showGcubeInfo the show gcube info
|
||||
* @param sortByColumn the sort by column
|
||||
* @param dataProvider the data provider
|
||||
* @param fields the fields
|
||||
*/
|
||||
public WorkspaceExplorer(HandlerManager eventBus, FilterCriteria filterCriteria, ItemType[] showableTypes, ItemType[] selectableTypes, List<String> displayProperties, boolean showGcubeInfo, DISPLAY_FIELD sortByColumn, AbstractDataProvider<Item> dataProvider, DISPLAY_FIELD...fields) {
|
||||
this(eventBus, showableTypes, selectableTypes, displayProperties, showGcubeInfo, sortByColumn, fields, dataProvider);
|
||||
public WorkspaceExplorer(HandlerManager eventBus, FilterCriteria filterCriteria, ItemType[] showableTypes, ItemType[] selectableTypes, List<String> displayProperties, boolean showGcubeInfo, DISPLAY_FIELD sortByColumn, DISPLAY_FIELD...fields) {
|
||||
this(eventBus, showableTypes, selectableTypes, displayProperties, showGcubeInfo, sortByColumn, fields);
|
||||
this.filterCriteria = filterCriteria;
|
||||
|
||||
}
|
||||
|
@ -211,56 +216,56 @@ public class WorkspaceExplorer implements ShowableTypes, SelectableTypes, Folder
|
|||
this.displayingFolderItem = item;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load folder.
|
||||
*
|
||||
* @param item the item
|
||||
* @param loadGcubeProperties the load gcube properties
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
public void loadFolder(final Item item, boolean loadGcubeProperties) throws Exception {
|
||||
GWT.log("loading folder data");
|
||||
setLoading();
|
||||
|
||||
if(!item.isFolder())
|
||||
throw new Exception("Item is not a folder");
|
||||
|
||||
if(item.getId()==null || item.getId().isEmpty())
|
||||
throw new Exception("Item id is null or empty");
|
||||
|
||||
// we make a copy of showable types
|
||||
List<ItemType> showableTypesParam = new ArrayList<ItemType>(showableTypes);
|
||||
|
||||
// we get sure that folders are displayed
|
||||
for (ItemType folder : Util.FOLDERS) {
|
||||
if (!showableTypesParam.contains(folder))
|
||||
showableTypesParam.add(folder);
|
||||
}
|
||||
|
||||
boolean purgeEmpyFolders = !showEmptyFolders;
|
||||
// FilterCriteria filterCriteria = new FilterCriteria(allowedMimeTypes,requiredProperties, allowedFileExtensions);
|
||||
|
||||
GWT.log("loading workspace folder by item id from server: "+item.getId());
|
||||
WorkspaceExplorerConstants.workspaceNavigatorService.getFolder(item, showableTypesParam, purgeEmpyFolders, filterCriteria, loadGcubeProperties, new AsyncCallback<Item>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
Window.alert(caught.getMessage());
|
||||
setAlert(caught.getMessage(), AlertType.ERROR);
|
||||
GWT.log("Error loading workspace folder from server",caught);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(Item result) {
|
||||
if(item.getName()==null || item.getName().isEmpty())
|
||||
item.setName(result.getName());
|
||||
|
||||
updateExplorer(result.getChildren());
|
||||
|
||||
setDisplayingFolderItem(result);
|
||||
}
|
||||
});
|
||||
}
|
||||
// /**
|
||||
// * Load folder.
|
||||
// *
|
||||
// * @param item the item
|
||||
// * @param loadGcubeProperties the load gcube properties
|
||||
// * @throws Exception the exception
|
||||
// */
|
||||
// public void loadFolder(final Item item, boolean loadGcubeProperties) throws Exception {
|
||||
// GWT.log("loading folder data");
|
||||
// setLoading();
|
||||
//
|
||||
// if(!item.isFolder())
|
||||
// throw new Exception("Item is not a folder");
|
||||
//
|
||||
// if(item.getId()==null || item.getId().isEmpty())
|
||||
// throw new Exception("Item id is null or empty");
|
||||
//
|
||||
// // we make a copy of showable types
|
||||
// List<ItemType> showableTypesParam = new ArrayList<ItemType>(showableTypes);
|
||||
//
|
||||
// // we get sure that folders are displayed
|
||||
// for (ItemType folder : Util.FOLDERS) {
|
||||
// if (!showableTypesParam.contains(folder))
|
||||
// showableTypesParam.add(folder);
|
||||
// }
|
||||
//
|
||||
// boolean purgeEmpyFolders = !showEmptyFolders;
|
||||
//// FilterCriteria filterCriteria = new FilterCriteria(allowedMimeTypes,requiredProperties, allowedFileExtensions);
|
||||
//
|
||||
// GWT.log("loading workspace folder by item id from server: "+item.getId());
|
||||
// WorkspaceExplorerConstants.workspaceNavigatorService.getFolder(item, showableTypesParam, purgeEmpyFolders, filterCriteria, loadGcubeProperties, new AsyncCallback<Item>() {
|
||||
//
|
||||
// @Override
|
||||
// public void onFailure(Throwable caught) {
|
||||
// Window.alert(caught.getMessage());
|
||||
// setAlert(caught.getMessage(), AlertType.ERROR);
|
||||
// GWT.log("Error loading workspace folder from server",caught);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onSuccess(Item result) {
|
||||
// if(item.getName()==null || item.getName().isEmpty())
|
||||
// item.setName(result.getName());
|
||||
//
|
||||
// updateExplorer(result.getChildren());
|
||||
//
|
||||
// setDisplayingFolderItem(result);
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
|
||||
/**
|
||||
* Load the Workspace Tree.
|
||||
|
@ -465,21 +470,58 @@ public class WorkspaceExplorer implements ShowableTypes, SelectableTypes, Folder
|
|||
itTables.reInitColumnsTable();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.gcube.portlets.widgets.wsexplorer.client.view.FolderLoader#loadFolder(org.gcube.portlets.widgets.wsexplorer.shared.Item, boolean, int, int)
|
||||
*/
|
||||
/**
|
||||
* This constructor is never used here. Use {@link WorkspaceExplorerPaginated} class if you want paginate the results
|
||||
*
|
||||
* @param item the item
|
||||
* @param loadGcubeProperties the load gcube properties
|
||||
* @param startIdx the start idx
|
||||
* @param limit the limit
|
||||
* @throws Exception the exception
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.gcube.portlets.widgets.wsexplorer.client.view.FolderLoader#loadFolder(org.gcube.portlets.widgets.wsexplorer.shared.Item, boolean, int, int, boolean)
|
||||
* Pagination is not implemented here
|
||||
*/
|
||||
@Override
|
||||
public void loadFolder(Item item, boolean loadGcubeProperties, int startIdx, int limit) throws Exception {
|
||||
this.loadFolder(item, loadGcubeProperties);
|
||||
public void loadFolder(
|
||||
final Item item, boolean loadGcubeProperties, int startIdx, int limit,
|
||||
boolean resetStore)
|
||||
throws Exception {
|
||||
|
||||
GWT.log("loading folder data");
|
||||
setLoading();
|
||||
|
||||
if(!item.isFolder())
|
||||
throw new Exception("Item is not a folder");
|
||||
|
||||
if(item.getId()==null || item.getId().isEmpty())
|
||||
throw new Exception("Item id is null or empty");
|
||||
|
||||
// we make a copy of showable types
|
||||
List<ItemType> showableTypesParam = new ArrayList<ItemType>(showableTypes);
|
||||
|
||||
// we get sure that folders are displayed
|
||||
for (ItemType folder : Util.FOLDERS) {
|
||||
if (!showableTypesParam.contains(folder))
|
||||
showableTypesParam.add(folder);
|
||||
}
|
||||
|
||||
boolean purgeEmpyFolders = !showEmptyFolders;
|
||||
// FilterCriteria filterCriteria = new FilterCriteria(allowedMimeTypes,requiredProperties, allowedFileExtensions);
|
||||
|
||||
GWT.log("loading workspace folder by item id from server: "+item.getId());
|
||||
WorkspaceExplorerConstants.workspaceNavigatorService.getFolder(item, showableTypesParam, purgeEmpyFolders, filterCriteria, loadGcubeProperties, new AsyncCallback<Item>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
Window.alert(caught.getMessage());
|
||||
setAlert(caught.getMessage(), AlertType.ERROR);
|
||||
GWT.log("Error loading workspace folder from server",caught);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(Item result) {
|
||||
if(item.getName()==null || item.getName().isEmpty())
|
||||
item.setName(result.getName());
|
||||
|
||||
updateExplorer(result.getChildren());
|
||||
|
||||
setDisplayingFolderItem(result);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,10 +21,14 @@ import com.google.gwt.user.cellview.client.SimplePager;
|
|||
import com.google.gwt.user.cellview.client.SimplePager.TextLocation;
|
||||
import com.google.gwt.user.client.Window;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.google.gwt.user.client.ui.Label;
|
||||
import com.google.gwt.user.client.ui.VerticalPanel;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
import com.google.gwt.view.client.AsyncDataProvider;
|
||||
import com.google.gwt.view.client.HasData;
|
||||
import com.google.gwt.view.client.Range;
|
||||
import com.google.gwt.view.client.SelectionModel;
|
||||
import com.google.gwt.view.client.SingleSelectionModel;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -37,14 +41,18 @@ public class WorkspaceExplorerPaginated extends WorkspaceExplorer{
|
|||
|
||||
private VerticalPanel vPanel = new VerticalPanel();
|
||||
|
||||
private static WorkspaceExplorerPaginated INSTANCE;
|
||||
private Boolean newLoading = false;
|
||||
|
||||
private Boolean justTest = false;
|
||||
|
||||
//private ListDataProvider<Item> dataProvider = new ListDataProvider<Item>();
|
||||
|
||||
private static MyCustomDataProvider<Item> dataProvider = new MyCustomDataProvider<Item>();
|
||||
private MyCustomDataProvider<Item> dataProvider = new MyCustomDataProvider<Item>();
|
||||
|
||||
protected boolean loadGcubeProperties = false;
|
||||
|
||||
protected Widget orginalLoadingIndicator = null;
|
||||
|
||||
/**
|
||||
* Instantiates a new workspace explorer paginated.
|
||||
*
|
||||
|
@ -62,8 +70,10 @@ public class WorkspaceExplorerPaginated extends WorkspaceExplorer{
|
|||
ItemType[] showableTypes, ItemType[] selectableTypes,
|
||||
List<String> displayProperties, boolean showGcubeInfo,
|
||||
DISPLAY_FIELD sortByColumn, DISPLAY_FIELD[] fields) {
|
||||
super(eventBus, filterCriteria, showableTypes, selectableTypes, displayProperties, showGcubeInfo, sortByColumn, dataProvider);
|
||||
INSTANCE = this;
|
||||
super(eventBus, filterCriteria, showableTypes, selectableTypes, displayProperties, showGcubeInfo, sortByColumn);
|
||||
initTable(dataProvider);
|
||||
newLoading = true;
|
||||
orginalLoadingIndicator = getCellTable().getLoadingIndicator();
|
||||
}
|
||||
|
||||
|
||||
|
@ -74,10 +84,8 @@ public class WorkspaceExplorerPaginated extends WorkspaceExplorer{
|
|||
*/
|
||||
public AsyncDataProvider<Item> getAsycnDataProvider(){
|
||||
return (AsyncDataProvider<Item>) getCellTable().getDataProvider();
|
||||
//return new MyCustomDataProvider<Item>();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the cell tale.
|
||||
*
|
||||
|
@ -87,17 +95,13 @@ public class WorkspaceExplorerPaginated extends WorkspaceExplorer{
|
|||
return getItTables().getCellTable();
|
||||
}
|
||||
|
||||
/**
|
||||
* Load folder.
|
||||
*
|
||||
* @param item the item
|
||||
* @param loadGcubeProperties the load gcube properties
|
||||
* @param startIdx the start idx
|
||||
* @param limit the limit
|
||||
* @throws Exception the exception
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.gcube.portlets.widgets.wsexplorer.client.view.WorkspaceExplorer#loadFolder(org.gcube.portlets.widgets.wsexplorer.shared.Item, boolean, int, int, boolean)
|
||||
*/
|
||||
public void loadFolder(final Item item, final boolean loadGcubeProperties, final int startIdx, final int limit) throws Exception {
|
||||
GWT.log("loading folder data");
|
||||
public void loadFolder(final Item item, final boolean loadGcubeProperties, final int startIdx, final int limit, final boolean resetStore) throws Exception {
|
||||
newLoading = resetStore;
|
||||
GWT.log("loading folder data for Item: "+item.getId()+" [startIdx: "+startIdx +", limit: "+limit+", resetStore:"+resetStore+"]");
|
||||
//super.loadFolder(item, loadGcubeProperties);
|
||||
this.loadGcubeProperties = loadGcubeProperties;
|
||||
setLoading();
|
||||
|
@ -118,8 +122,9 @@ public class WorkspaceExplorerPaginated extends WorkspaceExplorer{
|
|||
|
||||
final boolean purgeEmpyFolders = !showEmptyFolders;
|
||||
|
||||
//IF IS INIT OR A DOUBLE CLICK
|
||||
if(getDisplayingFolderItem()==null || getDisplayingFolderItem().getId()!=item.getId()){
|
||||
|
||||
GWT.log("Performing Get Folder Children Count ");
|
||||
WorkspaceExplorerConstants.workspaceNavigatorService.getFolderChildrenCount(item, new AsyncCallback<Integer>() {
|
||||
|
||||
@Override
|
||||
|
@ -127,11 +132,20 @@ public class WorkspaceExplorerPaginated extends WorkspaceExplorer{
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(Integer result) {
|
||||
public void onSuccess(final Integer result) {
|
||||
GWT.log("Folder Children count: "+result);
|
||||
getAsycnDataProvider().updateRowCount(result, false);
|
||||
|
||||
int newStartIndex = startIdx;
|
||||
getAsycnDataProvider().updateRowCount(result, true);
|
||||
|
||||
if(newLoading){
|
||||
GWT.log("Cleaning all data...");
|
||||
newStartIndex = 0;
|
||||
GWT.log("Store reset performed start index is: "+newStartIndex);
|
||||
}
|
||||
|
||||
//final Range range = display.getVisibleRange();
|
||||
perfomGetFolderChildren(item, loadGcubeProperties, startIdx, limit, purgeEmpyFolders, showableTypesParam);
|
||||
perfomGetFolderChildren(item, loadGcubeProperties, newStartIndex, limit, purgeEmpyFolders, showableTypesParam);
|
||||
}
|
||||
});
|
||||
}else
|
||||
|
@ -142,6 +156,7 @@ public class WorkspaceExplorerPaginated extends WorkspaceExplorer{
|
|||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Perfom get folder children.
|
||||
*
|
||||
|
@ -161,21 +176,49 @@ public class WorkspaceExplorerPaginated extends WorkspaceExplorer{
|
|||
Window.alert(caught.getMessage());
|
||||
setAlert(caught.getMessage(), AlertType.ERROR);
|
||||
GWT.log("Error loading workspace folder from server",caught);
|
||||
newLoading = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(Item result) {
|
||||
|
||||
if(item.getName()==null || item.getName().isEmpty())
|
||||
item.setName(result.getName());
|
||||
|
||||
GWT.log("Returned "+result.getChildren().size() +" children");
|
||||
//GWT.log("Returned "+result.getChildren().size() +" children");
|
||||
//getItTables().updateItems(result.getChildren(), true);
|
||||
|
||||
if(newLoading){
|
||||
getCellTable().setVisibleRangeAndClearData(new Range(startIdx, WorkspaceExplorerConstants.ITEMS_PER_PAGE), false);
|
||||
}
|
||||
|
||||
SelectionModel<? super Item> sm = getCellTable().getSelectionModel();
|
||||
|
||||
if(sm instanceof SingleSelectionModel){
|
||||
SingleSelectionModel ssm = (SingleSelectionModel) sm;
|
||||
ssm.clear();
|
||||
}
|
||||
|
||||
getAsycnDataProvider().updateRowData(startIdx, result.getChildren());
|
||||
getCellTable().setPageSize(result.getChildren().size()+1);
|
||||
//cellList.setVisibleRange(startIdx, result.getChildren().size());
|
||||
getCellTable().redraw();
|
||||
GWT.log("cellList size: "+getCellTable().getRowCount());
|
||||
|
||||
if(result.getChildren().size()==0){
|
||||
getCellTable().setLoadingIndicator(new Label("No data"));
|
||||
}else{
|
||||
getCellTable().setLoadingIndicator(orginalLoadingIndicator);
|
||||
}
|
||||
|
||||
|
||||
//getCellTable().setVisibleRangeAndClearData(new Range(startIdx, result.getChildren()).), false);
|
||||
//getAsycnDataProvider().getDataDisplays().
|
||||
GWT.log("Updating row data startIndex: "+startIdx + " size: "+result.getChildren().size());
|
||||
|
||||
//getCellTable().setPageSize(result.getChildren().size()+1);
|
||||
//getCellTable().setVisibleRange(startIdx, result.getChildren().size());
|
||||
//getCellTable().redraw();
|
||||
//GWT.log("cellTable size: "+getCellTable().getRowCount());
|
||||
setDisplayingFolderItem(result);
|
||||
newLoading = false;
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -220,7 +263,7 @@ public class WorkspaceExplorerPaginated extends WorkspaceExplorer{
|
|||
* Jul 5, 2017
|
||||
* @param <T> the generic type
|
||||
*/
|
||||
public static class MyCustomDataProvider<T> extends AsyncDataProvider<T> {
|
||||
public class MyCustomDataProvider<T> extends AsyncDataProvider<T> {
|
||||
|
||||
/**
|
||||
* {@link #onRangeChanged(HasData)} is called when the table requests a
|
||||
|
@ -235,45 +278,24 @@ public class WorkspaceExplorerPaginated extends WorkspaceExplorer{
|
|||
// Get the new range.
|
||||
final Range range = display.getVisibleRange();
|
||||
|
||||
// We are creating fake data. Normally, the data will come
|
||||
// from a
|
||||
// server.
|
||||
// int start = range.getStart();
|
||||
// int length = range.getLength();
|
||||
// List<Item> newData = new ArrayList<Item>();
|
||||
// for (int i = start; i < start + length; i++) {
|
||||
// newData.add(new Item("Item "+i, "Item "+i, false));
|
||||
// }
|
||||
// // Push the data to the displays. AsyncDataProvider will
|
||||
// // only update
|
||||
// // displays that are within range of the data.
|
||||
// updateRowData(start, newData);
|
||||
|
||||
int start = range.getStart();
|
||||
int length = range.getLength();
|
||||
GWT.log("Range changed: "+start +" "+length);
|
||||
|
||||
// try {
|
||||
// GWT.log("qui");
|
||||
// INSTANCE.loadFolder(INSTANCE.getItemSelected(), INSTANCE.loadGcubeProperties, start, length);
|
||||
// GWT.log("qua");
|
||||
// }
|
||||
// catch (Exception e) {
|
||||
// // TODO Auto-generated catch block
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// Item item = new Item(WorkspaceExplorerPaginated.this.getF, folderName, true);
|
||||
// WorkspaceExplorerPaginated.this.loadFolder(WorkspaceExplorerPaginated.this.getItemSelected(), super.get,start, length);
|
||||
GWT.log("Range changed: "+start +" "+length + " visible count: "+display.getVisibleItemCount());
|
||||
|
||||
if(newLoading){
|
||||
GWT.log("OnLoading is true.. returning");
|
||||
return;
|
||||
}
|
||||
try {
|
||||
loadFolder(getDisplayingFolderItem(), loadGcubeProperties, start, length, false);
|
||||
}
|
||||
catch (Exception e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public MyCustomDataProvider() {
|
||||
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -26,10 +26,12 @@ import com.google.gwt.view.client.SelectionChangeEvent;
|
|||
import com.google.gwt.view.client.SelectionChangeEvent.Handler;
|
||||
import com.google.gwt.view.client.SingleSelectionModel;
|
||||
|
||||
|
||||
/**
|
||||
* The Class AbstractItemTable.
|
||||
* The Class AbstractItemsCellTable.
|
||||
*
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it Feb 19, 2015
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||
* Jul 11, 2017
|
||||
* @param <T> the generic type
|
||||
*/
|
||||
public abstract class AbstractItemsCellTable<T> {
|
||||
|
@ -39,7 +41,7 @@ public abstract class AbstractItemsCellTable<T> {
|
|||
protected T itemContextMenu = null;
|
||||
protected boolean showMoreInfo;
|
||||
protected SingleSelectionModel<T> ssm;
|
||||
private HandlerManager eventBus;
|
||||
protected HandlerManager eventBus;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -47,8 +49,9 @@ public abstract class AbstractItemsCellTable<T> {
|
|||
*
|
||||
* @param pager the pager
|
||||
* @param pagination the pagination
|
||||
* @param dataProvider the data provider
|
||||
*/
|
||||
public abstract void initTable(final SimplePager pager, final Pagination pagination);
|
||||
public abstract void initTable(final SimplePager pager, final Pagination pagination, AbstractDataProvider<T> dataProvider);
|
||||
|
||||
|
||||
/**
|
||||
|
@ -59,7 +62,7 @@ public abstract class AbstractItemsCellTable<T> {
|
|||
* @param dataProvider the data provider
|
||||
* @param pageSize the page size
|
||||
*/
|
||||
public void initAbstractTable(HandlerManager eventBus, boolean fireOnClick, AbstractDataProvider<T> dataProvider, int pageSize){
|
||||
protected void initAbstractTable(HandlerManager eventBus, boolean fireOnClick, AbstractDataProvider<T> dataProvider, int pageSize){
|
||||
this.eventBus = eventBus;
|
||||
this.showMoreInfo = fireOnClick;
|
||||
sortedCellTable = new SortedCellTable<T>(pageSize, dataProvider);
|
||||
|
|
|
@ -56,7 +56,7 @@ public class ItemsTable<T extends Item> extends AbstractItemsCellTable<T> implem
|
|||
public DateTimeFormat dtformat = DateTimeFormat.getFormat("dd MMM hh:mm aaa yyyy");
|
||||
public ImageResource info = WorkspaceExplorerResources.ICONS.infoSquare();
|
||||
|
||||
public AbstractDataProvider<T> dataProvider;
|
||||
private AbstractDataProvider<T> dataProvider;
|
||||
|
||||
/**
|
||||
* The Enum DISPLAY_FIELD.
|
||||
|
@ -82,18 +82,14 @@ public class ItemsTable<T extends Item> extends AbstractItemsCellTable<T> implem
|
|||
* @param displayProperties the display properties
|
||||
* @param showGcubeItemsInfo the show gcube items info
|
||||
* @param startSortByColumn the start sort by column
|
||||
* @param asyncDataProvider the async data provider
|
||||
*/
|
||||
public ItemsTable(HandlerManager eventBus, boolean showMoreInfo, DISPLAY_FIELD[] fields, List<String> displayProperties, boolean showGcubeItemsInfo, DISPLAY_FIELD startSortByColumn, AbstractDataProvider<T> dataProvider) {
|
||||
this.dataProvider = dataProvider;
|
||||
initAbstractTable(eventBus, showMoreInfo, dataProvider, WorkspaceExplorerConstants.ITEMS_PER_PAGE);
|
||||
this.dataProvider.addDataDisplay(sortedCellTable);
|
||||
this.startSortByColumn = startSortByColumn;
|
||||
public ItemsTable(HandlerManager eventBus, boolean showMoreInfo, DISPLAY_FIELD[] fields, List<String> displayProperties, boolean showGcubeItemsInfo, DISPLAY_FIELD startSortByColumn) {
|
||||
this.eventBus = eventBus;
|
||||
setDisplayFields(fields);
|
||||
setDisplayProperties(displayProperties);
|
||||
setShowGcubeItemsInfo(showGcubeItemsInfo);
|
||||
this.isAsyncronusTable = dataProvider instanceof AbstractDataProvider?true:false;
|
||||
initTable(null, null);
|
||||
this.startSortByColumn = startSortByColumn;
|
||||
//initTable(null, null);
|
||||
}
|
||||
|
||||
|
||||
|
@ -129,7 +125,13 @@ public class ItemsTable<T extends Item> extends AbstractItemsCellTable<T> implem
|
|||
* @see org.gcube.portlets.admin.gcubereleases.client.view.AbstractPackageTable#initTable(com.google.gwt.user.cellview.client.AbstractCellTable, com.google.gwt.user.cellview.client.SimplePager, com.github.gwtbootstrap.client.ui.Pagination)
|
||||
*/
|
||||
@Override
|
||||
public void initTable(final SimplePager pager, final Pagination pagination) {
|
||||
public void initTable(final SimplePager pager, final Pagination pagination, AbstractDataProvider<T> dataProvider) {
|
||||
this.dataProvider = dataProvider;
|
||||
initAbstractTable(eventBus, showMoreInfo, dataProvider, WorkspaceExplorerConstants.ITEMS_PER_PAGE);
|
||||
this.dataProvider.addDataDisplay(sortedCellTable);
|
||||
|
||||
this.isAsyncronusTable = dataProvider instanceof AbstractDataProvider?true:false;
|
||||
|
||||
sortedCellTable.setEmptyTableWidget(new Label("No data."));
|
||||
|
||||
if(this.displayFields.contains(DISPLAY_FIELD.ICON)){
|
||||
|
@ -430,7 +432,7 @@ public class ItemsTable<T extends Item> extends AbstractItemsCellTable<T> implem
|
|||
for(int i=0;i<count;i++){
|
||||
sortedCellTable.removeColumn(0);
|
||||
}
|
||||
initTable(null, null);
|
||||
initTable(null, null, dataProvider);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -50,6 +50,7 @@ public class Item implements IsSerializable, ItemInterface{
|
|||
this.id = id;
|
||||
this.isFolder = isFolder;
|
||||
this.name = name;
|
||||
this.type = isFolder?ItemType.FOLDER:ItemType.UNKNOWN_TYPE;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue