pivot-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Edvin Syse <ed...@sysedata.no>
Subject Re: TreeView Drop between nodes?
Date Wed, 08 Jun 2011 08:08:37 GMT
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 <edvin@sysedata.no 
> <mailto:edvin@sysedata.no>> 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

> <http://pivot.apache.org/2.0/docs/api/org/apache/pivot/wtk/Theme.html#set%28java.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

> <http://pivot.apache.org/2.0/docs/api/org/apache/pivot/wtk/DropTarget.html#dragEnter%28org.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

> <http://pivot.apache.org/2.0/docs/api/org/apache/pivot/wtk/DropTarget.html#dragMove%28org.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

View raw message