showing properties for a list of items [message #168476] |
Wed, 16 February 2005 07:20  |
Eclipse User |
|
|
|
Originally posted by: alan.battersby.ntu.ac.uk
I am new to gef and still on a steep learning curve and also this question
is probably not gef specific please forgive my ignorance.
I have a Declaration class that contains a list of variable declarations.I
have also created a Variable class containing name,type and initialvalue
that implements the IPropertySource interface. Displaying one variable
defined alone, is not a problem.
When the DeclarationPart is selected I want the list off all variables
declared to appear in the properties window. One variable per line showing
name,type and initial value all to be editable. I assume that I must
create a DeclarationPropertySource class that iterates through the list but
am not sure how to start. I looked at the examples for flow, shapes and
logic but was unable to see anything similar to what I require.
Firstly is this possible? If so how do I go about it ? Is there something
in the examples above that I missed?
Thanks
Alan
|
|
|
|
|
Re: showing properties for a list of items [message #168571 is a reply to message #168548] |
Wed, 16 February 2005 15:30  |
Eclipse User |
|
|
|
Originally posted by: Lamont_Gilbert.rigidsoftware.com
Alan Battersby wrote:
> CL [dnoyeb] Gilbert wrote:
>
>> Alan Battersby wrote:
>>
>>> I am new to gef and still on a steep learning curve and also this
>>> question
>>> is probably not gef specific please forgive my ignorance.
>>> I have a Declaration class that contains a list of variable
>>> declarations.I
>>> have also created a Variable class containing name,type and initialvalue
>>> that implements the IPropertySource interface. Displaying one variable
>>> defined alone, is not a problem.
>>> When the DeclarationPart is selected I want the list off all variables
>>> declared to appear in the properties window. One variable per line
>>> showing
>>> name,type and initial value all to be editable. I assume that I must
>>> create a DeclarationPropertySource class that iterates through the
>>> list but
>>> am not sure how to start. I looked at the examples for flow, shapes and
>>> logic but was unable to see anything similar to what I require.
>>>
>>> Firstly is this possible? If so how do I go about it ? Is there
>>> something
>>> in the examples above that I missed?
>>>
>>> Thanks
>>>
>>> Alan
>>
>>
>>
>> yes its possible. you just return an array of property descriptors.
>> I learned how to do it from the examples, so its in there. If I can,
>> ill post some example code.
>>
>> CL
>
> I would appreciate an example. I have looked at examples again but
> cannot see any item that when selected show a list of items and
> properties viz
>
> Item 1
> Prop 1 value 1
> Prop 2 value
> ...
> Item 2
> Prop 1 value
> Prop 2 value
> ...
> Item 3
> etc
>
> So any code example would be greatly appreciated.
>
> Alan
One property source can return another property source as its value
instead of returning an int for instance. that property source can have
an array of descriptors, and a corresponding value for each one.
public Object getPropertyValue(Object id){
if(MyProperty.equals(id){
return new InteratingPropertySource(mystuff);
}
else return super.get....
}
class IteratingPropertySource{
public IPropertyDescriptor [] getPropertyDescritpros(){
for(int x=0;x < props.length;x++){
SubPropDescrip pd = new SubPropDescrip("Prop"+x,"value");
SubPropDescrip sps[x] = pd;
}
return sps;
}
public Object getPropertyValue(Object id){
for(int x=0;x<props.length;x++){
if(id.equals("Prop"+x)){
return new ValueSource(props[x]);
}
}
return null;
}
}
ValueSource is a simple source with a prop and a value.
if that does not help any send me an email and ill send u some files as
my email is on linux but my code is on windows mainly...
CL
|
|
|
Powered by
FUDForum. Page generated in 0.09063 seconds