From 347692bb5bd7477e384a6fefafc7c2bb04487369 Mon Sep 17 00:00:00 2001 From: Lucio Lelii Date: Thu, 26 Sep 2019 16:54:30 +0000 Subject: [PATCH] git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace-tree-widget@181861 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../client/AppControllerExplorer.java | 4 +- .../client/view/windows/DialogInfoboot.java | 166 ++++++++++++++++++ .../client/view/windows/DialogInfoboot.ui.xml | 143 +++++++++++++++ 3 files changed, 312 insertions(+), 1 deletion(-) create mode 100644 src/main/java/org/gcube/portlets/user/workspace/client/view/windows/DialogInfoboot.java create mode 100644 src/main/java/org/gcube/portlets/user/workspace/client/view/windows/DialogInfoboot.ui.xml diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/AppControllerExplorer.java b/src/main/java/org/gcube/portlets/user/workspace/client/AppControllerExplorer.java index adeb1af..88f6f8c 100644 --- a/src/main/java/org/gcube/portlets/user/workspace/client/AppControllerExplorer.java +++ b/src/main/java/org/gcube/portlets/user/workspace/client/AppControllerExplorer.java @@ -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()); } }); diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/view/windows/DialogInfoboot.java b/src/main/java/org/gcube/portlets/user/workspace/client/view/windows/DialogInfoboot.java new file mode 100644 index 0000000..ff004fe --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/workspace/client/view/windows/DialogInfoboot.java @@ -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 { + } + + 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>() { + + @Override + public void onFailure(Throwable caught) { + GWT.log("failure get list parents by item identifier " + caught); + textLocation.setValue(UNKNOWN); + } + + @Override + public void onSuccess(List result) { + + String location = ""; + if (result != null) { + for (FileModel fileModel : result) { + if (fileModel != null) + location += "/" + fileModel.getName(); + } + } + if (location.isEmpty()) + location = "/"; + + textLocation.setValue(location); + } + }); + + } + +} diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/view/windows/DialogInfoboot.ui.xml b/src/main/java/org/gcube/portlets/user/workspace/client/view/windows/DialogInfoboot.ui.xml new file mode 100644 index 0000000..7b777b0 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/workspace/client/view/windows/DialogInfoboot.ui.xml @@ -0,0 +1,143 @@ + + + + .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; + } + + + + + + + + Name + + + + + + + Description + + + + + + + Identifier + + + + + + + Location + + + + + + + Owner + + + + + + + + Type + + + + + + + Category + + + + + + + Creation Date + + + + + + + Last modification Date + + + + + + + Size + + + + + + + Sharing Mode + + + + + + + + + + +