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