This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 237588 - Encapsulate Fields and GUI Binding
Summary: Encapsulate Fields and GUI Binding
Status: RESOLVED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Refactoring (show other bugs)
Version: 7.4
Hardware: All All
: P3 normal with 1 vote (vote)
Assignee: Ralph Ruijs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-10-23 21:49 UTC by javalearner
Modified: 2014-09-13 04:52 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description javalearner 2013-10-23 21:49:51 UTC
Hi, first bug report, so apologies if it is filed incorrectly.

Steps: Create a class "myBean" with a single property "int myVariable;"

Using "Factoring" -> "Encapsulate Fields" to create setters/getters for above property, and enable "Generate Property Change Support"

The resulting code has has in the setter:
   <code>public static final String PROP_MYVARIABLE = "PROP_MYVARIABLE";</code>

   <code>firePropertyChange(PROP_PROP_MYVARIABLE, oldMyVariable, newMyVariable);</code>

Create a GUI frame, add a reference to "myBean", then add any text element, use "bind" -> "text", and select the binding source "Form" and use the ${myBean.myVariable}.
Any updates to the bean do not update the GUI form.
However, events are triggered and the bean is updated, the GUI just doesnt get update.

To work around, remove the "PROP_" and reset the String variable value to the fields case.
    <code>public static final String PROP_MYVARIABLE = "myVariable";</code>

Once done, bean updates are reflected within the GUI correctly.

PS: When using "Insert Code" -> "Add Property" the correct result is achieved.

Many thanks.
Comment 1 Jiri Prox 2013-10-24 13:37:22 UTC
reproducible

The Encapsulate Filed generates wrong string in PROP_ field
Comment 2 Ralph Ruijs 2014-09-01 23:49:53 UTC
changeset   : f079ac6bd2d7
author      : Ralph Benjamin Ruijs <ralphbenjamin@netbeans.org>
date        : Tue Sep 02 01:44:38 CEST 2014
summary     : #237588 - Encapsulate Fields and GUI Binding
Comment 3 Quality Engineering 2014-09-13 04:52:12 UTC
Integrated into 'main-silver', will be available in build *201409130001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/f079ac6bd2d7
User: Ralph Benjamin Ruijs <ralphbenjamin@netbeans.org>
Log: #237588 - Encapsulate Fields and GUI Binding