|
@@ -1,50 +1,50 @@ |
1 |
|
- |
package org.litesoft.GWT.client.widgets.sliderbar.client.solution.iph; |
2 |
|
- |
|
3 |
|
- |
import org.litesoft.GWT.client.widgets.sliderbar.client.view.*; |
4 |
|
- |
|
5 |
|
- |
import com.google.gwt.user.client.ui.*; |
6 |
|
- |
|
7 |
|
- |
public class IScale extends TouchableAbsolutePanelPK { |
8 |
|
- |
|
9 |
|
- |
Label leftLabel = new Label(), rightLabel = new Label(); |
10 |
|
- |
Image image; |
11 |
|
- |
int imgHeight; |
12 |
|
- |
int imgWidth; |
13 |
|
- |
|
14 |
|
- |
public IScale( String leftTxt, String rightTxt, int imgWidth, int imgHeight ) { |
15 |
|
- |
this.imgWidth = imgWidth; |
16 |
|
- |
this.imgHeight = imgHeight; |
17 |
|
- |
leftLabel.setText( leftTxt ); |
18 |
|
- |
rightLabel.setText( rightTxt ); |
19 |
|
- |
} |
20 |
|
- |
|
21 |
|
- |
public void addLeftStyleName( String styleName ) { |
22 |
|
- |
leftLabel.addStyleName( styleName ); |
23 |
|
- |
} |
24 |
|
- |
|
25 |
|
- |
public void addRightStyleName( String styleName ) { |
26 |
|
- |
rightLabel.addStyleName( styleName ); |
27 |
|
- |
} |
28 |
|
- |
|
29 |
|
- |
public void setBackGroundImage( Image image ) { |
30 |
|
- |
this.image = image; |
31 |
|
- |
this.add( image, 0, 0 ); |
32 |
|
- |
this.add( leftLabel, 0, 0 ); |
33 |
|
- |
this.add( rightLabel, 0, 0 ); |
34 |
|
- |
} |
35 |
|
- |
|
36 |
|
- |
protected void placeLabels() { |
37 |
|
- |
this.setWidgetPosition( leftLabel, |
38 |
|
- |
(imgWidth / 2 - leftLabel.getOffsetWidth()) / 2, |
39 |
|
- |
(imgHeight - leftLabel.getOffsetHeight()) / 2 ); |
40 |
|
- |
this.setWidgetPosition( rightLabel, |
41 |
|
- |
imgWidth / 2 + (imgWidth / 2 - rightLabel.getOffsetWidth()) / 2, |
42 |
|
- |
(imgHeight - rightLabel.getOffsetHeight()) / 2 ); |
43 |
|
- |
} |
44 |
|
- |
|
45 |
|
- |
protected void onLoad() { |
46 |
|
- |
super.onLoad(); |
47 |
|
- |
setPixelSize( image.getOffsetWidth(), image.getOffsetHeight() ); |
48 |
|
- |
placeLabels(); |
49 |
|
- |
} |
50 |
|
- |
} |
|
1 |
+ |
package org.litesoft.GWT.client.widgets.sliderbar.client.solution.iph; |
|
2 |
+ |
|
|
3 |
+ |
import org.litesoft.GWT.client.widgets.sliderbar.client.view.*; |
|
4 |
+ |
|
|
5 |
+ |
import com.google.gwt.user.client.ui.*; |
|
6 |
+ |
|
|
7 |
+ |
public class IScale extends TouchableAbsolutePanelPK { |
|
8 |
+ |
|
|
9 |
+ |
Label leftLabel = new Label(), rightLabel = new Label(); |
|
10 |
+ |
Image image; |
|
11 |
+ |
int imgHeight; |
|
12 |
+ |
int imgWidth; |
|
13 |
+ |
|
|
14 |
+ |
public IScale( String leftTxt, String rightTxt, int imgWidth, int imgHeight ) { |
|
15 |
+ |
this.imgWidth = imgWidth; |
|
16 |
+ |
this.imgHeight = imgHeight; |
|
17 |
+ |
leftLabel.setText( leftTxt ); |
|
18 |
+ |
rightLabel.setText( rightTxt ); |
|
19 |
+ |
} |
|
20 |
+ |
|
|
21 |
+ |
public void addLeftStyleName( String styleName ) { |
|
22 |
+ |
leftLabel.addStyleName( styleName ); |
|
23 |
+ |
} |
|
24 |
+ |
|
|
25 |
+ |
public void addRightStyleName( String styleName ) { |
|
26 |
+ |
rightLabel.addStyleName( styleName ); |
|
27 |
+ |
} |
|
28 |
+ |
|
|
29 |
+ |
public void setBackGroundImage( Image image ) { |
|
30 |
+ |
this.image = image; |
|
31 |
+ |
this.add( image, 0, 0 ); |
|
32 |
+ |
this.add( leftLabel, 0, 0 ); |
|
33 |
+ |
this.add( rightLabel, 0, 0 ); |
|
34 |
+ |
} |
|
35 |
+ |
|
|
36 |
+ |
protected void placeLabels() { |
|
37 |
+ |
this.setWidgetPosition( leftLabel, |
|
38 |
+ |
(imgWidth / 2 - leftLabel.getOffsetWidth()) / 2, |
|
39 |
+ |
(imgHeight - leftLabel.getOffsetHeight()) / 2 ); |
|
40 |
+ |
this.setWidgetPosition( rightLabel, |
|
41 |
+ |
imgWidth / 2 + (imgWidth / 2 - rightLabel.getOffsetWidth()) / 2, |
|
42 |
+ |
(imgHeight - rightLabel.getOffsetHeight()) / 2 ); |
|
43 |
+ |
} |
|
44 |
+ |
|
|
45 |
+ |
protected void onLoad() { |
|
46 |
+ |
super.onLoad(); |
|
47 |
+ |
setPixelSize( image.getOffsetWidth(), image.getOffsetHeight() ); |
|
48 |
+ |
placeLabels(); |
|
49 |
+ |
} |
|
50 |
+ |
} |