2013-03-25 12:35:05 +01:00
|
|
|
package org.gcube.portlets.user.workspace.client.view.windows;
|
|
|
|
|
|
|
|
import java.util.Date;
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
import org.gcube.portlets.user.workspace.client.AppControllerExplorer;
|
|
|
|
import org.gcube.portlets.user.workspace.client.ConstantsExplorer;
|
|
|
|
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.InfoContactModel;
|
2015-06-12 12:24:01 +02:00
|
|
|
import org.gcube.portlets.user.workspace.client.resources.Resources;
|
2013-03-25 12:35:05 +01:00
|
|
|
|
|
|
|
import com.extjs.gxt.ui.client.Style.HorizontalAlignment;
|
2014-02-18 14:40:19 +01:00
|
|
|
import com.extjs.gxt.ui.client.Style.Scroll;
|
2013-03-25 12:35:05 +01:00
|
|
|
import com.extjs.gxt.ui.client.event.ButtonEvent;
|
|
|
|
import com.extjs.gxt.ui.client.event.SelectionListener;
|
|
|
|
import com.extjs.gxt.ui.client.widget.Dialog;
|
2014-02-18 14:40:19 +01:00
|
|
|
import com.extjs.gxt.ui.client.widget.HorizontalPanel;
|
|
|
|
import com.extjs.gxt.ui.client.widget.Html;
|
|
|
|
import com.extjs.gxt.ui.client.widget.Label;
|
2015-06-12 15:07:02 +02:00
|
|
|
import com.extjs.gxt.ui.client.widget.LayoutContainer;
|
2013-03-25 12:35:05 +01:00
|
|
|
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.FormLayout;
|
|
|
|
import com.google.gwt.core.client.GWT;
|
2015-06-12 12:24:01 +02:00
|
|
|
import com.google.gwt.event.dom.client.ClickEvent;
|
|
|
|
import com.google.gwt.event.dom.client.ClickHandler;
|
2013-03-25 12:35:05 +01:00
|
|
|
import com.google.gwt.i18n.client.NumberFormat;
|
2015-06-12 12:24:01 +02:00
|
|
|
import com.google.gwt.user.client.Command;
|
2013-03-25 12:35:05 +01:00
|
|
|
import com.google.gwt.user.client.rpc.AsyncCallback;
|
2015-06-12 12:24:01 +02:00
|
|
|
import com.google.gwt.user.client.ui.Image;
|
2013-03-25 12:35:05 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
public class DialogGetInfo extends Dialog {
|
|
|
|
|
2014-11-03 14:45:36 +01:00
|
|
|
/**
|
2016-09-15 17:16:59 +02:00
|
|
|
*
|
2014-11-03 14:45:36 +01:00
|
|
|
*/
|
|
|
|
public static final String EMPTY = "empty";
|
|
|
|
public static final String UNKNOWN = "unknown";
|
2013-03-25 12:35:05 +01:00
|
|
|
private int widthDialog = 450;
|
|
|
|
private int heightTextArea = 50;
|
|
|
|
private TextField<String> txtName = new TextField<String>();
|
2013-05-24 18:18:14 +02:00
|
|
|
private TextField<String> txtAreaDescription = new TextArea();
|
2013-03-25 12:35:05 +01:00
|
|
|
private TextField<String> txtType = new TextField<String>();
|
|
|
|
private TextField<String> txtCategory = new TextField<String>();
|
|
|
|
private TextField<String> txtOwner = new TextField<String>();
|
2013-03-26 12:35:58 +01:00
|
|
|
private TextField<String> txtLastMofication = new TextField<String>();
|
2013-03-25 12:35:05 +01:00
|
|
|
private TextField<String> txtCreated = new TextField<String>();
|
|
|
|
private TextField<String> txtSize = new TextField<String>();
|
|
|
|
private TextField<String> txtLocation = new TextField<String>();
|
2016-09-15 17:16:59 +02:00
|
|
|
private TextField<String> txtIsPublic = new TextField<String>();
|
2013-03-25 12:35:05 +01:00
|
|
|
private TextField<String> txtShared = new TextField<String>();
|
2014-02-18 14:40:19 +01:00
|
|
|
// private TextArea textAreaSharedWith = new TextArea();
|
|
|
|
private Html htmlUsersWidget = new Html();
|
2015-06-12 12:24:01 +02:00
|
|
|
private Html htmlPropertiesWidget = new Html();
|
2013-03-25 12:35:05 +01:00
|
|
|
private final NumberFormat number = ConstantsExplorer.numberFormatterKB;
|
2015-06-12 12:24:01 +02:00
|
|
|
// private TextField<String> txtGcubeItemProperties;
|
|
|
|
private HorizontalPanel hpGcubeProperties;
|
|
|
|
private DialogEditProperties editProperties = null;
|
2016-09-15 17:16:59 +02:00
|
|
|
|
2015-06-12 12:24:01 +02:00
|
|
|
public DialogGetInfo(final FileModel fileModel) {
|
2016-09-15 17:16:59 +02:00
|
|
|
|
2013-03-25 12:35:05 +01:00
|
|
|
FormLayout layout = new FormLayout();
|
|
|
|
layout.setLabelWidth(90);
|
|
|
|
layout.setDefaultWidth(300);
|
|
|
|
setLayout(layout);
|
2016-09-15 17:16:59 +02:00
|
|
|
|
2013-03-25 12:35:05 +01:00
|
|
|
setIcon(fileModel.getAbstractPrototypeIcon());
|
|
|
|
setHeading(fileModel.getName() + " Properties");
|
|
|
|
|
|
|
|
setButtonAlign(HorizontalAlignment.RIGHT);
|
|
|
|
setModal(true);
|
|
|
|
// setBodyBorder(true);
|
|
|
|
setBodyStyle("padding: 9px; background: none");
|
|
|
|
setWidth(widthDialog);
|
|
|
|
setResizable(false);
|
|
|
|
setButtons(Dialog.OK);
|
2016-09-15 17:16:59 +02:00
|
|
|
|
2013-03-25 12:35:05 +01:00
|
|
|
txtName = new TextField<String>();
|
|
|
|
txtName.setFieldLabel("Name");
|
|
|
|
txtName.setReadOnly(true);
|
|
|
|
textFieldSetValue(txtName,fileModel.getName());
|
|
|
|
add(txtName);
|
2016-09-15 17:16:59 +02:00
|
|
|
|
2013-03-26 11:41:25 +01:00
|
|
|
txtLocation = new TextField<String>();
|
|
|
|
txtLocation.setFieldLabel("Location");
|
|
|
|
txtLocation.setReadOnly(true);
|
2016-09-15 17:16:59 +02:00
|
|
|
|
2013-03-26 11:41:25 +01:00
|
|
|
if(fileModel.isRoot())
|
|
|
|
txtLocation.setValue("/");
|
|
|
|
else
|
|
|
|
loadLocation(fileModel.getIdentifier());
|
|
|
|
|
|
|
|
add(txtLocation);
|
2015-06-12 12:24:01 +02:00
|
|
|
|
2016-09-15 17:16:59 +02:00
|
|
|
if(fileModel.isDirectory()){
|
|
|
|
txtIsPublic = new TextField<String>();
|
|
|
|
txtIsPublic.setFieldLabel("Public Folder");
|
|
|
|
txtIsPublic.setReadOnly(true);
|
|
|
|
txtIsPublic.setValue(fileModel.isPublic()+"");
|
|
|
|
add(txtIsPublic);
|
|
|
|
}
|
|
|
|
|
2014-11-04 18:20:06 +01:00
|
|
|
txtAreaDescription.setFieldLabel("Description");
|
|
|
|
txtAreaDescription.setHeight(30);
|
|
|
|
txtAreaDescription.setReadOnly(true);
|
|
|
|
add(txtAreaDescription);
|
2016-09-15 17:16:59 +02:00
|
|
|
|
2015-06-12 12:24:01 +02:00
|
|
|
//GCUBE PROPERTIES
|
|
|
|
hpGcubeProperties = new HorizontalPanel();
|
|
|
|
hpGcubeProperties.setStyleAttribute("padding-top", "6px");
|
|
|
|
hpGcubeProperties.setStyleAttribute("margin-bottom", "6px");
|
|
|
|
Label labelProperties = new Label("Properties");
|
|
|
|
labelProperties.setTitle("Gcube Properties");
|
|
|
|
labelProperties.setStyleAttribute("padding-right", "47px");
|
|
|
|
hpGcubeProperties.add(labelProperties);
|
|
|
|
loadGcubeItemProperties(fileModel.getIdentifier());
|
|
|
|
htmlPropertiesWidget.setHeight(heightTextArea);
|
2015-06-12 15:07:02 +02:00
|
|
|
htmlPropertiesWidget.setWidth("275px");
|
2016-09-15 17:16:59 +02:00
|
|
|
|
2015-06-12 15:07:02 +02:00
|
|
|
LayoutContainer lc = new LayoutContainer();
|
|
|
|
lc.addStyleName("editPermissions");
|
2016-09-15 17:16:59 +02:00
|
|
|
|
2015-06-12 15:07:02 +02:00
|
|
|
Image imgProperties = Resources.getIconEdit().createImage(); //EDIT PROPERTIES
|
|
|
|
imgProperties.setTitle("Edit Properties");
|
|
|
|
lc.add(imgProperties);
|
2016-09-15 17:16:59 +02:00
|
|
|
|
2015-06-12 15:07:02 +02:00
|
|
|
hpGcubeProperties.add(lc);
|
2015-06-12 12:24:01 +02:00
|
|
|
|
|
|
|
final Command cmdReloadProperties = new Command() {
|
2016-09-15 17:16:59 +02:00
|
|
|
|
2015-06-12 12:24:01 +02:00
|
|
|
@Override
|
|
|
|
public void execute() {
|
|
|
|
loadGcubeItemProperties(fileModel.getIdentifier());
|
|
|
|
}
|
|
|
|
};
|
2016-09-15 17:16:59 +02:00
|
|
|
|
2015-06-12 12:24:01 +02:00
|
|
|
imgProperties.addClickHandler(new ClickHandler() {
|
2016-09-15 17:16:59 +02:00
|
|
|
|
2015-06-12 12:24:01 +02:00
|
|
|
@Override
|
|
|
|
public void onClick(ClickEvent event) {
|
|
|
|
if(editProperties==null)
|
|
|
|
editProperties = new DialogEditProperties(fileModel, cmdReloadProperties);
|
2016-09-15 17:16:59 +02:00
|
|
|
|
2015-06-12 12:24:01 +02:00
|
|
|
editProperties.show();
|
2016-09-15 17:16:59 +02:00
|
|
|
|
2015-06-12 12:24:01 +02:00
|
|
|
}
|
|
|
|
});
|
|
|
|
htmlPropertiesWidget.setStyleAttribute("margin-left", "5px");
|
|
|
|
hpGcubeProperties.add(htmlPropertiesWidget);
|
|
|
|
hpGcubeProperties.setScrollMode(Scroll.AUTOY);
|
|
|
|
add(hpGcubeProperties);
|
|
|
|
setVisibleGcubeProperties(false);
|
2016-09-15 17:16:59 +02:00
|
|
|
|
2013-05-24 18:18:14 +02:00
|
|
|
if(fileModel.isDirectory()){
|
|
|
|
txtAreaDescription.setValue(fileModel.getDescription());
|
2014-11-04 18:20:06 +01:00
|
|
|
// add(txtAreaDescription);
|
|
|
|
}else
|
|
|
|
loadDescription(fileModel.getIdentifier());
|
2016-09-15 17:16:59 +02:00
|
|
|
|
2013-03-25 12:35:05 +01:00
|
|
|
txtType = new TextField<String>();
|
|
|
|
txtType.setFieldLabel("Type");
|
|
|
|
txtType.setReadOnly(true);
|
|
|
|
textFieldSetValue(txtType,fileModel.getType());
|
|
|
|
add(txtType);
|
2016-09-15 17:16:59 +02:00
|
|
|
|
2013-03-25 12:35:05 +01:00
|
|
|
txtCategory = new TextField<String>();
|
|
|
|
txtCategory.setFieldLabel("Category");
|
|
|
|
txtCategory.setReadOnly(true);
|
2016-10-07 17:18:01 +02:00
|
|
|
if(fileModel.getShortcutCategory()!=null)
|
|
|
|
textFieldSetValue(txtCategory,fileModel.getShortcutCategory().getValue());
|
2013-03-25 12:35:05 +01:00
|
|
|
add(txtCategory);
|
2013-05-24 18:18:14 +02:00
|
|
|
|
2013-03-25 12:35:05 +01:00
|
|
|
txtOwner = new TextField<String>();
|
|
|
|
txtOwner.setFieldLabel("Owner");
|
|
|
|
txtOwner.setReadOnly(true);
|
|
|
|
loadOwner(fileModel.getIdentifier());
|
|
|
|
add(txtOwner);
|
2013-05-24 18:18:14 +02:00
|
|
|
|
2013-03-25 12:35:05 +01:00
|
|
|
txtCreated = new TextField<String>();
|
|
|
|
txtCreated.setFieldLabel("Created");
|
|
|
|
txtCreated.setReadOnly(true);
|
2015-06-12 12:24:01 +02:00
|
|
|
|
2013-11-15 12:12:17 +01:00
|
|
|
loadCreationDate(fileModel.getIdentifier());
|
2016-09-15 17:16:59 +02:00
|
|
|
|
2013-03-25 12:35:05 +01:00
|
|
|
add(txtCreated);
|
2016-09-15 17:16:59 +02:00
|
|
|
|
2013-03-26 12:35:58 +01:00
|
|
|
txtLastMofication = new TextField<String>();
|
|
|
|
txtLastMofication.setFieldLabel("Last Mofication");
|
|
|
|
txtLastMofication.setReadOnly(true);
|
2013-11-15 12:12:17 +01:00
|
|
|
if(fileModel instanceof FileGridModel)
|
|
|
|
textFieldSetValue(txtLastMofication, ((FileGridModel) fileModel).getLastModification().toString());
|
|
|
|
else
|
|
|
|
loadLastModificationDate(fileModel.getIdentifier());
|
2016-09-15 17:16:59 +02:00
|
|
|
|
2013-03-26 12:35:58 +01:00
|
|
|
add(txtLastMofication);
|
2016-09-15 17:16:59 +02:00
|
|
|
|
2013-03-25 12:35:05 +01:00
|
|
|
txtSize = new TextField<String>();
|
|
|
|
txtSize.setFieldLabel("Size");
|
|
|
|
txtSize.setReadOnly(true);
|
2016-09-15 17:16:59 +02:00
|
|
|
|
2013-03-25 12:35:05 +01:00
|
|
|
if(fileModel instanceof FileGridModel)
|
|
|
|
textFieldSetValue(txtSize,getFormattedSize(((FileGridModel) fileModel).getSize()));
|
|
|
|
else
|
|
|
|
loadSize(fileModel.getIdentifier());
|
2016-09-15 17:16:59 +02:00
|
|
|
|
2013-03-25 12:35:05 +01:00
|
|
|
add(txtSize);
|
2016-09-15 17:16:59 +02:00
|
|
|
|
2015-06-12 12:24:01 +02:00
|
|
|
//SHARED
|
2013-03-25 12:35:05 +01:00
|
|
|
txtShared = new TextField<String>();
|
|
|
|
txtShared.setFieldLabel("Shared");
|
|
|
|
txtShared.setReadOnly(true);
|
|
|
|
textFieldSetValue(txtShared,fileModel.isShared()+"");
|
|
|
|
add(txtShared);
|
2016-09-15 17:16:59 +02:00
|
|
|
|
2015-06-12 12:24:01 +02:00
|
|
|
//USERS SHARED
|
2013-03-25 12:35:05 +01:00
|
|
|
if(fileModel.isShared()){
|
2016-09-15 17:16:59 +02:00
|
|
|
|
2014-02-18 14:40:19 +01:00
|
|
|
HorizontalPanel hp = new HorizontalPanel();
|
|
|
|
hp.setStyleAttribute("padding-top", "6px");
|
|
|
|
Label label = new Label("Shared with");
|
|
|
|
label.setStyleAttribute("padding-right", "39px");
|
|
|
|
hp.add(label);
|
2015-01-28 17:42:12 +01:00
|
|
|
loadACLsDescriptionForSharedFolder(fileModel.getIdentifier());
|
2014-02-18 14:40:19 +01:00
|
|
|
htmlUsersWidget.setHeight(heightTextArea);
|
|
|
|
htmlUsersWidget.setWidth("297px");
|
|
|
|
hp.add(htmlUsersWidget);
|
|
|
|
hp.setScrollMode(Scroll.AUTOY);
|
|
|
|
add(hp);
|
2013-03-25 12:35:05 +01:00
|
|
|
}
|
2016-09-15 17:16:59 +02:00
|
|
|
|
|
|
|
|
2013-03-25 12:35:05 +01:00
|
|
|
this.getButtonById(Dialog.OK).addSelectionListener(new SelectionListener<ButtonEvent>() {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void componentSelected(ButtonEvent ce) {
|
|
|
|
hide();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
this.show();
|
|
|
|
}
|
2016-09-15 17:16:59 +02:00
|
|
|
|
2015-06-12 12:24:01 +02:00
|
|
|
private void setVisibleGcubeProperties(boolean bool){
|
|
|
|
hpGcubeProperties.setVisible(bool);
|
|
|
|
}
|
2016-09-15 17:16:59 +02:00
|
|
|
|
2014-11-04 18:20:06 +01:00
|
|
|
/**
|
|
|
|
* @param identifier
|
|
|
|
*/
|
|
|
|
private void loadDescription(String identifier) {
|
|
|
|
txtAreaDescription.mask();
|
2016-09-15 17:16:59 +02:00
|
|
|
|
2014-11-04 18:20:06 +01:00
|
|
|
AppControllerExplorer.rpcWorkspaceService.getItemDescriptionById(identifier, new AsyncCallback<String>() {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onFailure(Throwable arg0) {
|
|
|
|
txtAreaDescription.unmask();
|
2016-09-15 17:16:59 +02:00
|
|
|
|
2014-11-04 18:20:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onSuccess(String result) {
|
|
|
|
if(result!=null)
|
|
|
|
txtAreaDescription.setValue(result);
|
|
|
|
else
|
|
|
|
txtAreaDescription.setValue("");
|
2016-09-15 17:16:59 +02:00
|
|
|
|
2014-11-04 18:20:06 +01:00
|
|
|
txtAreaDescription.unmask();
|
2016-09-15 17:16:59 +02:00
|
|
|
|
2014-11-04 18:20:06 +01:00
|
|
|
}
|
|
|
|
});
|
2016-09-15 17:16:59 +02:00
|
|
|
|
2014-11-04 18:20:06 +01:00
|
|
|
}
|
|
|
|
|
2013-03-26 12:35:58 +01:00
|
|
|
private void loadLastModificationDate(final String itemId) {
|
2016-09-15 17:16:59 +02:00
|
|
|
|
2013-03-26 12:35:58 +01:00
|
|
|
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();
|
2016-09-15 17:16:59 +02:00
|
|
|
|
2013-03-26 12:35:58 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onSuccess(Date result) {
|
2016-09-15 17:16:59 +02:00
|
|
|
|
2013-03-26 12:35:58 +01:00
|
|
|
if(result!=null)
|
|
|
|
txtLastMofication.setValue(result.toString());
|
|
|
|
else
|
|
|
|
txtLastMofication.setValue(UNKNOWN);
|
2016-09-15 17:16:59 +02:00
|
|
|
|
2013-03-26 12:35:58 +01:00
|
|
|
txtLastMofication.unmask();
|
|
|
|
}
|
|
|
|
});
|
2016-09-15 17:16:59 +02:00
|
|
|
|
2013-03-26 12:35:58 +01:00
|
|
|
}
|
|
|
|
|
2013-03-25 12:35:05 +01:00
|
|
|
private void textFieldSetValue(TextField<String> field, String value){
|
2016-09-15 17:16:59 +02:00
|
|
|
|
2013-03-25 12:35:05 +01:00
|
|
|
if(value==null || value.isEmpty())
|
2013-03-26 12:35:58 +01:00
|
|
|
field.setValue(UNKNOWN);
|
2013-03-25 12:35:05 +01:00
|
|
|
else
|
|
|
|
field.setValue(value);
|
|
|
|
}
|
2016-09-15 17:16:59 +02:00
|
|
|
|
2013-03-25 12:35:05 +01:00
|
|
|
private void loadOwner(final String itemId){
|
2016-09-15 17:16:59 +02:00
|
|
|
|
2013-03-25 12:35:05 +01:00
|
|
|
txtOwner.mask();
|
2015-06-12 12:24:01 +02:00
|
|
|
|
2013-03-25 12:35:05 +01:00
|
|
|
AppControllerExplorer.rpcWorkspaceService.getOwnerByItemId(itemId, new AsyncCallback<InfoContactModel>() {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onFailure(Throwable caught) {
|
|
|
|
GWT.log("an error occured in get Owner by Id "+itemId + " "+caught.getMessage());
|
|
|
|
txtOwner.unmask();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onSuccess(InfoContactModel result) {
|
|
|
|
textFieldSetValue(txtOwner,result.getName());
|
|
|
|
txtOwner.unmask();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
2016-09-15 17:16:59 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
2015-06-12 12:24:01 +02:00
|
|
|
private void loadGcubeItemProperties(final String itemId){
|
|
|
|
GWT.log("Load GcubeItemProperties");
|
|
|
|
htmlPropertiesWidget.mask();
|
|
|
|
AppControllerExplorer.rpcWorkspaceService.getHTMLGcubeItemProperties(itemId, new AsyncCallback<String>() {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onFailure(Throwable caught) {
|
|
|
|
htmlPropertiesWidget.unmask();
|
|
|
|
GWT.log("an error occured in load properties by Id "+itemId + " "+caught.getMessage());
|
|
|
|
setVisibleGcubeProperties(true);
|
2016-09-15 17:16:59 +02:00
|
|
|
htmlPropertiesWidget.setHtml("Error on recovering properties");
|
2015-06-12 12:24:01 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onSuccess(String result) {
|
|
|
|
// setVisibleGcubeProperties(true);
|
|
|
|
htmlPropertiesWidget.unmask();
|
|
|
|
if(result!=null){
|
|
|
|
setVisibleGcubeProperties(true);
|
|
|
|
htmlPropertiesWidget.setHtml(result);
|
|
|
|
}
|
|
|
|
// else{
|
|
|
|
// htmlPropertiesWidget.setHeight(20);
|
|
|
|
// htmlPropertiesWidget.setHtml("None");
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
2016-09-15 17:16:59 +02:00
|
|
|
|
|
|
|
|
2013-03-25 12:35:05 +01:00
|
|
|
private void loadSize(final String itemId){
|
2014-10-28 17:12:40 +01:00
|
|
|
GWT.log("Load size");
|
2013-03-25 12:35:05 +01:00
|
|
|
txtSize.mask();
|
|
|
|
AppControllerExplorer.rpcWorkspaceService.loadSizeByItemId(itemId, new AsyncCallback<Long>() {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onFailure(Throwable caught) {
|
|
|
|
GWT.log("an error occured in load creation date by Id "+itemId + " "+caught.getMessage());
|
|
|
|
txtSize.unmask();
|
2016-09-15 17:16:59 +02:00
|
|
|
|
2013-03-25 12:35:05 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onSuccess(Long result) {
|
2014-10-28 17:12:40 +01:00
|
|
|
GWT.log("Loaded size="+result);
|
2013-03-25 12:35:05 +01:00
|
|
|
textFieldSetValue(txtSize,getFormattedSize(result));
|
|
|
|
txtSize.unmask();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
2016-09-15 17:16:59 +02:00
|
|
|
|
|
|
|
|
2013-03-25 12:35:05 +01:00
|
|
|
private void loadCreationDate(final String itemId){
|
2016-09-15 17:16:59 +02:00
|
|
|
|
2013-03-25 12:35:05 +01:00
|
|
|
txtCreated.mask();
|
|
|
|
AppControllerExplorer.rpcWorkspaceService.getItemCreationDateById(itemId, new AsyncCallback<Date>() {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onFailure(Throwable caught) {
|
|
|
|
GWT.log("an error occured in load creation date by Id "+itemId + " "+caught.getMessage());
|
|
|
|
txtCreated.unmask();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onSuccess(Date result) {
|
|
|
|
if(result!=null)
|
|
|
|
textFieldSetValue(txtCreated,result.toString());
|
2016-09-15 17:16:59 +02:00
|
|
|
|
2013-03-25 12:35:05 +01:00
|
|
|
txtCreated.unmask();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
2016-09-15 17:16:59 +02:00
|
|
|
|
2015-01-28 17:42:12 +01:00
|
|
|
private void loadACLsDescriptionForSharedFolder(String sharedId){
|
2016-09-15 17:16:59 +02:00
|
|
|
|
2014-02-18 14:40:19 +01:00
|
|
|
htmlUsersWidget.mask();
|
2016-09-15 17:16:59 +02:00
|
|
|
|
2015-07-14 18:11:11 +02:00
|
|
|
AppControllerExplorer.rpcWorkspaceService.getACLsDescriptionForWorkspaceItemById(sharedId, new AsyncCallback<String>() {
|
2013-03-25 12:35:05 +01:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onFailure(Throwable caught) {
|
2014-02-18 14:40:19 +01:00
|
|
|
htmlUsersWidget.unmask();
|
|
|
|
htmlUsersWidget.setHtml("Error on recovering users");
|
2016-09-15 17:16:59 +02:00
|
|
|
|
2013-03-25 12:35:05 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2014-02-18 14:40:19 +01:00
|
|
|
public void onSuccess(String result) {
|
|
|
|
htmlUsersWidget.unmask();
|
2014-07-17 11:11:35 +02:00
|
|
|
GWT.log("Loaded ACLs: "+result);
|
2014-02-18 14:40:19 +01:00
|
|
|
htmlUsersWidget.setHtml(result);
|
2013-03-25 12:35:05 +01:00
|
|
|
}
|
|
|
|
});
|
2016-09-15 17:16:59 +02:00
|
|
|
|
2013-03-25 12:35:05 +01:00
|
|
|
}
|
2016-09-15 17:16:59 +02:00
|
|
|
|
2013-03-25 12:35:05 +01:00
|
|
|
private String getFormattedSize(long value){
|
|
|
|
|
|
|
|
if(value>0){
|
|
|
|
double kb = value/1024;
|
|
|
|
if(kb<1)
|
|
|
|
kb=1;
|
|
|
|
return number.format(kb);
|
2014-11-03 14:45:36 +01:00
|
|
|
}else if(value==0){
|
|
|
|
return EMPTY;
|
2013-03-25 12:35:05 +01:00
|
|
|
}else
|
|
|
|
return "";
|
|
|
|
}
|
2016-09-15 17:16:59 +02:00
|
|
|
|
2013-03-26 11:41:25 +01:00
|
|
|
private void loadLocation(String itemId){
|
2016-09-15 17:16:59 +02:00
|
|
|
|
2013-03-26 11:41:25 +01:00
|
|
|
txtLocation.mask();
|
2013-09-12 12:27:18 +02:00
|
|
|
AppControllerExplorer.rpcWorkspaceService.getListParentsByItemIdentifier(itemId, false, new AsyncCallback<List<FileModel>>() {
|
2013-03-26 11:41:25 +01:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onFailure(Throwable caught) {
|
|
|
|
GWT.log("failure get list parents by item identifier "+caught);
|
|
|
|
txtLocation.unmask();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onSuccess(List<FileModel> result) {
|
2016-09-15 17:16:59 +02:00
|
|
|
|
2013-03-26 11:41:25 +01:00
|
|
|
String location="";
|
|
|
|
if(result!=null){
|
|
|
|
for (FileModel fileModel : result) {
|
2016-09-30 12:50:48 +02:00
|
|
|
if(fileModel!=null)
|
|
|
|
location+="/"+fileModel.getName();
|
2013-03-26 11:41:25 +01:00
|
|
|
}
|
2016-09-15 17:16:59 +02:00
|
|
|
}
|
2013-03-26 11:41:25 +01:00
|
|
|
if(location.isEmpty())
|
|
|
|
location ="/";
|
2016-09-15 17:16:59 +02:00
|
|
|
|
2013-03-26 11:41:25 +01:00
|
|
|
txtLocation.setValue(location);
|
|
|
|
txtLocation.unmask();
|
|
|
|
}
|
|
|
|
});
|
2016-09-15 17:16:59 +02:00
|
|
|
|
2013-03-26 11:41:25 +01:00
|
|
|
}
|
2013-03-25 12:35:05 +01:00
|
|
|
}
|