"Notify Property Change"

I was created a bean which has two properties called provider and algorithm. I was created the tag property editors for both the properties. The property provider takes values "sun","DSTC". The property algorithm takes values "DSA","RSA","DH" etc. The provider "sun" is providing algorithms "DSA","RSA". and The provider "DSTC" is providing algorithms "DSA","RSA","DH". Here my problem is When ever I set the provider property as "SUN", the algorthm property should show only "DSA" and "RSA". If i changed my provider property as "DSTC", The algorithm property should contain values "DSA","RSA","DH". How can i notify the one property change to other of the same bean.Please remember that i used  tag editors for the both the properties. Please help me as early as possible.
ksreddyAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

heyhey_Commented:
my answer is - 'you can't implement this with property editors'

properties are supposed to be 'independent'

you can probably implement it using Customizer.
0
ksreddyAuthor Commented:
In customizer interface we had a function called setObject(Object bean). From which we can get the bean reference. Is there any way to get the object reference in propertyEditors.
0
heyhey_Commented:
Property Editor is supposed to edit some property i.e. some kind of data / object.

you should be able to use the same Property editor when you edit property of the same 'type' on some other Bean.

so - the answer is clear. no

properties are independent entities. they don't know anything about the Bean or some other properties of the same bean

0
Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

ksreddyAuthor Commented:
What is the use of listeners support in the editors.
0
heyhey_Commented:
usually the builder tool creates new Editor, sets its value using setValue() (that is the value of the property - as far as I remember, you'd better make a copy of this information) than registers listener to your editor and when it detects property change it asks the editor for the new value (using getValue()) and sets it to the Object.

debugging property-editor was one of the most painfull experiences ...

if you don't make a Copy of the Value, you'll have the real Propertiy object, which may have a reference to its's bean, so in theory, you can manipulate directly the bean. practicaly - it probably won't work in all the 'builder tools' and is very DANGEROUS.


0
heyhey_Commented:
>> if you don't make a Copy of the Value

the enviroment will probably call
editor.setValue(obj) with the real property object that is party of the bean. you'd better make a copy of this information (otherwise, you'll act directly on the Bean object which is highly unrecomeneded). when the user changes the value of the property inside your property editor, you should fire PropertyChangeEvent - the enviroment will ask your editor about the new value of the property and use the appropriate set method of the bean.
0
ksreddyAuthor Commented:
For a single bean howmany customizers we can have?
0
heyhey_Commented:
as far as I remember - one


'public interface Customizer
A customizer class provides a complete custom GUI for customizing a target Java Bean.
Each customizer should inherit from the java.awt.Component class so it can be instantiated inside an AWT dialog or panel.
Each customizer should have a null constructor.'

'public class BeanDescriptor
extends FeatureDescriptor
A BeanDescriptor provides global information about a "bean", including its Java class, its displayName, etc.

 public Class getCustomizerClass()
Returns:
The Class object for the bean's customizer. This may be null if the bean doesn't have a customizer.'


0
heyhey_Commented:
you have a lot of questions :)
0
ksreddyAuthor Commented:
Thank you. what was the design logic behind this. Like the customiser geting the reference of Bean, why are the property editors not passed this reference..
0
ksreddyAuthor Commented:
I would like to know background design of the beans. Books does not providing the complete information about internals of beans. They dont give internal details
0
ksreddyAuthor Commented:
I would like to know background design of the beans. Books does not providing the complete information about internals of beans. They dont give internal details
0
heyhey_Commented:
properties have 'types' (in fact as far as I remember 'type' = 'Java class')

you may have a lot of beans that have propery (or even more than one property) of the same type - for Example - java.awt.Color.

so you can implement nice ColorEditor, but this editor is supposed to edit only the property value (the Color) - it does not know what's the current bean, and can't (at least SHOULD not) interact directly with the bean.

Customizer is Component that is responsible for editing the whole bean at once.

the simplest workaround (in you case) is to use a single property editor (combo)with values


Sun DES
Sun RSA
DSTC DES
...

as you can see my English is quite bad :(, so I can't present the whole architecture (I even don't know it quite well). all these opinions are based on personal experience / not a single book.

0
ksreddyAuthor Commented:
What is the use of the beancontext. How can we use that?
0
heyhey_Commented:
7 questions.

I don't know what is beancontext.
and I don't have any documentation at the moment.
0
ksreddyAuthor Commented:
What is the use of the beancontext. How can we use that?
0
heyhey_Commented:
I have posted enought information for 100 points.
and I've described one solution + one workaround of your problem.

it's time for answer.
0
ksreddyAuthor Commented:
Adjusted points to 200
0
heyhey_Commented:
> How can i notify the one property change to
> other of the same bean.

you CAN'T

use single property editor with all the pairs
Sun DES
Sun RSA
DSTC DES
...

That's you ANSWER.
0
ksreddyAuthor Commented:
I would like to know the complete architecture of the bean? How the listeneres are working? What is the bean context? where it was used?
0
heyhey_Commented:
ok
take a look at the Java Beans specification first.
that's where the 'bean architecture' is defined'

http://java.sun.com/beans/spec.html
0
heyhey_Commented:
if you have more questions, I'll be glad to help you.
0
peter_bCommented:
hahaha LOL !
0
ksreddyAuthor Commented:
What do you ment by hahaha LOL !
0
heyhey_Commented:
      > How can i notify the one property change to
       > other of the same bean.

       you CAN'T

       use single property editor with all the pairs
       Sun DES
       Sun RSA
       DSTC DES
       ...

       That's your ANSWER.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.