Provide a Better Visual Feedback – Using Flex CursorManager(Flex鼠标管理 精彩转载)

Why do you need Flex CursorManager

Flex is all about User Experience. A Rich Internet Application (RIA) is not just attractive skins or fancy animations. It also means interacting with users and helping them use your application better.

One important part of User Experience is to provide a better visual feedback. For example, when someone types a model name and clicks Search button, it might take 2-3 seconds to get results from a web service.  What would a user do during that time? He or she probably keeps clicking the Search button, or thinks your application is dead.

So how to let users know what is going on with your application? You need to give them some visual feedback: like show the busy cursor when waiting for the back end response, and then remove the busy cursor when the data is ready.

To control the cursor image in Flex, you need CursorManager.

How to use CursorManager

Here is how you typically use CursorManager in Flex:

- Display the default busy cursor
  CursorManager.setBusyCursor();

- Remove the busy cursor
  CursorManager.removeBusyCursor();

- Create a new Cursor from your own cursor class
  [Bindable]
  [Embed(source="assets/heart.gif")]
  private var HeartCursor:Class;
  var cursorID:int = CursorManager.setCursor(HeartCursor);

- Removes a cursor from the cursor list
  CursorManager.removeCursor(cursorID);

- Remove all cursors
  CursorManager.removeAllCursors();

Sample Code

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
    layout="absolute">

    <mx:Script>
      <![CDATA[
         import mx.managers.CursorManager;

         private var cursorId:int;

         [Bindable]
         [Embed(source="assets/heart.gif")]
         private var HeartCursor:Class;

         private function showBusyCursor():void {
           CursorManager.setBusyCursor();
         }

         private function removeBusyCursor():void {
           CursorManager.removeBusyCursor();
         }            

         private function showHeartCursor():void {
           cursorId = CursorManager.setCursor(HeartCursor);
         }

         private function removeHeartCursor():void {
           CursorManager.removeCursor(cursorId);
         }
     ]]>
    </mx:Script>

    <mx:Panel title="Flex Tutorial - Cursor Manager"
        width="500" height="200"
        horizontalCenter="0" verticalCenter="0" verticalGap="20"
        horizontalAlign="center" verticalAlign="middle">

        <mx:HBox>
          <mx:Button label="Show Busy Cursor"
                     click="showBusyCursor()"/>
          <mx:Button label="Remove Busy Cursor"
                     click="removeBusyCursor()"/>
        </mx:HBox>

        <mx:HRule width="95%"/>

        <mx:HBox>
          <mx:Button label="Show Heart Cursor"
                     click="showHeartCursor()"/>
          <mx:Button label="Remove Heart Cursor"
                     click="removeHeartCursor()"/>
        </mx:HBox>
   </mx:Panel>

</mx:Application>

Conclusion

CursorManager offers a convienent way for you to control cursor display in Flex. By using it properly, you will provide a better visual feedback to users, thus enhance the user experience of your applicaton.

 
 
 
Servlet.service() for servlet [dispatcherServlet] in context with path [/cod] threw exception是指在处理请求时出现了异常。具体的异常信息是由引用和引用提供的。 根据引用中的错误信息,可以看出在处理请求时发生了错误。而引用提供了更具体的异常信息,指出了出现了org.springframework.dao.DataIntegrityViolationException: Error attempting to get column 'title' from result set. Cause: java.sql.SQLDataException: Cannot determine value type from string '数学'的异常。这个异常可能是由于在从结果集中获取列'title'的值时,出现了数据完整性违规的异常。具体是由于字符串'value'的值无法确定其数据类型导致的。 要解决这个异常,可以尝试检查相关的数据库表和实体类的映射关系,确保数据类型的一致性。另外,还可以检查在处理请求时是否有其他的异常抛出,以及在处理请求之前是否进行了正确的配置。引用提供了一个可能的解决方案,即通过配置JAVA_OPTS="-Djava.awt.headless=true"来解决相关问题。重新启动服务后进行测试,看是否能够正常运行。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* [Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception](https://download.csdn.net/download/weixin_38517997/14852674)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"] - *2* [Uncaught (in promise) Error Request failed with status code 500](https://blog.csdn.net/m0_61083409/article/details/123264803)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"] - *3* [java.lang.NoClassDefFoundError: Could not initialize class org.apache.batik.bridge.CursorManager](https://blog.csdn.net/qq_38423256/article/details/118681830)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值