Hi Janak,

Thanks so much for your help!  It works perfectly!

Thanks!

Elizabeth Kliman, B.Sc., SCJP
Developer / Développeur
Information Technology / Technologie de l'information 
Farm Credit Canada / Financement agricole Canada 
1800 Hamilton Street, P.O. Box 4320 
1800, rue Hamilton, C.P. 4320 
Regina SK S4P 4L3 
Tel/Tél. : (306) 780-3382 Fax/Télec. : (306) 780-5655 
E-mail/Courriel : [EMAIL PROTECTED]
Agriculture. It's all we do. L'agriculture... notre raison d'être. 
This message may contain information that is privileged, protected, 
confidential or subject to copyright. Using, disclosing, copying or 
distributing such information by anyone other than the intended recipient is 
strictly prohibited. If you've received this message in error, please delete it 
and notify me immediately.
Le présent courriel contient des renseignements de nature privilégiée, 
protégée, confidentielle ou assujettie à des droits d'auteur. Toute 
utilisation, communication, reproduction ou distribution de l'information 
contenue dans ce courriel par toute personne autre que le destinataire visé est 
strictement interdite. Si vous avez reçu ce courriel par erreur, veuillez le 
supprimer et m'en informer immédiatement.


-----Original Message-----
From: Janak Mulani [mailto:[EMAIL PROTECTED]
Sent: January 9, 2007 7:02 AM
To: Kliman, Elizabeth
Cc: [email protected]
Subject: RE: [ULC-developer] Scroll Pane


Hi Elizabeth,

You deploy your application as a portlet. When you do refresh or switch
tabs, the application is paused and resumed. When resuming, the state of the
UI at the time of pause is uploaded. Note that the widgets on the server
side are not instantiated again, they are just uploaded.

In your ScrollPane, the mouseWheelScrolling attribute is enabled/disabled in
the constructor but the state of mouseWheelScrolling is not sent to the
client during upload. In you case mouseWheelScrolling sent to the client by
a method invocation (invokeUI) in the ctr of MyScrollPane. This does not
help when resuming the ULC App, because the widget is not instatiated, it is
just uploaded.

I assume that mouseWheelScrolling is configured only at the time of creating
a scroll pane. Given this, you need to modify your code as follows:

public class MyScrollPane extends ULCScrollPane {
        private boolean mouseWheelScrolling = true;

        protected void uploadStateUI() {
                super.uploadStateUI();
                setStateUI("mouseWheelScrolling", mouseWheelScrolling);
        }

        public MyScrollPane(ULCComponent aViewPortView, boolean
aMouseWheelScrolling) {
                super(aViewPortView);
                mouseWheelScrolling = aMouseWheelScrolling;
        }

        protected String typeString() {
                return "UIMyScrollPane";
        }
}

----------------

public class UIMyScrollPane extends UIScrollPane {
        private boolean mouseWheelScrolling = true;

        protected void postInitializeState() {
                super.postInitializeState();
                if (!mouseWheelScrolling) {
                        JScrollPane scrollpane = (JScrollPane) getBasicObject();
                        MouseWheelListener[] listeners = scrollpane
                                        .getMouseWheelListeners();
                        for (int i = 0; i < listeners.length; i++) {
                                MouseWheelListener mouseWheelListener = 
listeners[i];
                                
scrollpane.removeMouseWheelListener(mouseWheelListener);
                        }
                }
        }

        public void setMouseWheelScrolling(boolean aMouseWheelScrolling) {
                this.mouseWheelScrolling = aMouseWheelScrolling;
        }
}

I hope this helps. Let me know.

Thanks and regards,

Janak

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Kliman, Elizabeth
Sent: Saturday, January 06, 2007 1:41 AM
To: ULC Developer List (E-mail)
Subject: [ULC-developer] Scroll Pane


Hi,
We have a situation where we've got a scroll pane nested within a scroll
pane.  We customized the scrollpane to be able to turn the mouse wheel
scrolling off for the inner scroll pane so that when the mouse is over the
inner scroll pane, it continues to scroll the outer scroll pane instead of
getting stuck inside the inner scroll pane.  Our application is deployed in
a portal.  This works as intended until the user hits the browser refresh
button or until the user switches tabs in the portal.  When the screen
refreshes with the ULC application, the mouse now scrolls in the inner
scroll pane, thus causing it to look stuck when attempting to scroll in the
outer scroll pane.
Is there any way I can prevent the mouse wheel scrolling from coming back
into the inner scroll pane when the browser is refreshed?
Here is the code we are using to implement the scroll panes.  I've edited
out the non-significant code and just left the code used for disabling the
mouse wheel scrolling, but as I said before, this code works just fine until
the browser refreshes the ULC application.  The outer scroll pane is created
with the second parameter as true and the inner scroll pane is created with
the second parameter as false.


package ca.fcc.ulc.application;
import ca.fcc.ulc.shared.WidgetStyles;
import com.ulcjava.base.application.ULCComponent;
import com.ulcjava.base.application.ULCScrollPane;
import com.ulcjava.base.application.util.Color;
public class MyScrollPane extends ULCScrollPane implements WidgetStyles {
        private boolean mouseWheelScrolling = true;

        public FccScrollPane(ULCComponent aViewPortView, boolean
aMouseWheelScrolling) {
                this(aViewPortView);
                setMouseWheelScrolling(aMouseWheelScrolling);
                configureMouseWheelScrolling();
        }

        private void configureMouseWheelScrolling(){
                if (!isMouseWheelScrolling()){
                        upload();
                        invokeUI("disableMouseWheelScrolling");
                }
        }

        protected String typeString() {
                return "ca.fcc.ulc.client.UIMyScrollPane";
        }

        private boolean isMouseWheelScrolling() {
                return mouseWheelScrolling;
        }
        private void setMouseWheelScrolling(boolean aMouseWheelScrolling) {
                mouseWheelScrolling = aMouseWheelScrolling;
        }
}
_________________________________________________________________________


package ca.fcc.ulc.client;
import java.awt.Color;
import java.awt.event.MouseWheelListener;
import javax.swing.JScrollPane;
import com.ulcjava.base.client.UIScrollPane;
public class UIMyScrollPane extends UIScrollPane {
        public void disableMouseWheelScrolling(){
                JScrollPane scrollpane = (JScrollPane)getBasicObject();
                MouseWheelListener[] listeners =
scrollpane.getMouseWheelListeners();
                for (int i = 0; i < listeners.length; i++) {
                        MouseWheelListener mouseWheelListener =
listeners[i];
                        scrollpane.removeMouseWheelListener(mouseWheelListen
er);
                }
        }
}
Thanks!
Elizabeth Kliman, B.Sc., SCJP
Developer / Développeur
Information Technology / Technologie de l'information
Farm Credit Canada / Financement agricole Canada
1800 Hamilton Street, P.O. Box 4320
1800, rue Hamilton, C.P. 4320
Regina SK S4P 4L3
Tel/Tél. : (306) 780-3382 Fax/Télec. : (306) 780-5655
E-mail/Courriel : [EMAIL PROTECTED]
Agriculture. It's all we do. L'agriculture... notre raison d'être.
This message may contain information that is privileged, protected,
confidential or subject to copyright. Using, disclosing, copying or
distributing such information by anyone other than the intended recipient is
strictly prohibited. If you've received this message in error, please delete
it and notify me immediately.
Le présent courriel contient des renseignements de nature privilégiée,
protégée, confidentielle ou assujettie à des droits d'auteur. Toute
utilisation, communication, reproduction ou distribution de l'information
contenue dans ce courriel par toute personne autre que le destinataire visé
est strictement interdite. Si vous avez reçu ce courriel par erreur,
veuillez le supprimer et m'en informer immédiatement.

_______________________________________________
ULC-developer mailing list
[email protected]
http://lists.canoo.com/mailman/listinfo/ulc-developer

Reply via email to