MinimizeEvent中的event.stopPropagation在zk 7.1中不起作用

时间:2014-10-07 06:12:56

标签: events binding zk stoppropagation

这是我的代码

<window id="chatW" border="none" mode="overlapped"
    viewModel="@id('vm') @init('zul.chat.chattest.ChatController')"
    binder="@init(queueScope='application')"
    minimizable="true"
    onClick="@command('showChat')"
    title="${labels.conversation }" apply="org.zkoss.bind.BindComposer"
    onMinimize="@command('minimize')">
</window>
控制器

和方法最小化

    @Command("minimize")
    @NotifyChange("minimizedWindow")
    public void minimize(
            @ContextParam(ContextType.TRIGGER_EVENT) MinimizeEvent event) {
        System.out.println("in minimize event" + event);
        event.stopPropagation();
    }

当我点击最小化按钮窗口消失时。我怎么能阻止这个事件?

2 个答案:

答案 0 :(得分:0)

您必须添加一个按钮以获取窗口,请参阅下面的代码

<?page title="new page title" contentType="text/html;charset=UTF-8"?>
<zk>
    <window  height="100%" width="100%" border="normal">

    <panel id="panel" title="Panel" framable="true" height="400px" width="700px"
        maximizable="true" minimizable="true"  border="normal" collapsible="true" closable="true">

        <panelchildren>       
        <tabbox >
            <tabs>
                <tab label="Find"></tab>
                <tab label="Result"></tab>
            </tabs>
            <tabpanels>
                <tabpanel>
                    <grid id="OwnerMultipleGrd" 
                        mold="paging" pageSize="5" style="align:top;">
                        <columns>
                            <column align="center" width="25px">
                                <checkbox></checkbox>
                            </column>
                            <column align="center">Taxonomy</column>
                            <column align="center">Asset Type</column>
                            <column align="center">Category</column>
                            <column align="center">Sub-Category</column>
                            <column align="center" width="25px">
                                <image id="AddTaxononomyImg"
                                    src="/AMContribution/Icons/Add.png">
                                </image>
                            </column>
                        </columns>                      
                    </grid>
                </tabpanel>

                <tabpanel>
                    <grid id="demoGrid" 
                        mold="paging" pageSize="5" style="align:top;">                      
                        <auxhead>
                            <auxheader width="25px">                            
                            </auxheader>
                            <auxheader >
                                <image
                                    src="/TaxonomyManager/Icons/funnel.png" />
                                <textbox id="filter1" width="100px" />
                            </auxheader>
                            <auxheader >
                                <image
                                    src="/TaxonomyManager/Icons/funnel.png" />
                                <textbox id="filter2" width="100px" />
                            </auxheader>
                            <auxheader >
                                <image
                                    src="/TaxonomyManager/Icons/funnel.png" />
                                <textbox id="filter3" width="100px" />
                            </auxheader>
                            <auxheader >
                                <image
                                    src="/TaxonomyManager/Icons/funnel.png" />
                                <textbox id="filter4" width="100px" />
                            </auxheader>                            
                        </auxhead>
                        <columns>                           
                            <column width="25px"><checkbox></checkbox> </column>
                            <column>Taxonomy</column>
                            <column>Asset Type</column>
                            <column>Category</column>
                            <column>Sub-Category</column>                           
                        </columns>                      
                    </grid>
                    <div align="center">
                    <button>Submit</button> <button>Cancel</button>
                    </div>

                </tabpanel>
            </tabpanels>
        </tabbox>
         </panelchildren>
    </panel>
    <button label="restore">
        <attribute name="onClick">
            panel.setMinimized(false);
        </attribute>
    </button>
    </window>
</zk>

答案 1 :(得分:0)

必须在客户端停止最小化效果,因为最小化效果不受服务器控制 看看here.