Error message system - AuthorElement ID reference

Post here questions and problems related to oXygen frameworks/document types.
Johann
Posts: 199
Joined: Wed Jun 17, 2015 12:46 pm

Error message system - AuthorElement ID reference

Post by Johann »

Hi,

I'm searching to build an error message system, which can be updated from any modification, to display an error message relative to an AuthorNode. All is good :

- CustomValidationProblemsFilter which updates a CustomError (couple of AuthorNode/ErrorInformation) List and merges it with Oxygen errors to update UI

- Update from any place with a Helper class which manages adding/removing error and specific style if necessary

My problem is I can't find a default solution to remove an old error, because I've not found any AuthorElement ID reference.

For example :

- I set up a custom error on a node because an attribute value is invalid.

- User changes this attribute value and it still is in error

- I set up a new error, but I can't remove the old error because the AuthorElement doesn't have the same previous instance ID.

I've looked for AuthorElement.equals or AuthorElement.hashCode, AuthorReferenceResolver (interface but not implemented by default), Anchor system (documentController), but I still can't get any unique reference ID from a same AuthorNode like : getId(AuthorElement element)

Please, do you have a solution to solve my problem ?

Regards.

Johann
Radu
Posts: 9059
Joined: Fri Jul 09, 2004 5:18 pm

Re: Error message system - AuthorElement ID reference

Post by Radu »

Hi Johann,

Ideally your "CustomValidationProblemsFilter" should be stateless. You receive the "filterValidationProblems" callback, you navigate the entire structure of Author Elements and create a series of ro.sync.ecss.component.validation.AuthorDocumentPositionedInfo objects which all represent errors for a particular AuthorElement.
Did you create an extra HashMap persistent between "filterValidationProblems" calls containing AuthorElements for which you already established that there were previous errors? And for what purpose?
There is no magic "ID" for an AuthorElement. If we kept such an ID inside each element, it would increase the overall memory footprint.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Post Reply