import com.google.gwt.resources.client.ImageResource;
import com.google.gwt.uibinder.client.UiConstructor;
import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.Element;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.Image;
public class ImageTextButton extends Button {
private String text;
public ImageTextButton(){
super();
}
private int imageWidth;
private int imageHeigth;
public @UiConstructor ImageTextButton(int imageWidth, int imageHeigth){
this();
this.imageWidth = imageWidth;
this.imageHeigth = imageHeigth;
}
public void setResource(ImageResource imageResource){
Image img = new Image(imageResource.getSafeUri());
img.setPixelSize(imageWidth, imageHeigth);
String definedStyles = img.getElement().getAttribute("style");
img.getElement().setAttribute("style", definedStyles + "; vertical-align:middle;");
DOM.insertChild(getElement(), img.getElement(), 0);
}
@Override
public void setText(String text) {
this.text = text;
Element span = DOM.createElement("span");
span.setInnerText(text);
span.setAttribute("style", "padding-left:3px; vertical-align:middle;");
DOM.insertBefore(getElement(), span, DOM.getFirstChild(getElement()));
}
@Override
public String getText() {
return this.text;
}
public int getImageWidth() {
return imageWidth;
}
public void setImageWidth(int imageWidth) {
this.imageWidth = imageWidth;
}
public int getImageHeigth() {
return imageHeigth;
}
public void setImageHeigth(int imageHeigth) {
this.imageHeigth = imageHeigth;
}
}
Hi all,
I'm using GWT 2.5.1 and I've some browser compatibility issue:
1. cellTable
I've a cellTable and the way is dispose in safary is not filling all browser width (100%) (although in other browsers works fine) see attachments(images: callTable_Chrome.png, callTable_Safary.png; sourceCode: Error.7z)
2. Setting an icon on a button
I create a button that can be add an Image but in IE browser the images appear distorted although in other browsers works fine see attachments(images: imageButton.png; sourceCode: ImageTextButton.java)
(the way I define the icon on button: <c:ImageTextButton ui:field="uiSave" text="Save" resource="{images.save}" imageHeigth="18" imageWidth="18" width="100px"/>)
<ui:with field="images" type="com.ux.client.images.ImageResources"/>
I'm I doing something wrong?
Can anyone help me?
Many Thanks,
Luis Costa
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.



No comments:
Post a Comment