• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

representing matryoshka object in form

 
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have case like this:






If object B doesn't have collection, we only need to represent B as grid B and then save the object. But how do I represent this case? one solution crossed my mind is using another grid. so everytime the row selected in grid representing object B is changing, the grid representing C changes to display C objects owned by the currently selected object B.but this poses another problem. I want to send the data by json to the server. lets say grid B has 5 B objects, and right now object B number 2 is selected, so grid C displays list of C objects of B number 2 only. So I cannot include the C objects of the other 4 B objects in the json string I'm about to send to server. Some help please? thanks
 
Rancher
Posts: 1449
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think you may want to post a little more code so people can follow what you are trying to do.
 
Hengki Widjaja
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't have the code yet. It's still conceptual. Because of this problem, my coding process is halted. But is the problem clear to you? I'm still thinking of the layout design that can accommodate this case.
 
Hengki Widjaja
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
actually I'm asking about how to design the html layout for this problem, so html/javascript section sounds quite appropriate. But if you think it should be moved, I don't really mind. thanks
 
Marshal
Posts: 28425
102
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't understand any of that question. I suppose that might be because the classes are named A, B, and C, though, which increases the coefficient of meaninglessness. You're talking about grids, and then collections, and then objects, and then sending data to servers... so there's a bit of GUI design, a bit of data design, a bit of describing actions, all about some unnamed objects which contain basically no useful data.

And yes, your coding process certainly should be halted. You don't have anything which you can write code for. So carry on designing until you have something which you can describe.
 
Hengki Widjaja
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
since this is still an idea (none of my projects have encountered such case, but somehow this morning I thought of it, so why not prepare even if this case hasn't happened yet). lets say you have 5 sons, and each of these sons of yours has 3 sons. For your details, I can simply use textboxes to store your name, DOB and age. as for your sons, a grid will do (it consists of 3 columns : name,age,DOB, just like your details). Now the problem is with your grandsons. What I think now is adding another grid below your son's grid (lets say grandson grid). If I select son number 2 in son's grid, the grandson grid will display the details of son number 2's sons (but none of the remaining 4 sons' sons). As far as I know I can only grab data displayed at the screen, so I'm missing the details of the other 4 sons' sons when I build my json string.

@Paul Clapham:
Clear enough ?
 
Paul Clapham
Marshal
Posts: 28425
102
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Then you certainly don't need different classes for the levels. If the classes represent men, then a Man class contains his name and a list of his sons, who are also, um, Man objects.

Hengki Widjaja wrote:As far as I know I can only grab data displayed at the screen



Of course that isn't true at all. You can "grab" any data which you have in your data model.
 
Hengki Widjaja
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
okay:








Is this about right? So how do you propose I build the json string ? Remember, we're in the view right now (i.e. html displayed in the browser, client-side) not some java file, that's why I thought this question should be put in HTML section. Right now the layout design is your detail, your sons' detail in grid Son and your sons' son's details in grid Grandson. as I've said earlier, the problem is with the grandson details. how do I get them when I build json?
 
Marshal
Posts: 80874
506
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There is something peculiar about a Son who doesn’t have a Father. I am not convinced you have got that inheritance tree at all right.
 
Hengki Widjaja
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That's just a representation in the java side. I'm looking for the appropriate layout strategy for this scenario in my html. The inheritance doesn't matter. Perhaps I chose the wrong analogy since the focus seems to have shifted to inheritance which is not my question. My problem is a grid which each of its rows has their own details. What I've encountered until now is just a case like an receipt with a list of stuff to buy. For this, a couple of textboxes for the receipt info(like the date of purchase, buyer's name, etc) followed by a grid of things to buy will do the trick. Hopefully this is clear enough to describe my problem.
 
Campbell Ritchie
Marshal
Posts: 80874
506
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Hengki Widjaja wrote: . . . But is the problem clear to you? . . .

No. Are you interested in a hierarchy of objects, or a hierarchical display?
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic