task_21379 #3
|
@ -359,7 +359,6 @@ public class WsThreddsWidgetViewManager {
|
|||
|
||||
final boolean isCreateConfiguration = folderDescriptor==null?true:false;
|
||||
|
||||
|
||||
//is the user a THREDDS_ADMIN (so DATA_MANAGER) in at least one scope?
|
||||
boolean isThreddsAdmin = false;
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package org.gcube.portlets.widgets.wsthreddssync.client.view.binder;
|
||||
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@ -31,48 +30,41 @@ import com.google.gwt.user.client.ui.Composite;
|
|||
import com.google.gwt.user.client.ui.HTMLPanel;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
|
||||
|
||||
/**
|
||||
* The Class ShowThreddsFolderInfoView.
|
||||
*
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||
* Feb 15, 2018
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it Feb 15, 2018
|
||||
*/
|
||||
public abstract class ShowThreddsFolderInfoView extends Composite {
|
||||
|
||||
|
||||
/** The ui binder. */
|
||||
private static ShowThreddsFolderInfoViewUiBinder uiBinder =
|
||||
GWT.create(ShowThreddsFolderInfoViewUiBinder.class);
|
||||
private static ShowThreddsFolderInfoViewUiBinder uiBinder = GWT.create(ShowThreddsFolderInfoViewUiBinder.class);
|
||||
|
||||
/**
|
||||
* The Interface ShowThreddsFolderInfoViewUiBinder.
|
||||
*
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||
* Feb 15, 2018
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it Feb 15, 2018
|
||||
*/
|
||||
interface ShowThreddsFolderInfoViewUiBinder
|
||||
extends UiBinder<Widget, ShowThreddsFolderInfoView> {
|
||||
interface ShowThreddsFolderInfoViewUiBinder extends UiBinder<Widget, ShowThreddsFolderInfoView> {
|
||||
}
|
||||
|
||||
|
||||
@UiField
|
||||
TextBox field_folder_status;
|
||||
|
||||
@UiField
|
||||
ListBox field_select_scope;
|
||||
|
||||
|
||||
@UiField
|
||||
TextBox field_catalogue_name;
|
||||
|
||||
|
||||
@UiField
|
||||
TextBox field_remote_path;
|
||||
|
||||
@UiField
|
||||
TextBox field_folder_path;
|
||||
|
||||
// @UiField
|
||||
// TextBox field_sync_updated;
|
||||
|
||||
@UiField
|
||||
TextBox field_folder_locked;
|
||||
|
@ -80,16 +72,13 @@ public abstract class ShowThreddsFolderInfoView extends Composite {
|
|||
@UiField
|
||||
Button button_do_unsync;
|
||||
|
||||
|
||||
/*@UiField
|
||||
TextBox field_last_sync;
|
||||
*/
|
||||
|
||||
/*
|
||||
* @UiField TextBox field_last_sync;
|
||||
*/
|
||||
|
||||
@UiField
|
||||
ControlGroup cg_catalogue_name;
|
||||
|
||||
|
||||
@UiField
|
||||
ControlGroup cg_remote_path;
|
||||
|
||||
|
@ -107,15 +96,14 @@ public abstract class ShowThreddsFolderInfoView extends Composite {
|
|||
|
||||
private boolean isCreateConfiguration;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* The Enum SUBMIT_ACTION.
|
||||
*
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||
* Mar 12, 2018
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it Mar 12, 2018
|
||||
*/
|
||||
public static enum SUBMIT_ACTION {CREATE_UPDATE_CONFIGURATION, DO_UNSYNC, DO_SYNC};
|
||||
public static enum SUBMIT_ACTION {
|
||||
CREATE_UPDATE_CONFIGURATION, DO_UNSYNC, DO_SYNC
|
||||
};
|
||||
|
||||
/**
|
||||
* Submit handler.
|
||||
|
@ -128,25 +116,22 @@ public abstract class ShowThreddsFolderInfoView extends Composite {
|
|||
* Sets the error.
|
||||
*
|
||||
* @param visible the visible
|
||||
* @param error the error
|
||||
* @param error the error
|
||||
*/
|
||||
public abstract void setError(boolean visible, String error);
|
||||
|
||||
|
||||
/**
|
||||
* Because this class has a default constructor, it can
|
||||
* be used as a binder template. In other words, it can be used in other
|
||||
* *.ui.xml files as follows:
|
||||
* <ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
|
||||
* xmlns:g="urn:import:**user's package**">
|
||||
* <g:**UserClassName**>Hello!</g:**UserClassName>
|
||||
* </ui:UiBinder>
|
||||
* Note that depending on the widget that is used, it may be necessary to
|
||||
* implement HasHTML instead of HasText.
|
||||
* Because this class has a default constructor, it can be used as a binder
|
||||
* template. In other words, it can be used in other *.ui.xml files as follows:
|
||||
* <ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder" xmlns:g=
|
||||
* "urn:import:**user's package**">
|
||||
* <g:**UserClassName**>Hello!</g:**UserClassName> </ui:UiBinder> Note that
|
||||
* depending on the widget that is used, it may be necessary to implement
|
||||
* HasHTML instead of HasText.
|
||||
*
|
||||
* @param folderId the folder id
|
||||
* @param folderId the folder id
|
||||
* @param isCreateConfiguration the is create configuration
|
||||
* @param mapScopeThreddsRoles the map scope thredds roles
|
||||
* @param mapScopeThreddsRoles the map scope thredds roles
|
||||
*/
|
||||
public ShowThreddsFolderInfoView(String folderId, boolean isCreateConfiguration) {
|
||||
this.folderId = folderId;
|
||||
|
@ -168,33 +153,34 @@ public abstract class ShowThreddsFolderInfoView extends Composite {
|
|||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
setError(false, "");
|
||||
//boolean isValid = validateSubmit();
|
||||
//if(isValid)
|
||||
// boolean isValid = validateSubmit();
|
||||
// if(isValid)
|
||||
submitHandler(SUBMIT_ACTION.DO_SYNC);
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
if(isCreateConfiguration) {
|
||||
WsThreddsWidget.wsThreddsSyncService.getListOfDataManagerScopesForLoggedUser(new AsyncCallback<List<GcubeScope>>() {
|
||||
if (isCreateConfiguration) {
|
||||
WsThreddsWidget.wsThreddsSyncService
|
||||
.getListOfDataManagerScopesForLoggedUser(new AsyncCallback<List<GcubeScope>>() {
|
||||
|
||||
@Override
|
||||
public void onSuccess(List<GcubeScope> result) {
|
||||
@Override
|
||||
public void onSuccess(List<GcubeScope> result) {
|
||||
|
||||
for (GcubeScope gcubeScope : result) {
|
||||
String toValue = FormatUtil.toScopeValue(gcubeScope);
|
||||
mapScopes.put(gcubeScope.getScopeName(), gcubeScope);
|
||||
field_select_scope.addItem(toValue, gcubeScope.getScopeName());
|
||||
for (GcubeScope gcubeScope : result) {
|
||||
String toValue = FormatUtil.toScopeValue(gcubeScope);
|
||||
mapScopes.put(gcubeScope.getScopeName(), gcubeScope);
|
||||
field_select_scope.addItem(toValue, gcubeScope.getScopeName());
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
// TODO Auto-generated method stub
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -202,21 +188,19 @@ public abstract class ShowThreddsFolderInfoView extends Composite {
|
|||
/**
|
||||
* Update view to result.
|
||||
*
|
||||
* @param folder the folder
|
||||
* @param folder the folder
|
||||
* @param syncFolderDesc the sync folder desc
|
||||
*/
|
||||
public void updateViewToResult(final WsFolder folder, WsThreddsSynchFolderDescriptor syncFolderDesc) {
|
||||
|
||||
this.field_select_scope.clear();
|
||||
|
||||
if(syncFolderDesc==null) {
|
||||
if (syncFolderDesc == null) {
|
||||
pager.getRight().setVisible(false);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if(syncFolderDesc.getSelectedScope()!=null) {
|
||||
if (syncFolderDesc.getSelectedScope() != null) {
|
||||
String toValue = FormatUtil.toScopeValue(syncFolderDesc.getSelectedScope());
|
||||
this.field_select_scope.addItem(toValue, syncFolderDesc.getSelectedScope().getScopeName());
|
||||
this.field_select_scope.setValue(0, syncFolderDesc.getSelectedScope().getScopeName());
|
||||
|
@ -224,39 +208,38 @@ public abstract class ShowThreddsFolderInfoView extends Composite {
|
|||
}
|
||||
|
||||
ThSyncFolderDescriptor sfd = syncFolderDesc.getServerFolderDescriptor();
|
||||
if(sfd!=null) {
|
||||
if (sfd != null) {
|
||||
|
||||
this.field_folder_path.setValue(sfd.getFolderPath());
|
||||
this.field_folder_path.setTitle(sfd.getFolderPath());
|
||||
this.field_folder_locked.setValue(sfd.isLocked()+"");
|
||||
|
||||
if(sfd.getElementInfo()!=null)
|
||||
this.field_folder_locked.setValue(sfd.isLocked() + "");
|
||||
|
||||
if (sfd.getElementInfo() != null) {
|
||||
this.field_folder_status.setValue(sfd.getElementInfo().getSyncStatus().toString());
|
||||
}
|
||||
|
||||
ThSynchFolderConfiguration config = sfd.getConfiguration();
|
||||
|
||||
if(config!=null) {
|
||||
if (config != null) {
|
||||
|
||||
this.field_catalogue_name.setValue(config.getToCreateCatalogName());
|
||||
this.field_catalogue_name.setTitle(config.getToCreateCatalogName());
|
||||
this.field_remote_path.setValue(config.getRemotePath());
|
||||
this.field_remote_path.setTitle(config.getRemotePath());
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
ThProcessDescriptor lpd = sfd.getLocalProcessDescriptor();
|
||||
if(lpd!=null) {
|
||||
//this.field_last_sync.setValue(DateTimeFormat.getFormat(DATE_FORMAT_YYYY_MM_DD_HH_MM_SS).format(new Date(lpd.getLaunchTime())));
|
||||
if (lpd != null) {
|
||||
// this.field_last_sync.setValue(DateTimeFormat.getFormat(DATE_FORMAT_YYYY_MM_DD_HH_MM_SS).format(new
|
||||
// Date(lpd.getLaunchTime())));
|
||||
ThSynchFolderConfiguration sc = lpd.getSynchConfiguration();
|
||||
if(sc!=null) {
|
||||
|
||||
//this.field_select_vre.setValue(sc.get, value);
|
||||
|
||||
if (sc != null) {
|
||||
// this.field_select_vre.setValue(sc.get, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
button_do_unsync.setVisible(true);
|
||||
|
||||
button_do_unsync.addClickHandler(new ClickHandler() {
|
||||
|
@ -278,8 +261,6 @@ public abstract class ShowThreddsFolderInfoView extends Composite {
|
|||
return isCreateConfiguration;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Validate submit.
|
||||
*
|
||||
|
@ -289,13 +270,13 @@ public abstract class ShowThreddsFolderInfoView extends Composite {
|
|||
cg_catalogue_name.setType(ControlGroupType.NONE);
|
||||
cg_remote_path.setType(ControlGroupType.NONE);
|
||||
|
||||
if(field_catalogue_name.getValue()==null || field_catalogue_name.getValue().isEmpty()){
|
||||
if (field_catalogue_name.getValue() == null || field_catalogue_name.getValue().isEmpty()) {
|
||||
cg_catalogue_name.setType(ControlGroupType.ERROR);
|
||||
setError(true, "Unit Title field is required");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(field_remote_path.getValue()==null || field_remote_path.getValue().isEmpty()){
|
||||
if (field_remote_path.getValue() == null || field_remote_path.getValue().isEmpty()) {
|
||||
cg_remote_path.setType(ControlGroupType.ERROR);
|
||||
setError(true, "Folder Name field is required");
|
||||
return false;
|
||||
|
@ -304,7 +285,6 @@ public abstract class ShowThreddsFolderInfoView extends Composite {
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the remote path.
|
||||
*
|
||||
|
@ -319,24 +299,21 @@ public abstract class ShowThreddsFolderInfoView extends Composite {
|
|||
*
|
||||
* @return the catalogue name
|
||||
*/
|
||||
public String getCatalogueName(){
|
||||
public String getCatalogueName() {
|
||||
return field_catalogue_name.getValue();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets the selected scope.
|
||||
*
|
||||
* @return the selected scope
|
||||
*/
|
||||
public GcubeScope getSelectedScope(){
|
||||
//String item = field_select_scope.getSelectedItemText();
|
||||
public GcubeScope getSelectedScope() {
|
||||
// String item = field_select_scope.getSelectedItemText();
|
||||
String scope = field_select_scope.getSelectedValue();
|
||||
return mapScopes.get(scope);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the pager.
|
||||
*
|
||||
|
@ -351,11 +328,10 @@ public abstract class ShowThreddsFolderInfoView extends Composite {
|
|||
*
|
||||
* @return the main panel
|
||||
*/
|
||||
public HTMLPanel getMainPanel(){
|
||||
public HTMLPanel getMainPanel() {
|
||||
return form_unit_fields;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Show unsync.
|
||||
*
|
||||
|
@ -365,6 +341,4 @@ public abstract class ShowThreddsFolderInfoView extends Composite {
|
|||
button_do_unsync.setVisible(show);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<!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:g="urn:import:com.google.gwt.user.client.ui"
|
||||
xmlns:b="urn:import:com.github.gwtbootstrap.client.ui">
|
||||
<ui:style>
|
||||
.noBorder {
|
||||
border: 0px;
|
||||
|
@ -13,36 +14,46 @@
|
|||
<b:ControlGroup ui:field="cg_folder_status">
|
||||
<b:ControlLabel for="cl_folder_status">Sync Status</b:ControlLabel>
|
||||
<b:Controls>
|
||||
<b:TextBox b:id="field_folder_status" ui:field="field_folder_status"
|
||||
readOnly="true"></b:TextBox>
|
||||
<b:TextBox b:id="field_folder_status"
|
||||
ui:field="field_folder_status" readOnly="true"></b:TextBox>
|
||||
</b:Controls>
|
||||
</b:ControlGroup>
|
||||
<b:ControlGroup ui:field="cg_folder_path">
|
||||
<b:ControlLabel for="cl_folder_path">Folder Path</b:ControlLabel>
|
||||
<b:Controls>
|
||||
<b:TextBox b:id="field_catalogue_name" ui:field="field_folder_path"
|
||||
readOnly="true"></b:TextBox>
|
||||
<b:TextBox b:id="field_catalogue_name"
|
||||
ui:field="field_folder_path" readOnly="true"></b:TextBox>
|
||||
</b:Controls>
|
||||
</b:ControlGroup>
|
||||
<b:ControlGroup ui:field="cg_folder_locked">
|
||||
<b:ControlLabel for="cl_folder_locked">Locked</b:ControlLabel>
|
||||
<b:Controls>
|
||||
<b:TextBox b:id="field_folder_locked" ui:field="field_folder_locked"
|
||||
readOnly="true"></b:TextBox>
|
||||
<b:TextBox b:id="field_folder_locked"
|
||||
ui:field="field_folder_locked" readOnly="true"></b:TextBox>
|
||||
</b:Controls>
|
||||
</b:ControlGroup>
|
||||
|
||||
<!-- <b:ControlGroup ui:field="cg_latest_sync_updated"> -->
|
||||
<!-- <b:ControlLabel for="cl_latest_sync_updated">Sync Updated</b:ControlLabel> -->
|
||||
<!-- <b:Controls> -->
|
||||
<!-- <b:TextBox b:id="field_sync_updated" -->
|
||||
<!-- ui:field="field_sync_updated" readOnly="true"></b:TextBox> -->
|
||||
<!-- </b:Controls> -->
|
||||
<!-- </b:ControlGroup> -->
|
||||
|
||||
<b:ControlGroup ui:field="cg_catalogue_name">
|
||||
<b:ControlLabel for="cl_catalogue_name">Catalogue Name</b:ControlLabel>
|
||||
<b:Controls>
|
||||
<b:TextBox b:id="field_catalogue_name" ui:field="field_catalogue_name"
|
||||
readOnly="true"></b:TextBox>
|
||||
<b:TextBox b:id="field_catalogue_name"
|
||||
ui:field="field_catalogue_name" readOnly="true"></b:TextBox>
|
||||
</b:Controls>
|
||||
</b:ControlGroup>
|
||||
|
||||
<b:ControlGroup ui:field="cg_unit_description">
|
||||
<b:ControlLabel for="cl_course_description">Published in the Scope</b:ControlLabel>
|
||||
<b:Controls>
|
||||
<b:ListBox b:id="field_select_scope" ui:field="field_select_scope">
|
||||
<b:ListBox b:id="field_select_scope"
|
||||
ui:field="field_select_scope">
|
||||
</b:ListBox>
|
||||
</b:Controls>
|
||||
</b:ControlGroup>
|
||||
|
@ -50,22 +61,24 @@
|
|||
<b:ControlGroup ui:field="cg_remote_path">
|
||||
<b:ControlLabel for="cl_remote_path">Remote Path</b:ControlLabel>
|
||||
<b:Controls>
|
||||
<b:TextBox b:id="field_remote_path" ui:field="field_remote_path"
|
||||
readOnly="true"></b:TextBox>
|
||||
<b:TextBox b:id="field_remote_path"
|
||||
ui:field="field_remote_path" readOnly="true"></b:TextBox>
|
||||
</b:Controls>
|
||||
</b:ControlGroup>
|
||||
|
||||
<!-- <b:ControlGroup ui:field="cg_last_sync"> -->
|
||||
<!-- <b:ControlLabel for="cl_last_sync">Last Sync Time</b:ControlLabel> -->
|
||||
<!-- <b:Controls> -->
|
||||
<!-- <b:TextBox b:id="field_last_sync" ui:field="field_last_sync" -->
|
||||
<!-- readOnly="true"></b:TextBox> -->
|
||||
<!-- </b:Controls> -->
|
||||
<!-- </b:ControlGroup> -->
|
||||
|
||||
<!-- <b:ControlGroup ui:field="cg_last_sync"> -->
|
||||
<!-- <b:ControlLabel for="cl_last_sync">Last Sync Time</b:ControlLabel> -->
|
||||
<!-- <b:Controls> -->
|
||||
<!-- <b:TextBox b:id="field_last_sync" ui:field="field_last_sync" -->
|
||||
<!-- readOnly="true"></b:TextBox> -->
|
||||
<!-- </b:Controls> -->
|
||||
<!-- </b:ControlGroup> -->
|
||||
</b:Fieldset>
|
||||
</b:Form>
|
||||
</g:HTMLPanel>
|
||||
<b:Button type="LINK" ui:field="button_do_unsync" visible="false">Delete Synchronize</b:Button>
|
||||
<b:Button type="LINK" ui:field="button_do_unsync"
|
||||
visible="false">Delete Synchronize</b:Button>
|
||||
<b:Pager left="Update Configuration" right="Do Synchronize"
|
||||
aligned="true" ui:field="pager" />
|
||||
</g:HTMLPanel>
|
||||
|
|
Loading…
Reference in New Issue