};
pasteItem = new MenuItem("<span>" + AbstractImagePrototype.create(newImages.paste()).getHTML() + " Paste</span>", true, new PasteCommand(this));
+ pasteItem.getElement().setId("FileContextMenu.paste");
RestResource sel = GSS.get().getTreeView().getSelection();
MenuBar contextMenu = new MenuBar(true);
if (isEmpty) {
contextMenu.addItem("<span>" + AbstractImagePrototype.create(newImages.fileUpdate()).getHTML() + " Upload</span>", true, new UploadFileCommand(this));
*/
if(sel instanceof RestResourceWrapper && !(sel instanceof TrashFolderResource)){
- contextMenu.addItem("<span>" + AbstractImagePrototype.create(newImages.fileUpdate()).getHTML() + " Upload</span>", true, new UploadFileCommand(this));
+ MenuItem upload = new MenuItem("<span>" + AbstractImagePrototype.create(newImages.fileUpdate()).getHTML() + " Upload</span>", true, new UploadFileCommand(this));
+ upload.getElement().setId("fileContextMenu.upload");
+ contextMenu.addItem(upload);
}
- contextMenu.addItem("<span>" + AbstractImagePrototype.create(images.refresh()).getHTML() + " Refresh</span>", true, new RefreshCommand(this, images));
+ MenuItem refresh = new MenuItem("<span>" + AbstractImagePrototype.create(images.refresh()).getHTML() + " Refresh</span>", true, new RefreshCommand(this, images));
+ refresh.getElement().setId("fileContextMenu.refresh");
+ contextMenu.addItem(refresh);
} else if (isTrash) {
- contextMenu.addItem("<span>" + AbstractImagePrototype.create(newImages.versions()).getHTML() + " Restore</span>", true, new RestoreTrashCommand(this));
- contextMenu.addItem("<span>" + AbstractImagePrototype.create(newImages.delete()).getHTML() + " Delete</span>", true, new DeleteCommand(this, images));
+ MenuItem restore = new MenuItem("<span>" + AbstractImagePrototype.create(newImages.versions()).getHTML() + " Restore</span>", true, new RestoreTrashCommand(this));
+ restore.getElement().setId("fileContextMenu.restore");
+ contextMenu.addItem(restore);
+
+ MenuItem delete = new MenuItem("<span>" + AbstractImagePrototype.create(newImages.delete()).getHTML() + " Delete</span>", true, new DeleteCommand(this, images));
+ delete.getElement().setId("fileContextMenu.delete");
+ contextMenu.addItem(delete);
} else {
final Command unselectAllCommand = new Command() {
}
};
cutItem = new MenuItem("<span>" + AbstractImagePrototype.create(newImages.cut()).getHTML() + " Cut</span>", true, new CutCommand(this));
+ cutItem.getElement().setId("fileContextMenu.cut");
+
copyItem = new MenuItem("<span>" + AbstractImagePrototype.create(newImages.copy()).getHTML() + " Copy</span>", true, new CopyCommand(this));
-
+ copyItem.getElement().setId("fileContextMenu.copy");
+
updateItem = new MenuItem("<span>" + AbstractImagePrototype.create(newImages.fileUpdate()).getHTML() + " Upload</span>", true, new UploadFileCommand(this));
+ updateItem.getElement().setId("fileContextMenu.upload");
trashItem = new MenuItem("<span>" + AbstractImagePrototype.create(newImages.emptyTrash()).getHTML() + " Move to Trash</span>", true, new ToTrashCommand(this));
+ trashItem.getElement().setId("fileContextMenu.moveToTrash");
+
deleteItem = new MenuItem("<span>" + AbstractImagePrototype.create(newImages.delete()).getHTML() + " Delete</span>", true, new DeleteCommand(this, images));
+ deleteItem.getElement().setId("fileContextMenu.delete");
sharingItem = new MenuItem("<span>" + AbstractImagePrototype.create(newImages.sharing()).getHTML() + " Sharing</span>", true, new PropertiesCommand(this, images, 1));
+ sharingItem.getElement().setId("fileContextMenu.sharing");
+
propItem = new MenuItem("<span>" + AbstractImagePrototype.create(newImages.viewText()).getHTML() + " Properties</span>", true, new PropertiesCommand(this, images, 0));
+ propItem.getElement().setId("fileContextMenu.properties");
if(sel!=null && sel instanceof FolderResource)
String[] link = {"", ""};
gss.getTopPanel().getFileMenu().createDownloadLink(link, false);
downloadItem = new MenuItem("<span>" + link[0] + AbstractImagePrototype.create(newImages.download()).getHTML() + " Download" + link[1] + "</span>", true, downloadCmd);
+ downloadItem.getElement().setId("fileContextMenu.download");
contextMenu.addItem(downloadItem);
+
gss.getTopPanel().getFileMenu().createDownloadLink(link, true);
saveAsItem = new MenuItem("<span>" + link[0] + AbstractImagePrototype.create(newImages.download()).getHTML() + " Save As" + link[1] + "</span>", true, downloadCmd);
+ saveAsItem.getElement().setId("fileContextMenu.saveAs");
contextMenu.addItem(saveAsItem);
contextMenu.addItem(cutItem);
contextMenu.addItem(copyItem);
if(sel!=null && sel instanceof FolderResource)
contextMenu.addItem(pasteItem);
- contextMenu.addItem("<span>" + AbstractImagePrototype.create(images.unselectAll()).getHTML() + " Unselect</span>", true, unselectAllCommand);
+ MenuItem unSelect = new MenuItem("<span>" + AbstractImagePrototype.create(images.unselectAll()).getHTML() + " Unselect</span>", true, unselectAllCommand);
+ unSelect.getElement().setId("fileContextMenu.unSelect");
+ contextMenu.addItem(unSelect);
+
contextMenu.addItem(trashItem);
contextMenu.addItem(deleteItem);
- contextMenu.addItem("<span>" + AbstractImagePrototype.create(images.refresh()).getHTML() + " Refresh</span>", true, new RefreshCommand(this, images));
+
+ MenuItem refresh = new MenuItem("<span>" + AbstractImagePrototype.create(images.refresh()).getHTML() + " Refresh</span>", true, new RefreshCommand(this, images));
+ refresh.getElement().setId("fileContextMenu.refresh");
+ contextMenu.addItem(refresh);
+
contextMenu.addItem(sharingItem);
contextMenu.addItem(propItem);
}
sb.appendHtmlConstant("</td>");
// Add the name and address.
- sb.appendHtmlConstant("<td style='font-size:95%;'>");
+ DisplayHelper.log("value.getName()");
+ sb.appendHtmlConstant("<td style='font-size:95%;' id='"+value.getName()+"'>");
sb.appendEscaped(value.getName());
sb.appendHtmlConstant("</td></tr><tr><td>");
sb.appendEscaped(value.getFileSizeAsString());
@Override
public SafeHtml getValue(FileResource object) {
SafeHtmlBuilder sb = new SafeHtmlBuilder();
- if (object.getContentType().endsWith("png") || object.getContentType().endsWith("gif") || object.getContentType().endsWith("jpeg") ){
-
+ if (object.getContentType().endsWith("png") || object.getContentType().endsWith("gif") || object.getContentType().endsWith("jpeg") ){
+ sb.appendHtmlConstant("<span id='fileList."+ object.getName() +"'>");
sb.appendEscaped(object.getName());
+ sb.appendHtmlConstant("</span>");
sb.appendHtmlConstant(" <a href='" +
GSS.get().getTopPanel().getFileMenu().getDownloadURL(object) +
"' title='" + object.getOwner() + " : " + object.getPath() + object.getName() +
}
- else
+ else{
+ sb.appendHtmlConstant("<span id='fileList."+ object.getName() +"'>");
sb.appendEscaped(object.getName());
+ sb.appendHtmlConstant("</span>");
+ }
return sb.toSafeHtml();
}
com.google.gwt.dom.client.Element helper = event.getHelper();
SafeHtmlBuilder sb = new SafeHtmlBuilder();
sb.appendHtmlConstant("<b>");
+ DisplayHelper.log(value.getName());
sb.appendEscaped(value.getName());
sb.appendHtmlConstant("</b>");
helper.setInnerHTML(sb.toSafeHtml().asString());
\r
}\r
}, ContextMenuEvent.getType());\r
+ tree.getElement().setId("groupsList.tree");\r
tree.addSelectionHandler(this);\r
tree.addOpenHandler(this);\r
tree.setAnimationEnabled(true);\r
for (int i = 0; i < groupList.size(); i++) {\r
final TreeItem item = new TreeItem();\r
item.setWidget(imageItemHTML(images.groupImage(), groupList.get(i).getName(),item));\r
- item.setUserObject(groupList.get(i)); \r
-// item.getElement().setId("groupsList."+ groupList.get(i).getName());\r
+ item.setUserObject(groupList.get(i));\r
tree.addItem(item);\r
updateUsers(item);\r
}\r
super.onBrowserEvent(event);\r
\r
}\r
- };\r
+ }; \r
link.sinkEvents(Event.ONMOUSEDOWN);\r
+ link.sinkEvents(Event.ONCONTEXTMENU);\r
+ link.sinkEvents(Event.ONCLICK);\r
+ link.sinkEvents(Event.ONKEYDOWN);\r
return link;\r
}\r
\r
--- /dev/null
+/*
+ * Copyright 2011 Electronic Business Systems Ltd.
+ *
+ * This file is part of GSS.
+ *
+ * GSS is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * GSS is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GSS. If not, see <http://www.gnu.org/licenses/>.
+ */
+package gr.ebs.gss.client.selenium.file;
+
+
+import gr.ebs.gss.client.selenium.folder.ActionUtils;
+
+import org.junit.After;
+import org.junit.Before;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.firefox.FirefoxDriver;
+
+
+/**
+ * @author natasa
+ *
+ */
+public class TestFileBasics {
+
+ ActionUtils action;
+
+ WebDriver driver;
+
+ String url = "http://127.0.0.1:8080/pithos/login?next=http://127.0.0.1:8080/pithos/";
+
+ String fileName = "";
+
+ String groupName = "Wookiees";
+
+ String userName = "past@ebs.gr";
+
+ String addUserName = "lakis@ebs.gr";
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @Before
+ public void setUp() throws Exception {
+
+ driver = new FirefoxDriver();
+
+ action = new ActionUtils(driver);
+
+ action.getUrl(url);
+
+ // Necessary delay in order all dom elements to be created
+ Thread.sleep(3000);
+ }
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @After
+ public void tearDown() throws Exception {
+ action.quit();
+ }
+
+ public void clickAFile(String aFileName){
+ action.click(By.id(""));
+ }
+ public void selectFileMenu(){
+
+ }
+
+ /**
+ * TODO: Download a file below in a folder
+ * > select a file
+ * > select File > 'Download'
+ * > save file from the popup window to your hdd
+ *
+ */
+
+ /** TODO: Save As
+ * **** This action performs the same results to the above 'Download' option
+ */
+
+ /** TODO:Empty Trash
+ * > select a file
+ * > select File > 'Empty Trash'
+ * *** Notice: There is no confirmation before performing this action
+ */
+
+
+ /** TODO:. Refresh
+ * > select a file
+ * > select File > 'Refresh'
+ */
+
+ /**
+ * TODO: . Cut file
+ * > select a file
+ * > select Edit > 'Cut'
+ * > select a destination folder
+ * > click Edit > Paste on the destination folder
+ */
+
+ /** TODO: . Copy file
+ * > select a file
+ * > select Edit > 'Copy'
+ * > select a destination folder
+ * > click Edit > 'Paste' on the destination folder
+ *
+ */
+
+ /** TODO: . Move to Trash
+ * > select a file
+ * > select Edit > 'Move to Trash'
+ * > select Trash folder and your file is in the Trash
+ */
+ /**. Delete
+ * > select a file
+ * > select Edit > 'Move to Trash'
+ * > click Delete to confirm
+ * */
+
+ /** TODO:. Select All
+ * > select a file
+ * > select Edit > 'Select All' this action results to select all files that are inside home folder
+ */
+
+ /** TODO:. Unselect All
+ * > select a file
+ * > select Edit > 'Unselect All' this action results to unselect all files that are inside home folder
+ */
+
+}
--- /dev/null
+/*
+ * Copyright 2011 Electronic Business Systems Ltd.
+ *
+ * This file is part of GSS.
+ *
+ * GSS is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * GSS is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GSS. If not, see <http://www.gnu.org/licenses/>.
+ */
+package gr.ebs.gss.client.selenium.file;
+
+
+
+/**
+ * @author natasa
+ *
+ */
+public class TestFileProperties extends TestFileBasics{
+
+ /** TODO:. Rename a file
+ * > select a file
+ * > select File > 'Properties'
+ * > type a new file name in the Name input box
+ * > click 'Ok'
+ */
+
+ /** TODO:. Add a Tag to a file
+ * > select a file
+ * > select File > 'Properties'
+ * > type a word that represents a tag to the tag input box
+ * > click 'Ok'
+ */
+
+ /** TODO:. Add a Version to a file
+ * > select a file
+ * > select File > 'Properties'
+ * > select the 'Versions' tab
+ * > click on the Versioned check box
+ * > click 'Ok'
+ */
+
+ /** TODO:
+ * . Add a new version in an already versioned file
+ */
+
+ /** TODO:. Remove a Version from a file
+ *
+ */
+
+}
--- /dev/null
+/*
+ * Copyright 2011 Electronic Business Systems Ltd.
+ *
+ * This file is part of GSS.
+ *
+ * GSS is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * GSS is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GSS. If not, see <http://www.gnu.org/licenses/>.
+ */
+package gr.ebs.gss.client.selenium.file;
+
+
+
+/**
+ * @author natasa
+ *
+ */
+public class TestFileSharing extends TestFileBasics {
+
+}
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
+import com.google.gwt.user.client.ui.AbstractImagePrototype;
+import com.google.gwt.user.client.ui.HTML;
+import com.google.gwt.user.client.ui.TreeItem;
+import com.google.gwt.user.client.ui.Widget;
+
public class TestGroup {
ActionUtils action;
action.quit();
}
- @Test
+// @Test
public void createNewGroup() throws InterruptedException{
action.click(By.id(userName));
action.click(By.id("Groups"));
}
+ public void selectOneGroup(String aGroupName){
+ selectGroupsTab();
+
+ action.click(By.id("groupsList." + aGroupName));
+ }
+
public void deleteGroup(String aGroupName) throws InterruptedException{
- selectGroupsTab();
+ selectOneGroup(aGroupName);
//right click on the groupName
//TODO: Problem on displaying the context menu
- action.sendRightClick(By.id("groupsList." + aGroupName));
+ /**
+ * NOTES: Context menu denies to be displayed
+ * Unsuccessful scenarios:
+ * id placed in:
+ *
+ * 1.addImageItem() method
+ * TreeItem item = new TreeItem();
+ * Widget aWidget = imageItemHTML(imageProto, title,item);
+ * aWidget.getElement().setId("groupsList."+title);
+ * item.setWidget(aWidget);
+ *
+ * 2.imageItemHTML either in <a id =""></a> or in <span id=""></span>
+ *
+ * 3. changed the HTML link to
+ * final HTML link = new HTML("<span id='groupsList."+title+"'>"+AbstractImagePrototype.create(imageProto).getHTML() + " " + title + "</span>"){
+ * or to
+ * final HTML link = new HTML(AbstractImagePrototype.create(imageProto).getHTML() +"<span id='groupsList."+title+"'>" + " " + title + "</span>"){
+ *
+ * 4. TODO: addKeyDown/keyUpHandler or catch the events the webDriver creates in the imageItemHTML
+
+ */
+
+ action.sendRightClick(By.id("groupsList.tree"));
- Thread.sleep(1000);
+ Thread.sleep(2000);
//select 'Delete' option from right click context menu
action.click(By.id("groupContextMenu.delete"));
}
-// @Test(expected=org.openqa.selenium.NoSuchElementException.class)
+ @Test
+// (expected=org.openqa.selenium.NoSuchElementException.class)
public void testDeleteGroup() throws InterruptedException{
deleteGroup(groupName);
//TODO: test assertion
- Assert.assertEquals(groupName, action.getText(By.id("groupsList."+groupName)));
+// Assert.assertEquals(groupName, action.getText(By.id("groupsList."+groupName)));
}