Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

"Notify Property Change"

Posted on 1999-07-15
25
Medium Priority
?
371 Views
Last Modified: 2013-11-23
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.
0
Comment
Question by:ksreddy
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 13
  • 11
25 Comments
 
LVL 16

Expert Comment

by:heyhey_
ID: 1246102
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
 

Author Comment

by:ksreddy
ID: 1246103
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
 
LVL 16

Expert Comment

by:heyhey_
ID: 1246104
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:ksreddy
ID: 1246105
What is the use of listeners support in the editors.
0
 
LVL 16

Expert Comment

by:heyhey_
ID: 1246106
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
 
LVL 16

Expert Comment

by:heyhey_
ID: 1246107
>> 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
 

Author Comment

by:ksreddy
ID: 1246108
For a single bean howmany customizers we can have?
0
 
LVL 16

Expert Comment

by:heyhey_
ID: 1246109
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
 
LVL 16

Expert Comment

by:heyhey_
ID: 1246110
you have a lot of questions :)
0
 

Author Comment

by:ksreddy
ID: 1246111
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
 

Author Comment

by:ksreddy
ID: 1246112
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
 

Author Comment

by:ksreddy
ID: 1246113
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
 
LVL 16

Expert Comment

by:heyhey_
ID: 1246114
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
 

Author Comment

by:ksreddy
ID: 1246115
What is the use of the beancontext. How can we use that?
0
 
LVL 16

Expert Comment

by:heyhey_
ID: 1246116
7 questions.

I don't know what is beancontext.
and I don't have any documentation at the moment.
0
 

Author Comment

by:ksreddy
ID: 1246117
What is the use of the beancontext. How can we use that?
0
 
LVL 16

Expert Comment

by:heyhey_
ID: 1246118
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
 

Author Comment

by:ksreddy
ID: 1246119
Adjusted points to 200
0
 
LVL 16

Expert Comment

by:heyhey_
ID: 1246120
> 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
 

Author Comment

by:ksreddy
ID: 1246121
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
 
LVL 16

Expert Comment

by:heyhey_
ID: 1246122
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
 
LVL 16

Expert Comment

by:heyhey_
ID: 1246123
if you have more questions, I'll be glad to help you.
0
 

Expert Comment

by:peter_b
ID: 1246124
hahaha LOL !
0
 

Author Comment

by:ksreddy
ID: 1246125
What do you ment by hahaha LOL !
0
 
LVL 16

Accepted Solution

by:
heyhey_ earned 400 total points
ID: 1246126
      > 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

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
The viewer will learn how to implement Singleton Design Pattern in Java.
Suggested Courses

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question