Hello Forum,
My Environment: SmartGWT 4.0 LGPL | GWT 2.51 | Chrome version 40.0.2214.115 m
The cowboys whose code I'm debugging — and whom I swear I'm going to kill if I ever get the chance — have a ListGridField defined like so...
The cowboy coder's umpteenth bug I'm currently debugging is...
I put a breakpoint at line 6. Plus, I have added the SC.logDebug() call at line 5.
You can safely assume that my IDE's debugger is working perfectly. And you would also be correct to assume that my logging is correctly configured at the right log level.
Here are some of my own assumptions...
Debugging in Development Mode in my IDE, this is what I do...
This is what I expect...
However, this is what actually happens...
Finally, here are my questions...
Thank you in advance for sharing your SmartGWT expertise with the community.
Yahoo-Yippie-I-Aye! ;)
Peace.
My Environment: SmartGWT 4.0 LGPL | GWT 2.51 | Chrome version 40.0.2214.115 m
The cowboys whose code I'm debugging — and whom I swear I'm going to kill if I ever get the chance — have a ListGridField defined like so...
Code:
... 1) cowboyCoded = new ListGridField("cowboyCoded"); 2) cowboyCoded.setSortNormalizer(new SortNormalizer() { 3) @Override 4) public Object normalize(ListGridRecord record, String [b][i][u]fieldName[/u][/i][/b]) { 5) SC.logDebug("I HATE FRICK'N COWBOY CODERS!") // I added this... 6) return cowboyCodedValueMap.get(record.getAttributeAsString("cowboyCoded")); } }); ...
- ...the 'cowboyCoded' column does NOT sort when its column header is clicked on.
I put a breakpoint at line 6. Plus, I have added the SC.logDebug() call at line 5.
You can safely assume that my IDE's debugger is working perfectly. And you would also be correct to assume that my logging is correctly configured at the right log level.
Here are some of my own assumptions...
- ...that the DataBoundComponent in question is doing client-side sorting (I'm 99% certain of this based on what I DO see in the SmartGWT Dev Console logs plus what I DON'T see in my server logs)
- ...that the ListGrid|ResultSet|DataSource is NOT in 'Paged Mode' — which I will eventually confirm is or isn't (with your help, hopefully, because I unashamedly confess: At this very moment that I'm writing this, I don't know yet how to determine that).
- ...that the meaning of 'normalize' in the context of RecordList.SortNormalizer.normalize() is the same meaning as 'normalize' in this context and not in this context.
- ...that my questions (below) are general enough that they could be answered without me having to provide a stand-alone test case to reproduce the cowboy behavior I'm observing. In other words, I assume that the only thing needed to answer my questions (below) is deep, expert knowledge of SmartGWT (which I unashamedly admit, I lack — at this point).
Debugging in Development Mode in my IDE, this is what I do...
- ...I launch in my browser, the View (a ListGrid) that contains the ListGridField defined in the above source code snippet...
- ...when the ListGrid View successfully loads, I sort the "cowboyCoded" column of the ListGrid by clicking on its column header
This is what I expect...
- ...to see "I HATE FRICK'N COWBOY CODERS!" in my console/logs...
- ...my IDE's debugger to fire up and pause at the breakpoint at line 6 in the source code snippet above...
- ...the 'cowboyCoded' column to be sorted when its column header is clicked on.
However, this is what actually happens...
- ...the string "I HATE FRICK'N COWBOY CODERS!" is nowhere to be found in my console/logs...
- ...my IDE's debugger does indeed fire up and the debugger does indeed pause at other breakpoints I have set at other points in the source code (not shown above). But it NEVER EVER pauses at the breakpoint at line 6 in the source code snippet above...
- ...the 'cowboyCoded' column does NOT get sorted when its column header is clicked on.
Finally, here are my questions...
- ...what flag(s) should the cowboy's have set in order for their module I'm now debugging to produce the expected behavior? On what class is that flag?
- ...should I expect the SortNormalizer.normalize() to be called when I click on the column header to trigger a sort?
- ...if 'No' to the preceding question, how then, can I trigger — from the View — SortNormalizer.normalize() to be called?
- ...assuming I can somehow manage to get SortNormalizer.normalize() to be called (by maybe switching on the right flag) then in that case, would refactoring the above snippet to the following, have any bearing whatsoever on anything?
Code:
... [b][i]import java.text.Normalizer;[/i][/b] ... 1) cowboyCoded = new ListGridField("cowboyCoded"); 2) cowboyCoded.setSortNormalizer(new SortNormalizer() { 3) @Override 4) public Object normalize(ListGridRecord record, String [b][i][u]fieldName[/u][/i][/b]) { 5) SC.logDebug("I HATE FRICK'N COWBOY CODERS!") // I added this... 6) String cowboyNormalized = cowboyCodedValueMap.get(record.getAttributeAsString([b][i][u]fieldName[/u][/i][/b])); 7) return [i][b]Normalizer.normalize( cowboyNormalized, Normalizer.Form.NFC ) ); // I MIGHT add this...[/b][/i] } }); ...
Yahoo-Yippie-I-Aye! ;)
Peace.
Comment