256: Workspace explorer

Task-Url: https://support.d4science.org/issues/256

Starting Save dialog

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/widgets/workspace-explorer@117050 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2015-07-07 10:14:25 +00:00
parent eb95045458
commit 9d026759d1
8 changed files with 306 additions and 251 deletions

View File

@ -14,4 +14,12 @@ public class WorkspaceExplorerConstants {
public static final String WORKSPACE_EXPLORER_CAPTION = "Workspace Explorer";
public static final String HOME_LABEL = "Home";
//DIALOGS
public static final String SAVE = "Save";
public static final String MAX_HEIGHT_DIALOG = "500px";
public static final int WIDHT_DIALOG = 720;
public static final String SELECT = "Select";
}

View File

@ -0,0 +1,93 @@
/**
*
*/
package org.gcube.portlets.widgets.wsexplorer.client.notification;
import org.gcube.portlets.widgets.wsexplorer.shared.Item;
/**
* The Class WorskpaceExplorerNotification.
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* Jun 29, 2015
*/
public class WorkspaceExplorerSaveNotification {
/**
* The listener interface for receiving worskpaceExplorerSaveNotification events.
* The class that is interested in processing a worskpaceExplorerSaveNotification
* event implements this interface, and the object created
* with that class is registered with a component using the
* component's <code>addWorskpaceExplorerSaveNotificationListener<code> method. When
* the worskpaceExplorerSaveNotification event occurs, that object's appropriate
* method is invoked.
*
* @see WorskpaceExplorerSaveNotificationEvent
*/
public interface WorskpaceExplorerSaveNotificationListener {
/**
* On parent selected.
*
* @param parent the parent
*/
void onParentSelected(Item parent);
/**
* On folder item name.
*
* @param itemName the item name
*/
void onFolderItemName(String itemName);
/**
* On aborted.
*/
void onAborted();
/**
* On failed.
*
* @param throwable the throwable
*/
void onFailed(Throwable throwable);
}
/**
* The listener interface for receiving hasWorskpaceExplorerSaveNotification events.
* The class that is interested in processing a hasWorskpaceExplorerSaveNotification
* event implements this interface, and the object created
* with that class is registered with a component using the
* component's <code>addHasWorskpaceExplorerSaveNotificationListener<code> method. When
* the hasWorskpaceExplorerSaveNotification event occurs, that object's appropriate
* method is invoked.
*
* @see HasWorskpaceExplorerSaveNotificationEvent
*/
public interface HasWorskpaceExplorerSaveNotificationListener {
/**
* Adds the workspace explorer save notification listener.
*
* @param handler the handler
*/
public void addWorkspaceExplorerSaveNotificationListener(WorskpaceExplorerSaveNotificationListener handler);
/**
* Removes the workspace explorer save notification listener.
*
* @param handler the handler
*/
public void removeWorkspaceExplorerSaveNotificationListener(WorskpaceExplorerSaveNotificationListener handler);
}
}

View File

@ -0,0 +1,90 @@
/**
*
*/
package org.gcube.portlets.widgets.wsexplorer.client.notification;
import org.gcube.portlets.widgets.wsexplorer.shared.Item;
/**
* The Class WorskpaceExplorerNotification.
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* Jun 29, 2015
*/
public class WorkspaceExplorerSelectNotification {
/**
* The listener interface for receiving worskpaceExplorerSelectNotification events.
* The class that is interested in processing a worskpaceExplorerSelectNotification
* event implements this interface, and the object created
* with that class is registered with a component using the
* component's <code>addWorskpaceExplorerSelectNotificationListener<code> method. When
* the worskpaceExplorerSelectNotification event occurs, that object's appropriate
* method is invoked.
*
* @see WorskpaceExplorerSelectNotificationEvent
*/
public interface WorskpaceExplorerSelectNotificationListener {
/**
* On selected item.
*
* @param item the item
*/
void onSelectedItem(Item item);
/**
* On aborted.
*/
void onAborted();
/**
* On failed.
*
* @param throwable the throwable
*/
void onFailed(Throwable throwable);
}
/**
* The listener interface for receiving hasWorskpaceExplorerSelectNotification events.
* The class that is interested in processing a hasWorskpaceExplorerSelectNotification
* event implements this interface, and the object created
* with that class is registered with a component using the
* component's <code>addHasWorskpaceExplorerSelectNotificationListener<code> method. When
* the hasWorskpaceExplorerSelectNotification event occurs, that object's appropriate
* method is invoked.
*
* @see HasWorskpaceExplorerSelectNotificationEvent
*/
public interface HasWorskpaceExplorerSelectNotificationListener {
/**
* Adds the workspace explorer select notification listener.
*
* @param handler the handler
*/
public void addWorkspaceExplorerSelectNotificationListener(WorskpaceExplorerSelectNotificationListener handler);
/**
* Removes the workspace explorer select notification listener.
*
* @param handler the handler
*/
public void removeWorkspaceExplorerSelectNotificationListener(WorskpaceExplorerSelectNotificationListener handler);
}
}

View File

@ -1,86 +0,0 @@
/**
*
*/
package org.gcube.portlets.widgets.wsexplorer.client.notification;
import org.gcube.portlets.widgets.wsexplorer.shared.Item;
/**
* The Class WorskpaceExplorerNotification.
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* Jun 29, 2015
*/
public class WorskpaceExplorerNotification {
/**
* The listener interface for receiving worskpaceExplorerNotification events.
* The class that is interested in processing a worskpaceExplorerNotification
* event implements this interface, and the object created
* with that class is registered with a component using the
* component's <code>addWorskpaceExplorerNotificationListener<code> method. When
* the worskpaceExplorerNotification event occurs, that object's appropriate
* method is invoked.
*
* @see WorskpaceExplorerNotificationEvent
*/
public interface WorskpaceExplorerNotificationListener {
/**
* On selecte item.
*
* @param expressionWrapperNotification the expression wrapper notification
*/
void onSelectedItem(Item item);
/**
* On aborted.
*/
void onAborted();
/**
* On failed.
*
* @param throwable the throwable
*/
void onFailed(Throwable throwable);
}
/**
* The listener interface for receiving hasWorskpaceExplorerNotification events.
* The class that is interested in processing a hasWorskpaceExplorerNotification
* event implements this interface, and the object created
* with that class is registered with a component using the
* component's <code>addHasWorskpaceExplorerNotificationListener<code> method. When
* the hasWorskpaceExplorerNotification event occurs, that object's appropriate
* method is invoked.
*
* @see HasWorskpaceExplorerNotificationEvent
*/
public interface HasWorskpaceExplorerNotificationListener {
/**
* Adds the workspace explorer notification listener.
*
* @param handler the handler
*/
public void addWorkspaceExplorerNotificationListener(WorskpaceExplorerNotificationListener handler);
/**
* Removes the workspace explorer notification listener.
*
* @param handler the handler
*/
public void removeWorkspaceExplorerNotificationListener(WorskpaceExplorerNotificationListener handler);
}
}

View File

@ -32,7 +32,7 @@ public interface WorkspaceExplorerIcons extends ClientBundle {
@Source("home.png")
ImageResource home();
@Source("info.png")
@Source("info-icon.png")
ImageResource info();
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 605 B

After

Width:  |  Height:  |  Size: 271 B

View File

@ -1,6 +1,3 @@
/**
*
*/
package org.gcube.portlets.widgets.wsexplorer.client.save;
import java.util.ArrayList;
@ -9,16 +6,14 @@ 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.client.notification.WorkspaceExplorerSaveNotification.HasWorskpaceExplorerSaveNotificationListener;
import org.gcube.portlets.widgets.wsexplorer.client.notification.WorkspaceExplorerSaveNotification.WorskpaceExplorerSaveNotificationListener;
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;
@ -27,47 +22,42 @@ import com.google.gwt.event.dom.client.ClickHandler;
/**
* The Class WorkspaceExplorerLoadDialog.
* The Class WorkspaceExplorerSaveDialog.
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* Jun 30, 2015
* Jul 7, 2015
*/
public class WorkspaceExplorerSaveDialog extends Modal implements HasWorskpaceExplorerNotificationListener{
public class WorkspaceExplorerSaveDialog extends Modal implements
HasWorskpaceExplorerSaveNotificationListener {
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 Button saveButton;
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>();
private List<WorskpaceExplorerSaveNotificationListener> listeners = new ArrayList<WorskpaceExplorerSaveNotificationListener>();
/**
* Instantiates a new workspace explorer load dialog.
* Instantiates a new workspace explorer save dialog.
*
* @param captionTxt the caption txt
* You can implement {@link WorskpaceExplorerNotificationListener} to receive events
*/
public WorkspaceExplorerSaveDialog(String captionTxt) {
WorkspaceExplorerController.eventBus.fireEvent(new LoadRootEvent());
WorkspaceExplorerController.eventBus.fireEvent(new LoadRootEvent());
initDialog(captionTxt);
}
/**
* Instantiates a new workspace explorer load dialog.
* Instantiates a new workspace explorer save dialog.
*
* @param captionTxt the caption txt
* @param showOnlyFolders the show only folders
*/
public WorkspaceExplorerSaveDialog(String captionTxt, boolean showOnlyFolders) {
if(showOnlyFolders){
public WorkspaceExplorerSaveDialog(String captionTxt,
boolean showOnlyFolders) {
if (showOnlyFolders) {
ItemType[] itemsType = new ItemType[2];
itemsType[0] = ItemType.ROOT;
itemsType[1] = ItemType.FOLDER;
@ -75,168 +65,122 @@ public class WorkspaceExplorerSaveDialog extends Modal implements HasWorskpaceEx
setShowableTypes(itemsType);
}
WorkspaceExplorerController.eventBus.fireEvent(new LoadRootEvent());
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 captionTxt the caption txt
* @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){
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){
if (showableTypes != null) {
ItemType[] itemsType = new ItemType[showableTypes.size()];
itemsType = showableTypes.toArray(itemsType);
setShowableTypes(showableTypes.toArray(itemsType));
}
WorkspaceExplorerController.eventBus.fireEvent(new LoadRootEvent());
WorkspaceExplorerController.eventBus.fireEvent(new LoadRootEvent());
initDialog(captionTxt);
}
/**
* Inits the dialog.
*
* @param captionTxt the caption txt
* @param captionTxt
* the caption txt
*/
private void initDialog(String captionTxt) {
this.captionTxt = (captionTxt==null || captionTxt.isEmpty())?WorkspaceExplorerConstants.WORKSPACE_EXPLORER_CAPTION: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);
saveButton = new Button(WorkspaceExplorerConstants.SAVE);
saveButton.setType(ButtonType.PRIMARY);
setWidth(WorkspaceExplorerConstants.WIDHT_DIALOG);
setMaxHeigth(WorkspaceExplorerConstants.MAX_HEIGHT_DIALOG);
hide(false);
addHideHandler(new HideHandler() {
@Override
public void onHide(HideEvent hideEvent) {
if(!isSelect)
if (!isSelect)
notifyAborted();
}
});
add(controller.getWorkspaceExplorerPanel());
selectButton.addClickHandler(new ClickHandler() {
saveButton.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
isSelect = false;
Item item = controller.getWsExplorer().getItemSelected();
if(item!=null){
if (item != null) {
isSelect = true;
INSTANCE.hide();
notifySelectedItem(item);
}else if(!controller.getWsExplorer().itemIsSelectable()){ //IGNORING ITEMS NOT SELECTABLE, USING BREADCRUMBS
notifyParentSelected(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);
if (itemB != null) {
}
}
}
});
setAlertConfirm("", false, null);
footer.add(selectButton);
footer.add(saveButton);
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.
* Notify parent selected.
*
* @param selected the selected
*/
private void notifySelectedItem(Item selected){
for (WorskpaceExplorerNotificationListener worskpaceExplorerNotificationListener : listeners) {
worskpaceExplorerNotificationListener.onSelectedItem(selected);
private void notifyParentSelected(Item selected) {
for (WorskpaceExplorerSaveNotificationListener worskpaceExplorerNotificationListener : listeners) {
worskpaceExplorerNotificationListener.onParentSelected(selected);
}
}
/**
* Notify aborted.
*/
private void notifyAborted(){
for (WorskpaceExplorerNotificationListener worskpaceExplorerNotificationListener : listeners) {
private void notifyAborted() {
for (WorskpaceExplorerSaveNotificationListener worskpaceExplorerNotificationListener : listeners) {
worskpaceExplorerNotificationListener.onAborted();
}
}
/**
* Notify failed.
*
* @param t the t
* @param t
* the t
*/
@SuppressWarnings("unused")
private void notifyFailed(Throwable t){
for (WorskpaceExplorerNotificationListener worskpaceExplorerNotificationListener : listeners) {
private void notifyFailed(Throwable t) {
for (WorskpaceExplorerSaveNotificationListener worskpaceExplorerNotificationListener : listeners) {
worskpaceExplorerNotificationListener.onFailed(t);
}
}
/**
* Gets the caption txt.
*
@ -254,8 +198,10 @@ public class WorkspaceExplorerSaveDialog extends Modal implements HasWorskpaceEx
public boolean isValidHide() {
return isSelect;
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see com.github.gwtbootstrap.client.ui.Modal#show()
*/
@Override
@ -264,35 +210,15 @@ public class WorkspaceExplorerSaveDialog extends Modal implements HasWorskpaceEx
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
*
* @param selectableTypes
* the selectableTypes to set
*/
private void setSelectableTypes(ItemType ... selectableTypes) {
private void setSelectableTypes(ItemType... selectableTypes) {
controller.setSelectableTypes(selectableTypes);
}
/**
* Gets the selectable types.
@ -302,9 +228,10 @@ public class WorkspaceExplorerSaveDialog extends Modal implements HasWorskpaceEx
public List<ItemType> getSelectableTypes() {
return controller.getSelectableTypes();
}
/**
* Return the showable items.
*
* @return the showableTypes
*/
public List<ItemType> getShowableTypes() {
@ -313,9 +240,35 @@ public class WorkspaceExplorerSaveDialog extends Modal implements HasWorskpaceEx
/**
* Set the showable items. The folders items are show as default.
* @param showableTypes the showableTypes to set
*
* @param showableTypes
* the showableTypes to set
*/
private void setShowableTypes(ItemType ... showableTypes) {
private void setShowableTypes(ItemType... showableTypes) {
controller.setShowableTypes(showableTypes);
}
/* (non-Javadoc)
* @see org.gcube.portlets.widgets.wsexplorer.client.notification.WorskpaceExplorerSaveNotification.HasWorskpaceExplorerSaveNotificationListener#addWorkspaceExplorerSaveNotificationListener(org.gcube.portlets.widgets.wsexplorer.client.notification.WorskpaceExplorerSaveNotification.WorskpaceExplorerSaveNotificationListener)
*/
@Override
public void addWorkspaceExplorerSaveNotificationListener(WorskpaceExplorerSaveNotificationListener handler) {
if(handler!=null)
listeners.add(handler);
}
/* (non-Javadoc)
* @see org.gcube.portlets.widgets.wsexplorer.client.notification.WorskpaceExplorerSaveNotification.HasWorskpaceExplorerSaveNotificationListener#removeWorkspaceExplorerSaveNotificationListener(org.gcube.portlets.widgets.wsexplorer.client.notification.WorskpaceExplorerSaveNotification.WorskpaceExplorerSaveNotificationListener)
*/
@Override
public void removeWorkspaceExplorerSaveNotificationListener(WorskpaceExplorerSaveNotificationListener handler) {
if(handler!=null){
if(listeners.contains(handler))
listeners.remove(handler);
}
}
}

View File

@ -9,8 +9,8 @@ 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.client.notification.WorkspaceExplorerSelectNotification.HasWorskpaceExplorerSelectNotificationListener;
import org.gcube.portlets.widgets.wsexplorer.client.notification.WorkspaceExplorerSelectNotification.WorskpaceExplorerSelectNotificationListener;
import org.gcube.portlets.widgets.wsexplorer.shared.Item;
import org.gcube.portlets.widgets.wsexplorer.shared.ItemType;
@ -32,12 +32,8 @@ import com.google.gwt.event.dom.client.ClickHandler;
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* Jun 30, 2015
*/
public class WorkspaceExplorerSelectDialog extends Modal implements HasWorskpaceExplorerNotificationListener{
public class WorkspaceExplorerSelectDialog extends Modal implements HasWorskpaceExplorerSelectNotificationListener{
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 WorkspaceExplorerSelectDialog INSTANCE = this;
private boolean isSelect = false;
@ -45,14 +41,14 @@ public class WorkspaceExplorerSelectDialog extends Modal implements HasWorskpace
private ModalFooter footer = new ModalFooter();
private Alert alertConfirm;
private WorkspaceExplorerController controller = new WorkspaceExplorerController();
private List<WorskpaceExplorerNotificationListener> listeners = new ArrayList<WorskpaceExplorerNotificationListener>();
private List<WorskpaceExplorerSelectNotificationListener> listeners = new ArrayList<WorskpaceExplorerSelectNotificationListener>();
/**
* Instantiates a new workspace explorer select dialog.
*
* @param captionTxt the caption txt
* You can implement {@link WorskpaceExplorerNotificationListener} to receive events
* You can implement {@link WorskpaceExplorerSelectNotificationListener} to receive events
*/
public WorkspaceExplorerSelectDialog(String captionTxt) {
WorkspaceExplorerController.eventBus.fireEvent(new LoadRootEvent());
@ -86,7 +82,7 @@ public class WorkspaceExplorerSelectDialog extends Modal implements HasWorskpace
* @param selectableTypes the selectable types
* @param showableTypes the showable types
*
* You can implement {@link WorskpaceExplorerNotificationListener} to receive events
* You can implement {@link WorskpaceExplorerSelectNotificationListener} to receive events
*/
public WorkspaceExplorerSelectDialog(String captionTxt, List<ItemType> selectableTypes, List<ItemType> showableTypes) {
if(selectableTypes!=null){
@ -116,10 +112,11 @@ public class WorkspaceExplorerSelectDialog extends Modal implements HasWorskpace
setAnimation(false);
setCloseVisible(true);
setTitle(this.captionTxt);
selectButton = new Button(SELECT);
selectButton = new Button(WorkspaceExplorerConstants.SELECT);
selectButton.setType(ButtonType.PRIMARY);
setWidth(WIDHT_DIALOG);
setMaxHeigth(MAX_HEIGHT_DIALOG);
setWidth(WorkspaceExplorerConstants.WIDHT_DIALOG);
setMaxHeigth(WorkspaceExplorerConstants.MAX_HEIGHT_DIALOG);
hide(false);
addHideHandler(new HideHandler() {
@ -209,7 +206,7 @@ public class WorkspaceExplorerSelectDialog extends Modal implements HasWorskpace
*/
private void notifySelectedItem(Item selected){
for (WorskpaceExplorerNotificationListener worskpaceExplorerNotificationListener : listeners) {
for (WorskpaceExplorerSelectNotificationListener worskpaceExplorerNotificationListener : listeners) {
worskpaceExplorerNotificationListener.onSelectedItem(selected);
}
}
@ -219,7 +216,7 @@ public class WorkspaceExplorerSelectDialog extends Modal implements HasWorskpace
*/
private void notifyAborted(){
for (WorskpaceExplorerNotificationListener worskpaceExplorerNotificationListener : listeners) {
for (WorskpaceExplorerSelectNotificationListener worskpaceExplorerNotificationListener : listeners) {
worskpaceExplorerNotificationListener.onAborted();
}
}
@ -232,7 +229,7 @@ public class WorkspaceExplorerSelectDialog extends Modal implements HasWorskpace
@SuppressWarnings("unused")
private void notifyFailed(Throwable t){
for (WorskpaceExplorerNotificationListener worskpaceExplorerNotificationListener : listeners) {
for (WorskpaceExplorerSelectNotificationListener worskpaceExplorerNotificationListener : listeners) {
worskpaceExplorerNotificationListener.onFailed(t);
}
}
@ -269,7 +266,7 @@ public class WorkspaceExplorerSelectDialog extends Modal implements HasWorskpace
* @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) {
public void addWorkspaceExplorerSelectNotificationListener(WorskpaceExplorerSelectNotificationListener handler) {
if(handler!=null)
listeners.add(handler);
}
@ -278,7 +275,7 @@ public class WorkspaceExplorerSelectDialog extends Modal implements HasWorskpace
* @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) {
public void removeWorkspaceExplorerSelectNotificationListener(WorskpaceExplorerSelectNotificationListener handler) {
if(handler!=null){
if(listeners.contains(handler))
listeners.remove(handler);