xq.gwt.mvc.controller.TextPropertyController Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of XqGwtMvc Show documentation
Show all versions of XqGwtMvc Show documentation
A framework for implementing the MVP variant of the Model View Controller design pattern in the context of GWT
The newest version!
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package xq.gwt.mvc.controller;
import xq.gwt.mvc.model.ConversionException;
import xq.gwt.mvc.model.PropertyModel;
import xq.gwt.mvc.view.TextPropertyView;
/**
*
* @author admin
*/
public class TextPropertyController extends AbstractPropertyController{
protected TextPropertyView textView;
public TextPropertyController(TextPropertyView view){
super(view);
this.textView = view;
}
@Override
public void setPropertyModel(PropertyModel model){
super.setPropertyModel(model);
}
@Override
public void updateModel() {
try {
textView.clearError();
model.setText(textView.getText());
if(model.getHasError()){
textView.setError("Invalid value");
}
} catch (ConversionException ex) {
textView.setError(ex.getMessage());
}
}
@Override
public void updateView() {
if (textView != null){
textView.clearError();
String val = model != null? model.getText() :null;
textView.setText(val);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy