added new constructor

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/widgets/workspace-explorer@173283 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2018-10-12 09:25:28 +00:00
parent 21e2c587b9
commit 791d78044c
2 changed files with 57 additions and 5 deletions

View File

@ -27,6 +27,7 @@ import org.gcube.portlets.widgets.wsexplorer.client.view.Breadcrumbs;
import org.gcube.portlets.widgets.wsexplorer.client.view.CreateFolderForm;
import org.gcube.portlets.widgets.wsexplorer.client.view.Navigation;
import org.gcube.portlets.widgets.wsexplorer.client.view.WorkspaceExplorer;
import org.gcube.portlets.widgets.wsexplorer.client.view.grid.ItemsTable.DISPLAY_FIELD;
import org.gcube.portlets.widgets.wsexplorer.shared.FilterCriteria;
import org.gcube.portlets.widgets.wsexplorer.shared.Item;
import org.gcube.portlets.widgets.wsexplorer.shared.ItemCategory;
@ -95,6 +96,28 @@ public class WorkspaceExplorerController implements EventHandler {
}
/**
* Instantiates a new workspace explorer controller.
*
* @param heightPanel the height panel
* @param filterCriteria the filter criteria
* @param showableTypes the showable types
* @param selectableTypes the selectable types
* @param displayProperties the display properties
* @param showGcubeInfo the show gcube info
* @param sortByColumn the sort by column
* @param fields the fields
*/
public WorkspaceExplorerController(String heightPanel, FilterCriteria filterCriteria, ItemType[] showableTypes, ItemType[] selectableTypes, List<String> displayProperties, boolean showGcubeInfo, DISPLAY_FIELD sortByColumn, DISPLAY_FIELD...fields) {
bindEvents();
//As default all items are showable and selectable
wsExplorer = new WorkspaceExplorer(eventBus, filterCriteria, showableTypes, selectableTypes, displayProperties, showGcubeInfo, sortByColumn, fields);
wsExplorer.initTable(new ListDataProvider<Item>());
initExplorerPanel(heightPanel);
}
/**
* Instantiates a new workspace explorer controller.
@ -298,6 +321,7 @@ public class WorkspaceExplorerController implements EventHandler {
* Load parent breadcrumb by item id.
*
* @param itemIdentifier the item identifier
* @param itemName the item name
* @param includeItemAsParent the include item as parent
*/
protected void loadParentBreadcrumbByItemId(final String itemIdentifier, String itemName, boolean includeItemAsParent){
@ -358,16 +382,16 @@ public class WorkspaceExplorerController implements EventHandler {
labelMime.getElement().getStyle().setMarginRight(marginValue, Unit.PX);
final Label labelACL = new Label("Rights: ");
labelACL.getElement().getStyle().setMarginRight(marginValue, Unit.PX);
hp.add(labelName);
hp.add(labelSize);
if(!item.isFolder())
hp.add(labelMime);
hp.add(labelACL);
final Button showIdButton = new Button("more");
showIdButton.setSize("50px", "22px");
showIdButton.addClickHandler(new ClickHandler() {
showIdButton.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
final Label labelitemId = new Label("Id: " + item.getId());
@ -375,9 +399,9 @@ public class WorkspaceExplorerController implements EventHandler {
labelitemId.getElement().getStyle().setMarginRight(marginValue, Unit.PX);
showIdButton.removeFromParent();
}
});
});
hp.add(showIdButton);
WorkspaceExplorerConstants.workspaceNavigatorService.getReadableSizeByItemId(item.getId(), new AsyncCallback<String>() {
@Override

View File

@ -12,6 +12,7 @@ import org.gcube.portlets.widgets.wsexplorer.client.event.LoadFolderEvent;
import org.gcube.portlets.widgets.wsexplorer.client.event.LoadRootEvent;
import org.gcube.portlets.widgets.wsexplorer.client.notification.WorkspaceExplorerSelectNotification.HasWorskpaceExplorerSelectNotificationListener;
import org.gcube.portlets.widgets.wsexplorer.client.notification.WorkspaceExplorerSelectNotification.WorskpaceExplorerSelectNotificationListener;
import org.gcube.portlets.widgets.wsexplorer.client.view.grid.ItemsTable.DISPLAY_FIELD;
import org.gcube.portlets.widgets.wsexplorer.shared.FilterCriteria;
import org.gcube.portlets.widgets.wsexplorer.shared.Item;
import org.gcube.portlets.widgets.wsexplorer.shared.ItemType;
@ -157,6 +158,33 @@ public class WorkspaceExplorerSelectDialog extends Modal implements HasWorskpace
}
/**
* Instantiates a new workspace explorer select dialog.
*
* @param captionTxt the caption txt
* @param showOnlyFolders the show only folders
* @param baseFolderId the base folder id
* @param baseFolderName the base folder name
* @param displayFields the display fields
*/
public WorkspaceExplorerSelectDialog(String captionTxt, boolean showOnlyFolders, String baseFolderId, String baseFolderName, DISPLAY_FIELD... displayFields) {
controller = new WorkspaceExplorerController(WorkspaceExplorerConstants.HEIGHT_EXPLORER_PANEL, null, null, null, null, false, null, displayFields);
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, baseFolderName);
}
/**
* Instantiates a new workspace explorer select dialog.
*