window builder pro 8.1 r35 databind bugs

SWT Designer allows you to create the views, editors, perspectives, pref pages, composites, etc. that comprise Eclipse SWT & RCP applications and plug-ins.

Moderators: Konstantin.Scheglov, gnebling, Alexander.Mitin, jwren, Eric Clayberg

window builder pro 8.1 r35 databind bugs

Postby emilio » Fri Oct 29, 2010 12:44 am

hi, after installing WBP 8.1.0 r35, i'm having serious problem with databinding. it's fresh eclipse install (3.5.2), no updates !
In the generated initDataBindings() after code reparse, some of my code is missing, specifically, the parts where i am binding comboviewers with input (writable lists). What happens is that i'm left only with latest comboviewer bininding, all the others are gone. very strange ! the undo is not working.

how can i install WBP 8.0, previous version, with the update site ?
on google code site, all i can find is "latest" update site.
tnx in advance
emilio
 
Posts: 11
Joined: Fri Oct 29, 2010 12:26 am

Re: window builder pro 8.1 r35 databind bugs

Postby Eric Clayberg » Fri Oct 29, 2010 4:54 am

We are not able to reproduce this.

Please provide a test case that illustrates the problem you are having (ideally showing the code before and after reparse).

That way we can determine whether the problem is caused by a regression in v8.1 or something else unrelated.

There is no update site available for anything other than v8.1.
Eric Clayberg
Software Engineering Manager
Google
http://code.google.com/webtoolkit/download.html

Author: "Eclipse Plug-ins"
http://www.qualityeclipse.com
Eric Clayberg
Moderator
 
Posts: 4503
Joined: Tue Sep 30, 2003 6:39 am
Location: Boston, MA USA

Re: window builder pro 8.1 r35 databind bugs

Postby emilio » Wed Nov 03, 2010 5:25 am

hi
i found out that there was some custom code in the initDataBindings(), and by looking the documentation, this procedure is for generated code only.

i removed that code, eerything is fine now.
emilio
 
Posts: 11
Joined: Fri Oct 29, 2010 12:26 am

Re: window builder pro 8.1 r35 databind bugs

Postby Eric Clayberg » Wed Nov 03, 2010 5:28 am

If you need to add any custom Data Binding code, you should be able to do it outside of that method.
Eric Clayberg
Software Engineering Manager
Google
http://code.google.com/webtoolkit/download.html

Author: "Eclipse Plug-ins"
http://www.qualityeclipse.com
Eric Clayberg
Moderator
 
Posts: 4503
Joined: Tue Sep 30, 2003 6:39 am
Location: Boston, MA USA

Re: window builder pro 8.1 r35 databind bugs

Postby emilio » Wed Nov 03, 2010 5:45 am

Eric Clayberg wrote:If you need to add any custom Data Binding code, you should be able to do it outside of that method.

ok. is there a "best practice" for that ?
i mean, i can easily put custom Data Bind code almost everywhere, but i dont want any more problems where WBP editor messes up my code.
emilio
 
Posts: 11
Joined: Fri Oct 29, 2010 12:26 am

Re: window builder pro 8.1 r35 databind bugs

Postby emilio » Wed Nov 03, 2010 6:06 am

i couldn't help my self, so i did little bit testing:

this is my initDataBindings()
Code: Select all
   protected DataBindingContext initDataBindings() {
      DataBindingContext bindingContext = new DataBindingContext();
      //
      ObservableListContentProvider listContentProvider = new ObservableListContentProvider();
      comboViewer_povjClanVrsta.setContentProvider(listContentProvider);
      //
      IObservableMap observeMap = BeansObservables.observeMap(listContentProvider.getKnownElements(), SgrDomain.class, "meaning");
      comboViewer_povjClanVrsta.setLabelProvider(new ObservableMapLabelProvider(observeMap));
      //
      comboViewer_povjClanVrsta.setInput(writableList_domainPovClnV);
      //
      return bindingContext;
   }


comboViewer_povjClanVrsta is ComboViewwer

writableList_domainPovClnV is WritableList:
Code: Select all
      this.domUtil = new DomainUtil(this.em);
      this.writableList_domainPovClnV =
         this.domUtil.getDomainEntityWritableList("POVJERENSTVO_CLAN_VRSTA");


DomainUtil gets domain data, from entity (for list of values):
Code: Select all
public class DomainUtil {

   public DomainUtil(EntityManager em) {
      this.em = em;
   }
   
   public DomainUtil(EntityManager em, Boolean praznoPolje) {
      this.praznoPolje = praznoPolje;
      this.em = em;
   }
   
   /**
    * Za naziv domene dohvaća sve vrijednosti i vraća kao WritableList (observable list)
    * Ako je definirano, dodaje na pocetak liste jedno prazno polje
    * @param domainName  naziv domene
    * @return WritableList sa vrijednostima/entitetima domene
    */
   public WritableList getDomainEntityWritableList(String domainName) {
      //dohvacam enitete domene
      Query q2 = em.createNamedQuery("SgrDomain.findAll");
      q2.setParameter("domainName", domainName);
      
      //vracam WritableList sa entitetima
      this.writableList_domainValues = new WritableList(q2.getResultList(), SgrDomain.class);
      
      if ( this.praznoPolje == true ) {
         //dodaj prazan zapis na pocetak
         SgrDomain domPrazno = new SgrDomain();
         SgrDomainPK domPKdummy = new SgrDomainPK();
         domPKdummy.setName(domainName);
         domPKdummy.setValue("");
         domPrazno.setId(domPKdummy);
         domPrazno.setMeaning("");
         this.writableList_domainValues.add(0, domPrazno);
      }
      
      return this.writableList_domainValues;
   }
   
   private EntityManager em;
   private WritableList writableList_domainValues;
   private Boolean praznoPolje = false;
   
}


What happens is that i can data bind input for comboviewer with writable list, and it works ! but when the code is reparsed, in "Bindings" tab the binding dissappears.
emilio
 
Posts: 11
Joined: Fri Oct 29, 2010 12:26 am

Re: window builder pro 8.1 r35 databind bugs

Postby Eric Clayberg » Wed Nov 03, 2010 6:21 am

Is all of the code in initDataBindings() generated by SWT Designer or was it edited by hand?

If you are able to create that binding using the tool and then it disappears on reparse, please send us a complete test case that will reproduce the problem.
Eric Clayberg
Software Engineering Manager
Google
http://code.google.com/webtoolkit/download.html

Author: "Eclipse Plug-ins"
http://www.qualityeclipse.com
Eric Clayberg
Moderator
 
Posts: 4503
Joined: Tue Sep 30, 2003 6:39 am
Location: Boston, MA USA

Re: window builder pro 8.1 r35 databind bugs

Postby emilio » Wed Nov 03, 2010 6:35 am

all the code in initDataBindings is generated
emilio
 
Posts: 11
Joined: Fri Oct 29, 2010 12:26 am

Re: window builder pro 8.1 r35 databind bugs

Postby asablin » Wed Nov 03, 2010 7:01 am

You need to mark comboViewer_povjClanVrsta as NVB (non-visual bean) for Designer include it to his component list.
Using field initializer:
Code: Select all
   private DomainUtil domUtil = new DomainUtil(em);
   /**
    * @wbp.nonvisual location=0,0
    */
   private WritableList writableList_domainPovClnV = domUtil.getDomainEntityWritableList("POVJERENSTVO_CLAN_VRSTA");
asablin
Moderator
 
Posts: 19
Joined: Thu Sep 23, 2010 3:07 am

Re: window builder pro 8.1 r35 databind bugs

Postby asablin » Wed Nov 03, 2010 7:14 am

Or conver his source to classic binding pattern:
Code: Select all
   private DomainUtil domUtil = new DomainUtil();
   private List<SgrDomain> list_domainPovClnV = domUtil
         .getDomainEntityList("POVJERENSTVO_CLAN_VRSTA");;

   protected DataBindingContext initDataBindings() {
   ...
      WritableList writableList = new WritableList(list_domainPovClnV, DataObject.class);
      comboViewer_povjClanVrsta.setInput(writableList);
   ...
   }
asablin
Moderator
 
Posts: 19
Joined: Thu Sep 23, 2010 3:07 am

Re: window builder pro 8.1 r35 databind bugs

Postby emilio » Wed Nov 03, 2010 7:19 am

asablin wrote:You need to mark comboViewer_povjClanVrsta as NVB (non-visual bean) for Designer include it to his component list.
Using field initializer:
Code: Select all
   private DomainUtil domUtil = new DomainUtil(em);
   /**
    * @wbp.nonvisual location=0,0
    */
   private WritableList writableList_domainPovClnV = domUtil.getDomainEntityWritableList("POVJERENSTVO_CLAN_VRSTA");

this does notr work ! and i cant find any docs about this.
emilio
 
Posts: 11
Joined: Fri Oct 29, 2010 12:26 am

Re: window builder pro 8.1 r35 databind bugs

Postby emilio » Wed Nov 03, 2010 7:21 am

asablin wrote:Or conver his source to classic binding pattern:
Code: Select all
   private DomainUtil domUtil = new DomainUtil();
   private List<SgrDomain> list_domainPovClnV = domUtil
         .getDomainEntityList("POVJERENSTVO_CLAN_VRSTA");;

   protected DataBindingContext initDataBindings() {
   ...
      WritableList writableList = new WritableList(list_domainPovClnV, DataObject.class);
      comboViewer_povjClanVrsta.setInput(writableList);
   ...
   }

i dont want to mess up with generated code, other people will be working on this project, so it can lead to complete mess.
emilio
 
Posts: 11
Joined: Fri Oct 29, 2010 12:26 am

Re: window builder pro 8.1 r35 databind bugs

Postby asablin » Wed Nov 03, 2010 7:34 am

This example work fine.
Code: Select all
public class Composite_test extends Composite {

   public static class DomainUtil {
      public DomainUtil() {
      }

      public WritableList getDomainEntityWritableList(String domainName) {
         return null; // fake
      }
   }

   public static class SgrDomain {
      private String meaning;

      public void setMeaning(String meaning) {
         this.meaning = meaning;
      }

      public String getMeaning() {
         return meaning;
      }
   }

   private DataBindingContext m_bindingContext;
   private ComboViewer comboViewer_povjClanVrsta;
   private DomainUtil domUtil = new DomainUtil();
   private WritableList writableList_domainPovClnV = domUtil
         .getDomainEntityWritableList("POVJERENSTVO_CLAN_VRSTA");

   /**
    * Create the composite.
    *
    * @param parent
    * @param style
    */
   public Composite_test(Composite parent, int style) {
      super(parent, style);

      comboViewer_povjClanVrsta = new ComboViewer(this, SWT.NONE);
      Combo combo = comboViewer_povjClanVrsta.getCombo();
      combo.setBounds(10, 10, 91, 23);

      m_bindingContext = initDataBindings();

   }

   @Override
   protected void checkSubclass() {
      // Disable the check that prevents subclassing of SWT components
   }

   protected DataBindingContext initDataBindings() {
      DataBindingContext bindingContext = new DataBindingContext();
      //
      ObservableListContentProvider listContentProvider = new ObservableListContentProvider();
      comboViewer_povjClanVrsta.setContentProvider(listContentProvider);
      //
      IObservableMap observeMap = BeansObservables.observeMap(
            listContentProvider.getKnownElements(), SgrDomain.class,
            "meaning");
      comboViewer_povjClanVrsta
            .setLabelProvider(new ObservableMapLabelProvider(observeMap));
      //
      comboViewer_povjClanVrsta.setInput(writableList_domainPovClnV);
      //
      return bindingContext;
   }
}
asablin
Moderator
 
Posts: 19
Joined: Thu Sep 23, 2010 3:07 am

Re: window builder pro 8.1 r35 databind bugs

Postby emilio » Wed Nov 03, 2010 10:20 am

i tried, it works, i reparsed it once - ok.
i reparsed it second time - it stops showing in binding list.

i've tried on 8.0, amd Instantiations WBP 7.6, all of my code works.
emilio
 
Posts: 11
Joined: Fri Oct 29, 2010 12:26 am

Re: window builder pro 8.1 r35 databind bugs

Postby asablin » Thu Nov 04, 2010 5:00 am

Give this a try using the latest SWT Designer 8.1 build...

http://code.google.com/javadevtools/dow ... -beta.html
asablin
Moderator
 
Posts: 19
Joined: Thu Sep 23, 2010 3:07 am

Next

Return to SWT Designer

Who is online

Users browsing this forum: Bing [Bot] and 1 guest

cron