custom submenu too long

Having trouble installing <oXygen/>? Got a bug to report? Post it all here.
bwbohl
Posts: 17

custom submenu too long

Tue Nov 21, 2017 1:02 pm

I'm currently developing a custom framework for oXygen XML Editor. In Author mode I implemented a submenu in the context-menu that offers framework specific actions. There are about 80 actions (might even get more), each inserting the same XML chunk with different attributes.

Now the problem is, that the list is too long to fit on my (and other) screen(s) and the submenu does not scroll if I reach the top or lower end. Is there a way to enable this?

I'm using oXygen XML Editor v18.1
=====
oXygen XML Editor v18.1
macOS Sierra 10.12.6
Radu
Posts: 5129

Re: custom submenu too long

Tue Nov 21, 2017 1:10 pm

Hi,

We do not have the possibility for scrollable submenus. Also from a user-experience point of view, having that many actions thrown on the same level in a menu is scary.
So you could either create your own categories (extra submenus) and divide the actions by category so that you do not have that many actions in one category or you could create only one custom Java-based action which when pressed could present the end user with a Swing-based dialog containing list of all the possible actions that they can invoke.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
bwbohl
Posts: 17

Re: custom submenu too long

Tue Nov 21, 2017 1:38 pm

I agree that such a long list is scary ;-)
But they all operate on the same level… An alphabetical sub-organisation of the list might be a way to go, though.

To illustrate the base a bit more:
every action inserts

Code: Select all

<part key="" count="" pname=""/>


With an individual value in @key, while the other attributes have to be filled by the user. The schema validates @key against a closed list. The schema does with the framework.
At the moment I generate an action for each allowed value of @key. Alternatively I could implement one action offering all the @key values in a dropdown via ${ask('message', combobox,('key':'value';'key2':'value2'). IS that what you mean?
Could I add other form fields to that dialog for the other attributes?

Is there a way to read those values ad-hoc form the supplied RNG schema? Or would that not be wise?

many thanks!
=====
oXygen XML Editor v18.1
macOS Sierra 10.12.6
Radu
Posts: 5129

Re: custom submenu too long

Tue Nov 21, 2017 3:07 pm

Hi,

So:

With an individual value in @key, while the other attributes have to be filled by the user. The schema validates @key against a closed list. The schema does with the framework.


When you customize a framework configuration, after you create an Author action instead of adding it to the contextual menu, in the Author tab there is a "Content completion" tab which allows you to add the action in the content completion window (the one which appears when you press ENTER in the Author visual editing mode and which has key search). So this might be another possibility.

At the moment I generate an action for each allowed value of @key. Alternatively I could implement one action offering all the @key values in a dropdown via ${ask('message', combobox,('key':'value';'key2':'value2'). IS that what you mean?
Could I add other form fields to that dialog for the other attributes?


The "ask" editor variable is quite limited in functionality.
When you create a new Author action in your custom framework, the action can have various activation modes (usually it has only one) and each activation mode can invoke an operation. Oxygen has lots of predefined available operations, among which the operation which inserts an XML fragment at the caret position:

https://www.oxygenxml.com/doc/versions/19.1/ug-editor/topics/dg-default-author-operations.html#dg-default-author-operations

but using our Maven-based Author SDK you can also provide your custom Author operation implementations:

https://www.oxygenxml.com/doc/versions/19.1/ug-editor/topics/dg-java-api.html

This would mean that when the action is pressed, Oxygen would invoke your custom Java code which could for example create a dialog using the Swing libraries showing a list of choices to the end user. Then using the Oxygen SDK API you could insert XML content at the caret position.
But you would need fair knowledge of Java to do that.

There is also a predefined operation called "JSOperation" which allows you to call the Oxygen API directly from some custom Javascript code, you can look as an example for "JSOperation" here:

https://www.oxygenxml.com/doc/versions/18/ug-editor/topics/dg-default-author-operations.html

As an example I created a Javascript-based operation implementation which asks the end user to pick a key value and then inserts an XML fragment containing it:

https://github.com/oxygenxml/javascript-sample-operations/blob/master/ask-for-attribute-value/askAttrValueForInsertedXMLFrag.js

Is there a way to read those values ad-hoc form the supplied RNG schema? Or would that not be wise?


What do you mean by "values"? Do you mean the possible values for the @key attribute?

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
bwbohl
Posts: 17

Re: custom submenu too long

Tue Nov 21, 2017 3:51 pm

Concerning your question: Yes I mean allowed values for @key, sorry for the imprecision.

I'll hook up when I've dug into the rich information you provided me with and see where I can get, potentially also the Java ;-)

Many thanks Radu, this is really great!!
=====
oXygen XML Editor v18.1
macOS Sierra 10.12.6

Return to “Common Problems”

Who is online

Users browsing this forum: No registered users and 0 guests