fixed get info
git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace-tree-widget@71779 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
d1c7b8d93e
commit
3c19103216
|
@ -126,4 +126,6 @@ public interface GWTWorkspaceService extends RemoteService{
|
||||||
|
|
||||||
Long loadSizeByItemId(String itemId) throws Exception;
|
Long loadSizeByItemId(String itemId) throws Exception;
|
||||||
|
|
||||||
|
Date loadLastModificationDateById(String itemId) throws Exception;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -134,5 +134,8 @@ public interface GWTWorkspaceServiceAsync {
|
||||||
|
|
||||||
void loadSizeByItemId(String itemId, AsyncCallback<Long> asyncCallback);
|
void loadSizeByItemId(String itemId, AsyncCallback<Long> asyncCallback);
|
||||||
|
|
||||||
|
void loadLastModificationDateById(String itemId,
|
||||||
|
AsyncCallback<Date> callback);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,13 +26,14 @@ import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||||
*/
|
*/
|
||||||
public class DialogGetInfo extends Dialog {
|
public class DialogGetInfo extends Dialog {
|
||||||
|
|
||||||
|
protected static final String UNKNOWN = "unknown";
|
||||||
private int widthDialog = 450;
|
private int widthDialog = 450;
|
||||||
private int heightTextArea = 50;
|
private int heightTextArea = 50;
|
||||||
private TextField<String> txtName = new TextField<String>();
|
private TextField<String> txtName = new TextField<String>();
|
||||||
private TextField<String> txtType = new TextField<String>();
|
private TextField<String> txtType = new TextField<String>();
|
||||||
private TextField<String> txtCategory = new TextField<String>();
|
private TextField<String> txtCategory = new TextField<String>();
|
||||||
private TextField<String> txtOwner = new TextField<String>();
|
private TextField<String> txtOwner = new TextField<String>();
|
||||||
|
private TextField<String> txtLastMofication = new TextField<String>();
|
||||||
private TextField<String> txtCreated = new TextField<String>();
|
private TextField<String> txtCreated = new TextField<String>();
|
||||||
private TextField<String> txtSize = new TextField<String>();
|
private TextField<String> txtSize = new TextField<String>();
|
||||||
private TextField<String> txtLocation = new TextField<String>();
|
private TextField<String> txtLocation = new TextField<String>();
|
||||||
|
@ -103,6 +104,13 @@ public class DialogGetInfo extends Dialog {
|
||||||
loadCreationDate(fileModel.getIdentifier());
|
loadCreationDate(fileModel.getIdentifier());
|
||||||
add(txtCreated);
|
add(txtCreated);
|
||||||
|
|
||||||
|
|
||||||
|
txtLastMofication = new TextField<String>();
|
||||||
|
txtLastMofication.setFieldLabel("Last Mofication");
|
||||||
|
txtLastMofication.setReadOnly(true);
|
||||||
|
loadLastModificationDate(fileModel.getIdentifier());
|
||||||
|
add(txtLastMofication);
|
||||||
|
|
||||||
txtSize = new TextField<String>();
|
txtSize = new TextField<String>();
|
||||||
txtSize.setFieldLabel("Size");
|
txtSize.setFieldLabel("Size");
|
||||||
txtSize.setReadOnly(true);
|
txtSize.setReadOnly(true);
|
||||||
|
@ -145,10 +153,36 @@ public class DialogGetInfo extends Dialog {
|
||||||
this.show();
|
this.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void loadLastModificationDate(final String itemId) {
|
||||||
|
|
||||||
|
txtLastMofication.mask();
|
||||||
|
AppControllerExplorer.rpcWorkspaceService.loadLastModificationDateById(itemId, new AsyncCallback<Date>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Throwable caught) {
|
||||||
|
GWT.log("an error occured in loadLastModificationDateById "+itemId + " "+caught.getMessage());
|
||||||
|
txtLastMofication.unmask();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess(Date result) {
|
||||||
|
|
||||||
|
if(result!=null)
|
||||||
|
txtLastMofication.setValue(result.toString());
|
||||||
|
else
|
||||||
|
txtLastMofication.setValue(UNKNOWN);
|
||||||
|
|
||||||
|
txtLastMofication.unmask();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
private void textFieldSetValue(TextField<String> field, String value){
|
private void textFieldSetValue(TextField<String> field, String value){
|
||||||
|
|
||||||
if(value==null || value.isEmpty())
|
if(value==null || value.isEmpty())
|
||||||
field.setValue("unknown");
|
field.setValue(UNKNOWN);
|
||||||
else
|
else
|
||||||
field.setValue(value);
|
field.setValue(value);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1908,4 +1908,32 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
|
||||||
throw new Exception(e.getMessage());
|
throw new Exception(e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Date loadLastModificationDateById(String itemId) throws Exception {
|
||||||
|
|
||||||
|
workspaceLogger.trace("get last modification date ItemId "+ itemId);
|
||||||
|
try {
|
||||||
|
|
||||||
|
Workspace workspace = getWorkspace();
|
||||||
|
|
||||||
|
WorkspaceItem wsItem = workspace.getItem(itemId);
|
||||||
|
|
||||||
|
wsItem.getLastModificationTime().getTime();
|
||||||
|
|
||||||
|
Date lastModification =null;
|
||||||
|
|
||||||
|
if(wsItem.getLastModificationTime()!=null){
|
||||||
|
|
||||||
|
lastModification = wsItem.getLastModificationTime().getTime();
|
||||||
|
}
|
||||||
|
|
||||||
|
return lastModification;
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
workspaceLogger.error("get last modification date ItemId ", e);
|
||||||
|
throw new Exception(e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue