Gwtext-based data binding to create applications (2) Event Interceptor

The event interceptor is Dataset object ties being bound by the event interceptor data binding

public interface DatasetInterceptor {
        public boolean doBeforeIntercept(Dataset dataset, String action, Object[] params);

        public void onIntercept(Dataset dataset, String action, Object[] params);

        public void doAfterIntercept(Dataset dataset, String action, Object[] params, int resultCode);

A simple data binding TextField, when the Dataset occurs ACTION_MOVE (the current log line change) event to dynamically modify the binding field contents, as follows:

public class DatasetText extends TextField implements DatasetFormField {
        private Dataset dataset;
        private DatasetField field;

        private DatasetInterceptor interceptor;

        public DatasetText(Dataset dataset, DatasetField field) {
                this.dataset = dataset;
                this.field = field;

        public DatasetText(DatasetField field) {
                this(null, field);

        private void init() {
                if(dataset != null) {

                        this.addListener(new TextFieldListenerAdapter(){

                                public void onBlur(Field field) {
                                        dataset.set(field.getName(), DatasetText.this.getText());

                                public void onFocus(Field field) {


        public void bind() {
                if(this.dataset == null) return;
                if(this.interceptor == null)
                        this.interceptor = new DatasetInterceptorFormAdapter(Constants.ACTION_MOVE){
                                public void doAction(Dataset dataset, Object params) {
                                        Record rec = dataset.getRecordAtCursor();
                                        if(rec != null)
                Record rec = dataset.getRecordAtCursor();
                if(rec != null)

        public void unbind() {
                if(this.dataset == null) return;

        public Dataset getDataset() {
                return this.dataset;

        public DatasetField getField() {
                return this.field;
分类:Java 时间:2010-03-29 人气:283
blog comments powered by Disqus


  • Java proxy mode (through public interface) 2010-06-16

    Java proxy mode (through public interface) Proxy pattern implementation of a common scheme is to define an interface or abstract class, and derive the target subclass (RealClass), and proxy subclass (ProxyClass). We have to operate in the target sub-

  • NVL (a, b) function if a = null, return b 2010-10-14

    NVL (a, b) function if a = null, return b

  • Project page type used in public 2010-03-29

    package; import org.hibernate.Query; import; public class PageManagerimple extends HibernateDaoSupport implements PageManager{ private PageModule pm = new PageModule(); pub

  • pages, java unified interface page 2011-07-12

    Definition: pageStart start page, pageEnd end page, pageSize the page size oracle page: select * from (select mytable .*, rownum num from (the actual transfer of SQL) where rownum <= pageEnd) where num> = pageStart sqlServer Page: select * from (sel

  • The Enumeration interface, java 2010-10-17

    Enumeration Interface Enumeration interface itself is not a data structure. However, other data structure is very important. Enumeration interface defines a data structure obtained from the means of continuous data. For example, Enumeration defines a

  • Collections.newSetFromMap(Map E,Boolean map) 2013-12-07

    Collections提供了一种保证元素唯一性的Map实现,就是用一个Set来表示Map,它持有这个Map的引用,并且保持Map的顺序.并发和性能特征.这就是newSetFromMap方法: public static <E> Set<E> newSetFromMap(Map<E, Boolean> map) { return new SetFromMap<>(map); } 从Collections中可以看到,这里使用了一个内部类SetFromMap,它实

  • Bobo-Zoie the main interface, and inheritance 2010-11-29

    Bobo inheritance of the main package 1. BrowseService (Bobo): Inquiries, call the main browse, pass in BrowseRequest req, get BrowseResult. public interface BrowseService { BrowseResult browse(BrowseRequest req) throws BrowseException; void close() t

  • JNDI Naming and Directory Interface 2010-03-25

    JNDI is a Java Naming and Directory Interface (Java Naming and Directory Interface), is a Java platform, a standard extension provides a set of interfaces, classes and on the concept of namespaces. Like many other Java technologies, like, JDNI is a p

  • 2010.12.15 --- android listView display pictures 2010-12-16

    2010.12.15 --- android listView display pictures Requirements: display images inside the listView Idea: online see some examples listView generally inherited SimpleAdapter, SimpleAdapter but can not directly display images on the network so we only n

  • 2010.12.16 --- android listView display picture memory overflow 2010-12-16

    2010.12.16 --- android listView display picture memory overflow Wrote yesterday listView load, they would have reported a large number of images of memory exception In fact, wrote yesterday there are two problems: 1, memory overflow 2, loading images

iOS 开发

Android 开发

Python 开发



PHP 开发

Ruby 开发






Javascript 开发

.NET 开发



Copyright (C), All Rights Reserved. 版权所有 黔ICP备15002463号-1

processed in 0.238 (s). 12 q(s)