256: Workspace explorer
Task-Url: https://support.d4science.org/issues/256 Updated selectable and showable types git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/widgets/workspace-explorer@115619 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
140cf9ce2c
commit
9e5c9b538a
|
@ -50,6 +50,10 @@ public class WorkspaceExplorerController implements EventHandler {
|
||||||
workspaceExplorerPanel = new WorkspaceExplorerPanel(5, wsExplorer.getPanel(), breadcrumbs, navigation);
|
workspaceExplorerPanel = new WorkspaceExplorerPanel(5, wsExplorer.getPanel(), breadcrumbs, navigation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void loadRoot(){
|
||||||
|
wsExplorer.loadRoot();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Bind events.
|
* Bind events.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -13,13 +13,14 @@ import org.gcube.portlets.widgets.wsexplorer.client.notification.WorskpaceExplor
|
||||||
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.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.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.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;
|
||||||
import com.google.gwt.user.client.ui.Button;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -33,7 +34,7 @@ import com.google.gwt.user.client.ui.Button;
|
||||||
*/
|
*/
|
||||||
public class WorkspaceExplorerLoadDialog extends Modal implements HasWorskpaceExplorerNotificationListener{
|
public class WorkspaceExplorerLoadDialog extends Modal implements HasWorskpaceExplorerNotificationListener{
|
||||||
|
|
||||||
private Button openButton;
|
private Button selectButton;
|
||||||
private WorkspaceExplorerLoadDialog INSTANCE = this;
|
private WorkspaceExplorerLoadDialog INSTANCE = this;
|
||||||
private boolean isSelect = false;
|
private boolean isSelect = false;
|
||||||
private String captionTxt;
|
private String captionTxt;
|
||||||
|
@ -49,13 +50,23 @@ public class WorkspaceExplorerLoadDialog extends Modal implements HasWorskpaceEx
|
||||||
* Add {@link WorskpaceExplorerNotificationListener} to receive events
|
* Add {@link WorskpaceExplorerNotificationListener} to receive events
|
||||||
*/
|
*/
|
||||||
public WorkspaceExplorerLoadDialog(String captionTxt) {
|
public WorkspaceExplorerLoadDialog(String captionTxt) {
|
||||||
|
controller.loadRoot();
|
||||||
|
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;
|
this.captionTxt = (captionTxt==null || captionTxt.isEmpty())?WorkspaceExplorerConstants.WORKSPACE_EXPLORER_CAPTION:captionTxt;
|
||||||
// setText(this.captionTxt);
|
|
||||||
setAnimation(false);
|
setAnimation(false);
|
||||||
setCloseVisible(true);
|
setCloseVisible(true);
|
||||||
setTitle(this.captionTxt);
|
setTitle(this.captionTxt);
|
||||||
openButton = new Button("Open");
|
selectButton = new Button("Select");
|
||||||
|
selectButton.setType(ButtonType.PRIMARY);
|
||||||
setWidth(710);
|
setWidth(710);
|
||||||
// setHeight("650px");
|
// setHeight("650px");
|
||||||
setMaxHeigth("500px");
|
setMaxHeigth("500px");
|
||||||
|
@ -93,6 +104,8 @@ public class WorkspaceExplorerLoadDialog extends Modal implements HasWorskpaceEx
|
||||||
//
|
//
|
||||||
// dock.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
|
// dock.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
|
||||||
// dock.setWidth("100%");
|
// dock.setWidth("100%");
|
||||||
|
|
||||||
|
|
||||||
add(controller.getWorkspaceExplorerPanel());
|
add(controller.getWorkspaceExplorerPanel());
|
||||||
|
|
||||||
// okButton.addClickHandler(new ClickHandler() {
|
// okButton.addClickHandler(new ClickHandler() {
|
||||||
|
@ -102,7 +115,7 @@ public class WorkspaceExplorerLoadDialog extends Modal implements HasWorskpaceEx
|
||||||
//
|
//
|
||||||
// }
|
// }
|
||||||
// });
|
// });
|
||||||
openButton.addClickHandler(new ClickHandler() {
|
selectButton.addClickHandler(new ClickHandler() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(ClickEvent event) {
|
public void onClick(ClickEvent event) {
|
||||||
|
@ -117,11 +130,39 @@ public class WorkspaceExplorerLoadDialog extends Modal implements HasWorskpaceEx
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
footer.add(openButton);
|
footer.add(selectButton);
|
||||||
|
|
||||||
add(footer);
|
add(footer);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new workspace explorer load 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
|
||||||
|
*
|
||||||
|
* Add {@link WorskpaceExplorerNotificationListener} to receive events
|
||||||
|
*/
|
||||||
|
public WorkspaceExplorerLoadDialog(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));
|
||||||
|
}
|
||||||
|
|
||||||
|
controller.loadRoot();
|
||||||
|
initDialog(captionTxt);
|
||||||
|
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Notify selected item.
|
* Notify selected item.
|
||||||
*
|
*
|
||||||
|
@ -149,6 +190,7 @@ public class WorkspaceExplorerLoadDialog extends Modal implements HasWorskpaceEx
|
||||||
*
|
*
|
||||||
* @param t the t
|
* @param t the t
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("unused")
|
||||||
private void notifyFailed(Throwable t){
|
private void notifyFailed(Throwable t){
|
||||||
|
|
||||||
for (WorskpaceExplorerNotificationListener worskpaceExplorerNotificationListener : listeners) {
|
for (WorskpaceExplorerNotificationListener worskpaceExplorerNotificationListener : listeners) {
|
||||||
|
@ -208,7 +250,7 @@ public class WorkspaceExplorerLoadDialog extends Modal implements HasWorskpaceEx
|
||||||
* Set which items are selectable.
|
* Set which items are selectable.
|
||||||
* @param selectableTypes the selectableTypes to set
|
* @param selectableTypes the selectableTypes to set
|
||||||
*/
|
*/
|
||||||
public void setSelectableTypes(ItemType ... selectableTypes) {
|
private void setSelectableTypes(ItemType ... selectableTypes) {
|
||||||
controller.setSelectableTypes(selectableTypes);
|
controller.setSelectableTypes(selectableTypes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -234,7 +276,7 @@ public class WorkspaceExplorerLoadDialog 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
|
||||||
*/
|
*/
|
||||||
public void setShowableTypes(ItemType ... showableTypes) {
|
private void setShowableTypes(ItemType ... showableTypes) {
|
||||||
controller.setShowableTypes(showableTypes);
|
controller.setShowableTypes(showableTypes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,10 +70,6 @@ public class WorkspaceExplorer implements ShowableTypes, SelectableTypes{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void loadItems(){
|
|
||||||
loadRoot();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the panel in loading mode.
|
* Set the panel in loading mode.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -12,8 +12,8 @@ package org.gcube.portlets.widgets.wsexplorer.shared;
|
||||||
*/
|
*/
|
||||||
public enum ItemType {
|
public enum ItemType {
|
||||||
|
|
||||||
ROOT,
|
ROOT, //MANDATORY
|
||||||
FOLDER,
|
FOLDER, //MANDATORY
|
||||||
EXTERNAL_IMAGE,
|
EXTERNAL_IMAGE,
|
||||||
EXTERNAL_FILE,
|
EXTERNAL_FILE,
|
||||||
EXTERNAL_PDF_FILE,
|
EXTERNAL_PDF_FILE,
|
||||||
|
|
Loading…
Reference in New Issue