building the GUI
This commit is contained in:
parent
af8d2525b9
commit
2ff9cbaf35
|
@ -118,7 +118,6 @@ import org.gcube.portlets.user.workspace.client.view.tree.AsyncTreePanel;
|
|||
import org.gcube.portlets.user.workspace.client.view.windows.DialogAddFolderAndSmart;
|
||||
import org.gcube.portlets.user.workspace.client.view.windows.DialogAddFolderAndSmart.AddType;
|
||||
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.DialogGetInfoBootstrap;
|
||||
import org.gcube.portlets.user.workspace.client.view.windows.DialogGetLink;
|
||||
import org.gcube.portlets.user.workspace.client.view.windows.DialogGetLink.Link_Type;
|
||||
|
|
|
@ -19,7 +19,6 @@ import com.extjs.gxt.ui.client.event.Listener;
|
|||
import com.extjs.gxt.ui.client.widget.Dialog;
|
||||
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;
|
||||
import com.google.gwt.user.client.Command;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
|
||||
|
@ -82,7 +81,7 @@ public class DialogEditProperties extends Dialog {
|
|||
@Override
|
||||
public void show() {
|
||||
resetForm();
|
||||
loadGcubeItemProperties();
|
||||
//loadGcubeItemProperties();
|
||||
super.show();
|
||||
}
|
||||
|
||||
|
@ -121,26 +120,26 @@ public class DialogEditProperties extends Dialog {
|
|||
|
||||
}
|
||||
|
||||
private void loadGcubeItemProperties() {
|
||||
// mask("Loading properties...");
|
||||
AppControllerExplorer.rpcWorkspaceService.loadGcubeItemProperties(item.getIdentifier(),
|
||||
new AsyncCallback<Map<String, String>>() {
|
||||
// private void loadGcubeItemProperties() {
|
||||
// // mask("Loading properties...");
|
||||
// AppControllerExplorer.rpcWorkspaceService.loadGcubeItemProperties(item.getIdentifier(),
|
||||
// new AsyncCallback<Map<String, String>>() {
|
||||
//
|
||||
// @Override
|
||||
// public void onSuccess(Map<String, String> result) {
|
||||
// // unmask();
|
||||
// setProperties(result);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onFailure(Throwable caught) {
|
||||
// // unmask();
|
||||
// GWT.log("an error occured in loadGcubeItemProperties " + item + " " + caught.getMessage());
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
|
||||
@Override
|
||||
public void onSuccess(Map<String, String> result) {
|
||||
// unmask();
|
||||
setProperties(result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
// unmask();
|
||||
GWT.log("an error occured in loadGcubeItemProperties " + item + " " + caught.getMessage());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void setProperties(Map<String, String> result) {
|
||||
public void setProperties(Map<String, String> result) {
|
||||
fields = new ArrayList<TextField<String>>(result.size());
|
||||
for (String key : result.keySet()) {
|
||||
TextField<String> field = new TextField<String>();
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
package org.gcube.portlets.user.workspace.client.view.windows;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.gcube.portlets.user.workspace.client.AppControllerExplorer;
|
||||
import org.gcube.portlets.user.workspace.client.interfaces.GXTFolderItemTypeEnum;
|
||||
import org.gcube.portlets.user.workspace.client.model.FileModel;
|
||||
|
||||
import com.github.gwtbootstrap.client.ui.Button;
|
||||
import com.github.gwtbootstrap.client.ui.ControlGroup;
|
||||
import com.github.gwtbootstrap.client.ui.Label;
|
||||
import com.github.gwtbootstrap.client.ui.TextArea;
|
||||
|
@ -14,8 +16,12 @@ import com.google.gwt.core.client.GWT;
|
|||
import com.google.gwt.dom.client.Style.Unit;
|
||||
import com.google.gwt.event.dom.client.ClickEvent;
|
||||
import com.google.gwt.event.dom.client.ClickHandler;
|
||||
import com.google.gwt.event.dom.client.KeyPressEvent;
|
||||
import com.google.gwt.event.dom.client.KeyPressHandler;
|
||||
import com.google.gwt.uibinder.client.UiBinder;
|
||||
import com.google.gwt.uibinder.client.UiField;
|
||||
import com.google.gwt.user.client.Command;
|
||||
import com.google.gwt.user.client.Window;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.google.gwt.user.client.ui.Composite;
|
||||
import com.google.gwt.user.client.ui.HTML;
|
||||
|
@ -35,6 +41,8 @@ public class DialogGetInfoBootstrap extends Composite {
|
|||
|
||||
public static final String UNKNOWN = "unknown";
|
||||
|
||||
private Map<String, String> gCubeProperties;
|
||||
|
||||
@UiField
|
||||
HorizontalPanel hpItemType;
|
||||
|
||||
|
@ -53,9 +61,29 @@ public class DialogGetInfoBootstrap extends Composite {
|
|||
@UiField
|
||||
HTML txtIsPublic;
|
||||
|
||||
@UiField
|
||||
ControlGroup cgThreddsSynched;
|
||||
|
||||
@UiField
|
||||
HTML txtThreddsSynched;
|
||||
|
||||
@UiField
|
||||
ControlGroup cgGcubeProperties;
|
||||
|
||||
@UiField
|
||||
TextArea txtAreaGcubeProperties;
|
||||
|
||||
@UiField
|
||||
TextArea txtAreaDescription;
|
||||
|
||||
@UiField
|
||||
Button buttonUpdateDescription;
|
||||
|
||||
@UiField
|
||||
Button buttonUpdateGcubeProperties;
|
||||
|
||||
private FileModel fileModel;
|
||||
|
||||
/*
|
||||
* TextField<String> txtType = new TextField<String>(); private
|
||||
* TextField<String> txtCategory = new TextField<String>(); private
|
||||
|
@ -76,6 +104,7 @@ public class DialogGetInfoBootstrap extends Composite {
|
|||
|
||||
public DialogGetInfoBootstrap(final FileModel fileModel) {
|
||||
initWidget(uiBinder.createAndBindUi(this));
|
||||
this.fileModel = fileModel;
|
||||
|
||||
hpItemType.add(fileModel.getIcon());
|
||||
Label labelItemType = new Label();
|
||||
|
@ -87,6 +116,11 @@ public class DialogGetInfoBootstrap extends Composite {
|
|||
if (typeEnum != null) {
|
||||
label = typeEnum.getLabel();
|
||||
label = label.replace("External ", "");
|
||||
|
||||
//loading gcube properties
|
||||
if(typeEnum.equals(GXTFolderItemTypeEnum.GCUBE_ITEM))
|
||||
loadGcubeItemProperties();
|
||||
|
||||
} else {
|
||||
label = fileModel.getType();
|
||||
}
|
||||
|
@ -106,17 +140,14 @@ public class DialogGetInfoBootstrap extends Composite {
|
|||
|
||||
if (fileModel.isDirectory()) {
|
||||
cgTxtIsPublic.setVisible(true);
|
||||
txtIsPublic.setHTML(fileModel.isPublic() + "");
|
||||
htmlSetValue(txtIsPublic, 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.getSynchedThreddsStatus() != null) {
|
||||
txtThreddsSynched.setVisible(true);
|
||||
htmlSetValue(txtThreddsSynched, fileModel.getSynchedThreddsStatus() + "");
|
||||
txtThreddsSynched.setHTML(fileModel.getSynchedThreddsStatus() + "");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -130,10 +161,49 @@ public class DialogGetInfoBootstrap extends Composite {
|
|||
}
|
||||
|
||||
private void addHandlers() {
|
||||
txtAreaDescription.addClickHandler(new ClickHandler() {
|
||||
|
||||
txtAreaDescription.addKeyPressHandler(new KeyPressHandler() {
|
||||
|
||||
@Override
|
||||
public void onKeyPress(KeyPressEvent event) {
|
||||
|
||||
GWT.log(event.getUnicodeCharCode()+"");
|
||||
|
||||
if(event.getUnicodeCharCode()==13) {
|
||||
txtAreaDescription.setReadOnly(true);
|
||||
Window.alert("Updating description");
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
buttonUpdateDescription.addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
txtAreaDescription.setReadOnly(false);
|
||||
txtAreaDescription.setFocus(true);
|
||||
}
|
||||
});
|
||||
|
||||
final Command cmdReloadProperties = new Command() {
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
loadGcubeItemProperties();
|
||||
}
|
||||
};
|
||||
|
||||
buttonUpdateGcubeProperties.addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
|
||||
DialogEditProperties editProperties = new DialogEditProperties(fileModel, cmdReloadProperties);
|
||||
editProperties.setProperties(gCubeProperties);
|
||||
editProperties.setZIndex(99999);
|
||||
editProperties.show();
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -208,6 +278,36 @@ public class DialogGetInfoBootstrap extends Composite {
|
|||
|
||||
}
|
||||
|
||||
private void loadGcubeItemProperties() {
|
||||
// mask("Loading properties...");
|
||||
AppControllerExplorer.rpcWorkspaceService.loadGcubeItemProperties(fileModel.getIdentifier(),
|
||||
new AsyncCallback<Map<String, String>>() {
|
||||
|
||||
@Override
|
||||
public void onSuccess(Map<String, String> result) {
|
||||
txtAreaGcubeProperties.setText("");
|
||||
GWT.log("Gcube Item Properties: "+result);
|
||||
gCubeProperties = result;
|
||||
// unmask();
|
||||
if(result!=null && result.size()>0) {
|
||||
for (String key : result.keySet()) {
|
||||
String text = txtAreaGcubeProperties.getText();
|
||||
text+=key+"="+result.get(key)+";\n";
|
||||
txtAreaGcubeProperties.setText(text);
|
||||
}
|
||||
cgGcubeProperties.setVisible(true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
// unmask();
|
||||
cgGcubeProperties.setVisible(false);
|
||||
GWT.log("an error occured in loadGcubeItemProperties " + fileModel.getIdentifier() + " " + caught.getMessage());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private void setPlaceholder(HTML html, String placeholder) {
|
||||
html.setHTML(placeholder);
|
||||
|
@ -219,5 +319,4 @@ public class DialogGetInfoBootstrap extends Composite {
|
|||
html.getElement().getStyle().setColor("#000");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -56,6 +56,15 @@
|
|||
</g:HTML>
|
||||
</b:Controls>
|
||||
</b:ControlGroup>
|
||||
<b:ControlGroup
|
||||
addStyleNames="my-control-group-get-info"
|
||||
ui:field="cgThreddsSynched" visible="false">
|
||||
<b:ControlLabel>Thredds Sync</b:ControlLabel>
|
||||
<b:Controls>
|
||||
<g:HTML ui:field="txtThreddsSynched">
|
||||
</g:HTML>
|
||||
</b:Controls>
|
||||
</b:ControlGroup>
|
||||
<b:ControlGroup
|
||||
addStyleNames="my-control-group-get-info">
|
||||
<b:ControlLabel>Description</b:ControlLabel>
|
||||
|
@ -63,15 +72,31 @@
|
|||
<b:TextArea ui:field="txtAreaDescription"
|
||||
readOnly="true">
|
||||
</b:TextArea>
|
||||
<b:Tooltip text='Update description' trigger="MANUAL">
|
||||
<b:Tooltip trigger="MANUAL" text="Update description">
|
||||
<b:Button icon="PENCIL"
|
||||
ui:field="buttonUpdateDescription" type="PRIMARY"></b:Button>
|
||||
</b:Tooltip>
|
||||
</b:Controls>
|
||||
</b:ControlGroup>
|
||||
</b:Fieldset>
|
||||
<b:ControlGroup
|
||||
addStyleNames="my-control-group-get-info"
|
||||
ui:field="cgGcubeProperties" visible="false">
|
||||
<b:ControlLabel>Gcube Properties</b:ControlLabel>
|
||||
<b:Controls>
|
||||
<b:TextArea ui:field="txtAreaGcubeProperties"
|
||||
readOnly="true">
|
||||
</b:TextArea>
|
||||
<b:Tooltip trigger="MANUAL"
|
||||
text="Update Gcube Properties">
|
||||
<b:Button icon="PENCIL"
|
||||
ui:field="buttonUpdateGcubeProperties" type="PRIMARY"></b:Button>
|
||||
</b:Tooltip>
|
||||
</b:Controls>
|
||||
</b:ControlGroup>
|
||||
|
||||
<b:Alert close="false" ui:field="errorAlert" type="ERROR"
|
||||
visible="false"></b:Alert>
|
||||
</b:Fieldset>
|
||||
</b:Form>
|
||||
</g:HTMLPanel>
|
||||
</ui:UiBinder>
|
|
@ -13,7 +13,6 @@ import org.gcube.portlets.widgets.workspacesharingwidget.shared.InfoContactModel
|
|||
|
||||
import com.extjs.gxt.ui.client.Style.ButtonScale;
|
||||
import com.extjs.gxt.ui.client.Style.HorizontalAlignment;
|
||||
import com.extjs.gxt.ui.client.data.BaseModel;
|
||||
import com.extjs.gxt.ui.client.data.BaseModelData;
|
||||
import com.extjs.gxt.ui.client.data.ModelData;
|
||||
import com.extjs.gxt.ui.client.event.ButtonEvent;
|
||||
|
|
Loading…
Reference in New Issue