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 268 | Next

Alexander Kolesnikov

"Tapestry 5: Building Web Applications"

We already have
had significant experience with custom models, so I will simply show the code for all
the necessary classes, and you should be able to easily figure out how all this works.
Here is the OptionModel implementation:
package com.packtpub.celebrities.util;
import java.util.Locale;
import java.util.Map;
import org.apache.tapestry.OptionModel;
public class LocaleOptionModel implements OptionModel
{
private Locale locale;
public LocaleOptionModel(Locale locale)
{
this.locale = locale;
}
public String getLabel()
{
Creating Custom Components
[ 224 ]
return locale.getDisplayName(locale);
}
public boolean isDisabled()
{
return false;
}
public Map getAttributes()
{
return null;
}
public Object getValue()
{
return locale;
}
}
The next implementation is that of the custom SelectModel itself:
package com.packtpub.celebrities.util;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import org.apache.tapestry.OptionGroupModel;
import org.apache.tapestry.OptionModel;
import org.apache.tapestry.util.AbstractSelectModel;
public class LocaleSelectModel extends AbstractSelectModel
{
private String locales;
public LocaleSelectModel(String locales)
{
this.


Pages:
256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280
Ciasta Hiszpania kredyty bez BIK dobre wierszyki MichaƂ Kozal