Compare commits

..

5 Commits

13 changed files with 214 additions and 1076 deletions

View File

@ -1,11 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/workspace-6.30.0/WEB-INF/classes" path="src/main/java">
<classpathentry kind="src" output="target/workspace-6.26.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/workspace-6.26.0-SNAPSHOT/WEB-INF/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="test" value="true"/>
@ -19,21 +24,16 @@
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/workspace-6.30.0/WEB-INF/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/workspace-6.30.0/WEB-INF/classes"/>
<classpathentry kind="output" path="target/workspace-6.26.0-SNAPSHOT/WEB-INF/classes"/>
</classpath>

View File

@ -1,4 +1,4 @@
eclipse.preferences.version=1
lastWarOutDir=/home/francescomangiacrapa/git/workspace/target/workspace-6.30.0
lastWarOutDir=/home/francescomangiacrapa/git/workspace/target/workspace-6.26.0-SNAPSHOT
warSrcDir=src/main/webapp
warSrcDirIsOutput=false

View File

@ -1,689 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
<wb-module deploy-name="workspace-6.30.0">
<wb-module deploy-name="workspace-6.25.0-SNAPSHOT">
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/target/generated-sources/gwt"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
<dependent-module archiveName="ckan-metadata-publisher-widget-2.2.1.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/ckan-metadata-publisher-widget/ckan-metadata-publisher-widget">
<dependency-type>uses</dependency-type>
</dependent-module>
<dependent-module archiveName="uri-resolver-manager-1.8.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/uri-resolver-manager/uri-resolver-manager">
<dependency-type>uses</dependency-type>
</dependent-module>
<property name="java-output-path" value="/${module}/target/www/WEB-INF/classes"/>
<property name="java-output-path" value="/${module}/target/www/WEB-INF/classes"/>
<property name="context-root" value="workspace"/>
</wb-module>
</wb-module>
</project-modules>

View File

@ -4,63 +4,10 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [v6.30.0] - 2024-02-20
- Moved to maven parent 1.2.0
- Equipped with the new Catalogue Publishing Widget [#26825]
- Fixed Incident [#26678]
## [v6.29.0] - 2023-04-04
- Just to release the patch #24929 in the 'storagehub-client-wrapper'
## [v6.28.6] - 2022-09-05
- Just to release the fixes #23676, #23789 implemented in the ws-tree
## [v6.28.5] - 2022-06-27
- [#23523] Updated to maven-portal-bom 3.6.4
- [#23491] Just to release the Publishing Widget enhancement #23491
## [v6.28.3] - 2022-05-02
- [#23225] Just including the enhancement #23225
## [v6.28.2] - 2022-03-24
## [v6.26.0-SNAPSHOT] - 2021-02-22
#### Enhancements
- [#23020] Just including the enhancement #23020
## [v6.28.1] - 2021-12-20
#### Fixes
- [#22578] Including workspace-tree-widget bug fixing
## [v6.28.0] - 2021-11-05
#### Enhancements
- [#22251] Make workspace file size field smart
## [v6.27.1] - 2021-06-22
[#21575] Including workspace-tree-widget bug fixing
Moved to maven-portal-bom 3.6.3
## [v6.27.0] - 2021-05-10
[#21387] Harmonized version of jackson libs to 2.8.11 to resolve conflict
[#21346] Applying new workflow to manage the "Sync with Tredds" facility
[#21444] Moved to maven-portal-bom >= 3.6.2-SNAPSHOT
## [v6.26.0] - 2021-04-12
#### Enhancements
[#21153] Upgrade the maven-portal-bom to 3.6.1 version
[#20762] Moved to ckan-metadata-publisher-widget 2.X
## [v6.25.4] - 2021-03-10
@ -85,31 +32,31 @@ Just to include new SHUB model
[#19952] Fixed incident
## [v6.25.0] - 2020-08-25
## [v6.25.0] [r4.25.0] - 2020-08-25
#### Enhancements
[#19600] revisit the "Get Info" Dialog in a modern view
## [v6.24.1] - 2020-06-22
## [v6.24.1] [r4.24.0] - 2020-06-22
[#19493] Just to include the ckan-util-library patched
## [v6.24.0] - 2020-05-18
## [v6.24.0] [r4.23.0] - 2020-05-18
**New Features**
[#19058] Restore operation: the user has to select the destination folder
## [v6.23.2] - 2020-04-21
## [v6.23.2] [r4.22.0] - 2020-04-21
Just to include the new shub-client released
## [v6.23.1] - 2020-03-27
## [v6.23.1] [r4.21.0] - 2020-03-27
Ported to git/jenkins

View File

@ -1,6 +1,6 @@
# gCube Workspace
# gCube Workspace Portlet
The gCube Workspace is a web-system (made from many components) that built a web-gui to manage the Workspace in the D4Science infrastructure. The Workspace is a collaborative area where users can exchange and organize information objects (workspace items) according to their specific needs.
The gCube Workspace Portlet is a web-gui to manage the gCube workspace, a collaborative area where users can exchange and organize information objects (workspace items) according to their specific needs.
Every user of any Virtual Research Environment is provided with this area for the exchange of workspace objects (share) with other users. Such an area is further organized in workspaces as to resemble a classic folder-based file system.
## Built With
@ -8,42 +8,6 @@ Every user of any Virtual Research Environment is provided with this area for th
* [OpenJDK](https://openjdk.java.net/) - The JDK used
* [Maven](https://maven.apache.org/) - Dependency Management
**Uses**
* GWT v.2.7.0. [GWT](http://www.gwtproject.org) is licensed under [Apache License 2.0](http://www.gwtproject.org/terms.html)
* GWT-Bootstrap v.2.3.2.0. [GWT-Bootstrap](https://github.com/gwtbootstrap) is licensed under [Apache License 2.0](http://www.apache.org/licenses/LICENSE-2.0)
* GXT v2.2.5 is licensed under [GPLv3](https://www.gnu.org/licenses/gpl-3.0.html)
**Related Components**
* [Workpsace Tree Widget](https://code-repo.d4science.org/gCubeSystem/workspace-tree-widget)
* [Workpsace Sharing Widget](https://code-repo.d4science.org/gCubeSystem/workspace-sharing-widget)
* [Task Executor Widget](https://code-repo.d4science.org/gCubeSystem/ws-task-executor-widget)
* [Catalogue Metadata Publisher Widget](https://code-repo.d4science.org/gCubeSystem/ckan-metadata-publisher-widget)
* [StorageHub Client Wrapper](https://code-repo.d4science.org/gCubeSystem/storagehub-client-wrapper)
and others. You can discovery all dependencies via dependency hierarchy (e.g. use [dependency:tree](https://maven.apache.org/plugins/maven-dependency-plugin/tree-mojo.html))
## Showcase
**Workspace Home**
<img src="https://gcube.wiki.gcube-system.org/images_gcube/c/cf/Showcase_Workspace.png" style="max-width:800px;" alt="Workspace Home" />
**Workspace 'Context Menu' facility**
<img src="https://gcube.wiki.gcube-system.org/images_gcube/2/2d/Workspace_Context_Menu.png" style="max-width:800px;" alt="Workspace Context Menu" />
**Workspace 'Get Info' facility**
<img src="https://gcube.wiki.gcube-system.org/images_gcube/2/27/Showcase_Workspace_Get_Info.png" style="max-width:800px;" alt="Workspace Get Info" />
<br />
<img src="https://gcube.wiki.gcube-system.org/images_gcube/8/83/Showcase_Workspace_GetInfo3.png" style="max-width:800px;" alt="Workspace Get Info 3" />
**Workspace 'Get Shareable Link' facility**
<img src="https://gcube.wiki.gcube-system.org/images_gcube/7/72/Showcase_Workspace_GetShareableLink.png" style="max-width:800px;" alt="Workspace Get Shareable Link" />
## Documentation
You can find the Workspace documentation at [Wiki gCube Workpsace](https://wiki.gcube-system.org/workspace)

119
pom.xml
View File

@ -6,14 +6,14 @@
<parent>
<artifactId>maven-parent</artifactId>
<groupId>org.gcube.tools</groupId>
<version>1.2.0</version>
<version>1.1.0</version>
<relativePath />
</parent>
<groupId>org.gcube.portlets.user</groupId>
<artifactId>workspace</artifactId>
<packaging>war</packaging>
<version>6.30.0</version>
<version>6.26.0-SNAPSHOT</version>
<name>gCube Workspace Portlet</name>
<description>
gCube Workspace Portlet is a web-gui to manage the gCube workspace, a collaborative area where users can exchange and organize information objects (workspace items) according to their specific needs.
@ -29,9 +29,6 @@
<maven.compiler.target>1.8</maven.compiler.target>
<webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory>
<additionalparam>-Xdoclint:none</additionalparam>
<jackson.version>2.8.11</jackson.version>
<gcube-portal-bom-version>3.7.0</gcube-portal-bom-version>
<gxt2.2.5-gwt2.X-version>2.7.0</gxt2.2.5-gwt2.X-version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
@ -43,48 +40,31 @@
<url>https://code-repo.d4science.org/gCubeSystem/${project.artifactId}</url>
</scm>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.gcube.distribution</groupId>
<artifactId>maven-portal-bom</artifactId>
<version>${gcube-portal-bom-version}</version>
<version>3.6.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<profiles>
<!-- PROD profile -->
<!-- <profile> -->
<!-- <id>workspace-release-profile</id> -->
<!-- <activation> -->
<!-- <property> -->
<!-- <name>Release</name> -->
<!-- </property> -->
<!-- </activation> -->
<!-- <properties> -->
<!-- <gcube-portal-bom-version>3.7.0</gcube-portal-bom-version> -->
<!-- </properties> -->
<!-- </profile> -->
<!-- DEV profile -->
<!-- <profile> -->
<!-- <id>workspace-snapshot-profile</id> -->
<!-- <activation> -->
<!-- <property> -->
<!-- <name>!Release</name> -->
<!-- </property> -->
<!-- </activation> -->
<!-- <properties> -->
<!-- <gcube-portal-bom-version>3.8.0-SNAPSHOT</gcube-portal-bom-version> -->
<!-- </properties> -->
<!-- </profile> -->
</profiles>
<dependencies>
<!-- UNCOMMENT THIS TO RUN IN DEVO MODE -->
<!-- <dependency> -->
<!-- <groupId>xerces</groupId> -->
<!-- <artifactId>xerces</artifactId> -->
<!-- <version>2.4.0</version> -->
<!-- </dependency> -->
<!-- This dependency is needed and is need on TOP to use GWT UI BInder
without old Xerces version of gCore complaining -->
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
@ -111,7 +91,6 @@
<version>2.9.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gcube.common</groupId>
<artifactId>authorization-client</artifactId>
@ -152,21 +131,6 @@
<dependency>
<groupId>org.gcube.contentmanagement</groupId>
<artifactId>storage-manager-wrapper</artifactId>
<!-- Resolving conflict (NoSuchMethodError stax2/ri/EmptyIterator) with
version stax2-api:jar:4.1 see https://support.d4science.org/issues/26825#note-5 -->
<exclusions>
<exclusion>
<groupId>org.codehaus.woodstox</groupId>
<artifactId>stax2-api</artifactId>
</exclusion>
</exclusions>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.4</version>
<scope>provided</scope>
</dependency>
@ -177,13 +141,16 @@
<scope>compile</scope>
</dependency>
<!-- WebSocket dep (does not work on Jetty) <dependency> <groupId>org.realityforge.gwt.websockets</groupId>
<artifactId>gwt-websockets</artifactId> <version>1.1.2</version> <scope>provided</scope>
</dependency> <dependency> <groupId>javax.websocket</groupId> <artifactId>javax.websocket-api</artifactId>
<version>1.1</version> <scope>provided</scope> </dependency> -->
<!-- FWS -->
<dependency>
<groupId>org.gcube.resources.discovery</groupId>
<artifactId>ic-client</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gcube.core</groupId>
<artifactId>common-scope-maps</artifactId>
@ -191,22 +158,6 @@
</dependency>
<!-- END FWS -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>org.gcube.portlets.widgets</groupId>
<artifactId>session-checker</artifactId>
@ -226,26 +177,9 @@
<dependency>
<groupId>org.gcube.portal</groupId>
<artifactId>social-library-stubs</artifactId>
<version>[1.0.0-SNAPSHOT, 2.0.0)</version>
<artifactId>social-networking-library</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gcube.social-networking</groupId>
<artifactId>social-service-client</artifactId>
<version>[2.0.0-SNAPSHOT, 3.0.0)</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>org.gcube.portal</groupId>
<artifactId>social-networking-library</artifactId>
</exclusion>
<exclusion>
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.gcube.applicationsupportlayer</groupId>
@ -258,12 +192,6 @@
<artifactId>workspace-tree-widget</artifactId>
<version>[6.31.3-SNAPSHOT, 7.0.0-SNAPSHOT)</version>
<scope>compile</scope>
<exclusions>
<exclusion>
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- User Management Core -->
@ -279,6 +207,12 @@
<version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
</dependency>
<!-- Force jackson-annotation dependency to 2.7 version -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>2.7.0</version>
</dependency>
<dependency>
<groupId>javax.portlet</groupId>
@ -300,7 +234,6 @@
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<scope>test</scope>
</dependency>
<dependency>
@ -432,4 +365,4 @@
</plugins>
</build>
</project>
</project>

View File

@ -33,12 +33,11 @@
<inherits
name='org.gcube.portlets.widgets.openlayerbasicwidgets.olbasicwidgets' />
<inherits
name='org.gcube.portlets.widgets.mpformbuilder.MetadataProfileFormBuilder' />
<inherits
name='org.gcube.portlets.widgets.ckandatapublisherwidget.CKanMetadataPublisher' />
<!--<inherits name="org.realityforge.gwt.websockets.WebSockets" /> -->
<!--<inherits name="org.realityforge.gwt.websockets.WebSockets" />-->
<!-- Specify the app entry point class. -->
<entry-point

View File

@ -102,6 +102,7 @@ import org.gcube.portlets.user.workspace.client.view.toolbars.GxtBreadcrumbPathP
import org.gcube.portlets.user.workspace.client.view.trash.WindowTrash;
import org.gcube.portlets.user.workspace.client.view.versioning.WindowVersioning;
import org.gcube.portlets.user.workspace.client.view.windows.DialogConfirm;
import org.gcube.portlets.user.workspace.client.view.windows.DialogGetInfo;
import org.gcube.portlets.user.workspace.client.view.windows.DialogGetInfoBootstrap;
import org.gcube.portlets.user.workspace.client.view.windows.InfoDisplay;
import org.gcube.portlets.user.workspace.client.view.windows.MessageBoxAlert;
@ -135,6 +136,7 @@ import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.shared.HandlerManager;
import com.google.gwt.user.client.Command;
import com.google.gwt.user.client.CommandCanceledException;
import com.google.gwt.user.client.Cookies;
import com.google.gwt.user.client.Timer;
import com.google.gwt.user.client.Window;
@ -587,9 +589,6 @@ public class AppController implements SubscriberInterface {
new MessageBoxAlert("Error", caught.getMessage(), null);
wsPortlet.getGridGroupContainer().unmask();
//Reload the tree and select the root. Fixing Incident [#26678]
AppControllerExplorer.getEventBus().fireEvent(new LoadTreeEvent(true));
}
@ -1418,7 +1417,6 @@ public class AppController implements SubscriberInterface {
//CREATING FOLDER PARENT FOR RPC
final FileModel parent = new FolderModel(folder.getIdentifier(), folder.getName(), folder.getParentFileModel(), true, folder.isShared(), folder.isVreFolder(), folder.isPublic());
parent.setSynchedWithWsThredds(folder.getSynchedWithWsThredds());
wsPortlet.getGridGroupContainer().mask(ConstantsExplorer.LOADING,ConstantsExplorer.LOADINGSTYLE);
appContrExplorer.getRpcWorkspaceService().getFolderChildrenForFileGrid(parent, new AsyncCallback<List<FileGridModel>>() {

View File

@ -1,42 +0,0 @@
package org.gcube.portlets.user.workspace.client.view;
import com.google.gwt.core.client.GWT;
import com.google.gwt.i18n.client.NumberFormat;
/**
* The Class SizeUtil.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Nov 5, 2021
*/
public class SizeUtil {
public static final NumberFormat numberFormat = NumberFormat.getFormat("#,##0.#");
/**
* Readable file size.
*
* @param size the size
* @return the string
*/
public static String readableFileSize(long size) {
GWT.log("Converting size: "+size);
// -1 should be the size of a folder
if (size == -1)
return "";
// in some cases the size returned by SHUB is negative,
// so reporting as 1B to user
if (size < 0)
return "1 byte";
if (size == 0)
return "0 byte";
final String[] units = new String[] { "bytes", "kB", "MB", "GB", "TB" };
int digitGroups = (int) (Math.log10(size) / Math.log10(1024));
return numberFormat.format(size / Math.pow(1024, digitGroups)) +" " +units[digitGroups];
}
}

View File

@ -5,6 +5,7 @@ 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.FileDownloadEvent;
import org.gcube.portlets.user.workspace.client.event.FileDownloadEvent.DownloadType;
import org.gcube.portlets.user.workspace.client.event.ImagePreviewEvent;
@ -17,7 +18,6 @@ import org.gcube.portlets.user.workspace.client.gridevent.StoreGridChangedEvent;
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 org.gcube.portlets.user.workspace.client.view.SizeUtil;
import com.extjs.gxt.ui.client.Style.SelectionMode;
import com.extjs.gxt.ui.client.data.ModelData;
@ -50,24 +50,28 @@ import com.extjs.gxt.ui.client.widget.grid.filters.StringFilter;
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
import com.google.gwt.core.shared.GWT;
import com.google.gwt.i18n.client.DateTimeFormat;
import com.google.gwt.i18n.client.NumberFormat;
import com.google.gwt.user.client.Random;
/**
* The Class GxtGridFilterGroupPanel.
*
* @author Francesco Mangiacrapa francesco.mangiacrapa{@literal @}isti.cnr.it
* Nov 17, 2015
* Nov 17, 2015
*/
public class GxtGridFilterGroupPanel extends LayoutContainer {
private ContentPanel cp = new ContentPanel();
// private ListStore<FileModel> store = ListStoreModel.getInstance().getStore();
private GroupingStore<FileGridModel> store = GroupingStoreModel.getInstance().getStore();
private FileGridModel currentItemSelected = null;
private FileModel currentFolderView = null;
private GroupingView view = new GroupingView();
private boolean groupingEnabled = false;
private final Grid<FileGridModel> grid;
private ColumnModel cm = null;
private NumberFormat number = ConstantsExplorer.numberFormatterKB;
private final Grid<FileGridModel> grid;
private ColumnModel cm = null;
/**
* Instantiates a new gxt grid filter group panel.
@ -76,21 +80,23 @@ public class GxtGridFilterGroupPanel extends LayoutContainer {
*/
public GxtGridFilterGroupPanel(boolean group) {
// setLayout(new FitLayout());
setId("GxtGridFilterGroupPanel " + Random.nextInt());
setId("GxtGridFilterGroupPanel "+Random.nextInt());
ColumnConfig icon = new ColumnConfig(FileModel.ICON, "", 60);
icon.setSortable(false);
ColumnConfig name = new ColumnConfig(FileGridModel.NAME, FileGridModel.NAME, 280);
ColumnConfig type = new ColumnConfig(FileGridModel.TYPE, FileGridModel.TYPE, 60);
ColumnConfig lastUpdate = new ColumnConfig(FileGridModel.LASTMODIFIED, "Last Update", 90);
lastUpdate.setDateTimeFormat(DateTimeFormat.getFormat("dd MMM hh:mm aaa yyyy"));
ColumnConfig category = new ColumnConfig(FileModel.HUMAN_REDABLE_CATEGORY, FileModel.HUMAN_REDABLE_CATEGORY,
100);
ColumnConfig category = new ColumnConfig(FileModel.HUMAN_REDABLE_CATEGORY, FileModel.HUMAN_REDABLE_CATEGORY, 100);
ColumnConfig size = new ColumnConfig(FileGridModel.SIZE, FileGridModel.SIZE, 45);
ColumnConfig ownerFullName = new ColumnConfig(FileGridModel.OWNERFULLNAME, FileGridModel.OWNER, 90);
size.setEditor(new CellEditor(new NumberField()));
if (group)
if(group)
cm = new ColumnModel(Arrays.asList(icon, name, ownerFullName, type, lastUpdate, size, category));
else
cm = new ColumnModel(Arrays.asList(icon, name, ownerFullName, type, lastUpdate, size));
@ -104,46 +110,50 @@ public class GxtGridFilterGroupPanel extends LayoutContainer {
grid = new Grid<FileGridModel>(store, columnModel);
grid.getView().setAutoFill(true);
view.setShowGroupedColumn(false);
view.setForceFit(true);
grid.setView(view);
view.setEmptyText(FileGridModel.EMPTY);
view.setShowGroupedColumn(false);
view.setForceFit(true);
grid.setView(view);
view.setEmptyText(FileGridModel.EMPTY);
if (group) {
store.groupBy(FileGridModel.HUMAN_REDABLE_CATEGORY);
groupingEnabled = true;
}
if(group){
store.groupBy(FileGridModel.HUMAN_REDABLE_CATEGORY);
groupingEnabled = true;
}
GridCellRenderer<FileGridModel> folderRender = new GridCellRenderer<FileGridModel>() {
GridCellRenderer<FileGridModel> folderRender = new GridCellRenderer<FileGridModel>() {
@Override
public String render(FileGridModel model, String property, ColumnData config, int rowIndex, int colIndex,
ListStore<FileGridModel> store, Grid<FileGridModel> grid) {
String val = model.get(property);
if (val == null || val.isEmpty())
return "";
public String render(FileGridModel model, String property, ColumnData config, int rowIndex, int colIndex, ListStore<FileGridModel> store, Grid<FileGridModel> grid) {
String val = model.get(property);
if(val==null || val.isEmpty())
return "";
return "<span qtitle='" + columnModel.getColumnById(property).getHeader() + "' qtip='" + val + "' >"
+ val + "</span>";
return "<span qtitle='" + columnModel.getColumnById(property).getHeader() + "' qtip='" + val + "' >" + val + "</span>";
}
};
};
GridCellRenderer<FileGridModel> kbRender = new GridCellRenderer<FileGridModel>() {
@Override
public String render(FileGridModel model, String property, ColumnData config, int rowIndex, int colIndex,
ListStore<FileGridModel> store, Grid<FileGridModel> grid) {
GridCellRenderer<FileGridModel> kbRender = new GridCellRenderer<FileGridModel>() {
@Override
public String render(FileGridModel model, String property, ColumnData config,
int rowIndex, int colIndex, ListStore<FileGridModel> store, Grid<FileGridModel> grid) {
long value = (Long) model.get(property);
//
if (value != -1) {
String theSize = SizeUtil.readableFileSize(value);
return "<span>" + theSize + "</span>";
}
return "";
}
};
long value = (Long) model.get(property);
size.setRenderer(kbRender);
type.setRenderer(folderRender);
if(value!=-1){
double kb = value/1024;
if(kb<1)
kb=1;
return "<span>" + number.format(kb) + "</span>";
}
return "";
}
};
size.setRenderer(kbRender);
type.setRenderer(folderRender);
//setAlphanumericStoreSorter(grid);
GridFilters filters = new GridFilters();
filters.setLocal(true);
@ -176,16 +186,17 @@ public class GxtGridFilterGroupPanel extends LayoutContainer {
ModelData target = se.getSelectedItem();
if (target != null) {
if(target!=null){
currentItemSelected = (FileGridModel) target;
boolean isMultiselection = false;
if (se.getSelection() != null && se.getSelection().size() > 1)
if(se.getSelection()!=null && se.getSelection().size()>1)
isMultiselection = true;
AppController.getEventBus().fireEvent(new GridElementSelectedEvent(target, isMultiselection));
} else {
}
else{
currentItemSelected = null;
AppController.getEventBus().fireEvent(new GridElementUnSelectedEvent());
}
@ -193,6 +204,7 @@ public class GxtGridFilterGroupPanel extends LayoutContainer {
}
});
grid.addListener(Events.RowDoubleClick, new Listener<BaseEvent>() {
@Override
@ -200,40 +212,39 @@ public class GxtGridFilterGroupPanel extends LayoutContainer {
FileGridModel fileModel = grid.getSelectionModel().getSelectedItem();
if (fileModel != null)
if(fileModel!=null)
fireEventByFileModelType(fileModel);
// if(fileModel.isDirectory())
// AppController.getEventBus().fireEvent(new
// DoubleClickElementSelectedEvent(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<GridEvent<FileGridModel>>() {
grid.setContextMenu(null); //add context menu null - ignore browse event right click
grid.addListener(Events.OnContextMenu, new Listener<GridEvent<FileGridModel>>(){
@Override
public void handleEvent(GridEvent<FileGridModel> be) {
public void handleEvent(GridEvent<FileGridModel> be)
{
if (be.isRightClick()) {
if(be.isRightClick()){
List<FileGridModel> selection = grid.getSelectionModel().getSelection();
if (selection != null && selection.size() > 0) {
List<FileGridModel> selection = grid.getSelectionModel().getSelection();
if(selection!=null && selection.size()>0){
// if(grid.getSelectionModel().getSelection().size()>1){
// new InfoDisplay("Info", "The context menu is not available if multi-select is active");
// return;
// }
List<FileModel> selected = new ArrayList<FileModel>(selection.size());
for (FileGridModel fileGridModel : selection) {
selected.add(fileGridModel);
List<FileModel> selected = new ArrayList<FileModel>(selection.size());
for (FileGridModel fileGridModel : selection) {
selected.add(fileGridModel);
}
// List<FileGridModel> selectedItems =
// grid.getSelectionModel().getSelectedItems();
AppController.getEventBus()
.fireEvent(new OpenContextMenuTreeEvent(selected, be.getClientX(), be.getClientY()));
}
}
//List<FileGridModel> selectedItems = grid.getSelectionModel().getSelectedItems();
AppController.getEventBus().fireEvent(new OpenContextMenuTreeEvent(selected, be.getClientX(), be.getClientY()));
}
}
}
});
@ -270,7 +281,7 @@ public class GxtGridFilterGroupPanel extends LayoutContainer {
if (groupingStore != null) {
groupingStore.groupBy(FileGridModel.HUMAN_REDABLE_CATEGORY);
}
this.groupingEnabled = true;
this.groupingEnabled = true;
}
}
@ -279,18 +290,19 @@ public class GxtGridFilterGroupPanel extends LayoutContainer {
*
* @param target the target
*/
private void fireEventByFileModelType(FileModel target) {
private void fireEventByFileModelType(FileModel target){
if (target.isDirectory()) {
if(target.isDirectory()){
AppController.getEventBus().fireEvent(new DoubleClickElementSelectedEvent(target));
return;
}
switch (target.getGXTFolderItemType()) {
switch(target.getGXTFolderItemType()){
case EXTERNAL_IMAGE:
case IMAGE_DOCUMENT:
AppController.getEventBus().fireEvent(new ImagePreviewEvent(target, 0, 0));
AppController.getEventBus().fireEvent(new ImagePreviewEvent(target,0, 0));
break;
case EXTERNAL_FILE:
case EXTERNAL_PDF_FILE:
@ -299,8 +311,7 @@ public class GxtGridFilterGroupPanel extends LayoutContainer {
case URL_DOCUMENT:
case EXTERNAL_RESOURCE_LINK:
AppController.getEventBus().fireEvent(new FileDownloadEvent(target.getIdentifier(), target.getName(),
DownloadType.SHOW, target.isDirectory() || target.isVreFolder(), null));
AppController.getEventBus().fireEvent(new FileDownloadEvent(target.getIdentifier(), target.getName(), DownloadType.SHOW, target.isDirectory() || target.isVreFolder(), null));
break;
case EXTERNAL_URL:
AppController.getEventBus().fireEvent(new ShowUrlEvent(target));
@ -316,26 +327,27 @@ public class GxtGridFilterGroupPanel extends LayoutContainer {
}
/**
* Reset store.
*/
private void resetStore() {
private void resetStore(){
store.removeAll();
}
/**
* Update store.
*
* @param result the result
* @return true, if successful
*/
public boolean updateStore(List<FileGridModel> result) {
public boolean updateStore(List<FileGridModel> result){
resetStore();
if (result != null && result.size() > 0) {
for (FileGridModel file : result) {
// GWT.log("File: "+file.getName() + " has sync:
// "+file.getSynchedThreddsStatus());
if(result!= null && result.size()>0){
for(FileGridModel file: result){
//GWT.log("File: "+file.getName() + " has sync: "+file.getSynchedThreddsStatus());
file.setIcon();
}
store.add(result);
@ -344,15 +356,16 @@ public class GxtGridFilterGroupPanel extends LayoutContainer {
return false;
}
/**
* Adds the to store.
*
* @param result the result
* @return true, if successful
*/
public boolean addToStore(FileGridModel result) {
public boolean addToStore(FileGridModel result){
if (result != null) {
if(result!= null){
result.setIcon();
store.add(result);
return true;
@ -365,7 +378,7 @@ public class GxtGridFilterGroupPanel extends LayoutContainer {
*
* @return the selected item
*/
public FileGridModel getSelectedItem() {
public FileGridModel getSelectedItem(){
return currentItemSelected;
}
@ -375,7 +388,7 @@ public class GxtGridFilterGroupPanel extends LayoutContainer {
*
* @return the selected items
*/
public List<FileGridModel> getSelectedItems() {
public List<FileGridModel> getSelectedItems(){
return grid.getSelectionModel().getSelection();
}
@ -385,9 +398,9 @@ public class GxtGridFilterGroupPanel extends LayoutContainer {
*
* @return the ids selected items
*/
public List<String> getIdsSelectedItems() {
public List<String> getIdsSelectedItems(){
if (grid.getSelectionModel().getSelection() != null) {
if(grid.getSelectionModel().getSelection()!=null){
List<String> ids = new ArrayList<String>();
for (FileModel file : grid.getSelectionModel().getSelection()) {
@ -408,18 +421,22 @@ public class GxtGridFilterGroupPanel extends LayoutContainer {
*/
public boolean deleteItem(String identifier) {
FileGridModel fileTarget = getFileGridModelByIdentifier(identifier);
FileGridModel fileTarget = getFileGridModelByIdentifier(identifier);
if (fileTarget != null) {
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");
}
else
System.out.println("Delete Error: file target with " + identifier + " identifier not exist in store" );
return false;
}
/**
* Gets the current folder view.
*
@ -429,6 +446,7 @@ public class GxtGridFilterGroupPanel extends LayoutContainer {
return currentFolderView;
}
/**
* Sets the current folder view.
*
@ -438,32 +456,35 @@ public class GxtGridFilterGroupPanel extends LayoutContainer {
this.currentFolderView = currentFolderView;
}
/**
* Rename item.//
*
* @param itemIdentifier the item identifier
* @param newName the new name
* @param extension the extension
* @param newName the new name
* @param extension the extension
* @return true, if successful
*/
public boolean renameItem(String itemIdentifier, String newName, String extension) {
if (itemIdentifier != null) {
FileGridModel fileTarget = getFileGridModelByIdentifier(itemIdentifier);
if (fileTarget != null) {
if(itemIdentifier!=null){
FileGridModel fileTarget = getFileGridModelByIdentifier(itemIdentifier);
if(fileTarget!=null){
Record record = store.getRecord(fileTarget);
if (record != null) {
if (extension != null)
record.set(FileGridModel.NAME, newName + extension);
if(record!=null){
if(extension!= null)
record.set(FileGridModel.NAME, newName+extension);
else
record.set(FileGridModel.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");
}
else
System.out.println("Record Error: file target not exist in store" );
}
else
System.out.println("Rename Error: file target is null" );
return false;
@ -475,7 +496,7 @@ public class GxtGridFilterGroupPanel extends LayoutContainer {
* @param id the id
* @return the file grid model by identifier
*/
public FileGridModel getFileGridModelByIdentifier(String id) {
public FileGridModel getFileGridModelByIdentifier(String id){
return store.findModel(FileGridModel.IDENTIFIER, id);
}
@ -485,13 +506,13 @@ public class GxtGridFilterGroupPanel extends LayoutContainer {
* @param id the id
* @return true, if successful
*/
public boolean selectItemByFileModelId(String id) {
public boolean selectItemByFileModelId(String id){
if (id != null && !id.isEmpty()) {
if(id!=null && !id.isEmpty()){
FileGridModel fileModel = getFileGridModelByIdentifier(id);
if (fileModel != null) {
if(fileModel!=null){
grid.getSelectionModel().select(fileModel, true);
return true;
}
@ -500,27 +521,29 @@ public class GxtGridFilterGroupPanel extends LayoutContainer {
return false;
}
/**
* Gets the store.
*
* @return the store
*/
public GroupingStore<FileGridModel> getStore() {
public GroupingStore<FileGridModel> getStore(){
return store;
}
/**
* Sets the border as on search. percentulae in java
*
* Sets the border as on search.
*percentulae in java
* @param bool the new border as on search
*/
public void setBorderAsOnSearch(boolean bool) {
public void setBorderAsOnSearch(boolean bool){
if (this.cp.getElement("body") != null) {
if(this.cp.getElement("body")!=null){
if (bool) {
if(bool){
this.cp.getElement("body").getStyle().setBorderColor("#32CD32");
} else
}
else
this.cp.getElement("body").getStyle().setBorderColor("#99BBE8");
}
@ -529,9 +552,9 @@ public class GxtGridFilterGroupPanel extends LayoutContainer {
/**
* Adds the data changed store listener.
*/
private void addDataChangedStoreListener() {
private void addDataChangedStoreListener(){
store.addListener(Store.Add, new Listener<StoreEvent<ModelData>>() {
store.addListener(Store.Add, new Listener<StoreEvent<ModelData>>(){
@Override
public void handleEvent(StoreEvent<ModelData> be) {
@ -540,7 +563,7 @@ public class GxtGridFilterGroupPanel extends LayoutContainer {
}
});
store.addListener(Store.Remove, new Listener<StoreEvent<ModelData>>() {
store.addListener(Store.Remove, new Listener<StoreEvent<ModelData>>(){
@Override
public void handleEvent(StoreEvent<ModelData> be) {
@ -549,7 +572,7 @@ public class GxtGridFilterGroupPanel extends LayoutContainer {
}
});
store.addListener(Store.Clear, new Listener<StoreEvent<ModelData>>() {
store.addListener(Store.Clear, new Listener<StoreEvent<ModelData>>(){
@Override
public void handleEvent(StoreEvent<ModelData> be) {
@ -565,9 +588,9 @@ public class GxtGridFilterGroupPanel extends LayoutContainer {
*
* @return -1 if store is null. The size otherwise
*/
private int storeSize() {
private int storeSize(){
if (store != null && store.getModels() != null) {
if(store!=null && store.getModels()!=null){
return store.getModels().size();
}
@ -577,34 +600,40 @@ public class GxtGridFilterGroupPanel extends LayoutContainer {
/**
* Refresh size.
*
* @param width the width
* @param width the width
* @param height the height
*/
public void refreshSize(String width, String height) {
GWT.log("refresh size grid " + width + "; heigth: " + height);
// if(this.isRendered()){
// GWT.log("refresh size grid "+height);
// this.setHeight(height);
// }
GWT.log("refresh size grid "+width +"; heigth: "+height);
this.setSize(width, height);
cp.setSize(width, height);
grid.setWidth(width);
int theWidth = Integer.parseInt(width.replace("px", ""));
GWT.log("theWidth is " + theWidth);
for (int i = 1; i < cm.getColumnCount(); i++) {
GWT.log("theWidth is "+theWidth);
for (int i=1; i<cm.getColumnCount(); i++) {
ColumnConfig col = cm.getColumn(i);
int percent;
if (i == 1) {
percent = theWidth * 30 / 100;
// GWT.log("i is: "+i+" percent is "+percent);
if(i==1) {
percent = theWidth*30/100;
//GWT.log("i is: "+i+" percent is "+percent);
col.setWidth(percent);
} else if (i == cm.getColumnCount() - 1) {
percent = theWidth * 10 / 100;
// GWT.log("i is last column: "+i+" percent is "+percent);
}else if (i==cm.getColumnCount()-1){
percent = theWidth*10/100;
//GWT.log("i is last column: "+i+" percent is "+percent);
col.setWidth(percent);
} else {
percent = theWidth * 20 / 100;
// GWT.log("i is: "+i+" percent is "+percent);
}else {
percent = theWidth*20/100;
//GWT.log("i is: "+i+" percent is "+percent);
col.setWidth(percent);
}
}
//cp.layout(true);
//this.layout(true);
}
}

View File

@ -18,6 +18,7 @@ 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;
import com.google.gwt.dom.client.Style.Overflow;
import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.user.client.Random;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.RootPanel;

1
src/test/.gitignore vendored
View File

@ -1 +0,0 @@
/resources/

View File

@ -4,15 +4,3 @@
/log4j.properties
/pred4s.gcubekey
/preprod.gcubekey
/devVRE.gcubekey
/CNR.it.gcubekey
/D4OS.gcubekey
/D4Research.gcubekey
/FARM.gcubekey
/ISTI.gcubekey
/OpenAIRE.gcubekey
/ParthenosVO.gcubekey
/SmartArea.gcubekey
/SoBigData.gcubekey
/d4science.research-infrastructures.eu.gcubekey
/gCubeApps.gcubekey