209: TDM - Show the resources through a ListView widget
Task-Url: https://support.d4science.org/issues/209 Added Status Bar git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-resources-widget@115485 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
88d3c8921a
commit
7869994995
|
@ -203,6 +203,7 @@ public class ResourcesListViewPanel extends FramedPanel {
|
|||
private MenuItem removeItem;
|
||||
private RemoveResourceSession removeResourceSession;
|
||||
private SaveResourceSession saveResourceSession;
|
||||
private ToolBar statusBar;
|
||||
|
||||
public ResourcesListViewPanel(EventBus eventBus) {
|
||||
super();
|
||||
|
@ -298,11 +299,11 @@ public class ResourcesListViewPanel extends FramedPanel {
|
|||
filterField.setWidth(100);
|
||||
filterField.bind(store);
|
||||
|
||||
ToolBar toolbar = new ToolBar();
|
||||
toolbar.add(new LabelToolItem("Filter:"));
|
||||
toolbar.add(filterField);
|
||||
toolbar.add(new SeparatorToolItem());
|
||||
toolbar.add(new LabelToolItem("Sort By:"));
|
||||
ToolBar toolBar = new ToolBar();
|
||||
toolBar.add(new LabelToolItem("Filter:"));
|
||||
toolBar.add(filterField);
|
||||
toolBar.add(new SeparatorToolItem());
|
||||
toolBar.add(new LabelToolItem("Sort By:"));
|
||||
|
||||
comboSort = new SimpleComboBox<String>(
|
||||
new StringLabelProvider<String>());
|
||||
|
@ -320,7 +321,10 @@ public class ResourcesListViewPanel extends FramedPanel {
|
|||
}
|
||||
|
||||
});
|
||||
toolbar.add(comboSort);
|
||||
toolBar.add(comboSort);
|
||||
|
||||
//
|
||||
statusBar = new ToolBar();
|
||||
|
||||
//
|
||||
ResourcesListViewBundle.INSTANCE.css().ensureInjected();
|
||||
|
@ -392,11 +396,13 @@ public class ResourcesListViewPanel extends FramedPanel {
|
|||
createContextMenu();
|
||||
|
||||
VerticalLayoutContainer main = new VerticalLayoutContainer();
|
||||
main.setScrollMode(ScrollMode.AUTO);
|
||||
main.setAdjustForScroll(false);
|
||||
main.setScrollMode(ScrollMode.NONE);
|
||||
// main.setAdjustForScroll(true);
|
||||
main.setBorders(true);
|
||||
main.add(toolbar, new VerticalLayoutData(1, -1));
|
||||
main.add(toolBar, new VerticalLayoutData(1, -1));
|
||||
main.add(listView, new VerticalLayoutData(1, 1));
|
||||
main.add(statusBar, new VerticalLayoutData(1, -1));
|
||||
|
||||
details = new ResourcesListViewDetailPanel(this);
|
||||
|
||||
|
@ -529,6 +535,18 @@ public class ResourcesListViewPanel extends FramedPanel {
|
|||
public void onSuccess(
|
||||
ArrayList<ResourceTDDescriptor> result) {
|
||||
Log.debug("Resources loaded " + result.size());
|
||||
if (result != null && result.size() > 0) {
|
||||
statusBar.clear();
|
||||
statusBar
|
||||
.add(new LabelToolItem(
|
||||
"Number of Resources: "
|
||||
+ result.size()));
|
||||
} else {
|
||||
statusBar.clear();
|
||||
statusBar.add(new LabelToolItem("No Resource"));
|
||||
|
||||
}
|
||||
statusBar.forceLayout();
|
||||
try {
|
||||
callback.onSuccess(result);
|
||||
} catch (Throwable e) {
|
||||
|
@ -908,18 +926,18 @@ public class ResourcesListViewPanel extends FramedPanel {
|
|||
ResourceTD resource = resourceTDDescriptor.getResourceTD();
|
||||
if (resource instanceof InternalURITD) {
|
||||
|
||||
|
||||
InternalURITD genericFileResourceTD = (InternalURITD) resource;
|
||||
String name = resourceTDDescriptor.getName();
|
||||
MimeTypeSupport mts=MimeTypeSupport.getMimeTypeSupportFromMimeName(genericFileResourceTD.getMimeType());
|
||||
MimeTypeSupport mts = MimeTypeSupport
|
||||
.getMimeTypeSupportFromMimeName(genericFileResourceTD
|
||||
.getMimeType());
|
||||
if (mts != null) {
|
||||
name = name + mts.getExtension();
|
||||
}
|
||||
|
||||
UriResolverSession uriResolverSession = new UriResolverSession(
|
||||
genericFileResourceTD.getId(), ApplicationType.SMP_ID,
|
||||
name,
|
||||
genericFileResourceTD.getMimeType());
|
||||
name, genericFileResourceTD.getMimeType());
|
||||
|
||||
TDGWTServiceAsync.INSTANCE.getUriFromResolver(uriResolverSession,
|
||||
new AsyncCallback<String>() {
|
||||
|
|
Loading…
Reference in New Issue