added feature to customize the message in case of empty list
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/widgets/workspace-explorer@174471 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
a3398cbd9a
commit
dfb325deec
|
@ -143,9 +143,9 @@ public class WorkspaceExplorerSelectDialog extends Modal implements HasWorskpace
|
|||
}
|
||||
|
||||
loadExplorer(captionTxt, null, null);
|
||||
customizeEmptyMessage(showOnlyFolders);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Instantiates a new workspace explorer select dialog.
|
||||
*
|
||||
|
@ -181,6 +181,7 @@ public class WorkspaceExplorerSelectDialog extends Modal implements HasWorskpace
|
|||
}
|
||||
|
||||
loadExplorer(captionTxt, baseFolderId, baseFolderName);
|
||||
customizeEmptyMessage(showOnlyFolders);
|
||||
}
|
||||
|
||||
|
||||
|
@ -207,6 +208,7 @@ public class WorkspaceExplorerSelectDialog extends Modal implements HasWorskpace
|
|||
}
|
||||
|
||||
loadExplorer(captionTxt, baseFolderId, baseFolderName);
|
||||
customizeEmptyMessage(showOnlyFolders);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -235,35 +237,15 @@ public class WorkspaceExplorerSelectDialog extends Modal implements HasWorskpace
|
|||
loadExplorer(captionTxt, null, null);
|
||||
}
|
||||
|
||||
|
||||
// /**
|
||||
// * Load explorer.
|
||||
// * If folder id is null or empty the explorer loads the root element
|
||||
// * Otherwise, it loads the folder id
|
||||
// *
|
||||
// * @param captionTxt the caption txt
|
||||
// * @param folderId the folder id
|
||||
// */
|
||||
// private void loadExplorer(String captionTxt, String folderId){
|
||||
//
|
||||
// if(folderId==null || folderId.isEmpty())
|
||||
// controller.getEventBus().fireEvent(new LoadRootEvent());
|
||||
// else{
|
||||
// Item item = new Item(folderId, "", true);
|
||||
// controller.getEventBus().fireEvent(new LoadFolderEvent<Item>(item));
|
||||
// }
|
||||
// initDialog(captionTxt);
|
||||
// }
|
||||
|
||||
/**
|
||||
* Load explorer.
|
||||
* If folder id is null or empty the explorer loads the root element
|
||||
* Otherwise, it loads the folder id
|
||||
*
|
||||
* @param captionTxt the caption txt
|
||||
* @param folderId the folder id
|
||||
* @param baseFolderName the base folder name
|
||||
*/
|
||||
* Load explorer.
|
||||
* If folder id is null or empty the explorer loads the root element
|
||||
* Otherwise, it loads the folder id
|
||||
*
|
||||
* @param captionTxt the caption txt
|
||||
* @param folderId the folder id
|
||||
* @param baseFolderName the base folder name
|
||||
*/
|
||||
private void loadExplorer(String captionTxt, String folderId, String baseFolderName){
|
||||
|
||||
if(folderId==null || folderId.isEmpty())
|
||||
|
@ -275,6 +257,17 @@ public class WorkspaceExplorerSelectDialog extends Modal implements HasWorskpace
|
|||
initDialog(captionTxt);
|
||||
}
|
||||
|
||||
/**
|
||||
* Customize empty message.
|
||||
*
|
||||
* @param showOnlyFolders the show only folders
|
||||
*/
|
||||
private void customizeEmptyMessage(boolean showOnlyFolders){
|
||||
//AFTER THE INIT I'M CHANGING THE MESSAGE IN CASE OF ONLY FOLDER ARE SHWOWN
|
||||
if(showOnlyFolders)
|
||||
controller.getWsExplorer().getItTables().setEmptyTableMessage("No folder selectable here");
|
||||
}
|
||||
|
||||
/**
|
||||
* Inits the dialog.
|
||||
*
|
||||
|
|
|
@ -139,6 +139,7 @@ public class WorkspaceExplorerSelectPanel extends ScrollPanel implements HasWors
|
|||
setShowableTypes(itemsType);
|
||||
}
|
||||
loadExplorer(captionTxt, null);
|
||||
customizeEmptyMessage(showOnlyFolders);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -160,7 +161,15 @@ public class WorkspaceExplorerSelectPanel extends ScrollPanel implements HasWors
|
|||
setSelectableTypes(itemsType);
|
||||
setShowableTypes(itemsType);
|
||||
}
|
||||
|
||||
loadExplorer(captionTxt, baseFolderId);
|
||||
customizeEmptyMessage(showOnlyFolders);
|
||||
}
|
||||
|
||||
private void customizeEmptyMessage(boolean showOnlyFolders){
|
||||
//AFTER THE INIT I'M CHANGING THE MESSAGE IN CASE OF ONLY FOLDER ARE SHWOWN
|
||||
if(showOnlyFolders)
|
||||
controller.getWsExplorer().getItTables().setEmptyTableMessage("No folder selectable here");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -134,7 +134,8 @@ public class ItemsTable<T extends Item> extends AbstractItemsCellTable<T> implem
|
|||
//this.isAsyncronusTable = dataProvider instanceof AbstractDataProvider?true:false;
|
||||
this.isAsyncronusTable = dataProvider instanceof ListDataProvider?false:true;
|
||||
|
||||
sortedCellTable.setEmptyTableWidget(new Label(WorkspaceExplorerConstants.WORKSPACE_FOLDER_EMPTY_MESSAGE));
|
||||
//sortedCellTable.setEmptyTableWidget(new Label(WorkspaceExplorerConstants.WORKSPACE_FOLDER_EMPTY_MESSAGE));
|
||||
setEmptyTableMessage(WorkspaceExplorerConstants.WORKSPACE_FOLDER_EMPTY_MESSAGE);
|
||||
|
||||
if(this.displayFields.contains(DISPLAY_FIELD.ICON)){
|
||||
//ICONS
|
||||
|
@ -481,4 +482,16 @@ public class ItemsTable<T extends Item> extends AbstractItemsCellTable<T> implem
|
|||
public T getSelectedItem() {
|
||||
return ssm.getSelectedObject();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the empty table message.
|
||||
*
|
||||
* @param msg the new empty table message
|
||||
*/
|
||||
public void setEmptyTableMessage(String msg){
|
||||
msg = msg!=null&&!msg.isEmpty()?msg:WorkspaceExplorerConstants.WORKSPACE_FOLDER_EMPTY_MESSAGE;
|
||||
if(sortedCellTable!=null)
|
||||
sortedCellTable.setEmptyTableWidget(new Label(msg));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue