|
View:
New views
16 Messages
—
Rating Filter:
Alert me
|
|
|
Value of Bean properties are updated, but the Property Sheet doesn't refresh?I have a Bean for which I would like one property to change depending on whether or not another property for that same Bean has been changed. Functionally, I can get this to work. But visually, the property sheet is not updating the values that it displays until I place the cursor in that field. For example, let's say I have a Bean with the following properties:
Color color int size float opacity Theme theme (enum) In this case, selecting a particular Theme will assign values to color, size, and opacity all at once. And when I do this, the actual object on the screen IS being updated to reflect that all the properties have just been modified. HOWEVER, the values for those same properties that are actually displayed in the Property Sheet do not change. How can I force the Property Sheet to refresh/update the values it's displaying when one of them is changed? I tried making all my properties "bound" in the BeanInfo file, but that doesn't do it. |
|
|
Re: Value of Bean properties are updated, but the Property Sheet doesn't refresh?Just marking something as bound in the BeanInfo doesn't actually make it so. Bound properties are properties supporting property change events. Are you using PropertyChangeSupport in your properties? Meaning are you firing property change events? An older tutorial not using the listeners bound to a specific property name per se (has to be done with code by who ever adds the listener...in this case the NB RCP APIs should handle that): http://java.sun.com/docs/books/tutorial/javabeans/properties/bound.html And the latest JavaDocs for PropertyChangeSupport: http://java.sun.com/javase/6/docs/api/java/beans/PropertyChangeSupport.html Basically: public class MyBean { private PropertyChangeSupport pcs = null; public MyBean(){ pcs = new PropertyChangeSupport(this); } private String name = ""; public void setName(String name){ String old = this.name; this.name = name; pcs.firePropertyChange("name", old, name); } public String getName(){ return this.name; } public void addPropertyChangeListener( PropertyChangeListener listener ) { this.pcs.addPropertyChangeListener( listener ); } public void removePropertyChangeListener( PropertyChangeListener listener ) { this.pcs.removePropertyChangeListener( listener ); } public void addPropertyChangeListener(String propName, PropertyChangeListener listener ) { this.pcs.addPropertyChangeListener(propName, listener ); } public void removePropertyChangeListener(String propName, PropertyChangeListener listener ) { this.pcs.removePropertyChangeListener(propName, listener ); } public PropertyChangeListener[] getPropertyChangeListeners(){ return this.pcs.getPropertyChangeListeners(); } public PropertyChangeListener[] getPropertyChangeListeners(String propName){ return this.pcs.getPropertyChangeListeners(propName); } } So, if you are not doing that you would experience problems. Wade ================== Wade Chandler, CCE Software Engineer and Developer Certified Forensic Computer Examiner NetBeans Dream Team Member and Contributor http://www.certified-computer-examiner.com http://wiki.netbeans.org/wiki/view/NetBeansDreamTeam http://www.netbeans.org ----- Original Message ---- > From: rhizomorph <khufu_lotus@...> > To: dev@... > Sent: Tuesday, June 16, 2009 12:08:42 PM > Subject: [openide-dev] Value of Bean properties are updated, but the Property Sheet doesn't refresh? > > I have a Bean for which I would like one property to change depending on whether > or not another property for that same Bean has been changed. Functionally, I can > get this to work. But visually, the property sheet is not updating the values > that it displays until I place the cursor in that field. For example, let's say > I have a Bean with the following properties: > > > > Color color > > int size > > float opacity > > Theme theme (enum) > > > > In this case, selecting a particular Theme will assign values to color, size, > and opacity all at once. And when I do this, the actual object on the screen IS > being updated to reflect that all the properties have just been modified. > HOWEVER, the values for those same properties that are actually displayed in the > Property Sheet do not change. How can I force the Property Sheet to > refresh/update the values it's displaying when one of them is changed? I tried > making all my properties "bound" in the BeanInfo file, but that doesn't do it. |
|
|
Value of Bean properties are updated, but the Property Sheet doesn't refresh?Sorry I forgot to mention - yes I am using PropertyChangeSupport and firing a change event on every modification. The only thing different is that I did not define the last 4 functions you listed (but I did already have the first 2):
addPropertyChangeListener(String, PropertyChangeListener); removePropertyChangeListener(String, PropertyChangeListener); getPropertyChangeListeners(); getPropertyChangeListeners(String); However, adding these has not fixed the problem. Again, changes that are made to all the other properties via setting the Theme property ARE being reflected in the GUI. They just aren't being reflected in the Property Sheet itself (until I click the mouse there). So if the property "color" is currently [255,255,255], then I set the Theme variable (which in turn changes the value of "color" to black), I will see that the object which depends on the value of "color" is now black, but in the Property Sheet itself I will still see [255,255,255], until I click the mouse there, at which point it will change to [0,0,0]. So it seems as though the only one not being notified is the Netbeans editor. Any ideas? |
|
|
Re: Value of Bean properties are updated, but the Property Sheet doesn't refresh?Not sure off the top of my head. Have you seen: http://platform.netbeans.org/tutorials/nbm-nodesapi2.html Maybe there is something you missed in there. If that doesn't help let me know, and I'll see if I can do up a test at some point. What version are you using? Wade ================== Wade Chandler, CCE Software Engineer and Developer Certified Forensic Computer Examiner NetBeans Dream Team Member and Contributor http://www.certified-computer-examiner.com http://wiki.netbeans.org/wiki/view/NetBeansDreamTeam http://www.netbeans.org ----- Original Message ---- > From: rhizomorph <khufu_lotus@...> > To: dev@... > Sent: Tuesday, June 16, 2009 1:55:31 PM > Subject: [openide-dev] Value of Bean properties are updated, but the Property Sheet doesn't refresh? > > Sorry I forgot to mention - yes I am using PropertyChangeSupport and firing a > change event on every modification. The only thing different is that I did not > define the last 4 functions you listed (but I did already have the first 2): > > > > addPropertyChangeListener(String, PropertyChangeListener); > > removePropertyChangeListener(String, PropertyChangeListener); > > getPropertyChangeListeners(); > > getPropertyChangeListeners(String); > > > > However, adding these has not fixed the problem. Again, changes that are made to > all the other properties via setting the Theme property ARE being reflected in > the GUI. They just aren't being reflected in the Property Sheet itself (until I > click the mouse there). So if the property "color" is currently [255,255,255], > then I set the Theme variable (which in turn changes the value of "color" to > black), I will see that the object which depends on the value of "color" is now > black, but in the Property Sheet itself I will still see [255,255,255], until I > click the mouse there, at which point it will change to [0,0,0]. So it seems as > though the only one not being notified is the Netbeans editor. Any ideas? |
|
|
Value of Bean properties are updated, but the Property Sheet doesn't refresh?Thanks for those links, but I'm not sure that's exactly what I'm looking for. There seems to be plenty of information about how to create your own nodes/property sheets etc, but I'm not concerned with that really. I just want access to the property sheet that NETBEANS itself uses to display the properties of an object that has been dragged into the GUI from the palette (not one that I create).
All I'm really trying to say is: "Hey Netbeans, pay attention to these properties and refresh them whenever they change, even if the change wasn't made through the property sheet". Because currently, ONLY changes made through the property sheet are actually updated in the property sheet. If one changes variable A through the property sheet, and variable B is changed as a result, only A's value will be refreshed - B will still get changed in the actual object, but the property sheet will still show the old value. I've spent the last two days reading endless javadoc about the NodesAPI (and related), which seems to let me do everything EXCEPT the one very simple task I'm trying to accomplish. In my latest attempt, I tried to use PropertySupport.Reflection to get/set values on the property sheet for a given Bean, like this... Code: public void setA(int newValue) { int oldA = A; int oldB = B; A = newValue; B = 5*A; // make some dependent change to B. propertySupport.firePropertyChange("propertyA", oldA, A); propertySupport.firePropertyChange("propertyB", oldB, B); // Does NOT update the property sheet. Property prop = new PropertySupport.Reflection(this, Integer.TYPE, "B"); // This fails! prop.setValue(B); // This MIGHT work, if I can even get this far! } But I can't seem to instantiate a Property variable to save my life, I get: > java.lang.NoClassDefFoundError: org/openide/nodes/PropertySupport$Reflection Whatever the hell that means - it compiles fine, so I don't know why it all-of-a-sudden realizes that a class definition is missing. I also tried using Property prop = new PropertySupport.Reflection(this, Integer.class, "B"); because I wasn't sure of the proper call, but this fails too. Any ideas? I can't possibly be the first person to create a bean in which two or more modifiable properties also happen to be interdependent. Wade Chandler wrote: > Not sure off the top of my head. Have you seen: > http://platform.netbeans.org/tutorials/nbm-nodesapi2.html > > Maybe there is something you missed in there. If that doesn't help let me know, and I'll see if I can do up a test at some point. What version are you using? > > Wade > |
|
|
Re: Value of Bean properties are updated, but the Property Sheet doesn't refresh?Creating a BeanInfo class is the way to go. Not only can you limit what values get displayed but the values get refreshed automatically. Take a look at how I do it with SQLRaider.... In the node class it is just one line and then create your BeanInfo class: createProperties(connectionModel, new ConnectionBeanInfo()); http://code.google.com/p/sqlraider/source/browse/trunk/database/src/com/sqlraider/db/view/node/ConnectionNode.java http://code.google.com/p/sqlraider/source/browse/trunk/database/src/com/sqlraider/db/view/node/beaninfo/ConnectionBeanInfo.java -Jeff Johnston On Wed, Jun 17, 2009 at 11:44 AM, rhizomorph <khufu_lotus@...> wrote: Thanks for those links, but I'm not sure that's exactly what I'm looking for. There seems to be plenty of information about how to create your own nodes/property sheets etc, but I'm not concerned with that really. I just want access to the property sheet that NETBEANS itself uses to display the properties of an object that has been dragged into the GUI from the palette (not one that I create). |
|
|
Re: Value of Bean properties are updated, but the Property Sheet doesn't refresh?That tutorial should have been using the global property sheet. May be something there that isn't working either if it is not. Wade ================== Wade Chandler, CCE Software Engineer and Developer Certified Forensic Computer Examiner NetBeans Dream Team Member and Contributor http://www.certified-computer-examiner.com http://wiki.netbeans.org/wiki/view/NetBeansDreamTeam http://www.netbeans.org ----- Original Message ---- > From: rhizomorph <khufu_lotus@...> > To: dev@... > Sent: Wednesday, June 17, 2009 12:44:32 PM > Subject: [openide-dev] Value of Bean properties are updated, but the Property Sheet doesn't refresh? > > Thanks for those links, but I'm not sure that's exactly what I'm looking for. > There seems to be plenty of information about how to create your own > nodes/property sheets etc, but I'm not concerned with that really. I just want > access to the property sheet that NETBEANS itself uses to display the properties > of an object that has been dragged into the GUI from the palette (not one that I > create). > > > > All I'm really trying to say is: "Hey Netbeans, pay attention to these > properties and refresh them whenever they change, even if the change wasn't made > through the property sheet". Because currently, ONLY changes made through the > property sheet are actually updated in the property sheet. If one changes > variable A through the property sheet, and variable B is changed as a result, > only A's value will be refreshed - B will still get changed in the actual > object, but the property sheet will still show the old value. > > > > I've spent the last two days reading endless javadoc about the NodesAPI (and > related), which seems to let me do everything EXCEPT the one very simple task > I'm trying to accomplish. > > > > In my latest attempt, I tried to use PropertySupport.Reflection to get/set > values on the property sheet for a given Bean, like this... > > > > > Code: > public void setA(int newValue) { > > int oldA = A; > > int oldB = B; > > A = newValue; > > B = 5*A; // make some dependent change to B. > > > > propertySupport.firePropertyChange("propertyA", oldA, A); > > propertySupport.firePropertyChange("propertyB", oldB, B); // Does NOT > update the property sheet. > > > > Property prop = new PropertySupport.Reflection(this, Integer.TYPE, "B"); // > This fails! > > prop.setValue(B); // This MIGHT work, if I can even get this far! > > } > > > > > > But I can't seem to instantiate a Property variable to save my life, I get: > > > > > > java.lang.NoClassDefFoundError: org/openide/nodes/PropertySupport$Reflection > > > > > Whatever the hell that means - it compiles fine, so I don't know why it > all-of-a-sudden realizes that a class definition is missing. I also tried using > Property prop = new PropertySupport.Reflection(this, Integer.class, "B"); > because I wasn't sure of the proper call, but this fails too. > > > > Any ideas? I can't possibly be the first person to create a bean in which two or > more modifiable properties also happen to be interdependent. > > > > > Wade Chandler wrote: > > Not sure off the top of my head. Have you seen: > > > http://platform.netbeans.org/tutorials/nbm-nodesapi2.html > > > > > > Maybe there is something you missed in there. If that doesn't help let me > know, and I'll see if I can do up a test at some point. What version are you > using? > > > > > > Wade > > > |
|
|
Value of Bean properties are updated, but the Property Sheet doesn't refresh?Thanks for all the input you guys, but I've concluded that Netbeans just has a bug in the way it monitors property change events.
None of your suggestions resolved the issue. Take the following simple Bean for example (3 properties, setting the value of one sets the value of all of them): Code: import java.beans.*; import java.io.Serializable; public class BrokenBean implements Serializable { public static final String PROP_A = "a"; public static final String PROP_B = "b"; public static final String PROP_C = "c"; private int a; private int b; private int c; private PropertyChangeSupport pcs; public BrokenBean() { pcs = new PropertyChangeSupport(this); } public int getA() { return a; } public int getB() { return b; } public int getC() { return c; } public void setA(int value) { setALL(value); } public void setB(int value) { setALL(value); } public void setC(int value) { setALL(value); } private void setALL(int value) { int oldValue = a; c = b = a = value; pcs.firePropertyChange(PROP_A, oldValue, a); pcs.firePropertyChange(PROP_B, oldValue, b); pcs.firePropertyChange(PROP_C, oldValue, c); } public void addPropertyChangeListener(PropertyChangeListener listener) { pcs.addPropertyChangeListener(listener); } public void removePropertyChangeListener(PropertyChangeListener listener) { pcs.removePropertyChangeListener(listener); } } Drag this Bean into a project (Netbeans will placed it in "Other Components"), and try to set any one of the values to 10. Changing one of them should change ALL of them immediately. In fact, if you use a JOptionPane to grab the values directly from the property sheet, you will see that all 3 values ARE updated (but not refreshed). Similarly, if you just MouseOver one of the other properties, you will see that even the ToolTip for that property has been updated. However, the Property Sheet itself is retarded and doesn't seem to realize that it's supposed to actually refresh the values of the other properties as well. And there is no way to tell it to do that (or at least, I can't find one). Now, if you click the mouse away from the bean onto some other object, or if you simply click on the "Properties" node, then you will see the values are all refreshed at once. But this does not happen immediately after setting the values, only when the property sheet loses focus or is told to redraw itself some other way. CONCLUSION: Netbeans needs to add a Sheet.repaint() method (or something equivalent). |
|
|
Re: Value of Bean properties are updated, but the Property Sheet doesn't refresh?The best way to get a definitive answer and move towards a workaround
and/or solution is to file an issue: http://www.netbeans.org/community/issues.html . -ernie rhizomorph wrote: > Thanks for all the input you guys, but I've concluded that Netbeans just has a bug in the way it monitors property change events. > > > > None of your suggestions resolved the issue. Take the following simple Bean for example (3 properties, setting the value of one sets the value of all of them): > > > > > Code: > import java.beans.*; > > import java.io.Serializable; > > > > public class BrokenBean implements Serializable { > > > > public static final String PROP_A = "a"; > > public static final String PROP_B = "b"; > > public static final String PROP_C = "c"; > > > > private int a; > > private int b; > > private int c; > > private PropertyChangeSupport pcs; > > > > public BrokenBean() { > > pcs = new PropertyChangeSupport(this); > > } > > > > public int getA() { return a; } > > public int getB() { return b; } > > public int getC() { return c; } > > > > public void setA(int value) { setALL(value); } > > public void setB(int value) { setALL(value); } > > public void setC(int value) { setALL(value); } > > > > private void setALL(int value) { > > int oldValue = a; > > c = b = a = value; > > pcs.firePropertyChange(PROP_A, oldValue, a); > > pcs.firePropertyChange(PROP_B, oldValue, b); > > pcs.firePropertyChange(PROP_C, oldValue, c); > > } > > > > public void addPropertyChangeListener(PropertyChangeListener listener) { > > pcs.addPropertyChangeListener(listener); > > } > > > > public void removePropertyChangeListener(PropertyChangeListener listener) { > > pcs.removePropertyChangeListener(listener); > > } > > } > > > > > > > > Drag this Bean into a project (Netbeans will placed it in "Other Components"), and try to set any one of the values to 10. Changing one of them should change ALL of them immediately. In fact, if you use a JOptionPane to grab the values directly from the property sheet, you will see that all 3 values ARE updated (but not refreshed). Similarly, if you just MouseOver one of the other properties, you will see that even the ToolTip for that property has been updated. However, the Property Sheet itself is retarded and doesn't seem to realize that it's supposed to actually refresh the values of the other properties as well. And there is no way to tell it to do that (or at least, I can't find one). Now, if you click the mouse away from the bean onto some other object, or if you simply click on the "Properties" node, then you will see the values are all refreshed at once. But this does not happen immediately after setting the values, only when the property sheet loses focus or is told > to redraw itself some other way. > > > > CONCLUSION: Netbeans needs to add a Sheet.repaint() method (or something equivalent). > > > > > > > |
|
|
Re: Value of Bean properties are updated, but the Property Sheet doesn't refresh?I don't think NB has a bug in this respect.
I assume you're changing the property value from within the EDT (as a DocumentChangeListener, or something), and then fire those events in the EDT as well, and you expect everything to happen in the EDT. That's probably slow: you're flooding the EDT with PropertyChangeEVents and repaints ant the whole thing. I'd try to use a SwingPropertyChangeSupport instead of a PropertyChangeSupport and see what happens. that way you differ the repaint after the events have been fired, and give a break to the EDT. Cheers, Antonio rhizomorph escribió: > Thanks for all the input you guys, but I've concluded that Netbeans just has a bug in the way it monitors property change events. > > > > None of your suggestions resolved the issue. Take the following simple Bean for example (3 properties, setting the value of one sets the value of all of them): > > > > > Code: > import java.beans.*; > > import java.io.Serializable; > > > > public class BrokenBean implements Serializable { > > > > public static final String PROP_A = "a"; > > public static final String PROP_B = "b"; > > public static final String PROP_C = "c"; > > > > private int a; > > private int b; > > private int c; > > private PropertyChangeSupport pcs; > > > > public BrokenBean() { > > pcs = new PropertyChangeSupport(this); > > } > > > > public int getA() { return a; } > > public int getB() { return b; } > > public int getC() { return c; } > > > > public void setA(int value) { setALL(value); } > > public void setB(int value) { setALL(value); } > > public void setC(int value) { setALL(value); } > > > > private void setALL(int value) { > > int oldValue = a; > > c = b = a = value; > > pcs.firePropertyChange(PROP_A, oldValue, a); > > pcs.firePropertyChange(PROP_B, oldValue, b); > > pcs.firePropertyChange(PROP_C, oldValue, c); > > } > > > > public void addPropertyChangeListener(PropertyChangeListener listener) { > > pcs.addPropertyChangeListener(listener); > > } > > > > public void removePropertyChangeListener(PropertyChangeListener listener) { > > pcs.removePropertyChangeListener(listener); > > } > > } > > > > > > > > Drag this Bean into a project (Netbeans will placed it in "Other Components"), and try to set any one of the values to 10. Changing one of them should change ALL of them immediately. In fact, if you use a JOptionPane to grab the values directly from the property sheet, you will see that all 3 values ARE updated (but not refreshed). Similarly, if you just MouseOver one of the other properties, you will see that even the ToolTip for that property has been updated. However, the Property Sheet itself is retarded and doesn't seem to realize that it's supposed to actually refresh the values of the other properties as well. And there is no way to tell it to do that (or at least, I can't find one). Now, if you click the mouse away from the bean onto some other object, or if you simply click on the "Properties" node, then you will see the values are all refreshed at once. But this does not happen immediately after setting the values, only when the property sheet loses focus or is to > to redraw itself some other way. > > > > CONCLUSION: Netbeans needs to add a Sheet.repaint() method (or something equivalent). > > > > > |
|
|
Value of Bean properties are updated, but the Property Sheet doesn't refresh?Unfortunately, using SwingPropertyChangeSupport instead doesn't fix the issue.
Something else I realized (and maybe this suggests the source of the problem) - if I change the value of "a" via the property sheet, b and c are also changed (programatically) but only "a" is displayed in BOLD. Meaning, Netbeans still thinks that properties "b" and "c" are at their default values. This happens regardless of whether or not "b" and "c" are set directly or via their setX() mutators. I'm guessing the same section of code that is responsible for Netbeans' failure to notice that these properties are no longer at their default values is also responsible to failing to issue a repaint command. |
|
|
Re: Value of Bean properties are updated, but the Property Sheet doesn't refresh?I'll have to examine. I have done this in the past. Before I thought you were trying to use the Node class and a property sheet, but you were talking about pure JavaBeans in Matisse. Anyways, I have definitely changed multiple properties from a single property change and had it work in the IDE. I'll see if I can dig up the old code and show you. Wade ================== Wade Chandler, CCE Software Engineer and Developer Certified Forensic Computer Examiner NetBeans Dream Team Member and Contributor http://www.certified-computer-examiner.com http://wiki.netbeans.org/wiki/view/NetBeansDreamTeam http://www.netbeans.org ----- Original Message ---- > From: rhizomorph <khufu_lotus@...> > To: dev@... > Sent: Saturday, July 4, 2009 1:27:24 PM > Subject: [openide-dev] Value of Bean properties are updated, but the Property Sheet doesn't refresh? > > Unfortunately, using SwingPropertyChangeSupport instead doesn't fix the issue. > > > > Something else I realized (and maybe this suggests the source of the problem) - > if I change the value of "a" via the property sheet, b and c are also changed > (programatically) but only "a" is displayed in BOLD. Meaning, Netbeans still > thinks that properties "b" and "c" are at their default values. This happens > regardless of whether or not "b" and "c" are set directly or via their setX() > mutators. I'm guessing the same section of code that is responsible for > Netbeans' failure to notice that these properties are no longer at their default > values is also responsible to failing to issue a repaint command. |
|
|
Re: Value of Bean properties are updated, but the Property Sheet doesn't refresh?Here, this should work: https://jdnc-incubator.dev.java.net/source/browse/jdnc-incubator/trunk/src/java/org/jdesktop/jdnc/incubator/wadechandler/swing/box/BoxFiller.java?rev=281&view=markup Make sure you get the full URL. Not sure how the email clients may cut it off into two lines etc. Anyways, that is a class to make Box and BoxLayout easier to use from a JavaBean perspective I had added to the SwingLabs/JDNC Incubator a few years ago. I haven't examined it right now to see if there is a bug in NB that keeps it from working correctly again, but this has definitely worked in the past. You might find something diffferent there than what you are doing. It is a little different in that it sets all the old values up and fires all the change events at the same time, but it is certainly changing multiple properties on a single set, and definitely used to work in the NB IDE (as well as JDeveloper) just fine. Hope it helps Wade ================== Wade Chandler, CCE Software Engineer and Developer Certified Forensic Computer Examiner NetBeans Dream Team Member and Contributor http://www.certified-computer-examiner.com http://wiki.netbeans.org/wiki/view/NetBeansDreamTeam http://www.netbeans.org ----- Original Message ---- > From: Wade Chandler <hwadechandler-nb@...> > To: dev@... > Sent: Saturday, July 4, 2009 1:45:29 PM > Subject: Re: [openide-dev] Value of Bean properties are updated, but the Property Sheet doesn't refresh? > > > I'll have to examine. I have done this in the past. Before I thought you were > trying to use the Node class and a property sheet, but you were talking about > pure JavaBeans in Matisse. Anyways, I have definitely changed multiple > properties from a single property change and had it work in the IDE. I'll see if > I can dig up the old code and show you. > > Wade > > ================== > Wade Chandler, CCE > Software Engineer and Developer > Certified Forensic Computer Examiner > NetBeans Dream Team Member and Contributor > > > http://www.certified-computer-examiner.com > http://wiki.netbeans.org/wiki/view/NetBeansDreamTeam > http://www.netbeans.org > > > > ----- Original Message ---- > > From: rhizomorph > > To: dev@... > > Sent: Saturday, July 4, 2009 1:27:24 PM > > Subject: [openide-dev] Value of Bean properties are updated, but the Property > Sheet doesn't refresh? > > > > Unfortunately, using SwingPropertyChangeSupport instead doesn't fix the issue. > > > > > > > > Something else I realized (and maybe this suggests the source of the problem) > - > > if I change the value of "a" via the property sheet, b and c are also changed > > (programatically) but only "a" is displayed in BOLD. Meaning, Netbeans still > > thinks that properties "b" and "c" are at their default values. This happens > > regardless of whether or not "b" and "c" are set directly or via their setX() > > mutators. I'm guessing the same section of code that is responsible for > > Netbeans' failure to notice that these properties are no longer at their > default > > values is also responsible to failing to issue a repaint command. |
|
|
Re: Value of Bean properties are updated, but the Property Sheet doesn't refresh?Be really, really, double-plus-really sure that the string names of the property changes fired from your Node are correct according to the beans spec. I.e. if setFoo() was called, the Node must fire a property change of "foo" - if the string doesn't match the name of a Property the property sheet is showing, it will ignore it (I think it used to log a warning too, but I don't know if that code's still there). -Tim |
|
|
Re: Value of Bean properties are updated, but the Property Sheet doesn't refresh?I have to admit I am seeing the same issues as Rhizomorph .
I am following the patters as described above and pcs.firePropertyChange is doign all the updates. I even forcefully in my propertyChange() method of my Node call this.getSheet().get("properties").setValue("name",newvalue) and the value in the Property window seems not to change. As Rhizomorph sais - just expand/clos the Set is updaing it - even just clicking into the property window is enough to get it updating visually. I will look into this a bit deeper to find the cause, fireing PropertyChange one more time will update it - but thats hacky. B-) On Sat, Jul 4, 2009 at 11:35 PM, Tim Boudreau<tboudreau@...> wrote: > > > Rhizomorph wrote: >> >> I have a Bean for which I would like one property to change depending on >> whether or not another property for that same Bean has been changed. >> Functionally, I can get this to work. But visually, the property sheet is >> not updating the values that it displays until I place the cursor in that >> field. For example, let's say I have a Bean with the following properties: >> > > Be really, really, double-plus-really sure that the string names of the > property changes fired from your Node are correct according to the beans > spec. I.e. if setFoo() was called, the Node must fire a property change of > "foo" - if the string doesn't match the name of a Property the property > sheet is showing, it will ignore it (I think it used to log a warning too, > but I don't know if that code's still there). > > -Tim > > -- > View this message in context: http://www.nabble.com/Value-of-Bean-properties-are-updated%2C-but-the-Property-Sheet-doesn%27t-refresh--tp24057658p24340146.html > Sent from the Netbeans RCP/Platform Users (Open API) mailing list archive at Nabble.com. > > |
|
|
Re: Value of Bean properties are updated, but the Property Sheet doesn't refresh?Well I got it fixed.
My mistake - of course (as most of the time !) MyObjectNode is a propertylistening to MyObject Now, Updating the name (with the Rename Action for example) will cause the "setName(..)" method to be called on the MyObjectNode. In the setName I set the name on the MyObject which will trigger propertyChange() to be called on the MyObjectNode where I do a this.fireDisplayName() to get the tree to update. In addition do call this.firePropertyChange() in the setName() method of the Node which did the trick. I assume the Property window is a PropertyListener to MyObjectNode and hence all makes sense. B-) On Wed, Sep 2, 2009 at 6:59 PM, bruehlicke<bruehlicke@...> wrote: > I have to admit I am seeing the same issues as Rhizomorph . > > I am following the patters as described above and > pcs.firePropertyChange is doign all the updates. I even forcefully in > my propertyChange() method of my Node call > > this.getSheet().get("properties").setValue("name",newvalue) > > and the value in the Property window seems not to change. As > Rhizomorph sais - just expand/clos the Set is updaing it - even just > clicking into the property window is enough to get it updating > visually. > > I will look into this a bit deeper to find the cause, fireing > PropertyChange one more time will update it - but thats hacky. > > B-) > > > > On Sat, Jul 4, 2009 at 11:35 PM, Tim Boudreau<tboudreau@...> wrote: >> >> >> Rhizomorph wrote: >>> >>> I have a Bean for which I would like one property to change depending on >>> whether or not another property for that same Bean has been changed. >>> Functionally, I can get this to work. But visually, the property sheet is >>> not updating the values that it displays until I place the cursor in that >>> field. For example, let's say I have a Bean with the following properties: >>> >> >> Be really, really, double-plus-really sure that the string names of the >> property changes fired from your Node are correct according to the beans >> spec. I.e. if setFoo() was called, the Node must fire a property change of >> "foo" - if the string doesn't match the name of a Property the property >> sheet is showing, it will ignore it (I think it used to log a warning too, >> but I don't know if that code's still there). >> >> -Tim >> >> -- >> View this message in context: http://www.nabble.com/Value-of-Bean-properties-are-updated%2C-but-the-Property-Sheet-doesn%27t-refresh--tp24057658p24340146.html >> Sent from the Netbeans RCP/Platform Users (Open API) mailing list archive at Nabble.com. >> >> > |
| Free embeddable forum powered by Nabble | Forum Help |