diff --git a/.classpath b/.classpath new file mode 100644 index 0000000..5cabfdb --- /dev/null +++ b/.classpath @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/.project b/.project new file mode 100644 index 0000000..6d50889 --- /dev/null +++ b/.project @@ -0,0 +1,59 @@ + + + workspace + workspace project + + + + + org.eclipse.wst.jsdt.core.javascriptValidator + + + + + org.eclipse.wst.common.project.facet.core.builder + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.wst.validation.validationbuilder + + + + + org.maven.ide.eclipse.maven2Builder + + + + + com.google.gdt.eclipse.core.webAppProjectValidator + + + + + com.google.gwt.eclipse.core.gwtProjectValidator + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.eclipse.m2e.core.maven2Nature + org.eclipse.jem.workbench.JavaEMFNature + org.eclipse.wst.common.modulecore.ModuleCoreNature + org.maven.ide.eclipse.maven2Nature + org.eclipse.jdt.core.javanature + org.eclipse.wst.common.project.facet.core.nature + org.eclipse.wst.jsdt.core.jsNature + com.google.gwt.eclipse.core.gwtNature + + diff --git a/.settings/.jsdtscope b/.settings/.jsdtscope new file mode 100644 index 0000000..ba3c245 --- /dev/null +++ b/.settings/.jsdtscope @@ -0,0 +1,15 @@ + + + + + + + + + + + + diff --git a/.settings/com.google.appengine.eclipse.core.prefs b/.settings/com.google.appengine.eclipse.core.prefs new file mode 100644 index 0000000..a60576c --- /dev/null +++ b/.settings/com.google.appengine.eclipse.core.prefs @@ -0,0 +1,3 @@ +#Thu Jun 16 10:18:26 CEST 2011 +eclipse.preferences.version=1 +filesCopiedToWebInfLib= diff --git a/.settings/com.google.gdt.eclipse.core.prefs b/.settings/com.google.gdt.eclipse.core.prefs new file mode 100644 index 0000000..2166963 --- /dev/null +++ b/.settings/com.google.gdt.eclipse.core.prefs @@ -0,0 +1,5 @@ +eclipse.preferences.version=1 +jarsExcludedFromWebInfLib= +lastWarOutDir=/home/backup-old-home/francesco-mangiacrapa/workspace/workspace/target/workspace-6.0.0-SNAPSHOT +warSrcDir=src/main/webapp +warSrcDirIsOutput=false diff --git a/.settings/com.google.gwt.eclipse.core.prefs b/.settings/com.google.gwt.eclipse.core.prefs new file mode 100644 index 0000000..c803c44 --- /dev/null +++ b/.settings/com.google.gwt.eclipse.core.prefs @@ -0,0 +1,5 @@ +#Thu Jun 16 11:14:17 CEST 2011 +eclipse.preferences.version=1 +entryPointModules= +filesCopiedToWebInfLib=gwt-servlet.jar +gwtCompileSettings=PGd3dC1jb21waWxlLXNldHRpbmdzPjxsb2ctbGV2ZWw+SU5GTzwvbG9nLWxldmVsPjxvdXRwdXQtc3R5bGU+T0JGVVNDQVRFRDwvb3V0cHV0LXN0eWxlPjxleHRyYS1hcmdzPjwhW0NEQVRBWy13YXIgc3JjL21haW4vd2ViYXBwXV0+PC9leHRyYS1hcmdzPjx2bS1hcmdzPjwhW0NEQVRBWy1YbXg1MTJtXV0+PC92bS1hcmdzPjxlbnRyeS1wb2ludC1tb2R1bGU+Y29tLmNvbXBhbnkuU29tZU1vZHVsZTwvZW50cnktcG9pbnQtbW9kdWxlPjwvZ3d0LWNvbXBpbGUtc2V0dGluZ3M+ diff --git a/.settings/org.eclipse.core.resources.prefs b/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..29abf99 --- /dev/null +++ b/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,6 @@ +eclipse.preferences.version=1 +encoding//src/main/java=UTF-8 +encoding//src/main/resources=UTF-8 +encoding//src/test/java=UTF-8 +encoding//src/test/resources=UTF-8 +encoding/=UTF-8 diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..69c31cd --- /dev/null +++ b/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.source=1.6 diff --git a/.settings/org.eclipse.m2e.core.prefs b/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 0000000..f897a7f --- /dev/null +++ b/.settings/org.eclipse.m2e.core.prefs @@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 diff --git a/.settings/org.eclipse.wst.common.component b/.settings/org.eclipse.wst.common.component new file mode 100644 index 0000000..d8e1cf1 --- /dev/null +++ b/.settings/org.eclipse.wst.common.component @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/.settings/org.eclipse.wst.common.project.facet.core.xml b/.settings/org.eclipse.wst.common.project.facet.core.xml new file mode 100644 index 0000000..fefc63a --- /dev/null +++ b/.settings/org.eclipse.wst.common.project.facet.core.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/.settings/org.eclipse.wst.jsdt.ui.superType.container b/.settings/org.eclipse.wst.jsdt.ui.superType.container new file mode 100644 index 0000000..3bd5d0a --- /dev/null +++ b/.settings/org.eclipse.wst.jsdt.ui.superType.container @@ -0,0 +1 @@ +org.eclipse.wst.jsdt.launching.baseBrowserLibrary \ No newline at end of file diff --git a/.settings/org.maven.ide.eclipse.prefs b/.settings/org.maven.ide.eclipse.prefs new file mode 100644 index 0000000..c74c58e --- /dev/null +++ b/.settings/org.maven.ide.eclipse.prefs @@ -0,0 +1,9 @@ +#Thu Sep 02 10:42:12 CEST 2010 +activeProfiles= +eclipse.preferences.version=1 +fullBuildGoals=process-test-resources +includeModules=false +resolveWorkspaceProjects=true +resourceFilterGoals=process-resources resources\:testResources +skipCompilerPlugin=true +version=1 diff --git a/WorkspacePortletTest-dev.launch b/WorkspacePortletTest-dev.launch new file mode 100644 index 0000000..ef6c811 --- /dev/null +++ b/WorkspacePortletTest-dev.launch @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/WorkspacePortletTest-prod.launch b/WorkspacePortletTest-prod.launch new file mode 100644 index 0000000..4c89edb --- /dev/null +++ b/WorkspacePortletTest-prod.launch @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..6968348 --- /dev/null +++ b/pom.xml @@ -0,0 +1,279 @@ + + 4.0.0 + + maven-parent + org.gcube.tools + 1.0.0 + + + + org.gcube.portlets.user + workspace + war + 6.0.0-SNAPSHOT + gCube Workspace Portlet + + gcube Workspace Portlet is a portlet for users workspace management + + + scm:svn:http://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/${project.artifactId} + scm:https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/${project.artifactId} + http://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/${project.artifactId} + + + + 2.4.0 + distro + + 1.6 + 1.6 + ${project.build.directory}/${project.build.finalName} + + UTF-8 + UTF-8 + + + + + + + xerces + xercesImpl + 2.9.1 + provided + + + com.google.gwt + gwt-user + ${gwtVersion} + provided + + + com.google.gwt + gwt-servlet + ${gwtVersion} + provided + + + com.sencha.gxt + gxt + 2.2.5 + provided + + + org.gcube.core + gcf + [1.4.0-SNAPSHOT, 2.0.0-SNAPSHOT) + provided + + + org.gcube.portlets.user + gcube-widgets + [1.4.0-SNAPSHOT, 2.0.0-SNAPSHOT) + provided + + + org.gcube.portal + custom-portal-handler + [1.2.0-SNAPSHOT, 2.0.0-SNAPSHOT) + provided + + + + org.gcube.applicationsupportlayer + aslcore + [3.2.0-SNAPSHOT, 4.0.0-SNAPSHOT) + provided + + + org.gcube.portal + social-networking-library + [1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT) + provided + + + org.gcube.portlets.user + workspace-tree-widget + [6.0.0-SNAPSHOT, 7.0.0-SNAPSHOT) + provided + + + org.gcube.contentmanagement + storage-resource-link-plugin + 1.0.0-SNAPSHOT + provided + + + org.gcube.portlets.user + wsmail-widget + [1.1.0-SNAPSHOT, 2.0.0-SNAPSHOT) + provided + + + org.gcube.portlets.user + home-library + [4.3.0-SNAPSHOT, 5.0.0-SNAPSHOT) + provided + + + org.gcube.portlets.user + home-library-jcr + [1.3.0-SNAPSHOT, 2.0.0-SNAPSHOT) + provided + + + org.gcube.dvos + usermanagement-core + [1.3.0-SNAPSHOT, 2.0.0-SNAPSHOT) + + + com.liferay.portal + portal-service + 6.0.6 + provided + + + javax.portlet + portlet-api + 2.0 + provided + + + org.slf4j + slf4j-log4j12 + 1.6.4 + runtime + + + org.slf4j + slf4j-api + 1.6.4 + runtime + + + junit + junit + 4.7 + test + + + javax.validation + validation-api + 1.0.0.GA + test + + + javax.validation + validation-api + 1.0.0.GA + sources + test + + + + + + ${webappDirectory}/WEB-INF/classes + + + + + + org.codehaus.mojo + gwt-maven-plugin + 2.4.0 + + + + compile + + + + + + + Messages.html + ${webappDirectory} + + + + + + org.apache.maven.plugins + maven-war-plugin + 2.1.1 + + + compile + + exploded + + + + + ${webappDirectory} + + + + org.apache.maven.plugins + maven-compiler-plugin + 2.3.2 + + 1.6 + 1.6 + + + + + org.apache.maven.plugins + maven-assembly-plugin + 2.2 + + + ${distroDirectory}/descriptor.xml + + + + + servicearchive + install + + single + + + + + + org.apache.maven.plugins + maven-resources-plugin + 2.5 + + + copy-profile + install + + copy-resources + + + target + + + ${distroDirectory} + true + + profile.xml + + + + + + + + + + + + diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/AppController.java b/src/main/java/org/gcube/portlets/user/workspace/client/AppController.java new file mode 100644 index 0000000..52a2da7 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/workspace/client/AppController.java @@ -0,0 +1,826 @@ +package org.gcube.portlets.user.workspace.client; + +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +import org.gcube.portlets.user.workspace.client.ConstantsExplorer.ViewSwitchType; +import org.gcube.portlets.user.workspace.client.ConstantsPortlet.ViewSwitchTypeInResult; +import org.gcube.portlets.user.workspace.client.event.ActiveGroupingView; +import org.gcube.portlets.user.workspace.client.event.ActiveGroupingViewHandler; +import org.gcube.portlets.user.workspace.client.event.AddFolderEvent; +import org.gcube.portlets.user.workspace.client.event.AddFolderEventHandler; +import org.gcube.portlets.user.workspace.client.event.AddSmartFolderEvent; +import org.gcube.portlets.user.workspace.client.event.DeleteItemEvent; +import org.gcube.portlets.user.workspace.client.event.DeleteItemEventHandler; +import org.gcube.portlets.user.workspace.client.event.DeleteMessageEvent; +import org.gcube.portlets.user.workspace.client.event.DeleteMessageEventHandler; +import org.gcube.portlets.user.workspace.client.event.DoubleClickElementSelectedEvent; +import org.gcube.portlets.user.workspace.client.event.DoubleClickElementSelectedEventHandler; +import org.gcube.portlets.user.workspace.client.event.FileDownloadEvent; +import org.gcube.portlets.user.workspace.client.event.FileDownloadEventHandler; +import org.gcube.portlets.user.workspace.client.event.FileUploadEvent; +import org.gcube.portlets.user.workspace.client.event.FileUploadEventHandler; +import org.gcube.portlets.user.workspace.client.event.FilterScopeEvent; +import org.gcube.portlets.user.workspace.client.event.GridElementSelectedEvent; +import org.gcube.portlets.user.workspace.client.event.GridElementSelectedEventHandler; +import org.gcube.portlets.user.workspace.client.event.GridElementUnSelectedEvent; +import org.gcube.portlets.user.workspace.client.event.GridElementUnSelectedEventHandler; +import org.gcube.portlets.user.workspace.client.event.ImagePreviewEvent; +import org.gcube.portlets.user.workspace.client.event.ImagePreviewEventHandler; +import org.gcube.portlets.user.workspace.client.event.LoadAllScopeEvent; +import org.gcube.portlets.user.workspace.client.event.LoadAllScopeEventHandler; +import org.gcube.portlets.user.workspace.client.event.OpenContextMenuTreeEvent; +import org.gcube.portlets.user.workspace.client.event.OpenContextMenuTreeEventHandler; +import org.gcube.portlets.user.workspace.client.event.OpenReportsEvent; +import org.gcube.portlets.user.workspace.client.event.OpenReportsEventHandler; +import org.gcube.portlets.user.workspace.client.event.PathElementSelectedEvent; +import org.gcube.portlets.user.workspace.client.event.PathElementSelectedEventHandler; +import org.gcube.portlets.user.workspace.client.event.PreviewMessageEvent; +import org.gcube.portlets.user.workspace.client.event.PreviewMessageEventHandler; +import org.gcube.portlets.user.workspace.client.event.RenameItemEvent; +import org.gcube.portlets.user.workspace.client.event.RenameItemEventHandler; +import org.gcube.portlets.user.workspace.client.event.SaveAttachmentsEvent; +import org.gcube.portlets.user.workspace.client.event.SaveAttachmentsEventHandler; +import org.gcube.portlets.user.workspace.client.event.SaveSmartFolderEvent; +import org.gcube.portlets.user.workspace.client.event.SaveSmartFolderEventHandler; +import org.gcube.portlets.user.workspace.client.event.ScopeChangeEvent; +import org.gcube.portlets.user.workspace.client.event.ScopeChangeEventHandler; +import org.gcube.portlets.user.workspace.client.event.SearchTextEvent; +import org.gcube.portlets.user.workspace.client.event.SearchTextEventHandler; +import org.gcube.portlets.user.workspace.client.event.SendMessageEvent; +import org.gcube.portlets.user.workspace.client.event.SendMessageEventHandler; +import org.gcube.portlets.user.workspace.client.event.WebDavUrlEvent; +import org.gcube.portlets.user.workspace.client.event.WebDavUrlEventHandler; +import org.gcube.portlets.user.workspace.client.interfaces.EventsTypeEnum; +import org.gcube.portlets.user.workspace.client.interfaces.SubscriberInterface; +import org.gcube.portlets.user.workspace.client.model.FileGridModel; +import org.gcube.portlets.user.workspace.client.model.FileModel; +import org.gcube.portlets.user.workspace.client.model.FolderModel; +import org.gcube.portlets.user.workspace.client.model.ScopeModel; +import org.gcube.portlets.user.workspace.client.view.WorskpacePortlet; +import org.gcube.portlets.user.workspace.client.view.panels.GxtBorderLayoutPanel; +import org.gcube.portlets.user.workspace.client.view.panels.GxtItemsPanel; +import org.gcube.portlets.user.workspace.client.view.windows.MessageBoxAlert; +import org.gcube.portlets.user.wsmail.client.forms.MailForm; + +import com.google.gwt.core.client.GWT; +import com.google.gwt.core.client.RunAsyncCallback; +import com.google.gwt.core.client.Scheduler; +import com.google.gwt.core.client.Scheduler.ScheduledCommand; +import com.google.gwt.event.shared.HandlerManager; +import com.google.gwt.user.client.Cookies; +import com.google.gwt.user.client.Window; +import com.google.gwt.user.client.rpc.AsyncCallback; +import com.google.gwt.user.client.ui.HasWidgets; + +/** + * + * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it + * + */ +public class AppController implements SubscriberInterface { + private final static HandlerManager eventBus = new HandlerManager(null); + private WorskpacePortlet wsPortlet = null; + private AppControllerExplorer appContrExplorer = null; + private String rootIdentifier = null; + public static boolean isSearchActive = false; + + public AppController(AppControllerExplorer appControllerExplorer) { + this.appContrExplorer = appControllerExplorer; + this.appContrExplorer.subscribe(this, new EventsTypeEnum[] { + EventsTypeEnum.RENAME_ITEM_EVENT, + EventsTypeEnum.SELECTED_ITEM_EVENT, + // EventsTypeEnum.EXPAND_FOLDER_EVENT, + EventsTypeEnum.ADDED_FOLDER_EVENT, + EventsTypeEnum.DELETE_ITEM_EVENT, + EventsTypeEnum.SUBTREE_LOAD_EVENT, + EventsTypeEnum.SMART_FOLDER_EVENT, + EventsTypeEnum.COMPLETED_FILE_UPLOAD_EVENT, + EventsTypeEnum.ADDED_FILE_EVENT, + EventsTypeEnum.MOVED_ITEM_EVENT, + EventsTypeEnum.LOAD_MESSAGES_EVENT, + EventsTypeEnum.SWITCH_VIEW_EVENT, + EventsTypeEnum.DELETED_MESSAGE, + EventsTypeEnum.MARK_MESSAGE_AS_READ, + EventsTypeEnum.REFRESH_FOLDER, + EventsTypeEnum.SELECTED_MESSAGE, + EventsTypeEnum.CREATE_NEW_MESSAGE, + EventsTypeEnum.REPLY_FORWARD_MESSAGE + }); + bind(); + } + + public static HandlerManager getEventBus() { + return eventBus; + } + + private void bind() { + // History.addValueChangeHandler(this); + + //********EVENTS TO NOTIFY SUBSCRIBERS + eventBus.addHandler(ActiveGroupingView.TYPE, new ActiveGroupingViewHandler() { + + @Override + public void onActiveGroupingView(ActiveGroupingView activeGroupingView) { + + if(activeGroupingView.isActiveGrouping()){ + setCookieGridViewSetting("true"); + wsPortlet.getGridGroupContainer().enableGrouping(); + } + else{ + setCookieGridViewSetting("false"); + wsPortlet.getGridGroupContainer().disableGrouping(); + } + + } + }); + + eventBus.addHandler(OpenReportsEvent.TYPE, new OpenReportsEventHandler() { + + @Override + public void onClickOpenReports(OpenReportsEvent openReportsEvent) { + + AppControllerExplorer.getEventBus().fireEvent(new OpenReportsEvent(openReportsEvent.getSourceFileModel())); + + } + }); + + eventBus.addHandler(PreviewMessageEvent.TYPE, new PreviewMessageEventHandler() { + + @Override + public void onPreviewMessage(PreviewMessageEvent previewMessageEvent) { + AppControllerExplorer.getEventBus().fireEvent(new PreviewMessageEvent(previewMessageEvent.getMessageIdentifier(), previewMessageEvent.getMessageType())); + + } + }); + + eventBus.addHandler(WebDavUrlEvent.TYPE, new WebDavUrlEventHandler() { + + @Override + public void onClickWebDavUrl(WebDavUrlEvent webDavUrlEvent) { + AppControllerExplorer.getEventBus().fireEvent(new WebDavUrlEvent(webDavUrlEvent.getItemIdentifier())); + + } + + }); + + + eventBus.addHandler(OpenContextMenuTreeEvent.TYPE, new OpenContextMenuTreeEventHandler() { + + @Override + public void onOpenContextMenuTree(OpenContextMenuTreeEvent openContextMenuTreeEvent) { + AppControllerExplorer.getEventBus().fireEvent(openContextMenuTreeEvent); + + + } + }); + + eventBus.addHandler(ImagePreviewEvent.TYPE, new ImagePreviewEventHandler() { + + @Override + public void onClickPreview(ImagePreviewEvent imgPrevEvnt) { + AppControllerExplorer.getEventBus().fireEvent(new ImagePreviewEvent(imgPrevEvnt.getSourceFileModel(), imgPrevEvnt.getClientX(), imgPrevEvnt.getClientY())); + + } + + }); + + eventBus.addHandler(FileDownloadEvent.TYPE, new FileDownloadEventHandler() { + + @Override + public void onFileDownloadEvent(FileDownloadEvent fileDownloadEvent) { + AppControllerExplorer.getEventBus().fireEvent(new FileDownloadEvent(fileDownloadEvent.getItemIdentifier(), fileDownloadEvent.getItemName(), fileDownloadEvent.getDownloadType())); + } + }); + + eventBus.addHandler(DeleteMessageEvent.TYPE, new DeleteMessageEventHandler() { + + @Override + public void onDeleteMessage(DeleteMessageEvent deleteMessageEvent) { + AppControllerExplorer.getEventBus().fireEvent(new DeleteMessageEvent(deleteMessageEvent.getMessageTarget())); + } + + }); + + eventBus.addHandler(SaveAttachmentsEvent.TYPE, new SaveAttachmentsEventHandler() { + + @Override + public void onSaveAttachments(SaveAttachmentsEvent saveAttachmentsEvent) { + AppControllerExplorer.getEventBus().fireEvent(new SaveAttachmentsEvent(saveAttachmentsEvent.getMessageIdentifier(), saveAttachmentsEvent.getMessageType())); + + } + }); + + eventBus.addHandler(GridElementSelectedEvent.TYPE, new GridElementSelectedEventHandler() { + + @Override + public void onGridElementSelected(GridElementSelectedEvent event) { + + doElementGridSelected(true, event.getSourceFile()); + + // setFileDetailsInView(event.getSourceFile().getIdentifier()); + + } + }); + + eventBus.addHandler(LoadAllScopeEvent.TYPE, new LoadAllScopeEventHandler() { + + @Override + public void onLoadScopes(LoadAllScopeEvent loadAllScopeEvent) { + doLoadAllScope(); + + } + + private void doLoadAllScope() { + + appContrExplorer.getRpcWorkspaceService().getAllScope(new AsyncCallback>() { + + @Override + public void onFailure(Throwable caught) { + new MessageBoxAlert("Error", ConstantsExplorer.SERVER_ERROR + " getting all scope." +ConstantsExplorer.TRY_AGAIN, null); + } + + @Override + public void onSuccess(List result) { + + // for(ScopeModel scope: result) + // System.out.println("#############Scopde id " + scope.getId() + " name " + scope.getName()); + + if(result!=null && result.size()>0){ + wsPortlet.getSearchAndFilterContainer().setListScope(result); + wsPortlet.getSearchAndFilterContainer().selectScopeByIndex(0); //select first scope + } + else + new MessageBoxAlert("Error", ConstantsExplorer.SERVER_ERROR + " getting all scope. No scope available. " +ConstantsExplorer.TRY_AGAIN, null); + + } + }); + } + }); + + eventBus.addHandler(ScopeChangeEvent.TYPE, new ScopeChangeEventHandler() { + + @Override + public void onLoadScope(ScopeChangeEvent scopeChangeEvent) { + doLoadScope(scopeChangeEvent.getScopeId()); + + } + + private void doLoadScope(String scopeId) { + AppControllerExplorer.getEventBus().fireEvent(new FilterScopeEvent(scopeId)); + + } + }); + + eventBus.addHandler(SaveSmartFolderEvent.TYPE, new SaveSmartFolderEventHandler() { + + @Override + public void onSaveSmartFolder(SaveSmartFolderEvent saveSmartFolderEvent) { + doSaveSmartFolder(saveSmartFolderEvent); + + } + + private void doSaveSmartFolder(SaveSmartFolderEvent event) { + + AppControllerExplorer.getEventBus().fireEvent(new AddSmartFolderEvent(event.getSearchText())); + + } + }); + + eventBus.addHandler(DoubleClickElementSelectedEvent.TYPE, new DoubleClickElementSelectedEventHandler() { + + @Override + public void onDoubleClickElementGrid(DoubleClickElementSelectedEvent doubleClickElementSelectedEvent) { + + doElementDoubleClick(doubleClickElementSelectedEvent.getSourceFile()); + + } + + private void doElementDoubleClick(final FileGridModel fileModel) { +// appContrExplorer.expandFolder(event.getIdentifier()); + + //COMMENTED 01-02-2013 +// appContrExplorer.expandFolder(event.getIdentifier()); + + FolderModel folder = new FolderModel(fileModel.getIdentifier(), fileModel.getName(), fileModel.getParentFileModel(), true, fileModel.isShared()); + updateStoreByRpc(folder); + + } + }); + + eventBus.addHandler(SearchTextEvent.TYPE, new SearchTextEventHandler() { + + @Override + public void onSearchText(SearchTextEvent searchTextEvent) { + + if(searchTextEvent.getTextSearch()==null){ + appContrExplorer.searching(false); + wsPortlet.getGridGroupContainer().setBorderAsOnSearch(false); + } + else{ + wsPortlet.getSearchAndFilterContainer().setSearchActive(true); //ADDED 06-04-12 + isSearchActive = true; + appContrExplorer.searching(true); + doSearchText(searchTextEvent.getTextSearch()); + } + } + + private void doSearchText(String textSearch) { + + if(wsPortlet.getGxtCardLayoutResultPanel().getActivePanel() instanceof GxtItemsPanel){ //If active panel is panel with file items + + wsPortlet.getSearchAndFilterContainer().setVisibleButtonSave(true); //ADDED 24/04/2012 + +// wsPortlet.getGxtCardLayoutResultPanel().getToolBarItem().activeAllButtonWithoutGroupView(false); //ADDED 06/02/2013 + + wsPortlet.getGridGroupContainer().setBorderAsOnSearch(true); + + wsPortlet.getGridGroupContainer().mask(ConstantsExplorer.LOADING,ConstantsExplorer.LOADINGSTYLE); + + appContrExplorer.getRpcWorkspaceService().getItemsBySearchName(textSearch, new AsyncCallback>() { + + @Override + public void onFailure(Throwable caught) { + System.out.println("Failure search RPC"); + new MessageBoxAlert("Error", ConstantsExplorer.SERVER_ERROR + " searching item. " +ConstantsExplorer.TRY_AGAIN, null); + wsPortlet.getGridGroupContainer().unmask(); + + } + + @Override + public void onSuccess(List result) { + wsPortlet.getGridGroupContainer().updateStore(result); + wsPortlet.getGridGroupContainer().unmask(); + } + }); + } + } + }); + + eventBus.addHandler(PathElementSelectedEvent.TYPE, new PathElementSelectedEventHandler() { + + @Override + public void onPathElementSelected(PathElementSelectedEvent event) { + wsPortlet.getSearchAndFilterContainer().searchCancel(); //cancel search + + if(wsPortlet.getGxtCardLayoutResultPanel().getActivePanel() instanceof GxtItemsPanel){ //If active panel is panel with file items + AppController.getEventBus().fireEvent(new SearchTextEvent(null)); + } + + doPathElementSelected(event); + } + + private void doPathElementSelected(PathElementSelectedEvent event) { + // appContrExplorer.selectItemInTree(event.getSourceFile().getIdentifier()); + + appContrExplorer.expandFolder(event.getSourceFile().getIdentifier()); + } + + }); + + eventBus.addHandler(GridElementUnSelectedEvent.TYPE, new GridElementUnSelectedEventHandler() { + + @Override + public void onGridElementUnSelected(GridElementUnSelectedEvent event) { + doElementGridSelected(false, null); + } + }); + + + eventBus.addHandler(AddFolderEvent.TYPE, new AddFolderEventHandler() { + + @Override + public void onAddItem(AddFolderEvent event) { + AppControllerExplorer.getEventBus().fireEvent(new AddFolderEvent(event.getFileSourceModel(),event.getParentFileModel())); + + } + + }); + + eventBus.addHandler(SendMessageEvent.TYPE, new SendMessageEventHandler() { + + @Override + public void onSendMessage(SendMessageEvent sendMessageEvent) { + doSendMessage(sendMessageEvent.getListFileModelSelected()); + + } + + private void doSendMessage(List listFileModelSelected) { + AppControllerExplorer.getEventBus().fireEvent(new SendMessageEvent(null)); + } + }); + + + eventBus.addHandler(FileUploadEvent.TYPE, new FileUploadEventHandler() { + + @Override + public void onFileUploadEvent(FileUploadEvent fileUploadEvent) { + + AppControllerExplorer.getEventBus().fireEvent(new FileUploadEvent(null,fileUploadEvent.getUploadType())); + + } + }); + + + eventBus.addHandler(FileDownloadEvent.TYPE, new FileDownloadEventHandler() { + + @Override + public void onFileDownloadEvent(FileDownloadEvent fileDownloadEvent) { + AppControllerExplorer.getEventBus().fireEvent(new FileDownloadEvent(fileDownloadEvent.getItemIdentifier(), fileDownloadEvent.getItemName(), fileDownloadEvent.getDownloadType())); + + } + }); + + + eventBus.addHandler(DeleteItemEvent.TYPE, new DeleteItemEventHandler() { + + @Override + public void onDeleteItem(DeleteItemEvent event) { + doDeleteItem(event); + } + + private void doDeleteItem(final DeleteItemEvent event){ + + AppControllerExplorer.getEventBus().fireEvent(new DeleteItemEvent(event.getFileTarget())); + + } + + }); + + eventBus.addHandler(RenameItemEvent.TYPE, new RenameItemEventHandler() { + + @Override + public void onRenameItem(RenameItemEvent event) { + doRenameItem(event); + } + + public void doRenameItem(final RenameItemEvent event) { + + AppControllerExplorer.getEventBus().fireEvent(new RenameItemEvent(event.getFileTarget())); + } + }); + } + + private void doElementGridSelected(boolean isSelected, FileModel target) { + + // wsPortlet.getToolbarPanelContainer().activeButtonsOnSelect(itemSelected); + + + wsPortlet.getGxtCardLayoutResultPanel().getToolBarItem().activeButtonsOnSelect(target, isSelected); + + + if(isSelected){ + ArrayList listParents = appContrExplorer.getListParentsByIdentifier(target.getIdentifier()); + + setPathInView(listParents); //Set file path in tab panel on current item selected + + + if(isSearchActive){ //COMMENTED 30-01-12 - syncronization only if search is active + + wsPortlet.getSearchAndFilterContainer().setSearchActive(true); + + appContrExplorer.searching(true); + + appContrExplorer.findItemAndSelectItemInTree(target.getIdentifier()); + } + + } + + } + + private void setPathInView(ArrayList parents){ + + //this.wsPortlet.getBasicTabContainer().setLabelPath(path); //Set path in tab view panel + + this.wsPortlet.getToolBarPath().setPath(parents); //Set path in tab view panel + } + + /** + * init method + * @param rootPanel + */ + public void go(final HasWidgets rootPanel) { + + final String searchParameter = Window.Location.getParameter(ConstantsPortlet.GET_SEARCH_PARAMETER); + final boolean instanceWithGrouping = readCookieWorkspaceGridViewSetting(); + + System.out.println("Cookie "+ConstantsPortlet.GCUBE_COOKIE_WORKSPACE_GRID_VIEW_SETTING + " return "+instanceWithGrouping); + + boolean isSearch = false; + // Log.trace("Start Workspace Portlet"); + if (this.appContrExplorer == null){ + this.wsPortlet = new WorskpacePortlet(instanceWithGrouping); + } + else{ + + if(searchParameter!=null && !searchParameter.isEmpty()) + isSearch = true; + + this.wsPortlet = new WorskpacePortlet(this.appContrExplorer.getPanel(true, false, !isSearch), instanceWithGrouping); + eventBus.fireEvent(new LoadAllScopeEvent()); //LOAD ALL SCOPE EVENT + } + + rootPanel.add(wsPortlet.getBorderLayoutContainer()); + + //SET TOGGLE BUTTON GRID VIEW + Scheduler.get().scheduleDeferred(new ScheduledCommand() { + + @Override + public void execute() { + wsPortlet.getGxtCardLayoutResultPanel().getToolBarItem().toggleGridViewButton(instanceWithGrouping); + } + }); + + //If is SEARCH - fire event search text + if(searchParameter!=null && !searchParameter.isEmpty()) + Scheduler.get().scheduleDeferred(new ScheduledCommand() { + + @Override + public void execute() { +// wsPortlet.getGxtCardLayoutResultPanel().getToolBarItem().activeAllButtonWithoutGroupView(false); + wsPortlet.getSearchAndFilterContainer().searchText(searchParameter); + + } + }); + } + + + /** + * + * @return true if exists a cookie with msg as true value (or not exists the cookie), false otherwise + */ + private boolean readCookieWorkspaceGridViewSetting() { + + //get the cookie with name GCBUEWorkspaceGridViewSetting + String msg = Cookies.getCookie(ConstantsPortlet.GCUBE_COOKIE_WORKSPACE_GRID_VIEW_SETTING); + + //if null, there was no cookie + if(msg == null){ + setCookieGridViewSetting("true"); + return true; + } + + if(msg.compareTo("true")==0) + return true; + + return false; + + } + + public static void setCookie(String name, String value, int days) { + + if (value == null) { + Cookies.removeCookie(name); + return; + } + + // Now + Date expiringDate = new Date(); + // Now + days + expiringDate.setTime(expiringDate.getTime() + ConstantsPortlet.MILLISECS_PER_DAY * days); + Cookies.setCookie(name, value, expiringDate); + } + + public static void setCookieGridViewSetting(String value) { + + setCookie(ConstantsPortlet.GCUBE_COOKIE_WORKSPACE_GRID_VIEW_SETTING, value, ConstantsPortlet.COOKIE_EXPIRE_DAYS); + } + + public GxtBorderLayoutPanel getMainPanel(){ + return wsPortlet.getBorderLayoutContainer(); + } + + // public ExplorerPanel getExplorerPanel() { + // return wsPortlet.getExplorerPanel(); + // } + + public void setSizeAsyncTreePanel(int width, int height) { + wsPortlet.getExplorerPanel().getAsycTreePanel().setSizeTreePanel(width-17, height-55); + } + + private void updateStoreByRpc(final FileModel folder){ + + wsPortlet.getGridGroupContainer().mask(ConstantsExplorer.LOADING,ConstantsExplorer.LOADINGSTYLE); + + System.out.println("In client new RPC getFolderChildrenForFileGrid "+folder.getName()); + + appContrExplorer.getRpcWorkspaceService().getFolderChildrenForFileGrid(folder, new AsyncCallback>() { + + @Override + public void onFailure(Throwable caught) { + new MessageBoxAlert("Error", ConstantsExplorer.SERVER_ERROR + " getting items for grid. " +ConstantsExplorer.TRY_AGAIN, null); + // System.out.println(caught); + // caught.printStackTrace(); + wsPortlet.getGridGroupContainer().unmask(); + + } + + @Override + public void onSuccess(List result) { + wsPortlet.getGridGroupContainer().setCurrentFolderView(folder); //SET folder as current view + + wsPortlet.getGridGroupContainer().unmask(); + wsPortlet.getGridGroupContainer().updateStore(result); + + } + }); + } + + public FileModel getSelectedFolder(){ + + return this.appContrExplorer.getSelectedFolderInTree(); + } + + + /** + * Following methods implements SubscriberInterface + */ + + @Override + public void addedFolder(String itemIdentifier, FileModel parent) { + updateStoreByRpc(parent); + } + + @Override + public void addedFile(String itemIdentifier, FileModel parent) { + updateStoreByRpc(parent); + } + + @Override + public void selectedItem(FileModel item, ArrayList parents) { + + FileModel currentFolder = wsPortlet.getGridGroupContainer().getCurrentFolderView(); + + if(currentFolder!=null){ + + setPathInView(parents); //set path + + if(wsPortlet.getSearchAndFilterContainer().isSearchActive()){ //ADDED 12-04-12 + wsPortlet.getSearchAndFilterContainer().searchCancel(); //TODO added in 05/04/2012 + AppController.getEventBus().fireEvent(new SearchTextEvent(null)); + wsPortlet.getSearchAndFilterContainer().setSearchActive(false); + isSearchActive = false; + if(item.isDirectory()) + updateStoreByRpc(item); + else + updateStoreByRpc(item.getParentFileModel()); + + return; + } + + if (item.isDirectory()) + updateStoreByRpc(item); //View children of folder + else{ + String currentIdentifier = currentFolder.getIdentifier(); //Actual id parent + + if(!currentIdentifier.equals(item.getParentFileModel().getIdentifier())) {//Update store only if folder parent is differently + updateStoreByRpc(item.getParentFileModel()); //View contents of parent folder + } + } + } + else + updateStoreByRpc(item); //View children of root + } + + @Override + public void expandFolderItem(FolderModel folder) { + updateStoreByRpc(folder); + } + + @Override + public boolean renameItem(String itemIdentifier, String newName, String extension) { + return wsPortlet.getGridGroupContainer().renameItem(itemIdentifier, newName, extension); + + } + + @Override + public boolean deleteItem(String itemIdentifier) { + return wsPortlet.getGridGroupContainer().deleteItem(itemIdentifier); + + } + + @Override + public void rootLoaded(FileModel root) { + this.rootIdentifier = root.getIdentifier(); + } + + @Override + public void setParentItemSelected(ArrayList listParents){ + setPathInView(listParents); + } + + @Override + public void smartFolderSelected(final String folderId, final String category) { + + + System.out.println("In client folderId: " + folderId); + System.out.println("In client category: " + category); + + wsPortlet.getGridGroupContainer().mask(ConstantsExplorer.LOADING,ConstantsExplorer.LOADINGSTYLE); + + wsPortlet.getGridGroupContainer().setBorderAsOnSearch(true); + + if (folderId != null && !folderId.isEmpty()) { + + appContrExplorer.getRpcWorkspaceService().getSmartFolderResultsById(folderId,new AsyncCallback>() { + + @Override + public void onFailure(Throwable caught) { + new MessageBoxAlert("Error", ConstantsExplorer.SERVER_ERROR + " getting smart folders. " +ConstantsExplorer.TRY_AGAIN, null); + wsPortlet.getGridGroupContainer().unmask(); + } + + @Override + public void onSuccess(List result) { + wsPortlet.getSearchAndFilterContainer().setSearchActive(true); + isSearchActive = true; + wsPortlet.getGridGroupContainer().unmask(); + wsPortlet.getGridGroupContainer().updateStore(result); + } + + }); + } else { + + if (category != null && !category.isEmpty()) { + + appContrExplorer.getRpcWorkspaceService().getSmartFolderResultsByCategory(category, new AsyncCallback>() { + + @Override + public void onFailure(Throwable caught) { + new MessageBoxAlert("Error", ConstantsExplorer.SERVER_ERROR + " getting smart folder results by category. " +ConstantsExplorer.TRY_AGAIN, null); + } + + @Override + public void onSuccess(List result) { + wsPortlet.getGridGroupContainer().unmask(); + wsPortlet.getGridGroupContainer().updateStore(result); + } + }); + + } + + } + + } + + @Override + public void movedItems(String sourceParentIdentifier, FileModel targetParent) { + updateStoreByRpc(targetParent); + } + + @Override + public void switchView(ViewSwitchType type){ + + if(type.equals(ViewSwitchType.Tree) || type.equals(ViewSwitchType.SmartFolder)){ + wsPortlet.getGxtCardLayoutResultPanel().setActivePanel(ViewSwitchTypeInResult.Group); + wsPortlet.getSearchAndFilterContainer().setEmptyText(ConstantsPortlet.SEARCHINWORSPACE); + } + else{ + wsPortlet.getGxtCardLayoutResultPanel().setActivePanel(ViewSwitchTypeInResult.Messages); + wsPortlet.getSearchAndFilterContainer().setEmptyText(ConstantsPortlet.SEARCHINMESSAGE); + } + + //***ADDED 24/04/2012 + wsPortlet.getSearchAndFilterContainer().searchCancel(); + eventBus.fireEvent(new SearchTextEvent(null)); + // appContrExplorer.searching(false); + //************** + + } + + @Override + public void refreshFolder(FileModel folderTarget) { + updateStoreByRpc(folderTarget); + + } + + // @Override + // public void updatePrevieMessage(String fromLogin, String subject, + // String date, String body, List attachs) { + // wsPortlet.getMessagesPanelContainer().setBodyValue(subject, body); + // wsPortlet.getMessagesPanelContainer().setFromTitle(fromLogin, date); + // wsPortlet.getMessagesPanelContainer().setAttachs(attachs); + // + // } + + + @Override + public void createNewMessage(final HashMap hashAttachs) { + GWT.runAsync(MailForm.class, new RunAsyncCallback() { + @Override + public void onSuccess() { + if (hashAttachs.size() == 0) { //no attachments + new MailForm(); + } else { + new MailForm(hashAttachs); + } + } + public void onFailure(Throwable reason) { + Window.alert("Could not load this component: " + reason.getMessage()); + } + }); + } + +} diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/ConstantsPortlet.java b/src/main/java/org/gcube/portlets/user/workspace/client/ConstantsPortlet.java new file mode 100644 index 0000000..b178c15 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/workspace/client/ConstantsPortlet.java @@ -0,0 +1,52 @@ +package org.gcube.portlets.user.workspace.client; + +/** + * + * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it + * + */ +public class ConstantsPortlet { + + // ToolBar button + public static final String ADDFOLDER = "Add Folder"; + public static final String REMOVEITEM = "Remove Item"; + public static final String RENAMEITEM = "Rename Item"; + public static final String UPLOADFILE = "Upload File"; + public static final String DOWNLOADITEM = "Download Item"; + public static final String UPLOADARCHIVE = "Upload Archive"; + + public static final String GET_SEARCH_PARAMETER ="search"; + // Div Gwt + public static final String WORKSPACEDIV = "workspaceDiv"; + + // Panels Names + public static final String WORKSPACE = "Workspace"; + public static final String EXPLORER = "Explorer"; + public static final String DETAILS = "Details"; + public static final String RESULT = "Result"; + + public enum ViewSwitchTypeInResult { + List, Icons, Group, Messages + }; + + // Messages + public static final String FIELDVALIDATEERROR = "The field must be alphanumeric"; + + // Filter Panel + public static final String SEARCH = "Search"; + public static final String SAVE = "Save"; + public static final String CANCEL = "Cancel"; + public static final String SEARCHINWORSPACE = "Search in workspace"; + public static final String SEARCHINMESSAGE = "Search in messages"; + public static final String VIEWSPACE = "Filter by Space"; + public static final String PREVIEW = "Preview"; + public static final String OPEN = "Open"; + + public static final String TITLEACCESSWEBDAV = "Access from Desktop"; + + //COOKIE SETTINGS + public static final String GCUBE_COOKIE_WORKSPACE_GRID_VIEW_SETTING = "GCUBE-Cookie-WorkspaceGridViewSetting"; + public static final int COOKIE_EXPIRE_DAYS = 30; + public static final long MILLISECS_PER_DAY = 1000L * 60L * 60L * 24L; + +} diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/WorkspacePortlet.java b/src/main/java/org/gcube/portlets/user/workspace/client/WorkspacePortlet.java new file mode 100644 index 0000000..b209743 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/workspace/client/WorkspacePortlet.java @@ -0,0 +1,64 @@ +package org.gcube.portlets.user.workspace.client; + +import com.google.gwt.core.client.EntryPoint; +import com.google.gwt.event.logical.shared.ResizeEvent; +import com.google.gwt.event.logical.shared.ResizeHandler; +import com.google.gwt.user.client.Window; +import com.google.gwt.user.client.ui.RootPanel; + +/** + * + * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it + * + */ +public class WorkspacePortlet implements EntryPoint { + /** + * This is the entry point method. + */ + + AppController appController; + + public void onModuleLoad() { + + AppControllerExplorer appControllerExplorer = new AppControllerExplorer(); + appController = new AppController(appControllerExplorer); + appController.go(RootPanel.get(ConstantsPortlet.WORKSPACEDIV)); + + Window.addResizeHandler(new ResizeHandler() { + @Override + public void onResize(ResizeEvent event) { + System.out.println("onWindowResized width: "+event.getWidth()+" height: "+event.getHeight()); + updateSize(); + } + }); + + updateSize(); + + } + + /** + * Update window size + */ + public void updateSize(){ + + RootPanel workspace = RootPanel.get(ConstantsPortlet.WORKSPACEDIV); + + int topBorder = workspace.getAbsoluteTop(); + + int leftBorder = workspace.getAbsoluteLeft(); + + + int rootHeight = (Window.getClientHeight() - topBorder - 4) ;// - ((footer == null)?0:(footer.getOffsetHeight()-15)); + + if (rootHeight > 550) + rootHeight = 550; + + int rootWidth = Window.getClientWidth() - 2* leftBorder; //- rightScrollBar; + + System.out.println("New workspace dimension Height: "+rootHeight+" Width: "+rootWidth); + + appController.getMainPanel().setHeight(rootHeight); + appController.getMainPanel().setWidth(rootWidth); + } + +} diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/event/ActiveGroupingView.java b/src/main/java/org/gcube/portlets/user/workspace/client/event/ActiveGroupingView.java new file mode 100644 index 0000000..e764238 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/workspace/client/event/ActiveGroupingView.java @@ -0,0 +1,32 @@ +package org.gcube.portlets.user.workspace.client.event; + +import com.google.gwt.event.shared.GwtEvent; + +/** + * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it + * + */ +public class ActiveGroupingView extends GwtEvent { + public static Type TYPE = new Type(); + private boolean activeGrouping; + + public boolean isActiveGrouping() { + return activeGrouping; + } + + public ActiveGroupingView(boolean active) { + this.activeGrouping = active; + } + + @Override + public Type getAssociatedType() { + return TYPE; + } + + @Override + protected void dispatch(ActiveGroupingViewHandler handler) { + handler.onActiveGroupingView(this); + } + + +} diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/event/ActiveGroupingViewHandler.java b/src/main/java/org/gcube/portlets/user/workspace/client/event/ActiveGroupingViewHandler.java new file mode 100644 index 0000000..82e2712 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/workspace/client/event/ActiveGroupingViewHandler.java @@ -0,0 +1,7 @@ +package org.gcube.portlets.user.workspace.client.event; + +import com.google.gwt.event.shared.EventHandler; + +public interface ActiveGroupingViewHandler extends EventHandler { + void onActiveGroupingView(ActiveGroupingView activeGroupingView); +} \ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/event/DoubleClickElementSelectedEvent.java b/src/main/java/org/gcube/portlets/user/workspace/client/event/DoubleClickElementSelectedEvent.java new file mode 100644 index 0000000..14a4538 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/workspace/client/event/DoubleClickElementSelectedEvent.java @@ -0,0 +1,35 @@ +package org.gcube.portlets.user.workspace.client.event; + +import org.gcube.portlets.user.workspace.client.model.FileGridModel; + +import com.extjs.gxt.ui.client.data.ModelData; +import com.google.gwt.event.shared.GwtEvent; + +/** + * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it + * + */ +public class DoubleClickElementSelectedEvent extends GwtEvent { + public static Type TYPE = new Type(); + + private FileGridModel targetFile = null; + + public DoubleClickElementSelectedEvent(ModelData target) { + this.targetFile = (FileGridModel) target; + } + + @Override + public Type getAssociatedType() { + return TYPE; + } + + @Override + protected void dispatch(DoubleClickElementSelectedEventHandler handler) { + handler.onDoubleClickElementGrid(this); + + } + + public FileGridModel getSourceFile() { + return targetFile; + } +} \ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/event/DoubleClickElementSelectedEventHandler.java b/src/main/java/org/gcube/portlets/user/workspace/client/event/DoubleClickElementSelectedEventHandler.java new file mode 100644 index 0000000..913eaf5 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/workspace/client/event/DoubleClickElementSelectedEventHandler.java @@ -0,0 +1,12 @@ +package org.gcube.portlets.user.workspace.client.event; + +import com.google.gwt.event.shared.EventHandler; + +/** + * + * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it + * + */ +public interface DoubleClickElementSelectedEventHandler extends EventHandler { + void onDoubleClickElementGrid(DoubleClickElementSelectedEvent doubleClickElementSelectedEvent); +} diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/event/GridElementSelectedEvent.java b/src/main/java/org/gcube/portlets/user/workspace/client/event/GridElementSelectedEvent.java new file mode 100644 index 0000000..5ce4157 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/workspace/client/event/GridElementSelectedEvent.java @@ -0,0 +1,37 @@ +package org.gcube.portlets.user.workspace.client.event; + +import org.gcube.portlets.user.workspace.client.model.FileGridModel; + +import com.extjs.gxt.ui.client.data.ModelData; +import com.google.gwt.event.shared.GwtEvent; + +/** + * + * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it + * + */ +public class GridElementSelectedEvent extends GwtEvent { + public static Type TYPE = new Type(); + + private FileGridModel targetFile = null; + + public GridElementSelectedEvent(ModelData target) { + this.targetFile = (FileGridModel) target; + } + + @Override + public Type getAssociatedType() { + // TODO Auto-generated method stub + return TYPE; + } + + @Override + protected void dispatch(GridElementSelectedEventHandler handler) { + handler.onGridElementSelected(this); + + } + + public FileGridModel getSourceFile() { + return targetFile; + } +} \ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/event/GridElementSelectedEventHandler.java b/src/main/java/org/gcube/portlets/user/workspace/client/event/GridElementSelectedEventHandler.java new file mode 100644 index 0000000..0fda88f --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/workspace/client/event/GridElementSelectedEventHandler.java @@ -0,0 +1,12 @@ +package org.gcube.portlets.user.workspace.client.event; + +import com.google.gwt.event.shared.EventHandler; + +/** + * + * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it + * + */ +public interface GridElementSelectedEventHandler extends EventHandler { + void onGridElementSelected(GridElementSelectedEvent event); +} diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/event/GridElementUnSelectedEvent.java b/src/main/java/org/gcube/portlets/user/workspace/client/event/GridElementUnSelectedEvent.java new file mode 100644 index 0000000..4e2a447 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/workspace/client/event/GridElementUnSelectedEvent.java @@ -0,0 +1,22 @@ +package org.gcube.portlets.user.workspace.client.event; + +import com.google.gwt.event.shared.GwtEvent; + +/** + * + * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it + * + */ +public class GridElementUnSelectedEvent extends GwtEvent { + public static Type TYPE = new Type(); + + @Override + public Type getAssociatedType() { + return TYPE; + } + + @Override + protected void dispatch(GridElementUnSelectedEventHandler handler) { + handler.onGridElementUnSelected(this); + } +} \ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/event/GridElementUnSelectedEventHandler.java b/src/main/java/org/gcube/portlets/user/workspace/client/event/GridElementUnSelectedEventHandler.java new file mode 100644 index 0000000..4abec96 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/workspace/client/event/GridElementUnSelectedEventHandler.java @@ -0,0 +1,12 @@ +package org.gcube.portlets.user.workspace.client.event; + +import com.google.gwt.event.shared.EventHandler; + +/** + * + * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it + * + */ +public interface GridElementUnSelectedEventHandler extends EventHandler { + void onGridElementUnSelected(GridElementUnSelectedEvent event); + } diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/event/GridMessageSelectedEvent.java b/src/main/java/org/gcube/portlets/user/workspace/client/event/GridMessageSelectedEvent.java new file mode 100644 index 0000000..76192f1 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/workspace/client/event/GridMessageSelectedEvent.java @@ -0,0 +1,35 @@ +package org.gcube.portlets.user.workspace.client.event; + +import org.gcube.portlets.user.workspace.client.model.MessageModel; + +import com.extjs.gxt.ui.client.data.ModelData; +import com.google.gwt.event.shared.GwtEvent; + +/** + * + * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it + * + */ +public class GridMessageSelectedEvent extends GwtEvent { + public static Type TYPE = new Type(); + + private MessageModel targetMessage = null; + + public GridMessageSelectedEvent(ModelData target) { + this.targetMessage = (MessageModel) target; + } + + @Override + public Type getAssociatedType() { + return TYPE; + } + + @Override + protected void dispatch(GridMessageSelectedEventHandler handler) { + handler.onGridMessageSelected(this); + } + + public MessageModel getTargetMessage() { + return targetMessage; + } +} \ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/event/GridMessageSelectedEventHandler.java b/src/main/java/org/gcube/portlets/user/workspace/client/event/GridMessageSelectedEventHandler.java new file mode 100644 index 0000000..3c17661 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/workspace/client/event/GridMessageSelectedEventHandler.java @@ -0,0 +1,12 @@ +package org.gcube.portlets.user.workspace.client.event; + +import com.google.gwt.event.shared.EventHandler; + +/** + * + * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it + * + */ +public interface GridMessageSelectedEventHandler extends EventHandler { + void onGridMessageSelected(GridMessageSelectedEvent gridMessageSelectedEvent); +} diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/event/GridMessageUnSelectedEvent.java b/src/main/java/org/gcube/portlets/user/workspace/client/event/GridMessageUnSelectedEvent.java new file mode 100644 index 0000000..fc93f26 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/workspace/client/event/GridMessageUnSelectedEvent.java @@ -0,0 +1,36 @@ +package org.gcube.portlets.user.workspace.client.event; + +import org.gcube.portlets.user.workspace.client.model.MessageModel; + +import com.extjs.gxt.ui.client.data.ModelData; +import com.google.gwt.event.shared.GwtEvent; + +/** + * + * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it + * + */ +public class GridMessageUnSelectedEvent extends GwtEvent { + public static Type TYPE = new Type(); + + private MessageModel targetMessage = null; + + public GridMessageUnSelectedEvent(ModelData target) { + this.targetMessage = (MessageModel) target; + } + + @Override + public Type getAssociatedType() { + return TYPE; + } + + @Override + protected void dispatch(GridMessageUnSelectedEventHandler handler) { + handler.onGridMessageUnSelected(this); + + } + + public MessageModel getTargetMessage() { + return targetMessage; + } +} \ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/event/GridMessageUnSelectedEventHandler.java b/src/main/java/org/gcube/portlets/user/workspace/client/event/GridMessageUnSelectedEventHandler.java new file mode 100644 index 0000000..df26050 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/workspace/client/event/GridMessageUnSelectedEventHandler.java @@ -0,0 +1,12 @@ +package org.gcube.portlets.user.workspace.client.event; + +import com.google.gwt.event.shared.EventHandler; + +/** + * + * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it + * + */ +public interface GridMessageUnSelectedEventHandler extends EventHandler { + void onGridMessageUnSelected(GridMessageUnSelectedEvent gridMessageUnSelectedEvent); +} diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/event/GridRenameItemEvent.java b/src/main/java/org/gcube/portlets/user/workspace/client/event/GridRenameItemEvent.java new file mode 100644 index 0000000..489852a --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/workspace/client/event/GridRenameItemEvent.java @@ -0,0 +1,47 @@ +package org.gcube.portlets.user.workspace.client.event; + +import org.gcube.portlets.user.workspace.client.model.FileGridModel; + +import com.google.gwt.event.shared.GwtEvent; + +/** + * + * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it + * + */ +public class GridRenameItemEvent extends GwtEvent { + public static Type TYPE = new Type(); + + private FileGridModel fileGridModel = null; + private String newName; + private String extension; + + + public GridRenameItemEvent(FileGridModel fileGridModel, String newName, String extension) { + this.fileGridModel = fileGridModel; + this.newName = newName; + this.extension = extension; + } + + @Override + public Type getAssociatedType() { + return TYPE; + } + + @Override + protected void dispatch(GridRenameItemEventHandler handler) { + handler.onGridItemRename(this); + } + + public FileGridModel getFileGridModel() { + return fileGridModel; + } + + public String getNewName() { + return newName; + } + + public String getExtension() { + return extension; + } +} \ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/event/GridRenameItemEventHandler.java b/src/main/java/org/gcube/portlets/user/workspace/client/event/GridRenameItemEventHandler.java new file mode 100644 index 0000000..5662c4f --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/workspace/client/event/GridRenameItemEventHandler.java @@ -0,0 +1,12 @@ +package org.gcube.portlets.user.workspace.client.event; + +import com.google.gwt.event.shared.EventHandler; + +/** + * + * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it + * + */ +public interface GridRenameItemEventHandler extends EventHandler { + void onGridItemRename(GridRenameItemEvent event); +} diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/event/LoadAllScopeEvent.java b/src/main/java/org/gcube/portlets/user/workspace/client/event/LoadAllScopeEvent.java new file mode 100644 index 0000000..97174c9 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/workspace/client/event/LoadAllScopeEvent.java @@ -0,0 +1,28 @@ +package org.gcube.portlets.user.workspace.client.event; + +import com.google.gwt.event.shared.GwtEvent; + +/** + * + * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it + * + */ +public class LoadAllScopeEvent extends GwtEvent { + public static Type TYPE = new Type(); + + public LoadAllScopeEvent() { + } + + @Override + public Type getAssociatedType() { + // TODO Auto-generated method stub + return TYPE; + } + + @Override + protected void dispatch(LoadAllScopeEventHandler handler) { + handler.onLoadScopes(this); + + } + +} \ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/event/LoadAllScopeEventHandler.java b/src/main/java/org/gcube/portlets/user/workspace/client/event/LoadAllScopeEventHandler.java new file mode 100644 index 0000000..518424f --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/workspace/client/event/LoadAllScopeEventHandler.java @@ -0,0 +1,11 @@ +package org.gcube.portlets.user.workspace.client.event; + +import com.google.gwt.event.shared.EventHandler; + +/** + * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it + * + */ +public interface LoadAllScopeEventHandler extends EventHandler { + void onLoadScopes(LoadAllScopeEvent loadAllScopeEvent); +} diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/event/PathElementSelectedEvent.java b/src/main/java/org/gcube/portlets/user/workspace/client/event/PathElementSelectedEvent.java new file mode 100644 index 0000000..b791df8 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/workspace/client/event/PathElementSelectedEvent.java @@ -0,0 +1,35 @@ +package org.gcube.portlets.user.workspace.client.event; + +import org.gcube.portlets.user.workspace.client.model.FileModel; + +import com.google.gwt.event.shared.GwtEvent; + +/** + * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it + * + */ +public class PathElementSelectedEvent extends GwtEvent { + public static Type TYPE = new Type(); + + private FileModel targetFile = null; + + public PathElementSelectedEvent(FileModel target) { + this.targetFile = target; + } + + @Override + public Type getAssociatedType() { + // TODO Auto-generated method stub + return TYPE; + } + + @Override + protected void dispatch(PathElementSelectedEventHandler handler) { + handler.onPathElementSelected(this); + + } + + public FileModel getSourceFile() { + return targetFile; + } +} \ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/event/PathElementSelectedEventHandler.java b/src/main/java/org/gcube/portlets/user/workspace/client/event/PathElementSelectedEventHandler.java new file mode 100644 index 0000000..75dc426 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/workspace/client/event/PathElementSelectedEventHandler.java @@ -0,0 +1,12 @@ +package org.gcube.portlets.user.workspace.client.event; + +import com.google.gwt.event.shared.EventHandler; + + +/** + * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it + * + */ +public interface PathElementSelectedEventHandler extends EventHandler { + void onPathElementSelected(PathElementSelectedEvent event); +} diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/event/SaveSmartFolderEvent.java b/src/main/java/org/gcube/portlets/user/workspace/client/event/SaveSmartFolderEvent.java new file mode 100644 index 0000000..944b751 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/workspace/client/event/SaveSmartFolderEvent.java @@ -0,0 +1,45 @@ +package org.gcube.portlets.user.workspace.client.event; + +import com.google.gwt.event.shared.GwtEvent; + +/** + * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it + * + */ +public class SaveSmartFolderEvent extends GwtEvent{ + public static Type TYPE = new Type(); + + private String smartFolderName; + private String searchText; + private String workpaceFolderId; + + public SaveSmartFolderEvent(String smartFolderName, String searchText, String workpaceFolderId) { + + this.smartFolderName = smartFolderName; + this.searchText = searchText; + this.workpaceFolderId = workpaceFolderId; + } + + @Override + public Type getAssociatedType() { + return TYPE; + } + + @Override + protected void dispatch(SaveSmartFolderEventHandler handler) { + handler.onSaveSmartFolder(this); + + } + + public String getSmartFolderName() { + return smartFolderName; + } + + public String getSearchText() { + return searchText; + } + + public String getWorkpaceFolderId() { + return workpaceFolderId; + } +} diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/event/SaveSmartFolderEventHandler.java b/src/main/java/org/gcube/portlets/user/workspace/client/event/SaveSmartFolderEventHandler.java new file mode 100644 index 0000000..944dda5 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/workspace/client/event/SaveSmartFolderEventHandler.java @@ -0,0 +1,11 @@ +package org.gcube.portlets.user.workspace.client.event; + +import com.google.gwt.event.shared.EventHandler; + +/** + * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it + * + */ +public interface SaveSmartFolderEventHandler extends EventHandler { + void onSaveSmartFolder(SaveSmartFolderEvent saveSmartFolderEvent); +} \ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/event/ScopeChangeEvent.java b/src/main/java/org/gcube/portlets/user/workspace/client/event/ScopeChangeEvent.java new file mode 100644 index 0000000..4ae2015 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/workspace/client/event/ScopeChangeEvent.java @@ -0,0 +1,35 @@ +package org.gcube.portlets.user.workspace.client.event; + +import com.google.gwt.event.shared.GwtEvent; + +/** + * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it + * + */ +public class ScopeChangeEvent extends GwtEvent { + public static Type TYPE = new Type(); + + private String scopeId; + + + public ScopeChangeEvent(String scopeId) { + this.scopeId = scopeId; + } + + @Override + public Type getAssociatedType() { + // TODO Auto-generated method stub + return TYPE; + } + + @Override + protected void dispatch(ScopeChangeEventHandler handler) { + handler.onLoadScope(this); + + } + + public String getScopeId() { + return scopeId; + } + +} \ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/event/ScopeChangeEventHandler.java b/src/main/java/org/gcube/portlets/user/workspace/client/event/ScopeChangeEventHandler.java new file mode 100644 index 0000000..e93168a --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/workspace/client/event/ScopeChangeEventHandler.java @@ -0,0 +1,11 @@ +package org.gcube.portlets.user.workspace.client.event; + +import com.google.gwt.event.shared.EventHandler; + +/** + * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it + * + */ +public interface ScopeChangeEventHandler extends EventHandler { + void onLoadScope(ScopeChangeEvent scopeChangeEvent); +} diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/event/SearchTextEvent.java b/src/main/java/org/gcube/portlets/user/workspace/client/event/SearchTextEvent.java new file mode 100644 index 0000000..4d98f9e --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/workspace/client/event/SearchTextEvent.java @@ -0,0 +1,34 @@ +package org.gcube.portlets.user.workspace.client.event; + +import com.google.gwt.event.shared.GwtEvent; + +/** + * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it + * + */ +public class SearchTextEvent extends GwtEvent { + public static Type TYPE = new Type(); + + private String textSearch = null; + + public SearchTextEvent(String text) { + this.textSearch = text; + } + + @Override + public Type getAssociatedType() { + // TODO Auto-generated method stub + return TYPE; + } + + @Override + protected void dispatch(SearchTextEventHandler handler) { + handler.onSearchText(this); + + } + + public String getTextSearch() { + return textSearch; + } + +} \ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/event/SearchTextEventHandler.java b/src/main/java/org/gcube/portlets/user/workspace/client/event/SearchTextEventHandler.java new file mode 100644 index 0000000..7093557 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/workspace/client/event/SearchTextEventHandler.java @@ -0,0 +1,12 @@ +package org.gcube.portlets.user.workspace.client.event; + +import com.google.gwt.event.shared.EventHandler; + + +/** + * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it + * + */ +public interface SearchTextEventHandler extends EventHandler { + void onSearchText(SearchTextEvent searchTextEvent); +} diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/model/GroupingStoreModel.java b/src/main/java/org/gcube/portlets/user/workspace/client/model/GroupingStoreModel.java new file mode 100644 index 0000000..5769ef1 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/workspace/client/model/GroupingStoreModel.java @@ -0,0 +1,48 @@ +package org.gcube.portlets.user.workspace.client.model; + +import java.util.List; + +import com.extjs.gxt.ui.client.store.GroupingStore; + +/** + * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it + * This class is not used + */ +public class GroupingStoreModel implements StoreOperationsInterface{ + + public static GroupingStoreModel instance; + private GroupingStore store; + + public static GroupingStoreModel getInstance() + { + if (instance == null) + instance = new GroupingStoreModel(); + + return instance; + } + + public GroupingStoreModel() { + setStore(new GroupingStore()); + } + + + private void setStore(GroupingStore store){ + this.store = store; + } + + public GroupingStore getStore(){ + return this.store; + } + + @Override + public List getListModel() { + return this.store.getModels(); + } + + @Override + public void setListModel(List listModel) { + this.store.removeAll(); + this.store.add(listModel); + + } +} diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/model/ListStoreModel.java b/src/main/java/org/gcube/portlets/user/workspace/client/model/ListStoreModel.java new file mode 100644 index 0000000..315a7ef --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/workspace/client/model/ListStoreModel.java @@ -0,0 +1,47 @@ +package org.gcube.portlets.user.workspace.client.model; + +import java.util.List; + +import com.extjs.gxt.ui.client.store.ListStore; + +/** + * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it + * This class is not used + */ +public class ListStoreModel implements StoreOperationsInterface{ + + public static ListStoreModel instance; + private ListStore store; + + public static ListStoreModel getInstance() + { + if (instance == null) + instance = new ListStoreModel(); + + return instance; + } + + public ListStoreModel() { + setStore(new ListStore()); + } + + private void setStore(ListStore store){ + this.store = store; + } + + public ListStore getStore(){ + return this.store; + } + + @Override + public List getListModel() { + return this.store.getModels(); + } + + @Override + public void setListModel(List listModel) { + this.store.removeAll(); + this.store.add(listModel); + + } +} diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/model/StoreOperationsInterface.java b/src/main/java/org/gcube/portlets/user/workspace/client/model/StoreOperationsInterface.java new file mode 100644 index 0000000..e6f549e --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/workspace/client/model/StoreOperationsInterface.java @@ -0,0 +1,14 @@ +package org.gcube.portlets.user.workspace.client.model; + +import java.util.List; + + +/** + * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it + * This class is not used + */ +public interface StoreOperationsInterface { + + List getListModel(); + void setListModel(List listModel); +} diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/view/GxtComboBox.java b/src/main/java/org/gcube/portlets/user/workspace/client/view/GxtComboBox.java new file mode 100644 index 0000000..5ea8240 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/workspace/client/view/GxtComboBox.java @@ -0,0 +1,106 @@ +package org.gcube.portlets.user.workspace.client.view; + +import java.util.ArrayList; +import java.util.List; + +import org.gcube.portlets.user.workspace.client.model.ScopeModel; + +import com.extjs.gxt.ui.client.store.ListStore; +import com.extjs.gxt.ui.client.widget.form.ComboBox; +import com.extjs.gxt.ui.client.widget.form.ComboBox.TriggerAction; +import com.extjs.gxt.ui.client.widget.form.SimpleComboBox; + +/** + * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it + * + */ +public class GxtComboBox { + + ListStore stringNameFilterModel = null; + ListStore scopeNameModels = null; + ComboBox comboStringFilter = null; + ComboBox comboViewScope = null; + + public GxtComboBox() { + + this.createComboBox(); + } + + private void createComboBox() { + + scopeNameModels = new ListStore(); + + comboViewScope = new ComboBox(); + comboViewScope.setEmptyText("Select a Scope..."); + comboViewScope.setDisplayField("name"); + comboViewScope.setStore(scopeNameModels); + comboViewScope.setTypeAhead(true); + comboViewScope.setEditable(false); + comboViewScope.setTriggerAction(TriggerAction.ALL); + + comboStringFilter = new ComboBox(); + comboStringFilter.setWidth(150); + comboStringFilter.setStore(stringNameFilterModel); + comboStringFilter.setDisplayField("name"); + comboStringFilter.setTypeAhead(true); + comboStringFilter.setEditable(false); + comboStringFilter.setTriggerAction(TriggerAction.ALL); + } + + public ComboBox getComboViewScope(){ + + return comboViewScope; + } + + public SimpleComboBox getComboStringFilter() { + + List ls = new ArrayList(); + ls.add("is"); + ls.add("contains"); + ls.add("begin with"); + ls.add("end with"); + + SimpleComboBox scb = new SimpleComboBox(); + scb.setEmptyText("Select filter on item name"); + scb.setTypeAhead(true); + scb.setEditable(false); + scb.setTriggerAction(TriggerAction.ALL); //Open list items also after the selection + + scb.add(ls); + + return scb; + } + + public void setListScope(List listScope){ + + this.scopeNameModels.add(listScope); + } + + +// private List getStringFilter() { +// List stringNameFil = new ArrayList(); +// stringNameFil.add(new StringNameFilterModel("is")); +// stringNameFil.add(new StringNameFilterModel("contain")); +// stringNameFil.add(new StringNameFilterModel("begin")); +// stringNameFil.add(new StringNameFilterModel("end")); +// return stringNameFil; +// } + + public SimpleComboBox getComboNameFilter() { + + List ls = new ArrayList(); + ls.add("Common Name"); + ls.add("Scientific Name"); + ls.add("Common/Scientific Name"); + + SimpleComboBox scb = new SimpleComboBox(); + scb.setEmptyText("Select Criteria"); + scb.setTypeAhead(true); + scb.setEditable(false); + scb.setTriggerAction(TriggerAction.ALL); + + scb.add(ls); + + return scb; + } +} \ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/view/GxtDetailsContainer.java b/src/main/java/org/gcube/portlets/user/workspace/client/view/GxtDetailsContainer.java new file mode 100644 index 0000000..b874b5e --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/workspace/client/view/GxtDetailsContainer.java @@ -0,0 +1,233 @@ +package org.gcube.portlets.user.workspace.client.view; + +import com.extjs.gxt.ui.client.Style.LayoutRegion; +import com.extjs.gxt.ui.client.util.Margins; +import com.extjs.gxt.ui.client.widget.ContentPanel; +import com.extjs.gxt.ui.client.widget.HorizontalPanel; +import com.extjs.gxt.ui.client.widget.LayoutContainer; +import com.extjs.gxt.ui.client.widget.Text; +import com.extjs.gxt.ui.client.widget.VerticalPanel; +import com.extjs.gxt.ui.client.widget.Viewport; +import com.extjs.gxt.ui.client.widget.form.FormPanel; +import com.extjs.gxt.ui.client.widget.form.FormPanel.LabelAlign; +import com.extjs.gxt.ui.client.widget.form.TextArea; +import com.extjs.gxt.ui.client.widget.form.TextField; +import com.extjs.gxt.ui.client.widget.layout.BorderLayout; +import com.extjs.gxt.ui.client.widget.layout.BorderLayoutData; +import com.extjs.gxt.ui.client.widget.layout.ColumnData; +import com.extjs.gxt.ui.client.widget.layout.ColumnLayout; +import com.extjs.gxt.ui.client.widget.layout.FitLayout; +import com.extjs.gxt.ui.client.widget.layout.FormData; +import com.extjs.gxt.ui.client.widget.layout.FormLayout; + +/** + * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it + * + */ +public class GxtDetailsContainer extends Viewport{ + + private TextField txfName = new TextField(); + private TextArea txtDescription = new TextArea(); + private Text txtLabelOwner = new Text("Owner:"); + private Text txtLabelCreationTime = new Text("Creation Time:"); + private Text txtLabelDimension = new Text("Dimension:"); + private Text txtOwner = new Text("Empty"); + private Text txtCreationTime = new Text("Empty"); + private Text txtDimension = new Text("Empty"); + private ContentPanel west = new ContentPanel(); + private ContentPanel center = new ContentPanel(); + + public GxtDetailsContainer(){ + + this.initBorderLayout(); + this.initItemsPropertiesLayout(); + this.initItemsDetailsLayout(); + } + + private void initItemsDetailsLayout() { + + LayoutContainer itemsDetails = new LayoutContainer(); + itemsDetails.setLayout(new ColumnLayout()); + + VerticalPanel vp = new VerticalPanel(); + vp.setStyleAttribute("padding", "5px"); + vp.setLayout(new FitLayout()); + Text txtTitle = new Text("Items-Details"); + txtTitle.setStyleAttribute("font-weight", "bold"); + vp.add(txtTitle); + + LayoutContainer left = new LayoutContainer(); + left.setStyleAttribute("paddingRight", "20px"); + + HorizontalPanel hpOwner = new HorizontalPanel(); + hpOwner.setSpacing(5); + txtLabelOwner.setStyleAttribute("padding-left", "5px"); + hpOwner.add(txtLabelOwner); + hpOwner.add(txtOwner); + + HorizontalPanel hpCreationTime = new HorizontalPanel(); + hpCreationTime.setSpacing(5); + txtLabelCreationTime.setStyleAttribute("padding-left", "5px"); + hpCreationTime.add(txtLabelCreationTime); + hpCreationTime.add(txtCreationTime); + + HorizontalPanel hpDimension = new HorizontalPanel(); + hpDimension.setSpacing(5); + txtLabelDimension.setStyleAttribute("padding-left", "5px"); + hpDimension.add(txtLabelDimension); + hpDimension.add(txtDimension); + + LayoutContainer right = new LayoutContainer(); + right.setStyleAttribute("paddingLeft", "20px"); + + itemsDetails.add(left, new ColumnData(.5)); + itemsDetails.add(right, new ColumnData(.5)); + + + vp.add(hpOwner); + vp.add(hpCreationTime); + vp.add(hpDimension); + vp.add(itemsDetails); + center.add(vp); + } + + private void initBorderLayout(){ + + BorderLayout bl = new BorderLayout(); + setLayout(bl); + + west.setHeaderVisible(false); + BorderLayoutData westData = new BorderLayoutData(LayoutRegion.WEST, 400); + + westData.setCollapsible(false); + westData.setFloatable(false); + westData.setSplit(false); + westData.setMargins(new Margins(3, 0, 3, 3)); + + center.setHeaderVisible(false); + BorderLayoutData centerData = new BorderLayoutData(LayoutRegion.CENTER); + centerData.setMargins(new Margins(3)); + centerData.setCollapsible(false); + centerData.setFloatable(true); + centerData.setSplit(true); + + add(west, westData); + add(center, centerData); + } + + private void initItemsPropertiesLayout() { + + LayoutContainer itemsDetails = new LayoutContainer(); + itemsDetails.setLayout(new ColumnLayout()); + + VerticalPanel vp = new VerticalPanel(); + vp.setStyleAttribute("padding", "5px"); + vp.setLayout(new FitLayout()); + Text txtTitle = new Text("Items-Properties"); + txtTitle.setStyleAttribute("font-weight", "bold"); + vp.add(txtTitle); + + FormPanel formPanel = new FormPanel(); +// formPanel.setFrame(true); + formPanel.setHeaderVisible(false); + formPanel.setBodyBorder(false); + FormData formData = new FormData("100%"); + + LayoutContainer left = new LayoutContainer(); + left.setStyleAttribute("paddingRight", "20px"); + FormLayout layout = new FormLayout(); + layout.setLabelAlign(LabelAlign.TOP); +// layout.setLabelWidth(40); + left.setLayout(layout); + +// txtName.setEnabled(false); + txfName.setReadOnly(true); + txfName.setFieldLabel("Name"); + left.add(txfName, formData); + + LayoutContainer right = new LayoutContainer(); + right.setStyleAttribute("paddingLeft", "20px"); + layout = new FormLayout(); +// layout.setLabelWidth(40); + layout.setLabelAlign(LabelAlign.TOP); + right.setLayout(layout); + + +// txtDescription.setEnabled(false); + txtDescription.setReadOnly(true); + txtDescription.setHeight(50); + txtDescription.setFieldLabel("Description"); + right.add(txtDescription, formData); + + itemsDetails.add(left, new ColumnData(.5)); + itemsDetails.add(right, new ColumnData(.5)); + + formPanel.add(itemsDetails,new FormData("100%")); + + west.add(vp); + west.add(formPanel); + + } + + public TextField getTxtName() { + return txfName; + } + + public void setTxtName(TextField txtName) { + this.txfName = txtName; + } + + public TextArea getTxtDescription() { + return txtDescription; + } + + public void setTxtDescription(TextArea txtDescription) { + this.txtDescription = txtDescription; + } + + public Text getTxtOwner() { + return txtOwner; + } + + public void setTxtOwner(Text txtOwner) { + this.txtOwner = txtOwner; + } + + public Text getTxtCreationTime() { + return txtCreationTime; + } + + public void setTxtCreationTime(Text txtCreationTime) { + this.txtCreationTime = txtCreationTime; + } + + public Text getTxtDimension() { + return txtDimension; + } + + public void setTxtDimension(Text txtDimension) { + this.txtDimension = txtDimension; + } + + + public void resetDetails(){ + + this.txtDimension.setText(""); + this.txtCreationTime.setText(""); + this.txfName.reset(); + this.txtDescription.reset(); + this.txtOwner.setText(""); + } + + public void setDetails(String itemName, String description, String dimension, String creationTime, String owner){ + + this.resetDetails(); + + this.txtDimension.setText(dimension); + this.txtCreationTime.setText(creationTime); + this.txfName.setValue(itemName); + this.txtDescription.setValue(description); + this.txtOwner.setText(owner); + + } +} diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/view/GxtListView.java b/src/main/java/org/gcube/portlets/user/workspace/client/view/GxtListView.java new file mode 100644 index 0000000..77faa29 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/workspace/client/view/GxtListView.java @@ -0,0 +1,67 @@ +package org.gcube.portlets.user.workspace.client.view; + + +import org.gcube.portlets.user.workspace.client.ConstantsExplorer; +import org.gcube.portlets.user.workspace.client.ConstantsPortlet; +import org.gcube.portlets.user.workspace.client.model.FileGridModel; +import org.gcube.portlets.user.workspace.client.model.FileModel; +import org.gcube.portlets.user.workspace.client.model.ListStoreModel; + +import com.extjs.gxt.ui.client.event.Events; +import com.extjs.gxt.ui.client.event.Listener; +import com.extjs.gxt.ui.client.event.SelectionChangedEvent; +import com.extjs.gxt.ui.client.store.ListStore; +import com.extjs.gxt.ui.client.util.Format; +import com.extjs.gxt.ui.client.widget.ContentPanel; +import com.extjs.gxt.ui.client.widget.LayoutContainer; +import com.extjs.gxt.ui.client.widget.ListView; + +/** + * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it + * + */ +public class GxtListView extends LayoutContainer { + + private ContentPanel cp = new ContentPanel(); +// private String headerTitle = ConstantsPortlet.RESULT; + private ListStore store = ListStoreModel.getInstance().getStore(); + + public GxtListView() { + + cp.setBodyBorder(false); + cp.setHeading(ConstantsPortlet.RESULT); + cp.setHeaderVisible(true); + + ListView view = new ListView() { + @Override + protected FileGridModel prepareData(FileGridModel model) { + String s = model.get(ConstantsExplorer.NAME); + model.set("shortName", Format.ellipse(s, 15)); + return model; + } + + }; + + view.setStore(store); + view.setItemSelector("div.thumb-wrap"); + view.getSelectionModel().addListener(Events.SelectionChange, new Listener>() { + + public void handleEvent(SelectionChangedEvent be) { + cp.setHeading("Simple ListView (" + be.getSelection().size() + + " items selected)"); + } + + }); + + cp.add(view); + add(cp); + } + + private native String getTemplate() /*-{ + return [ '', '
', + '
', + '{shortName}
', '
', + '
' ].join(""); + + }-*/; +} diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/view/StringNameFilterModel.java b/src/main/java/org/gcube/portlets/user/workspace/client/view/StringNameFilterModel.java new file mode 100644 index 0000000..e0af2ca --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/workspace/client/view/StringNameFilterModel.java @@ -0,0 +1,32 @@ +package org.gcube.portlets.user.workspace.client.view; + +import com.extjs.gxt.ui.client.data.BaseModelData; + +/** + * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it + * + */ +public class StringNameFilterModel extends BaseModelData { + + /** + * + */ + private static final long serialVersionUID = 1L; + + public StringNameFilterModel() { + + } + + public StringNameFilterModel(String name) { + setName(name); + } + + public String getName() { + return get("name"); + } + + public void setName(String name) { + set("name", name); + } + +} diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/view/WorskpacePortlet.java b/src/main/java/org/gcube/portlets/user/workspace/client/view/WorskpacePortlet.java new file mode 100644 index 0000000..28a2462 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/workspace/client/view/WorskpacePortlet.java @@ -0,0 +1,97 @@ +package org.gcube.portlets.user.workspace.client.view; + +import org.gcube.portlets.user.workspace.client.view.grids.GxtGridFilterGroupPanel; +import org.gcube.portlets.user.workspace.client.view.panels.GxtBasicTabPanel; +import org.gcube.portlets.user.workspace.client.view.panels.GxtBorderLayoutPanel; +import org.gcube.portlets.user.workspace.client.view.panels.GxtCardLayoutResultPanel; +import org.gcube.portlets.user.workspace.client.view.panels.GxtSeachAndFilterPanel; +import org.gcube.portlets.user.workspace.client.view.toolbars.GxtPathPanel; + + +/** + * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it + * + */ +public class WorskpacePortlet { + + private GxtBorderLayoutPanel borderLayoutContainer = null; + private GxtBasicTabPanel basicTabContainer = null; +// private GxtToolBarFunctionsPanel toolbarPanelContainer = null; + private ExplorerPanel explorerPanel = null; + private GxtDetailsContainer detailsContainer; + private GxtListView listViewContainer; + private GxtPathPanel toolBarPathPanel; + private GxtGridFilterGroupPanel gridFilterGroupContainer; + private GxtSeachAndFilterPanel searchAndFilterContainer; + private GxtGridFilterGroupPanel gridFilterContainer; + private GxtCardLayoutResultPanel gxtCardLayoutResultPanel; + + public WorskpacePortlet(boolean activeGroup) { + +// Log.trace("Initializing WorskpacePortlet"); + this.basicTabContainer = new GxtBasicTabPanel(); + this.toolBarPathPanel = new GxtPathPanel(); + this.searchAndFilterContainer = new GxtSeachAndFilterPanel(this.toolBarPathPanel.getToolBarPathPanel()); + + this.gridFilterContainer = new GxtGridFilterGroupPanel(false); + this.gridFilterGroupContainer = new GxtGridFilterGroupPanel(activeGroup); + this.listViewContainer = new GxtListView(); + this.detailsContainer = new GxtDetailsContainer(); + + + this.gxtCardLayoutResultPanel = new GxtCardLayoutResultPanel(gridFilterContainer, gridFilterGroupContainer, listViewContainer, detailsContainer); + + } + + public WorskpacePortlet(ExplorerPanel expPanel, boolean activeGroup) { + this(activeGroup); + this.explorerPanel = expPanel; + + this.borderLayoutContainer = new GxtBorderLayoutPanel(this.searchAndFilterContainer, this.explorerPanel, this.gxtCardLayoutResultPanel, this.detailsContainer); + } + + public GxtBorderLayoutPanel getBorderLayoutContainer() { + return borderLayoutContainer; + } + + public GxtBasicTabPanel getBasicTabContainer() { + return basicTabContainer; + } + + public GxtDetailsContainer getDetailsContainer() { + return detailsContainer; + } + + + public GxtSeachAndFilterPanel getSearchAndFilterContainer() { + return searchAndFilterContainer; + } + + + public GxtPathPanel getToolBarPath() { + return toolBarPathPanel; + } + + + public GxtGridFilterGroupPanel getGridGroupContainer() { + return gridFilterGroupContainer; + } + + + public ExplorerPanel getExplorerPanel() { + return explorerPanel; + } + + public GxtGridFilterGroupPanel getGridFilterContainer() { + return gridFilterContainer; + } + + + public void setGridFilterContainer(GxtGridFilterGroupPanel gridFilterContainer) { + this.gridFilterContainer = gridFilterContainer; + } + + public GxtCardLayoutResultPanel getGxtCardLayoutResultPanel() { + return gxtCardLayoutResultPanel; + } +} diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/view/grids/GxtGridFilterGroupPanel.java b/src/main/java/org/gcube/portlets/user/workspace/client/view/grids/GxtGridFilterGroupPanel.java new file mode 100644 index 0000000..2e8d7b3 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/workspace/client/view/grids/GxtGridFilterGroupPanel.java @@ -0,0 +1,450 @@ +package org.gcube.portlets.user.workspace.client.view.grids; + +import java.util.Arrays; +import java.util.List; + +import org.gcube.portlets.user.workspace.client.AppController; +import org.gcube.portlets.user.workspace.client.ConstantsExplorer; +import org.gcube.portlets.user.workspace.client.event.DoubleClickElementSelectedEvent; +import org.gcube.portlets.user.workspace.client.event.FileDownloadEvent; +import org.gcube.portlets.user.workspace.client.event.FileDownloadEvent.DownloadType; +import org.gcube.portlets.user.workspace.client.event.GridElementSelectedEvent; +import org.gcube.portlets.user.workspace.client.event.GridElementUnSelectedEvent; +import org.gcube.portlets.user.workspace.client.event.ImagePreviewEvent; +import org.gcube.portlets.user.workspace.client.event.OpenContextMenuTreeEvent; +import org.gcube.portlets.user.workspace.client.event.OpenReportsEvent; +import org.gcube.portlets.user.workspace.client.interfaces.GXTFolderItemTypeEnum; +import org.gcube.portlets.user.workspace.client.model.FileGridModel; +import org.gcube.portlets.user.workspace.client.model.FileModel; +import org.gcube.portlets.user.workspace.client.model.GroupingStoreModel; + +import com.extjs.gxt.ui.client.Style.SelectionMode; +import com.extjs.gxt.ui.client.data.ModelData; +import com.extjs.gxt.ui.client.event.BaseEvent; +import com.extjs.gxt.ui.client.event.Events; +import com.extjs.gxt.ui.client.event.GridEvent; +import com.extjs.gxt.ui.client.event.Listener; +import com.extjs.gxt.ui.client.event.SelectionChangedEvent; +import com.extjs.gxt.ui.client.event.SelectionChangedListener; +import com.extjs.gxt.ui.client.store.GroupingStore; +import com.extjs.gxt.ui.client.store.ListStore; +import com.extjs.gxt.ui.client.store.Record; +import com.extjs.gxt.ui.client.widget.ContentPanel; +import com.extjs.gxt.ui.client.widget.LayoutContainer; +import com.extjs.gxt.ui.client.widget.form.NumberField; +import com.extjs.gxt.ui.client.widget.grid.CellEditor; +import com.extjs.gxt.ui.client.widget.grid.ColumnConfig; +import com.extjs.gxt.ui.client.widget.grid.ColumnData; +import com.extjs.gxt.ui.client.widget.grid.ColumnModel; +import com.extjs.gxt.ui.client.widget.grid.Grid; +import com.extjs.gxt.ui.client.widget.grid.GridCellRenderer; +import com.extjs.gxt.ui.client.widget.grid.GroupingView; +import com.extjs.gxt.ui.client.widget.grid.filters.DateFilter; +import com.extjs.gxt.ui.client.widget.grid.filters.GridFilters; +import com.extjs.gxt.ui.client.widget.grid.filters.NumericFilter; +import com.extjs.gxt.ui.client.widget.grid.filters.StringFilter; +import com.extjs.gxt.ui.client.widget.layout.FitLayout; +import com.google.gwt.i18n.client.NumberFormat; + +/** + * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it + * + */ +public class GxtGridFilterGroupPanel extends LayoutContainer { + + private ContentPanel cp = new ContentPanel(); +// private ListStore store = ListStoreModel.getInstance().getStore(); + private GroupingStore store = GroupingStoreModel.getInstance().getStore(); + private FileGridModel currenItemSelected = null; + private FileModel currentFolderView = null; + private final NumberFormat number = NumberFormat.getFormat("#,##0 KB;(#,##0 KB)"); + private GroupingView view = new GroupingView(); + private boolean groupingEnabled = false; + + public GxtGridFilterGroupPanel(boolean group) { + setLayout(new FitLayout()); + ColumnConfig icon = new ColumnConfig(ConstantsExplorer.ICON, "", 25); + ColumnConfig name = new ColumnConfig(ConstantsExplorer.NAME, ConstantsExplorer.NAME, 300); + ColumnConfig type = new ColumnConfig(ConstantsExplorer.TYPE, ConstantsExplorer.TYPE, 100); + ColumnConfig creationDate = new ColumnConfig(ConstantsExplorer.GRIDCOLUMNCREATIONDATE, ConstantsExplorer.GRIDCOLUMNCREATIONDATE, 100); + ColumnConfig category = new ColumnConfig(ConstantsExplorer.SHORTCUTCATEGORY, ConstantsExplorer.SHORTCUTCATEGORY, 100); + ColumnConfig size = new ColumnConfig(ConstantsExplorer.SIZE, ConstantsExplorer.SIZE, 50); + + size.setEditor(new CellEditor(new NumberField())); + + ColumnModel cm = null; + + if(group) + cm = new ColumnModel(Arrays.asList(icon, name, type, creationDate, size, category)); + else + cm = new ColumnModel(Arrays.asList(icon, name, type, creationDate, size)); + + final ColumnModel columnModel = cm; + + cp.setBodyBorder(true); +// cp.setHeading(ConstantsPortlet.RESULT); + cp.setHeaderVisible(false); + cp.setLayout(new FitLayout()); + + final Grid grid = new Grid(store, columnModel); + grid.getView().setAutoFill(true); + grid.setBorders(true); + + + view.setShowGroupedColumn(false); + view.setForceFit(true); + grid.setView(view); + view.setEmptyText(ConstantsExplorer.EMPTY); + +// view.setGroupRenderer(new GridGroupRenderer() { +// public String render(GroupColumnData data) { +// String f = columnModel.getColumnById(data.field).getHeader(); +// String l = data.models.size() == 1 ? "Item" : "Items"; +// return f + ": " + data.group + " (" + data.models.size() + " " + l + ")"; +// } +// }); + + if(group){ + store.groupBy(ConstantsExplorer.SHORTCUTCATEGORY); + groupingEnabled = true; + } + + GridCellRenderer folderRender = new GridCellRenderer() { + @Override + public String render(FileGridModel model, String property, ColumnData config, int rowIndex, int colIndex, ListStore store, Grid grid) { + String val = model.get(property); + String color = "black"; + + if(val != null && val.equals(GXTFolderItemTypeEnum.FOLDER.toString())){ +// color = "#EEC900"; + return "" + val + ""; + }else{ + if(val==null) + val = ""; + return "" + val + ""; + } + } + }; + + GridCellRenderer kbRender = new GridCellRenderer() { + @Override + public String render(FileGridModel model, String property, ColumnData config, + int rowIndex, int colIndex, ListStore store, Grid grid) { + + long value = (Long) model.get(property); + + if(value!=-1){ + String color = "black"; + // int val = Integer.parseInt(value); + // String style = (val/1024) < 2000000 ? "red" : "green"; + double kb = value/1024; + if(kb<1) + kb=1; + return "" + number.format(kb) + ""; + + } + + return ""; + } + }; + + size.setRenderer(kbRender); + type.setRenderer(folderRender); + + //setAlphanumericStoreSorter(grid); + + GridFilters filters = new GridFilters(); + filters.setLocal(true); + + StringFilter nameFilter = new StringFilter(ConstantsExplorer.NAME); + StringFilter authorFilter = new StringFilter(ConstantsExplorer.TYPE); + DateFilter dateFilter = new DateFilter(ConstantsExplorer.GRIDCOLUMNCREATIONDATE); + NumericFilter sizeFilter = new NumericFilter(ConstantsExplorer.SIZE); + + + filters.addFilter(nameFilter); + filters.addFilter(authorFilter); + filters.addFilter(dateFilter); + filters.addFilter(sizeFilter); + + // grid.setStyleAttribute("borderTop", "none"); + grid.setAutoExpandColumn(ConstantsExplorer.NAME); + grid.setBorders(false); + grid.setStripeRows(true); + grid.setColumnLines(true); + + grid.getView().setShowDirtyCells(false); + + // grid.setSize(500, 500); + grid.addPlugin(filters); + + grid.getSelectionModel().setSelectionMode(SelectionMode.SINGLE); + + grid.getSelectionModel().addSelectionChangedListener(new SelectionChangedListener() { + + @Override + public void selectionChanged(SelectionChangedEvent se) { + System.out.println("selection grid change"); + + ModelData target = se.getSelectedItem(); + + if(target!=null){ + currenItemSelected = (FileGridModel) target; + AppController.getEventBus().fireEvent(new GridElementSelectedEvent(target)); + } + else{ + currenItemSelected = null; + AppController.getEventBus().fireEvent(new GridElementUnSelectedEvent()); + } + } + }); + + + grid.addListener(Events.RowDoubleClick, new Listener() { + + @Override + public void handleEvent(BaseEvent be) { + + FileGridModel fileModel = grid.getSelectionModel().getSelectedItem(); + + if(fileModel!=null) + fireEventByFileModelType(fileModel); + // if(fileModel.isDirectory()) + // AppController.getEventBus().fireEvent(new DoubleClickElementSelectedEvent(fileModel)); + } + + }); + + + grid.setContextMenu(null); //add context menu null - ignore browse event right click + + grid.addListener(Events.OnContextMenu, new Listener>(){ + @Override + public void handleEvent(GridEvent be) + { + + if(be.isRightClick()) + { + if(grid.getSelectionModel().getSelectedItem()!=null){ + + FileGridModel fileGridModel = grid.getSelectionModel().getSelectedItem(); + AppController.getEventBus().fireEvent(new OpenContextMenuTreeEvent(fileGridModel, be.getClientX(), be.getClientY())); + } + } + } + }); + + cp.add(grid); + add(cp); + } + + public void disableGrouping() { + GroupingStore groupingStore = null; + if (this.getStore() instanceof GroupingStore) { + groupingStore = (GroupingStore) this.getStore(); + if (groupingStore != null) { + groupingStore.clearGrouping(); + } + this.groupingEnabled = false; + } + } + + public void enableGrouping() { + GroupingStore groupingStore = null; + if (this.getStore() instanceof GroupingStore) { + groupingStore = (GroupingStore) this.getStore(); + if (groupingStore != null) { + groupingStore.groupBy(ConstantsExplorer.SHORTCUTCATEGORY); + } + this.groupingEnabled = true; + } + } + + private void fireEventByFileModelType(FileModel target){ + + if(target.isDirectory()){ + AppController.getEventBus().fireEvent(new DoubleClickElementSelectedEvent(target)); + return; + } + + + switch(target.getGXTFolderItemType()){ + + case EXTERNAL_IMAGE: + AppController.getEventBus().fireEvent(new ImagePreviewEvent(target, 0, 0)); + break; + case EXTERNAL_FILE: + AppController.getEventBus().fireEvent(new FileDownloadEvent(target.getIdentifier(), target.getName(), DownloadType.SHOW)); + break; + case EXTERNAL_PDF_FILE: + AppController.getEventBus().fireEvent(new FileDownloadEvent(target.getIdentifier(), target.getName(), DownloadType.SHOW)); + break; + case EXTERNAL_URL: + AppController.getEventBus().fireEvent(new FileDownloadEvent(target.getIdentifier(), target.getName(), DownloadType.SHOW)); + break; + case REPORT_TEMPLATE: + AppController.getEventBus().fireEvent(new OpenReportsEvent(target)); + break; + case REPORT: + AppController.getEventBus().fireEvent(new OpenReportsEvent(target)); + break; + case QUERY: + break; + case TIME_SERIES: + break; + case PDF_DOCUMENT: + AppController.getEventBus().fireEvent(new FileDownloadEvent(target.getIdentifier(), target.getName(), DownloadType.SHOW)); + break; + case IMAGE_DOCUMENT: + AppController.getEventBus().fireEvent(new ImagePreviewEvent(target,0, 0)); + break; + case DOCUMENT: + AppController.getEventBus().fireEvent(new FileDownloadEvent(target.getIdentifier(), target.getName(), DownloadType.SHOW)); + break; + case URL_DOCUMENT: + AppController.getEventBus().fireEvent(new FileDownloadEvent(target.getIdentifier(), target.getName(), DownloadType.SHOW)); + break; + case METADATA: + break; + case WORKFLOW_REPORT: + break; + case WORKFLOW_TEMPLATE: + break; + case EXTERNAL_RESOURCE_LINK: + AppController.getEventBus().fireEvent(new FileDownloadEvent(target.getIdentifier(), target.getName(), DownloadType.SHOW)); + break; + default: + + } + + } + + + private void resetStore(){ + store.removeAll(); + } + + + public boolean updateStore(List result){ + + resetStore(); + if(result!= null){ + for(FileGridModel file: result) + file.setIcon(); + store.add(result); + return true; + } + return false; + } + + public FileGridModel getSelectedItem(){ + + return currenItemSelected; + + } + + /** + * + * @param identifier (MANDATORY) + * @return + */ + public boolean deleteItem(String identifier) { + + FileGridModel fileTarget = getFileGridModelByIdentifier(identifier); + + if(fileTarget!=null){ + Record record = store.getRecord(fileTarget); + store.remove((FileGridModel) record.getModel()); + return true; + } + else + System.out.println("Delete Error: file target with " + identifier + " identifier not exist in store" ); + + return false; + } + + /** + * + * @param fileTarget (MANDATORY) + * @param newName (MANDATORY) + * @param extension OPTIONAL - string or null + */ + private boolean renameItem(FileGridModel fileTarget, String newName, String extension) { + + if(fileTarget!=null){ + Record record = store.getRecord(fileTarget); + if(record!=null){ + if(extension!= null) + record.set(ConstantsExplorer.NAME, newName+extension); + else + record.set(ConstantsExplorer.NAME, newName); + + return true; + } + else + System.out.println("Record Error: file target with " + fileTarget.getIdentifier() + " identifier not exist in store" ); + } + else + System.out.println("Rename Error: file target with is null" ); + + return false; + } + + + public FileModel getCurrentFolderView() { + return currentFolderView; + } + + + public void setCurrentFolderView(FileModel currentFolderView) { + this.currentFolderView = currentFolderView; + } + + + public boolean renameItem(String itemIdentifier, String newName, String extension) { + + if(itemIdentifier!=null){ + FileGridModel fileTarget = getFileGridModelByIdentifier(itemIdentifier); + if(fileTarget!=null){ + Record record = store.getRecord(fileTarget); + if(record!=null){ + if(extension!= null) + record.set(ConstantsExplorer.NAME, newName+extension); + else + record.set(ConstantsExplorer.NAME, newName); + + return true; + } + } + else + System.out.println("Record Error: file target not exist in store" ); + } + else + System.out.println("Rename Error: file target is null" ); + + return false; + + } + + public FileGridModel getFileGridModelByIdentifier(String id){ + return (FileGridModel) store.findModel(ConstantsExplorer.IDENTIFIER, id); + } + + public GroupingStore getStore(){ + return store; + } + + public void setBorderAsOnSearch(boolean bool){ + + if(this.cp.getElement("body")!=null){ + + if(bool){ + this.cp.getElement("body").getStyle().setBorderColor("#32CD32"); + } + else + this.cp.getElement("body").getStyle().setBorderColor("#99BBE8"); + + } + } + +} \ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/view/grids/GxtGridFilterPanel.java b/src/main/java/org/gcube/portlets/user/workspace/client/view/grids/GxtGridFilterPanel.java new file mode 100644 index 0000000..6bf0add --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/workspace/client/view/grids/GxtGridFilterPanel.java @@ -0,0 +1,227 @@ +package org.gcube.portlets.user.workspace.client.view.grids; + +import java.util.Arrays; +import java.util.List; + +import org.gcube.portlets.user.workspace.client.AppController; +import org.gcube.portlets.user.workspace.client.ConstantsExplorer; +import org.gcube.portlets.user.workspace.client.ConstantsPortlet; +import org.gcube.portlets.user.workspace.client.event.GridElementSelectedEvent; +import org.gcube.portlets.user.workspace.client.event.GridElementUnSelectedEvent; +import org.gcube.portlets.user.workspace.client.model.FileGridModel; +import org.gcube.portlets.user.workspace.client.model.FileModel; +import org.gcube.portlets.user.workspace.client.model.ListStoreModel; + +import com.extjs.gxt.ui.client.data.ModelData; +import com.extjs.gxt.ui.client.event.BaseEvent; +import com.extjs.gxt.ui.client.event.Events; +import com.extjs.gxt.ui.client.event.Listener; +import com.extjs.gxt.ui.client.event.SelectionChangedEvent; +import com.extjs.gxt.ui.client.event.SelectionChangedListener; +import com.extjs.gxt.ui.client.store.ListStore; +import com.extjs.gxt.ui.client.store.Record; +import com.extjs.gxt.ui.client.store.Store; +import com.extjs.gxt.ui.client.store.StoreSorter; +import com.extjs.gxt.ui.client.widget.ContentPanel; +import com.extjs.gxt.ui.client.widget.LayoutContainer; +import com.extjs.gxt.ui.client.widget.grid.ColumnConfig; +import com.extjs.gxt.ui.client.widget.grid.ColumnModel; +import com.extjs.gxt.ui.client.widget.grid.Grid; +import com.extjs.gxt.ui.client.widget.grid.filters.GridFilters; +import com.extjs.gxt.ui.client.widget.grid.filters.StringFilter; +import com.extjs.gxt.ui.client.widget.layout.FitLayout; + +/** + * This class is not used + * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it + * + */ + +public class GxtGridFilterPanel extends LayoutContainer { + + private ContentPanel cp = new ContentPanel(); + private ListStore store = ListStoreModel.getInstance().getStore(); + private FileGridModel currenItemSelected = null; + private FileModel currentFolderView = null; + + public GxtGridFilterPanel() { + setLayout(new FitLayout()); + ColumnConfig name = new ColumnConfig(ConstantsExplorer.NAME, ConstantsExplorer.NAME, 400); + ColumnConfig type = new ColumnConfig(ConstantsExplorer.TYPE, ConstantsExplorer.TYPE, 100); + ColumnConfig creationDate = new ColumnConfig(ConstantsExplorer.GRIDCOLUMNCREATIONDATE, ConstantsExplorer.GRIDCOLUMNCREATIONDATE, 100); + ColumnConfig size = new ColumnConfig(ConstantsExplorer.SIZE, ConstantsExplorer.SIZE, 50); + + ColumnModel cm = new ColumnModel(Arrays.asList(name, type, creationDate, size)); + + cp.setBodyBorder(false); + cp.setHeading(ConstantsPortlet.RESULT); + cp.setHeaderVisible(true); + cp.setLayout(new FitLayout()); + + GridFilters filters = new GridFilters(); + filters.setLocal(true); + + StringFilter nameFilter = new StringFilter(ConstantsExplorer.NAME); + StringFilter authorFilter = new StringFilter(ConstantsExplorer.TYPE); + StringFilter sizeFilter = new StringFilter(ConstantsExplorer.SIZE); + + filters.addFilter(nameFilter); + filters.addFilter(authorFilter); + filters.addFilter(sizeFilter); + + final Grid grid = new Grid(store, cm); + + grid.getView().setAutoFill(true); + + setAlphanumericStoreSorter(grid); + + grid.setAutoExpandColumn(ConstantsExplorer.NAME); + grid.setBorders(false); + grid.setStripeRows(true); + grid.setColumnLines(true); + grid.addPlugin(filters); + + + grid.getSelectionModel().addSelectionChangedListener(new SelectionChangedListener() { + + @Override + public void selectionChanged(SelectionChangedEvent se) { + System.out.println("selection grid change"); + + ModelData target = se.getSelectedItem(); + + if(target!=null){ + currenItemSelected = (FileGridModel) target; + AppController.getEventBus().fireEvent(new GridElementSelectedEvent(target)); + } + else{ + currenItemSelected = null; + AppController.getEventBus().fireEvent(new GridElementUnSelectedEvent()); + } + } + }); + + + grid.addListener(Events.RowDoubleClick, new Listener() { + + @Override + public void handleEvent(BaseEvent be) { +// FileGridModel fileModel = (FileGridModel) be.getSource(); +// if(fileModel.isDirectory()) + } + + }); + + cp.add(grid); + add(cp); + } + + private void resetStore(){ + store.removeAll(); + } + + + public boolean updateStore(List result){ + + resetStore(); + if(result!= null){ + store.add(result); + return true; + } + return false; + } + + public FileGridModel getSelectedItem(){ + + return currenItemSelected; + + } + + + /** + * + * @param identifier (MANDATORY) + * @return + */ + public boolean deleteItem(String identifier) { + +// FileGridModel fileTarget = (FileGridModel) store.findModel("identifier", identifier); + FileGridModel fileTarget = getFileGridModelByIdentifier(identifier); + + if(fileTarget!=null){ + Record record = store.getRecord(fileTarget); + store.remove((FileGridModel) record.getModel()); + return true; + } + else + System.out.println("Delete Error: file target with " + identifier + " identifier not exist in store" ); + + return false; + } + + + public FileModel getCurrentFolderView() { + return currentFolderView; + } + + + public void setCurrentFolderView(FileModel currentFolderView) { + this.currentFolderView = currentFolderView; + } + + + public boolean renameItem(String itemIdentifier, String newName, String extension) { + + if(itemIdentifier!=null){ +// FileGridModel fileTarget = (FileGridModel) store.findModel(ConstantsExplorer.IDENTIFIER, itemIdentifier); + FileGridModel fileTarget = getFileGridModelByIdentifier(itemIdentifier); + if(fileTarget!=null){ + Record record = store.getRecord(fileTarget); + if(record!=null){ + if(extension!= null) + record.set(ConstantsExplorer.NAME, newName+extension); + else + record.set(ConstantsExplorer.NAME, newName); + + return true; + } + } + else + System.out.println("Record Error: file target not exist in store" ); + } + else + System.out.println("Rename Error: file target with is null" ); + + return false; + + } + + private void setAlphanumericStoreSorter(Grid grid){ + + // Sorting files + grid.getStore().setStoreSorter(new StoreSorter() { + + @Override + public int compare(Store store, FileGridModel m1, FileGridModel m2, String property) { + boolean m1Folder = m1.isDirectory(); + boolean m2Folder = m2.isDirectory(); + + if (m1Folder && !m2Folder) { + return -1; + } else if (!m1Folder && m2Folder) { + return 1; + } + + return m1.getName().compareTo(m2.getName()); + } + }); + } + + public FileGridModel getFileGridModelByIdentifier(String id){ + return (FileGridModel) store.findModel(ConstantsExplorer.IDENTIFIER, id); + } + + public ListStore getStore(){ + return store; + } +} \ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/view/panels/GxtBasicTabPanel.java b/src/main/java/org/gcube/portlets/user/workspace/client/view/panels/GxtBasicTabPanel.java new file mode 100644 index 0000000..a8b898c --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/workspace/client/view/panels/GxtBasicTabPanel.java @@ -0,0 +1,290 @@ +package org.gcube.portlets.user.workspace.client.view.panels; + +import org.gcube.portlets.user.workspace.client.model.ScopeModel; +import org.gcube.portlets.user.workspace.client.view.GxtComboBox; + +import com.extjs.gxt.ui.client.Style.HorizontalAlignment; +import com.extjs.gxt.ui.client.event.BaseEvent; +import com.extjs.gxt.ui.client.event.ButtonEvent; +import com.extjs.gxt.ui.client.event.Events; +import com.extjs.gxt.ui.client.event.Listener; +import com.extjs.gxt.ui.client.event.SelectionChangedEvent; +import com.extjs.gxt.ui.client.event.SelectionChangedListener; +import com.extjs.gxt.ui.client.event.SelectionListener; +import com.extjs.gxt.ui.client.util.Margins; +import com.extjs.gxt.ui.client.util.Padding; +import com.extjs.gxt.ui.client.widget.ContentPanel; +import com.extjs.gxt.ui.client.widget.HorizontalPanel; +import com.extjs.gxt.ui.client.widget.Label; +import com.extjs.gxt.ui.client.widget.LayoutContainer; +import com.extjs.gxt.ui.client.widget.TabItem; +import com.extjs.gxt.ui.client.widget.TabPanel; +import com.extjs.gxt.ui.client.widget.Text; +import com.extjs.gxt.ui.client.widget.button.Button; +import com.extjs.gxt.ui.client.widget.form.ComboBox; +import com.extjs.gxt.ui.client.widget.form.DateField; +import com.extjs.gxt.ui.client.widget.form.FormButtonBinding; +import com.extjs.gxt.ui.client.widget.form.FormPanel; +import com.extjs.gxt.ui.client.widget.form.SimpleComboBox; +import com.extjs.gxt.ui.client.widget.form.TextField; +import com.extjs.gxt.ui.client.widget.layout.FitLayout; +import com.extjs.gxt.ui.client.widget.layout.FormData; +import com.extjs.gxt.ui.client.widget.layout.RowLayout; +import com.extjs.gxt.ui.client.widget.layout.VBoxLayout; +import com.extjs.gxt.ui.client.widget.layout.VBoxLayout.VBoxLayoutAlign; +import com.extjs.gxt.ui.client.widget.layout.VBoxLayoutData; +import com.google.gwt.user.client.Window; + +/** + * This class is not used + * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it + * + */ +public class GxtBasicTabPanel extends LayoutContainer { + + //Tab View + private TabItem tabView = null; + private TabItem tabSearch = null; + private TabPanel tabPanel = null; + private Text txtPath = new Text("PATH:"); + private Label labelPath = new Label(""); + private GxtComboBox comboBoxGxt = null; + private ComboBox cbViewScope = null; +// private Text txtSwitch = new Text("Explorer View:"); + private Text txtViewScope = new Text("View Scope:"); + public enum viewSwitchType {TREE,SHORTCUT}; + private final String EMPTY = "EMPTY"; + + //Tab Search + private final TextField textSearch = new TextField(); + private Button bSearch = new Button("Search"); + private Button bCancel = new Button("Cancel"); + private TextField textFull = new TextField(); + private DateField fromDate = new DateField(); + private DateField toDate = new DateField(); + private final String FIELDVALIDATEERROR = "The field must be alphanumeric"; + private SimpleComboBox cbNameFilter = null; +// TableData tdContentView = null; + + public GxtBasicTabPanel() { + +// Log.trace("Initializing GxtBasicTabPanel"); + + setLayout(new FitLayout()); + setBorders(true); + setId("ContentPanelTab"); + + this.tabPanel = new TabPanel(); + this.tabView = new TabItem("View"); + this.tabSearch = new TabItem("Search"); + this.comboBoxGxt = new GxtComboBox(); + this.cbViewScope = this.comboBoxGxt.getComboViewScope(); + this.cbNameFilter = this.comboBoxGxt.getComboStringFilter(); + this.initTabView(); + this.initTabSearch(); + } + + private void initTabView() { + + ContentPanel cp = new ContentPanel(); + cp.setHeaderVisible(false); + cp.setLayout(new RowLayout()); + cp.setBorders(false); + cp.setBodyBorder(false); +// cp.setStyleAttribute("margin-top", "20px"); + + tabPanel.setBorders(false); + tabPanel.setBodyBorder(false); + tabPanel.setStyleAttribute("margin-top", "10px"); + tabPanel.setTabMargin(10); + tabPanel.setTabWidth(250); + tabPanel.setBorderStyle(false); + tabPanel.setPlain(true); + + VBoxLayout vBoxLayout = new VBoxLayout(); + vBoxLayout.setPadding(new Padding(5)); + vBoxLayout.setVBoxLayoutAlign(VBoxLayoutAlign.LEFT); + VBoxLayoutData flex = new VBoxLayoutData(new Margins(30, 10, 10, 10)); + + txtPath.addStyleName("pad-text"); + txtPath.setStyleAttribute("backgroundColor", "white"); + txtPath.setAutoWidth(true); + +// Radio radioTree = new Radio(); +// radioTree.setBoxLabel("Tree"); +// radioTree.setValue(true); +// radioTree.setValueAttribute(viewSwitchType.TREE.toString()); +// Radio radioShortcut = new Radio(); +// radioShortcut.setBoxLabel("Shortcut"); +// radioShortcut.setValueAttribute(viewSwitchType.SHORTCUT.toString()); +// RadioGroup radioGroup = new RadioGroup(); +// radioGroup.setFieldLabel("Afecto"); +// radioGroup.add(radioTree); +// radioGroup.add(radioShortcut); +// radioGroup.setStyleAttribute("margin-left", "20px"); + + HorizontalPanel hpPath = new HorizontalPanel(); + hpPath.setLayout(new FitLayout()); + hpPath.setBorders(true); + hpPath.add(txtPath); + this.labelPath.setEnabled(false); + this.setLabelPath(""); + this.labelPath.setStyleAttribute("margin-left", "20px"); + hpPath.add(this.labelPath); + + HorizontalPanel hpScope = new HorizontalPanel(); + hpScope.setLayout(new FitLayout()); + hpScope.add(txtViewScope); + + //Select in combo the first element of store + this.cbViewScope.addListener(Events.Attach, new Listener(){ + public void handleEvent(BaseEvent be) { + cbViewScope.setValue(cbViewScope.getStore().getAt(0)); + } + }); + + this.cbViewScope.addSelectionChangedListener(new SelectionChangedListener() { + + @Override + public void selectionChanged(SelectionChangedEvent se) { + +// Window.alert("selected scope" + se.getSelectedItem().get("name")); + + //TODO + + } + }); + + this.cbViewScope.setStyleAttribute("margin-left", "20px"); + hpScope.add(this.cbViewScope); + +// HorizontalPanel hpRadio = new HorizontalPanel(); +// hpRadio.setLayout(new FitLayout()); +// hpRadio.add(txtSwitch); +// hpRadio.add(radioGroup); + + cp.add(hpPath,flex); + cp.add(hpScope,flex); +// cp.add(hpRadio, flex); + + this.tabView.add(cp); + + tabPanel.add(tabView); + add(tabPanel); + } + + + private void initTabSearch() { + + ContentPanel cp = new ContentPanel(); + cp.setHeaderVisible(false); + cp.setLayout(new RowLayout()); + cp.setBorders(false); + cp.setBodyBorder(false); + + + FormPanel formPanel = new FormPanel(); + formPanel.setHeaderVisible(false); + formPanel.setBodyBorder(false); + +// formPanel.setFrame(true); + formPanel.setWidth(350); + + FormData formData = new FormData("-20"); + + + cbNameFilter.setFieldLabel("Name Filter"); +// combo.setDisplayField("name"); + formPanel.add(cbNameFilter, formData); + + textSearch.setFieldLabel("Item Name"); + textSearch.setAllowBlank(false); + textSearch.setRegex("^[ a-zA-Z0-9_-]*$"); +// textSearch.getMessages().setRegexText(FIELDVALIDATEERROR); + formPanel.add(textSearch, formData); + + fromDate.setName("date"); + fromDate.setFieldLabel("From"); + formPanel.add(fromDate); + + toDate.setName("date"); + toDate.setFieldLabel("To"); + formPanel.add(toDate); + + textFull.setFieldLabel("Full Text"); + textFull.setAllowBlank(true); + formPanel.add(textFull, formData); + + this.tabSearch.add(formPanel); + + bSearch.addSelectionListener(new SelectionListener() { + public void componentSelected(ButtonEvent ce) { + if (textSearch.getValue() == null || textSearch.getValue() == "" || !textSearch.isValid()) { + // textSearch.fireEvent(Events.ValidateEdit); + textSearch.markInvalid(FIELDVALIDATEERROR); + // textSearch.forceInvalid("The field must be alphanumeric"); + + } else { + + Window.alert("submit"); //TODO aysnc ws +// HistoryExample.addItem("search"); + } + } + }); + + + this.bCancel.addSelectionListener(new SelectionListener() { + + @Override + public void componentSelected(ButtonEvent ce) { + resetFieldsInTabSearch(); + + } + }); + + formPanel.setButtonAlign(HorizontalAlignment.LEFT); + + formPanel.addButton(this.bSearch); + formPanel.addButton(this.bCancel); + + + FormButtonBinding binding = new FormButtonBinding(formPanel); + binding.addButton(this.bSearch); + + tabPanel.add(tabSearch); + add(tabPanel); + + } + + + public void resetFieldsInTabSearch(){ + this.textSearch.reset(); + this.textFull.reset(); + this.fromDate.reset(); + this.toDate.reset(); + this.cbNameFilter.reset(); + + } + + public LayoutContainer getTabs() { + + return this; + } + + public String getValueComboNameFilter(){ + + return this.cbViewScope.getRawValue(); + + } + + public void setLabelPath(String path){ + + if(path != null && (!path.isEmpty())) + this.labelPath.setText(path); + else + this.labelPath.setText(EMPTY); + + + } + +} \ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/view/panels/GxtBorderLayoutPanel.java b/src/main/java/org/gcube/portlets/user/workspace/client/view/panels/GxtBorderLayoutPanel.java new file mode 100644 index 0000000..af4cfc5 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/workspace/client/view/panels/GxtBorderLayoutPanel.java @@ -0,0 +1,140 @@ +package org.gcube.portlets.user.workspace.client.view.panels; + +import org.gcube.portlets.user.workspace.client.ConstantsPortlet; +import org.gcube.portlets.user.workspace.client.view.ExplorerPanel; +import org.gcube.portlets.user.workspace.client.view.GxtDetailsContainer; + +import com.extjs.gxt.ui.client.Style.LayoutRegion; +import com.extjs.gxt.ui.client.Style.Scroll; +import com.extjs.gxt.ui.client.event.BoxComponentEvent; +import com.extjs.gxt.ui.client.event.Events; +import com.extjs.gxt.ui.client.event.Listener; +import com.extjs.gxt.ui.client.util.Margins; +import com.extjs.gxt.ui.client.widget.ContentPanel; +import com.extjs.gxt.ui.client.widget.layout.BorderLayout; +import com.extjs.gxt.ui.client.widget.layout.BorderLayoutData; +import com.extjs.gxt.ui.client.widget.layout.FitLayout; + + +/** + * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it + * + */ +public class GxtBorderLayoutPanel extends ContentPanel { + private ContentPanel north = new ContentPanel(); + private ContentPanel west = new ContentPanel(); + private ContentPanel center = new ContentPanel(); + private ContentPanel east = new ContentPanel(); + private ContentPanel south = new ContentPanel(); + private GxtDetailsContainer detailsContainer = null; + private ExplorerPanel expPanel = null; //TODO change position + private GxtSeachAndFilterPanel searchAndFilterContainer; + private GxtCardLayoutResultPanel gxtCardLayoutResultPanel; + + + public GxtBorderLayoutPanel( + GxtSeachAndFilterPanel searchAndFilterContainer2, + ExplorerPanel explorerPanel, + GxtCardLayoutResultPanel gxtCardLayoutResultPanel, + GxtDetailsContainer detailsContainer2) { + + this.searchAndFilterContainer = searchAndFilterContainer2; + this.expPanel = explorerPanel; + this.gxtCardLayoutResultPanel = gxtCardLayoutResultPanel; + this.detailsContainer = detailsContainer2; + + this.initLayout(); + this.createLayouts(); + } + + private void initLayout(){ + + north.setId("NorthPanel"); + north.setLayout(new FitLayout()); + west.setId("WestPanel"); + west.setLayout(new FitLayout()); + center.setId("CenterPanel"); + center.setLayout(new FitLayout()); + center.setHeaderVisible(false); + east.setId("EastPanel"); + center.setScrollMode(Scroll.AUTOX); + center.setBorders(false); + + north.setHeaderVisible(false); + west.setHeading(ConstantsPortlet.EXPLORER); + south.setHeading(ConstantsPortlet.DETAILS); + + south.setLayout(new FitLayout()); + + east.setVisible(false); + south.setVisible(false); + + this.createLayouts(); + } + + public void createLayouts(){ + + final BorderLayout borderLayout = new BorderLayout(); + setLayout(borderLayout); + //setStyleAttribute("padding", "10px"); + setHeaderVisible(false); + +// center.add(this.gridFilter); + + BorderLayoutData northData = new BorderLayoutData(LayoutRegion.NORTH, 55, 55, 70); + northData.setCollapsible(true); + + northData.setSplit(true); //Split bar between regions +// northData.setFloatable(true); + northData.setCollapsible(true); +// northData.setHideCollapseTool(false); +// northData.setSplit(true); + northData.setMargins(new Margins(0, 0, 1, 0)); + + BorderLayoutData westData = new BorderLayoutData(LayoutRegion.WEST, 330,330,400); + westData.setSplit(true); + westData.setCollapsible(true); + westData.setMargins(new Margins(0,1,0,0)); + + BorderLayoutData centerData = new BorderLayoutData(LayoutRegion.CENTER); + centerData.setMargins(new Margins(0)); + + BorderLayoutData eastData = new BorderLayoutData(LayoutRegion.EAST, 150,50,150); + eastData.setSplit(true); + eastData.setCollapsible(true); + eastData.setMargins(new Margins(0,0,0,1)); + + BorderLayoutData southData = new BorderLayoutData(LayoutRegion.SOUTH, 140,140,140); + southData.setSplit(true); + southData.setCollapsible(true); + southData.setMargins(new Margins(1, 0, 0, 0)); + + north.add(this.searchAndFilterContainer); + west.add(this.expPanel); + +// center.add(this.toolbarContainer); + + center.add(this.gxtCardLayoutResultPanel); + + south.add(this.detailsContainer); + + west.addListener(Events.Resize, new Listener(){ + + @Override + public void handleEvent(BoxComponentEvent be) { + + expPanel.getAsycTreePanel().setSizeTreePanel(expPanel.getWidth()-13, expPanel.getHeight()-39); + + if(expPanel.getSmartFolderPanel()!=null) + expPanel.getSmartFolderPanel().setSizeSmartPanel(expPanel.getWidth()-2, expPanel.getHeight()-29); + + } + + }); + + add(north, northData); + add(west, westData); + add(center, centerData); + add(east, eastData); + } +} \ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/view/panels/GxtCardLayoutResultPanel.java b/src/main/java/org/gcube/portlets/user/workspace/client/view/panels/GxtCardLayoutResultPanel.java new file mode 100644 index 0000000..5188e80 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/workspace/client/view/panels/GxtCardLayoutResultPanel.java @@ -0,0 +1,100 @@ +package org.gcube.portlets.user.workspace.client.view.panels; + +import org.gcube.portlets.user.workspace.client.ConstantsPortlet.ViewSwitchTypeInResult; +import org.gcube.portlets.user.workspace.client.view.GxtDetailsContainer; +import org.gcube.portlets.user.workspace.client.view.GxtListView; +import org.gcube.portlets.user.workspace.client.view.grids.GxtGridFilterGroupPanel; +import org.gcube.portlets.user.workspace.client.view.toolbars.GxtToolBarItem; + +import com.extjs.gxt.ui.client.widget.ContentPanel; +import com.extjs.gxt.ui.client.widget.LayoutContainer; +import com.extjs.gxt.ui.client.widget.layout.CardLayout; +import com.extjs.gxt.ui.client.widget.layout.FitLayout; +import com.google.gwt.user.client.Element; + +/** + * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it + * + */ +public class GxtCardLayoutResultPanel extends LayoutContainer{ + + private CardLayout cardLayout = new CardLayout(); + private GxtItemsPanel itemPanel; + private GxtGridFilterGroupPanel gridFilterViewContainer; + private GxtListView iconsViewContainer; + private GxtGridFilterGroupPanel gridGroupViewContainer; + private ContentPanel activePanel = null; + private GxtToolBarItem toolBarItem; + + public GxtCardLayoutResultPanel( + GxtGridFilterGroupPanel gridFilterContainer, + GxtGridFilterGroupPanel gridFilterGroupContainer, + GxtListView listViewContainer, + GxtDetailsContainer detailsContainer) { + + this.gridFilterViewContainer = gridFilterContainer; + this.iconsViewContainer = listViewContainer; + this.gridGroupViewContainer = gridFilterGroupContainer; + + + instanceItemsPanel(); + + } + + private void instanceItemsPanel(){ + this.toolBarItem = new GxtToolBarItem(gridGroupViewContainer); //instance toolbar + this.itemPanel = new GxtItemsPanel(gridFilterViewContainer, iconsViewContainer, gridGroupViewContainer, toolBarItem); + } + + + @Override + protected void onRender(Element parent, int pos) { + super.onRender(parent, pos); + setLayout(new FitLayout()); + + ContentPanel cp = new ContentPanel(); + cp.setHeaderVisible(false); + cp.setLayout(cardLayout); + + cp.add(itemPanel); + + cardLayout.setActiveItem(itemPanel); + activePanel = itemPanel; + + add(cp); + + }; + + public void setActivePanel(ViewSwitchTypeInResult type){ + + + if(type.equals(ViewSwitchTypeInResult.Group) ){ + cardLayout.setActiveItem(itemPanel); + activePanel = itemPanel; + // toolBar.setEnabled(true); + } + + } + + // public GxtGridMessagesFilterPanel getMessagesPanelContainer() { + // return messagesPanelContainer; + // } + + public GxtItemsPanel getItemPanel() { + return itemPanel; + } + + public void setItemPanel(GxtItemsPanel itemPanel) { + this.itemPanel = itemPanel; + } + + + public GxtToolBarItem getToolBarItem() { + return toolBarItem; + } + + public ContentPanel getActivePanel(){ + return activePanel; + } + +} diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/view/panels/GxtItemsPanel.java b/src/main/java/org/gcube/portlets/user/workspace/client/view/panels/GxtItemsPanel.java new file mode 100644 index 0000000..3c72d99 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/workspace/client/view/panels/GxtItemsPanel.java @@ -0,0 +1,38 @@ +package org.gcube.portlets.user.workspace.client.view.panels; + +import org.gcube.portlets.user.workspace.client.view.GxtListView; +import org.gcube.portlets.user.workspace.client.view.grids.GxtGridFilterGroupPanel; +import org.gcube.portlets.user.workspace.client.view.toolbars.GxtToolBarItem; + +import com.extjs.gxt.ui.client.widget.ContentPanel; +import com.extjs.gxt.ui.client.widget.layout.FitLayout; + +/** + * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it + * + */ +public class GxtItemsPanel extends ContentPanel{ + private GxtToolBarItem toolBarItem; + private GxtGridFilterGroupPanel gridFilterViewContainer; + private GxtListView iconsViewContainer; + private GxtGridFilterGroupPanel gridGroupViewContainer; + + + public GxtItemsPanel(GxtGridFilterGroupPanel gridFilterViewContainer,GxtListView iconsViewContainer, GxtGridFilterGroupPanel gridGroupViewContainer, GxtToolBarItem toolBarItem) { + this.gridFilterViewContainer = gridFilterViewContainer; + this.iconsViewContainer = iconsViewContainer; + this.gridGroupViewContainer = gridGroupViewContainer; + this.toolBarItem = toolBarItem; + setBorders(false); + setBodyBorder(false); + setHeaderVisible(false); + + this.setLayout(new FitLayout()); + setTopComponent(this.toolBarItem.getToolBar()); + + add(gridGroupViewContainer); + + } + + +} diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/view/panels/GxtSeachAndFilterPanel.java b/src/main/java/org/gcube/portlets/user/workspace/client/view/panels/GxtSeachAndFilterPanel.java new file mode 100644 index 0000000..31b7e83 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/workspace/client/view/panels/GxtSeachAndFilterPanel.java @@ -0,0 +1,268 @@ +package org.gcube.portlets.user.workspace.client.view.panels; + +import java.util.List; + +import org.gcube.portlets.user.workspace.client.AppController; +import org.gcube.portlets.user.workspace.client.ConstantsExplorer; +import org.gcube.portlets.user.workspace.client.ConstantsPortlet; +import org.gcube.portlets.user.workspace.client.event.SaveSmartFolderEvent; +import org.gcube.portlets.user.workspace.client.event.ScopeChangeEvent; +import org.gcube.portlets.user.workspace.client.event.SearchTextEvent; +import org.gcube.portlets.user.workspace.client.model.ScopeModel; +import org.gcube.portlets.user.workspace.client.view.GxtComboBox; + +import com.extjs.gxt.ui.client.Style.HorizontalAlignment; +import com.extjs.gxt.ui.client.Style.VerticalAlignment; +import com.extjs.gxt.ui.client.event.ComponentEvent; +import com.extjs.gxt.ui.client.event.KeyListener; +import com.extjs.gxt.ui.client.event.SelectionChangedEvent; +import com.extjs.gxt.ui.client.event.SelectionChangedListener; +import com.extjs.gxt.ui.client.widget.HorizontalPanel; +import com.extjs.gxt.ui.client.widget.LayoutContainer; +import com.extjs.gxt.ui.client.widget.VerticalPanel; +import com.extjs.gxt.ui.client.widget.form.ComboBox; +import com.extjs.gxt.ui.client.widget.form.DateField; +import com.extjs.gxt.ui.client.widget.form.SimpleComboBox; +import com.extjs.gxt.ui.client.widget.form.TextField; +import com.extjs.gxt.ui.client.widget.layout.FitLayout; +import com.google.gwt.dom.client.Style.Unit; +import com.google.gwt.event.dom.client.ClickEvent; +import com.google.gwt.event.dom.client.ClickHandler; +import com.google.gwt.event.logical.shared.ResizeEvent; +import com.google.gwt.event.logical.shared.ResizeHandler; +import com.google.gwt.user.client.Window; +import com.google.gwt.user.client.ui.Button; +import com.google.gwt.user.client.ui.HTML; +import com.google.gwt.user.client.ui.RootPanel; + +/** + * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it + * @author Massimiliano Assante ISTI-CNR + * + * @version 1.0 May 14th 2012 + */ +public class GxtSeachAndFilterPanel extends LayoutContainer { + + private GxtComboBox comboBoxGxt = null; + private ComboBox cbViewScope = null; + private HTML txtViewScope = new HTML(""+ConstantsPortlet.VIEWSPACE+":"); + private final TextField textSearch = new TextField(); + private Button bSearch = new Button(ConstantsPortlet.SEARCH); + private Button bCancel = new Button(ConstantsPortlet.CANCEL); + private Button bSave = new Button(ConstantsPortlet.SAVE); + private TextField textFull = new TextField(); + private DateField fromDate = new DateField(); + private DateField toDate = new DateField(); + private SimpleComboBox cbNameFilter = null; + private HorizontalPanel toolbarPathPanel = null; + private boolean isSearchActive = false; + private VerticalPanel cp = new VerticalPanel(); + + HorizontalPanel hp = new HorizontalPanel(); + HorizontalPanel hp2 = new HorizontalPanel(); + + HorizontalPanel hpMain = new HorizontalPanel(); + + public GxtSeachAndFilterPanel(HorizontalPanel toolbarContainer) { + + txtViewScope.getElement().getStyle().setColor("#15428B"); + txtViewScope.getElement().getStyle().setFontSize(12, Unit.PX); + + setLayout(new FitLayout()); + setBorders(true); + setId("SearchAndFilter"); + + this.comboBoxGxt = new GxtComboBox(); + this.cbViewScope = this.comboBoxGxt.getComboViewScope(); + this.cbNameFilter = this.comboBoxGxt.getComboStringFilter(); + + this.cbViewScope.setWidth(300); + this.cbViewScope.setAutoWidth(true); + + this.toolbarPathPanel = toolbarContainer; + cp.add(this.toolbarPathPanel); + + + + hp.setStyleAttribute("padding", "2px"); + + this.cbViewScope.setStyleAttribute("margin-left", "5px"); + this.cbViewScope.setStyleAttribute("margin-right", "100px"); + + seVisibleButtonsCancelSave(false); + + textSearch.setAllowBlank(true); + textSearch.setEmptyText(ConstantsPortlet.SEARCHINWORSPACE); + textSearch.setWidth(325); + + textSearch.setRegex("^[a-zA-Z0-9]+[ a-zA-Z0-9_().-]*"); //alphanumeric + textSearch.getMessages().setRegexText(ConstantsExplorer.MESSAGE_SEARCH_FORCE_APHANUMERIC); + textSearch.setAutoValidate(true); + hp.add(textSearch); + + bSearch.setStyleName("wizardButton"); + bSearch.getElement().getStyle().setMarginLeft(3, Unit.PX); + bCancel.setStyleName("wizardButton"); + bCancel.getElement().getStyle().setMarginLeft(3, Unit.PX); + bSave.setStyleName("wizardButton"); + bSave.getElement().getStyle().setMarginLeft(3, Unit.PX); + + hp.add(bSearch); + // hp.add(bCancel); + hp.add(bSave); + + bSearch.setWidth("70px"); + bSave.setWidth("70px"); + + hp2.setHorizontalAlign(HorizontalAlignment.RIGHT); + hp2.setVerticalAlign(VerticalAlignment.MIDDLE); + hp2.add(txtViewScope); + hp2.add(cbViewScope); + + cbViewScope.setStyleAttribute("margin-top", "2px"); + + + hpMain.add(hp); + hpMain.add(hp2); + cp.add(hpMain); + + this.addListeners(); + + add(cp); + + updateSize(); + Window.addResizeHandler(new ResizeHandler() { + @Override + public void onResize(ResizeEvent event) { + updateSize(); + } + }); + + layout(); + } + + /** + * Update window size + */ + public void updateSize() { + RootPanel workspace = RootPanel.get(ConstantsPortlet.WORKSPACEDIV); + int leftBorder = workspace.getAbsoluteLeft(); + int rootWidth = Window.getClientWidth() - 2* leftBorder; //- rightScrollBar; + hp.setWidth(rootWidth - 400); + } + + public void searchText(String value){ + textSearch.setValue(value); + seVisibleButtonsCancelSave(true); + AppController.getEventBus().fireEvent(new SearchTextEvent(value)); + } + + private void addListeners(){ + + bSearch.addClickHandler(new ClickHandler() { + @Override + public void onClick(ClickEvent event) { + if(textSearch.getValue()!=null && !textSearch.getValue().isEmpty() && textSearch.isValid()){ +// seVisibleButtonsCancelSave(true); +// AppController.getEventBus().fireEvent(new SearchTextEvent(textSearch.getValue())); + searchText(textSearch.getValue()); + } + } + }); + + KeyListener keyListener = new KeyListener() { + public void componentKeyUp(ComponentEvent event) { + if (event.getKeyCode() == 13) { // KEY_ENTER +// seVisibleButtonsCancelSave(true); +// AppController.getEventBus().fireEvent(new SearchTextEvent(textSearch.getValue())); + searchText(textSearch.getValue()); + } + } + }; + + textSearch.addKeyListener(keyListener); +// +// bCancel.addClickHandler(new ClickHandler() { +// @Override +// public void onClick(ClickEvent event) { +// if(textSearch.getValue()!=null && !textSearch.getValue().isEmpty() && textSearch.isValid()){ +// searchCancel(); +// AppController.getEventBus().fireEvent(new SearchTextEvent(null)); +// } +// } +// }); + + bSave.addClickHandler(new ClickHandler() { + @Override + public void onClick(ClickEvent event) { + if(textSearch.getValue()!=null && !textSearch.getValue().isEmpty() && textSearch.isValid()){ + if (textSearch.getValue() != null && textSearch.getValue().length()>0) { + AppController.getEventBus().fireEvent(new SaveSmartFolderEvent(null, textSearch.getValue(), null)); + } + } + } + }); + + this.cbViewScope.addSelectionChangedListener(new SelectionChangedListener() { + + @Override + public void selectionChanged(SelectionChangedEvent se) { + + ScopeModel scope = se.getSelectedItem(); + + AppController.getEventBus().fireEvent(new ScopeChangeEvent(scope.getId())); + + } + }); + + } + + public void resetFields(){ + this.textSearch.reset(); + this.textFull.reset(); + this.fromDate.reset(); + this.toDate.reset(); + this.cbNameFilter.reset(); + + } + + public void seVisibleButtonsCancelSave(boolean flag){ + + this.bCancel.setVisible(flag); + this.bSave.setVisible(flag); + } + + public void searchCancel(){ + resetFields(); + seVisibleButtonsCancelSave(false); + // AppController.getEventBus().fireEvent(new SearchTextEvent(null)); + } + + public boolean isSearchActive(){ + return this.isSearchActive; + } + + public void setListScope(List listScope){ + + this.comboBoxGxt.setListScope(listScope); + } + + public void selectScopeByIndex(int index){ + + this.cbViewScope.setValue(cbViewScope.getStore().getAt(index)); + } + + public void setSearchActive(boolean isSearchActive) { + System.out.println("#################SET SEARCH ACTIVE in GRID " + isSearchActive); + this.isSearchActive = isSearchActive; + } + + public void setVisibleButtonSave(boolean bool){ + this.bSave.setVisible(bool); + } + + public void setEmptyText(String emptyText){ + textSearch.setEmptyText(emptyText); + } + +} \ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/view/toolbars/GxtPathPanel.java b/src/main/java/org/gcube/portlets/user/workspace/client/view/toolbars/GxtPathPanel.java new file mode 100644 index 0000000..ffca941 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/workspace/client/view/toolbars/GxtPathPanel.java @@ -0,0 +1,125 @@ +package org.gcube.portlets.user.workspace.client.view.toolbars; + +import java.util.ArrayList; +import java.util.LinkedHashMap; + +import org.gcube.portlets.user.workspace.client.AppController; +import org.gcube.portlets.user.workspace.client.event.PathElementSelectedEvent; +import org.gcube.portlets.user.workspace.client.model.FileModel; +import org.gcube.portlets.user.workspace.client.resources.Resources; + +import com.extjs.gxt.ui.client.event.ButtonEvent; +import com.extjs.gxt.ui.client.event.Events; +import com.extjs.gxt.ui.client.event.Listener; +import com.extjs.gxt.ui.client.widget.HorizontalPanel; +import com.extjs.gxt.ui.client.widget.Text; +import com.extjs.gxt.ui.client.widget.WidgetComponent; +import com.extjs.gxt.ui.client.widget.button.Button; +import com.google.gwt.user.client.ui.Image; + +/** + * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it + * + */ +public class GxtPathPanel { + + private static final String ROOT_NAME = "Workspace"; + + private HorizontalPanel toolBar = new HorizontalPanel(); + private Text txtPath = new Text("PATH "); + private LinkedHashMap hashFileModel; // Ordered-HashMap + boolean rootAdded = false; + WidgetComponent hardDiskIcon = new WidgetComponent(new Image (Resources.getImageHardDisk())); + + public GxtPathPanel() { + toolBar = new HorizontalPanel(); + toolBar.setHeight("25px"); + initToolbar(); + } + + public HorizontalPanel getToolBarPathPanel() { + return toolBar; + } + + public void setPath(ArrayList parents) { + + initToolbarWithoutFakeRoot(); + + if (parents != null && parents.size() > 0) { + + ArrayList