This commit is contained in:
Lucio Lelii 2019-09-26 16:54:30 +00:00
parent 6b1d630032
commit 347692bb5b
3 changed files with 312 additions and 1 deletions

View File

@ -121,6 +121,7 @@ import org.gcube.portlets.user.workspace.client.view.windows.DialogAddUrl;
import org.gcube.portlets.user.workspace.client.view.windows.DialogGetInfo;
import org.gcube.portlets.user.workspace.client.view.windows.DialogGetLink;
import org.gcube.portlets.user.workspace.client.view.windows.DialogGetLink.Link_Type;
import org.gcube.portlets.user.workspace.client.view.windows.DialogInfoboot;
import org.gcube.portlets.user.workspace.client.view.windows.DialogShareLink;
import org.gcube.portlets.user.workspace.client.view.windows.DialogShareableLink;
import org.gcube.portlets.user.workspace.client.view.windows.DialogText;
@ -690,7 +691,8 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
@Override
public void onGetInfo(GetInfoEvent getInfoEvent) {
new DialogGetInfo(getInfoEvent.getSourceFile());
//new DialogGetInfo(getInfoEvent.getSourceFile());
new DialogInfoboot(getInfoEvent.getSourceFile());
}
});

View File

@ -0,0 +1,166 @@
package org.gcube.portlets.user.workspace.client.view.windows;
import java.util.List;
import org.gcube.portlets.user.workspace.client.AppControllerExplorer;
import org.gcube.portlets.user.workspace.client.model.FileModel;
import org.gcube.portlets.widgets.switchbutton.client.SwitchButton;
import com.extjs.gxt.ui.client.util.Format;
import com.github.gwtbootstrap.client.ui.Button;
import com.github.gwtbootstrap.client.ui.Icon;
import com.github.gwtbootstrap.client.ui.Label;
import com.github.gwtbootstrap.client.ui.Modal;
import com.github.gwtbootstrap.client.ui.ModalFooter;
import com.github.gwtbootstrap.client.ui.TextBox;
import com.github.gwtbootstrap.client.ui.constants.IconType;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Widget;
public class DialogInfoboot extends Composite {
private static DialogInfobootUiBinder uiBinder = GWT.create(DialogInfobootUiBinder.class);
public static final String EMPTY = "empty";
public static final String UNKNOWN = "unknown";
private Modal modalBox = new Modal();
@UiField
TextBox textName;
@UiField
TextBox textLocation;
@UiField
TextBox textIdentifier;
@UiField
TextBox textDescription;
@UiField
TextBox textType;
@UiField
TextBox textCategory;
@UiField
TextBox textOwner;
@UiField
TextBox textCreated;
@UiField
TextBox textLastModified;
@UiField
TextBox textSize;
@UiField
TextBox textSharingMode;
interface DialogInfobootUiBinder extends UiBinder<Widget, DialogInfoboot> {
}
public DialogInfoboot(FileModel item) {
initWidget(uiBinder.createAndBindUi(this));
/*typeIcon.setIcon(IconType.FILE);*/
modalBox.setTitle("Info for "+item.getName());
modalBox.setAnimation(true);
textName.setValue(item.getName());
textIdentifier.setValue(item.getIdentifier());
textType.setValue(item.getType());
String sharingMode = "PRIVATE";
if (item.isShared()) {
if(item.isSpecialFolder())
sharingMode = "VRE FOLDER";
else sharingMode="SHARED";
}
textSharingMode.setValue(sharingMode);
//TODO: Location can be a property of FileModel
if (item.isRoot())
textLocation.setValue("/");
else
loadLocation(item.getIdentifier());
if (item.getShortcutCategory() != null)
textCategory.setValue(item.getShortcutCategory().getValue());
ModalFooter modalFooter = new ModalFooter();
final Button buttClose = new Button("Close");
buttClose.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
modalBox.hide();
}
});
modalFooter.add(buttClose);
modalBox.add(this);
modalBox.add(modalFooter);
modalBox.show();
}
/*private String getFormattedSize(long value) {
if (value > 0) {
double kb = value / 1024;
if (kb < 1)
kb = 1;
return number.format(kb);
} else if (value == 0) {
return EMPTY;
} else
return "";
}*/
private void loadLocation(String itemId) {
AppControllerExplorer.rpcWorkspaceService.getListParentsByItemIdentifier(itemId, false,
new AsyncCallback<List<FileModel>>() {
@Override
public void onFailure(Throwable caught) {
GWT.log("failure get list parents by item identifier " + caught);
textLocation.setValue(UNKNOWN);
}
@Override
public void onSuccess(List<FileModel> result) {
String location = "";
if (result != null) {
for (FileModel fileModel : result) {
if (fileModel != null)
location += "/" + fileModel.getName();
}
}
if (location.isEmpty())
location = "/";
textLocation.setValue(location);
}
});
}
}

View File

@ -0,0 +1,143 @@
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:g="urn:import:com.google.gwt.user.client.ui"
xmlns:b="urn:import:com.github.gwtbootstrap.client.ui"
xmlns:citem="urn:import:org.gcube.portlets.widgets.switchbutton.client">
<ui:style>
.back-color-info {
background-color: #fafaff !important;
}
.margin-bottom-20 {
margin-bottom: 20px;
}
.padding-left-10 {
padding-left: 10px;
}
.margin-left-10 {
}
.text-bold {
font-weight: bold;
}
.read-only {
pointer-events: none;
cursor: default;
opacity: .5;
padding-left: 10px;
}
.font-size-14 {
font-size: 18px;
margin-left: 5px;
margin-right: 5px;
padding: 5px;
}
.font-size-30 {
font-size: 30px;
font-weight: bold;
}
.to-top-alignment {
vertical-align: top;
padding-top: 0px !important;
}
.no-border {
border: 0px;
}
</ui:style>
<g:HTMLPanel>
<b:Form type="HORIZONTAL">
<b:Fieldset>
<b:ControlGroup>
<b:ControlLabel>Name</b:ControlLabel>
<b:Controls>
<!-- If you add id attribute to element,You should use b:id attribute. -->
<b:TextBox readOnly="true" ui:field="textName"></b:TextBox>
</b:Controls>
</b:ControlGroup>
<b:ControlGroup>
<b:ControlLabel>Description</b:ControlLabel>
<b:Controls>
<!-- If you add id attribute to element,You should use b:id attribute. -->
<b:TextBox readOnly="true" ui:field="textDescription"></b:TextBox>
</b:Controls>
</b:ControlGroup>
<b:ControlGroup>
<b:ControlLabel>Identifier</b:ControlLabel>
<b:Controls>
<!-- If you add id attribute to element,You should use b:id attribute. -->
<b:TextBox readOnly="true" ui:field="textIdentifier"></b:TextBox>
</b:Controls>
</b:ControlGroup>
<b:ControlGroup>
<b:ControlLabel>Location</b:ControlLabel>
<b:Controls>
<!-- If you add id attribute to element,You should use b:id attribute. -->
<b:TextBox readOnly="true" ui:field="textLocation"></b:TextBox>
</b:Controls>
</b:ControlGroup>
<b:ControlGroup>
<b:ControlLabel>Owner</b:ControlLabel>
<b:Controls>
<!-- If you add id attribute to element,You should use b:id attribute. -->
<b:TextBox readOnly="true" ui:field="textOwner"></b:TextBox>
</b:Controls>
</b:ControlGroup>
<b:ControlGroup>
<b:ControlLabel>Type</b:ControlLabel>
<b:Controls>
<!-- If you add id attribute to element,You should use b:id attribute. -->
<b:TextBox readOnly="true" ui:field="textType"></b:TextBox>
</b:Controls>
</b:ControlGroup>
<b:ControlGroup>
<b:ControlLabel>Category</b:ControlLabel>
<b:Controls>
<!-- If you add id attribute to element,You should use b:id attribute. -->
<b:TextBox readOnly="true" ui:field="textCategory"></b:TextBox>
</b:Controls>
</b:ControlGroup>
<b:ControlGroup>
<b:ControlLabel>Creation Date</b:ControlLabel>
<b:Controls>
<!-- If you add id attribute to element,You should use b:id attribute. -->
<b:TextBox readOnly="true" ui:field="textCreated"></b:TextBox>
</b:Controls>
</b:ControlGroup>
<b:ControlGroup>
<b:ControlLabel>Last modification Date</b:ControlLabel>
<b:Controls>
<!-- If you add id attribute to element,You should use b:id attribute. -->
<b:TextBox readOnly="true" ui:field="textLastModified"></b:TextBox>
</b:Controls>
</b:ControlGroup>
<b:ControlGroup>
<b:ControlLabel>Size</b:ControlLabel>
<b:Controls>
<!-- If you add id attribute to element,You should use b:id attribute. -->
<b:TextBox readOnly="true" ui:field="textSize"></b:TextBox>
</b:Controls>
</b:ControlGroup>
<b:ControlGroup>
<b:ControlLabel>Sharing Mode</b:ControlLabel>
<b:Controls>
<!-- If you add id attribute to element,You should use b:id attribute. -->
<b:TextBox readOnly="true" ui:field="textSharingMode"></b:TextBox>
</b:Controls>
</b:ControlGroup>
</b:Fieldset>
</b:Form>
</g:HTMLPanel>
</ui:UiBinder>