SmartGwt 3.0 Power
FF10 and IE8
Quirks Mode
I've been playing with the idea of writing an integration of FontAwesome into SmartGwt by creating a new button class extended from StatefulCanvas.
I'm running into a couple of issues:
1) Compatibility : In order for @font-face to be recognized by FF10 and IE8 (the only 2 browsers I'm testing with so far), I have to declare a DOCTYPE and some standards mode. This makes the @font-face be recognized by both but then several other issues occur in SmartGwt. I know the suggested best practice is to leave out the DOCTYPE and use quirks mode. In doing so, FF10 still works fine with @font-face but IE8 stops seeing the font icons. I've just decided to exclude IE for now and continue on but if you have any suggestions for this, I'm all ears.
2) CSS not being respected. I've taken the Twitter Bootstrap .btn css and added it as the baseStyle for my new button class. I've tried the suggested approach of overriding getInnerHTML() as well as playing around with setContents() but certain things from the baseStyle CSS are not honored using either approach.
Are there certain css properties that are tied to StatefulCanvas that cannot be changed via css?
So far, here is a compiled list of all the css properties that don't seem to work correctly or at all:
- cursor
- padding (left, top, bottom works but right does not)
Finally, setTitle() and setIcon() don't seem to do anything with a class extended from StatefulCanvas. What am I doing wrong?
Here is some code:
css
FontIcon.java
FontIconTestPage.java
FF10 and IE8
Quirks Mode
I've been playing with the idea of writing an integration of FontAwesome into SmartGwt by creating a new button class extended from StatefulCanvas.
I'm running into a couple of issues:
1) Compatibility : In order for @font-face to be recognized by FF10 and IE8 (the only 2 browsers I'm testing with so far), I have to declare a DOCTYPE and some standards mode. This makes the @font-face be recognized by both but then several other issues occur in SmartGwt. I know the suggested best practice is to leave out the DOCTYPE and use quirks mode. In doing so, FF10 still works fine with @font-face but IE8 stops seeing the font icons. I've just decided to exclude IE for now and continue on but if you have any suggestions for this, I'm all ears.
2) CSS not being respected. I've taken the Twitter Bootstrap .btn css and added it as the baseStyle for my new button class. I've tried the suggested approach of overriding getInnerHTML() as well as playing around with setContents() but certain things from the baseStyle CSS are not honored using either approach.
Are there certain css properties that are tied to StatefulCanvas that cannot be changed via css?
So far, here is a compiled list of all the css properties that don't seem to work correctly or at all:
- cursor
- padding (left, top, bottom works but right does not)
Finally, setTitle() and setIcon() don't seem to do anything with a class extended from StatefulCanvas. What am I doing wrong?
Here is some code:
css
Code:
.myBtn, .myBtnOver, .myBtnFocused, .myBtnFocusedOver, .myBtnDown, .myBtnFocusedDown, .myBtnSelected, .myBtnSelectedFocused, .myBtnSelectedDown, .myBtnSelectedFocusedDown, .myBtnSelectedOver, .myBtnSelectedFocusedOver, .myBtnDisabled, .myBtnSelectedDisabled { display:inline-block; *display:inline; *zoom:1; padding:4px 10px 4px; margin-bottom:0; font-size:14px; line-height:20px; *line-height:20px; color:#5c5f63; text-align:center; text-shadow:0 1px 1px rgba(255, 255, 255, 0.75); vertical-align:middle; cursor:pointer; background-color:#551122; background-image:-moz-linear-gradient(top, #f7f8fa, #edeeef); background-image:-ms-linear-gradient(top, #f7f8fa, #edeeef); background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#f7f8fa), to(#edeeef)); background-image:-webkit-linear-gradient(top, #f7f8fa, #edeeef); background-image:-o-linear-gradient(top, #f7f8fa, #edeeef); background-image:linear-gradient(top, #f7f8fa, #edeeef); background-repeat:repeat-x; filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#f7f8fa', endColorstr='#edeeef', GradientType=0); border-color:#edeeef #edeeef #c5c8cb; border-color:rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); *background-color:#551122; filter:progid:DXImageTransform.Microsoft.gradient(enabled = false); background:#f7f8fa; border:1px solid #e1e2e5; *border:0; border-bottom-color:#c6c8cd; -webkit-border-radius:4px; -moz-border-radius:4px; border-radius:4px; *margin-left:.3em; -webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05); -moz-box-shadow:inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05); box-shadow:inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05); }
Code:
public class FontIcon extends StatefulCanvas { String icon; String title; public FontIcon(String iconStr, String label) { this.icon = "icon-" + iconStr; this.title = label; setBaseStyle("myBtn"); this.setContents("<span style=\"white-space:pre;\"><i class=\"" + icon + "\"></i>" + title + "</span>"); this.setSize("1", "1"); } }
Code:
public class FontIconTestPage extends VLayout { public FontIconTestPage() { setSize("100%", "100%"); setPadding(16); setMembersMargin(8); final FontIcon btn1 = new FontIcon("ok", " Okay"); addMember(btn1); } }
Comment