Perfect. Thanks.

________________________________

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Daniel Grob
Sent: Montag, 30. April 2007 11:44
To: [email protected]
Subject: Re: [ULC-developer] Using ULCLookupField as table cell editor


Hi John,

In ULC, all cell renderers and editors need to implement the
ICellComponent interface. The methods of this interface define the
behavior of the component when used as a cell renderer or cell editor.
But why you can use the ULCLookupTextField as editor without
implementing this interface? This is because ULCLookupTextField already
indirectly implements the ICellComponent interface because its
superclass ULCTextField implements it. This also explains why you get a
simple ULCTextField instead of a ULCLookupTextField as editor.

To use the ULCLookupTextField as editor you need to correctly implement
the methods of the ICellComponent interface:


*       public void copyAttributes(ICellComponent source);
        Copy the relevant visual attributes from the source object to
this object (= the template object).
        
*       public boolean areAttributesEqual(ICellComponent component);
        Check if the relevant visual attributes are equals between this
object and the component object.
        
*       public int attributesHashCode();
        Calculate the hash code for the relevant visual attributes.
        


The following postings on the developer list might help you:


*
http://lists.canoo.com/mailman/private/ulc-developer/2004/001034.html
        Shows how to implement the ICellComponent interface for the
progress bar. 
*
http://lists.canoo.com/mailman/private/ulc-developer/2005/002596.html
        Shows how to implement the ICellComponent interface for the
slider. 
*
http://lists.canoo.com/mailman/private/ulc-developer/2005/003334.html
        Shows how to implement the ICellComponent interface for the date
component from the community.
        


Regards Dany



Prince John, Bedag wrote: 

        Hi, 

        I am trying to use a ULCLookupTextField as an editor in a
ULCTable, but without success. The lookup field works fine standalone,
but inside the table I just get a text field. I have tried adding it as
a parameter to a DefaultCellEditor:

        mHeimatortTable.getColumnModel().getColumn(1).setCellEditor( 
                    new
DefaultCellEditor(GUIUtils.createKonstanteDropDown(Nation.getEnumCollect
ion(), 
                        getLocale(), true))); 


        And I tried writing a custom cell editor 

        public class PLZCellEditor 
            extends DefaultCellEditor 
        { 
            private static final long serialVersionUID =
-5383602841474707283L; 

            public PLZCellEditor(ULCLookupTextField editor) 
            { 
                super(editor); 
            } 

            @Override 
            public IEditorComponent getTableCellEditorComponent(ULCTable
table, Object value, int row) 
            { 
                return getEditorComponent(); 
            } 
        } 

        Neither works. Anyone have any ideas? (A ComboBox works fine in
the same table) 

        With best wishes 

        John Prince 


        John Prince
        Bedag Informatik AG
        Software-Entwicklung
        Gutenbergstrasse 1
        3011 Bern 
        Telefon:        +41 (0)31 633 21 21 (direkt 633 22 25)
        Fax:            +41 (0)31 633 25 55
        E-Mail:         mailto:[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]> 
        www.bedag.ch <file://www.bedag.ch> 
        



_______________________________________________ ULC-developer mailing
list [email protected]
http://lists.canoo.com/mailman/listinfo/ulc-developer 

Reply via email to