Il est juste une simple application TESTVaadin et DataModel. Comment puis-je obtenir la valeur stockée par une implémentation Property DataModel utilisée par un champ Label? Vaadin
import br.com.elf.ui.IndexApplication;
public class IndexApplication extends Application {
public void init() {
setMainWindow(getStartUpWindow());
}
private Window getStartUpWindow() {
Window mainWindow = new Window();
mainWindow.addComponent(
new Label(new Property() {
public Object getValue() {
return "DataModel Example";
}
public void setValue(Object value) throws ReadOnlyException, ConversionException {
throw new ReadOnlyException();
}
public Class<?> getType() {
return String.class;
}
public boolean isReadOnly() {
return true;
}
public void setReadOnly(boolean readyOnly) {
// Empty body
}
));
}
return mainWindow;
}
}
Avis i ai i plain champ Label. Je sais que je peux simplement appeler
mainWindow.addComponent(new Label("DataModel Example"));
à la place. Mais afin de voir comment Property DataModel fonctionne derrière les scènes, j'ai ajouté une implémentation de propriété. Mais au lieu de voir la production
DataModel Exemple
-je obtenir
Pourquoi ???
Et quel est le véritable but de la méthode Object getType() définie dans l'interface Property ??? Si le HTML montre sa sortie dans la chaîne normale, donc je pense qu'il n'y a aucune raison d'implémenter un Object getType(), non ???
salutations,