Subversion Repository Public Repository

litesoft

Diff Revisions 720 vs 948 for /trunk/Java/GWT/Client/src/org/litesoft/GWT/client/widgets/nonpublic/external/MouseDragHandler.java

Diff revisions: vs.
  @@ -23,54 +23,46 @@
23 23 * Converts {@link MouseEvent}s to {@link DragEvent}s and delegates to the
24 24 * specified {@link DragGesture}.
25 25 */
26 - public class MouseDragHandler extends MouseHandlerAdaptor
27 - {
26 + public class MouseDragHandler extends MouseHandlerAdaptor {
28 27 private static MouseDragHandlerImpl s_Impl = (MouseDragHandlerImpl) GWT.create( MouseDragHandlerImpl.class );
29 28
30 29 private DragGesture m_dragGesture;
31 30 private MouseEvent m_mouseDown = null;
32 31 private MouseEvent m_previousEvent = null;
33 32
34 - public MouseDragHandler( DragGesture dragGesture )
35 - {
33 + public MouseDragHandler( DragGesture dragGesture ) {
36 34 super( Event.ONMOUSEDOWN | Event.ONMOUSEMOVE | Event.ONMOUSEUP );
37 35 m_dragGesture = dragGesture;
38 36 }
39 37
40 - protected MouseEvent getMouseDown()
41 - {
38 + protected MouseEvent getMouseDown() {
42 39 return m_mouseDown;
43 40 }
44 41
45 - protected MouseEvent getPreviousEvent()
46 - {
42 + protected MouseEvent getPreviousEvent() {
47 43 return m_previousEvent;
48 44 }
49 45
50 46 /**
51 47 * Get the delegate object which will handle drag operations.
52 48 */
53 - public DragGesture getDragGesture()
54 - {
49 + public DragGesture getDragGesture() {
55 50 return m_dragGesture;
56 51 }
57 52
58 53 /**
59 54 * Set the delegate object which will handle drag operations.
60 55 */
61 - public void setDragGesture( DragGesture dragGesture )
62 - {
56 + public void setDragGesture( DragGesture dragGesture ) {
63 57 m_dragGesture = dragGesture;
64 58 }
65 59
66 60 @Override
67 - public void onMouseDown( MouseEvent e )
68 - {
61 + public void onMouseDown( MouseEvent e ) {
69 62 DOM.eventCancelBubble( e.getDomEvent(), true );
70 63 s_Impl.onMouseDown( e.getDomEvent() );
71 64
72 - if ( m_dragGesture != null )
73 - {
65 + if ( m_dragGesture != null ) {
74 66 m_mouseDown = e;
75 67 m_dragGesture.start( e );
76 68 m_previousEvent = e;
  @@ -78,48 +70,39 @@
78 70 }
79 71
80 72 @Override
81 - public void onMouseMove( MouseEvent e )
82 - {
83 - if ( m_mouseDown != null )
84 - {
73 + public void onMouseMove( MouseEvent e ) {
74 + if ( m_mouseDown != null ) {
85 75 m_dragGesture.step( new DragEvent( e, m_mouseDown, m_previousEvent ) );
86 76 m_previousEvent = e;
87 77 }
88 78 }
89 79
90 80 @Override
91 - public void onMouseUp( MouseEvent e )
92 - {
81 + public void onMouseUp( MouseEvent e ) {
93 82 // it is possible to get a mouse up without a mouse down
94 - if ( m_mouseDown != null )
95 - {
83 + if ( m_mouseDown != null ) {
96 84 // clear MD first to prevent reentrancy
97 85 m_mouseDown = null;
98 86 m_dragGesture.finish();
99 87 m_previousEvent = null;
100 88 }
101 89
102 - if ( e != null )
103 - {
90 + if ( e != null ) {
104 91 s_Impl.onMouseUp( e.getDomEvent() );
105 92 }
106 93 }
107 94
108 - protected static class MouseDragHandlerImpl
109 - {
110 - public void onMouseDown( Event event )
111 - {
95 + protected static class MouseDragHandlerImpl {
96 + public void onMouseDown( Event event ) {
112 97 // prevents text selection and image dragging in Mozilla, Safari & Opera
113 98 DOM.eventPreventDefault( event );
114 99 }
115 100
116 - public void onMouseUp( Event event )
117 - {
101 + public void onMouseUp( Event event ) {
118 102 }
119 103 }
120 104
121 - protected static class MouseDragHandlerImplIE6 extends MouseDragHandlerImpl
122 - {
105 + protected static class MouseDragHandlerImplIE6 extends MouseDragHandlerImpl {
123 106 @Override
124 107 public native void onMouseDown( Event event ) /*-{
125 108 $doc.body.onselectstart = function ()