setEditable odd behavior
Post here questions and problems related to oXygen frameworks/document types.
setEditable odd behavior
I set some documents as not editable.
When in Author mode if I try to edit the document a small popup displays saying
When in text mode, our main editing mode, it does prevent editing but no popup? Can I enable that popup in text mode?
When in Author mode if I try to edit the document a small popup displays saying
, niceCannot insert text in read only Context
When in text mode, our main editing mode, it does prevent editing but no popup? Can I enable that popup in text mode?
-
- Posts: 1009
- Joined: Wed Nov 16, 2005 11:11 am
Re: setEditable odd behavior
Post by alex_jitianu »
Hello,
Unfortunately that message doesn't come from a common place. It is specific to the Author mode. You could use the API to present a similar message when the user edits in the text mode:
Best regards,
Alex
Unfortunately that message doesn't come from a common place. It is specific to the Author mode. You could use the API to present a similar message when the user edits in the text mode:
Code: Select all
// Create the AuthorComponent
editorComponent = factory.createEditorComponentProvider(
new String[] {EditorPageConstants.PAGE_TEXT},
// The initial page
EditorPageConstants.PAGE_TEXT);
if (EditorPageConstants.PAGE_TEXT.equals(editorComponent.getWSEditorAccess().getCurrentPageID())) {
final WSXMLTextEditorPage page = (WSXMLTextEditorPage) editorComponent.getWSEditorAccess().getCurrentPage();
JTextComponent comp = (JTextComponent) page.getTextComponent();
comp.getDocument().addDocumentListener(new DocumentListener() {
@Override
public void removeUpdate(DocumentEvent e) {
insertUpdate(e);
}
@Override
public void insertUpdate(DocumentEvent e) {
if (!page.isEditable()) {
// TODO Present a pop-up.
}
}
@Override
public void changedUpdate(DocumentEvent e) {
insertUpdate(e);
}
});
}
Alex
Re: setEditable odd behavior
I added the document listener.
Unfortunately it is only called if the document is editable. Any document that has this function called
where editableFlag == false
the listener is not called and no popup to let the user know they are trying to edit a read only document?
Code: Select all
docListener = new DocumentListener() {
@Override
public void removeUpdate(DocumentEvent e) {
System.out.println("removeUpdate");
insertUpdate(e);
}
@Override
public void insertUpdate(DocumentEvent e) {
System.out.println("insertUpdate");
if (!editable && EditorPageConstants.PAGE_TEXT.equals(editorComponent.getWSEditorAccess().getCurrentPageID())) {
JOptionPane.showMessageDialog(null, "Cannot insert text in read only Context!", "InfoBox: Text Insert", JOptionPane.INFORMATION_MESSAGE);
}
}
@Override
public void changedUpdate(DocumentEvent e) {
System.out.println("changedUpdate");
insertUpdate(e);
}
};
final WSTextEditorPage page = (WSTextEditorPage) editorComponent.getWSEditorAccess().getCurrentPage();
JTextComponent comp = (JTextComponent) page.getTextComponent();
comp.getDocument().addDocumentListener(docListener);
Code: Select all
((WSTextBasedEditorPage) page).setEditable(editableFlag);
the listener is not called and no popup to let the user know they are trying to edit a read only document?
-
- Posts: 1009
- Joined: Wed Nov 16, 2005 11:11 am
Re: setEditable odd behavior
Post by alex_jitianu »
Hello,
Ups! I'm sorry for sending you on a wild goose chase... You can try a KeyListener instead. I've tested such a listener and it receives events:
Best regards,
Alex
Ups! I'm sorry for sending you on a wild goose chase... You can try a KeyListener instead. I've tested such a listener and it receives events:
Code: Select all
JTextComponent comp = (JTextComponent) page.getTextComponent();
comp.addKeyListener(new KeyListener() {
public void keyTyped(KeyEvent e) {
System.out.println("Key typed");
}
public void keyReleased(KeyEvent e) {}
public void keyPressed(KeyEvent e) {}
});
Alex
Re: setEditable odd behavior
Alex,
Excellent! I'll give it a go. No problem chasing gooses. I think sometimes I'm in the Goose manufacturing business!
Thanks for all the great help. Your tech support is unsurpassed.
Scott
Excellent! I'll give it a go. No problem chasing gooses. I think sometimes I'm in the Goose manufacturing business!
Thanks for all the great help. Your tech support is unsurpassed.
Scott
Re: setEditable odd behavior
Hi,
Just to update this thread, in Oxygen 17.1 trying to edit in the Text editing mode with a read-only document should result in an error tooltip shown to the user.
Regards,
Radu
Just to update this thread, in Oxygen 17.1 trying to edit in the Text editing mode with a read-only document should result in an error tooltip shown to the user.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
Return to “SDK-API, Frameworks - Document Types”
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