你如何改变鼠标突出显示? [英] How do you change the mouse over highlighting?

查看:693
本文介绍了你如何改变鼠标突出显示?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在GWT中,我使用CellTable。



将鼠标悬停在CellTable上时,它会突出显示每一行。



如何改变鼠标悬停的突出显示行为?具体来说: > 禁用/启用 使

  • 仅使光标处的特定网格项(而不是整行)高亮显示



  • (目前我已经创建了一列1列宽的CellTables,并将它们添加到VerticalPanel布局中......创建幻觉有一个CellTable,它会根据您的光标突出显示每个网格。这是不好的?为什么?性能?)

    解决方案你会注意到CellTable使用了一个ResourceBundle,这意味着所有的css样式都被混淆了......这使得覆盖样式变得更加困难。



    CellTable构造函数实际上允许您覆盖默认的ResourceBundle。首先,您需要创建自己的资源包,如下所示:

      public interface CellTableResources extends Resources {

    public CellTableResources INSTANCE =
    GWT.create(CellTableResources.class);

    / **
    *此小部件中使用的样式。
    * /
    @Source(CellTable.css)
    CellTable.Style cellTableStyle();
    }

    然后您需要创建自己的CSS文件。我建议直接将CellTable样式复制到您的项目中,并以此作为起点。您可以在这里找到它:
    http://code.google.com/p/google-web-toolkit/source/browse/trunk/user/src/com/google/gwt/user/cellview/client/ CellTable.css



    请确保首先注入样式,然后将它馈送到CellTable的构造函数中,如下所示:

      CellTableResources.INSTANCE.cellTableStyle()。ensureInjected(); 
    myCellTable = new CellTable< T>(Integer.MAX_VALUE,CellTableResources.INSTANCE);

    具体来说,您需要调整这些样式:




    • cellTableKeyboardSelectedRow
    • cellTableKeyboardSelectedRowCell
    • cellTableSelectedRow

    • cellTableSelectedRowCell

    • cellTableKeyboardSelectedCell



    请注意,单元格表区分'selected row'和键盘选择行。所选行是所选的实际行(即通过SelectionModel)。键盘选择行是指当用户按下上/下键时突出显示的内容,但并不意味着该行实际上被选中(如果有意义的话)。


    In GWT, I am using CellTable.

    When you mouse over the CellTable it highlights each row.

    How do change the behavior of the highlighting from the mouse over? Specifically:

    • change the color of highlighting
    • disable/enable
    • make it highlight only the specific grid item at your cursor (instead of the entire row)

    ( The current hack I have is to create a bunch of 1 column wide CellTables and add them to a VerticalPanel layout... creating the illusion that there is one CellTable and it highlights each grid according to your cursor. Is this bad? Why? performance? )

    解决方案

    You will notice the CellTable uses a ResourceBundle, which means all the css styles get obfuscated ... this makes it more difficult to override styles.

    The CellTable constructor will actually allow you to override the default ResourceBundle. So first, you need to create your own resource bundle like this:

    public interface CellTableResources extends Resources {
    
            public CellTableResources INSTANCE =
                    GWT.create(CellTableResources.class);
    
            /**
             * The styles used in this widget.
             */
            @Source("CellTable.css")
            CellTable.Style cellTableStyle();
    }
    

    Then you need to create your own CSS file. I recommend copying the CellTable style directly into your project and use that as a starting point. You can find it here: http://code.google.com/p/google-web-toolkit/source/browse/trunk/user/src/com/google/gwt/user/cellview/client/CellTable.css

    Make sure the style is injected first, and then you just feed it into the CellTable's constructor like this:

       CellTableResources.INSTANCE.cellTableStyle().ensureInjected();
       myCellTable = new CellTable<T>(Integer.MAX_VALUE,CellTableResources.INSTANCE);
    

    Specifically, you'll want to tweak these styles:

    • cellTableKeyboardSelectedRow
    • cellTableKeyboardSelectedRowCell
    • cellTableSelectedRow
    • cellTableSelectedRowCell
    • cellTableKeyboardSelectedCell

    It is important to note that the cell table differentiates between the 'selected row' and the 'keyboard selected row'. The selected row is the actual row selected (ie via SelectionModel). The keyboard selected row refers to what is highlighted when the user is pressing the up / down key, but does not mean the row is actually selected (if that makes sense).

    这篇关于你如何改变鼠标突出显示?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆