Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [ve-dev] Example BeanInfo classes for SWT


By "grouping" ,  do you refer to things like TRIM where it maps into a set of properties?   This is an area that  may need more iteration.


------------
Dr. Gili Mendel
IBM
Software Development
RTP Raleigh, NC
(919)543 6408, tie: 441 6408



"Scott Stanchfield" <scott@xxxxxxxxxxxx>
Sent by: ve-dev-admin@xxxxxxxxxxx

03/12/2004 11:02 AM

Please respond to
ve-dev

To
<ve-dev@xxxxxxxxxxx>
cc
Subject
RE: [ve-dev] Example BeanInfo classes for SWT





Thanks much. I'll bang on the concepts I've been working a bit this weekend.
 
I'm playing with some "grouping" concepts which might make much of this easier as well as provide some nice additional support on top of standard beans. Details soon...
 
Later!
-- Scott


From: ve-dev-admin@xxxxxxxxxxx [mailto:ve-dev-admin@xxxxxxxxxxx] On Behalf Of Joe Winchester
Sent:
Friday, March 12, 2004 10:19 AM
To:
ve-dev@xxxxxxxxxxx
Subject:
[ve-dev] Example BeanInfo classes for SWT



Folks,


Following Wednesday's discussion on BeanInfo this is the design that I believe we agreed upon to proceed with for the near term.   All of these examples are released into the CVS repository.


Style bits are defined on the BeanDescriptor by a two dimensional value with a key of "org.eclipse.ve.sweet".  The array elements are the order:
       String internalName,
       String displayName,
       Boolean isExpert,
       Object[] values.  

The values is an Object[] that contains repeating entries of
       String displayName

       String initializationString

       Integer value


The following is an example of the BeanInfo class for Button.


public
BeanDescriptor getBeanDescriptor() {
       BeanDescriptor descriptor =
new BeanDescriptor(Button.class);
       
descriptor.setValue(
           
org.eclipse.ve.sweet.stylebits",
           
new Object[] [] {
                       {
"style" , "style" , Boolean.FALSE ,  new Object[] {
                           
"PUSH" , "org.eclipse.swt.SWT.PUSH" , new Integer(SWT.PUSH) ,
                               
"CHECK" , "org.eclipse.swt.SWT.CHECK" ,  new Integer(SWT.CHECK),                                
                               
"RADIO" , "org.eclipse.swt.SWT.RADIO" , new Integer(SWT.RADIO) ,
                               
"ARROW" , "org.eclipse.swt.SWT.ARROW" , new Integer(SWT.ARROW) ,
                               
"TOGGLE" , "org.eclipse.swt.SWT.TOGGLE" , new Integer(SWT.TOGGLE)                                
                       } } ,

                       {
"textAlignment" , "textAlignment", Boolean.FALSE , new Object[] {
                               
"LEFT" , "org.eclipse.swt.SWT.LEFT" , new Integer(SWT.LEFT) ,                                        
                               
"RIGHT" , "org.eclipse.swt.SWT.RIGHT" , new Integer(SWT.RIGHT) ,
                               
"CENTER" , "org.eclipse.swt.SWT.CENTER" , new Integer(SWT.CENTER)                                
                       } },

                       {
"arrowStyle" , "arrowStyle", Boolean.FALSE , new Object[] {
                               
"UP" , "org.eclipse.swt.SWT.UP" , new Integer(SWT.UP) ,                                        
                               
"DOWN" , "org.eclipse.swt.SWT.DOWN" , new Integer(SWT.DOWN) ,
                               
"LEFT" , "org.eclipse.swt.SWT.LEFT" , new Integer(SWT.LEFT) ,
                               
"RIGHT" , "org.eclipse.swt.SWT.RIGHT" , new Integer(SWT.RIGHT)                                
                       } }

               }

       );

       // Get any other inherited style bits and merge them in

       
return descriptor;
}


For the merging there is a help called in org.eclipse.swt.beaninfo.SweetHelper with a static method


/**

* Combine all of the style bits from the descriptor's classes superclass into the descriptor
*/        
public
static void mergeSuperclassStyleBits(BeanDescriptor descriptor)

No implicit inheritance is done by the tool using the style bits, although if no style bits are found then the inheritance chain is walked to find the first BeanInfo whose BeanDescriptor does have style bits.


For single value'd style bits they are defined with just a single entry.


descriptor.setValue(

               SweetHelper.STYLE_BITS_ID,

           
new Object[] [] {                                                        
                       {
"horizontalScroll" , "horizontalScroll" , Boolean.FALSE , new Object[] {
                           
"H_SCROLL" , "org.eclipse.swt.SWT.H_SCROLL" , new Integer(SWT.H_SCROLL)                                
                       } } ,

                       {
"verticalScroll" , "verticalScroll" , Boolean.FALSE , new Object[] {
                               
"V_SCROLL" , "org.eclipse.swt.SWT.V_SCROLL" , new Integer(SWT.V_SCROLL)                                
                       } }

               }

       );


For the VE BeanInfo classes the Composite will not include the bits NO_MERGE_PAINTS, NO_BACKGROUND, NO_FOCUS, NO_DEFER_REDRAW.  These are introduced on CanvasBeanInfo.    That way all custom controls and subclasses of Composite by default will not include these style bits.


Best regards,


Joe Winchester


Back to the top