Subversion Repository Public Repository

litesoft

Diff Revisions 947 vs 948 for /trunk/Java/GWT/Client/src/org/litesoft/GWT/client/widgets/OurImage.java

Diff revisions: vs.
  @@ -11,24 +11,20 @@
11 11 import com.google.gwt.user.client.*;
12 12 import com.google.gwt.user.client.ui.*;
13 13
14 - public class OurImage extends Image implements OnBrowserEventListenable
15 - {
14 + public class OurImage extends Image implements OnBrowserEventListenable {
16 15 public static final Logger LOGGER = LoggerFactory.getLogger( OurImage.class );
17 16
18 17 private String mUrl;
19 18
20 - public OurImage()
21 - {
19 + public OurImage() {
22 20 }
23 21
24 - public OurImage( String pUrl )
25 - {
22 + public OurImage( String pUrl ) {
26 23 super( pUrl );
27 24 mUrl = pUrl;
28 25 }
29 26
30 - public OurImage size( int pWidth, int pHeight )
31 - {
27 + public OurImage size( int pWidth, int pHeight ) {
32 28 setWidth( pWidth );
33 29 setHeight( pHeight );
34 30 return this;
  @@ -39,8 +35,7 @@
39 35 *
40 36 * @see <a href="http://www.w3.org/TR/1999/REC-html401-19991224/struct/objects.html#adef-height-IMG">W3C HTML Specification</a>
41 37 */
42 - public void setHeight( int pPixels )
43 - {
38 + public void setHeight( int pPixels ) {
44 39 getImageElement().setHeight( pPixels );
45 40 }
46 41
  @@ -49,51 +44,42 @@
49 44 *
50 45 * @see <a href="http://www.w3.org/TR/1999/REC-html401-19991224/struct/objects.html#adef-width-IMG">W3C HTML Specification</a>
51 46 */
52 - public void setWidth( int pPixels )
53 - {
47 + public void setWidth( int pPixels ) {
54 48 getImageElement().setWidth( pPixels );
55 49 }
56 50
57 51 /**
58 52 * This should have been protected in Image.java
59 53 */
60 - protected ImageElement getImageElement()
61 - {
54 + protected ImageElement getImageElement() {
62 55 return getElement().cast();
63 56 }
64 57
65 58 @Override
66 - public String getUrl()
67 - {
59 + public String getUrl() {
68 60 return mUrl;
69 61 }
70 62
71 63 @Override
72 - public void setUrl( String pUrl )
73 - {
64 + public void setUrl( String pUrl ) {
74 65 mUrl = Strings.deNull( pUrl ).trim();
75 66 // Stupid GWT & IE thing at:
76 67 // ImageSrcIE6
77 68 // at line: 64
78 69 // todo: remove try/catch when Either GWT or IE is fixed
79 - try
80 - {
70 + try {
81 71 super.setUrl( pUrl );
82 72 }
83 - catch ( Throwable e )
84 - {
73 + catch ( Throwable e ) {
85 74 LOGGER.warn.log( e, "OurImage.setUrl(), ignoring exception" );
86 75 }
87 76 String zElementURL = DOM.getElementProperty( getElement(), "src" );
88 77 String zActualURL = super.getUrl();
89 - if ( !Objects.areNonArraysEqual( zActualURL, zElementURL ) )
90 - {
78 + if ( !Objects.areNonArraysEqual( zActualURL, zElementURL ) ) {
91 79 LOGGER.warn.log( "OurImage.setUrl( '", mUrl, "' ), Actual ( '", zActualURL, "' ) , Element ( '", zElementURL, "' )" );
92 - TimedRunnableManager.INSTANCE.runIn( new TimedRunnable()
93 - {
80 + TimedRunnableManager.INSTANCE.runIn( new TimedRunnable() {
94 81 @Override
95 - public Again runOnce()
96 - {
82 + public Again runOnce() {
97 83 setUrl( mUrl );
98 84 return null;
99 85 }
  @@ -104,39 +90,31 @@
104 90 private OnBrowserEventListener mListener = null;
105 91
106 92 @Override
107 - public Widget getOnBrowserEventListenableWidget()
108 - {
93 + public Widget getOnBrowserEventListenableWidget() {
109 94 return this;
110 95 }
111 96
112 97 @Override
113 - public OnBrowserEventListener getOnBrowserEventListener()
114 - {
98 + public OnBrowserEventListener getOnBrowserEventListener() {
115 99 return mListener;
116 100 }
117 101
118 102 @Override
119 - public void setOnBrowserEventListener( int pEventBitsToAdd, OnBrowserEventListener pListener )
120 - {
121 - if ( null != (mListener = pListener) )
122 - {
103 + public void setOnBrowserEventListener( int pEventBitsToAdd, OnBrowserEventListener pListener ) {
104 + if ( null != (mListener = pListener) ) {
123 105 sinkEvents( pEventBitsToAdd );
124 106 }
125 107 }
126 108
127 109 @Override
128 - public void clearOnBrowserEventListener()
129 - {
110 + public void clearOnBrowserEventListener() {
130 111 mListener = null;
131 112 }
132 113
133 114 @Override
134 - public void onBrowserEvent( Event event )
135 - {
136 - if ( mListener != null )
137 - {
138 - if ( mListener.onBrowserEvent( event ) )
139 - {
115 + public void onBrowserEvent( Event event ) {
116 + if ( mListener != null ) {
117 + if ( mListener.onBrowserEvent( event ) ) {
140 118 return;
141 119 }
142 120 }