unable to literally "new" JideButton after actionlistener

This is the forum for JIDE Common Layer which is open sourced at https://github.com/jidesoft/jide-oss. Please note, JIDE technical support doesn't monitor this forum as often as other forums. Please consider subscribe for technical support for JIDE Common Layer so that you can use customer only forum to get a timely response.

Moderator: JIDE Support

Forum rules
Community driven forum for open source JIDE Common Layer. JIDE technical support doesn't monitor this forum as often as other forums. If you only use JIDE Common Layer, please consider subscribing for technical support for JIDE Common Layer so that you can use customer only forum to get a timely response.

unable to literally "new" JideButton after actionlistener

Postby calvn » Mon Feb 16, 2009 6:20 am

hi there.

i have JideButton in my code, and it is supposed to show a thumbnail of each image it links to. unfortunately, after the button is clicked, subsequent thumbnails shown will be the thumbnail that was last clicked.

this code below is from the details pane, which displays details of a record that is highlighted from the main pane.
Code: Select all
static Image imageInstance;
Property thumbNailCell;
public void update()
{
//original image
imageInstance = getImageFromSomewhere;

//resized to fit into property pane
Image resizedImage = imageInstance.getScaledInstance(50, -1, Image.SCALE_REPLICATE);

//create a new button with the resizedImage
ImageIcon thumbNail = new ImageIcon(resizedImage);
JideButton btn = new JideButton("Expand Image "+counter,thumbNail);
btn.addActionListener(this);
counter++;

//put the button into the Property thumbNailCell
[b]thumbNailCell.setValue(btn);[/b]
}


i had set a static int counter, and had it increment each time i new the btn (JideButton). if i just browse the thumbnails of each record, the JideButton displays fine. however, if i click on the button (say it currently is a picture of an iphone), all future thumbnails will incorrectly reflect as "iphone". The counter that should show up with the text at JideButton also remains stagnant, doesn't increment. Weird enough though, the image expands out correctly in the viewer.

some help here, please?

thanks and regards,
calvin.
Last edited by calvn on Tue Feb 17, 2009 8:31 pm, edited 2 times in total.
calvn
 
Posts: 4
Joined: Sun Feb 15, 2009 8:55 pm

Re: unable to literally "new" JideButton after actionlistener

Postby JIDE Support » Mon Feb 16, 2009 6:29 am

I don't think I can help based on the information you post. To be frank, I don't think this is related to JIDE. If you replace JideButton with JButton, you will see the same result.
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 37263
Joined: Sun Sep 14, 2003 10:49 am

Re: unable to literally "new" JideButton after actionlistener

Postby calvn » Tue Feb 17, 2009 5:12 am

JIDE Support wrote:I don't think I can help based on the information you post. To be frank, I don't think this is related to JIDE. If you replace JideButton with JButton, you will see the same result.


hi, thanks for the prompt reply. unfortunately, i have very limited internet access at my workplace, so i apologise for the (lack of) code details which i'm typing from memory.

you're right though, it's not the JideButton. i've had JOptionPane to display the JideButton instances, and they all worked fine. i realised that i left out this crucial part, jidesoft.grid.property. i've tried thumbNailCell.removeAllChildren, setting thumbNailCell=null, thumbNailCell.rowUpdated, also creating a new instance of thumbNailCell (this actually adds more buttons, rather than overriding the previous), nothing works yet. any suggestions on how to "refresh" this cell in the correct manner?
calvn
 
Posts: 4
Joined: Sun Feb 15, 2009 8:55 pm

Re: unable to literally "new" JideButton after actionlistener

Postby JIDE Support » Tue Feb 17, 2009 8:50 am

I am sorry but I don't think I can help with this limited information. Could you create a test case so that I can run to see the issue, if you think this could be a JIDE bug?

Thanks,
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 37263
Joined: Sun Sep 14, 2003 10:49 am

Re: unable to literally "new" JideButton after actionlistener

Postby calvn » Tue Feb 17, 2009 8:19 pm

i hope i'm interpreting correctly, here goes.

1. user selects a record RECORD_0 in the MAIN_PANE, and the corresponding details are set out in PROPERTIES_PANE on the right(various textual description and finally the thumbnailed-image button).

2. user selects another record, RECORD_1. again, the details are correctly displayed in the PROPERTIES_PANE. user then clicks on the thumbnailed-image button to view the image in its original size.

3. when user selects RECORD_0, or any other records, all details are correctly displayed in PROPERTIES_PANE, except for the thumbnailed-image button, which seems to be bound to RECORD_1's thumbnailed-image button. but a JOptionPane.showMessage displays the button instance correctly. so i suppose what i should look for is a trigger to refresh the Property class if it exists.
calvn
 
Posts: 4
Joined: Sun Feb 15, 2009 8:55 pm

Re: unable to literally "new" JideButton after actionlistener

Postby JIDE Support » Tue Feb 17, 2009 8:58 pm

First of all, I don't think it is related to JIDE at all based on your description. It is probably a Swing usage problem in your code which we are not obligated to support you as we provide only JIDE support. Secondly, no matter how you describe the scenario to us, we don't see your actual code thus cannot point to you what could be wrong. So even we want to go out of our way to help you, we couldn't.

Thanks,
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 37263
Joined: Sun Sep 14, 2003 10:49 am

Re: unable to literally "new" JideButton after actionlistener

Postby calvn » Wed Feb 18, 2009 2:13 am

JIDE Support wrote:First of all, I don't think it is related to JIDE at all based on your description. It is probably a Swing usage problem in your code which we are not obligated to support you as we provide only JIDE support. Secondly, no matter how you describe the scenario to us, we don't see your actual code thus cannot point to you what could be wrong. So even we want to go out of our way to help you, we couldn't.

Thanks,

i've got it sorted out. added the line .removeEditor() at the end of actionPerformed(). thank you for the patience with me!
calvn
 
Posts: 4
Joined: Sun Feb 15, 2009 8:55 pm

Re: unable to literally "new" JideButton after actionlistener

Postby JIDE Support » Wed Feb 18, 2009 8:23 am

Great that you sorted it out. There is no way for us to know that's the answer.
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 37263
Joined: Sun Sep 14, 2003 10:49 am


Return to JIDE Common Layer Open Source Project Discussion (Community Driven)

Who is online

Users browsing this forum: No registered users and 16 guests