Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
openbis
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
sispub
openbis
Commits
1f28e52d
Commit
1f28e52d
authored
16 years ago
by
ribeaudc
Browse files
Options
Downloads
Patches
Plain Diff
[LMS-644] add: - Parsing of the Message returned by the server.
SVN: 9288
parent
75085e0e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/sample/GenericSampleBatchRegistrationForm.java
+59
-26
59 additions, 26 deletions
...pplication/sample/GenericSampleBatchRegistrationForm.java
with
59 additions
and
26 deletions
openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/sample/GenericSampleBatchRegistrationForm.java
+
59
−
26
View file @
1f28e52d
...
...
@@ -37,6 +37,9 @@ import com.extjs.gxt.ui.client.widget.form.FormPanel.Encoding;
import
com.extjs.gxt.ui.client.widget.form.FormPanel.Method
;
import
com.extjs.gxt.ui.client.widget.layout.FlowLayout
;
import
com.extjs.gxt.ui.client.widget.layout.FormLayout
;
import
com.google.gwt.xml.client.Document
;
import
com.google.gwt.xml.client.Node
;
import
com.google.gwt.xml.client.XMLParser
;
import
ch.systemsx.cisd.openbis.generic.client.web.client.application.AbstractAsyncCallback
;
import
ch.systemsx.cisd.openbis.generic.client.web.client.application.GenericConstants
;
...
...
@@ -138,32 +141,7 @@ public final class GenericSampleBatchRegistrationForm extends LayoutContainer
// Does some action after the form has been successfully submitted. Note that the response
// coming from the server could be an error message. Even in case of error on the server
// side this listener will be informed.
panel
.
addListener
(
Events
.
Submit
,
new
Listener
<
FormEvent
>()
{
//
// Listener
//
public
final
void
handleEvent
(
final
FormEvent
be
)
{
final
String
msg
=
be
.
resultHtml
;
// Was not successful
if
(
StringUtils
.
isBlank
(
msg
)
==
false
)
{
infoBox
.
displayError
(
msg
);
// final Document document = XMLParser.parse(msg);
// System.out.println(document.getElementsByTagName("message").item(0)
// .getFirstChild().getNodeValue());
setUploadEnabled
(
true
);
}
else
{
viewContext
.
getService
().
registerSamples
(
sampleType
,
sessionKeyField
.
getValue
(),
new
RegisterSamplesCallback
(
viewContext
));
}
}
});
panel
.
addListener
(
Events
.
Submit
,
new
FormPanelListener
());
return
panel
;
}
...
...
@@ -252,4 +230,59 @@ public final class GenericSampleBatchRegistrationForm extends LayoutContainer
}
}
private
final
class
FormPanelListener
implements
Listener
<
FormEvent
>
{
FormPanelListener
()
{
}
private
final
void
extractAndDisplay
(
final
String
msg
)
{
final
Document
document
=
XMLParser
.
parse
(
msg
);
final
Node
message
=
document
.
getFirstChild
();
final
Node
typeNode
=
message
.
getAttributes
().
getNamedItem
(
"type"
);
final
String
messageText
=
message
.
getFirstChild
().
getNodeValue
();
final
String
type
=
typeNode
.
getNodeValue
();
if
(
"info"
.
equals
(
type
))
{
infoBox
.
displayInfo
(
messageText
);
}
else
{
infoBox
.
displayError
(
messageText
);
}
}
//
// Listener
//
public
final
void
handleEvent
(
final
FormEvent
be
)
{
final
String
msg
=
be
.
resultHtml
;
// Was not successful
if
(
StringUtils
.
isBlank
(
msg
)
==
false
)
{
if
(
msg
.
startsWith
(
"<message"
))
{
if
(
msg
.
indexOf
(
"<![CDATA["
)
>
-
1
&&
XMLParser
.
supportsCDATASection
()
==
false
)
{
infoBox
.
displayError
(
msg
.
replaceAll
(
"<"
,
"<"
));
}
else
{
extractAndDisplay
(
msg
);
}
}
else
{
infoBox
.
displayError
(
msg
);
}
setUploadEnabled
(
true
);
}
else
{
viewContext
.
getService
().
registerSamples
(
sampleType
,
SESSION_KEY
,
new
RegisterSamplesCallback
(
viewContext
));
}
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment