256: Workspace explorer

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

Fixed bug NullPointer
Updated set height

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/widgets/workspace-explorer@117559 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2015-07-30 12:59:36 +00:00
parent b7a6998335
commit ac13de6141
8 changed files with 41 additions and 37 deletions

View File

@ -21,6 +21,8 @@ public class WorkspaceExplorerConstants {
// DIALOGS // DIALOGS
public static final String SAVE = "Save"; public static final String SAVE = "Save";
public static final String MAX_HEIGHT_DIALOG = "500px"; public static final String MAX_HEIGHT_DIALOG = "500px";
public static final String HEIGHT_EXPLORER_PANEL = "400px";
public static final String AUTO = "auto";
public static final int WIDHT_DIALOG = 730; public static final int WIDHT_DIALOG = 730;
public static final String SELECT = "Select"; public static final String SELECT = "Select";

View File

@ -56,10 +56,10 @@ public class WorkspaceExplorerController implements EventHandler {
/** /**
* Instantiates a new workspace explorer controller. * Instantiates a new workspace explorer controller.
*/ */
public WorkspaceExplorerController(){ public WorkspaceExplorerController(String heightPanel){
bindEvents(); bindEvents();
wsExplorer = new WorkspaceExplorer(); wsExplorer = new WorkspaceExplorer();
workspaceExplorerPanel = new WorkspaceExplorerPanel(5, wsExplorer.getPanel(), breadcrumbs, navigation); workspaceExplorerPanel = new WorkspaceExplorerPanel(5, wsExplorer.getPanel(), breadcrumbs, navigation, heightPanel);
} }
@ -68,10 +68,10 @@ public class WorkspaceExplorerController implements EventHandler {
* *
* @param filterCriteria the filter criteria * @param filterCriteria the filter criteria
*/ */
public WorkspaceExplorerController(FilterCriteria filterCriteria) { public WorkspaceExplorerController(FilterCriteria filterCriteria, String heightPanel) {
bindEvents(); bindEvents();
wsExplorer = new WorkspaceExplorer(filterCriteria); wsExplorer = new WorkspaceExplorer(filterCriteria);
workspaceExplorerPanel = new WorkspaceExplorerPanel(5, wsExplorer.getPanel(), breadcrumbs, navigation); workspaceExplorerPanel = new WorkspaceExplorerPanel(5, wsExplorer.getPanel(), breadcrumbs, navigation, heightPanel);
} }
/** /**

View File

@ -17,7 +17,7 @@ import com.google.gwt.user.client.ui.ScrollPanel;
public class WorkspaceExplorerPanel extends DockPanel{ public class WorkspaceExplorerPanel extends DockPanel{
public int width = 550; public int width = 550;
public int height = 400; // public int height = 400;
public int west_width = 150; public int west_width = 150;
private ScrollPanel westPanel = new ScrollPanel(); private ScrollPanel westPanel = new ScrollPanel();
@ -32,12 +32,11 @@ public class WorkspaceExplorerPanel extends DockPanel{
* @param breadcrumbs the breadcrumbs * @param breadcrumbs the breadcrumbs
* @param navigation the navigation * @param navigation the navigation
*/ */
public WorkspaceExplorerPanel(int splitterSize, ScrollPanel wsExplorer, Composite breadcrumbs, Composite navigation) { public WorkspaceExplorerPanel(int splitterSize, ScrollPanel wsExplorer, Composite breadcrumbs, Composite navigation, String heigth) {
// setStyleName("cw-DockPanel"); // setStyleName("cw-DockPanel");
ensureDebugId("WorkspaceNavigatorPanel"); ensureDebugId("WorkspaceNavigatorPanel");
// setSpacing(4); // setSpacing(4);
// setHorizontalAlignment(DockPanel.ALIGN_CENTER); // setHorizontalAlignment(DockPanel.ALIGN_CENTER);
add(breadcrumbs, DockPanel.NORTH); add(breadcrumbs, DockPanel.NORTH);
southPanel.ensureDebugId("SouthPanelWEP"); southPanel.ensureDebugId("SouthPanelWEP");
add(southPanel, DockPanel.SOUTH); add(southPanel, DockPanel.SOUTH);
@ -46,7 +45,7 @@ public class WorkspaceExplorerPanel extends DockPanel{
westPanel.add(navigation); westPanel.add(navigation);
add(westPanel, DockPanel.WEST); add(westPanel, DockPanel.WEST);
centerScrollable.setSize(width+"px", height+"px"); centerScrollable.setSize(width+"px", heigth);
centerScrollable.add(wsExplorer); centerScrollable.add(wsExplorer);
add(centerScrollable, DockPanel.CENTER); add(centerScrollable, DockPanel.CENTER);
} }

View File

@ -55,7 +55,7 @@ public class WorkspaceExplorerSaveDialog extends Modal implements HasWorskpaceEx
* @param fileName the file name * @param fileName the file name
*/ */
public WorkspaceExplorerSaveDialog(String captionTxt, String fileName) { public WorkspaceExplorerSaveDialog(String captionTxt, String fileName) {
controller = new WorkspaceExplorerController(); controller = new WorkspaceExplorerController(WorkspaceExplorerConstants.HEIGHT_EXPLORER_PANEL);
loadExplorer(captionTxt, fileName); loadExplorer(captionTxt, fileName);
} }
@ -67,7 +67,7 @@ public class WorkspaceExplorerSaveDialog extends Modal implements HasWorskpaceEx
* @param filterCriteria the filter criteria to filter for Mime Types, File Extensions, Properties * @param filterCriteria the filter criteria to filter for Mime Types, File Extensions, Properties
*/ */
public WorkspaceExplorerSaveDialog(String captionTxt, String fileName, FilterCriteria filterCriteria) { public WorkspaceExplorerSaveDialog(String captionTxt, String fileName, FilterCriteria filterCriteria) {
controller = new WorkspaceExplorerController(filterCriteria); controller = new WorkspaceExplorerController(filterCriteria, WorkspaceExplorerConstants.HEIGHT_EXPLORER_PANEL);
loadExplorer(captionTxt, fileName); loadExplorer(captionTxt, fileName);
} }
@ -79,14 +79,14 @@ public class WorkspaceExplorerSaveDialog extends Modal implements HasWorskpaceEx
* @param showOnlyFolders the show only folders * @param showOnlyFolders the show only folders
*/ */
public WorkspaceExplorerSaveDialog(String captionTxt, String fileName, boolean showOnlyFolders) { public WorkspaceExplorerSaveDialog(String captionTxt, String fileName, boolean showOnlyFolders) {
controller = new WorkspaceExplorerController(WorkspaceExplorerConstants.HEIGHT_EXPLORER_PANEL);
if (showOnlyFolders) { if (showOnlyFolders) {
ItemType[] itemsType = new ItemType[1]; ItemType[] itemsType = new ItemType[1];
itemsType[0] = ItemType.FOLDER; itemsType[0] = ItemType.FOLDER;
setSelectableTypes(itemsType); setSelectableTypes(itemsType);
setShowableTypes(itemsType); setShowableTypes(itemsType);
} }
controller = new WorkspaceExplorerController();
loadExplorer(captionTxt, fileName); loadExplorer(captionTxt, fileName);
} }
@ -97,14 +97,14 @@ public class WorkspaceExplorerSaveDialog extends Modal implements HasWorskpaceEx
* @param showOnlyFolders the show only folders * @param showOnlyFolders the show only folders
*/ */
public WorkspaceExplorerSaveDialog(String fileName, boolean showOnlyFolders) { public WorkspaceExplorerSaveDialog(String fileName, boolean showOnlyFolders) {
controller = new WorkspaceExplorerController(WorkspaceExplorerConstants.HEIGHT_EXPLORER_PANEL);
if (showOnlyFolders) { if (showOnlyFolders) {
ItemType[] itemsType = new ItemType[1]; ItemType[] itemsType = new ItemType[1];
itemsType[0] = ItemType.FOLDER; itemsType[0] = ItemType.FOLDER;
setSelectableTypes(itemsType); setSelectableTypes(itemsType);
setShowableTypes(itemsType); setShowableTypes(itemsType);
} }
controller = new WorkspaceExplorerController();
loadExplorer(WorkspaceExplorerConstants.WORKSPACE_EXPLORER_SAVE_AS_CAPTION, fileName); loadExplorer(WorkspaceExplorerConstants.WORKSPACE_EXPLORER_SAVE_AS_CAPTION, fileName);
} }
@ -117,13 +117,13 @@ public class WorkspaceExplorerSaveDialog extends Modal implements HasWorskpaceEx
* @param showableTypes the showable types * @param showableTypes the showable types
*/ */
public WorkspaceExplorerSaveDialog(String captionTxt, String fileName, List<ItemType> showableTypes) { public WorkspaceExplorerSaveDialog(String captionTxt, String fileName, List<ItemType> showableTypes) {
controller = new WorkspaceExplorerController(WorkspaceExplorerConstants.HEIGHT_EXPLORER_PANEL);
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));
} }
controller = new WorkspaceExplorerController();
loadExplorer(captionTxt, fileName); loadExplorer(captionTxt, fileName);
} }
@ -135,13 +135,13 @@ public class WorkspaceExplorerSaveDialog extends Modal implements HasWorskpaceEx
* @param showableTypes the showable types * @param showableTypes the showable types
*/ */
public WorkspaceExplorerSaveDialog(String fileName, List<ItemType> showableTypes) { public WorkspaceExplorerSaveDialog(String fileName, List<ItemType> showableTypes) {
controller = new WorkspaceExplorerController(WorkspaceExplorerConstants.HEIGHT_EXPLORER_PANEL);
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));
} }
controller = new WorkspaceExplorerController();
loadExplorer(WorkspaceExplorerConstants.WORKSPACE_EXPLORER_SAVE_AS_CAPTION, fileName); loadExplorer(WorkspaceExplorerConstants.WORKSPACE_EXPLORER_SAVE_AS_CAPTION, fileName);
} }

View File

@ -56,7 +56,7 @@ public class WorkspaceExplorerSavePanel extends ScrollPanel implements HasWorskp
* @param fileName the file name * @param fileName the file name
*/ */
public WorkspaceExplorerSavePanel(String fileName) { public WorkspaceExplorerSavePanel(String fileName) {
controller = new WorkspaceExplorerController(); controller = new WorkspaceExplorerController(WorkspaceExplorerConstants.AUTO);
loadExplorer(fileName); loadExplorer(fileName);
} }
@ -67,7 +67,7 @@ public class WorkspaceExplorerSavePanel extends ScrollPanel implements HasWorskp
* @param filterCriteria the filter criteria * @param filterCriteria the filter criteria
*/ */
public WorkspaceExplorerSavePanel(String fileName, FilterCriteria filterCriteria) { public WorkspaceExplorerSavePanel(String fileName, FilterCriteria filterCriteria) {
controller = new WorkspaceExplorerController(filterCriteria); controller = new WorkspaceExplorerController(filterCriteria, WorkspaceExplorerConstants.AUTO);
loadExplorer(fileName); loadExplorer(fileName);
} }
@ -78,14 +78,14 @@ public class WorkspaceExplorerSavePanel extends ScrollPanel implements HasWorskp
* @param showOnlyFolders the show only folders * @param showOnlyFolders the show only folders
*/ */
public WorkspaceExplorerSavePanel(String fileName, boolean showOnlyFolders) { public WorkspaceExplorerSavePanel(String fileName, boolean showOnlyFolders) {
controller = new WorkspaceExplorerController(WorkspaceExplorerConstants.AUTO);
if (showOnlyFolders) { if (showOnlyFolders) {
ItemType[] itemsType = new ItemType[1]; ItemType[] itemsType = new ItemType[1];
itemsType[0] = ItemType.FOLDER; itemsType[0] = ItemType.FOLDER;
setSelectableTypes(itemsType); setSelectableTypes(itemsType);
setShowableTypes(itemsType); setShowableTypes(itemsType);
} }
controller = new WorkspaceExplorerController();
loadExplorer(fileName); loadExplorer(fileName);
} }
@ -96,13 +96,13 @@ public class WorkspaceExplorerSavePanel extends ScrollPanel implements HasWorskp
* @param showableTypes the showable types * @param showableTypes the showable types
*/ */
public WorkspaceExplorerSavePanel(String fileName, List<ItemType> showableTypes) { public WorkspaceExplorerSavePanel(String fileName, List<ItemType> showableTypes) {
controller = new WorkspaceExplorerController(WorkspaceExplorerConstants.AUTO);
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));
} }
controller = new WorkspaceExplorerController();
loadExplorer(fileName); loadExplorer(fileName);
} }

View File

@ -52,7 +52,7 @@ public class WorkspaceExplorerSelectDialog extends Modal implements HasWorskpace
* *
*/ */
public WorkspaceExplorerSelectDialog(String captionTxt) { public WorkspaceExplorerSelectDialog(String captionTxt) {
controller = new WorkspaceExplorerController(); controller = new WorkspaceExplorerController(WorkspaceExplorerConstants.HEIGHT_EXPLORER_PANEL);
loadExplorer(captionTxt); loadExplorer(captionTxt);
} }
@ -63,7 +63,7 @@ public class WorkspaceExplorerSelectDialog extends Modal implements HasWorskpace
* @param filterCriteria the filter criteria * @param filterCriteria the filter criteria
*/ */
public WorkspaceExplorerSelectDialog(String captionTxt, FilterCriteria filterCriteria) { public WorkspaceExplorerSelectDialog(String captionTxt, FilterCriteria filterCriteria) {
controller = new WorkspaceExplorerController(filterCriteria); controller = new WorkspaceExplorerController(filterCriteria, WorkspaceExplorerConstants.HEIGHT_EXPLORER_PANEL);
loadExplorer(captionTxt); loadExplorer(captionTxt);
} }
@ -75,7 +75,7 @@ public class WorkspaceExplorerSelectDialog extends Modal implements HasWorskpace
* @param showOnlyFolders the show only folders * @param showOnlyFolders the show only folders
*/ */
public WorkspaceExplorerSelectDialog(String captionTxt, boolean showOnlyFolders) { public WorkspaceExplorerSelectDialog(String captionTxt, boolean showOnlyFolders) {
controller = new WorkspaceExplorerController(); controller = new WorkspaceExplorerController(WorkspaceExplorerConstants.HEIGHT_EXPLORER_PANEL);
if(showOnlyFolders){ if(showOnlyFolders){
ItemType[] itemsType = new ItemType[1]; ItemType[] itemsType = new ItemType[1];
itemsType[0] = ItemType.FOLDER; itemsType[0] = ItemType.FOLDER;
@ -95,7 +95,7 @@ public class WorkspaceExplorerSelectDialog extends Modal implements HasWorskpace
* You can implement {@link WorskpaceExplorerSelectNotificationListener} 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) {
controller = new WorkspaceExplorerController(); controller = new WorkspaceExplorerController(WorkspaceExplorerConstants.HEIGHT_EXPLORER_PANEL);
if(selectableTypes!=null){ if(selectableTypes!=null){
ItemType[] itemsType = new ItemType[selectableTypes.size()]; ItemType[] itemsType = new ItemType[selectableTypes.size()];
itemsType = selectableTypes.toArray(itemsType); itemsType = selectableTypes.toArray(itemsType);

View File

@ -51,7 +51,7 @@ public class WorkspaceExplorerSelectPanel extends ScrollPanel implements HasWors
* @param captionTxt the tool-tip of the panel * @param captionTxt the tool-tip of the panel
*/ */
public WorkspaceExplorerSelectPanel(String captionTxt) { public WorkspaceExplorerSelectPanel(String captionTxt) {
controller = new WorkspaceExplorerController(); controller = new WorkspaceExplorerController(WorkspaceExplorerConstants.AUTO);
loadExplorer(captionTxt); loadExplorer(captionTxt);
} }
@ -63,7 +63,7 @@ public class WorkspaceExplorerSelectPanel extends ScrollPanel implements HasWors
* @param filterCriteria the filter criteria * @param filterCriteria the filter criteria
*/ */
public WorkspaceExplorerSelectPanel(String captionTxt, FilterCriteria filterCriteria) { public WorkspaceExplorerSelectPanel(String captionTxt, FilterCriteria filterCriteria) {
controller = new WorkspaceExplorerController(filterCriteria); controller = new WorkspaceExplorerController(filterCriteria, WorkspaceExplorerConstants.AUTO);
loadExplorer(captionTxt); loadExplorer(captionTxt);
} }
@ -76,7 +76,7 @@ public class WorkspaceExplorerSelectPanel extends ScrollPanel implements HasWors
* @param showOnlyFolders the show only folders * @param showOnlyFolders the show only folders
*/ */
public WorkspaceExplorerSelectPanel(String captionTxt, boolean showOnlyFolders) { public WorkspaceExplorerSelectPanel(String captionTxt, boolean showOnlyFolders) {
controller = new WorkspaceExplorerController(); controller = new WorkspaceExplorerController(WorkspaceExplorerConstants.AUTO);
if(showOnlyFolders){ if(showOnlyFolders){
ItemType[] itemsType = new ItemType[1]; ItemType[] itemsType = new ItemType[1];
@ -97,7 +97,7 @@ public class WorkspaceExplorerSelectPanel extends ScrollPanel implements HasWors
* @param showableTypes the showable types * @param showableTypes the showable types
*/ */
public WorkspaceExplorerSelectPanel(String captionTxt, List<ItemType> selectableTypes, List<ItemType> showableTypes) { public WorkspaceExplorerSelectPanel(String captionTxt, List<ItemType> selectableTypes, List<ItemType> showableTypes) {
controller = new WorkspaceExplorerController(); controller = new WorkspaceExplorerController(WorkspaceExplorerConstants.AUTO);
if(selectableTypes!=null){ if(selectableTypes!=null){
ItemType[] itemsType = new ItemType[selectableTypes.size()]; ItemType[] itemsType = new ItemType[selectableTypes.size()];
itemsType = selectableTypes.toArray(itemsType); itemsType = selectableTypes.toArray(itemsType);

View File

@ -1,8 +1,11 @@
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent"> <!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder" xmlns:b="urn:import:com.github.gwtbootstrap.client.ui"> <ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:b="urn:import:com.github.gwtbootstrap.client.ui" xmlns:g="urn:import:com.google.gwt.user.client.ui">
<!-- <g:FlowPanel styleName="{style.pretty}"> --> <!-- <g:FlowPanel styleName="{style.pretty}"> -->
<b:FluidRow> <g:FlowPanel>
<b:Breadcrumbs ui:field="breadcrumbs"> <b:FluidRow>
</b:Breadcrumbs> <b:Breadcrumbs ui:field="breadcrumbs">
</b:FluidRow> </b:Breadcrumbs>
</b:FluidRow>
</g:FlowPanel>
</ui:UiBinder> </ui:UiBinder>