2518: Workspace Resources Explorer should visualise creation date
Task-Url: https://support.d4science.org/issues/2518 Added creation date item to Workspace Explorer Updated pom version at 1.2.0 git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/widgets/workspace-explorer@124950 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
01b8052aae
commit
ddc2ca678a
2
pom.xml
2
pom.xml
|
@ -10,7 +10,7 @@
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>org.gcube.portlets.widgets</groupId>
|
<groupId>org.gcube.portlets.widgets</groupId>
|
||||||
<artifactId>workspace-explorer</artifactId>
|
<artifactId>workspace-explorer</artifactId>
|
||||||
<version>1.1.1-SNAPSHOT</version>
|
<version>1.2.0-SNAPSHOT</version>
|
||||||
<name>gCube Workspace Explorer</name>
|
<name>gCube Workspace Explorer</name>
|
||||||
<description>
|
<description>
|
||||||
gCube Workspace Explorer widget allows to navigate (gcube) user workspace
|
gCube Workspace Explorer widget allows to navigate (gcube) user workspace
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
package org.gcube.portlets.widgets.wsexplorer.client.explore;
|
package org.gcube.portlets.widgets.wsexplorer.client.explore;
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ public class WorkspaceResourcesExplorerPanel extends DockPanel implements HasWor
|
||||||
private ScrollPanel southPanel = new ScrollPanel();
|
private ScrollPanel southPanel = new ScrollPanel();
|
||||||
private String folderId;
|
private String folderId;
|
||||||
private String folderName;
|
private String folderName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new workspace folder explorer select panel.
|
* Instantiates a new workspace folder explorer select panel.
|
||||||
*
|
*
|
||||||
|
@ -83,12 +83,12 @@ public class WorkspaceResourcesExplorerPanel extends DockPanel implements HasWor
|
||||||
this.folderId = folderId;
|
this.folderId = folderId;
|
||||||
this.folderName = folderName;
|
this.folderName = folderName;
|
||||||
bindEvents();
|
bindEvents();
|
||||||
wsExplorer = new WorkspaceExplorer(eventBus, showableTypes, selectableTypes, new DISPLAY_FIELD[]{DISPLAY_FIELD.ICON, DISPLAY_FIELD.NAME});
|
wsExplorer = new WorkspaceExplorer(eventBus, showableTypes, selectableTypes, new DISPLAY_FIELD[]{DISPLAY_FIELD.ICON, DISPLAY_FIELD.NAME, DISPLAY_FIELD.CREATION_DATE});
|
||||||
Item item = new Item(folderId, folderName, true);
|
Item item = new Item(folderId, folderName, true);
|
||||||
wsExplorer.loadFolder(item);
|
wsExplorer.loadFolder(item);
|
||||||
initPanel("");
|
initPanel("");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new workspace explorer select panel.
|
* Instantiates a new workspace explorer select panel.
|
||||||
*
|
*
|
||||||
|
@ -106,15 +106,15 @@ public class WorkspaceResourcesExplorerPanel extends DockPanel implements HasWor
|
||||||
initExplorer(folderId, "", ItemType.values(), ItemType.values());
|
initExplorer(folderId, "", ItemType.values(), ItemType.values());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Bind events.
|
* Bind events.
|
||||||
*/
|
*/
|
||||||
private void bindEvents(){
|
private void bindEvents(){
|
||||||
|
|
||||||
eventBus.addHandler(ClickItemEvent.TYPE, new ClickItemEventHandler() {
|
eventBus.addHandler(ClickItemEvent.TYPE, new ClickItemEventHandler() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(final ClickItemEvent clickItemEvent) {
|
public void onClick(final ClickItemEvent clickItemEvent) {
|
||||||
isSelect = false;
|
isSelect = false;
|
||||||
|
@ -125,17 +125,17 @@ public class WorkspaceResourcesExplorerPanel extends DockPanel implements HasWor
|
||||||
notifyNotValidSelection();
|
notifyNotValidSelection();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
notifySelectedItem(wsExplorer.getItemSelected());
|
notifySelectedItem(wsExplorer.getItemSelected());
|
||||||
isSelect = true;
|
isSelect = true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
eventBus.addHandler(LoadFolderEvent.TYPE, new LoadFolderEventHandler() {
|
eventBus.addHandler(LoadFolderEvent.TYPE, new LoadFolderEventHandler() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onLoadFolder(LoadFolderEvent loadFolderEvent) {
|
public void onLoadFolder(LoadFolderEvent loadFolderEvent) {
|
||||||
|
|
||||||
if(loadFolderEvent.getTargetItem()!=null && loadFolderEvent.getTargetItem().isFolder()){
|
if(loadFolderEvent.getTargetItem()!=null && loadFolderEvent.getTargetItem().isFolder()){
|
||||||
try {
|
try {
|
||||||
wsExplorer.loadFolder(loadFolderEvent.getTargetItem());
|
wsExplorer.loadFolder(loadFolderEvent.getTargetItem());
|
||||||
|
@ -147,16 +147,16 @@ public class WorkspaceResourcesExplorerPanel extends DockPanel implements HasWor
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
eventBus.addHandler(BreadcrumbClickEvent.TYPE, new BreadcrumbClickEventHandler() {
|
eventBus.addHandler(BreadcrumbClickEvent.TYPE, new BreadcrumbClickEventHandler() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBreadcrumbClick(BreadcrumbClickEvent breadcrumbClickEvent) {
|
public void onBreadcrumbClick(BreadcrumbClickEvent breadcrumbClickEvent) {
|
||||||
eventBus.fireEvent(new LoadFolderEvent(breadcrumbClickEvent.getTargetItem()));
|
eventBus.fireEvent(new LoadFolderEvent(breadcrumbClickEvent.getTargetItem()));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load parent breadcrumb by item id.
|
* Load parent breadcrumb by item id.
|
||||||
|
@ -185,7 +185,7 @@ public class WorkspaceResourcesExplorerPanel extends DockPanel implements HasWor
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Refresh root folder view.
|
* Refresh root folder view.
|
||||||
|
@ -194,14 +194,14 @@ public class WorkspaceResourcesExplorerPanel extends DockPanel implements HasWor
|
||||||
Item item = new Item(folderId, folderName, true);
|
Item item = new Item(folderId, folderName, true);
|
||||||
eventBus.fireEvent(new LoadFolderEvent(item));
|
eventBus.fireEvent(new LoadFolderEvent(item));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clear more info.
|
* Clear more info.
|
||||||
*/
|
*/
|
||||||
private void clearMoreInfo(){
|
private void clearMoreInfo(){
|
||||||
southPanel.clear();
|
southPanel.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Inits the panel.
|
* Inits the panel.
|
||||||
*
|
*
|
||||||
|
@ -211,20 +211,20 @@ public class WorkspaceResourcesExplorerPanel extends DockPanel implements HasWor
|
||||||
this.captionTxt = captionTxt;
|
this.captionTxt = captionTxt;
|
||||||
if(this.captionTxt!=null && !this.captionTxt.isEmpty())
|
if(this.captionTxt!=null && !this.captionTxt.isEmpty())
|
||||||
setTitle(this.captionTxt);
|
setTitle(this.captionTxt);
|
||||||
|
|
||||||
add(breadcrumbs, DockPanel.NORTH);
|
add(breadcrumbs, DockPanel.NORTH);
|
||||||
// centerScrollable.setSize(width+"px", height);
|
// centerScrollable.setSize(width+"px", height);
|
||||||
setAlertConfirm("", false, null);
|
setAlertConfirm("", false, null);
|
||||||
|
|
||||||
mainVP.add(wsExplorer.getPanel());
|
mainVP.add(wsExplorer.getPanel());
|
||||||
mainVP.add(footerHP);
|
mainVP.add(footerHP);
|
||||||
centerScrollable.add(mainVP);
|
centerScrollable.add(mainVP);
|
||||||
add(centerScrollable, DockPanel.CENTER);
|
add(centerScrollable, DockPanel.CENTER);
|
||||||
|
|
||||||
add(footerHP, DockPanel.SOUTH);
|
add(footerHP, DockPanel.SOUTH);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the alert confirm.
|
* Sets the alert confirm.
|
||||||
*
|
*
|
||||||
|
@ -238,17 +238,17 @@ public class WorkspaceResourcesExplorerPanel extends DockPanel implements HasWor
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
//silent
|
//silent
|
||||||
}
|
}
|
||||||
|
|
||||||
alertConfirm = new Alert();
|
alertConfirm = new Alert();
|
||||||
alertConfirm.setText(html);
|
alertConfirm.setText(html);
|
||||||
alertConfirm.setVisible(show);
|
alertConfirm.setVisible(show);
|
||||||
alertConfirm.setClose(true);
|
alertConfirm.setClose(true);
|
||||||
alertConfirm.setType(AlertType.INFO);
|
alertConfirm.setType(AlertType.INFO);
|
||||||
|
|
||||||
Button yes = new Button("Yes");
|
Button yes = new Button("Yes");
|
||||||
yes.setType(ButtonType.LINK);
|
yes.setType(ButtonType.LINK);
|
||||||
yes.addClickHandler(new ClickHandler() {
|
yes.addClickHandler(new ClickHandler() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(ClickEvent event) {
|
public void onClick(ClickEvent event) {
|
||||||
if(item!=null){
|
if(item!=null){
|
||||||
|
@ -257,11 +257,11 @@ public class WorkspaceResourcesExplorerPanel extends DockPanel implements HasWor
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Button no = new Button("No");
|
Button no = new Button("No");
|
||||||
no.setType(ButtonType.LINK);
|
no.setType(ButtonType.LINK);
|
||||||
no.addClickHandler(new ClickHandler() {
|
no.addClickHandler(new ClickHandler() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(ClickEvent event) {
|
public void onClick(ClickEvent event) {
|
||||||
alertConfirm.close();
|
alertConfirm.close();
|
||||||
|
@ -277,33 +277,33 @@ public class WorkspaceResourcesExplorerPanel extends DockPanel implements HasWor
|
||||||
* @param selected the selected
|
* @param selected the selected
|
||||||
*/
|
*/
|
||||||
private void notifySelectedItem(Item selected){
|
private void notifySelectedItem(Item selected){
|
||||||
|
|
||||||
for (WorskpaceExplorerSelectNotificationListener worskpaceExplorerNotificationListener : listeners) {
|
for (WorskpaceExplorerSelectNotificationListener worskpaceExplorerNotificationListener : listeners) {
|
||||||
worskpaceExplorerNotificationListener.onSelectedItem(selected);
|
worskpaceExplorerNotificationListener.onSelectedItem(selected);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Notify aborted.
|
* Notify aborted.
|
||||||
*/
|
*/
|
||||||
private void notifyAborted(){
|
private void notifyAborted(){
|
||||||
|
|
||||||
for (WorskpaceExplorerSelectNotificationListener worskpaceExplorerNotificationListener : listeners) {
|
for (WorskpaceExplorerSelectNotificationListener worskpaceExplorerNotificationListener : listeners) {
|
||||||
worskpaceExplorerNotificationListener.onAborted();
|
worskpaceExplorerNotificationListener.onAborted();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Notify not valid selection.
|
* Notify not valid selection.
|
||||||
*/
|
*/
|
||||||
private void notifyNotValidSelection(){
|
private void notifyNotValidSelection(){
|
||||||
|
|
||||||
for (WorskpaceExplorerSelectNotificationListener worskpaceExplorerNotificationListener : listeners) {
|
for (WorskpaceExplorerSelectNotificationListener worskpaceExplorerNotificationListener : listeners) {
|
||||||
worskpaceExplorerNotificationListener.onNotValidSelection();
|
worskpaceExplorerNotificationListener.onNotValidSelection();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Notify failed.
|
* Notify failed.
|
||||||
*
|
*
|
||||||
|
@ -311,12 +311,12 @@ public class WorkspaceResourcesExplorerPanel extends DockPanel implements HasWor
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
private void notifyFailed(Throwable t){
|
private void notifyFailed(Throwable t){
|
||||||
|
|
||||||
for (WorskpaceExplorerSelectNotificationListener worskpaceExplorerNotificationListener : listeners) {
|
for (WorskpaceExplorerSelectNotificationListener worskpaceExplorerNotificationListener : listeners) {
|
||||||
worskpaceExplorerNotificationListener.onFailed(t);
|
worskpaceExplorerNotificationListener.onFailed(t);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the caption txt.
|
* Gets the caption txt.
|
||||||
*
|
*
|
||||||
|
@ -334,7 +334,7 @@ public class WorkspaceResourcesExplorerPanel extends DockPanel implements HasWor
|
||||||
public boolean isValidHide() {
|
public boolean isValidHide() {
|
||||||
return isSelect;
|
return isSelect;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.gcube.portlets.widgets.wsexplorer.client.notification.WorskpaceExplorerNotification.HasWorskpaceExplorerNotificationListener#addWorkspaceExplorerNotificationListener(org.gcube.portlets.widgets.wsexplorer.client.notification.WorskpaceExplorerNotification.WorskpaceExplorerNotificationListener)
|
* @see org.gcube.portlets.widgets.wsexplorer.client.notification.WorskpaceExplorerNotification.HasWorskpaceExplorerNotificationListener#addWorkspaceExplorerNotificationListener(org.gcube.portlets.widgets.wsexplorer.client.notification.WorskpaceExplorerNotification.WorskpaceExplorerNotificationListener)
|
||||||
*/
|
*/
|
||||||
|
@ -354,7 +354,7 @@ public class WorkspaceResourcesExplorerPanel extends DockPanel implements HasWor
|
||||||
listeners.remove(handler);
|
listeners.remove(handler);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Item is selectable.
|
* Item is selectable.
|
||||||
*
|
*
|
||||||
|
@ -366,7 +366,7 @@ public class WorkspaceResourcesExplorerPanel extends DockPanel implements HasWor
|
||||||
GWT.log("item: "+item);
|
GWT.log("item: "+item);
|
||||||
if (item!=null){
|
if (item!=null){
|
||||||
boolean selectable = wsExplorer.getSelectableTypes().contains(item.getType());
|
boolean selectable = wsExplorer.getSelectableTypes().contains(item.getType());
|
||||||
return (selectable)?true:false;
|
return selectable?true:false;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -101,26 +101,6 @@ public abstract class AbstractItemsCellTable {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
DoubleClickEvent.getType());
|
DoubleClickEvent.getType());
|
||||||
/*
|
|
||||||
cellTable.addCellPreviewHandler(new CellPreviewEvent.Handler<Item> () {
|
|
||||||
long lastClick=-1000;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onCellPreview(CellPreviewEvent<Item> event) {
|
|
||||||
long clictAt = System.currentTimeMillis();
|
|
||||||
GWT.log("clickAt: "+(clictAt));
|
|
||||||
GWT.log("lastClick: "+(lastClick));
|
|
||||||
if(event.getNativeEvent().getType().contains("click")){
|
|
||||||
GWT.log(""+(clictAt-lastClick));
|
|
||||||
if(clictAt-lastClick < 300) { // dblclick on 2 clicks detected within 300 ms
|
|
||||||
Window.alert("I am a double click crafted event!");
|
|
||||||
}
|
|
||||||
lastClick = System.currentTimeMillis();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}); */
|
|
||||||
|
|
||||||
|
|
||||||
MenuBar options = new MenuBar(true);
|
MenuBar options = new MenuBar(true);
|
||||||
ScheduledCommand openCommand = new ScheduledCommand() {
|
ScheduledCommand openCommand = new ScheduledCommand() {
|
||||||
|
@ -187,12 +167,6 @@ public abstract class AbstractItemsCellTable {
|
||||||
cellTable.redraw();
|
cellTable.redraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*private void addItem(Item pckg) {
|
|
||||||
dataProvider.getList().add(pckg);
|
|
||||||
dataProvider.flush();
|
|
||||||
dataProvider.refresh();
|
|
||||||
}*/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the cell tables.
|
* Gets the cell tables.
|
||||||
*
|
*
|
||||||
|
|
|
@ -5,6 +5,7 @@ package org.gcube.portlets.widgets.wsexplorer.client.view.grid;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
@ -16,9 +17,11 @@ import org.gcube.portlets.widgets.wsexplorer.shared.Item;
|
||||||
import com.github.gwtbootstrap.client.ui.Pagination;
|
import com.github.gwtbootstrap.client.ui.Pagination;
|
||||||
import com.google.gwt.cell.client.ButtonCell;
|
import com.google.gwt.cell.client.ButtonCell;
|
||||||
import com.google.gwt.cell.client.Cell.Context;
|
import com.google.gwt.cell.client.Cell.Context;
|
||||||
|
import com.google.gwt.cell.client.DateCell;
|
||||||
import com.google.gwt.cell.client.ImageResourceCell;
|
import com.google.gwt.cell.client.ImageResourceCell;
|
||||||
import com.google.gwt.dom.client.Style.Unit;
|
import com.google.gwt.dom.client.Style.Unit;
|
||||||
import com.google.gwt.event.shared.HandlerManager;
|
import com.google.gwt.event.shared.HandlerManager;
|
||||||
|
import com.google.gwt.i18n.shared.DateTimeFormat;
|
||||||
import com.google.gwt.resources.client.ImageResource;
|
import com.google.gwt.resources.client.ImageResource;
|
||||||
import com.google.gwt.safehtml.shared.SafeHtml;
|
import com.google.gwt.safehtml.shared.SafeHtml;
|
||||||
import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
|
import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
|
||||||
|
@ -41,7 +44,8 @@ public class ItemsTable extends AbstractItemsCellTable implements SelectionItem{
|
||||||
private Column<Item, ImageResource> icon;
|
private Column<Item, ImageResource> icon;
|
||||||
private TextColumn<Item> name;
|
private TextColumn<Item> name;
|
||||||
private TextColumn<Item> owner;
|
private TextColumn<Item> owner;
|
||||||
private Item selectedItem = null;
|
public DateTimeFormat dtformat = DateTimeFormat.getFormat("dd MMM hh:mm aaa yyyy");
|
||||||
|
// private Item selectedItem = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Enum DISPLAY_FIELD.
|
* The Enum DISPLAY_FIELD.
|
||||||
|
@ -49,8 +53,9 @@ public class ItemsTable extends AbstractItemsCellTable implements SelectionItem{
|
||||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||||
* Feb 1, 2016
|
* Feb 1, 2016
|
||||||
*/
|
*/
|
||||||
public static enum DISPLAY_FIELD{ICON, NAME, OWNER};
|
public static enum DISPLAY_FIELD{ICON, NAME, OWNER, CREATION_DATE};
|
||||||
private List<DISPLAY_FIELD> displayFields;
|
private List<DISPLAY_FIELD> displayFields;
|
||||||
|
private Column<Item, Date> dateColumn;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new items table.
|
* Instantiates a new items table.
|
||||||
|
@ -92,19 +97,19 @@ public class ItemsTable extends AbstractItemsCellTable implements SelectionItem{
|
||||||
* @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)
|
* @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
|
@Override
|
||||||
public void initTable(final AbstractCellTable<Item> packageTable, final SimplePager pager, final Pagination pagination) {
|
public void initTable(final AbstractCellTable<Item> abstractCellTable, final SimplePager pager, final Pagination pagination) {
|
||||||
packageTable.setEmptyTableWidget(new Label("No data."));
|
abstractCellTable.setEmptyTableWidget(new Label("No data."));
|
||||||
|
|
||||||
//ICONS
|
|
||||||
ImageResourceCell iconResourceCell = new ImageResourceCell() {
|
|
||||||
public Set<String> getConsumedEvents() {
|
|
||||||
HashSet<String> events = new HashSet<String>();
|
|
||||||
events.add("click");
|
|
||||||
return events;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
if(this.displayFields.contains(DISPLAY_FIELD.ICON)){
|
if(this.displayFields.contains(DISPLAY_FIELD.ICON)){
|
||||||
|
//ICONS
|
||||||
|
ImageResourceCell iconResourceCell = new ImageResourceCell() {
|
||||||
|
public Set<String> getConsumedEvents() {
|
||||||
|
HashSet<String> events = new HashSet<String>();
|
||||||
|
events.add("click");
|
||||||
|
return events;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
icon = new Column<Item, ImageResource>(iconResourceCell) {
|
icon = new Column<Item, ImageResource>(iconResourceCell) {
|
||||||
@Override
|
@Override
|
||||||
public ImageResource getValue(Item dataObj) {
|
public ImageResource getValue(Item dataObj) {
|
||||||
|
@ -120,8 +125,8 @@ public class ItemsTable extends AbstractItemsCellTable implements SelectionItem{
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
icon.setSortable(false);
|
icon.setSortable(false);
|
||||||
packageTable.addColumn(icon, "");
|
abstractCellTable.addColumn(icon, "");
|
||||||
packageTable.setColumnWidth(icon, 10.0, Unit.PCT);
|
abstractCellTable.setColumnWidth(icon, 10.0, Unit.PCT);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this.displayFields.contains(DISPLAY_FIELD.NAME)){
|
if(this.displayFields.contains(DISPLAY_FIELD.NAME)){
|
||||||
|
@ -134,10 +139,10 @@ public class ItemsTable extends AbstractItemsCellTable implements SelectionItem{
|
||||||
};
|
};
|
||||||
name.setSortable(true);
|
name.setSortable(true);
|
||||||
|
|
||||||
packageTable.addColumn(name, "Name");
|
abstractCellTable.addColumn(name, "Name");
|
||||||
|
|
||||||
double width = displayFields.size()>1?50:90;
|
// double width = displayFields.size()>1?50:90;
|
||||||
packageTable.setColumnWidth(name, width, Unit.PCT);
|
// abstractCellTable.setColumnWidth(name, width, Unit.PCT);
|
||||||
|
|
||||||
ListHandler<Item> nameColumnHandler = new ListHandler<Item>(dataProvider.getList());
|
ListHandler<Item> nameColumnHandler = new ListHandler<Item>(dataProvider.getList());
|
||||||
nameColumnHandler.setComparator(name, new Comparator<Item>() {
|
nameColumnHandler.setComparator(name, new Comparator<Item>() {
|
||||||
|
@ -147,7 +152,7 @@ public class ItemsTable extends AbstractItemsCellTable implements SelectionItem{
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
packageTable.addColumnSortHandler(nameColumnHandler);
|
abstractCellTable.addColumnSortHandler(nameColumnHandler);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -161,9 +166,9 @@ public class ItemsTable extends AbstractItemsCellTable implements SelectionItem{
|
||||||
};
|
};
|
||||||
|
|
||||||
owner.setSortable(true);
|
owner.setSortable(true);
|
||||||
packageTable.addColumn(owner, "Owner");
|
abstractCellTable.addColumn(owner, "Owner");
|
||||||
double width = displayFields.size()==2 ?90:40;
|
// double width = displayFields.size()==2 ?90:40;
|
||||||
packageTable.setColumnWidth(owner, width, Unit.PCT);
|
// abstractCellTable.setColumnWidth(owner, width, Unit.PCT);
|
||||||
|
|
||||||
ListHandler<Item> ownerColumnHandler = new ListHandler<Item>(dataProvider.getList());
|
ListHandler<Item> ownerColumnHandler = new ListHandler<Item>(dataProvider.getList());
|
||||||
ownerColumnHandler.setComparator(owner, new Comparator<Item>() {
|
ownerColumnHandler.setComparator(owner, new Comparator<Item>() {
|
||||||
|
@ -172,10 +177,33 @@ public class ItemsTable extends AbstractItemsCellTable implements SelectionItem{
|
||||||
return o1.getOwner().compareTo(o2.getOwner());
|
return o1.getOwner().compareTo(o2.getOwner());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
packageTable.addColumnSortHandler(ownerColumnHandler);
|
abstractCellTable.addColumnSortHandler(ownerColumnHandler);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(this.displayFields.contains(DISPLAY_FIELD.CREATION_DATE)){
|
||||||
|
|
||||||
|
DateCell date = new DateCell(dtformat);
|
||||||
|
dateColumn = new Column<Item, Date>(date){
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Date getValue(Item object) {
|
||||||
|
return object.getCreationDate();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
dateColumn.setSortable(true);
|
||||||
|
ListHandler<Item> dateColumnHandler = new ListHandler<Item>(dataProvider.getList());
|
||||||
|
dateColumnHandler.setComparator(dateColumn, new Comparator<Item>() {
|
||||||
|
@Override
|
||||||
|
public int compare(Item o1, Item o2) {
|
||||||
|
return o1.getCreationDate().compareTo(o2.getCreationDate());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
abstractCellTable.addColumnSortHandler(dateColumnHandler);
|
||||||
|
abstractCellTable.addColumn(dateColumn, "Created");
|
||||||
|
}
|
||||||
|
|
||||||
/*final SingleSelectionModel<Item> selectionModel = new SingleSelectionModel<Item>();
|
/*final SingleSelectionModel<Item> selectionModel = new SingleSelectionModel<Item>();
|
||||||
selectionModel.addSelectionChangeHandler(new Handler() {
|
selectionModel.addSelectionChangeHandler(new Handler() {
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -3,6 +3,8 @@
|
||||||
*/
|
*/
|
||||||
package org.gcube.portlets.widgets.wsexplorer.server;
|
package org.gcube.portlets.widgets.wsexplorer.server;
|
||||||
|
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -116,7 +118,7 @@ public class ItemBuilder {
|
||||||
// if(workspaceItem instanceof FolderItem){
|
// if(workspaceItem instanceof FolderItem){
|
||||||
// storageID = workspaceItem.getStorageID();
|
// storageID = workspaceItem.getStorageID();
|
||||||
// }
|
// }
|
||||||
item = new Item(parent, workspaceItem.getId(), itemName, type, workspaceItemPath, UserUtil.getUserFullName(workspaceItem.getOwner().getPortalLogin()), isFolder, false);
|
item = new Item(parent, workspaceItem.getId(), itemName, type, workspaceItemPath, UserUtil.getUserFullName(workspaceItem.getOwner().getPortalLogin()), toDate(workspaceItem.getCreationTime()), isFolder, false);
|
||||||
item.setSharedFolder(isSharedFolder);
|
item.setSharedFolder(isSharedFolder);
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
_log.error("Error on getting item: "+itemName+" with id: "+workspaceItem.getId()+", from HL, so skipping item");
|
_log.error("Error on getting item: "+itemName+" with id: "+workspaceItem.getId()+", from HL, so skipping item");
|
||||||
|
@ -353,7 +355,7 @@ public class ItemBuilder {
|
||||||
|
|
||||||
//BUILDS A SIMPLE ITEM FOR BREADCRUMB
|
//BUILDS A SIMPLE ITEM FOR BREADCRUMB
|
||||||
String path = null; //wsFolder.getPath(); FORCED TO NULL BECAUSE IS SLOW CALL
|
String path = null; //wsFolder.getPath(); FORCED TO NULL BECAUSE IS SLOW CALL
|
||||||
Item item = new Item(null, wsFolder.getId(), name, ItemType.FOLDER, path, null, true, isRoot);
|
Item item = new Item(null, wsFolder.getId(), name, ItemType.FOLDER, path, null, null, true, isRoot);
|
||||||
item.setSpecialFolder(isSpecialFolder);
|
item.setSpecialFolder(isSpecialFolder);
|
||||||
|
|
||||||
_log.debug("breadcrumb returning: "+item);
|
_log.debug("breadcrumb returning: "+item);
|
||||||
|
@ -375,6 +377,20 @@ public class ItemBuilder {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* To date.
|
||||||
|
*
|
||||||
|
* @param calendar the calendar
|
||||||
|
* @return the date
|
||||||
|
*/
|
||||||
|
public static Date toDate(Calendar calendar)
|
||||||
|
{
|
||||||
|
if (calendar == null) return null;
|
||||||
|
return calendar.getTime();
|
||||||
|
|
||||||
|
}
|
||||||
/*
|
/*
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
List<String> allowedFileExtension = new ArrayList<String>();
|
List<String> allowedFileExtension = new ArrayList<String>();
|
||||||
|
|
|
@ -217,12 +217,12 @@ public class WorkspaceExplorerServiceImpl extends RemoteServiceServlet implement
|
||||||
}else if(fullName.indexOf(".")>0){
|
}else if(fullName.indexOf(".")>0){
|
||||||
fullName = fullName.substring(0, fullName.indexOf("."));
|
fullName = fullName.substring(0, fullName.indexOf("."));
|
||||||
}
|
}
|
||||||
item = new Item(null, root.getId(), fullName+"'s", ItemType.FOLDER, root.getPath(), root.getOwner().getPortalLogin(), true, true);
|
item = new Item(null, root.getId(), fullName+"'s", ItemType.FOLDER, root.getPath(), root.getOwner().getPortalLogin(), null, true, true);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case VRE_FOLDER:{
|
case VRE_FOLDER:{
|
||||||
WorkspaceItem folder = workspace.getMySpecialFolders();
|
WorkspaceItem folder = workspace.getMySpecialFolders();
|
||||||
item = new Item(null, folder.getId(), WorkspaceExplorerConstants.VRE_FOLDERS_LABEL, ItemType.FOLDER, folder.getPath(), folder.getOwner().getPortalLogin(), true, false);
|
item = new Item(null, folder.getId(), WorkspaceExplorerConstants.VRE_FOLDERS_LABEL, ItemType.FOLDER, folder.getPath(), folder.getOwner().getPortalLogin(), null, true, false);
|
||||||
//SET SPECIAL FOLDER /Workspace/MySpecialFolders
|
//SET SPECIAL FOLDER /Workspace/MySpecialFolders
|
||||||
item.setSpecialFolder(true);
|
item.setSpecialFolder(true);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
package org.gcube.portlets.widgets.wsexplorer.shared;
|
package org.gcube.portlets.widgets.wsexplorer.shared;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
import com.google.gwt.user.client.rpc.IsSerializable;
|
import com.google.gwt.user.client.rpc.IsSerializable;
|
||||||
|
|
||||||
|
@ -28,6 +29,7 @@ public class Item implements IsSerializable, ItemInterface{
|
||||||
private boolean isSpecialFolder = false;
|
private boolean isSpecialFolder = false;
|
||||||
private boolean isSharedFolder = false;
|
private boolean isSharedFolder = false;
|
||||||
private boolean isRoot = false;
|
private boolean isRoot = false;
|
||||||
|
private Date creationDate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new item.
|
* Instantiates a new item.
|
||||||
|
@ -56,16 +58,18 @@ public class Item implements IsSerializable, ItemInterface{
|
||||||
* @param type the type
|
* @param type the type
|
||||||
* @param path the path
|
* @param path the path
|
||||||
* @param owner the owner
|
* @param owner the owner
|
||||||
|
* @param creationDate the creation date
|
||||||
* @param isFolder the is folder
|
* @param isFolder the is folder
|
||||||
* @param isRoot the is root
|
* @param isRoot the is root
|
||||||
*/
|
*/
|
||||||
public Item(Item parent, String id, String name, ItemType type, String path, String owner, boolean isFolder, boolean isRoot) {
|
public Item(Item parent, String id, String name, ItemType type, String path, String owner, Date creationDate, boolean isFolder, boolean isRoot) {
|
||||||
this(id, name, isFolder);
|
this(id, name, isFolder);
|
||||||
this.parent = parent;
|
this.parent = parent;
|
||||||
this.type = type;
|
this.type = type;
|
||||||
this.path = path;
|
this.path = path;
|
||||||
this.children = new ArrayList<Item>();
|
this.children = new ArrayList<Item>();
|
||||||
this.owner = owner;
|
this.owner = owner;
|
||||||
|
this.creationDate = creationDate;
|
||||||
this.isRoot = isRoot;
|
this.isRoot = isRoot;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -302,6 +306,16 @@ public class Item implements IsSerializable, ItemInterface{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the creationDate
|
||||||
|
*/
|
||||||
|
public Date getCreationDate() {
|
||||||
|
|
||||||
|
return creationDate;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the parent.
|
* Sets the parent.
|
||||||
*
|
*
|
||||||
|
@ -318,7 +332,7 @@ public class Item implements IsSerializable, ItemInterface{
|
||||||
public String toString() {
|
public String toString() {
|
||||||
|
|
||||||
StringBuilder builder = new StringBuilder();
|
StringBuilder builder = new StringBuilder();
|
||||||
builder.append("Item id=");
|
builder.append("Item [id=");
|
||||||
builder.append(id);
|
builder.append(id);
|
||||||
builder.append(", name=");
|
builder.append(", name=");
|
||||||
builder.append(name);
|
builder.append(name);
|
||||||
|
@ -338,7 +352,10 @@ public class Item implements IsSerializable, ItemInterface{
|
||||||
builder.append(isSharedFolder);
|
builder.append(isSharedFolder);
|
||||||
builder.append(", isRoot=");
|
builder.append(", isRoot=");
|
||||||
builder.append(isRoot);
|
builder.append(isRoot);
|
||||||
|
builder.append(", creationDate=");
|
||||||
|
builder.append(creationDate);
|
||||||
builder.append("]");
|
builder.append("]");
|
||||||
return builder.toString();
|
return builder.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue