You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@pivot.apache.org by prophe <au...@cargosoft.ru> on 2011/10/01 07:18:20 UTC

Re: Replace column in table view

I don't know=) where I must call drawImage()?

-----
Thank you!
--
View this message in context: http://apache-pivot-users.399431.n3.nabble.com/Replace-column-in-table-view-tp3375080p3384411.html
Sent from the Apache Pivot - Users mailing list archive at Nabble.com.

Re: Replace column in table view

Posted by pan peter <pa...@gmail.com>.
seems we need a detail description of how to implement this. this thread is
far less descriptive for implementing this functionality.

--
View this message in context: http://apache-pivot-users.399431.n3.nabble.com/Replace-column-in-table-view-tp3375080p3499265.html
Sent from the Apache Pivot - Users mailing list archive at Nabble.com.

Re: Replace column in table view

Posted by Greg Brown <gk...@verizon.net>.
Could this be related to your problem?

https://bugzilla.mozilla.org/show_bug.cgi?id=588455

On Nov 10, 2011, at 10:12 AM, pan peter wrote:

> Hi, 
> 
> I need to swap table columns as well. i don't really understand what you
> guys talk about here, i made the 
> 
>        tableView = (TableView)  namespace.get("tableView");
>        TableViewHeader tvh = (TableViewHeader)
> namespace.get("tableViewHeader");
>        tvh.setDropTarget(new DropTarget() {...});
>        tvh.setDragSource(new DragSource() {...});
>        tableView.setDropTarget(new DropTarget() {...});
>        tableView.setDragSource(new DragSource() {...});
> and I put some break point within the dragEnter and drop method, but program
> doesn't stop at anywhere.
> 
> Do I need do something more? 
> 
> I'm playing with the demo table.
> 
> --
> View this message in context: http://apache-pivot-users.399431.n3.nabble.com/Replace-column-in-table-view-tp3375080p3496967.html
> Sent from the Apache Pivot - Users mailing list archive at Nabble.com.


Re: Replace column in table view

Posted by pan peter <pa...@gmail.com>.
Hi, 

I need to swap table columns as well. i don't really understand what you
guys talk about here, i made the 

        tableView = (TableView)  namespace.get("tableView");
        TableViewHeader tvh = (TableViewHeader)
namespace.get("tableViewHeader");
        tvh.setDropTarget(new DropTarget() {...});
        tvh.setDragSource(new DragSource() {...});
        tableView.setDropTarget(new DropTarget() {...});
        tableView.setDragSource(new DragSource() {...});
and I put some break point within the dragEnter and drop method, but program
doesn't stop at anywhere.

Do I need do something more? 

I'm playing with the demo table.

--
View this message in context: http://apache-pivot-users.399431.n3.nabble.com/Replace-column-in-table-view-tp3375080p3496967.html
Sent from the Apache Pivot - Users mailing list archive at Nabble.com.

Re: Replace column in table view

Posted by prophe <au...@cargosoft.ru>.
Ok, Thank you for your help!

-----
Thank you!
--
View this message in context: http://apache-pivot-users.399431.n3.nabble.com/Replace-column-in-table-view-tp3375080p3389872.html
Sent from the Apache Pivot - Users mailing list archive at Nabble.com.

Re: Replace column in table view

Posted by Greg Brown <gk...@verizon.net>.
The simplest way to do this is probably to attach a decorator to the header that draws the line.

On Oct 3, 2011, at 3:13 AM, prophe wrote:

> And now I want to paint the bold line on the filter that is under mouse
> cursor while dragging and a narrow under the filter. Looking like on the
> picture:
> http://apache-pivot-users.399431.n3.nabble.com/file/n3389352/ertrt.jpg 
> 
> My code is:
> 
> 	@Override
> 	public DropAction dragMove(Component component, Manifest dragContent,
> 			int supportedDropActions, int x, int y, DropAction userDropAction) {
> 		
> 		int currentheader = getHeaderAt(x);
> 		if (currentheader!=-1){
> 			Bounds currentBounds = getHeaderBounds(currentheader);
> 			int filterEdge = Math.abs(x-currentBounds.x);
> 				if (filterEdge>currentBounds.width/2){
> 					System.out.println("here right");
> 				}else{
> 					System.out.println("here left");
> 				}
> 		}
> 		
> 		return null;
> 	}
> in place of System.out.println("here right"); and System.out.println("here
> left"); I want to draw a narrow and line like on the image. How can I do it?
> Thank you
> 
> -----
> Thank you!
> --
> View this message in context: http://apache-pivot-users.399431.n3.nabble.com/Replace-column-in-table-view-tp3375080p3389352.html
> Sent from the Apache Pivot - Users mailing list archive at Nabble.com.


Re: Replace column in table view

Posted by prophe <au...@cargosoft.ru>.
And now I want to paint the bold line on the filter that is under mouse
cursor while dragging and a narrow under the filter. Looking like on the
picture:
http://apache-pivot-users.399431.n3.nabble.com/file/n3389352/ertrt.jpg 

My code is:

	@Override
	public DropAction dragMove(Component component, Manifest dragContent,
			int supportedDropActions, int x, int y, DropAction userDropAction) {
		
		int currentheader = getHeaderAt(x);
		if (currentheader!=-1){
			Bounds currentBounds = getHeaderBounds(currentheader);
			int filterEdge = Math.abs(x-currentBounds.x);
				if (filterEdge>currentBounds.width/2){
					System.out.println("here right");
				}else{
					System.out.println("here left");
				}
		}
		
		return null;
	}
in place of System.out.println("here right"); and System.out.println("here
left"); I want to draw a narrow and line like on the image. How can I do it?
Thank you

-----
Thank you!
--
View this message in context: http://apache-pivot-users.399431.n3.nabble.com/Replace-column-in-table-view-tp3375080p3389352.html
Sent from the Apache Pivot - Users mailing list archive at Nabble.com.

Re: Replace column in table view

Posted by prophe <au...@cargosoft.ru>.
I find a problem in my code. I've set wrong offset:

	@Override
	public Point getOffset() {
		Point point = new Point(startX, startY);
		return point;
	}
When I do:
	@Override
	public Point getOffset() {
		Point point = new Point(0, 0);
		return point;
	}
All is OK.

-----
Thank you!
--
View this message in context: http://apache-pivot-users.399431.n3.nabble.com/Replace-column-in-table-view-tp3375080p3389239.html
Sent from the Apache Pivot - Users mailing list archive at Nabble.com.

Re: Replace column in table view

Posted by Greg Brown <gk...@verizon.net>.
Glad you figured it out. I misunderstood the issue so my suggestion wouldn't have worked anyway.

On Oct 3, 2011, at 12:04 AM, prophe wrote:

> How can I do that? Now my column picture when I try to drag look like:
> http://apache-pivot-users.399431.n3.nabble.com/file/n3389036/rty.jpg 
> As you can see it appear always in first column in 0,0 point. But I want to
> display it in the column header that I try to drag!
> 
> -----
> Thank you!
> --
> View this message in context: http://apache-pivot-users.399431.n3.nabble.com/Replace-column-in-table-view-tp3375080p3389036.html
> Sent from the Apache Pivot - Users mailing list archive at Nabble.com.


Re: Replace column in table view

Posted by prophe <au...@cargosoft.ru>.
How can I do that? Now my column picture when I try to drag look like:
http://apache-pivot-users.399431.n3.nabble.com/file/n3389036/rty.jpg 
As you can see it appear always in first column in 0,0 point. But I want to
display it in the column header that I try to drag!

-----
Thank you!
--
View this message in context: http://apache-pivot-users.399431.n3.nabble.com/Replace-column-in-table-view-tp3375080p3389036.html
Sent from the Apache Pivot - Users mailing list archive at Nabble.com.

Re: Replace column in table view

Posted by Greg Brown <gk...@verizon.net>.
You'll probably want to translate to the coordinates of the header rather than the origin coordinates.

On Oct 1, 2011, at 1:58 AM, prophe wrote:

> I've replaced graphics.translate(-headerBounds.x, -headerBounds.y);
> And the problem with black rectangle is resolve. But When I try to move
> second and greater column, image appears always in the first column! Why it
> can be? how can I set the right location to display image? 
> 
> -----
> Thank you!
> --
> View this message in context: http://apache-pivot-users.399431.n3.nabble.com/Replace-column-in-table-view-tp3375080p3384442.html
> Sent from the Apache Pivot - Users mailing list archive at Nabble.com.


Re: Replace column in table view

Posted by prophe <au...@cargosoft.ru>.
I've replaced graphics.translate(-headerBounds.x, -headerBounds.y);
And the problem with black rectangle is resolve. But When I try to move
second and greater column, image appears always in the first column! Why it
can be? how can I set the right location to display image? 

-----
Thank you!
--
View this message in context: http://apache-pivot-users.399431.n3.nabble.com/Replace-column-in-table-view-tp3375080p3384442.html
Sent from the Apache Pivot - Users mailing list archive at Nabble.com.