private PickupDragController dragController;
+ @Override
public void onModuleLoad() {
// Initialize the singleton before calling the constructors of the
// various widgets that might call GSS.get().
String initToken = History.getToken();
if(initToken.length() == 0)
History.newItem("Files");
-
-
// Add history listener to handle any history events
- History.addValueChangeHandler(new ValueChangeHandler<String>() {
- public void onValueChange(ValueChangeEvent<String> event) {
- String tokenInput = event.getValue();
- String historyToken = handleSpecialFolderNames(tokenInput);
- GWT.log("tokenInput ='" +tokenInput+"'");
- try {
- if(historyToken.equals("Search"))
- inner.selectTab(2);
- else if(historyToken.equals("Groups"))
- inner.selectTab(1);
- else if(historyToken.equals("Files")|| historyToken.length()==0)
- inner.selectTab(0);
- else {
- PopupTree popupTree = GSS.get().getFolders().getPopupTree();
- TreeItem treeObj = GSS.get().getFolders().getPopupTree().getTreeItem(historyToken);
- SelectionEvent.fire(popupTree, treeObj);
+ History.addValueChangeHandler(new ValueChangeHandler<String>() {
+ @Override
+ public void onValueChange(ValueChangeEvent<String> event) {
+ String tokenInput = event.getValue();
+ String historyToken = handleSpecialFolderNames(tokenInput);
+ try {
+ if(historyToken.equals("Search"))
+ inner.selectTab(2);
+ else if(historyToken.equals("Groups"))
+ inner.selectTab(1);
+ else if(historyToken.equals("Files")|| historyToken.length()==0)
+ inner.selectTab(0);
+ else {
+ PopupTree popupTree = GSS.get().getFolders().getPopupTree();
+ TreeItem treeObj = GSS.get().getFolders().getPopupTree().getTreeItem(historyToken);
+ SelectionEvent.fire(popupTree, treeObj);
}
- } catch (IndexOutOfBoundsException e) {
- inner.selectTab(0);
- }
- }
- });
+ } catch (IndexOutOfBoundsException e) {
+ inner.selectTab(0);
+ }
+ }
+ });
// Add the left and right panels to the split panel.
splitPanel.setLeftWidget(folders);
// sizes have been computed by the browser.
DeferredCommand.addCommand(new Command() {
+ @Override
public void execute() {
onWindowResized(Window.getClientHeight());
}
if (announcement != null)
DeferredCommand.addCommand(new Command() {
+ @Override
public void execute() {
displayInformation(announcement);
}
DeferredCommand.addCommand(new Command() {
+ @Override
public void execute() {
fetchUser(username);
}
* @return the formated token with a "/" at the end or the same tokenInput parameter
*/
- public String handleSpecialFolderNames(String tokenInput){
+ private String handleSpecialFolderNames(String tokenInput){
List<String> pathsToCheck = Arrays.asList("Files/trash", "Files/shared", "Files/others");
if(pathsToCheck.contains(tokenInput))
return tokenInput + "/";
return tokenInput;
}
+
+ /**
+ * Reject illegal resource names, like '.' or '..'.
+ */
+ static boolean isValidResourceName(String name) {
+ if (".".equals(name) || "..".equals(name))
+ return false;
+ return true;
+ }
+
+
}