Skip to content

Basic uitable support #4

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

Merged
merged 17 commits into from
Nov 27, 2017
Merged

Basic uitable support #4

merged 17 commits into from
Nov 27, 2017

Conversation

Dev-iL
Copy link
Member

@Dev-iL Dev-iL commented Nov 24, 2017

Added some methods for manipulating uitables, and an accompanying demo app. Also included some minor refactoring of method names to follow Java conventions (internal functions, so no change to API).

NOTE: As of the creation of the PR, the markdown documentation wasn’t updated, so please see \Demo\TableDemo.m for a demonstration of the new functionality.

Dev-iL added 6 commits October 4, 2017 16:38
- Improved in-code documentation for some methods.
- See `getWidgetInfo`.
- Added a utility function for preallocating a `struct` based on a JSON object.
- Added a utility function for unifying structs with different fieldnames.
@Dev-iL Dev-iL requested a review from sco1 November 24, 2017 10:18
@Dev-iL
Copy link
Member Author

Dev-iL commented Nov 24, 2017

Things to do before the PR is merged (comments by @altmany):

  1. README - fix the list of methods at the top (aboutDojo is listed at the end os setStyle, not in a separate line)
  2. README - add explanation and usage example for aboutDojo()
  3. README - add explanation and usage example for getWidgetInfo() and also list it at the top (list of public methods)
  4. README - fontWeight() - clarify that 'lighter' is also accepted, and that the actual visible effect depends on the availability in the font-face that is used
  5. mlapptools - make getWidgetInfo() accept a specific control handle (not just a uifigure handle) and return only the information relevant for this specific control
  6. mlapptools - make getWebWindow() and getWebElements() public
  7. mlapptools - fontweight() has a bug: needs to call mlapptools.validateFontWeight(), not .validatefontweight()
  8. mlapptools - make QUERY_TIMEOUT public (or at least have a public setter method)
  9. TableDemo - in ButtonPushed(), don't loop over ...:44 but rather over ...:size(w,1) - it is indeed 22 for R2017x, but may well change in R2018x, so better keep it generic...

Copy link
Member

@sco1 sco1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

@sco1
Copy link
Member

sco1 commented Nov 24, 2017

RE: 8 on your list, since we're using this as an Abstract class I'm not sure we'll be able to do this. I'd prefer not having to instantiate the class just to have a settable timeiout, so it may have to be done using a global or an external settings file that can be parsed.

@altmany
Copy link

altmany commented Nov 24, 2017

re 8, you could have a setTimeout(hFig,value) function that would setappdata(hFig,'QUERY_TIMEOUT',value) and then whenever you want to check for the timeout you could do something like:

timeout = getappdata(hFig,'QUERY_TIMEOUT');
if isempty(timeout), timeout = mlapptools.QUERY_TIMEOUT; end
while true && (toc < timeout)
   ...

Iterations now use the output of `size` instead of a hard-coded value.
- Added a "shield" indicating the required MATLAB versions.
- Reordered methods lexicographically.
- Added link for `aboutDojo`.
- Added explanation and usage example for `getHTML` and `getWidgetInfo`.
- `fontWeight`- Clarified when this method has an effect; mentioned that `'lighter'` is also accepted.
- Removed some of the internal documentation in `mlapptools.m`.
(`TMP_somename.m` is the convention used for temporary testing files)
+ Minor (internal) documentation changes.
+ Added relevant documentation.
+ Fixed bug related to a capitalization issue in `fontWeight`.
+ Renamed "uielement" to "uiElement" to better fit conventions.

TODO: add unit tests.
@Dev-iL
Copy link
Member Author

Dev-iL commented Nov 26, 2017

@sco1 @altmany I have added some more commits that address most of the suggestions above.

  • Regarding 5. - It was not clear to me how to achieve it, so I left it unimplemented for now. It seems to me that having both functionalities in the same method (both accepting a uifigure and a "uielement") is confusing. Instead, we can rename the current method to getWidgetListing and implement Yair's suggestion under the current name (getWidgetInfo).
  • Regarding 8. - I did as Yair suggested, although I had to include somewhat of a hack to make it work in all cases as expected.

Thoughts / comments?

- `getWidgetInfo` now operates on a single widget, whereas `getWidgetList` has the old functionality of `getWidgetInfo` (i.e. it accepts a `uifigure` and returns a list of widgets). The heavy lifting is done by the new `private` `decodeDijitRegistryResult` method.
- README updated.
- Fixed an off-by-1 bug in the widget decoding logic.
@Dev-iL
Copy link
Member Author

Dev-iL commented Nov 27, 2017

Implemented 5 as explained in my previous comment. Tested all code examples manually. I think it's ready to merge now. Will wait for comments until the end of the day before merging.

@sco1
Copy link
Member

sco1 commented Nov 27, 2017

Haven't had a chance to play with the newest functionality but it still looks OK to me. I'm assuming you guys have looked at it pretty thoroughly so I'm confident that it works as desired.

Until MATLAB renders external README documents I'd prefer to keep at least a framework of the inline documentation in place so folks have at least something useful show up with doc/help. I'd still defer to the README for more in-depth information.

@sco1
Copy link
Member

sco1 commented Nov 27, 2017

Also, once this PR is merged I'll go back through and tag releases as requested...wherever it was requested.

Text is a copy of the methods summary from README.md.
@altmany
Copy link

altmany commented Nov 27, 2017

Waiting for your merge to post the followup article on UndocumentedMatlab.com

@Dev-iL Dev-iL merged commit f86cace into StackOverflowMATLABchat:develop Nov 27, 2017
@altmany
Copy link

altmany commented Nov 27, 2017

https://undocumentedmatlab.com/blog/customizing-uifigures-part-3

@altmany
Copy link

altmany commented Nov 27, 2017

Thanks for the great work @sco1 & @Dev-iL - very high-quality code, and nifty research indeed into the Dojo underworld :-)

I'm 100% certain that this will get MathWorks' attention, and for a very good reason - they should have included this functionality in their code ages ago.

@sco1
Copy link
Member

sco1 commented Nov 27, 2017

@altmany Fingers crossed! More than a few head scratchers with the new UI engine, as much as I love it.

I dream of a day when we can get documented methods for things like centering text without having to muck through the underlying graphics engine. Though there will always be a soft spot in my heart for the many hours spent with findjobj ☺️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants