|
@@ -1,34 +1,34 @@ |
1 |
|
- |
// This Source Code is in the Public Domain per: http://unlicense.org |
2 |
|
- |
package org.litesoft.GWT.client.widgets; |
3 |
|
- |
|
4 |
|
- |
import org.litesoft.GWT.client.widgets.nonpublic.*; |
5 |
|
- |
|
6 |
|
- |
import com.google.gwt.dom.client.Element; |
7 |
|
- |
import com.google.gwt.dom.client.*; |
8 |
|
- |
import com.google.gwt.user.client.*; |
9 |
|
- |
|
10 |
|
- |
public class ImageCellButton extends AbstractCellButton { |
11 |
|
- |
private String mImageRef; |
12 |
|
- |
|
13 |
|
- |
public ImageCellButton( DefButtonNamedTypedFactoryImage pDefButtonFactory, int pMinimumCellSize ) { |
14 |
|
- |
super( 0, pDefButtonFactory, 0, "Image", // |
15 |
|
- |
pMinimumCellSize, createElement( pDefButtonFactory.getButtonImageRef() ) ); |
16 |
|
- |
prefetchImageButtonImages( mImageRef = pDefButtonFactory.getButtonImageRef() ); |
17 |
|
- |
} |
18 |
|
- |
|
19 |
|
- |
private static Element createElement( String pButtonImageRef ) { |
20 |
|
- |
Element zElement = DOM.createImg(); |
21 |
|
- |
zElement.setPropertyString( "src", buildImageButtonImageURL( pButtonImageRef, true ) ); |
22 |
|
- |
ImageElement.as( zElement ).setAlt( pButtonImageRef ); |
23 |
|
- |
return zElement; |
24 |
|
- |
} |
25 |
|
- |
|
26 |
|
- |
@Override |
27 |
|
- |
public void setEnabled( boolean pEnabled ) { |
28 |
|
- |
boolean zUpdateSource = isEnabled() != pEnabled; |
29 |
|
- |
super.setEnabled( pEnabled ); |
30 |
|
- |
if ( zUpdateSource ) { |
31 |
|
- |
mInnerElement.setPropertyString( "src", buildImageButtonImageURL( mImageRef, pEnabled ) ); |
32 |
|
- |
} |
33 |
|
- |
} |
34 |
|
- |
} |
|
1 |
+ |
// This Source Code is in the Public Domain per: http://unlicense.org |
|
2 |
+ |
package org.litesoft.GWT.client.widgets; |
|
3 |
+ |
|
|
4 |
+ |
import org.litesoft.GWT.client.widgets.nonpublic.*; |
|
5 |
+ |
|
|
6 |
+ |
import com.google.gwt.dom.client.Element; |
|
7 |
+ |
import com.google.gwt.dom.client.*; |
|
8 |
+ |
import com.google.gwt.user.client.*; |
|
9 |
+ |
|
|
10 |
+ |
public class ImageCellButton extends AbstractCellButton { |
|
11 |
+ |
private String mImageRef; |
|
12 |
+ |
|
|
13 |
+ |
public ImageCellButton( DefButtonNamedTypedFactoryImage pDefButtonFactory, int pMinimumCellSize ) { |
|
14 |
+ |
super( 0, pDefButtonFactory, 0, "Image", // |
|
15 |
+ |
pMinimumCellSize, createElement( pDefButtonFactory.getButtonImageRef() ) ); |
|
16 |
+ |
prefetchImageButtonImages( mImageRef = pDefButtonFactory.getButtonImageRef() ); |
|
17 |
+ |
} |
|
18 |
+ |
|
|
19 |
+ |
private static Element createElement( String pButtonImageRef ) { |
|
20 |
+ |
Element zElement = DOM.createImg(); |
|
21 |
+ |
zElement.setPropertyString( "src", buildImageButtonImageURL( pButtonImageRef, true ) ); |
|
22 |
+ |
ImageElement.as( zElement ).setAlt( pButtonImageRef ); |
|
23 |
+ |
return zElement; |
|
24 |
+ |
} |
|
25 |
+ |
|
|
26 |
+ |
@Override |
|
27 |
+ |
public void setEnabled( boolean pEnabled ) { |
|
28 |
+ |
boolean zUpdateSource = isEnabled() != pEnabled; |
|
29 |
+ |
super.setEnabled( pEnabled ); |
|
30 |
+ |
if ( zUpdateSource ) { |
|
31 |
+ |
mInnerElement.setPropertyString( "src", buildImageButtonImageURL( mImageRef, pEnabled ) ); |
|
32 |
+ |
} |
|
33 |
+ |
} |
|
34 |
+ |
} |