Hello,

I've just finished the getting started with GWT tutorial:
https://developers.google.com/web-toolkit/doc/latest/tutorial/style
Which I think is really good.

I have a couple of questions though.

https://developers.google.com/web-toolkit/doc/latest/tutorial/style
For the dynamic styling a widget is used, and then the stylename is added 
to the widget.
Is there a reason a widget is used for this?
code:

stocksFlexTable.setText(row, 2, changeText + " (" + changePercentText
        + "%)");    Label changeWidget = (Label)stocksFlexTable.getWidget(row, 
2);
    changeWidget.setText(changeText + " (" + changePercentText + "%)");


// Change the color of text in the Change field based on its value.
    String changeStyleName = "noChange";
    if (price.getChangePercent() < -0.1f) {
      changeStyleName = "negativeChange";
    }
    else if (price.getChangePercent() > 0.1f) {
      changeStyleName = "positiveChange";
    }

    changeWidget.setStyleName(changeStyleName);

I don't see the need for it, it works perfect like this as well:
stocksFlexTable.setText(rowIdx, 2, changeText + " (" + changePercentage + 
"%)");
        if (price.getChangePercent() < -0.1f) {
            stocksFlexTable.getCellFormatter().addStyleName(rowIdx, 2, 
"negativeChange");
        }else{
            stocksFlexTable.getCellFormatter().addStyleName(rowIdx, 2, 
"positiveChange");
        }

Can anybody tell me why a widget is suggested here as a better solution?


Second question about the generated javascript:
"If, after you compile StockWatcher, you look at the generated JavaScript 
for the Add button, you will see that the button has a class attribute of 
gwt-Button:
<button class="gwt-Button" tabindex="0" type="button">Add</button>"

Problem is a cannot find this button code in the "stockwatcher.nocache.js", 
and also not in any of the generated permutations, is that normal??
(i have compiled it :p )

Cheers!,

Ruben


-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/Gcsr_69JEOMJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to