Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    How to add VLayout and HLayout subclass to Visual Builder component pallet?

    CODE shows simple subclasses that would allow for use of gwt-2.3 activities/places/history management within smartgwt. As I understand it, java classes cannot be added to the visual builder component pallet, but the following approach seemed to get close:

    http://forums.smartclient.com/showth...nent+schema%22.

    Is there a recommended approach to adding classes like these to the component pallet?

    Code:
    package com.smartgwt.client.widgets.layout;
    
    import com.google.gwt.user.client.ui.AcceptsOneWidget;
    import com.google.gwt.user.client.ui.IsWidget;
    
    public class HSimpleLayoutPanel extends HLayout implements AcceptsOneWidget{
    
      @Override
      public void setWidget(IsWidget widget) {
        clear();
        addMember(asWidgetOrNull(widget));
      }
    }
    
    package com.smartgwt.client.widgets.layout;
    
    import com.google.gwt.user.client.ui.AcceptsOneWidget;
    import com.google.gwt.user.client.ui.IsWidget;
    
    public class VSimpleLayoutPanel extends VLayout implements AcceptsOneWidget{
      @Override
      public void setWidget(IsWidget widget) {
        clear();
        addMember(asWidgetOrNull(widget));
      }
    }
    Edit: Instead of, clear(), in the above code use:

    Code:
      for (Canvas child : getChildren())
        removeChild(child);
    Last edited by wil.pannell; 12 Jul 2011, 09:19.

    #2
    This is completely supported for SmartClient. For SmartGWT, GWT technology introduces hurdles because of the lack of support for Java reflection - you cannot, for example, create a Java class based on an XML description in the palette file because there's no Class.forName(), class.newInstance() etc in GWT's subset of Java.

    You can get around this by introducing a GWT compiler extension that introduces limited reflection capabilities, such that you end up with a JavaScript API that can be called to create GWT components with specific properties. This is on our roadmap and therefore a valid Feature Sponsorship if it's a key capability for you.

    Comment


      #3
      Gotcha. As always, thanks for your thorough and authoritative reply.

      Comment

      Working...
      X