|
@@ -5,30 +5,27 @@ |
5 |
5 |
|
|
6 |
6 |
|
import com.google.gwt.dom.client.Element; |
7 |
7 |
|
import com.google.gwt.dom.client.*; |
8 |
|
- |
import com.google.gwt.event.dom.client.*; |
9 |
8 |
|
import com.google.gwt.user.client.*; |
10 |
9 |
|
|
11 |
10 |
|
public class ImageCellButton extends AbstractCellButton |
12 |
11 |
|
{ |
13 |
|
- |
protected ImageCellButton( String pButtonType, String pSize, int pMinimumCellSize, String pImageButtonName, String pEnabledToolTip, String pDisabledToolTip, ClickHandler pHandler ) |
|
12 |
+ |
private String mImageRef; |
|
13 |
+ |
|
|
14 |
+ |
public ImageCellButton( DefButtonNamedTypedFactoryImage pDefButtonFactory, int pMinimumCellSize ) |
14 |
15 |
|
{ |
15 |
|
- |
super( 0, pImageButtonName, pSize + "Image", pMinimumCellSize, pButtonType, null, // |
16 |
|
- |
0, createElement( pImageButtonName ), pEnabledToolTip, pDisabledToolTip, pHandler ); |
|
16 |
+ |
super( 0, pDefButtonFactory, 0, "Image", // |
|
17 |
+ |
pMinimumCellSize, createElement( pDefButtonFactory.getButtonImageRef() ) ); |
|
18 |
+ |
prefetchImageButtonImages( mImageRef = pDefButtonFactory.getButtonImageRef() ); |
17 |
19 |
|
} |
18 |
20 |
|
|
19 |
|
- |
private static Element createElement( String pImageButtonName ) |
|
21 |
+ |
private static Element createElement( String pButtonImageRef ) |
20 |
22 |
|
{ |
21 |
23 |
|
Element zElement = DOM.createImg(); |
22 |
|
- |
zElement.setPropertyString( "src", buildURL( pImageButtonName, true ) ); |
23 |
|
- |
ImageElement.as( zElement ).setAlt( pImageButtonName ); |
|
24 |
+ |
zElement.setPropertyString( "src", buildImageButtonImageURL( pButtonImageRef, true ) ); |
|
25 |
+ |
ImageElement.as( zElement ).setAlt( pButtonImageRef ); |
24 |
26 |
|
return zElement; |
25 |
27 |
|
} |
26 |
28 |
|
|
27 |
|
- |
private static String buildURL( String pImageButtonName, boolean pEnabled ) |
28 |
|
- |
{ |
29 |
|
- |
return "common/images/ImageButton/" + pImageButtonName + (pEnabled ? "/Enabled.gif" : "/Disabled.gif"); |
30 |
|
- |
} |
31 |
|
- |
|
32 |
29 |
|
@Override |
33 |
30 |
|
public void setEnabled( boolean pEnabled ) |
34 |
31 |
|
{ |
|
@@ -36,7 +33,7 @@ |
36 |
33 |
|
super.setEnabled( pEnabled ); |
37 |
34 |
|
if ( zUpdateSource ) |
38 |
35 |
|
{ |
39 |
|
- |
mInnerElement.setPropertyString( "src", buildURL( getName(), pEnabled ) ); |
|
36 |
+ |
mInnerElement.setPropertyString( "src", buildImageButtonImageURL( mImageRef, pEnabled ) ); |
40 |
37 |
|
} |
41 |
38 |
|
} |
42 |
39 |
|
} |