Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » WindowBuilder » Custom Editors for Components?
Custom Editors for Components? [message #693379] Wed, 06 July 2011 11:10 Go to next message
Rayleigh Missing name is currently offline Rayleigh Missing nameFriend
Messages: 20
Registered: July 2011
Junior Member
Is it possible to define a Customizer similar to those in Jigloo GUI Builder?
So when I double click a component, a custom editor pops up.
Re: Custom Editors for Components? [message #693425 is a reply to message #693379] Wed, 06 July 2011 13:03 Go to previous messageGo to next message
Konstantin Scheglov is currently offline Konstantin ScheglovFriend
Messages: 555
Registered: July 2009
Senior Member
Yes, WindowBuilder supports java.beans.Customizer for Swing components.

Konstantin Scheglov,
Google, Inc.
Re: Custom Editors for Components? [message #693841 is a reply to message #693425] Thu, 07 July 2011 10:04 Go to previous messageGo to next message
Rayleigh Missing name is currently offline Rayleigh Missing nameFriend
Messages: 20
Registered: July 2011
Junior Member
Thanks, I found out you have to open it with right click -> customize.
However, the changes I make to the bean with my customizer do not work.
The customizer looks like this:

===========================================
public class CustomTextfieldCustomizer extends JPanel implements Customizer {

private CustomTextfield beanField;

public CustomTextfieldCustomizer() {
this.initGUI();
}

...

@Override
public void setObject(Object bean) {
this.beanField = (CustomTextfield) bean;
this.updateValues(this.beanField);
this.initActions();
}

...

public void applyChanges(CustomTextfield bean) {
this.firePropertyChange("name", bean.getName(), this.getTxtName().getText());
this.firePropertyChange("description", bean.getDescription(), this.getTxtDescription().getText());
this.firePropertyChange("text", bean.getText(), this.getTxtInitialValue().getText());
}
}
===========================================

After Pressing the ok button inside the customizer, applyChanges() is called.
This works fine with jigloo but nothing happens in Window Builder.
Re: Custom Editors for Components? [message #693930 is a reply to message #693841] Thu, 07 July 2011 13:52 Go to previous messageGo to next message
Konstantin Scheglov is currently offline Konstantin ScheglovFriend
Messages: 555
Registered: July 2009
Senior Member
Works for me.
Please post full sources of Bean, BeanInfo and Customizer.


Konstantin Scheglov,
Google, Inc.
Re: Custom Editors for Components? [message #694280 is a reply to message #693379] Fri, 08 July 2011 09:10 Go to previous messageGo to next message
Rayleigh Missing name is currently offline Rayleigh Missing nameFriend
Messages: 20
Registered: July 2011
Junior Member
Seems like I misunderstood the way, window builder handles customizers.
I've added my own ok and cancel buttons and now there are 2 of each when opening the customizer in window builder. How can I add an action listener to the window builder ok/cancel buttons?
Re: Custom Editors for Components? [message #694393 is a reply to message #694280] Fri, 08 July 2011 13:44 Go to previous messageGo to next message
Konstantin Scheglov is currently offline Konstantin ScheglovFriend
Messages: 555
Registered: July 2009
Senior Member
OK/Cancel buttons are buttons of enclosing JFace dialog, you can not access them from Swing customizer.
Do you have any official documentation or tutorial which shows that Customizer should use its own OK/Cancel buttons?
I don't see anything like this here.


Konstantin Scheglov,
Google, Inc.
Re: Custom Editors for Components? [message #695828 is a reply to message #694393] Tue, 12 July 2011 15:47 Go to previous messageGo to next message
Rayleigh Missing name is currently offline Rayleigh Missing nameFriend
Messages: 20
Registered: July 2011
Junior Member
Me neither. I did it this way because I wanted to define the behaviour for the ok and the cancel button myself.

I've tried it like that now:
Whenever the user changes a value inside the customizer, the coresponding bean setter(not firePropertyChange because it did nothing) will be called.
This works fine when pressing the ok button but the cancel button causes odd behavior.
After Pressing Cancel, the SourceCode and the Design View representation of the bean do not change. This is ok.
But when I open the customizer the next time, it is filled with the changes made before pressing cancel.

How can I revert all the changes made to the bean after pressing cancel? Or only apply changes to the bean after pressing ok?
Do you have an example of how its done right?
Re: Custom Editors for Components? [message #696759 is a reply to message #695828] Thu, 14 July 2011 19:13 Go to previous messageGo to next message
Konstantin Scheglov is currently offline Konstantin ScheglovFriend
Messages: 555
Registered: July 2009
Senior Member
OK, I've found that editor should rollback properties changes after Cancel.

Fixed in trunk.


Konstantin Scheglov,
Google, Inc.
Re: Custom Editors for Components? [message #697324 is a reply to message #693379] Sat, 16 July 2011 07:19 Go to previous message
Rayleigh Missing name is currently offline Rayleigh Missing nameFriend
Messages: 20
Registered: July 2011
Junior Member
Thank you, I'll check it out as soon as we get that svn through proxy stuff working.
Previous Topic:Licensing
Next Topic:Error PropertyResolutionException
Goto Forum:
  


Current Time: Fri Sep 20 21:45:12 GMT 2024

Powered by FUDForum. Page generated in 0.03731 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top