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:
parent
eb95045458
commit
9d026759d1
|
@ -14,4 +14,12 @@ public class WorkspaceExplorerConstants {
|
||||||
public static final String WORKSPACE_EXPLORER_CAPTION = "Workspace Explorer";
|
public static final String WORKSPACE_EXPLORER_CAPTION = "Workspace Explorer";
|
||||||
|
|
||||||
public static final String HOME_LABEL = "Home";
|
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";
|
||||||
}
|
}
|
||||||
|
|
|
@ -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);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -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);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -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);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -32,7 +32,7 @@ public interface WorkspaceExplorerIcons extends ClientBundle {
|
||||||
@Source("home.png")
|
@Source("home.png")
|
||||||
ImageResource home();
|
ImageResource home();
|
||||||
|
|
||||||
@Source("info.png")
|
@Source("info-icon.png")
|
||||||
ImageResource info();
|
ImageResource info();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 605 B After Width: | Height: | Size: 271 B |
|
@ -1,6 +1,3 @@
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package org.gcube.portlets.widgets.wsexplorer.client.save;
|
package org.gcube.portlets.widgets.wsexplorer.client.save;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
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.WorkspaceExplorerConstants;
|
||||||
import org.gcube.portlets.widgets.wsexplorer.client.WorkspaceExplorerController;
|
import org.gcube.portlets.widgets.wsexplorer.client.WorkspaceExplorerController;
|
||||||
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.notification.WorskpaceExplorerNotification.HasWorskpaceExplorerNotificationListener;
|
import org.gcube.portlets.widgets.wsexplorer.client.notification.WorkspaceExplorerSaveNotification.HasWorskpaceExplorerSaveNotificationListener;
|
||||||
import org.gcube.portlets.widgets.wsexplorer.client.notification.WorskpaceExplorerNotification.WorskpaceExplorerNotificationListener;
|
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.Item;
|
||||||
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.Button;
|
import com.github.gwtbootstrap.client.ui.Button;
|
||||||
import com.github.gwtbootstrap.client.ui.Modal;
|
import com.github.gwtbootstrap.client.ui.Modal;
|
||||||
import com.github.gwtbootstrap.client.ui.ModalFooter;
|
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.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;
|
||||||
|
@ -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
|
* @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";
|
private Button saveButton;
|
||||||
public static final String MAX_HEIGHT_DIALOG = "500px";
|
|
||||||
public static final int WIDHT_DIALOG = 720;
|
|
||||||
|
|
||||||
private Button selectButton;
|
|
||||||
private WorkspaceExplorerSaveDialog INSTANCE = this;
|
private WorkspaceExplorerSaveDialog INSTANCE = this;
|
||||||
private boolean isSelect = false;
|
private boolean isSelect = false;
|
||||||
private String captionTxt;
|
private String captionTxt;
|
||||||
private ModalFooter footer = new ModalFooter();
|
private ModalFooter footer = new ModalFooter();
|
||||||
private Alert alertConfirm;
|
|
||||||
private WorkspaceExplorerController controller = new WorkspaceExplorerController();
|
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
|
* @param captionTxt the caption txt
|
||||||
* You can implement {@link WorskpaceExplorerNotificationListener} to receive events
|
|
||||||
*/
|
*/
|
||||||
public WorkspaceExplorerSaveDialog(String captionTxt) {
|
public WorkspaceExplorerSaveDialog(String captionTxt) {
|
||||||
WorkspaceExplorerController.eventBus.fireEvent(new LoadRootEvent());
|
WorkspaceExplorerController.eventBus.fireEvent(new LoadRootEvent());
|
||||||
initDialog(captionTxt);
|
initDialog(captionTxt);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new workspace explorer load dialog.
|
* Instantiates a new workspace explorer save dialog.
|
||||||
*
|
*
|
||||||
* @param captionTxt the caption txt
|
* @param captionTxt the caption txt
|
||||||
* @param showOnlyFolders the show only folders
|
* @param showOnlyFolders the show only folders
|
||||||
*/
|
*/
|
||||||
public WorkspaceExplorerSaveDialog(String captionTxt, boolean showOnlyFolders) {
|
public WorkspaceExplorerSaveDialog(String captionTxt,
|
||||||
|
boolean showOnlyFolders) {
|
||||||
if(showOnlyFolders){
|
|
||||||
|
if (showOnlyFolders) {
|
||||||
ItemType[] itemsType = new ItemType[2];
|
ItemType[] itemsType = new ItemType[2];
|
||||||
itemsType[0] = ItemType.ROOT;
|
itemsType[0] = ItemType.ROOT;
|
||||||
itemsType[1] = ItemType.FOLDER;
|
itemsType[1] = ItemType.FOLDER;
|
||||||
|
@ -75,168 +65,122 @@ public class WorkspaceExplorerSaveDialog extends Modal implements HasWorskpaceEx
|
||||||
setShowableTypes(itemsType);
|
setShowableTypes(itemsType);
|
||||||
}
|
}
|
||||||
|
|
||||||
WorkspaceExplorerController.eventBus.fireEvent(new LoadRootEvent());
|
WorkspaceExplorerController.eventBus.fireEvent(new LoadRootEvent());
|
||||||
initDialog(captionTxt);
|
initDialog(captionTxt);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new workspace explorer save dialog.
|
* 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 selectableTypes the selectable types
|
||||||
* @param showableTypes the showable types
|
* @param showableTypes the showable types
|
||||||
*
|
|
||||||
* You can implement {@link WorskpaceExplorerNotificationListener} to receive events
|
|
||||||
*/
|
*/
|
||||||
public WorkspaceExplorerSaveDialog(String captionTxt, List<ItemType> selectableTypes, List<ItemType> showableTypes) {
|
public WorkspaceExplorerSaveDialog(String captionTxt,
|
||||||
if(selectableTypes!=null){
|
List<ItemType> selectableTypes, List<ItemType> showableTypes) {
|
||||||
|
if (selectableTypes != null) {
|
||||||
ItemType[] itemsType = new ItemType[selectableTypes.size()];
|
ItemType[] itemsType = new ItemType[selectableTypes.size()];
|
||||||
itemsType = selectableTypes.toArray(itemsType);
|
itemsType = selectableTypes.toArray(itemsType);
|
||||||
setSelectableTypes(selectableTypes.toArray(itemsType));
|
setSelectableTypes(selectableTypes.toArray(itemsType));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(showableTypes!=null){
|
if (showableTypes != null) {
|
||||||
ItemType[] itemsType = new ItemType[showableTypes.size()];
|
ItemType[] itemsType = new ItemType[showableTypes.size()];
|
||||||
itemsType = showableTypes.toArray(itemsType);
|
itemsType = showableTypes.toArray(itemsType);
|
||||||
setShowableTypes(showableTypes.toArray(itemsType));
|
setShowableTypes(showableTypes.toArray(itemsType));
|
||||||
}
|
}
|
||||||
|
|
||||||
WorkspaceExplorerController.eventBus.fireEvent(new LoadRootEvent());
|
WorkspaceExplorerController.eventBus.fireEvent(new LoadRootEvent());
|
||||||
initDialog(captionTxt);
|
initDialog(captionTxt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Inits the dialog.
|
* Inits the dialog.
|
||||||
*
|
*
|
||||||
* @param captionTxt the caption txt
|
* @param captionTxt
|
||||||
|
* the caption txt
|
||||||
*/
|
*/
|
||||||
private void initDialog(String captionTxt) {
|
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);
|
setAnimation(false);
|
||||||
setCloseVisible(true);
|
setCloseVisible(true);
|
||||||
setTitle(this.captionTxt);
|
setTitle(this.captionTxt);
|
||||||
selectButton = new Button(SELECT);
|
saveButton = new Button(WorkspaceExplorerConstants.SAVE);
|
||||||
selectButton.setType(ButtonType.PRIMARY);
|
saveButton.setType(ButtonType.PRIMARY);
|
||||||
setWidth(WIDHT_DIALOG);
|
setWidth(WorkspaceExplorerConstants.WIDHT_DIALOG);
|
||||||
setMaxHeigth(MAX_HEIGHT_DIALOG);
|
setMaxHeigth(WorkspaceExplorerConstants.MAX_HEIGHT_DIALOG);
|
||||||
hide(false);
|
hide(false);
|
||||||
|
|
||||||
addHideHandler(new HideHandler() {
|
addHideHandler(new HideHandler() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onHide(HideEvent hideEvent) {
|
public void onHide(HideEvent hideEvent) {
|
||||||
if(!isSelect)
|
if (!isSelect)
|
||||||
notifyAborted();
|
notifyAborted();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
add(controller.getWorkspaceExplorerPanel());
|
add(controller.getWorkspaceExplorerPanel());
|
||||||
selectButton.addClickHandler(new ClickHandler() {
|
saveButton.addClickHandler(new ClickHandler() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(ClickEvent event) {
|
public void onClick(ClickEvent event) {
|
||||||
isSelect = false;
|
isSelect = false;
|
||||||
Item item = controller.getWsExplorer().getItemSelected();
|
Item item = controller.getWsExplorer().getItemSelected();
|
||||||
if(item!=null){
|
if (item != null) {
|
||||||
isSelect = true;
|
isSelect = true;
|
||||||
INSTANCE.hide();
|
INSTANCE.hide();
|
||||||
notifySelectedItem(item);
|
notifyParentSelected(item);
|
||||||
}else if(!controller.getWsExplorer().itemIsSelectable()){ //IGNORING ITEMS NOT SELECTABLE, USING BREADCRUMBS
|
|
||||||
|
} else if (!controller.getWsExplorer().itemIsSelectable()) {
|
||||||
|
// IGNORING ITEMS NOT SELECTABLE, USING BREADCRUMBS
|
||||||
Item itemB = controller.getBreadcrumbs().getLastParent();
|
Item itemB = controller.getBreadcrumbs().getLastParent();
|
||||||
if(itemB!=null){
|
if (itemB != null) {
|
||||||
setAlertConfirm("Selecting \""+itemB.getName()+"\", confirm?", true, itemB);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
footer.add(saveButton);
|
||||||
setAlertConfirm("", false, null);
|
|
||||||
footer.add(selectButton);
|
|
||||||
add(footer);
|
add(footer);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the alert confirm.
|
* Notify parent selected.
|
||||||
*
|
|
||||||
* @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
|
* @param selected the selected
|
||||||
*/
|
*/
|
||||||
private void notifySelectedItem(Item selected){
|
private void notifyParentSelected(Item selected) {
|
||||||
|
|
||||||
for (WorskpaceExplorerNotificationListener worskpaceExplorerNotificationListener : listeners) {
|
for (WorskpaceExplorerSaveNotificationListener worskpaceExplorerNotificationListener : listeners) {
|
||||||
worskpaceExplorerNotificationListener.onSelectedItem(selected);
|
worskpaceExplorerNotificationListener.onParentSelected(selected);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Notify aborted.
|
* Notify aborted.
|
||||||
*/
|
*/
|
||||||
private void notifyAborted(){
|
private void notifyAborted() {
|
||||||
|
|
||||||
for (WorskpaceExplorerNotificationListener worskpaceExplorerNotificationListener : listeners) {
|
for (WorskpaceExplorerSaveNotificationListener worskpaceExplorerNotificationListener : listeners) {
|
||||||
worskpaceExplorerNotificationListener.onAborted();
|
worskpaceExplorerNotificationListener.onAborted();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Notify failed.
|
* Notify failed.
|
||||||
*
|
*
|
||||||
* @param t the t
|
* @param t
|
||||||
|
* the t
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
private void notifyFailed(Throwable t){
|
private void notifyFailed(Throwable t) {
|
||||||
|
|
||||||
for (WorskpaceExplorerNotificationListener worskpaceExplorerNotificationListener : listeners) {
|
for (WorskpaceExplorerSaveNotificationListener worskpaceExplorerNotificationListener : listeners) {
|
||||||
worskpaceExplorerNotificationListener.onFailed(t);
|
worskpaceExplorerNotificationListener.onFailed(t);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the caption txt.
|
* Gets the caption txt.
|
||||||
*
|
*
|
||||||
|
@ -254,8 +198,10 @@ public class WorkspaceExplorerSaveDialog extends Modal implements HasWorskpaceEx
|
||||||
public boolean isValidHide() {
|
public boolean isValidHide() {
|
||||||
return isSelect;
|
return isSelect;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
* @see com.github.gwtbootstrap.client.ui.Modal#show()
|
* @see com.github.gwtbootstrap.client.ui.Modal#show()
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@ -264,35 +210,15 @@ public class WorkspaceExplorerSaveDialog extends Modal implements HasWorskpaceEx
|
||||||
isSelect = false;
|
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.
|
* 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);
|
controller.setSelectableTypes(selectableTypes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the selectable types.
|
* Gets the selectable types.
|
||||||
|
@ -302,9 +228,10 @@ public class WorkspaceExplorerSaveDialog extends Modal implements HasWorskpaceEx
|
||||||
public List<ItemType> getSelectableTypes() {
|
public List<ItemType> getSelectableTypes() {
|
||||||
return controller.getSelectableTypes();
|
return controller.getSelectableTypes();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the showable items.
|
* Return the showable items.
|
||||||
|
*
|
||||||
* @return the showableTypes
|
* @return the showableTypes
|
||||||
*/
|
*/
|
||||||
public List<ItemType> getShowableTypes() {
|
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.
|
* 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);
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,8 +9,8 @@ import java.util.List;
|
||||||
import org.gcube.portlets.widgets.wsexplorer.client.WorkspaceExplorerConstants;
|
import org.gcube.portlets.widgets.wsexplorer.client.WorkspaceExplorerConstants;
|
||||||
import org.gcube.portlets.widgets.wsexplorer.client.WorkspaceExplorerController;
|
import org.gcube.portlets.widgets.wsexplorer.client.WorkspaceExplorerController;
|
||||||
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.notification.WorskpaceExplorerNotification.HasWorskpaceExplorerNotificationListener;
|
import org.gcube.portlets.widgets.wsexplorer.client.notification.WorkspaceExplorerSelectNotification.HasWorskpaceExplorerSelectNotificationListener;
|
||||||
import org.gcube.portlets.widgets.wsexplorer.client.notification.WorskpaceExplorerNotification.WorskpaceExplorerNotificationListener;
|
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.Item;
|
||||||
import org.gcube.portlets.widgets.wsexplorer.shared.ItemType;
|
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
|
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||||
* Jun 30, 2015
|
* 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 Button selectButton;
|
||||||
private WorkspaceExplorerSelectDialog INSTANCE = this;
|
private WorkspaceExplorerSelectDialog INSTANCE = this;
|
||||||
private boolean isSelect = false;
|
private boolean isSelect = false;
|
||||||
|
@ -45,14 +41,14 @@ public class WorkspaceExplorerSelectDialog extends Modal implements HasWorskpace
|
||||||
private ModalFooter footer = new ModalFooter();
|
private ModalFooter footer = new ModalFooter();
|
||||||
private Alert alertConfirm;
|
private Alert alertConfirm;
|
||||||
private WorkspaceExplorerController controller = new WorkspaceExplorerController();
|
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.
|
* 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 WorskpaceExplorerSelectNotificationListener} to receive events
|
||||||
*/
|
*/
|
||||||
public WorkspaceExplorerSelectDialog(String captionTxt) {
|
public WorkspaceExplorerSelectDialog(String captionTxt) {
|
||||||
WorkspaceExplorerController.eventBus.fireEvent(new LoadRootEvent());
|
WorkspaceExplorerController.eventBus.fireEvent(new LoadRootEvent());
|
||||||
|
@ -86,7 +82,7 @@ public class WorkspaceExplorerSelectDialog extends Modal implements HasWorskpace
|
||||||
* @param selectableTypes the selectable types
|
* @param selectableTypes the selectable types
|
||||||
* @param showableTypes the showable 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) {
|
public WorkspaceExplorerSelectDialog(String captionTxt, List<ItemType> selectableTypes, List<ItemType> showableTypes) {
|
||||||
if(selectableTypes!=null){
|
if(selectableTypes!=null){
|
||||||
|
@ -116,10 +112,11 @@ public class WorkspaceExplorerSelectDialog extends Modal implements HasWorskpace
|
||||||
setAnimation(false);
|
setAnimation(false);
|
||||||
setCloseVisible(true);
|
setCloseVisible(true);
|
||||||
setTitle(this.captionTxt);
|
setTitle(this.captionTxt);
|
||||||
selectButton = new Button(SELECT);
|
selectButton = new Button(WorkspaceExplorerConstants.SELECT);
|
||||||
selectButton.setType(ButtonType.PRIMARY);
|
selectButton.setType(ButtonType.PRIMARY);
|
||||||
setWidth(WIDHT_DIALOG);
|
setWidth(WorkspaceExplorerConstants.WIDHT_DIALOG);
|
||||||
setMaxHeigth(MAX_HEIGHT_DIALOG);
|
setMaxHeigth(WorkspaceExplorerConstants.MAX_HEIGHT_DIALOG);
|
||||||
|
|
||||||
hide(false);
|
hide(false);
|
||||||
|
|
||||||
addHideHandler(new HideHandler() {
|
addHideHandler(new HideHandler() {
|
||||||
|
@ -209,7 +206,7 @@ public class WorkspaceExplorerSelectDialog extends Modal implements HasWorskpace
|
||||||
*/
|
*/
|
||||||
private void notifySelectedItem(Item selected){
|
private void notifySelectedItem(Item selected){
|
||||||
|
|
||||||
for (WorskpaceExplorerNotificationListener worskpaceExplorerNotificationListener : listeners) {
|
for (WorskpaceExplorerSelectNotificationListener worskpaceExplorerNotificationListener : listeners) {
|
||||||
worskpaceExplorerNotificationListener.onSelectedItem(selected);
|
worskpaceExplorerNotificationListener.onSelectedItem(selected);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -219,7 +216,7 @@ public class WorkspaceExplorerSelectDialog extends Modal implements HasWorskpace
|
||||||
*/
|
*/
|
||||||
private void notifyAborted(){
|
private void notifyAborted(){
|
||||||
|
|
||||||
for (WorskpaceExplorerNotificationListener worskpaceExplorerNotificationListener : listeners) {
|
for (WorskpaceExplorerSelectNotificationListener worskpaceExplorerNotificationListener : listeners) {
|
||||||
worskpaceExplorerNotificationListener.onAborted();
|
worskpaceExplorerNotificationListener.onAborted();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -232,7 +229,7 @@ public class WorkspaceExplorerSelectDialog extends Modal implements HasWorskpace
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
private void notifyFailed(Throwable t){
|
private void notifyFailed(Throwable t){
|
||||||
|
|
||||||
for (WorskpaceExplorerNotificationListener worskpaceExplorerNotificationListener : listeners) {
|
for (WorskpaceExplorerSelectNotificationListener worskpaceExplorerNotificationListener : listeners) {
|
||||||
worskpaceExplorerNotificationListener.onFailed(t);
|
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)
|
* @see org.gcube.portlets.widgets.wsexplorer.client.notification.WorskpaceExplorerNotification.HasWorskpaceExplorerNotificationListener#addWorkspaceExplorerNotificationListener(org.gcube.portlets.widgets.wsexplorer.client.notification.WorskpaceExplorerNotification.WorskpaceExplorerNotificationListener)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void addWorkspaceExplorerNotificationListener(WorskpaceExplorerNotificationListener handler) {
|
public void addWorkspaceExplorerSelectNotificationListener(WorskpaceExplorerSelectNotificationListener handler) {
|
||||||
if(handler!=null)
|
if(handler!=null)
|
||||||
listeners.add(handler);
|
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)
|
* @see org.gcube.portlets.widgets.wsexplorer.client.notification.WorskpaceExplorerNotification.HasWorskpaceExplorerNotificationListener#removeWorkspaceExplorerNotificationListener(org.gcube.portlets.widgets.wsexplorer.client.notification.WorskpaceExplorerNotification.WorskpaceExplorerNotificationListener)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void removeWorkspaceExplorerNotificationListener(WorskpaceExplorerNotificationListener handler) {
|
public void removeWorkspaceExplorerSelectNotificationListener(WorskpaceExplorerSelectNotificationListener handler) {
|
||||||
if(handler!=null){
|
if(handler!=null){
|
||||||
if(listeners.contains(handler))
|
if(listeners.contains(handler))
|
||||||
listeners.remove(handler);
|
listeners.remove(handler);
|
||||||
|
|
Loading…
Reference in New Issue