256: Workspace explorer
Task-Url: https://support.d4science.org/issues/256 Enhancements git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/widgets/workspace-explorer@117008 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
f5933696b7
commit
706f53b60f
|
@ -11,6 +11,8 @@ import org.gcube.portlets.widgets.wsexplorer.client.event.LoadMySpecialFolderEve
|
||||||
import org.gcube.portlets.widgets.wsexplorer.client.event.LoadMySpecialFolderEventHandler;
|
import org.gcube.portlets.widgets.wsexplorer.client.event.LoadMySpecialFolderEventHandler;
|
||||||
import org.gcube.portlets.widgets.wsexplorer.client.event.LoadRootEvent;
|
import org.gcube.portlets.widgets.wsexplorer.client.event.LoadRootEvent;
|
||||||
import org.gcube.portlets.widgets.wsexplorer.client.event.LoadRootEventHandler;
|
import org.gcube.portlets.widgets.wsexplorer.client.event.LoadRootEventHandler;
|
||||||
|
import org.gcube.portlets.widgets.wsexplorer.client.event.MoreInfoShowEvent;
|
||||||
|
import org.gcube.portlets.widgets.wsexplorer.client.event.MoreInfoShowEventHandler;
|
||||||
import org.gcube.portlets.widgets.wsexplorer.client.rpc.WorkspaceExplorerService;
|
import org.gcube.portlets.widgets.wsexplorer.client.rpc.WorkspaceExplorerService;
|
||||||
import org.gcube.portlets.widgets.wsexplorer.client.rpc.WorkspaceExplorerServiceAsync;
|
import org.gcube.portlets.widgets.wsexplorer.client.rpc.WorkspaceExplorerServiceAsync;
|
||||||
import org.gcube.portlets.widgets.wsexplorer.client.view.Breadcrumbs;
|
import org.gcube.portlets.widgets.wsexplorer.client.view.Breadcrumbs;
|
||||||
|
@ -20,6 +22,7 @@ import org.gcube.portlets.widgets.wsexplorer.shared.Item;
|
||||||
import org.gcube.portlets.widgets.wsexplorer.shared.ItemCategory;
|
import org.gcube.portlets.widgets.wsexplorer.shared.ItemCategory;
|
||||||
import org.gcube.portlets.widgets.wsexplorer.shared.ItemType;
|
import org.gcube.portlets.widgets.wsexplorer.shared.ItemType;
|
||||||
|
|
||||||
|
import com.github.gwtbootstrap.client.ui.Alert;
|
||||||
import com.github.gwtbootstrap.client.ui.constants.AlertType;
|
import com.github.gwtbootstrap.client.ui.constants.AlertType;
|
||||||
import com.google.gwt.core.client.GWT;
|
import com.google.gwt.core.client.GWT;
|
||||||
import com.google.gwt.event.shared.EventHandler;
|
import com.google.gwt.event.shared.EventHandler;
|
||||||
|
@ -97,6 +100,25 @@ public class WorkspaceExplorerController implements EventHandler {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
eventBus.addHandler(MoreInfoShowEvent.TYPE, new MoreInfoShowEventHandler() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onMoreInfo(MoreInfoShowEvent moreInfoShowEvent) {
|
||||||
|
|
||||||
|
if(moreInfoShowEvent.getItem()!=null){
|
||||||
|
workspaceExplorerPanel.getSouthPanel().clear();
|
||||||
|
Alert alert = new Alert();
|
||||||
|
alert.setText(moreInfoShowEvent.getItem().toString());
|
||||||
|
alert.setType(AlertType.INFO);
|
||||||
|
alert.setClose(true);
|
||||||
|
workspaceExplorerPanel.getSouthPanel().add(alert);
|
||||||
|
// GWT.log("onMoreInfo");
|
||||||
|
// setupPopover(navigation.getMoreInfoPanel(), moreInfoShowEvent.getItem().getName(), "Info "+moreInfoShowEvent.getItem().getName()).show();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
eventBus.addHandler(LoadMySpecialFolderEvent.TYPE, new LoadMySpecialFolderEventHandler() {
|
eventBus.addHandler(LoadMySpecialFolderEvent.TYPE, new LoadMySpecialFolderEventHandler() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -22,6 +22,7 @@ public class WorkspaceExplorerPanel extends DockPanel{
|
||||||
|
|
||||||
private ScrollPanel westPanel = new ScrollPanel();
|
private ScrollPanel westPanel = new ScrollPanel();
|
||||||
private ScrollPanel centerScrollable = new ScrollPanel();
|
private ScrollPanel centerScrollable = new ScrollPanel();
|
||||||
|
private ScrollPanel southPanel = new ScrollPanel();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new workspace explorer panel.
|
* Instantiates a new workspace explorer panel.
|
||||||
|
@ -38,16 +39,25 @@ public class WorkspaceExplorerPanel extends DockPanel{
|
||||||
// setHorizontalAlignment(DockPanel.ALIGN_CENTER);
|
// setHorizontalAlignment(DockPanel.ALIGN_CENTER);
|
||||||
|
|
||||||
add(breadcrumbs, DockPanel.NORTH);
|
add(breadcrumbs, DockPanel.NORTH);
|
||||||
// northPanel.add(breadcrumbs);
|
southPanel.ensureDebugId("SouthPanelWEP");
|
||||||
|
add(southPanel, DockPanel.SOUTH);
|
||||||
|
|
||||||
westPanel.setWidth(west_width+"px");
|
westPanel.setWidth(west_width+"px");
|
||||||
westPanel.add(navigation);
|
westPanel.add(navigation);
|
||||||
add(westPanel, DockPanel.WEST);
|
add(westPanel, DockPanel.WEST);
|
||||||
|
|
||||||
centerScrollable.setSize(width+"px", height+"px");
|
centerScrollable.setSize(width+"px", height+"px");
|
||||||
centerScrollable.add(wsExplorer);
|
centerScrollable.add(wsExplorer);
|
||||||
add(centerScrollable, DockPanel.CENTER);
|
add(centerScrollable, DockPanel.CENTER);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the southPanel
|
||||||
|
*/
|
||||||
|
public ScrollPanel getSouthPanel() {
|
||||||
|
return southPanel;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the west panel.
|
* Gets the west panel.
|
||||||
*
|
*
|
||||||
|
|
|
@ -0,0 +1,48 @@
|
||||||
|
package org.gcube.portlets.widgets.wsexplorer.client.event;
|
||||||
|
|
||||||
|
import org.gcube.portlets.widgets.wsexplorer.shared.Item;
|
||||||
|
|
||||||
|
import com.google.gwt.event.shared.GwtEvent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Class DisplaySelectedReleaseEvent.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||||
|
* Feb 19, 2015
|
||||||
|
*/
|
||||||
|
public class MoreInfoShowEvent extends GwtEvent<MoreInfoShowEventHandler> {
|
||||||
|
public static Type<MoreInfoShowEventHandler> TYPE = new Type<MoreInfoShowEventHandler>();
|
||||||
|
private Item item;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new display selected release event.
|
||||||
|
*
|
||||||
|
* @param release the release
|
||||||
|
*/
|
||||||
|
public MoreInfoShowEvent(Item item) {
|
||||||
|
this.item = item;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see com.google.gwt.event.shared.GwtEvent#getAssociatedType()
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Type<MoreInfoShowEventHandler> getAssociatedType() {
|
||||||
|
return TYPE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see com.google.gwt.event.shared.GwtEvent#dispatch(com.google.gwt.event.shared.EventHandler)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
protected void dispatch(MoreInfoShowEventHandler handler) {
|
||||||
|
handler.onMoreInfo(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the item
|
||||||
|
*/
|
||||||
|
public Item getItem() {
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
package org.gcube.portlets.widgets.wsexplorer.client.event;
|
||||||
|
|
||||||
|
import com.google.gwt.event.shared.EventHandler;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Interface DisplaySelectedReleaseEventHandler.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||||
|
* Feb 19, 2015
|
||||||
|
*/
|
||||||
|
public interface MoreInfoShowEventHandler extends EventHandler {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param moreInfoShowEvent
|
||||||
|
*/
|
||||||
|
void onMoreInfo(MoreInfoShowEvent moreInfoShowEvent);
|
||||||
|
}
|
|
@ -31,5 +31,8 @@ public interface WorkspaceExplorerIcons extends ClientBundle {
|
||||||
|
|
||||||
@Source("home.png")
|
@Source("home.png")
|
||||||
ImageResource home();
|
ImageResource home();
|
||||||
|
|
||||||
|
@Source("info.png")
|
||||||
|
ImageResource info();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,11 @@ public class WorkspaceExplorerResources {
|
||||||
return AbstractImagePrototype.create(ICONS.loading());
|
return AbstractImagePrototype.create(ICONS.loading());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static AbstractImagePrototype getIconInfo() {
|
||||||
|
|
||||||
|
return AbstractImagePrototype.create(ICONS.info());
|
||||||
|
}
|
||||||
|
|
||||||
/** My custom base icon collection */
|
/** My custom base icon collection */
|
||||||
public enum CustomIconType implements BaseIconType {
|
public enum CustomIconType implements BaseIconType {
|
||||||
|
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 260 B |
|
@ -0,0 +1,321 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.gcube.portlets.widgets.wsexplorer.client.save;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.gcube.portlets.widgets.wsexplorer.client.WorkspaceExplorerConstants;
|
||||||
|
import org.gcube.portlets.widgets.wsexplorer.client.WorkspaceExplorerController;
|
||||||
|
import org.gcube.portlets.widgets.wsexplorer.client.event.LoadRootEvent;
|
||||||
|
import org.gcube.portlets.widgets.wsexplorer.client.notification.WorskpaceExplorerNotification.HasWorskpaceExplorerNotificationListener;
|
||||||
|
import org.gcube.portlets.widgets.wsexplorer.client.notification.WorskpaceExplorerNotification.WorskpaceExplorerNotificationListener;
|
||||||
|
import org.gcube.portlets.widgets.wsexplorer.shared.Item;
|
||||||
|
import org.gcube.portlets.widgets.wsexplorer.shared.ItemType;
|
||||||
|
|
||||||
|
import com.github.gwtbootstrap.client.ui.Alert;
|
||||||
|
import com.github.gwtbootstrap.client.ui.Button;
|
||||||
|
import com.github.gwtbootstrap.client.ui.Modal;
|
||||||
|
import com.github.gwtbootstrap.client.ui.ModalFooter;
|
||||||
|
import com.github.gwtbootstrap.client.ui.constants.AlertType;
|
||||||
|
import com.github.gwtbootstrap.client.ui.constants.ButtonType;
|
||||||
|
import com.github.gwtbootstrap.client.ui.event.HideEvent;
|
||||||
|
import com.github.gwtbootstrap.client.ui.event.HideHandler;
|
||||||
|
import com.google.gwt.event.dom.client.ClickEvent;
|
||||||
|
import com.google.gwt.event.dom.client.ClickHandler;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Class WorkspaceExplorerLoadDialog.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||||
|
* Jun 30, 2015
|
||||||
|
*/
|
||||||
|
public class WorkspaceExplorerSaveDialog extends Modal implements HasWorskpaceExplorerNotificationListener{
|
||||||
|
|
||||||
|
public static final String SELECT = "Select";
|
||||||
|
public static final String MAX_HEIGHT_DIALOG = "500px";
|
||||||
|
public static final int WIDHT_DIALOG = 720;
|
||||||
|
|
||||||
|
private Button selectButton;
|
||||||
|
private WorkspaceExplorerSaveDialog INSTANCE = this;
|
||||||
|
private boolean isSelect = false;
|
||||||
|
private String captionTxt;
|
||||||
|
private ModalFooter footer = new ModalFooter();
|
||||||
|
private Alert alertConfirm;
|
||||||
|
private WorkspaceExplorerController controller = new WorkspaceExplorerController();
|
||||||
|
private List<WorskpaceExplorerNotificationListener> listeners = new ArrayList<WorskpaceExplorerNotificationListener>();
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new workspace explorer load dialog.
|
||||||
|
*
|
||||||
|
* @param captionTxt the caption txt
|
||||||
|
* You can implement {@link WorskpaceExplorerNotificationListener} to receive events
|
||||||
|
*/
|
||||||
|
public WorkspaceExplorerSaveDialog(String captionTxt) {
|
||||||
|
WorkspaceExplorerController.eventBus.fireEvent(new LoadRootEvent());
|
||||||
|
initDialog(captionTxt);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new workspace explorer load dialog.
|
||||||
|
*
|
||||||
|
* @param captionTxt the caption txt
|
||||||
|
* @param showOnlyFolders the show only folders
|
||||||
|
*/
|
||||||
|
public WorkspaceExplorerSaveDialog(String captionTxt, boolean showOnlyFolders) {
|
||||||
|
|
||||||
|
if(showOnlyFolders){
|
||||||
|
ItemType[] itemsType = new ItemType[2];
|
||||||
|
itemsType[0] = ItemType.ROOT;
|
||||||
|
itemsType[1] = ItemType.FOLDER;
|
||||||
|
setSelectableTypes(itemsType);
|
||||||
|
setShowableTypes(itemsType);
|
||||||
|
}
|
||||||
|
|
||||||
|
WorkspaceExplorerController.eventBus.fireEvent(new LoadRootEvent());
|
||||||
|
initDialog(captionTxt);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new workspace explorer save dialog.
|
||||||
|
*
|
||||||
|
* @param captionTxt captionTxt sets the text inside the caption, if null sets "Workspace Explorer"
|
||||||
|
* @param selectableTypes the selectable types
|
||||||
|
* @param showableTypes the showable types
|
||||||
|
*
|
||||||
|
* You can implement {@link WorskpaceExplorerNotificationListener} to receive events
|
||||||
|
*/
|
||||||
|
public WorkspaceExplorerSaveDialog(String captionTxt, List<ItemType> selectableTypes, List<ItemType> showableTypes) {
|
||||||
|
if(selectableTypes!=null){
|
||||||
|
ItemType[] itemsType = new ItemType[selectableTypes.size()];
|
||||||
|
itemsType = selectableTypes.toArray(itemsType);
|
||||||
|
setSelectableTypes(selectableTypes.toArray(itemsType));
|
||||||
|
}
|
||||||
|
|
||||||
|
if(showableTypes!=null){
|
||||||
|
ItemType[] itemsType = new ItemType[showableTypes.size()];
|
||||||
|
itemsType = showableTypes.toArray(itemsType);
|
||||||
|
setShowableTypes(showableTypes.toArray(itemsType));
|
||||||
|
}
|
||||||
|
|
||||||
|
WorkspaceExplorerController.eventBus.fireEvent(new LoadRootEvent());
|
||||||
|
initDialog(captionTxt);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Inits the dialog.
|
||||||
|
*
|
||||||
|
* @param captionTxt the caption txt
|
||||||
|
*/
|
||||||
|
private void initDialog(String captionTxt) {
|
||||||
|
this.captionTxt = (captionTxt==null || captionTxt.isEmpty())?WorkspaceExplorerConstants.WORKSPACE_EXPLORER_CAPTION:captionTxt;
|
||||||
|
setAnimation(false);
|
||||||
|
setCloseVisible(true);
|
||||||
|
setTitle(this.captionTxt);
|
||||||
|
selectButton = new Button(SELECT);
|
||||||
|
selectButton.setType(ButtonType.PRIMARY);
|
||||||
|
setWidth(WIDHT_DIALOG);
|
||||||
|
setMaxHeigth(MAX_HEIGHT_DIALOG);
|
||||||
|
hide(false);
|
||||||
|
|
||||||
|
addHideHandler(new HideHandler() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onHide(HideEvent hideEvent) {
|
||||||
|
if(!isSelect)
|
||||||
|
notifyAborted();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
add(controller.getWorkspaceExplorerPanel());
|
||||||
|
selectButton.addClickHandler(new ClickHandler() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(ClickEvent event) {
|
||||||
|
isSelect = false;
|
||||||
|
Item item = controller.getWsExplorer().getItemSelected();
|
||||||
|
if(item!=null){
|
||||||
|
isSelect = true;
|
||||||
|
INSTANCE.hide();
|
||||||
|
notifySelectedItem(item);
|
||||||
|
}else if(!controller.getWsExplorer().itemIsSelectable()){ //IGNORING ITEMS NOT SELECTABLE, USING BREADCRUMBS
|
||||||
|
Item itemB = controller.getBreadcrumbs().getLastParent();
|
||||||
|
if(itemB!=null){
|
||||||
|
setAlertConfirm("Selecting \""+itemB.getName()+"\", confirm?", true, itemB);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
setAlertConfirm("", false, null);
|
||||||
|
footer.add(selectButton);
|
||||||
|
add(footer);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the alert confirm.
|
||||||
|
*
|
||||||
|
* @param html the html
|
||||||
|
* @param bool the bool
|
||||||
|
*/
|
||||||
|
private void setAlertConfirm(String html, boolean show, final Item item){
|
||||||
|
try{
|
||||||
|
footer.remove(alertConfirm);
|
||||||
|
}catch(Exception e){
|
||||||
|
//silent
|
||||||
|
}
|
||||||
|
|
||||||
|
alertConfirm = new Alert();
|
||||||
|
alertConfirm.setText(html);
|
||||||
|
alertConfirm.setVisible(show);
|
||||||
|
alertConfirm.setClose(true);
|
||||||
|
alertConfirm.setType(AlertType.INFO);
|
||||||
|
|
||||||
|
Button yes = new Button("Yes");
|
||||||
|
yes.setType(ButtonType.LINK);
|
||||||
|
yes.addClickHandler(new ClickHandler() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(ClickEvent event) {
|
||||||
|
if(item!=null){
|
||||||
|
isSelect = true;
|
||||||
|
INSTANCE.hide();
|
||||||
|
notifySelectedItem(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Button no = new Button("No");
|
||||||
|
no.setType(ButtonType.LINK);
|
||||||
|
no.addClickHandler(new ClickHandler() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(ClickEvent event) {
|
||||||
|
alertConfirm.close();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
alertConfirm.add(yes);
|
||||||
|
alertConfirm.add(no);
|
||||||
|
footer.insert(alertConfirm,0);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Notify selected item.
|
||||||
|
*
|
||||||
|
* @param selected the selected
|
||||||
|
*/
|
||||||
|
private void notifySelectedItem(Item selected){
|
||||||
|
|
||||||
|
for (WorskpaceExplorerNotificationListener worskpaceExplorerNotificationListener : listeners) {
|
||||||
|
worskpaceExplorerNotificationListener.onSelectedItem(selected);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notify aborted.
|
||||||
|
*/
|
||||||
|
private void notifyAborted(){
|
||||||
|
|
||||||
|
for (WorskpaceExplorerNotificationListener worskpaceExplorerNotificationListener : listeners) {
|
||||||
|
worskpaceExplorerNotificationListener.onAborted();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notify failed.
|
||||||
|
*
|
||||||
|
* @param t the t
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
private void notifyFailed(Throwable t){
|
||||||
|
|
||||||
|
for (WorskpaceExplorerNotificationListener worskpaceExplorerNotificationListener : listeners) {
|
||||||
|
worskpaceExplorerNotificationListener.onFailed(t);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the caption txt.
|
||||||
|
*
|
||||||
|
* @return the captionTxt
|
||||||
|
*/
|
||||||
|
public String getCaptionTxt() {
|
||||||
|
return captionTxt;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if is valid hide.
|
||||||
|
*
|
||||||
|
* @return the isValidHide
|
||||||
|
*/
|
||||||
|
public boolean isValidHide() {
|
||||||
|
return isSelect;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see com.github.gwtbootstrap.client.ui.Modal#show()
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void show() {
|
||||||
|
super.show();
|
||||||
|
isSelect = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.gcube.portlets.widgets.wsexplorer.client.notification.WorskpaceExplorerNotification.HasWorskpaceExplorerNotificationListener#addWorkspaceExplorerNotificationListener(org.gcube.portlets.widgets.wsexplorer.client.notification.WorskpaceExplorerNotification.WorskpaceExplorerNotificationListener)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void addWorkspaceExplorerNotificationListener(WorskpaceExplorerNotificationListener handler) {
|
||||||
|
if(handler!=null)
|
||||||
|
listeners.add(handler);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.gcube.portlets.widgets.wsexplorer.client.notification.WorskpaceExplorerNotification.HasWorskpaceExplorerNotificationListener#removeWorkspaceExplorerNotificationListener(org.gcube.portlets.widgets.wsexplorer.client.notification.WorskpaceExplorerNotification.WorskpaceExplorerNotificationListener)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void removeWorkspaceExplorerNotificationListener(WorskpaceExplorerNotificationListener handler) {
|
||||||
|
if(handler!=null){
|
||||||
|
if(listeners.contains(handler))
|
||||||
|
listeners.remove(handler);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set which items are selectable.
|
||||||
|
* @param selectableTypes the selectableTypes to set
|
||||||
|
*/
|
||||||
|
private void setSelectableTypes(ItemType ... selectableTypes) {
|
||||||
|
controller.setSelectableTypes(selectableTypes);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the selectable types.
|
||||||
|
*
|
||||||
|
* @return the selectable types
|
||||||
|
*/
|
||||||
|
public List<ItemType> getSelectableTypes() {
|
||||||
|
return controller.getSelectableTypes();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the showable items.
|
||||||
|
* @return the showableTypes
|
||||||
|
*/
|
||||||
|
public List<ItemType> getShowableTypes() {
|
||||||
|
return controller.getShowableTypes();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the showable items. The folders items are show as default.
|
||||||
|
* @param showableTypes the showableTypes to set
|
||||||
|
*/
|
||||||
|
private void setShowableTypes(ItemType ... showableTypes) {
|
||||||
|
controller.setShowableTypes(showableTypes);
|
||||||
|
}
|
||||||
|
}
|
|
@ -22,7 +22,6 @@ import com.github.gwtbootstrap.client.ui.constants.AlertType;
|
||||||
import com.github.gwtbootstrap.client.ui.constants.ButtonType;
|
import com.github.gwtbootstrap.client.ui.constants.ButtonType;
|
||||||
import com.github.gwtbootstrap.client.ui.event.HideEvent;
|
import com.github.gwtbootstrap.client.ui.event.HideEvent;
|
||||||
import com.github.gwtbootstrap.client.ui.event.HideHandler;
|
import com.github.gwtbootstrap.client.ui.event.HideHandler;
|
||||||
import com.google.gwt.dom.client.Style.Unit;
|
|
||||||
import com.google.gwt.event.dom.client.ClickEvent;
|
import com.google.gwt.event.dom.client.ClickEvent;
|
||||||
import com.google.gwt.event.dom.client.ClickHandler;
|
import com.google.gwt.event.dom.client.ClickHandler;
|
||||||
|
|
||||||
|
@ -50,7 +49,7 @@ public class WorkspaceExplorerSelectDialog extends Modal implements HasWorskpace
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new workspace explorer load dialog.
|
* Instantiates a new workspace explorer select dialog.
|
||||||
*
|
*
|
||||||
* @param captionTxt the caption txt
|
* @param captionTxt the caption txt
|
||||||
* You can implement {@link WorskpaceExplorerNotificationListener} to receive events
|
* You can implement {@link WorskpaceExplorerNotificationListener} to receive events
|
||||||
|
@ -61,7 +60,7 @@ public class WorkspaceExplorerSelectDialog extends Modal implements HasWorskpace
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new workspace explorer load dialog.
|
* Instantiates a new workspace explorer select dialog.
|
||||||
*
|
*
|
||||||
* @param captionTxt the caption txt
|
* @param captionTxt the caption txt
|
||||||
* @param showOnlyFolders the show only folders
|
* @param showOnlyFolders the show only folders
|
||||||
|
@ -81,7 +80,7 @@ public class WorkspaceExplorerSelectDialog extends Modal implements HasWorskpace
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new workspace explorer load dialog.
|
* Instantiates a new workspace explorer select dialog.
|
||||||
*
|
*
|
||||||
* @param captionTxt captionTxt sets the text inside the caption, if null sets "Workspace Explorer"
|
* @param captionTxt captionTxt sets the text inside the caption, if null sets "Workspace Explorer"
|
||||||
* @param selectableTypes the selectable types
|
* @param selectableTypes the selectable types
|
||||||
|
|
|
@ -20,6 +20,7 @@ import com.google.gwt.uibinder.client.UiBinder;
|
||||||
import com.google.gwt.uibinder.client.UiField;
|
import com.google.gwt.uibinder.client.UiField;
|
||||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||||
import com.google.gwt.user.client.ui.Composite;
|
import com.google.gwt.user.client.ui.Composite;
|
||||||
|
import com.google.gwt.user.client.ui.HorizontalPanel;
|
||||||
import com.google.gwt.user.client.ui.Widget;
|
import com.google.gwt.user.client.ui.Widget;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -213,7 +213,7 @@ public class WorkspaceExplorer implements ShowableTypes, SelectableTypes{
|
||||||
private void updateExplorer(ArrayList<Item> items){
|
private void updateExplorer(ArrayList<Item> items){
|
||||||
GWT.log("workspace explorer updating..");
|
GWT.log("workspace explorer updating..");
|
||||||
explorerPanel.clear();
|
explorerPanel.clear();
|
||||||
itTables = new ItemsTable();
|
itTables = new ItemsTable(true);
|
||||||
itTables.addItems(items);
|
itTables.addItems(items);
|
||||||
explorerPanel.add(itTables.getCellTable());
|
explorerPanel.add(itTables.getCellTable());
|
||||||
GWT.log("workspace explorer updated");
|
GWT.log("workspace explorer updated");
|
||||||
|
|
|
@ -37,6 +37,8 @@ public abstract class AbstractItemsCellTable implements SelectionItem{
|
||||||
|
|
||||||
protected CellTable<Item> cellTable;
|
protected CellTable<Item> cellTable;
|
||||||
protected ListDataProvider<Item> dataProvider = new ListDataProvider<Item>();
|
protected ListDataProvider<Item> dataProvider = new ListDataProvider<Item>();
|
||||||
|
protected Item itemContextMenu = null;
|
||||||
|
protected boolean showMoreInfo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Inits the table.
|
* Inits the table.
|
||||||
|
@ -52,11 +54,14 @@ public abstract class AbstractItemsCellTable implements SelectionItem{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new abstract Item table.
|
* Instantiates a new abstract Item table.
|
||||||
|
* @param showMoreInfo
|
||||||
|
* @param showMoreInfo
|
||||||
*
|
*
|
||||||
* @param showGroupId
|
* @param showGroupId
|
||||||
* the show group id
|
* the show group id
|
||||||
*/
|
*/
|
||||||
public AbstractItemsCellTable() {
|
public AbstractItemsCellTable(boolean showMoreInfo) {
|
||||||
|
this.showMoreInfo = showMoreInfo;
|
||||||
cellTable = new CellTable<Item>(1, CellTableResources.INSTANCE);
|
cellTable = new CellTable<Item>(1, CellTableResources.INSTANCE);
|
||||||
cellTable.addStyleName("table-overflow");
|
cellTable.addStyleName("table-overflow");
|
||||||
cellTable.setStriped(true);
|
cellTable.setStriped(true);
|
||||||
|
@ -111,47 +116,50 @@ public abstract class AbstractItemsCellTable implements SelectionItem{
|
||||||
|
|
||||||
}
|
}
|
||||||
}); */
|
}); */
|
||||||
|
|
||||||
addContextMenu();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void addContextMenu(){
|
|
||||||
|
|
||||||
MenuBar options = new MenuBar(true);
|
MenuBar options = new MenuBar(true);
|
||||||
|
ScheduledCommand openCommand = new ScheduledCommand() {
|
||||||
ScheduledCommand command = new ScheduledCommand() {
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute() {
|
public void execute() {
|
||||||
WorkspaceExplorerController.eventBus.fireEvent(new org.gcube.portlets.widgets.wsexplorer.client.event.LoadFolderEvent(getSelectedItem()));
|
WorkspaceExplorerController.eventBus.fireEvent(new org.gcube.portlets.widgets.wsexplorer.client.event.LoadFolderEvent(itemContextMenu));
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
MenuItem openItem = new MenuItem("Open", command);
|
MenuItem openItem = new MenuItem("Open", openCommand);
|
||||||
options.addItem(openItem);
|
options.addItem(openItem);
|
||||||
final DialogBox menuWrapper = new DialogBox(true);
|
final DialogBox menuWrapper = new DialogBox(true);
|
||||||
menuWrapper.getElement().getStyle().setBorderStyle(BorderStyle.NONE);
|
menuWrapper.getElement().getStyle().setBorderStyle(BorderStyle.NONE);
|
||||||
menuWrapper.getElement().getStyle().setZIndex(10000);
|
menuWrapper.getElement().getStyle().setZIndex(10000);
|
||||||
menuWrapper.add(options);
|
menuWrapper.add(options);
|
||||||
|
cellTable.sinkEvents(Event.ONCONTEXTMENU);
|
||||||
cellTable.sinkEvents(Event.ONCONTEXTMENU);
|
|
||||||
cellTable.addHandler(
|
cellTable.addHandler(new ContextMenuHandler() {
|
||||||
new ContextMenuHandler() {
|
@Override
|
||||||
@Override
|
public void onContextMenu(ContextMenuEvent event) {
|
||||||
public void onContextMenu(ContextMenuEvent event) {
|
GWT.log("On Context Menu: " + event.getNativeEvent().getEventTarget().toString());
|
||||||
GWT.log("On Context Menu");
|
Item selectedObject = (Item) event.getSource();
|
||||||
if(getSelectedItem().isFolder()){
|
itemContextMenu = selectedObject;
|
||||||
event.preventDefault();
|
if (selectedObject != null && selectedObject.isFolder()) {
|
||||||
event.stopPropagation();
|
event.preventDefault();
|
||||||
menuWrapper.setPopupPosition(event.getNativeEvent().getClientX(),event.getNativeEvent().getClientY());
|
event.stopPropagation();
|
||||||
|
menuWrapper.setPopupPosition(event.getNativeEvent().getClientX(), event.getNativeEvent().getClientY());
|
||||||
menuWrapper.show();
|
menuWrapper.show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, ContextMenuEvent.getType()
|
}, ContextMenuEvent.getType());
|
||||||
);
|
|
||||||
|
// ssm.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// public void onSelectionChange(SelectionChangeEvent event) {
|
||||||
|
// // changed the context menu selection
|
||||||
|
// GWT.log("Selected item is" + ssm.getSelectedObject());
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -9,23 +9,38 @@ import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.gcube.portlets.widgets.wsexplorer.client.Util;
|
import org.gcube.portlets.widgets.wsexplorer.client.Util;
|
||||||
|
import org.gcube.portlets.widgets.wsexplorer.client.WorkspaceExplorerController;
|
||||||
|
import org.gcube.portlets.widgets.wsexplorer.client.event.MoreInfoShowEvent;
|
||||||
|
import org.gcube.portlets.widgets.wsexplorer.client.resources.WorkspaceExplorerResources;
|
||||||
import org.gcube.portlets.widgets.wsexplorer.shared.Item;
|
import org.gcube.portlets.widgets.wsexplorer.shared.Item;
|
||||||
|
|
||||||
import com.github.gwtbootstrap.client.ui.Pagination;
|
import com.github.gwtbootstrap.client.ui.Pagination;
|
||||||
|
import com.github.gwtbootstrap.client.ui.Popover;
|
||||||
|
import com.github.gwtbootstrap.client.ui.Tooltip;
|
||||||
|
import com.github.gwtbootstrap.client.ui.constants.Placement;
|
||||||
|
import com.github.gwtbootstrap.client.ui.constants.Trigger;
|
||||||
|
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.FieldUpdater;
|
||||||
|
import com.google.gwt.cell.client.ImageCell;
|
||||||
import com.google.gwt.cell.client.ImageResourceCell;
|
import com.google.gwt.cell.client.ImageResourceCell;
|
||||||
|
import com.google.gwt.core.shared.GWT;
|
||||||
|
import com.google.gwt.dom.client.Element;
|
||||||
|
import com.google.gwt.dom.client.NativeEvent;
|
||||||
import com.google.gwt.dom.client.Style.Unit;
|
import com.google.gwt.dom.client.Style.Unit;
|
||||||
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.SafeHtmlBuilder;
|
import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
|
||||||
|
import com.google.gwt.safehtml.shared.SafeHtmlUtils;
|
||||||
import com.google.gwt.user.cellview.client.AbstractCellTable;
|
import com.google.gwt.user.cellview.client.AbstractCellTable;
|
||||||
import com.google.gwt.user.cellview.client.Column;
|
import com.google.gwt.user.cellview.client.Column;
|
||||||
import com.google.gwt.user.cellview.client.ColumnSortEvent.ListHandler;
|
import com.google.gwt.user.cellview.client.ColumnSortEvent.ListHandler;
|
||||||
import com.google.gwt.user.cellview.client.SimplePager;
|
import com.google.gwt.user.cellview.client.SimplePager;
|
||||||
import com.google.gwt.user.cellview.client.TextColumn;
|
import com.google.gwt.user.cellview.client.TextColumn;
|
||||||
|
import com.google.gwt.user.client.ui.HorizontalPanel;
|
||||||
|
import com.google.gwt.user.client.ui.Image;
|
||||||
import com.google.gwt.user.client.ui.Label;
|
import com.google.gwt.user.client.ui.Label;
|
||||||
import com.google.gwt.view.client.SelectionChangeEvent;
|
import com.google.gwt.user.client.ui.Widget;
|
||||||
import com.google.gwt.view.client.SelectionChangeEvent.Handler;
|
|
||||||
import com.google.gwt.view.client.SingleSelectionModel;
|
|
||||||
/**
|
/**
|
||||||
* The Class PackagesTable.
|
* The Class PackagesTable.
|
||||||
*
|
*
|
||||||
|
@ -38,13 +53,13 @@ public class ItemsTable extends AbstractItemsCellTable {
|
||||||
private TextColumn<Item> name;
|
private TextColumn<Item> name;
|
||||||
private TextColumn<Item> owner;
|
private TextColumn<Item> owner;
|
||||||
private Item selectedItem = null;
|
private Item selectedItem = null;
|
||||||
|
private Column<Item, ImageResource> moreInfo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new items table.
|
* Instantiates a new items table.
|
||||||
*/
|
*/
|
||||||
public ItemsTable() {
|
public ItemsTable(boolean showMoreInfo) {
|
||||||
super();
|
super(showMoreInfo);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@ -75,7 +90,7 @@ public class ItemsTable extends AbstractItemsCellTable {
|
||||||
* @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(AbstractCellTable<Item> packageTable, final SimplePager pager, final Pagination pagination) {
|
public void initTable(final AbstractCellTable<Item> packageTable, final SimplePager pager, final Pagination pagination) {
|
||||||
packageTable.setEmptyTableWidget(new Label("No data."));
|
packageTable.setEmptyTableWidget(new Label("No data."));
|
||||||
|
|
||||||
//ICONS
|
//ICONS
|
||||||
|
@ -115,7 +130,7 @@ public class ItemsTable extends AbstractItemsCellTable {
|
||||||
};
|
};
|
||||||
name.setSortable(true);
|
name.setSortable(true);
|
||||||
packageTable.addColumn(name, "Name");
|
packageTable.addColumn(name, "Name");
|
||||||
packageTable.setColumnWidth(name, 60.0, Unit.PCT);
|
packageTable.setColumnWidth(name, 50.0, 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,14 +162,149 @@ public class ItemsTable extends AbstractItemsCellTable {
|
||||||
});
|
});
|
||||||
packageTable.addColumnSortHandler(ownerColumnHandler);
|
packageTable.addColumnSortHandler(ownerColumnHandler);
|
||||||
|
|
||||||
final SingleSelectionModel<Item> selectionModel = new SingleSelectionModel<Item>();
|
if(showMoreInfo){
|
||||||
|
/*
|
||||||
|
// ButtonCell.
|
||||||
|
final ButtonCell buttonCell = new ButtonCell();
|
||||||
|
|
||||||
|
final Column<Item, String> column = new Column<Item, String>(buttonCell) {
|
||||||
|
@Override
|
||||||
|
public String getValue(Item dataObj) {
|
||||||
|
return "Info";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void render(Context context, Item object, SafeHtmlBuilder sb) {
|
||||||
|
super.render(context, object, sb);
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
column.setFieldUpdater(new FieldUpdater<Item, String>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void update(int index, Item object, String value) {
|
||||||
|
GWT.log("mouseover mouseover mouseover");
|
||||||
|
Popover pop = new Popover();
|
||||||
|
pop.setHeading("Info");
|
||||||
|
pop.setText("MouseOver on");
|
||||||
|
pop.setPlacement(Placement.RIGHT);
|
||||||
|
pop.setHtml(true);
|
||||||
|
pop.setTrigger(Trigger.HOVER);
|
||||||
|
// pop.setWidget(buttonCell);
|
||||||
|
setupPopover(packageTable.asWidget(), "MouseOver", "title");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
column.setSortable(false);
|
||||||
|
packageTable.addColumn(column, "");
|
||||||
|
packageTable.setColumnWidth(column, 10.0, Unit.PCT);
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
final Column<Item, String> buttonImageCellTest = new Column<Item, String>(new ButtonImageCell()) {
|
||||||
|
|
||||||
|
private HorizontalPanel widget;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getValue(Item row) {
|
||||||
|
//url to image
|
||||||
|
return WorkspaceExplorerResources.ICONS.info().getSafeUri().toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void render(Context context, Item object, SafeHtmlBuilder sb) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
super.render(context, object, sb);
|
||||||
|
widget = new HorizontalPanel();
|
||||||
|
sb.appendEscaped(widget.getElement().getInnerHTML());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setFieldUpdater(
|
||||||
|
FieldUpdater<Item, String> fieldUpdater) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
super.setFieldUpdater(fieldUpdater);
|
||||||
|
setupPopover(widget, "", "").show();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
packageTable.addColumn(buttonImageCellTest, "");
|
||||||
|
packageTable.setColumnWidth(buttonImageCellTest, 10.0, Unit.PCT);
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
//ICONS
|
||||||
|
ImageResourceCell moreInfoResourceCell = new ImageResourceCell() {
|
||||||
|
public Set<String> getConsumedEvents() {
|
||||||
|
HashSet<String> events = new HashSet<String>();
|
||||||
|
events.add("click");
|
||||||
|
return events;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
moreInfo = new Column<Item, ImageResource>(moreInfoResourceCell) {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ImageResource getValue(Item dataObj) {
|
||||||
|
return WorkspaceExplorerResources.ICONS.info();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBrowserEvent(Context context, Element elem, Item object, NativeEvent event) {
|
||||||
|
super.onBrowserEvent(context, elem, object, event);
|
||||||
|
if ("click".equals(event.getType())) {
|
||||||
|
WorkspaceExplorerController.eventBus.fireEvent(new MoreInfoShowEvent(object));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
moreInfo.setFieldUpdater(new FieldUpdater<Item, ImageResource>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void update(int index, Item object, ImageResource value) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// icon.setCellStyleNames("img-centered-clickable");
|
||||||
|
moreInfo.setSortable(false);
|
||||||
|
packageTable.addColumn(moreInfo, "");
|
||||||
|
packageTable.setColumnWidth(moreInfo, 10.0, Unit.PCT);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/*final SingleSelectionModel<Item> selectionModel = new SingleSelectionModel<Item>();
|
||||||
selectionModel.addSelectionChangeHandler(new Handler() {
|
selectionModel.addSelectionChangeHandler(new Handler() {
|
||||||
@Override
|
@Override
|
||||||
public void onSelectionChange(SelectionChangeEvent event) {
|
public void onSelectionChange(SelectionChangeEvent event) {
|
||||||
}
|
}
|
||||||
});
|
});*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Tooltip setupPopover(Widget w, String message, String heading) {
|
||||||
|
Tooltip popover = new Tooltip();
|
||||||
|
popover.setWidget(w);
|
||||||
|
popover.setText(message);
|
||||||
|
// popover.setHeading(heading);
|
||||||
|
popover.setPlacement(Placement.RIGHT);
|
||||||
|
popover.reconfigure();
|
||||||
|
return popover;
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ButtonImageCell extends ButtonCell{
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void render(com.google.gwt.cell.client.Cell.Context context,
|
||||||
|
String value, SafeHtmlBuilder sb) {
|
||||||
|
SafeHtml html = SafeHtmlUtils.fromTrustedString(new Image(value).toString());
|
||||||
|
sb.append(html);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.gcube.portlets.widgets.wsexplorer.client.grid.AbstractItemsCellTable#selectedItem(org.gcube.portlets.widgets.wsexplorer.shared.Item)
|
* @see org.gcube.portlets.widgets.wsexplorer.client.grid.AbstractItemsCellTable#selectedItem(org.gcube.portlets.widgets.wsexplorer.shared.Item)
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -13,4 +13,8 @@
|
||||||
|
|
||||||
.breadcrumbs-navigator .breadcrumb {
|
.breadcrumbs-navigator .breadcrumb {
|
||||||
margin-bottom: 3px !important;
|
margin-bottom: 3px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.moreinfo{
|
||||||
|
margin-top: 60%;
|
||||||
}
|
}
|
|
@ -26,8 +26,10 @@ public class ItemComparator implements Comparator<Item> {
|
||||||
boolean isItem1Folder = Util.isFolder(item1.getType());
|
boolean isItem1Folder = Util.isFolder(item1.getType());
|
||||||
boolean isItem2Folder = Util.isFolder(item2.getType());
|
boolean isItem2Folder = Util.isFolder(item2.getType());
|
||||||
|
|
||||||
if (isSpecialFolder(item1) ^ isSpecialFolder(item2)) return isSpecialFolder(item1) ? -1 : 1;
|
//XOR
|
||||||
|
if (isSpecialFolder(item1) ^ isSpecialFolder(item2)) return isSpecialFolder(item1) ? -1 : 1;
|
||||||
|
|
||||||
|
//XOR
|
||||||
if (isItem1Folder ^ isItem2Folder) return isItem1Folder ? -1 : 1;
|
if (isItem1Folder ^ isItem2Folder) return isItem1Folder ? -1 : 1;
|
||||||
|
|
||||||
//otherwise we compare the names
|
//otherwise we compare the names
|
||||||
|
@ -35,6 +37,6 @@ public class ItemComparator implements Comparator<Item> {
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isSpecialFolder(Item item) {
|
private boolean isSpecialFolder(Item item) {
|
||||||
return item.getName().equals(WorkspaceExplorerConstants.VRE_FOLDERS_LABEL);
|
return item.getName().equals(WorkspaceExplorerConstants.VRE_FOLDERS_LABEL) && item.getParent()!=null && item.getParent().isRoot();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue