Forums Register Login

Refreshable List (really tough question)

+Pie Number of slices to send: Send
Hi all,
I've got a Vector of objects.

I've to display them in a javax.microedition.lcdui.List.

Those objects may change their name, may be deleted, or may be added.
The list should be properly updated.

Here is the question:
How can I be sure to point to the same object between this operations:
  • Select an Object (i.e. pressing the "select" soft button)
  • [list] retreive the object selected in the method[/list]
    using the index
  • doing some stuff with selected object retreived

  • if the update process can occurr suddenly???

    Any idea?

    Thanks

    [ March 03, 2006: Message edited by: marcus don ]
    +Pie Number of slices to send: Send
    Hi Marcus,
    Was not able to understand the question completely.


    MY TAKE ->
    (Assuming we maintain an external index also.)

    Lets take these two cases:
    1. The list can change while we are doing some operations on object.
    2. The list can change only after we are done with our operations.

    In the first case - Its possible only by using threads, and that is bad programming if both the threads manipulate the same object at the same time. Of course, there could be better alternative, and ultimately, we may use synhronize method. That automatically leads us to 2nd probability.

    Now the second case - whether we implement synchronize in case of threads OR a simple program without threads - Here it may depend on the operation we gonna perform.
    Like, if we gonna delete some item we have to adjust the index appropriately. Similarly, it can be done for all operations.
    And in case we delete the same item which is HIGHLIGHTED, we may change the index to next item or previous item.

    Does it solve our purpose??

    - Ramy..
    +Pie Number of slices to send: Send
    Hi Ramy,
    thanks for your answer.

    Your assumptions are corrects and well thought.
    You catch the point.

    I have got a chat application,
    a vector contains all discovered members,
    while the list display their names.
    Selecting an item (a member) I can
  • send a message
  • ban the user
  • see the user profile


  • How do you think I can maintain an external index between the list
    and the members?

    How can I refresh the list, checking if all elements are the same,
    if not... updating them?

    i.e.

    Here I store chat members


    and this is the list



    Thanks again,
    Marcus
    +Pie Number of slices to send: Send
    Hi Marcus,
    See, I have been working in J2ME from last six months. And unfortunately, as I am in GAMING, i have dealt with Canvas class only in whatever project I have worked upon. So I dont know, even the basic functions of List.

    So I made some assumptions like, maxItems being the number of item in list.


    We can maintain the index with the keypresses. That is, when we press down key, we may increase our index by 1. In fact, as I told you, so far I have woeked with Canvas class only, and in that as everything is DRAWN by YOU, so you need to maintain such an index. Not really sure, how much will this stuff be of use in case of a LIST.
    And yeah, even though I tried my best to include every condition in deletion stuff, yet I may have missed any boundary condition. Sorry in advance, if that occurs .

    I just hope this is what we needed!!..

    - Ramy..
    +Pie Number of slices to send: Send
    Hi Ramy,
    sorry for the late answer,
    thank you for your help.

    I didn't find a solution yet, but soon or later I'll solve it...

    I still don't understand :roll: how to synchronize the mutable Hashtable of users with the List.

    Marcus
    Today you are you, that is turer than true. There is no one alive who is youer than you! - Seuss. Tiny ad:
    a bit of art, as a gift, the permaculture playing cards
    https://gardener-gift.com


    reply
    reply
    This thread has been viewed 1519 times.
    Similar Threads
    PreAssessment Questions and Answers
    Event handling
    [LONG POST] IBM Pre-assessment Test
    Longer Post - ALL IBM ICE EXAM Q's for UML
    Where do I put images in J2me application
    More...

    All times above are in ranch (not your local) time.
    The current ranch time is
    Mar 28, 2024 12:22:40.