-1

My requirement is to create a customlistfieldmanager by extending verticalfeildmanager, I am not able to figureout how to do this?

I am not able to understand why my manager has asked me to use this method.

any sort of help is welcomed!

Michael Donohue
  • 11,776
  • 5
  • 31
  • 44
varunrao321
  • 925
  • 2
  • 10
  • 18

2 Answers2

2

It's possible that he's asked you to do this because of the most limiting factor of a normal ListField: you're stuck with uniform heights.

What you'll need to do is have a parent container that is a scrolling VerticalFieldManager. Inside of that will be custom Managers that can handle the same functionality as the row would in a ListField. It needs to accept focus and fire off an event when it's clicked. You'll also need to keep track of what item number it is, so that when it's clicked it knows how to notify any listeners about which one was selected. Also, the parent VFM will need to be able to keep track of which "row" is currently selected -- in this case which one has focus.

Edit for comment

If you add a NullField into each of them it can accept focus but won't actually show up as anything. To determine if a "row" (the Manager) has focus, you can use getFieldWithFocus() on that Manager and the one that doesn't return null is the row that is selected. You will probably also have to do some custom painting to draw the selection highlight

jprofitt
  • 10,874
  • 4
  • 36
  • 46
  • thanks a lot for your reply jprofitt, that was enlghtng, my requirement is to maintain a dynamic listfield with thumbnails, can you give me more detailing like what all the methods I can use or some snippet.. – varunrao321 Oct 11 '11 at 16:53
  • hello jprofitt, most of the customverticalfieldmanager is done, but I am not able to do the focusing on the custom managers added to the verticalfielmanager – varunrao321 Oct 13 '11 at 09:37
  • Updated my answer with more info – jprofitt Oct 13 '11 at 12:17
  • Hello jprofit, if I am correct I should add nullfield to parent verticalfield manager along with customanager and keep track of the field count with getfieldcount() and keep track of clicked field with getfieldwithfocus? – varunrao321 Oct 13 '11 at 19:29
  • I don't know that you'll need one in the parent, but if it suits your design then it won't be hurting anything. Another thing you might be able to do is keep track of the row `NullField`s and their corresponding row index, then set a `FocusChangeListener` on them so in your `VerticalFieldManager` you'd be able to know which row has focus without needing to do a lot of searching. – jprofitt Oct 13 '11 at 19:33
1

You will have to dynamically add and remove custom elements from your CustomListFieldManager as you add and remove elements from a VerticalFieldManager.

Your manager asked that because he want you to learn how to handle custom object to understand how to use managers.

Michael Donohue
  • 11,776
  • 5
  • 31
  • 44
Juanma Baiutti
  • 637
  • 1
  • 10
  • 27
  • thanks a lot for your reply juanmabaiu, that was of great help,yes my requirement is to maintain a dynamic listfield with thumbnail, can you give me more detailing like what all the methods I can use or some example.. – varunrao321 Oct 11 '11 at 16:47