I have never really looked into the painting side of things in Pivot, so the
following is guesswork.
Greg, Todd and maybe some others can give a definitive answer.


It might be that the TreeView component is not being repainted, which means
that the decorator is not being used.
Perhaps you can call one of the repaint() methods for your TreeView in the
dragMove() method?

That seems to be what is happening in the mouseMove() method of the default
TreeView skin.
org.apache.pivot.wtk.skin.terra.TerraTreeViewSkin.mouseMove(Component, int,
int)

Chris

.
On 8 June 2011 15:08, Edvin Syse <[email protected]> wrote:

>  Hi Chris,
>
> thanks for the detailed explanation. I save off the coordinates and all I
> need in the DropTarget#dragMove method, and do the rendering in
> Decorator#update. It renders in the correct place, but the Decorator#update
> method is not called while I'm dragging. Therefore, the rendering doesn't
> show up before after I've dropped, and then move the mouse slightly. I tried
> manually calling Decorator#update from DropTarget#dragMove, but that's not
> working either.
>
> When I just hover over the TreeView with the mouse, the Decorator#update
> method is called all the time, but not while I drag. Any idea what I'm doing
> wrong? :)
>
> -- Edvin
>
> Den 08.06.2011 08:29, skrev Chris Bartlett:
>
> I was in the middle of writing a reply to you last night when there was a
> power outage, but it seems you did exactly as I was going to suggest anyway!
>
>
>  On 8 June 2011 06:10, Edvin Syse <[email protected]> wrote:
>
>> How do I install a custom skin just for this TreeView? :)
>>
>  Pivot only supports a single Skin for each Component.  If you want a
> particular instance of a Component to have a different skin, you can extend
> the Component and then register your custom skin against it in the Theme.
>
>  So you might create a MyTreeView which extends
> org.apache.pivot.wtk.TreeView
> and a MyTerraTreeViewSkin which extends
> org.apache.pivot.wtk.skin.terra.TerraTreeViewSkin.
>
>  Then you can add them to the Theme
>
> http://pivot.apache.org/2.0/docs/api/org/apache/pivot/wtk/Theme.html#set(java.lang.Class,
> java.lang.Class)
>
>  See this thread
>
> http://apache-pivot-users.399431.n3.nabble.com/How-to-change-skin-tp2218079p2218079.html
>
>  As Greg mentioned, it might be easier to write a custom Decorator and
> apply it to the DropTarget (TreeView) when the dragEnter method is called.
>
> http://pivot.apache.org/2.0/docs/api/org/apache/pivot/wtk/DropTarget.html#dragEnter(org.apache.pivot.wtk.Component,
> org.apache.pivot.wtk.Manifest, int, org.apache.pivot.wtk.DropAction)
>
>  The Decorator might receive x & y coordinate updates from the DropTarget
> via the dragMove method, or could listen to the ComponentMouseListener
> events for the TreeView.
>
> http://pivot.apache.org/2.0/docs/api/org/apache/pivot/wtk/DropTarget.html#dragMove(org.apache.pivot.wtk.Component,
> org.apache.pivot.wtk.Manifest, int, int, int,
> org.apache.pivot.wtk.DropAction)
>
> http://pivot.apache.org/2.0/docs/api/org/apache/pivot/wtk/ComponentMouseListener.html
>
>  It could use these coordinates along with the bounds of the nodes to
> determine where to render the line.
>
>  Chris
>
>

Reply via email to