fixed isAsyncronus property
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/widgets/workspace-explorer@158623 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
667b81b080
commit
81f388b31e
|
@ -26,7 +26,6 @@ import org.gcube.portlets.widgets.wsexplorer.shared.ItemType;
|
|||
import com.github.gwtbootstrap.client.ui.constants.AlertType;
|
||||
import com.google.gwt.core.shared.GWT;
|
||||
import com.google.gwt.dom.client.Element;
|
||||
import com.google.gwt.dom.client.Style;
|
||||
import com.google.gwt.event.shared.HandlerManager;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.google.gwt.user.client.ui.DockPanel;
|
||||
|
@ -68,58 +67,51 @@ public class WorkspaceResourcesExplorerPanel extends DockPanel implements HasWor
|
|||
|
||||
// TODO Auto-generated method stub
|
||||
super.onLoad();
|
||||
Element parent = getParent().getElement();
|
||||
if(parent==null){
|
||||
Util.console("WorkspaceResourcesExplorerPanel parent is null");
|
||||
}else{
|
||||
Util.console("WorkspaceResourcesExplorerPanel parent exists");
|
||||
Style style = parent.getStyle();
|
||||
if(style==null){
|
||||
Util.console("WorkspaceResourcesExplorerPanel style is null");
|
||||
}else{
|
||||
Util.console("WorkspaceResourcesExplorerPanel style exists");
|
||||
String height = style.getHeight();
|
||||
Util.console("WorkspaceResourcesExplorerPanel read height from parent: "+height);
|
||||
if(height!=null && !height.isEmpty() && height.contains("px")){
|
||||
String purgedHeight = height.replaceAll("px", "");
|
||||
int heightToInt = Integer.parseInt(purgedHeight);
|
||||
int nh = getNewHeightForContainer(heightToInt);
|
||||
if(nh>0){
|
||||
parentHeight = nh;
|
||||
Util.console("WorkspaceResourcesExplorerPanel Set new height to center panel: "+nh);
|
||||
wsExplorer.getPanel().setHeight(nh+"px");
|
||||
}
|
||||
}else
|
||||
GWT.log("WorkspaceResourcesExplorerPanel read invalid height from parent!");
|
||||
int newHeight = getValidAncestorsHeight(this.getElement());
|
||||
|
||||
if (newHeight>-1){
|
||||
int nh = getNewHeightForContainer(newHeight);
|
||||
Util.console("Height founded through ancestors is: "+nh);
|
||||
if(nh>0){
|
||||
parentHeight = nh;
|
||||
Util.console("WorkspaceResourcesExplorerPanel Set new height to center panel: "+nh);
|
||||
wsExplorer.getPanel().setHeight(nh+"px");
|
||||
}
|
||||
}
|
||||
}else
|
||||
Util.console("No height found through anchestors");
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the valid parent height.
|
||||
* Gets the valid ancestors height.
|
||||
*
|
||||
* @param ele the ele
|
||||
* @return the valid parent height
|
||||
* @return the valid ancestors height
|
||||
*/
|
||||
public int getValidParentHeight(Element ele){
|
||||
public int getValidAncestorsHeight(Element ele){
|
||||
|
||||
if (ele == null)
|
||||
try{
|
||||
|
||||
if (ele == null)
|
||||
return -1;
|
||||
|
||||
Element parent = ele.getParentElement();
|
||||
if(parent==null){
|
||||
return -1;
|
||||
}
|
||||
|
||||
String height = parent.getStyle().getHeight();
|
||||
if(height!=null && !height.isEmpty() && height.contains("px")){
|
||||
String purgedHeight = height.replaceAll("px", "");
|
||||
return Integer.parseInt(purgedHeight);
|
||||
}
|
||||
|
||||
return getValidAncestorsHeight(ele.getParentElement());
|
||||
}catch (Exception e){
|
||||
GWT.log(e.getMessage());
|
||||
return -1;
|
||||
|
||||
Element parent = ele.getParentElement();
|
||||
if(parent==null){
|
||||
return -1;
|
||||
}
|
||||
|
||||
String height = parent.getStyle().getHeight();
|
||||
if(height!=null && !height.isEmpty() && height.contains("px")){
|
||||
String purgedHeight = height.replaceAll("px", "");
|
||||
return Integer.parseInt(purgedHeight);
|
||||
}
|
||||
|
||||
return getValidParentHeight(ele.getParentElement());
|
||||
}
|
||||
|
||||
|
||||
|
@ -556,6 +548,7 @@ public class WorkspaceResourcesExplorerPanel extends DockPanel implements HasWor
|
|||
* @return the new height for container
|
||||
*/
|
||||
protected int getNewHeightForContainer(int parentHeight){
|
||||
GWT.log("getNewHeightForContainer: "+parentHeight);
|
||||
if(parentHeight>0){
|
||||
int bh = breadcrumbs.getHeight();
|
||||
bh = bh>offsetBreadcrumb?bh:offsetBreadcrumb;
|
||||
|
@ -571,7 +564,7 @@ public class WorkspaceResourcesExplorerPanel extends DockPanel implements HasWor
|
|||
* @param height the new height to internal scroll
|
||||
*/
|
||||
public void setHeightToInternalScroll(int height){
|
||||
|
||||
GWT.log("setHeightToInternalScroll: "+height);
|
||||
int nh = getNewHeightForContainer(height);
|
||||
if(nh>0){
|
||||
Util.console("Set new height to center panel: "+nh);
|
||||
|
|
|
@ -216,57 +216,6 @@ 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 the Workspace Tree.
|
||||
*/
|
||||
|
@ -299,8 +248,8 @@ public class WorkspaceExplorer implements ShowableTypes, SelectableTypes, Folder
|
|||
|
||||
@Override
|
||||
public void onSuccess(Item item) {
|
||||
updateExplorer(item.getChildren());
|
||||
|
||||
updateExplorer(item.getChildren());
|
||||
setDisplayingFolderItem(item);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -40,6 +40,7 @@ import com.google.gwt.user.cellview.client.TextColumn;
|
|||
import com.google.gwt.user.client.ui.Image;
|
||||
import com.google.gwt.user.client.ui.Label;
|
||||
import com.google.gwt.view.client.AbstractDataProvider;
|
||||
import com.google.gwt.view.client.ListDataProvider;
|
||||
|
||||
/**
|
||||
* The Class PackagesTable.
|
||||
|
@ -85,10 +86,10 @@ public class ItemsTable<T extends Item> extends AbstractItemsCellTable<T> implem
|
|||
*/
|
||||
public ItemsTable(HandlerManager eventBus, boolean showMoreInfo, DISPLAY_FIELD[] fields, List<String> displayProperties, boolean showGcubeItemsInfo, DISPLAY_FIELD startSortByColumn) {
|
||||
this.eventBus = eventBus;
|
||||
this.startSortByColumn = startSortByColumn;
|
||||
setDisplayFields(fields);
|
||||
setDisplayProperties(displayProperties);
|
||||
setShowGcubeItemsInfo(showGcubeItemsInfo);
|
||||
this.startSortByColumn = startSortByColumn;
|
||||
//initTable(null, null);
|
||||
}
|
||||
|
||||
|
@ -130,7 +131,8 @@ public class ItemsTable<T extends Item> extends AbstractItemsCellTable<T> implem
|
|||
initAbstractTable(eventBus, fireEventOnClick, dataProvider, WorkspaceExplorerConstants.ITEMS_PER_PAGE);
|
||||
this.dataProvider.addDataDisplay(sortedCellTable);
|
||||
|
||||
this.isAsyncronusTable = dataProvider instanceof AbstractDataProvider?true:false;
|
||||
//this.isAsyncronusTable = dataProvider instanceof AbstractDataProvider?true:false;
|
||||
this.isAsyncronusTable = dataProvider instanceof ListDataProvider?false:true;
|
||||
|
||||
sortedCellTable.setEmptyTableWidget(new Label("No data."));
|
||||
|
||||
|
@ -260,6 +262,7 @@ public class ItemsTable<T extends Item> extends AbstractItemsCellTable<T> implem
|
|||
return -1;
|
||||
}
|
||||
};
|
||||
GWT.log("date colum sortable");
|
||||
sortedCellTable.setComparator(dateColumn,c);
|
||||
}
|
||||
|
||||
|
@ -357,6 +360,8 @@ public class ItemsTable<T extends Item> extends AbstractItemsCellTable<T> implem
|
|||
sortedCellTable.setColumnWidth(showGcubeInfoClm, 32.0, Unit.PX);
|
||||
}
|
||||
|
||||
GWT.log("startSortByColumn: "+startSortByColumn);
|
||||
|
||||
if(startSortByColumn!=null)
|
||||
switch (startSortByColumn) {
|
||||
case NAME:
|
||||
|
@ -373,6 +378,7 @@ public class ItemsTable<T extends Item> extends AbstractItemsCellTable<T> implem
|
|||
if(this.displayFields.contains(DISPLAY_FIELD.CREATION_DATE)){
|
||||
sortedCellTable.setDefaultSortOrder(dateColumn, false); // sorts ascending on first click
|
||||
sortedCellTable.setInitialSortColumn(dateColumn);
|
||||
GWT.log("sortedCellTable: "+sortedCellTable);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -234,6 +234,7 @@ public class SortedCellTable<T> extends CellTable<T> {
|
|||
new ColumnSortInfo(
|
||||
initialSortColumn,
|
||||
defaultSortOrderMap.get(initialSortColumn)));
|
||||
|
||||
currentlySortedColumn = initialSortColumn;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -107,8 +107,7 @@ public class WorkspaceExplorerServiceImpl extends RemoteServiceServlet implement
|
|||
|
||||
logger.trace("Returning:");
|
||||
Long endTime = System.currentTimeMillis() - startTime;
|
||||
String time = String.format("%d msc %d sec", endTime, TimeUnit.MILLISECONDS.toSeconds(endTime));
|
||||
logger.info("end time - " + time);
|
||||
logger.debug("end time - " + String.format("%d msc %d sec", endTime - startTime, TimeUnit.MILLISECONDS.toSeconds(endTime)));
|
||||
|
||||
Collections.sort(rootItem.getChildren(), new ItemComparator());
|
||||
logger.info("Returning children size: "+rootItem.getChildren().size());
|
||||
|
@ -145,13 +144,12 @@ public class WorkspaceExplorerServiceImpl extends RemoteServiceServlet implement
|
|||
itemFolder = ItemBuilder.purgeEmptyFolders(itemFolder);
|
||||
}
|
||||
|
||||
logger.trace("Returning:");
|
||||
Long endTime = System.currentTimeMillis() - startTime;
|
||||
String time = String.format("%d msc %d sec", endTime, TimeUnit.MILLISECONDS.toSeconds(endTime));
|
||||
logger.info("end time - " + time);
|
||||
|
||||
Collections.sort(itemFolder.getChildren(), new ItemComparator());
|
||||
|
||||
Long endTime = System.currentTimeMillis() - startTime;
|
||||
logger.debug("end time - " + String.format("%d msc %d sec", endTime - startTime, TimeUnit.MILLISECONDS.toSeconds(endTime)));
|
||||
logger.info("Returning children size: "+itemFolder.getChildren().size());
|
||||
|
||||
return itemFolder;
|
||||
|
||||
} catch (Exception e) {
|
||||
|
|
Loading…
Reference in New Issue