|
GrandMasterBirt
|
 |
« on: May 21, 2008, 12:43:47 AM » |
|
I notice you are using the idea of Flex regarding data grids: Just bind data to it and let the grid make all the necessary rows.
However I am a bit stumped as to how I am supposed to create the data. Maybe its because its 1am and I am not up for going though the source code. Do you have any documentation (even design docs) as to how to use the DataGrid?
Also: When a datagrid is created it looks for resource/....png for pagination. Obviously I don't have these, but is there going to be a way to not need to provide these PNGs? (there should probably be some defaults for those who are just diving in). In my case there is no pagination needed.
|
|
|
|
|
Logged
|
|
|
|
|
darkfrog
|
 |
« Reply #1 on: May 21, 2008, 08:06:59 AM » |
|
Sorry for not having better documentation for the new features in Data-Binding. I don't suppose you'd be willing to create a simple tutorial as you're learning how to use DataGrid? I've added some additional JavaDocs to DataGrid, so hopefully that will help explain a little better. Also, I wrote a little test application for the new features that will hopefully explain it much better: http://svn.jseamless.org/examples/tests/trunk/src/org/jseamless/test/DataGridTest.javaThe DataTree is still a lot slower than I'd like, but DataGrid is extremely fast. Unfortunately, right now DataGrid does not support scrolling contents, so the only way you can display more content than is visible in the grid at any given time is through pagination. However, if you are only displaying a single page you can disable pagination by calling setPagination(null). Sorry about the resources not being available. They are checked into the project, but I realize I forgot to modify the build.xml file to jar them up into releases. If you update the jar file now they should be in there correctly. I would highly recommend switching to using SVN though as the jars are not as frequently updated as the repository is. After 1.0 is finalized you may want to switch to jars again, but for now SVN is generally your best bet for the most stable code. Let me know if you have any problems and if you do decide to create a DataGrid tutorial I went ahead and started a page for it that you can simply edit on the wiki: http://trac.jseamless.org/wiki/DataGridTutorial
|
|
|
|
|
Logged
|
|
|
|
|
GrandMasterBirt
|
 |
« Reply #2 on: May 21, 2008, 09:01:57 AM » |
|
I was actually going to offer to write some tutorials as I am getting familiar with it. The only down side is that I am a terrible writer so someone is going to have to just read what I made for English errors  . I understand the pagination issue, BUT the exception is thrown at <init> which I have no control over. In <init> you set the pagination and the error is thrown when the .png files cannot be located. I have been using beta 7 JARs but since we are in Beta mode and everything is unstable I can just use the SVN. Just note you might want to change it to "Alpha" to be more concise as to what the stability is. Beta usually a code-freeze for bug testing before release (from my experience). While alpha is an experiment in features and stability (though not many people would want to use an Alpha...). Should I open a ticket regarding the .png issue? Do you have a doc on how to build, what the required tools are? If not I can just scrape the build files, and write a doc 
|
|
|
|
« Last Edit: May 21, 2008, 09:10:58 AM by GrandMasterBirt »
|
Logged
|
|
|
|
|
darkfrog
|
 |
« Reply #3 on: May 21, 2008, 10:23:50 AM » |
|
The PNG issue is resolved in the trunk and the latest jar. Doc on how to build? Not sure what you mean? You mean building from the source? If you're using Eclipse or another IDE you should just be able to import the code and reference the projects as dependencies without building jars at all. However, the build.xml files can be executed with the "jar" target and it will do the complete build for you. As far as beta versus alpha there are some political reasons why it is called beta rather than alpha. Early betas were technically alpha builds, but because of corporate policies about using alpha releases where I work there was the need to side-step that issue.  From beta 6 forward they are true betas. Some new features are still being adding, but the core functionality is relatively solid. At RC 1 (the next release scheduled) there will be a feature freeze and only bug-fixes will occur. Don't worry about creating a ticket for the PNG issue as it was build file specific.
|
|
|
|
|
Logged
|
|
|
|
|
GrandMasterBirt
|
 |
« Reply #4 on: May 21, 2008, 03:13:30 PM » |
|
I hate corporate politics a company I worked for never released a .0 version caz .0 was "unstable". And it fooled no one, xept maybe a non-tech-savvy CEO.
|
|
|
|
|
Logged
|
|
|
|
|
darkfrog
|
 |
« Reply #5 on: May 21, 2008, 04:45:14 PM » |
|
Yes, but corporations pay the bills, so what's a coder to do? 
|
|
|
|
|
Logged
|
|
|
|
|
GrandMasterBirt
|
 |
« Reply #6 on: May 21, 2008, 07:14:56 PM » |
|
PNG issue fixed in latest SVN. (verified) 
|
|
|
|
|
Logged
|
|
|
|
|
GrandMasterBirt
|
 |
« Reply #7 on: May 21, 2008, 07:18:05 PM » |
|
Error: Caused by: java.lang.ArithmeticException: / by zero at org.jseamless.databinding.grid.DataGrid.getPageCount(DataGrid.java:127) at org.jseamless.databinding.structure.basic.BasicPagination.getPageCount(BasicPagination.java:206) at org.jseamless.databinding.structure.basic.BasicPagination.update(BasicPagination.java:226) at org.jseamless.databinding.grid.DataGrid.update(DataGrid.java:292) at org.jseamless.container.Application.update(Application.java:893) ... 6 more This happens when the data grid is initialized to have 0 rows. An error should be thrown at that time and the grid should not fail to update. DataGrid line 82: if(rows <= 0){ throw new RuntimeException("There must be at least 1 row in the DataGrid."); }
|
|
|
|
« Last Edit: May 21, 2008, 08:10:59 PM by GrandMasterBirt »
|
Logged
|
|
|
|
|
GrandMasterBirt
|
 |
« Reply #8 on: May 21, 2008, 08:07:18 PM » |
|
I made a small DataGridTutorial page. Its not much, but its a start. http://trac.jseamless.org/wiki/DataGridTutorialAlso I am going to request a feature: ListDataContainer needs a Vararg constructor -- You should be able to provide it with a vararg list of Objects which will be used as data for the list. Whether or not this would make the list immutable or not makes no difference to me. It seems like a perfectly normal way of using it when you have a fixed set of data and you just want to add a row. Also this is the perfect object to make generic. The generic should be what type is stored in the List. As for the way you deal with headers and row data, that will be for another time...
|
|
|
|
« Last Edit: May 22, 2008, 07:05:23 AM by GrandMasterBirt »
|
Logged
|
|
|
|
|
darkfrog
|
 |
« Reply #9 on: May 22, 2008, 08:27:11 AM » |
|
This aspect is still a work in progress, so I'm definitely open to suggestions to make it better.
I have created an ArrayDataContainer that replicates the functionality you specified rather than adding the functionality to ListDataContainer since the latter is primarily designed to take an already existing list.
As for generics I've thought about this, but the multi-depth hierarchical structure makes it mostly just frustrating to utilize generics in it. There are some other gotcha's that led to decide against generics on this. I may re-think this later if given good cause to do so though.
|
|
|
|
|
Logged
|
|
|
|
|
darkfrog
|
 |
« Reply #10 on: May 22, 2008, 08:36:22 AM » |
|
Oh, I forgot to mention, I also added your suggestion of throwing a RuntimeException if the rows passed in is less than 1.
The tutorial looks great by the way. Feel free to add and/or create pages as you're learning more about jSeamless. I've been so busy adding functionality to jSeamless I haven't had much time to write user documentation (although I try to do a pretty good job of JavaDoc'ing these days) and it would be a great burden lifted to have assistance getting this done. It is particularly useful for someone other than the creator to write this information as their learning because what seems intuitive to me may not be for others.
|
|
|
|
|
Logged
|
|
|
|
|
GrandMasterBirt
|
 |
« Reply #11 on: May 22, 2008, 09:33:22 AM » |
|
Perfectly understandable...
How I see generics happening in jSeamless to make it useful:
The getObject should return the generic type. It seems that object is REALLY the place where generics shine. This is because the DataGrid's object is really a DataContainer -- So data grid extends Container<DataContainer> but DataGrid itself has no generics.
Also I notice you made some bad conversions when it came to the object property. In the ComboBox the Object represents the currently selected item, that is very misleading and hard to figure out. The combo box should have a property "getSelectedItem". Also ComboBox should be generic in that it represents the Object being held in the List of Objects that it has so getSelectedItem returns the appropriate type.
Back To DataGrid: Why did you decide to not use the DataGrid object of Flex to render the DataGrid? Are columns re-sizable? Are columns re-arrangeable? Can you sort each column by clicking on the header? Is there a form of data grid that can have non-strings rendered in each cell?
As a side note: At work we have done some really cool stuff with the DataGrid, its an amazingly flexible component in flex (though it has quirks).
|
|
|
|
|
Logged
|
|
|
|
|
GrandMasterBirt
|
 |
« Reply #12 on: May 22, 2008, 09:38:30 AM » |
|
I've been so busy adding functionality to jSeamless I haven't had much time to write user documentation (although I try to do a pretty good job of JavaDoc'ing these days) and it would be a great burden lifted to have assistance getting this done. It is particularly useful for someone other than the creator to write this information as their learning because what seems intuitive to me may not be for others.
Just write some nifty javadocs and any half-assed documentation that you can give and I can try to transform it into something usable by a developer.
|
|
|
|
|
Logged
|
|
|
|
|
darkfrog
|
 |
« Reply #13 on: May 22, 2008, 11:54:30 AM » |
|
The getObject should return the generic type. It seems that object is REALLY the place where generics shine. This is because the DataGrid's object is really a DataContainer -- So data grid extends Container<DataContainer> but DataGrid itself has no generics.
Not really sure I follow what you're saying here. Can you post some sample code? Also, you have to realize that multi-level hierarchical structures will be common for DataTree, which also leverages DataContainers so depending on the depth different types of objects will likely be used and thus only causing pain for people that have to try to generify it. Also, consider ObjectGrid. It allows you to just set a bean to it and it pulls it apart setting the fields of the bean (potentially many different types). I would think the majority of scenarios generics would cause trouble and the gains from using generics seem to be minimal in few cases. Also I notice you made some bad conversions when it came to the object property. In the ComboBox the Object represents the currently selected item, that is very misleading and hard to figure out. The combo box should have a property "getSelectedItem". Also ComboBox should be generic in that it represents the Object being held in the List of Objects that it has so getSelectedItem returns the appropriate type.
I can add a convenience method to ComboBox to getSelectedObject() and return the generic type, but it would simply be a wrapper around getObject() that does a conversion. Why did you decide to not use the DataGrid object of Flex to render the DataGrid?
You can use the DataGrid of Flex, but it's just named differently (org.jseamless.table.DataTable). Eventually I hope to phase it out when all the functionality is available in the custom DataGrid component. There were lots of things I wasn't happy about in the Flex DataGrid. I originally started out just using theirs and ended up deciding to create my own custom implementation on the jSeamless side so other implementations can get the benefit of any and all functionality added. Are columns re-sizable?
They are programmatically, but not yet via user interaction. Are columns re-arrangeable?
Not yet, but that is on my agenda. Can you sort each column by clicking on the header?
Also, not yet, but there's actually some code in place to leverage that, but it hasn't been completed yet. Is there a form of data grid that can have non-strings rendered in each cell?
What do you mean? If you set an ObjectConverter to the DataGrid it will allow you to dynamically convert the objects to a String representation for view in the cell. If you mean changing the component displayed, then you can do that by creating your own DataHeaders and DataCells. As a side note: At work we have done some really cool stuff with the DataGrid, its an amazingly flexible component in flex (though it has quirks).
In many ways it's powerful, but there were some severe limitations and bugs that it was just easier to write my own implementation rather than trying to make theirs fit.
|
|
|
|
|
Logged
|
|
|
|
|
GrandMasterBirt
|
 |
« Reply #14 on: May 22, 2008, 01:38:58 PM » |
|
Regarding getObject -- getObject should not be exposed to the outside, or should be under very careful considerations. ComboBox should definately have getSelectedObject(), its not a convenience method, its a method that lets you understand what is what. Or at the VERY least a javadoc is needed to indicate that getObject returns the selected object for ComboBox. Regarding rendering custom components in the DataGrid cells, I can check it out, you you can add an example to the wiki  For now DataGrid has a really kick-*** pagination bar, but actually looks pretty hokey. Try rendering it with 10 rows, then select each row one at a time by clicking, notice at selecting last row the graphics would cause the sizes of the cells to shift a few pixels up. Also when no pagination is needed, there is a 1 sticking out on the bottom of the data grid, it makes it very... confusing when you first look at it, what does that 1 apply to. No arrows are displayed.
|
|
|
|
|
Logged
|
|
|
|
|
darkfrog
|
 |
« Reply #15 on: May 22, 2008, 02:06:12 PM » |
|
Regarding getObject -- getObject should not be exposed to the outside, or should be under very careful considerations.
Why? ComboBox should definately have getSelectedObject(), its not a convenience method, its a method that lets you understand what is what. Or at the VERY least a javadoc is needed to indicate that getObject returns the selected object for ComboBox.
This is done and committed. If you update there will be a getSelectedObject that auto-casts to O. I didn't include a reference to getObject() returning the selection item since I've been trying to push jSeamless as a whole to utilize getObject() as the standard mechanism for maintaining the underlying Object representation of the Component. Regarding rendering custom components in the DataGrid cells, I can check it out, you you can add an example to the wiki  For now DataGrid has a really kick-*** pagination bar, but actually looks pretty hokey. Try rendering it with 10 rows, then select each row one at a time by clicking, notice at selecting last row the graphics would cause the sizes of the cells to shift a few pixels up. Also when no pagination is needed, there is a 1 sticking out on the bottom of the data grid, it makes it very... confusing when you first look at it, what does that 1 apply to. No arrows are displayed. Can you post a little code snippet? The 1 applies to the current page...I understand that it can be confusing...perhaps it should auto-hide the pagination support if there aren't more rows than can be displayed...I could even have it animate a resize so if content adds it will re-display the pagination support by expanding dynamically.
|
|
|
|
|
Logged
|
|
|
|
|
GrandMasterBirt
|
 |
« Reply #16 on: May 22, 2008, 02:45:53 PM » |
|
Why?
I guess it goes with the fact that you use it as internal storage, but its not always clear for what. I thought this was a great flex convention, very intuitive: Containers which render lists of anything have a "DataProvider" property which is the list. Components which render single objects have a "Data" property which is the data to be rendered. This is done and committed. If you update there will be a getSelectedObject that auto-casts to O. I didn't include a reference to getObject() returning the selection item since I've been trying to push jSeamless as a whole to utilize getObject() as the standard mechanism for maintaining the underlying Object representation of the Component.
getObject standard is just plain ol' confusing. What does the Object apply to? Going form Flex to jSeamless I assumed Object contained the List of values not the selected value until the code showed me otherwise. Then again it could be just me. See what others think, but in the end you should always document what it does, don't assume everyone knows your conversions... Though at my job our standard is: If documentation is long, then its not intuitive and thus wrong as an interface (which is almost always true). Can you post a little code snippet? The 1 applies to the current page...I understand that it can be confusing...perhaps it should auto-hide the pagination support if there aren't more rows than can be displayed...I could even have it animate a resize so if content adds it will re-display the pagination support by expanding dynamically.
The 1 should be hidden if no pagination is needed (like the arrows). Probably its best to hide the entire pagination component if its not necessary. I like the idea of the animated appear/disappear of the pagination component, but that is non-critical. I still have yet to discover how animations work in jSeamless  Maybe I can do the animation part for you 
|
|
|
|
|
Logged
|
|
|
|
|
darkfrog
|
 |
« Reply #17 on: May 22, 2008, 04:10:12 PM » |
|
Let me think a little more on this and I'll post more later.
|
|
|
|
|
Logged
|
|
|
|
|
GrandMasterBirt
|
 |
« Reply #18 on: May 22, 2008, 11:32:59 PM » |
|
BTW: Please add the convenience method to ComboBox: public O getSelectedObject() { return (O) getObject(); }
|
|
|
|
|
Logged
|
|
|
|
|
darkfrog
|
 |
« Reply #19 on: May 23, 2008, 08:11:33 AM » |
|
It has been added.
|
|
|
|
|
Logged
|
|
|
|
|
darkfrog
|
 |
« Reply #20 on: May 23, 2008, 08:14:24 AM » |
|
There is definitely room for improvement and once 1.0 is finalized I will probably start some new threads for discussion about some architecture changes for 1.1. For now I'll leave things alone, but try to add more JavaDocs to explain better what's going on. To that end, if you find lacking JavaDoc's feel free to post any content that should be added and I'll get it in there.
|
|
|
|
|
Logged
|
|
|
|
|
GrandMasterBirt
|
 |
« Reply #21 on: May 23, 2008, 09:07:02 AM » |
|
Fair enough.
At the very least put a javadoc on each class just telling us how to get what we need out of it if its a bit unclear from just looking at the methods.
|
|
|
|
|
Logged
|
|
|
|
|