谷歌浏览器event listener(谷歌浏览器 安卓下载)

大家好,今天小编来为大家解答谷歌浏览器event listener这个问题,谷歌浏览器 安卓下载很多人还不知道,现在让我们一起来看看吧!

谷歌浏览器event listener(谷歌浏览器 安卓下载)

本文目录

  1. EasyExcel使用(一):监听器
  2. Android操作系统是基于Linux Kernel是什么意思
  3. android是什么
  4. android onTouchEvent和setOnTouchListener中onTouch的区别
  5. Hibernate 3的新特性 Event-listener 的详细实用
  6. springevent是否可以跨服务监听

一、EasyExcel使用(一):监听器

1、公司在excel导入导出选择了 EasyExcel框架弥补poi大量占用内存的缺陷。

2、继承监听器 AnalysisEventListener抽象类需要实现invoke、doAfterAllAnalysed、onException三个接口。

3、 invoke方法负责每一行解析后触发的函数,data是读取excel后转换的实体,context是整个上下文。

4、在这里我们我们可以对每一行导入数据进行校验。

5、 doAfterAllAnalysed方法负责所有行数都结束后触发的函数。

6、在这里我们可以对已经解析完毕的数据进行批量导入。

7、关于使用Mybatis-plus批量导入saveBatch性能问题看这里

8、 onException方法负责针对捕捉到异常的数据触发的函数。(如果在此抛出异常则停止读取)

9、 EasyExcel使用(二):公共监听器

二、Android操作系统是基于Linux Kernel是什么意思

1、kernel(内核):是操作系统最基本的部分,是一个操作系统的核心。是基于硬件的第一层软件扩充,提供操作系统的最基本的功能,是操作系统工作的基础,它负责管理系统的进程、内存、内核体系结构、设备驱动程序、文件和网络系统,决定着系统的性能和稳定。

2、Linux内核:顾名思义即Linux系统的核心,是Linux操作系统最基本的部分,所谓内核通俗的讲,就是负责硬件管理,为应用程序招供操作硬件的接口。

3、Android(安卓):本质上是一个基于 Linux内核上面运行的 java虚拟机,实际上就是一个解释程序。它相当于一个应用程序,应用程序要运行需要一个平台,这个平台是Linux内核。这就是Android操作系统是基于Linux Kernel的意思。

三、android是什么

1.公开优势方面,Android平台首先是开放的,发达的平台允许任何移动终端厂商加入Android联盟。显著的开放性可以让它拥有更多的开发者,随着用户和应用的不断增加,一个全新的平台很快就会成熟。2.丰富的硬件这还是和Android平台的开放性有关。由于Android的开放性,很多厂商会推出各种不同功能和特点的产品。功能差异和特性不会影响数据同步甚至软件兼容性。3、便于开发Android平台为第三方开发者提供了非常广阔自由的环境,不会受到各种规章制度的阻碍。可想而知会诞生多少新颖独特的软件,但它也有两面性。4.谷歌应用互联网上的谷歌已经走过了10年的历史。从搜索巨头到互联网全面渗透,地图、邮件、搜索等谷歌服务已经成为用户与互联网之间的重要纽带,安卓平台手机将这些优秀的谷歌服务无缝结合。

四、android onTouchEvent和setOnTouchListener中onTouch的区别

Android中的事件分为按键事件和触摸事件,这里对触摸事件进行阐述。Touch事件是由一个ACTION_DOWN,n个

ACTION_MOVE,一个ACTION_UP组成onClick,onLongClick,onScroll等事件。Android中的控件都是继承

View这个基类的,而控件分为两种:一种是继承View不能包含其他控件的控件;一种是继承ViewGroup可以包含其他控件的控件,暂且称为容器控

件,比如ListView,GridView,LinearLayout等。

Ø public boolean dispatchTouchEvent(MotionEventev)这个方法分发TouchEvent

Ø public booleanonInterceptTouchEvent(MotionEvent ev)这个方法拦截TouchEvent

Ø public boolean onTouchEvent(MotionEvent ev)这个方法处理TouchEvent

其中view类中有dispatchTouchEvent和onTouchEvent两个方法,ViewGroup继承View,而且还新添了一个

onInterceptTouchEvent方法。Activity中也无onInterceptTouchEvent方法,但有另外两种方法。我们可以

发现上面3个方法都是返回boolean,那各代表什么意思呢?

 public boolean dispatchTouchEvent(MotionEvent ev)

Called to process touch screen

events.You can override this to intercept all touch screen events before

they aredispatched to the window. Be sure to call this implementation

for touch screenevents that should be handled normally.

· boolean Return true if this event was consumed.

它会被调用处理触摸屏事件,可以重写覆盖此方法来拦截所有触摸屏事件在这些事件分发到窗口之前。通常应该处理触摸屏事件,一定要调用这个实现。当返

回值为true时,表示这个事件已经被消费了。例如在TextActivity中dispatchTouchEvent在ACTION_MOVE返回

也就是它并没有把那ACTION_MOVE分发下去。

public boolean onInterceptTouchEvent(MotionEvent ev)

method to intercept all touch screen motion events. This allows you

towatch events as they are dispatched to your children, and take

ownership of thecurrent gesture at any point.

Usingthis function takes some care, as it has a fairly complicated interaction with View.onTouchEvent(MotionEvent),and

using it requires implementing that method as well as this one in

thecorrect way. Events will be received in the following order:

1. You will receive the down event here.

down event will be handled either by a child of this viewgroup, or

given to your own onTouchEvent() method to handle; this means youshould

implement onTouchEvent() to return true, so you will continue to see

therest of the gesture(instead of looking for a parent view to handle

it). Also,by returning true from onTouchEvent(), you will not receive

any followingevents in onInterceptTouchEvent() and all touch processing

must happen inonTouchEvent() like normal.

as long as you return false from this function, eachfollowing event(up

to and including the final up) will be delivered first hereand then to

the target's onTouchEvent().

you return true from here, you will not receive any followingevents:

the target view will receive the same event but with the action ACTION_CANCEL, and all further events will be delivered to youronTouchEvent() method and no longer appear here.

The motion event being dispatched down the hierarchy.

true to steal motionevents from the children and have them dispatched

to this ViewGroup throughonTouchEvent(). The current target will receive

an ACTION_CANCEL event, and nofurther messages will be delivered here.

1. ACTION_DOWN首先会传递到onInterceptTouchEvent()方法

2.如果该ViewGroup的onInterceptTouchEvent()在接收到down事件处理完成之后return false,那么后续的move, up等事件将继续会先传递给该ViewGroup,之后才和down事件一样传递给最终的目标view的onTouchEvent()处理。

3.如果该ViewGroup的onInterceptTouchEvent()在接收到down事件处理完成之后return true,那么后续的move, up等事件将不再传递给onInterceptTouchEvent(),而是和down事件一样传递给该ViewGroup的onTouchEvent()处理,注意,目标view将接收不到任何事件。

4.如果最终需要处理事件的view的onTouchEvent()返回了false,那么该事件将被传递至其上一层次的view的onTouchEvent()处理。

5.如果最终需要处理事件的view的onTouchEvent()返回了true,那么后续事件将可以继续传递给该view的onTouchEvent()处理。

暂且不管onUserInteraction方法因为它只是一个空方法如果你没实现的话。getWindow().superDispatchTouchEvent(ev)。其中getWindow()返回的是PhoneWindow。

此函数调用super.dispatchTouchEvent(event),Activity的rootview是

PhoneWindow.DecorView,它继承FrameLayout。通过super.dispatchTouchEvent把touch事件派

发给各个Activity的是子view。同时我可以看到,如果子view拦截了事件,则不会执行onTouchEvent函数。

ViewGroup.java中dispatchTouchEvent方法:

由于代码过长这里就不贴出来了,但也知道它返回的是

return target.dispatchTouchEvent(ev);

这里target指的是所分发的目标,可以是它本身,也可以是它的子View。

ViewGroup.java中的onInterceptTouchEvent方法:

默认情况下返回false。即不拦截touch事件。

View.java中的dispatchTouchEvent方法

这里我们很清楚可以知道如果if条件不成立则dispatchTouchEvent的返回值是onTouchEvent的返回值

五、Hibernate 3的新特性 Event-listener 的详细实用

1、能够取得运行期详细信息,除了能记录粗粒度的实体的保存删除操作外,还能精确追踪对实体字段修改、实体关联/级联关系的变更,能记录更新前的值、更新后的值,可以生成详细日志。

2、灵活解耦,跨数据库,不影响原有代码。

3、 Hibernate3新特性事件处理框架是hibernate 2拦截器的一个补充或者替代,由拦截器被动拦截操作事件变成事件源的主动驱动,这是一个进步。Hibernate事件框架官方文档.

4、 Hibernate3中定义了很多的事件,涵盖了持久化过程中不同的生命周期。简单说Session的一个方法(load, flush...)分别对应一个事件,当该方法被调用时,就会触发一个相应的事件,这个事件会被我们预先定义的事件监听器收到,再进行相应的处理。这种方式来做审计日志是再适合不过。

5、但也有个缺点就是这样的Event-listener是脱离主容器(比如Spring IoC环境)单独实例化的,无法访问主容器的资源(比如要取得当前登录的用户信息就会比较麻烦)。这个暂时还没解决。

6、在这里我们选取PostInsertEventListener(插入后事件),PostUpdateEventListener(更新后事件),PostDeleteEventListener(删除后事件)接口作为CRUD方法的监听接口。hibernate3中事件是分为pre和 post,表示该发生事件前、后。这里我们全部用Post,因为PostEvent只有在数据实际改变后才会触发,假如CRUD事务因为异常回滚,则不会触发事件。

7、首先定义一个mark接口Historiazable,实现该接口的entity类表明是需要做审计日志的。

8、然后编写我们自定义的EventListener类,实现上述的事件接口。

9、在事件接口实现方法里在根据不同的事件编写审计日志的代码。

10、public class HistoryListener implements PostInsertEventListener,

11、 PostUpdateEventListener, PostDeleteEventListener{

12、 public void onPostInsert(PostInsertEvent event){

13、 if(event.getEntity() instanceof Historizable){

14、 public void onPostUpdate(PostUpdateEvent event){

15、 if(event.getEntity() instanceof Historizable){

16、 public void onPostDelete(PostDeleteEvent event){

17、 if(event.getEntity() instanceof Historizable){

18、编辑hibernate.cfg.xml,配置监听器

19、<listener type="post-insert" class="net.jeffrey.hibernate.history.HistoryListener"/>

20、<listener type="post-update" class="net.jeffrey.hibernate.history.HistoryListener"/>

21、<listener type="post-delete" class="net.jeffrey.hibernate.history.HistoryListener"/>

22、<property name="hibernate.ejb.cfgfile" value="hibernate.cfg.xml"/>

六、springevent是否可以跨服务监听

springevent可以跨服务监听。根据查询相关信息springevent监听范围

2、定义监听ApplicationListener接口,要么在方法上添加EventListener注解。

3、发布事件,调用ApplicationContext.publishEvent()或者ApplicationEventPublisher.publishEvent()。比如用户注册成功以后,系统要给用户发送一封邮件,同时还要给用户发放优惠券,为了跟注册流程解耦,可以在注册成功以后发出一个事件,让其他服务来监听。

好了,文章到此结束,希望可以帮助到大家。

声明:信息资讯网所有作品(图文、音视频)均由用户自行上传分享,仅供网友学习交流,版权归原作者东方体育日报所有。若您的权利被侵害,请联系 删除。

本文链接:http://www.gdxhedu.com/news/157445.html