just started to work on this task
parent
ef2f034478
commit
0a1e418d13
@ -0,0 +1,173 @@
|
||||
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 com.extjs.gxt.ui.client.widget.form.TextField;
|
||||
import com.github.gwtbootstrap.client.ui.ControlGroup;
|
||||
import com.github.gwtbootstrap.client.ui.TextArea;
|
||||
import com.github.gwtbootstrap.client.ui.TextBox;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
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 DialogGetInfoBootstrap extends Composite {
|
||||
|
||||
private static DialogGetInfoBootstrapUiBinder uiBinder = GWT.create(DialogGetInfoBootstrapUiBinder.class);
|
||||
|
||||
interface DialogGetInfoBootstrapUiBinder extends UiBinder<Widget, DialogGetInfoBootstrap> {
|
||||
}
|
||||
|
||||
public DialogGetInfoBootstrap() {
|
||||
initWidget(uiBinder.createAndBindUi(this));
|
||||
}
|
||||
|
||||
public static final String UNKNOWN = "unknown";
|
||||
|
||||
@UiField
|
||||
TextBox txtName;
|
||||
|
||||
@UiField
|
||||
TextBox txtId;
|
||||
|
||||
@UiField
|
||||
TextBox txtLocation;
|
||||
|
||||
@UiField
|
||||
ControlGroup cgTxtIsPublic;
|
||||
|
||||
@UiField
|
||||
TextBox txtIsPublic;
|
||||
|
||||
@UiField
|
||||
TextArea txtAreaDescription;
|
||||
|
||||
/*
|
||||
* TextField<String> txtType = new TextField<String>(); private
|
||||
* TextField<String> txtCategory = 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> txtSize = new TextField<String>(); private
|
||||
* TextField<String> txtLocation = new TextField<String>(); private
|
||||
* TextField<String> txtIsPublic = new TextField<String>(); private
|
||||
* TextField<String> txtThreddsSynched = new TextField<String>(); private
|
||||
* TextField<String> txtShared = new TextField<String>(); // private TextArea
|
||||
* textAreaSharedWith = new TextArea(); private Html htmlUsersWidget = new
|
||||
* Html(); private Html htmlPropertiesWidget = new Html(); private final
|
||||
* NumberFormat number = ConstantsExplorer.numberFormatterKB; // private
|
||||
* TextField<String> txtGcubeItemProperties; private HorizontalPanel
|
||||
* hpGcubeProperties; private DialogEditProperties editProperties = null;
|
||||
*/
|
||||
|
||||
public DialogGetInfoBootstrap(final FileModel fileModel) {
|
||||
initWidget(uiBinder.createAndBindUi(this));
|
||||
|
||||
// Setting name
|
||||
textFieldSetValue(txtName, fileModel.getName());
|
||||
textFieldSetValue(txtId, fileModel.getIdentifier());
|
||||
|
||||
if (fileModel.isRoot())
|
||||
txtLocation.setValue("/");
|
||||
else
|
||||
loadLocation(fileModel.getIdentifier());
|
||||
|
||||
if (fileModel.isDirectory()) {
|
||||
cgTxtIsPublic.setVisible(true);
|
||||
txtIsPublic.setValue(fileModel.isPublic() + "");
|
||||
|
||||
/*
|
||||
* if (fileModel.getSynchedThreddsStatus() != null) { txtThreddsSynched = new
|
||||
* TextField<String>(); txtThreddsSynched.setFieldLabel("Thredds Sync");
|
||||
* txtThreddsSynched.setReadOnly(true);
|
||||
* txtThreddsSynched.setValue(fileModel.getSynchedThreddsStatus() + "");
|
||||
* add(txtThreddsSynched);
|
||||
*
|
||||
* }
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
if (fileModel.isDirectory()) {
|
||||
txtAreaDescription.setValue(fileModel.getDescription());
|
||||
// add(txtAreaDescription);
|
||||
} else
|
||||
loadDescription(fileModel.getIdentifier());
|
||||
|
||||
}
|
||||
|
||||
private void textFieldSetValue(TextBox field, String value) {
|
||||
|
||||
if (value == null || value.isEmpty())
|
||||
field.setValue(UNKNOWN);
|
||||
else
|
||||
field.setValue(value);
|
||||
}
|
||||
|
||||
private void loadLocation(String itemId) {
|
||||
|
||||
txtLocation.setEnabled(false);
|
||||
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);
|
||||
txtLocation.setValue(UNKNOWN);
|
||||
txtLocation.setEnabled(false);
|
||||
}
|
||||
|
||||
@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 = "/";
|
||||
|
||||
txtLocation.setValue(location);
|
||||
txtLocation.setEnabled(true);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param identifier
|
||||
*/
|
||||
private void loadDescription(String identifier) {
|
||||
txtAreaDescription.setEnabled(false);
|
||||
|
||||
AppControllerExplorer.rpcWorkspaceService.getItemDescriptionById(identifier, new AsyncCallback<String>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable arg0) {
|
||||
txtAreaDescription.setEnabled(false);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(String result) {
|
||||
if (result != null)
|
||||
txtAreaDescription.setValue(result);
|
||||
else
|
||||
txtAreaDescription.setValue("");
|
||||
|
||||
txtAreaDescription.setEnabled(true);
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,95 @@
|
||||
<!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">
|
||||
<ui:style>
|
||||
.back-color-info {
|
||||
background-color: #fafaff !important;
|
||||
}
|
||||
|
||||
.margin-bottom-20 {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.padding-left-10 {
|
||||
padding-left: 10px;
|
||||
}
|
||||
|
||||
.margin-left-5 {
|
||||
margin-left: 5px;
|
||||
}
|
||||
|
||||
.text-bold {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.not-active {
|
||||
pointer-events: none;
|
||||
cursor: default;
|
||||
opacity: .5;
|
||||
padding-left: 10px;
|
||||
}
|
||||
|
||||
.font-size-14 {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.to-top-alignment {
|
||||
vertical-align: top;
|
||||
padding-top: 0px !important;
|
||||
}
|
||||
|
||||
.no-border {
|
||||
border: 0px;
|
||||
}
|
||||
</ui:style>
|
||||
<g:HTMLPanel>
|
||||
<b:Form type="HORIZONTAL">
|
||||
<b:Alert ui:field="actionAlert" close="false" type="INFO"
|
||||
visible="false">
|
||||
<b:Icon type="ROTATE_RIGHT" spin="true" />
|
||||
</b:Alert>
|
||||
<b:Fieldset ui:field="fieldSetGetInfo"
|
||||
styleName="{style.noBorder}">
|
||||
<b:ControlGroup addStyleNames="my-control-group">
|
||||
<b:ControlLabel>Name</b:ControlLabel>
|
||||
<b:Controls>
|
||||
<b:TextBox ui:field="txtName" readOnly="true">
|
||||
</b:TextBox>
|
||||
</b:Controls>
|
||||
</b:ControlGroup>
|
||||
<b:ControlGroup addStyleNames="my-control-group">
|
||||
<b:ControlLabel>Id</b:ControlLabel>
|
||||
<b:Controls>
|
||||
<b:TextBox ui:field="txtId" readOnly="true">
|
||||
</b:TextBox>
|
||||
</b:Controls>
|
||||
</b:ControlGroup>
|
||||
<b:ControlGroup addStyleNames="my-control-group">
|
||||
<b:ControlLabel>Location</b:ControlLabel>
|
||||
<b:Controls>
|
||||
<b:TextBox ui:field="txtLocation" readOnly="true">
|
||||
</b:TextBox>
|
||||
</b:Controls>
|
||||
</b:ControlGroup>
|
||||
<b:ControlGroup addStyleNames="my-control-group"
|
||||
ui:field="cgTxtIsPublic" visible="false">
|
||||
<b:ControlLabel>Public Folder</b:ControlLabel>
|
||||
<b:Controls>
|
||||
<b:TextBox ui:field="txtIsPublic" readOnly="true">
|
||||
</b:TextBox>
|
||||
</b:Controls>
|
||||
</b:ControlGroup>
|
||||
<b:ControlGroup addStyleNames="my-control-group">
|
||||
<b:ControlLabel>Description</b:ControlLabel>
|
||||
<b:Controls>
|
||||
<b:TextArea ui:field="txtAreaDescription" readOnly="true">
|
||||
</b:TextArea>
|
||||
</b:Controls>
|
||||
</b:ControlGroup>
|
||||
</b:Fieldset>
|
||||
<b:Alert close="false" ui:field="errorAlert" type="ERROR"
|
||||
visible="false"></b:Alert>
|
||||
</b:Form>
|
||||
</g:HTMLPanel>
|
||||
</ui:UiBinder>
|
Loading…
Reference in New Issue