Re: Stack Panel change handlers

2010-08-05 Thread Jero
Hello! I have the same problem..but i found this can not implementd..
can body help me please!!! :)



public class StackComponent extends StackLayoutPanel implements
HasChangeHandlers {

public StackComponent(Unit unit) {
super(unit);
}

@Override
public void showWidget(Widget widget) {
super.showWidget(widget);
fireEvent(new StackChangeEvent(widget));

}

@Override
public HandlerRegistration addChangeHandler(ChangeHandler handler) {
return addDomHandler(handler, ChangeEvent.getType());
}

}



this code is this page:
http://stackoverflow.com/questions/1890432/fire-event-when-switching-stacks-of-stacklayoutpanel-in-gwt-2-0



Greetings!





On Jul 13, 4:12 pm, Ali ali.a.sa...@gmail.com wrote:
 Hi,
 I am using a StackPanel (called leftStackPanel in code) in my
 application and in order to respond to Click events on this stack
 panel, I have coded the following and it works fine. But classes
 SourcesChangeEvents, ChangeListenerCollection, and ChangeListener are
 deprecated. I tried to use alternative new classes like
 HasChangeHandlers instead, but I wasn't able to code this with new
 classes. Can anyone help me with this?

 StackPanel  leftStackPanel = new LeftStackPanel();
 StackPanelListener stackListener = new StackPanelListener();
 leftStackPanel.addChangeListener(stackListener);

 //inner class
 class LeftStackPanel extends StackPanel implements
 SourcesChangeEvents{
                 ChangeListenerCollection clc;
                 int current;
                 public LeftStackPanel(){
                         clc = new ChangeListenerCollection();
                 }

                 public void showStack( int index ) {
                         int visibleStack = index;
                         int oldVisibleStack = visibleStack;
                           super.showStack(index);
                           if (oldVisibleStack != visibleStack  clc != null) 
 {
                             clc.fireChange(this);
                           }
             super.showStack( index );
             current = index;
             clc.fireChange( this );
         }

                 public int getCurrent() {
              return current;
         }

                 @Override
                 public void addChangeListener(ChangeListener cl) {
                         // TODO Auto-generated method stub
                         clc.add( cl );

                 }

                 @Override
                 public void removeChangeListener(ChangeListener cl) {
                         // TODO Auto-generated method stub
                         clc.remove( cl );
                 }

                 /*public void onBrowserEvent(Event event){
                         super.onBrowserEvent(event);
                         //if(event.)
                         if (event.getTypeInt()== event.ONCLICK){
                                 int selectedIndex = this.getSelectedIndex();

                         }
                 }*/
         }

         //inner class
         class StackPanelListener implements ChangeListener{

                 @Override
                 public void onChange(Widget sender) {
                         int current = ((LeftStackPanel)sender).getCurrent();
                         System.out.println(index:  + current);

                 }

         }

-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To post to this group, send email to google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



RE: Stack Panel

2008-12-21 Thread Ananda
Thanks Ajay..

 

From: Google-Web-Toolkit@googlegroups.com
[mailto:google-web-tool...@googlegroups.com] On Behalf Of ajay jetti
Sent: Saturday, December 20, 2008 1:10 PM
To: Google-Web-Toolkit@googlegroups.com
Subject: Re: Stack Panel

 

Try Using .gwt-StackPanelContent tag and use a background:your-color for
changing the color.



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~--~~~~--~~--~--~---



Re: Stack Panel

2008-12-19 Thread ajay jetti
Try Using .gwt-StackPanelContent tag and use a background:your-color for
changing the color.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~--~~~~--~~--~--~---