ref 9056:TabMan - Improve resource management in TabMan
https://support.d4science.org/issues/9056 Improve resources management git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-sdmx-export-widget@151398 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
19010a25a9
commit
3323ff92fa
|
@ -29,8 +29,10 @@ public class SDMXExportWizardTD extends WizardWindow {
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* @param title Title
|
* @param title
|
||||||
* @param eventBus Event bus
|
* Title
|
||||||
|
* @param eventBus
|
||||||
|
* Event bus
|
||||||
*/
|
*/
|
||||||
public SDMXExportWizardTD(String title, final EventBus eventBus) {
|
public SDMXExportWizardTD(String title, final EventBus eventBus) {
|
||||||
super(title, eventBus);
|
super(title, eventBus);
|
||||||
|
@ -39,52 +41,47 @@ public class SDMXExportWizardTD extends WizardWindow {
|
||||||
|
|
||||||
exportSession = new SDMXExportSession();
|
exportSession = new SDMXExportSession();
|
||||||
|
|
||||||
final AutoProgressMessageBox box = new AutoProgressMessageBox("Wait",
|
final AutoProgressMessageBox box = new AutoProgressMessageBox("Wait", "Retrieving Information, please wait...");
|
||||||
"Retrive Tabular Resource Information, please wait...");
|
|
||||||
box.setProgressText("Retrieving...");
|
box.setProgressText("Retrieving...");
|
||||||
box.auto();
|
box.auto();
|
||||||
box.show();
|
box.show();
|
||||||
|
|
||||||
TDGWTServiceAsync.INSTANCE
|
retrieveTabularDataInfo(box);
|
||||||
.getTabResourceInformation(new AsyncCallback<TabResource>() {
|
|
||||||
|
|
||||||
public void onFailure(Throwable caught) {
|
SDMXRegistrySelectionCard sdmxRegistrySelectionCard = new SDMXRegistrySelectionCard(exportSession);
|
||||||
if (caught instanceof TDGWTSessionExpiredException) {
|
|
||||||
eventBus.fireEvent(new SessionExpiredEvent(
|
|
||||||
SessionExpiredType.EXPIREDONSERVER));
|
|
||||||
} else {
|
|
||||||
if (caught instanceof TDGWTIsLockedException) {
|
|
||||||
Log.error(caught.getLocalizedMessage());
|
|
||||||
showErrorAndHide("Error Locked",
|
|
||||||
caught.getLocalizedMessage(), "",
|
|
||||||
caught);
|
|
||||||
} else {
|
|
||||||
Log.error("No Tabular Resource Information retrived from server "
|
|
||||||
+ caught.getLocalizedMessage());
|
|
||||||
box.hide();
|
|
||||||
showErrorAndHide(
|
|
||||||
"Error",
|
|
||||||
"Error retrieving tabular resource information: ",
|
|
||||||
caught.getLocalizedMessage(), caught);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onSuccess(TabResource result) {
|
|
||||||
Log.debug("Tabular Resource Information retrived");
|
|
||||||
exportSession.setTabResource(result);
|
|
||||||
exportSession.setExportType(TableType
|
|
||||||
.getColumnDataTypeFromId(result
|
|
||||||
.getTableTypeName()));
|
|
||||||
box.hide();
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
SDMXRegistrySelectionCard sdmxRegistrySelectionCard = new SDMXRegistrySelectionCard(
|
|
||||||
exportSession);
|
|
||||||
addCard(sdmxRegistrySelectionCard);
|
addCard(sdmxRegistrySelectionCard);
|
||||||
sdmxRegistrySelectionCard.setup();
|
sdmxRegistrySelectionCard.setup();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void retrieveTabularDataInfo(final AutoProgressMessageBox box) {
|
||||||
|
TDGWTServiceAsync.INSTANCE.getTabResourceInformation(new AsyncCallback<TabResource>() {
|
||||||
|
|
||||||
|
public void onFailure(Throwable caught) {
|
||||||
|
if (caught instanceof TDGWTSessionExpiredException) {
|
||||||
|
eventBus.fireEvent(new SessionExpiredEvent(SessionExpiredType.EXPIREDONSERVER));
|
||||||
|
} else {
|
||||||
|
if (caught instanceof TDGWTIsLockedException) {
|
||||||
|
Log.error(caught.getLocalizedMessage());
|
||||||
|
showErrorAndHide("Error Locked", caught.getLocalizedMessage(), "", caught);
|
||||||
|
} else {
|
||||||
|
Log.error(
|
||||||
|
"No Tabular Resource Information retrived from server " + caught.getLocalizedMessage());
|
||||||
|
box.hide();
|
||||||
|
showErrorAndHide("Error", "Error retrieving tabular resource information: ",
|
||||||
|
caught.getLocalizedMessage(), caught);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onSuccess(TabResource result) {
|
||||||
|
Log.debug("Tabular Resource Information retrived");
|
||||||
|
exportSession.setTabResource(result);
|
||||||
|
exportSession.setExportType(TableType.getColumnDataTypeFromId(result.getTableTypeName()));
|
||||||
|
box.hide();
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -156,7 +156,7 @@ public class SDMXOperationInProgressCard extends WizardCard implements
|
||||||
newTrId = operationResult.getTrId();
|
newTrId = operationResult.getTrId();
|
||||||
SafeHtmlBuilder safeHtmlBuilder = new SafeHtmlBuilder();
|
SafeHtmlBuilder safeHtmlBuilder = new SafeHtmlBuilder();
|
||||||
safeHtmlBuilder
|
safeHtmlBuilder
|
||||||
.appendHtmlConstant("<div style='text-align:center;font-size:large;font-weight:bold; color:#009900;'>Operation Completed</div>");
|
.appendHtmlConstant("<div style='text-align:center;font-size:large;font-weight:bold; color:#009900;'>Operation Completed<br>Check The Resources</div>");
|
||||||
resultField.setHTML(safeHtmlBuilder.toSafeHtml());
|
resultField.setHTML(safeHtmlBuilder.toSafeHtml());
|
||||||
resultField.setVisible(true);
|
resultField.setVisible(true);
|
||||||
Command sayComplete = new Command() {
|
Command sayComplete = new Command() {
|
||||||
|
|
|
@ -44,48 +44,50 @@ public class SDMXRegistrySelectionCard extends WizardCard {
|
||||||
public SDMXRegistrySelectionCard(final SDMXExportSession exportSession) {
|
public SDMXRegistrySelectionCard(final SDMXExportSession exportSession) {
|
||||||
super("SDMX Registry selection", "");
|
super("SDMX Registry selection", "");
|
||||||
thisCard = this;
|
thisCard = this;
|
||||||
SDMXRegistrySource sdmxRegistrySource=new SDMXRegistrySource();
|
SDMXRegistrySource sdmxRegistrySource = new SDMXRegistrySource();
|
||||||
exportSession.setSource(sdmxRegistrySource);
|
exportSession.setSource(sdmxRegistrySource);
|
||||||
this.exportSession = exportSession;
|
this.exportSession = exportSession;
|
||||||
|
retrieveDefaultRegistryURL();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void create(String defaultRegistryUrl) {
|
||||||
|
|
||||||
VerticalPanel registrySelectionPanel = new VerticalPanel();
|
VerticalPanel registrySelectionPanel = new VerticalPanel();
|
||||||
registrySelectionPanel.setStylePrimaryName(res.wizardCSS()
|
registrySelectionPanel.setStylePrimaryName(res.wizardCSS().getImportSelectionSources());
|
||||||
.getImportSelectionSources());
|
|
||||||
|
|
||||||
Radio radioStandardRegistry = new Radio();
|
Radio radioStandardRegistry = new Radio();
|
||||||
|
|
||||||
radioStandardRegistry
|
if (defaultRegistryUrl == null || defaultRegistryUrl.isEmpty()) {
|
||||||
.setBoxLabel("<p style='display:inline-table;'><b>Internal SDMX Registry</b>"
|
radioStandardRegistry.setBoxLabel("<p style='display:inline-table;'><b>Internal SDMX Registry</b>"
|
||||||
+ "<br>Select this if you want use the Internal Registry</p>");
|
+ "<br>Select this if you want use the Internal Registry" + "</p>");
|
||||||
|
} else {
|
||||||
|
radioStandardRegistry.setBoxLabel("<p style='display:inline-table;'><b>Internal SDMX Registry</b>"
|
||||||
|
+ "<br>Select this if you want use the <a href='" + defaultRegistryUrl + "'>Internal Registry</a>"
|
||||||
|
+ "</p>");
|
||||||
|
}
|
||||||
radioStandardRegistry.setValue(true);
|
radioStandardRegistry.setValue(true);
|
||||||
radioStandardRegistry.setName("Default");
|
radioStandardRegistry.setName("Default");
|
||||||
radioStandardRegistry.setStylePrimaryName(res.wizardCSS()
|
radioStandardRegistry.setStylePrimaryName(res.wizardCSS().getImportSelectionSource());
|
||||||
.getImportSelectionSource());
|
|
||||||
|
|
||||||
Radio radioUrlRegistry = new Radio();
|
Radio radioUrlRegistry = new Radio();
|
||||||
radioUrlRegistry
|
radioUrlRegistry.setBoxLabel(
|
||||||
.setBoxLabel("<p style='display:inline-table;'><b>Another SDMX Registry</b><br><SPAN id='SDMXRegistryUrl'></SPAN></p>");
|
"<p style='display:inline-table;'><b>Another SDMX Registry</b><br><SPAN id='SDMXRegistryUrl'></SPAN></p>");
|
||||||
radioUrlRegistry.setName("Url");
|
radioUrlRegistry.setName("Url");
|
||||||
radioUrlRegistry.setStylePrimaryName(res.wizardCSS()
|
radioUrlRegistry.setStylePrimaryName(res.wizardCSS().getImportSelectionSource());
|
||||||
.getImportSelectionSource());
|
|
||||||
radioUrlRegistry.disable();
|
radioUrlRegistry.disable();
|
||||||
radioUrlRegistry.setVisible(false);
|
radioUrlRegistry.setVisible(false);
|
||||||
|
|
||||||
|
|
||||||
url.setName("sdmxRegistryUrlInpuntField");
|
url.setName("sdmxRegistryUrlInpuntField");
|
||||||
url.setId("sdmxRegistryUrlInputFieldId");
|
url.setId("sdmxRegistryUrlInputFieldId");
|
||||||
url.setStylePrimaryName(res.wizardCSS()
|
url.setStylePrimaryName(res.wizardCSS().getSDMXRegistryUrlInputStyle());
|
||||||
.getSDMXRegistryUrlInputStyle());
|
|
||||||
|
|
||||||
final VerticalLayoutContainer vcontainer = new VerticalLayoutContainer();
|
final VerticalLayoutContainer vcontainer = new VerticalLayoutContainer();
|
||||||
vcontainer.add(new FieldLabel(url, "URL"), new VerticalLayoutData(-1,
|
vcontainer.add(new FieldLabel(url, "URL"), new VerticalLayoutData(-1, -1));
|
||||||
-1));
|
vcontainer.setStylePrimaryName(res.wizardCSS().getSDMXRegistryUrlStyle());
|
||||||
vcontainer.setStylePrimaryName(res.wizardCSS()
|
|
||||||
.getSDMXRegistryUrlStyle());
|
|
||||||
vcontainer.setVisible(false);
|
vcontainer.setVisible(false);
|
||||||
|
|
||||||
NodeList<Element> nodel = radioUrlRegistry.getElement()
|
NodeList<Element> nodel = radioUrlRegistry.getElement().getElementsByTagName("SPAN");
|
||||||
.getElementsByTagName("SPAN");
|
|
||||||
Element span = nodel.getItem(0);
|
Element span = nodel.getItem(0);
|
||||||
span.appendChild(vcontainer.getElement());
|
span.appendChild(vcontainer.getElement());
|
||||||
|
|
||||||
|
@ -99,7 +101,6 @@ public class SDMXRegistrySelectionCard extends WizardCard {
|
||||||
|
|
||||||
toggle.addValueChangeHandler(new ValueChangeHandler<HasValue<Boolean>>() {
|
toggle.addValueChangeHandler(new ValueChangeHandler<HasValue<Boolean>>() {
|
||||||
|
|
||||||
|
|
||||||
public void onValueChange(ValueChangeEvent<HasValue<Boolean>> event) {
|
public void onValueChange(ValueChangeEvent<HasValue<Boolean>> event) {
|
||||||
try {
|
try {
|
||||||
ToggleGroup group = (ToggleGroup) event.getSource();
|
ToggleGroup group = (ToggleGroup) event.getSource();
|
||||||
|
@ -107,36 +108,58 @@ public class SDMXRegistrySelectionCard extends WizardCard {
|
||||||
Log.info("Registry Selected:" + radio.getName());
|
Log.info("Registry Selected:" + radio.getName());
|
||||||
if (radio.getName().compareTo("Url") == 0) {
|
if (radio.getName().compareTo("Url") == 0) {
|
||||||
vcontainer.setVisible(true);
|
vcontainer.setVisible(true);
|
||||||
NodeList<Element> nodel = radio.getElement()
|
NodeList<Element> nodel = radio.getElement().getElementsByTagName("SPAN");
|
||||||
.getElementsByTagName("SPAN");
|
|
||||||
Element span = nodel.getItem(0);
|
Element span = nodel.getItem(0);
|
||||||
span.appendChild(vcontainer.getElement());
|
span.appendChild(vcontainer.getElement());
|
||||||
|
|
||||||
Log.info("SDMXRegistry Url");
|
Log.info("SDMXRegistry Url");
|
||||||
Log.info("Input value: " + url.getCurrentValue());
|
Log.info("Input value: " + url.getCurrentValue());
|
||||||
SDMXRegistrySource r = ((SDMXRegistrySource) exportSession
|
SDMXRegistrySource r = ((SDMXRegistrySource) exportSession.getSource());
|
||||||
.getSource());
|
//TODO r.setUrl(url.getCurrentValue());
|
||||||
r.setUrl(null);
|
r.setUrl(null);
|
||||||
Log.info("" + exportSession.getSource());
|
Log.info("" + exportSession.getSource());
|
||||||
} else {
|
} else {
|
||||||
vcontainer.setVisible(false);
|
vcontainer.setVisible(false);
|
||||||
Log.info("SDMXRegistry Default");
|
Log.info("SDMXRegistry Default");
|
||||||
SDMXRegistrySource r = ((SDMXRegistrySource) exportSession
|
SDMXRegistrySource r = ((SDMXRegistrySource) exportSession.getSource());
|
||||||
.getSource());
|
|
||||||
r.setUrl(null);
|
r.setUrl(null);
|
||||||
Log.info("Input value: " + url.getCurrentValue());
|
|
||||||
Log.info("" + exportSession.getSource());
|
Log.info("" + exportSession.getSource());
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.error("ToggleGroup: onValueChange "
|
Log.error("ToggleGroup: onValueChange " + e.getLocalizedMessage());
|
||||||
+ e.getLocalizedMessage());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
setCenterWidget(registrySelectionPanel, new MarginData(0));
|
setCenterWidget(registrySelectionPanel, new MarginData(0));
|
||||||
|
forceLayout();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void retrieveDefaultRegistryURL() {
|
||||||
|
mask("Please Wait...");
|
||||||
|
|
||||||
|
TDGWTServiceAsync.INSTANCE.getDefaultSDMXRegistryURL(new AsyncCallback<String>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Throwable caught) {
|
||||||
|
unmask();
|
||||||
|
if (caught instanceof TDGWTSessionExpiredException) {
|
||||||
|
getEventBus().fireEvent(new SessionExpiredEvent(SessionExpiredType.EXPIREDONSERVER));
|
||||||
|
} else {
|
||||||
|
|
||||||
|
Log.error("Error retrieving URL of default SDMX Registry " + caught.getLocalizedMessage());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess(String defaultURLRegistry) {
|
||||||
|
unmask();
|
||||||
|
create(defaultURLRegistry);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -146,30 +169,27 @@ public class SDMXRegistrySelectionCard extends WizardCard {
|
||||||
try {
|
try {
|
||||||
Log.info("Input value: " + url.getCurrentValue());
|
Log.info("Input value: " + url.getCurrentValue());
|
||||||
if (exportSession.getSource() instanceof SDMXRegistrySource) {
|
if (exportSession.getSource() instanceof SDMXRegistrySource) {
|
||||||
((SDMXRegistrySource) exportSession.getSource())
|
((SDMXRegistrySource) exportSession.getSource()).setUrl(url.getCurrentValue());
|
||||||
.setUrl(url.getCurrentValue());
|
|
||||||
|
|
||||||
TDGWTServiceAsync.INSTANCE.setSDMXRegistrySource(
|
TDGWTServiceAsync.INSTANCE.setSDMXRegistrySource(
|
||||||
((SDMXRegistrySource)exportSession.getSource()), new AsyncCallback<Void>() {
|
((SDMXRegistrySource) exportSession.getSource()), new AsyncCallback<Void>() {
|
||||||
|
|
||||||
public void onFailure(Throwable caught) {
|
public void onFailure(Throwable caught) {
|
||||||
if (caught instanceof TDGWTSessionExpiredException) {
|
if (caught instanceof TDGWTSessionExpiredException) {
|
||||||
getEventBus()
|
getEventBus().fireEvent(
|
||||||
.fireEvent(
|
new SessionExpiredEvent(SessionExpiredType.EXPIREDONSERVER));
|
||||||
new SessionExpiredEvent(
|
} else {
|
||||||
SessionExpiredType.EXPIREDONSERVER));
|
Log.error(
|
||||||
} else {
|
"SDMXRegistrySource do not stored " + caught.getLocalizedMessage());
|
||||||
Log.error("SDMXRegistrySource do not stored "
|
showErrorAndHide("Error", "SDMXRegistrySource do not stored.",
|
||||||
+ caught.getLocalizedMessage());
|
caught.getLocalizedMessage(), caught);
|
||||||
showErrorAndHide("Error", "SDMXRegistrySource do not stored."
|
|
||||||
,caught.getLocalizedMessage(), caught);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onSuccess(Void result) {
|
public void onSuccess(Void result) {
|
||||||
Log.info("SDMXRegistrySource stored");
|
Log.info("SDMXRegistrySource stored");
|
||||||
goNext();
|
goNext();
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
@ -184,8 +204,7 @@ public class SDMXRegistrySelectionCard extends WizardCard {
|
||||||
};
|
};
|
||||||
|
|
||||||
getWizardWindow().setNextButtonCommand(sayNextCard);
|
getWizardWindow().setNextButtonCommand(sayNextCard);
|
||||||
|
|
||||||
|
|
||||||
Command sayPreviousCard = new Command() {
|
Command sayPreviousCard = new Command() {
|
||||||
public void execute() {
|
public void execute() {
|
||||||
try {
|
try {
|
||||||
|
@ -196,20 +215,19 @@ public class SDMXRegistrySelectionCard extends WizardCard {
|
||||||
Log.error("sayPreviousCard :" + e.getLocalizedMessage());
|
Log.error("sayPreviousCard :" + e.getLocalizedMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
getWizardWindow().setPreviousButtonCommand(sayPreviousCard);
|
getWizardWindow().setPreviousButtonCommand(sayPreviousCard);
|
||||||
|
|
||||||
setEnableBackButton(false);
|
setEnableBackButton(false);
|
||||||
setEnableNextButton(true);
|
setEnableNextButton(true);
|
||||||
setBackButtonVisible(false);
|
setBackButtonVisible(false);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void goNext() {
|
protected void goNext() {
|
||||||
try {
|
try {
|
||||||
SDMXAgenciesSelectionCard sdmxAgencyTypeCard = new SDMXAgenciesSelectionCard(
|
SDMXAgenciesSelectionCard sdmxAgencyTypeCard = new SDMXAgenciesSelectionCard(exportSession);
|
||||||
exportSession);
|
|
||||||
getWizardWindow().addCard(sdmxAgencyTypeCard);
|
getWizardWindow().addCard(sdmxAgencyTypeCard);
|
||||||
Log.info("NextCard SDMXAgenciesSelectionCard ");
|
Log.info("NextCard SDMXAgenciesSelectionCard ");
|
||||||
getWizardWindow().nextCard();
|
getWizardWindow().nextCard();
|
||||||
|
@ -218,6 +236,4 @@ public class SDMXRegistrySelectionCard extends WizardCard {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -156,7 +156,7 @@ public class SDMXTemplateExportOperationInProgressCard extends WizardCard implem
|
||||||
newTrId = operationResult.getTrId();
|
newTrId = operationResult.getTrId();
|
||||||
SafeHtmlBuilder safeHtmlBuilder = new SafeHtmlBuilder();
|
SafeHtmlBuilder safeHtmlBuilder = new SafeHtmlBuilder();
|
||||||
safeHtmlBuilder
|
safeHtmlBuilder
|
||||||
.appendHtmlConstant("<div style='text-align:center;font-size:large;font-weight:bold; color:#009900;'>Operation Completed</div>");
|
.appendHtmlConstant("<div style='text-align:center;font-size:large;font-weight:bold; color:#009900;'>Operation Completed<br>Check The Resources</div>");
|
||||||
resultField.setHTML(safeHtmlBuilder.toSafeHtml());
|
resultField.setHTML(safeHtmlBuilder.toSafeHtml());
|
||||||
resultField.setVisible(true);
|
resultField.setVisible(true);
|
||||||
Command sayComplete = new Command() {
|
Command sayComplete = new Command() {
|
||||||
|
|
|
@ -47,45 +47,46 @@ public class SDMXTemplateExportRegistrySelectionCard extends WizardCard {
|
||||||
SDMXRegistrySource sdmxRegistrySource=new SDMXRegistrySource();
|
SDMXRegistrySource sdmxRegistrySource=new SDMXRegistrySource();
|
||||||
sdmxTemplateExportSession.setSource(sdmxRegistrySource);
|
sdmxTemplateExportSession.setSource(sdmxRegistrySource);
|
||||||
this.sdmxTemplateExportSession = sdmxTemplateExportSession;
|
this.sdmxTemplateExportSession = sdmxTemplateExportSession;
|
||||||
|
retrieveDefaultRegistryURL();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void create(String defaultRegistryUrl) {
|
||||||
VerticalPanel registrySelectionPanel = new VerticalPanel();
|
VerticalPanel registrySelectionPanel = new VerticalPanel();
|
||||||
registrySelectionPanel.setStylePrimaryName(res.wizardCSS()
|
registrySelectionPanel.setStylePrimaryName(res.wizardCSS().getImportSelectionSources());
|
||||||
.getImportSelectionSources());
|
|
||||||
|
|
||||||
Radio radioStandardRegistry = new Radio();
|
Radio radioStandardRegistry = new Radio();
|
||||||
|
|
||||||
radioStandardRegistry
|
if (defaultRegistryUrl == null || defaultRegistryUrl.isEmpty()) {
|
||||||
.setBoxLabel("<p style='display:inline-table;'><b>Internal SDMX Registry</b>"
|
radioStandardRegistry.setBoxLabel("<p style='display:inline-table;'><b>Internal SDMX Registry</b>"
|
||||||
+ "<br>Select this if you want use the Internal Registry</p>");
|
+ "<br>Select this if you want use the Internal Registry" + "</p>");
|
||||||
|
} else {
|
||||||
|
radioStandardRegistry.setBoxLabel("<p style='display:inline-table;'><b>Internal SDMX Registry</b>"
|
||||||
|
+ "<br>Select this if you want use the <a href='" + defaultRegistryUrl + "'>Internal Registry</a>"
|
||||||
|
+ "</p>");
|
||||||
|
}
|
||||||
radioStandardRegistry.setValue(true);
|
radioStandardRegistry.setValue(true);
|
||||||
radioStandardRegistry.setName("Default");
|
radioStandardRegistry.setName("Default");
|
||||||
radioStandardRegistry.setStylePrimaryName(res.wizardCSS()
|
radioStandardRegistry.setStylePrimaryName(res.wizardCSS().getImportSelectionSource());
|
||||||
.getImportSelectionSource());
|
|
||||||
|
|
||||||
Radio radioUrlRegistry = new Radio();
|
Radio radioUrlRegistry = new Radio();
|
||||||
radioUrlRegistry
|
radioUrlRegistry.setBoxLabel(
|
||||||
.setBoxLabel("<p style='display:inline-table;'><b>Another SDMX Registry</b><br><SPAN id='SDMXRegistryUrl'></SPAN></p>");
|
"<p style='display:inline-table;'><b>Another SDMX Registry</b><br><SPAN id='SDMXRegistryUrl'></SPAN></p>");
|
||||||
radioUrlRegistry.setName("Url");
|
radioUrlRegistry.setName("Url");
|
||||||
radioUrlRegistry.setStylePrimaryName(res.wizardCSS()
|
radioUrlRegistry.setStylePrimaryName(res.wizardCSS().getImportSelectionSource());
|
||||||
.getImportSelectionSource());
|
|
||||||
radioUrlRegistry.disable();
|
radioUrlRegistry.disable();
|
||||||
radioUrlRegistry.setVisible(false);
|
radioUrlRegistry.setVisible(false);
|
||||||
|
|
||||||
|
|
||||||
url.setName("sdmxRegistryUrlInpuntField");
|
url.setName("sdmxRegistryUrlInpuntField");
|
||||||
url.setId("sdmxRegistryUrlInputFieldId");
|
url.setId("sdmxRegistryUrlInputFieldId");
|
||||||
url.setStylePrimaryName(res.wizardCSS()
|
url.setStylePrimaryName(res.wizardCSS().getSDMXRegistryUrlInputStyle());
|
||||||
.getSDMXRegistryUrlInputStyle());
|
|
||||||
|
|
||||||
final VerticalLayoutContainer vcontainer = new VerticalLayoutContainer();
|
final VerticalLayoutContainer vcontainer = new VerticalLayoutContainer();
|
||||||
vcontainer.add(new FieldLabel(url, "URL"), new VerticalLayoutData(-1,
|
vcontainer.add(new FieldLabel(url, "URL"), new VerticalLayoutData(-1, -1));
|
||||||
-1));
|
vcontainer.setStylePrimaryName(res.wizardCSS().getSDMXRegistryUrlStyle());
|
||||||
vcontainer.setStylePrimaryName(res.wizardCSS()
|
|
||||||
.getSDMXRegistryUrlStyle());
|
|
||||||
vcontainer.setVisible(false);
|
vcontainer.setVisible(false);
|
||||||
|
|
||||||
NodeList<Element> nodel = radioUrlRegistry.getElement()
|
NodeList<Element> nodel = radioUrlRegistry.getElement().getElementsByTagName("SPAN");
|
||||||
.getElementsByTagName("SPAN");
|
|
||||||
Element span = nodel.getItem(0);
|
Element span = nodel.getItem(0);
|
||||||
span.appendChild(vcontainer.getElement());
|
span.appendChild(vcontainer.getElement());
|
||||||
|
|
||||||
|
@ -99,7 +100,6 @@ public class SDMXTemplateExportRegistrySelectionCard extends WizardCard {
|
||||||
|
|
||||||
toggle.addValueChangeHandler(new ValueChangeHandler<HasValue<Boolean>>() {
|
toggle.addValueChangeHandler(new ValueChangeHandler<HasValue<Boolean>>() {
|
||||||
|
|
||||||
|
|
||||||
public void onValueChange(ValueChangeEvent<HasValue<Boolean>> event) {
|
public void onValueChange(ValueChangeEvent<HasValue<Boolean>> event) {
|
||||||
try {
|
try {
|
||||||
ToggleGroup group = (ToggleGroup) event.getSource();
|
ToggleGroup group = (ToggleGroup) event.getSource();
|
||||||
|
@ -107,29 +107,25 @@ public class SDMXTemplateExportRegistrySelectionCard extends WizardCard {
|
||||||
Log.info("Registry Selected:" + radio.getName());
|
Log.info("Registry Selected:" + radio.getName());
|
||||||
if (radio.getName().compareTo("Url") == 0) {
|
if (radio.getName().compareTo("Url") == 0) {
|
||||||
vcontainer.setVisible(true);
|
vcontainer.setVisible(true);
|
||||||
NodeList<Element> nodel = radio.getElement()
|
NodeList<Element> nodel = radio.getElement().getElementsByTagName("SPAN");
|
||||||
.getElementsByTagName("SPAN");
|
|
||||||
Element span = nodel.getItem(0);
|
Element span = nodel.getItem(0);
|
||||||
span.appendChild(vcontainer.getElement());
|
span.appendChild(vcontainer.getElement());
|
||||||
|
|
||||||
Log.info("SDMXRegistry Url");
|
Log.info("SDMXRegistry Url");
|
||||||
Log.info("Input value: " + url.getCurrentValue());
|
Log.info("Input value: " + url.getCurrentValue());
|
||||||
SDMXRegistrySource r = ((SDMXRegistrySource) sdmxTemplateExportSession
|
SDMXRegistrySource r = ((SDMXRegistrySource) sdmxTemplateExportSession.getSource());
|
||||||
.getSource());
|
|
||||||
r.setUrl(null);
|
r.setUrl(null);
|
||||||
Log.info("" + sdmxTemplateExportSession.getSource());
|
Log.info("" + sdmxTemplateExportSession.getSource());
|
||||||
} else {
|
} else {
|
||||||
vcontainer.setVisible(false);
|
vcontainer.setVisible(false);
|
||||||
Log.info("SDMXRegistry Default");
|
Log.info("SDMXRegistry Default");
|
||||||
SDMXRegistrySource r = ((SDMXRegistrySource) sdmxTemplateExportSession
|
SDMXRegistrySource r = ((SDMXRegistrySource) sdmxTemplateExportSession.getSource());
|
||||||
.getSource());
|
|
||||||
r.setUrl(null);
|
r.setUrl(null);
|
||||||
Log.info("Input value: " + url.getCurrentValue());
|
Log.info("Input value: " + url.getCurrentValue());
|
||||||
Log.info("" + sdmxTemplateExportSession.getSource());
|
Log.info("" + sdmxTemplateExportSession.getSource());
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.error("ToggleGroup: onValueChange "
|
Log.error("ToggleGroup: onValueChange " + e.getLocalizedMessage());
|
||||||
+ e.getLocalizedMessage());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -139,6 +135,32 @@ public class SDMXTemplateExportRegistrySelectionCard extends WizardCard {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void retrieveDefaultRegistryURL() {
|
||||||
|
mask("Please Wait...");
|
||||||
|
|
||||||
|
TDGWTServiceAsync.INSTANCE.getDefaultSDMXRegistryURL(new AsyncCallback<String>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Throwable caught) {
|
||||||
|
unmask();
|
||||||
|
if (caught instanceof TDGWTSessionExpiredException) {
|
||||||
|
getEventBus().fireEvent(new SessionExpiredEvent(SessionExpiredType.EXPIREDONSERVER));
|
||||||
|
} else {
|
||||||
|
|
||||||
|
Log.error("Error retrieving URL of default SDMX Registry " + caught.getLocalizedMessage());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess(String defaultURLRegistry) {
|
||||||
|
unmask();
|
||||||
|
create(defaultURLRegistry);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setup() {
|
public void setup() {
|
||||||
Command sayNextCard = new Command() {
|
Command sayNextCard = new Command() {
|
||||||
|
@ -146,30 +168,28 @@ public class SDMXTemplateExportRegistrySelectionCard extends WizardCard {
|
||||||
try {
|
try {
|
||||||
Log.info("Input value: " + url.getCurrentValue());
|
Log.info("Input value: " + url.getCurrentValue());
|
||||||
if (sdmxTemplateExportSession.getSource() instanceof SDMXRegistrySource) {
|
if (sdmxTemplateExportSession.getSource() instanceof SDMXRegistrySource) {
|
||||||
((SDMXRegistrySource) sdmxTemplateExportSession.getSource())
|
((SDMXRegistrySource) sdmxTemplateExportSession.getSource()).setUrl(url.getCurrentValue());
|
||||||
.setUrl(url.getCurrentValue());
|
|
||||||
|
|
||||||
TDGWTServiceAsync.INSTANCE.setSDMXRegistrySource(
|
TDGWTServiceAsync.INSTANCE.setSDMXRegistrySource(
|
||||||
((SDMXRegistrySource)sdmxTemplateExportSession.getSource()), new AsyncCallback<Void>() {
|
((SDMXRegistrySource) sdmxTemplateExportSession.getSource()),
|
||||||
|
new AsyncCallback<Void>() {
|
||||||
|
|
||||||
public void onFailure(Throwable caught) {
|
public void onFailure(Throwable caught) {
|
||||||
if (caught instanceof TDGWTSessionExpiredException) {
|
if (caught instanceof TDGWTSessionExpiredException) {
|
||||||
getEventBus()
|
getEventBus().fireEvent(
|
||||||
.fireEvent(
|
new SessionExpiredEvent(SessionExpiredType.EXPIREDONSERVER));
|
||||||
new SessionExpiredEvent(
|
} else {
|
||||||
SessionExpiredType.EXPIREDONSERVER));
|
Log.error(
|
||||||
} else {
|
"SDMXRegistrySource do not stored " + caught.getLocalizedMessage());
|
||||||
Log.error("SDMXRegistrySource do not stored "
|
showErrorAndHide("Error", "SDMXRegistrySource do not stored.",
|
||||||
+ caught.getLocalizedMessage());
|
caught.getLocalizedMessage(), caught);
|
||||||
showErrorAndHide("Error", "SDMXRegistrySource do not stored."
|
|
||||||
,caught.getLocalizedMessage(), caught);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onSuccess(Void result) {
|
public void onSuccess(Void result) {
|
||||||
Log.info("SDMXRegistrySource stored");
|
Log.info("SDMXRegistrySource stored");
|
||||||
goNext();
|
goNext();
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
@ -184,8 +204,7 @@ public class SDMXTemplateExportRegistrySelectionCard extends WizardCard {
|
||||||
};
|
};
|
||||||
|
|
||||||
getWizardWindow().setNextButtonCommand(sayNextCard);
|
getWizardWindow().setNextButtonCommand(sayNextCard);
|
||||||
|
|
||||||
|
|
||||||
Command sayPreviousCard = new Command() {
|
Command sayPreviousCard = new Command() {
|
||||||
public void execute() {
|
public void execute() {
|
||||||
try {
|
try {
|
||||||
|
@ -196,16 +215,16 @@ public class SDMXTemplateExportRegistrySelectionCard extends WizardCard {
|
||||||
Log.error("sayPreviousCard :" + e.getLocalizedMessage());
|
Log.error("sayPreviousCard :" + e.getLocalizedMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
getWizardWindow().setPreviousButtonCommand(sayPreviousCard);
|
getWizardWindow().setPreviousButtonCommand(sayPreviousCard);
|
||||||
|
|
||||||
setEnableBackButton(false);
|
setEnableBackButton(false);
|
||||||
setEnableNextButton(true);
|
setEnableNextButton(true);
|
||||||
setBackButtonVisible(false);
|
setBackButtonVisible(false);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void goNext() {
|
protected void goNext() {
|
||||||
try {
|
try {
|
||||||
SDMXTemplateExportAgenciesSelectionCard sdmxAgencyTypeCard = new SDMXTemplateExportAgenciesSelectionCard(
|
SDMXTemplateExportAgenciesSelectionCard sdmxAgencyTypeCard = new SDMXTemplateExportAgenciesSelectionCard(
|
||||||
|
@ -218,6 +237,4 @@ public class SDMXTemplateExportRegistrySelectionCard extends WizardCard {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue