SectionStackSection - Handler

Hello,

I would like to use the SectionStack as a menu on the left side of my webpage.
Is it possible to add a handler that will be invoked every time the + symbol is pressed. I need this function to set/change a canvas outside of the SectionStack.

Thanks a lot for your help
Ludi

There does not seem to be a handler for exapnd/collapse of a SectionStackSection.
IMHO, this should be added as an RFE if I am correct in my assumption.

As a workaround, you could add a DrawHandler to the Canvas for the SectionStackSection such that when it is first drawn (shown) you could perform any initialization you wish. Here is a sample of how to put inititalization code based on first drawing:

public class MyCanvas extends Canvas {

    boolean initialized=false;
	public MyCanvas() {
        this.addDrawHandler(new DrawHandler() {
            public void onDraw(DrawEvent event) {
                if (!initialized) {
                    initComponents();
                }
            }
        });
	}

    protected void initComponents() {
        //Do side effects here...
        initialized = true;
    }
}

Good luck.

I tried your solution with the DrawHandler already.

I need to have an handler that invokes an event every time the SectionStackSection will be expanded! With the DrawHandler only the first time the onDraw method will be invoked.
I would like to replace a different layout beside the StackSection.

Do you have any other idea?

Perhaps addFocusChangedHandler(FocusChangedHandler handler) might help?

SectionStack.addSectionHeaderClickHandler is now in SVN. The event is fired when the user clicks on a section header. SectionHeaderClickEvent.getSection() will return the section header that was clicked.

Sanjiv

Hello

Where can I get the latest jar file for this fix.

Thanks

Download SmartGWT 1.1 which was just released.

Hello

I have implemented “SectionStack.addSectionHeaderClickHandler” in my code. I am getting this following error. I am using the latest released 1.1 jar file

Uncaught JavaScript exception [java.lang.ClassCastException: com.smartgwt.client.widgets.layout.SectionStackSection
	at com.smartgwt.client.widgets.BaseWidget.getRef(BaseWidget.java:116)
	at com.smartgwt.client.widgets.layout.SectionHeader.getOrCreateRef(SectionHeader.java:66)
	at com.smartgwt.client.widgets.layout.events.SectionHeaderClickEvent.getSection(Native Method)
	at com.example.test.client.gui.MainPanel$2.onSectionHeaderClick(MainPanel.java:164)
	at com.smartgwt.client.widgets.layout.events.SectionHeaderClickEvent.dispatch(SectionHeaderClickEvent.java:97)
	at com.smartgwt.client.widgets.layout.events.SectionHeaderClickEvent.dispatch(SectionHeaderClickEvent.java:1)
	at com.google.gwt.event.shared.HandlerManager$HandlerRegistry.fireEvent(HandlerManager.java:65)
	at com.google.gwt.event.shared.HandlerManager$HandlerRegistry.access$1(HandlerManager.java:53)
	at com.google.gwt.event.shared.HandlerManager.fireEvent(HandlerManager.java:178)
	at com.smartgwt.client.widgets.BaseWidget.fireEvent(BaseWidget.java:66)] in http://localhost:8888/Test/hosted.html?test, line 9

Here is my code

         sectionStack2.addSectionHeaderClickHandler(new SectionHeaderClickHandler() {
		
			public void onSectionHeaderClick(SectionHeaderClickEvent event) {
				SectionHeader section = event.getSection(); //Here I get ClassCastException
			}
		
		});

Please correct me if I am wrong.

Thanks

Are there any one who can explain me about this issue?

I’ll look into this.

I had the same problem.
The <code>setSectionHeaderClass(String className)</code> does not work either. I try to (re-)create an example which creates the exception…

Hello Sanjiv,

Thanks for looking in to it.

Were you able to replicate this issue. Can you please give me an update on this?

Thanks

I haven’t heard back anything regarding SectionHeaderClickHandler. Please tell me.

Fixed in SVN.