1. #1
    eyez
    Guest

    Default ContentPanel, delete and add new widgets

    ContentPanel, delete and add new widgets


    `Hello everybody,

    I´m trying to do a simple thing, but I still do something wrong..
    So here is my problem: I have a ContentPanel with another panel in it, the panel is showing something like a profile site.. I have two buttons(one for "my profile" and the second for "another profile") and I want when you click on the button second button, to show anotherProfile (which is another class) - but then it just deletes everything from the contentpanel and its not showing the new widget..

    Also if I click on "my profile" everything disappears and its not showing my profile again.. what is my mistake (I didnt copy some uneccesary things) :


    public class ProfileView extends LayoutContainer {



    @Override
    protected final void onRender(final Element parent, final int index) {

    super.onRender(parent, index);
    setScrollMode(Scroll.AUTOY);

    content = new ContentPanel();


    navigationPnl = new ContentPanel();
    navigationPnl.setHeaderVisible(false);
    navigationPnl.setSize(800, 40);
    add(navigationPnl);

    add(content);
    showMyProfile(); // at the beginning this is working..but the first time I click on a button, it doesnt

    myProfile = new Button("My Profile", new ClickHandler() {

    @Override
    public void onClick(final ClickEvent event) {

    showMyProfile();

    }
    });

    teachProfile = new Button("Other Profile", new ClickHandler() {

    @Override
    public void onClick(final ClickEvent event) {

    showOtherProfile();

    }
    });


    navigationPnl.add(myProfile);
    navigationPnl.add(otherProfile);


    public void showMyProfile() {

    content.removeAll();
    content.add(new MyProfile());
    repaint();

    public void showOtherProfile() {


    content.removeAll();
    content.add(new OtherProfile());
    repaint();
    }
    }

    }

    MyProfile and OtherProfile are another two classes which are just ContentPanels ...

  2. #2
    Ext GWT Premium Member
    Join Date
    Aug 2010
    Location
    Germany, Solingen
    Posts
    239
    Vote Rating
    2
    gishmo is on a distinguished road

      0  

    Default


    try: content.layout(); instead of repaint();

  3. #3
    eyez
    Guest

    Default


    It is working. thank you.. but its really slow :S.. is they maybe another way to do it or why is it sooo slow :S

  4. #4
    Ext GWT Premium Member
    Join Date
    Aug 2010
    Location
    Germany, Solingen
    Posts
    239
    Vote Rating
    2
    gishmo is on a distinguished road

      0  

    Default


    Did you compile your code?

  5. #5
    eyez
    Guest

    Default


    yes I compiled it.. I think I found a solution.. btw one more question, do you maybe know how to get the text from a TextArea and "put" a text in the area - which can then be modified (for example you have a name on your profile saved..and you wwant to change your name..then I wanted a textarea to apear with the old name in it and then it can be changed)?? I was searching through the methods but I didn´t see any..

Thread Participants: 1

Tags for this Thread