SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 240 | Next

Alexander Kolesnikov

"Tapestry 5: Building Web Applications"

tapestry.annotations.Persist;
import org.apache.tapestry.services.PersistentLocale;
public class Border
{
@Inject
private PersistentLocale persistentLocale;
@Inject
private Locale currentLocale;
@Persist
private String localeLabel;
public String getLocaleLabel()
Creating Custom Components
[ 198 ]
{
if (localeLabel == null)
{
if (currentLocale.equals(Locale.GERMAN))
{
localeLabel =
new Locale("en").getDisplayName(Locale.ENGLISH);
} else {
localeLabel =
new Locale("de").getDisplayName(Locale.GERMAN);
}
}
return localeLabel;
}
@OnEvent(component="switchlocale")
void changeLocale()
{
localeLabel = currentLocale.getDisplayName(currentLocale);
if (currentLocale.equals(Locale.GERMAN))
{
persistentLocale.set(Locale.ENGLISH);
}
else
{
persistentLocale.set(Locale.GERMAN);
}
}
}
Also, to see immediately that the stylesheet is available to the page, we can add a
couple of simple style definitions to the styles.css file, but this is certainly optional:
body, table, input, select
{
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10pt;
}
h1
{
font-family: Arial, Helvetica, sans-serif;
font-size: 20pt;
font-weight: bold;
color: #204060;
}
Next, we need to change all the page templates, removing all the common content
from them and surrounding the remaining content with the Border component.


Pages:
228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252
druga wojna światowa Free English grammar and study guid hotel jelenia góra Russian bride counter strike 1.6