-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Show JTree children in correct order #20
base: master
Are you sure you want to change the base?
Conversation
The class.getDeclaredMethods() method returns methods in an arbitrary order. Use the generated _seqFields field instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm afraid that it's not possible to rely on SEQ_FIELDS
alone, because the instances
won't be found this way. The existing implementation iterated over methods, where instances
were available, so showing only seq
fields now would be an ugly regression.
Or am I missing something?
You are not missing something, it doesn't work with instances!!! KSY file to test it:
In the compiled Java code, the public static String[] _seqFields = new String[] { "mySequentialItem" }; But the methods let us access the sequential item and the instance: public long mySequentialItem() { ... }
public Long myInstance() { ... } What do you think about this:
|
Yes, seems reasonable to me. Order of |
The GUI uses the
getDeclaredMethods()
method to populate JTree children. But the Javadoc says:So the order of nodes in the JTree sometimes does not match the order in the KSY file.
Here's an example using png.ksy (from ide.kaitai.io). The order in the KSY file:
Example of the GUI showing the wrong order:
This pull request gets the correct order from the
_seqFields
field, which is generated from the KSY file.The
_seqFields
field in the compiled png.java file:Now the JTree nodes are in the correct order: