added search by item id functionality

git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace-tree-widget@76831 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2013-06-06 16:04:06 +00:00
parent dd8bdb5bc4
commit 47ecdfd3e6
6 changed files with 135 additions and 15 deletions

View File

@ -742,7 +742,10 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
FileModel file = explorerPanel.getAsycTreePanel().getFileModelByIdentifier(fileDownloadEvent.getItemIdentifier());
file.setMarkAsRead(true);
if(file!=null){ //FILE CAN NOT LOADED IN TREE
file.setMarkAsRead(true);
}
notifySubscriber(fileDownloadEvent);
}

View File

@ -105,8 +105,7 @@ public interface GWTWorkspaceService extends RemoteService{
public GWTWorkspaceItem getTimeSeriesById(String identifier) throws Exception;
boolean shareFolder(FileModel folder, List<InfoContactModel> listContacts,
boolean isNewFolder) throws Exception;
boolean shareFolder(FileModel folder, List<InfoContactModel> listContacts, boolean isNewFolder) throws Exception;
public List<InfoContactModel> getListUserSharedByFolderSharedId(String itemId) throws Exception;
@ -120,23 +119,22 @@ public interface GWTWorkspaceService extends RemoteService{
public String itemExistsInWorkpaceFolder(String parentId, String itemName) throws Exception;
List<InfoContactModel> getListUserSharedBySharedItem(String sharedItemId)
throws Exception;
public List<InfoContactModel> getListUserSharedBySharedItem(String sharedItemId) throws Exception;
Date getItemCreationDateById(String itemId) throws Exception;
public Date getItemCreationDateById(String itemId) throws Exception;
Long loadSizeByItemId(String itemId) throws Exception;
public Long loadSizeByItemId(String itemId) throws Exception;
Date loadLastModificationDateById(String itemId) throws Exception;
public Date loadLastModificationDateById(String itemId) throws Exception;
FileModel getParentByItemId(String identifier) throws Exception;
public FileModel getParentByItemId(String identifier) throws Exception;
/**
* @param identifier
* @return
* @throws Exception
*/
List<GxtAccountingField> getAccountingReaders(String identifier)
public List<GxtAccountingField> getAccountingReaders(String identifier)
throws Exception;
/**
@ -144,6 +142,13 @@ public interface GWTWorkspaceService extends RemoteService{
* @return
* @throws Exception
*/
List<GxtAccountingField> getAccountingHistory(String identifier) throws Exception;
public List<GxtAccountingField> getAccountingHistory(String identifier) throws Exception;
/**
* @param itemId
* @return
* @throws Exception
*/
public FileGridModel getItemForFileGrid(String itemId) throws Exception;
}

View File

@ -147,5 +147,7 @@ public interface GWTWorkspaceServiceAsync {
void getAccountingHistory(String identifier,
AsyncCallback<List<GxtAccountingField>> callback);
void getItemForFileGrid(String itemId, AsyncCallback<FileGridModel> callback);
}

View File

@ -0,0 +1,73 @@
package org.gcube.portlets.user.workspace.client.view.windows;
import com.extjs.gxt.ui.client.Style.HorizontalAlignment;
import com.extjs.gxt.ui.client.Style.VerticalAlignment;
import com.extjs.gxt.ui.client.event.ButtonEvent;
import com.extjs.gxt.ui.client.event.SelectionListener;
import com.extjs.gxt.ui.client.widget.Dialog;
import com.extjs.gxt.ui.client.widget.VerticalPanel;
import com.extjs.gxt.ui.client.widget.form.TextArea;
import com.extjs.gxt.ui.client.widget.form.TextField;
import com.google.gwt.dom.client.Style.Unit;
/**
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
*
*/
public class DialogGetLink extends Dialog {
private TextField<String> txt;
private int widht = 500;
private int height = 200;
private VerticalPanel vp = new VerticalPanel();
public DialogGetLink(String headingTxt, String msgTitle, String urlValue) {
setButtonAlign(HorizontalAlignment.CENTER);
vp.setHorizontalAlign(HorizontalAlignment.CENTER);
vp.setVerticalAlign(VerticalAlignment.MIDDLE);
vp.getElement().getStyle().setPadding(5, Unit.PX);
setHeading(headingTxt);
setModal(true);
setBodyStyle("padding: 9px; background: none");
setWidth(widht);
setHeight(height);
setResizable(false);
setButtons(Dialog.OK);
txt = new TextArea();
txt.setStyleAttribute("padding-top", "20px");
txt.setWidth(widht-30);
txt.setFieldLabel(msgTitle);
txt.setValue(urlValue);
txt.setReadOnly(true);
this.getButtonById(Dialog.OK).addSelectionListener(new SelectionListener<ButtonEvent>() {
@Override
public void componentSelected(ButtonEvent ce) {
hide();
}
});
setFocusWidget(txt);
txt.selectAll();
vp.add(txt);
add(vp);
this.show();
}
public String getTxtValue() {
return txt.getValue();
}
public void selectTxt(){
txt.select(0, txt.getValue().length());
}
}

View File

@ -963,7 +963,7 @@ public class GWTWorkspaceBuilder {
//ACCOUNTING
fileModel.setMarkAsRead(item.isMarkedAsRead());
if(parentFolderModel.isShared()){
if(parentFolderModel!=null && parentFolderModel.isShared()){
fileModel.setShared(true);
fileModel.setShareable(false);
}
@ -1052,7 +1052,7 @@ public class GWTWorkspaceBuilder {
return listFileGridModel;
}
private FileGridModel buildGXTFileGridModelItem(WorkspaceItem item, FileModel parentFileModel) throws InternalErrorException{
protected FileGridModel buildGXTFileGridModelItem(WorkspaceItem item, FileModel parentFileModel) throws InternalErrorException{
FileGridModel fileGridModel = null;
@ -1092,7 +1092,7 @@ public class GWTWorkspaceBuilder {
//ACCOUNTING
fileGridModel.setMarkAsRead(item.isMarkedAsRead());
if(parentFileModel.isShared()){
if(parentFileModel!=null && parentFileModel.isShared()){
fileGridModel.setShared(true);
fileGridModel.setShareable(false);
}

View File

@ -281,7 +281,44 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
} catch (Exception e) {
workspaceLogger.error("Error in server During items retrieving", e);
// workspaceLogger.trace("Error in server During items retrieving " + e);
e.printStackTrace();
// e.printStackTrace();
//GWT can't serialize all exceptions
throw new Exception("Error during item loading, please contact the support.");
}
}
@Override
public FileGridModel getItemForFileGrid(String itemId) throws Exception {
Workspace workspace;
try {
workspace = getWorkspace();
List<FileGridModel> listFileGridModels = new ArrayList<FileGridModel>();
GCUBEClientLog logger = new GCUBEClientLog(GWTWorkspaceServiceImpl.class);
logger.trace("get child for Grid by id: "+itemId);
workspaceLogger.trace("get children for Grid");
WorkspaceItem wsItem = workspace.getItem(itemId);
GWTWorkspaceBuilder builder = getGWTWorkspaceBuilder();
Long startTime = System.currentTimeMillis();
Long endTime = System.currentTimeMillis() - startTime;
String time = String.format("%d msc %d sec", endTime, TimeUnit.MILLISECONDS.toSeconds(endTime));
logger.trace("get child for Grid by id returning element in " + time);
return builder.buildGXTFileGridModelItem(wsItem, null);
} catch (Exception e) {
workspaceLogger.error("Error in server during item retrieving", e);
// workspaceLogger.trace("Error in server During items retrieving " + e);
// e.printStackTrace();
//GWT can't serialize all exceptions
throw new Exception("Error during item loading, please contact the support.");
}