litesoft
Diff Revisions
947
vs
948
for /trunk/Java/GWT/Client/src/org/litesoft/GWT/client/widgets/nonpublic/external/DragThresholdFilter.java
|
@@ -22,8 +22,7 @@ |
22 |
22 |
|
* prevent accidental manipulation or to pervent the wrapped gesture's start |
23 |
23 |
|
* action from being executed until the mouse is moved. |
24 |
24 |
|
*/ |
25 |
|
- |
public class DragThresholdFilter extends DragGestureWrapper |
26 |
|
- |
{ |
|
25 |
+ |
public class DragThresholdFilter extends DragGestureWrapper { |
27 |
26 |
|
private final int m_threshold; |
28 |
27 |
|
|
29 |
28 |
|
private MouseEvent m_start; |
|
@@ -35,54 +34,43 @@ |
35 |
34 |
|
* @param distance the distance in screen pixels to move before taking an |
36 |
35 |
|
* action, or <code>0</code> |
37 |
36 |
|
*/ |
38 |
|
- |
public DragThresholdFilter( int distance, DragGesture delegate ) |
39 |
|
- |
{ |
|
37 |
+ |
public DragThresholdFilter( int distance, DragGesture delegate ) { |
40 |
38 |
|
super( delegate ); |
41 |
39 |
|
|
42 |
|
- |
if ( distance < 0 ) |
43 |
|
- |
{ |
|
40 |
+ |
if ( distance < 0 ) { |
44 |
41 |
|
throw new IllegalArgumentException( String.valueOf( distance ) ); |
45 |
42 |
|
} |
46 |
43 |
|
|
47 |
44 |
|
m_threshold = distance; |
48 |
45 |
|
} |
49 |
46 |
|
|
50 |
|
- |
protected boolean equalsThreshold( int deltaX, int deltaY ) |
51 |
|
- |
{ |
|
47 |
+ |
protected boolean equalsThreshold( int deltaX, int deltaY ) { |
52 |
48 |
|
return Math.abs( deltaX ) >= m_threshold || Math.abs( deltaY ) >= m_threshold; |
53 |
49 |
|
} |
54 |
50 |
|
|
55 |
51 |
|
@Override |
56 |
|
- |
public void start( MouseEvent e ) |
57 |
|
- |
{ |
58 |
|
- |
if ( m_threshold == 0 ) |
59 |
|
- |
{ |
|
52 |
+ |
public void start( MouseEvent e ) { |
|
53 |
+ |
if ( m_threshold == 0 ) { |
60 |
54 |
|
m_started = true; |
61 |
55 |
|
super.start( e ); |
62 |
|
- |
} |
63 |
|
- |
else |
64 |
|
- |
{ |
|
56 |
+ |
} else { |
65 |
57 |
|
m_start = e; |
66 |
58 |
|
} |
67 |
59 |
|
} |
68 |
60 |
|
|
69 |
61 |
|
@Override |
70 |
|
- |
public void step( DragEvent e ) |
71 |
|
- |
{ |
72 |
|
- |
if ( !m_started && equalsThreshold( e.getDeltaX(), e.getDeltaY() ) ) |
73 |
|
- |
{ |
|
62 |
+ |
public void step( DragEvent e ) { |
|
63 |
+ |
if ( !m_started && equalsThreshold( e.getDeltaX(), e.getDeltaY() ) ) { |
74 |
64 |
|
m_started = true; |
75 |
65 |
|
super.start( m_start ); |
76 |
66 |
|
} |
77 |
|
- |
if ( m_started ) |
78 |
|
- |
{ |
|
67 |
+ |
if ( m_started ) { |
79 |
68 |
|
super.step( e ); |
80 |
69 |
|
} |
81 |
70 |
|
} |
82 |
71 |
|
|
83 |
72 |
|
@Override |
84 |
|
- |
public void finish() |
85 |
|
- |
{ |
|
73 |
+ |
public void finish() { |
86 |
74 |
|
super.finish(); |
87 |
75 |
|
m_started = false; |
88 |
76 |
|
m_start = null; |