SmartGWT 4.1p (nigtly build from 06 may 2015)
Apple IOS 8.3
We have a problem with the display of a DrawLabel on Apple IOS:
It seems, the alignment property is ignored for the label, the text is displayed every time left aligned.
See attached Picture.
The behaviour is the same at Crome and Safari.
Further more: When I remove the DrawRect no text is displayed.
Switching to desktop mode of the browser, solves this problem, but the the assigned click handler to the parent DrawPane is not executed in this case. So it is not a solution for us.
The same code works fine on every other system (Windows, Android)
Her is the code of my label class, the code of the other classes, you will find in the attached files
Has anyone a solution for this problem ?
Best regards
Lutz
Apple IOS 8.3
We have a problem with the display of a DrawLabel on Apple IOS:
It seems, the alignment property is ignored for the label, the text is displayed every time left aligned.
See attached Picture.
The behaviour is the same at Crome and Safari.
Further more: When I remove the DrawRect no text is displayed.
Switching to desktop mode of the browser, solves this problem, but the the assigned click handler to the parent DrawPane is not executed in this case. So it is not a solution for us.
The same code works fine on every other system (Windows, Android)
Her is the code of my label class, the code of the other classes, you will find in the attached files
Code:
package eisenmann.apple.client.canvas;
import com.smartgwt.client.types.Alignment;
import com.smartgwt.client.util.SC;
import com.smartgwt.client.widgets.drawing.DrawLabel;
import com.smartgwt.client.widgets.drawing.DrawPane;
import com.smartgwt.client.widgets.drawing.DrawRect;
import com.smartgwt.client.widgets.events.ClickEvent;
import com.smartgwt.client.widgets.events.ClickHandler;
public class TextFigure
extends DrawPane
{
private static final String BR = "<br>";
private static final int FONT_HEIGHT = 50;
private Bounds bounds;
private String text;
private Alignment alignment;
private DrawLabel drawLabel;
/**
* Initializes a TextFigure instance.
* <p>
*
* @param bounds
* @param text
* @param alignment
*/
public TextFigure(Bounds bounds, String text, Alignment alignment)
{
super();
this.bounds = bounds;
setLeft(bounds.getX());
setTop(bounds.getY());
setWidth(bounds.getWidth());
setHeight(bounds.getHeight());
this.text = text;
this.alignment = alignment;
createContent();
}
private int getLeftPos()
{
double left = 0;
switch ( alignment )
{
case CENTER:
left = bounds.getWidth() / 2;
break;
case RIGHT:
left = bounds.getWidth();
break;
case LEFT:
default:
break;
}
return (int) left;
}
private int getTopPos()
{
return (bounds.getHeight() - FONT_HEIGHT) / 2;
}
private void createContent()
{
setBackgroundColor("lightgreen");
setBorder("4px solid red");
addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event)
{
StringBuilder sb = new StringBuilder();
sb.append("SimpleTextFigure Version 5" + BR);
sb.append("DrawPane" + BR);
sb.append("Border : " + getBorder() + BR);
sb.append("Left : " + getLeft() + BR);
sb.append("Top : " + getTop() + BR);
sb.append("Width : " + getWidth() + BR);
sb.append("Height : " + getHeight() + BR + BR);
sb.append("DrawLabel" + BR);
sb.append("Alignment : " + drawLabel.getAlignment() + BR);
sb.append("Fontfamily : " + drawLabel.getFontFamily() + BR);
sb.append("FontSize : " + drawLabel.getFontSize() + BR);
sb.append("FontStyle : " + drawLabel.getFontStyle() + BR);
sb.append("FontWeight : " + drawLabel.getFontWeight() + BR);
sb.append("Left : " + drawLabel.getLeft() + BR);
sb.append("Top : " + drawLabel.getTop() + BR);
SC.say(sb.toString());
}
});
/* removing of this block leads to not displaying the text at ipad */
DrawRect backgroundRect = new DrawRect();
backgroundRect.setLineColor(null);
backgroundRect.setFillColor(null);
backgroundRect.setTop(0);
backgroundRect.setLeft(0);
backgroundRect.setWidth(bounds.getWidth());
backgroundRect.setHeight(bounds.getHeight());
addDrawItem(backgroundRect, true);
drawLabel = new DrawLabel();
drawLabel.setTop(getTopPos());
drawLabel.setLeft(getLeftPos());
drawLabel.setFontFamily("Arial");
drawLabel.setFontSize(FONT_HEIGHT);
drawLabel.setFontWeight("bold");
drawLabel.setLineColor("blue");
drawLabel.setContents(text);
drawLabel.setAlignment(alignment.getValue());
addDrawItem(drawLabel, true);
}
}Best regards
Lutz