Editor gains focus, while conref is edited
Oxygen general issues.
-
- Posts: 206
- Joined: Thu Dec 01, 2011 4:22 pm
- Location: Hamburg, Germany
Editor gains focus, while conref is edited
Hello,
in our cms we allow the user to edit the attributes of a xml document directly. This means while the user is typing the new value for an attribute the typed letters are directly inserted.
The problem is when the user types a new value for the conref attribute, the editor gains the focus so that the user continues to write content in the xml document and therefore has to focus the Text Widget again each letter
Would it be possible to avoid that the editor gains the focus when it resolves a conref?
Currently as a workaround we turned off the feature that conrefs are resolved automatically in the preferences.
Best regards,
Simon
in our cms we allow the user to edit the attributes of a xml document directly. This means while the user is typing the new value for an attribute the typed letters are directly inserted.
The problem is when the user types a new value for the conref attribute, the editor gains the focus so that the user continues to write content in the xml document and therefore has to focus the Text Widget again each letter

Would it be possible to avoid that the editor gains the focus when it resolves a conref?
Currently as a workaround we turned off the feature that conrefs are resolved automatically in the preferences.
Best regards,
Simon
Simon Scholz
vogella GmbH
http://www.vogella.com
vogella GmbH
http://www.vogella.com
-
- Posts: 9445
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Editor gains focus, while conref is edited
Hi Simon,
I cannot quite reproduce the behavior on my side.
So you are referring to the Author mode, right?
Did you create some kind of custom Attributes view which uses our AuthorDocumentController API to set attributes to the current XML element?
Are you sure that the custom code you added for setting the attribute does not request focus in the document at some point?
Because I added some logging on our side and modifying the @conref attribute or any other attribute does not seem to set focus back to the Author mode control.
I had a view in which I added an action and that action used the AuthorDocumentController to modify an attribute in the document, the focus remained in the view after the modification occured.
The focus is requested in the Author mode control only when saving the content (CTRL-S).
Regards,
Radu
I cannot quite reproduce the behavior on my side.
So you are referring to the Author mode, right?
Did you create some kind of custom Attributes view which uses our AuthorDocumentController API to set attributes to the current XML element?
Are you sure that the custom code you added for setting the attribute does not request focus in the document at some point?
Because I added some logging on our side and modifying the @conref attribute or any other attribute does not seem to set focus back to the Author mode control.
I had a view in which I added an action and that action used the AuthorDocumentController to modify an attribute in the document, the focus remained in the view after the modification occured.
The focus is requested in the Author mode control only when saving the content (CTRL-S).
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 206
- Joined: Thu Dec 01, 2011 4:22 pm
- Location: Hamburg, Germany
Re: Editor gains focus, while conref is edited
That´s right.Radu wrote: I cannot quite reproduce the behavior on my side.
So you are referring to the Author mode, right?
Yes we have our own properties view for all properties in our CMS.Radu wrote: Did you create some kind of custom Attributes view which uses our AuthorDocumentController API to set attributes to the current XML element?
And in case the properties are the attributes of an AuthorNode in the Editor they are modified by the AuthorDocumentController API.
So your guess is right.
Because of the fact that modifing conref attributes and all other attributes have the same implementation, it must be the conrefs fault that the focus is gained. When we modify other attributes the editor does not gain the focus.Radu wrote: Are you sure that the custom code you added for setting the attribute does not request focus in the document at some point?
Other reason is that when I turn off the preference for resolving conrefs everything works just fine.
So resolving conrefs and the focus problem must be somehow connected.
Here is the code, which I use to modify the attributes.
Code: Select all
if (authorNode instanceof AuthorElement) {
AuthorElement authorElement = (AuthorElement) authorNode;
AuthorDocumentController documentController = getDocumentController();
if (documentController != null) {
AttrValue attrValue = new AttrValue(value.toString());
if (id instanceof CIAttribute) {
String attrName = ((CIAttribute) id).getName();
if ("".equals(value)) { //$NON-NLS-1$
documentController.removeAttribute(attrName,
authorElement);
} else {
documentController.setAttribute(attrName, attrValue,
authorElement);
}
}
if (id instanceof String) {
if ("".equals(value)) { //$NON-NLS-1$
documentController.removeAttribute(id.toString(),
authorElement);
} else {
AttrValue oldAttrValue = authorElement.getAttribute(id
.toString());
// check if the change is really new
if (!attrValue.equals(oldAttrValue)) {
documentController.setAttribute(id.toString(),
attrValue, authorElement);
}
}
}
}
}
Simon
Simon Scholz
vogella GmbH
http://www.vogella.com
vogella GmbH
http://www.vogella.com
-
- Posts: 9445
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Editor gains focus, while conref is edited
Hi Simon,
Sorry, but I still cannot reproduce the problem on my side.
Here's what I did:
In our Elements view I added an extra text field which on every modification sets the @conref attribute on a certain element:
I placed the caret in the Author mode on an element with an existing @conref and then I started typing in that text field. The focus remained in the text field as the content in the Author mode changed to show either the conref target or an error when the typed value was invalid. The focus never moved in the Author mode.
Could you also try to do a similar experiment on your side?
You could try to have a clean Eclipse workspace with an installed Oxygen plugin and have a custom plugin with a simple custom view which has a text field in which when typing the value gets sent to the controller.
If the focus does not move in the Author mode in such a simple example but it does in a more complex customization then something in your customization (maybe the styles filter or maybe some other listener) somehow triggers this focus to be lost.
Regards,
Radu
Sorry, but I still cannot reproduce the problem on my side.
Here's what I did:
In our Elements view I added an extra text field which on every modification sets the @conref attribute on a certain element:
Code: Select all
final Text tf = SWTUtils.createGridTextField(parent);
tf.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
String value = tf.getText();
AuthorElement authorElement = currentElement;
String attrName = "conref";
if (authorElement != null) {
AuthorDocumentController documentController = viewport.getController();
if (documentController != null) {
AttrValue attrValue = new AttrValue(value.toString());
AttrValue oldAttrValue = authorElement.getAttribute(attrName);
// check if the change is really new
if (!attrValue.equals(oldAttrValue)) {
documentController.setAttribute(attrName, attrValue, authorElement);
}
}
}
}
});
Could you also try to do a similar experiment on your side?
You could try to have a clean Eclipse workspace with an installed Oxygen plugin and have a custom plugin with a simple custom view which has a text field in which when typing the value gets sent to the controller.
If the focus does not move in the Author mode in such a simple example but it does in a more complex customization then something in your customization (maybe the styles filter or maybe some other listener) somehow triggers this focus to be lost.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service