changed constructors

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/widgets/workspace-explorer@173260 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2018-10-12 08:20:31 +00:00
parent 7add6a9070
commit 21e2c587b9
3 changed files with 73 additions and 18 deletions

View File

@ -147,7 +147,7 @@ public class WorkspaceResourcesExplorerPanel extends DockPanel implements HasWor
itemsType[0] = ItemType.FOLDER;
itemsType[1] = ItemType.PRIVATE_FOLDER;
itemsType[2] = ItemType.SHARED_FOLDER;
itemsType[3] = ItemType.VRE_FOLDER;
itemsType[3] = ItemType.VRE_FOLDER;
initExplorer(folderId, "", itemsType, itemsType, null, null, false, null);
}else{
initExplorer(folderId, "", ItemType.values(), ItemType.values(), null, null, false, null);
@ -170,7 +170,7 @@ public class WorkspaceResourcesExplorerPanel extends DockPanel implements HasWor
itemsType[0] = ItemType.FOLDER;
itemsType[1] = ItemType.PRIVATE_FOLDER;
itemsType[2] = ItemType.SHARED_FOLDER;
itemsType[3] = ItemType.VRE_FOLDER;
itemsType[3] = ItemType.VRE_FOLDER;
initExplorer(folderId, "", itemsType, itemsType, showProperties, filter, false, null);
}else{
initExplorer(folderId, "", ItemType.values(), ItemType.values(), showProperties, filter, false, null);
@ -195,7 +195,7 @@ public class WorkspaceResourcesExplorerPanel extends DockPanel implements HasWor
itemsType[0] = ItemType.FOLDER;
itemsType[1] = ItemType.PRIVATE_FOLDER;
itemsType[2] = ItemType.SHARED_FOLDER;
itemsType[3] = ItemType.VRE_FOLDER;
itemsType[3] = ItemType.VRE_FOLDER;
initExplorer(folderId, "", itemsType, itemsType, showProperties, filter, showGcubeInfo, sortByColumn);
}else{
initExplorer(folderId, "", ItemType.values(), ItemType.values(), showProperties, filter, showGcubeInfo, sortByColumn);
@ -203,6 +203,33 @@ public class WorkspaceResourcesExplorerPanel extends DockPanel implements HasWor
}
/**
* Instantiates a new workspace explorer panel.
*
* @param folderId the folder id
* @param showOnlyFolders the show only folders
* @param showProperties the show properties - show the input properties as column/s
* @param filter the filter - get only workspace item/s with input key=value like GcubeProperty
* @param showGcubeInfo the show gcube info - if true shows all the properties associated to a file (or a gcube item) by opening a popup window when clicking on the item
* @param sortByColumn the sort by column
* @param displayFields the display fields
* @throws Exception the exception
*/
public WorkspaceResourcesExplorerPanel(String folderId, boolean showOnlyFolders, List<String> showProperties, FilterCriteria filter, boolean showGcubeInfo, DISPLAY_FIELD sortByColumn, DISPLAY_FIELD... displayFields) throws Exception {
if(showOnlyFolders){
ItemType[] itemsType = new ItemType[4];
itemsType[0] = ItemType.FOLDER;
itemsType[1] = ItemType.PRIVATE_FOLDER;
itemsType[2] = ItemType.SHARED_FOLDER;
itemsType[3] = ItemType.VRE_FOLDER;
initExplorer(folderId, "", itemsType, itemsType, showProperties, filter, showGcubeInfo, sortByColumn, displayFields);
}else{
initExplorer(folderId, "", ItemType.values(), ItemType.values(), showProperties, filter, showGcubeInfo, sortByColumn, displayFields);
}
}
/**
* Inits the explorer.
*
@ -214,13 +241,20 @@ public class WorkspaceResourcesExplorerPanel extends DockPanel implements HasWor
* @param filter the filter
* @param showGcubeInfo the show gcube info
* @param sortByColumn the sort by column
* @param displayFields the display fields
* @throws Exception the exception
*/
protected void initExplorer(String folderId, String folderName, ItemType[] selectableTypes, ItemType[] showableTypes, List<String> showProperties, FilterCriteria filter, boolean showGcubeInfo, DISPLAY_FIELD sortByColumn) throws Exception{
protected void initExplorer(String folderId, String folderName, ItemType[] selectableTypes, ItemType[] showableTypes, List<String> showProperties, FilterCriteria filter, boolean showGcubeInfo, DISPLAY_FIELD sortByColumn, DISPLAY_FIELD... displayFields) throws Exception{
GWT.log("Using base init");
setParameters(folderId, folderName, showProperties, filter);
bindEvents();
wsExplorer = new WorkspaceExplorer(eventBus, filter, showableTypes, selectableTypes, showProperties, showGcubeInfo, sortByColumn, new DISPLAY_FIELD[]{DISPLAY_FIELD.ICON, DISPLAY_FIELD.NAME,DISPLAY_FIELD.CREATION_DATE});
DISPLAY_FIELD[] showTheFields;
if(displayFields==null || displayFields.length==0)
showTheFields = new DISPLAY_FIELD[]{DISPLAY_FIELD.ICON, DISPLAY_FIELD.NAME,DISPLAY_FIELD.CREATION_DATE};
else
showTheFields = displayFields;
wsExplorer = new WorkspaceExplorer(eventBus, filter, showableTypes, selectableTypes, showProperties, showGcubeInfo, sortByColumn, showTheFields);
wsExplorer.initTable(new ListDataProvider<Item>());
Item item = new Item(folderId, folderName, true);
wsExplorer.loadFolder(item, true, -1, -1, false);

View File

@ -118,11 +118,11 @@ public class WorkspaceResourcesExplorerPanelPaginated extends WorkspaceResources
* @throws Exception the exception
*/
@Override
protected void initExplorer(String folderId, String folderName, ItemType[] selectableTypes, ItemType[] showableTypes, List<String> showProperties, FilterCriteria filter, boolean showGcubeInfo, DISPLAY_FIELD sortByColumn) throws Exception{
protected void initExplorer(String folderId, String folderName, ItemType[] selectableTypes, ItemType[] showableTypes, List<String> showProperties, FilterCriteria filter, boolean showGcubeInfo, DISPLAY_FIELD sortByColumn, DISPLAY_FIELD... displayFields) throws Exception{
GWT.log("Using paginated init");
setParameters(folderId, folderName, showProperties, filter);
bindEvents();
wsExplorerPaginated = new WorkspaceExplorerPaginated(eventBus, filter, showableTypes, selectableTypes, showProperties, showGcubeInfo, sortByColumn, new DISPLAY_FIELD[]{DISPLAY_FIELD.ICON, DISPLAY_FIELD.NAME, DISPLAY_FIELD.CREATION_DATE});
wsExplorerPaginated = new WorkspaceExplorerPaginated(eventBus, filter, showableTypes, selectableTypes, showProperties, showGcubeInfo, sortByColumn, displayFields);
wsExplorerPaginated.initPagination(ITEMS_PER_PAGE);
//wsExplorer.initTable(dataProvider);
Item item = new Item(folderId, folderName, true);

View File

@ -134,13 +134,34 @@ public class WorkspaceExplorerSelectPanel extends ScrollPanel implements HasWors
itemsType[1] = ItemType.PRIVATE_FOLDER;
itemsType[2] = ItemType.SHARED_FOLDER;
itemsType[3] = ItemType.VRE_FOLDER;
setSelectableTypes(itemsType);
setShowableTypes(itemsType);
}
loadExplorer(captionTxt, null);
}
/**
* Instantiates a new workspace explorer select panel.
*
* @param captionTxt the tool-tip of the panel
* @param showOnlyFolders the show only folders
* @param initFromFolderId the init from folder id
*/
public WorkspaceExplorerSelectPanel(String captionTxt, boolean showOnlyFolders, String baseFolderId) {
controller = new WorkspaceExplorerController(WorkspaceExplorerConstants.AUTO);
if(showOnlyFolders){
ItemType[] itemsType = new ItemType[4];
itemsType[0] = ItemType.FOLDER;
itemsType[1] = ItemType.PRIVATE_FOLDER;
itemsType[2] = ItemType.SHARED_FOLDER;
itemsType[3] = ItemType.VRE_FOLDER;
setSelectableTypes(itemsType);
setShowableTypes(itemsType);
}
loadExplorer(captionTxt, baseFolderId);
}
/**
* Instantiates a new workspace explorer select panel.
@ -447,7 +468,7 @@ public class WorkspaceExplorerSelectPanel extends ScrollPanel implements HasWors
ArrayList<ItemType> list = new ArrayList<>();
for (int i = 0; i < selectableTypes.length; i++) {
list.add(selectableTypes[i]);
}
}
GWT.log("setSelectableTypes for type " + list.toString());
controller.setSelectableTypes(getPatchedTypes(selectableTypes));
}
@ -455,12 +476,12 @@ public class WorkspaceExplorerSelectPanel extends ScrollPanel implements HasWors
private ItemType[] getPatchedTypes(ItemType[] selectableTypes) {
boolean ANY_FOLDER = false;
boolean ANY_FILE = false;
ArrayList<ItemType> list = new ArrayList<>();
for (int i = 0; i < selectableTypes.length; i++) {
list.add(selectableTypes[i]);
}
}
for (int i = 0; i < selectableTypes.length; i++) {
if (selectableTypes[i] == ItemType.FOLDER)
ANY_FOLDER = true;
@ -468,14 +489,14 @@ public class WorkspaceExplorerSelectPanel extends ScrollPanel implements HasWors
ANY_FILE = true;
}
}
for (int i = 0; i < selectableTypes.length; i++) {
list.add(selectableTypes[i]);
}
}
if (ANY_FOLDER) {
list.add(ItemType.PRIVATE_FOLDER);
list.add(ItemType.VRE_FOLDER);
list.add(ItemType.SHARED_FOLDER);
list.add(ItemType.SHARED_FOLDER);
}
if (ANY_FILE) {
ArrayList<ItemType> temp = new ArrayList<>();
@ -488,13 +509,13 @@ public class WorkspaceExplorerSelectPanel extends ScrollPanel implements HasWors
temp.remove(ItemType.SHARED_FOLDER);
temp.remove(ItemType.FOLDER);
for (ItemType itemType : temp) {
list.add(itemType);
list.add(itemType);
}
}
GWT.log("getPatchedTypes returns " + list.toString());
return list.toArray(new ItemType[list.size()]);
}
/**
* Gets the selectable types.
@ -521,7 +542,7 @@ public class WorkspaceExplorerSelectPanel extends ScrollPanel implements HasWors
ArrayList<ItemType> list = new ArrayList<>();
for (int i = 0; i < showableTypes.length; i++) {
list.add(showableTypes[i]);
}
}
GWT.log("setShowableTypes for type " + list.toString());
controller.setShowableTypes(getPatchedTypes(showableTypes));
}