开发者

New style for a new GWT component

开发者 https://www.devze.com 2023-02-05 04:21 出处:网络
I am using SmartGWT 2.4, and I have two 开发者_开发百科types of TabSet(s), each one has a different look and feel, and I am facing a problem implementing that.

I am using SmartGWT 2.4, and I have two 开发者_开发百科types of TabSet(s), each one has a different look and feel, and I am facing a problem implementing that.

The new TabSet has been implemented as the following :

public class MainTabSet extends TabSet{
    public MainTabSet(){
        super.setStylePrimaryName("MainTabSet");
        build();
    }

    private void build(){
        setMargin(6);
        setWidth100();
        setHeight100();  
        setStyleName("nt-main-tabset");
        Tab inboxTab = new Tab("Inbox");
        inboxTab.setPane(new InboxPane().get());
     }
}

based on the last paragraph (Multiple looks for the same component type) here :

I've defined a new class that holds the same primary name I used above :

isc.defineClass("MainTabSet", "TabSet");

and then I've added some properties to it :

    isc.MainTabSet.addProperties({
        tabBarThickness:100,
        scrollerButtonSize:100,
        pickerButtonSize:100,

        symmetricScroller:false,
        symmetricPickerButton:false,

        scrollerSrc:"nothing",
        pickerButtonSrc:"nothingg",

        closeTabIconSize:100
    })

The code above has been written at the top of section 6 (TabSet) in load_skin.js file.

Now, I am still getting the same old TabSet look and feel in MainTabSet.

my Questions now are :

  1. did I follow the right steps to achieve my goal ?

  2. how could I consider new classes to some sub elements of TabSet -like TabBar- but only for the new component (MainTabSet)?

Thank you guys.


According to last paragraph of the article that you have mentioned, you were suppose to call setScClassName("MainTabSet") to apply smartClient's js class to your java class. I think that should be something like this:

public class MainTabSet extends TabSet{
    public MainTabSet(){
        setScClassName("MainTabSet");
        build();
    }

    private void build(){
        setMargin(6);
        setWidth100();
        setHeight100();  
        setStyleName("nt-main-tabset");
        Tab inboxTab = new Tab("Inbox");
        inboxTab.setPane(new InboxPane().get());
     }
}
0

精彩评论

暂无评论...
验证码 换一张
取 消