You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by "Bertrand, Shawn R" <sh...@tycoelectronics.com> on 2007/07/24 22:38:20 UTC

[Trinidad] JSF components and div scroll position

I've taken my tree component and added some CSS to enable a scroll bar
around it when it becomes large enough:

 

            inlineStyle="width: 200px; height: 400px; max-height: 400px;
overflow: auto; ....

 

This works well, but as I expand and collapse nodes in the tree, the
scroll position isn't maintained due to the component being thrown out
and reconstructed via PPR.  I wish there was an onscroll on the tree, as
this would give me the hook I need to save the position and I could
restore it via window.onload, but to no avail.

 

Does anyone have an idea how this might be done?

 

Thanks in advance,

 

Shawn Bertrand

Tyco Electronics

 


RE: [Trinidad] JSF components and div scroll position

Posted by "Bertrand, Shawn R" <sh...@tycoelectronics.com>.
Yes, from the get-go I had put that in because I recall having that
problem in the past.

 

Thanks for the suggestion,

 

Shawn

 

 

________________________________

From: Simon Lessard [mailto:simon.lessard.3@gmail.com] 
Sent: Wednesday, July 25, 2007 3:11 PM
To: MyFaces Discussion
Subject: Re: [Trinidad] JSF components and div scroll position

 

Hello,

It's probably not the problem, but do you have a default constructor in
your component class?

On 7/25/07, Bertrand, Shawn R < shawn.bertrand@tycoelectronics.com
<ma...@tycoelectronics.com> > wrote:

Sounds good - a very cool extension indeed.

 

So for the time being, I'm trying to implement a custom component that
extends CorePanelGroupLayout with the ability to specify an onscroll
handler.

 

I have all the necessary parts (component, renderer, taglib, <component>
and <renderkit> entries, with first 3 subclassing the necessary
classes), but I keep getting an exception when the component is called
to instantiate:

 

javax.faces.FacesException: Can't instantiate class:
'com.macom.wsbu.uas.web.faces.component.PanelGroup'.

 
com.sun.faces.application.ApplicationImpl.newThing(ApplicationImpl.java:
728)

 
com.sun.faces.application.ApplicationImpl.createComponent(ApplicationImp
l.java:352)

 
javax.faces.webapp.UIComponentTag.createComponent(UIComponentTag.java:10
13)

 
javax.faces.webapp.UIComponentTag.createChild(UIComponentTag.java:1036)

 
javax.faces.webapp.UIComponentTag.findComponent(UIComponentTag.java:749)

 
javax.faces.webapp.UIComponentTag.doStartTag(UIComponentTag.java:429)

 

I've double and triple checked file locations and package names, and
nothing out in web land suggests anything helpful.  I already have a
custom component extended from UIXComponentBase that is working
beautifully.  Any restrictions with doing this that you know about?
Probably something simple that I've overlooked.

 

Thanks in advance,

 

Shawn

 

 

-----Original Message-----
From: Adam Winer [mailto:awiner@gmail.com] 
Sent: Tuesday, July 24, 2007 5:37 PM
To: MyFaces Discussion
Subject: Re: [Trinidad] JSF components and div scroll position

 

Once we get 1.0.2 out (hopefully soon) let's look at providing

some hooks for DOM replacement during AJAX, something

where you get called with something like:

 

  // Tellls you that oldDom is about to be replaced with newDom,

  // and lets you manipulate the dom, or return "true" to block

  // it or handle it all yourself

  function domReplaceNotify(oldDom, newDom)

  {

    ... see if oldDom contains the tree...

    ... if it does, copy scrollTop and scrollLeft into newDom

    // And let the system handle the move for you

    return false;

  }

 

-- Adam

 

 

On 7/24/07, Bertrand, Shawn R <sh...@tycoelectronics.com>
wrote:

> 

> I've taken my tree component and added some CSS to enable a scroll bar

> around it when it becomes large enough:

> 

> 

> 

>             inlineStyle="width: 200px; height: 400px; max-height:
400px;

> overflow: auto; ....

> 

> 

> 

> This works well, but as I expand and collapse nodes in the tree, the
scroll

> position isn't maintained due to the component being thrown out and

> reconstructed via PPR.  I wish there was an onscroll on the tree, as
this

> would give me the hook I need to save the position and I could restore
it

> via window.onload, but to no avail.

> 

> 

> 

> Does anyone have an idea how this might be done?

> 

> 

> 

> Thanks in advance,

> 

> 

> 

> Shawn Bertrand

> 

> Tyco Electronics

> 

> 

 


Re: [Trinidad] JSF components and div scroll position

Posted by Simon Lessard <si...@gmail.com>.
Hello,

It's probably not the problem, but do you have a default constructor in your
component class?

On 7/25/07, Bertrand, Shawn R <sh...@tycoelectronics.com> wrote:
>
>  Sounds good - a very cool extension indeed.
>
>
>
> So for the time being, I'm trying to implement a custom component that
> extends CorePanelGroupLayout with the ability to specify an onscroll
> handler.
>
>
>
> I have all the necessary parts (component, renderer, taglib, <component>
> and <renderkit> entries, with first 3 subclassing the necessary classes),
> but I keep getting an exception when the component is called to instantiate:
>
>
>
> javax.faces.FacesException: Can't instantiate class: '
> com.macom.wsbu.uas.web.faces.component.PanelGroup'.
>
>       com.sun.faces.application.ApplicationImpl.newThing(
> ApplicationImpl.java:728)
>
>       com.sun.faces.application.ApplicationImpl.createComponent(
> ApplicationImpl.java:352)
>
>       javax.faces.webapp.UIComponentTag.createComponent(
> UIComponentTag.java:1013)
>
>       javax.faces.webapp.UIComponentTag.createChild(UIComponentTag.java
> :1036)
>
>       javax.faces.webapp.UIComponentTag.findComponent(UIComponentTag.java
> :749)
>
>       javax.faces.webapp.UIComponentTag.doStartTag(UIComponentTag.java
> :429)
>
>
>
> I've double and triple checked file locations and package names, and
> nothing out in web land suggests anything helpful.  I already have a custom
> component extended from UIXComponentBase that is working beautifully.  Any
> restrictions with doing this that you know about?  Probably something simple
> that I've overlooked.
>
>
>
> Thanks in advance,
>
>
>
> Shawn
>
>
>
>
>
> -----Original Message-----
> From: Adam Winer [mailto:awiner@gmail.com]
> Sent: Tuesday, July 24, 2007 5:37 PM
> To: MyFaces Discussion
> Subject: Re: [Trinidad] JSF components and div scroll position
>
>
>
> Once we get 1.0.2 out (hopefully soon) let's look at providing
>
> some hooks for DOM replacement during AJAX, something
>
> where you get called with something like:
>
>
>
>   // Tellls you that oldDom is about to be replaced with newDom,
>
>   // and lets you manipulate the dom, or return "true" to block
>
>   // it or handle it all yourself
>
>   function domReplaceNotify(oldDom, newDom)
>
>   {
>
>     ... see if oldDom contains the tree...
>
>     ... if it does, copy scrollTop and scrollLeft into newDom
>
>     // And let the system handle the move for you
>
>     return false;
>
>   }
>
>
>
> -- Adam
>
>
>
>
>
> On 7/24/07, Bertrand, Shawn R <sh...@tycoelectronics.com> wrote:
>
> >
>
> > I've taken my tree component and added some CSS to enable a scroll bar
>
> > around it when it becomes large enough:
>
> >
>
> >
>
> >
>
> >             inlineStyle="width: 200px; height: 400px; max-height: 400px;
>
> > overflow: auto; ….
>
> >
>
> >
>
> >
>
> > This works well, but as I expand and collapse nodes in the tree, the
> scroll
>
> > position isn't maintained due to the component being thrown out and
>
> > reconstructed via PPR.  I wish there was an onscroll on the tree, as
> this
>
> > would give me the hook I need to save the position and I could restore
> it
>
> > via window.onload, but to no avail.
>
> >
>
> >
>
> >
>
> > Does anyone have an idea how this might be done?
>
> >
>
> >
>
> >
>
> > Thanks in advance,
>
> >
>
> >
>
> >
>
> > Shawn Bertrand
>
> >
>
> > Tyco Electronics
>
> >
>
> >
>

RE: [Trinidad] JSF components and div scroll position

Posted by "Bertrand, Shawn R" <sh...@tycoelectronics.com>.
Sounds good - a very cool extension indeed.

 

So for the time being, I'm trying to implement a custom component that
extends CorePanelGroupLayout with the ability to specify an onscroll
handler.

 

I have all the necessary parts (component, renderer, taglib, <component>
and <renderkit> entries, with first 3 subclassing the necessary
classes), but I keep getting an exception when the component is called
to instantiate:

 

javax.faces.FacesException: Can't instantiate class:
'com.macom.wsbu.uas.web.faces.component.PanelGroup'.

 
com.sun.faces.application.ApplicationImpl.newThing(ApplicationImpl.java:
728)

 
com.sun.faces.application.ApplicationImpl.createComponent(ApplicationImp
l.java:352)

 
javax.faces.webapp.UIComponentTag.createComponent(UIComponentTag.java:10
13)

 
javax.faces.webapp.UIComponentTag.createChild(UIComponentTag.java:1036)

 
javax.faces.webapp.UIComponentTag.findComponent(UIComponentTag.java:749)

 
javax.faces.webapp.UIComponentTag.doStartTag(UIComponentTag.java:429)

 

I've double and triple checked file locations and package names, and
nothing out in web land suggests anything helpful.  I already have a
custom component extended from UIXComponentBase that is working
beautifully.  Any restrictions with doing this that you know about?
Probably something simple that I've overlooked.

 

Thanks in advance,

 

Shawn

 

 

-----Original Message-----
From: Adam Winer [mailto:awiner@gmail.com] 
Sent: Tuesday, July 24, 2007 5:37 PM
To: MyFaces Discussion
Subject: Re: [Trinidad] JSF components and div scroll position

 

Once we get 1.0.2 out (hopefully soon) let's look at providing

some hooks for DOM replacement during AJAX, something

where you get called with something like:

 

  // Tellls you that oldDom is about to be replaced with newDom,

  // and lets you manipulate the dom, or return "true" to block

  // it or handle it all yourself

  function domReplaceNotify(oldDom, newDom)

  {

    ... see if oldDom contains the tree...

    ... if it does, copy scrollTop and scrollLeft into newDom

    // And let the system handle the move for you

    return false;

  }

 

-- Adam

 

 

On 7/24/07, Bertrand, Shawn R <sh...@tycoelectronics.com>
wrote:

> 

> I've taken my tree component and added some CSS to enable a scroll bar

> around it when it becomes large enough:

> 

> 

> 

>             inlineStyle="width: 200px; height: 400px; max-height:
400px;

> overflow: auto; ....

> 

> 

> 

> This works well, but as I expand and collapse nodes in the tree, the
scroll

> position isn't maintained due to the component being thrown out and

> reconstructed via PPR.  I wish there was an onscroll on the tree, as
this

> would give me the hook I need to save the position and I could restore
it

> via window.onload, but to no avail.

> 

> 

> 

> Does anyone have an idea how this might be done?

> 

> 

> 

> Thanks in advance,

> 

> 

> 

> Shawn Bertrand

> 

> Tyco Electronics

> 

> 


Re: [Trinidad] JSF components and div scroll position

Posted by Adam Winer <aw...@gmail.com>.
Once we get 1.0.2 out (hopefully soon) let's look at providing
some hooks for DOM replacement during AJAX, something
where you get called with something like:

  // Tellls you that oldDom is about to be replaced with newDom,
  // and lets you manipulate the dom, or return "true" to block
  // it or handle it all yourself
  function domReplaceNotify(oldDom, newDom)
  {
    ... see if oldDom contains the tree...
    ... if it does, copy scrollTop and scrollLeft into newDom
    // And let the system handle the move for you
    return false;
  }

-- Adam


On 7/24/07, Bertrand, Shawn R <sh...@tycoelectronics.com> wrote:
>
> I've taken my tree component and added some CSS to enable a scroll bar
> around it when it becomes large enough:
>
>
>
>             inlineStyle="width: 200px; height: 400px; max-height: 400px;
> overflow: auto; ….
>
>
>
> This works well, but as I expand and collapse nodes in the tree, the scroll
> position isn't maintained due to the component being thrown out and
> reconstructed via PPR.  I wish there was an onscroll on the tree, as this
> would give me the hook I need to save the position and I could restore it
> via window.onload, but to no avail.
>
>
>
> Does anyone have an idea how this might be done?
>
>
>
> Thanks in advance,
>
>
>
> Shawn Bertrand
>
> Tyco Electronics
>
>