pivot-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Bartlett <cbartlet...@gmail.com>
Subject Re: TreeView Drop between nodes?
Date Wed, 08 Jun 2011 06:29:15 GMT
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> 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

Mime
View raw message