开发者

Two ICEfaces panel positioned interacting

开发者 https://www.devze.com 2023-02-16 10:49 出处:网络
How do you constrain the elements of a开发者_高级运维 PanelPositioned so they can only be dragged within the current panel? I have two vertical lists of different data types, one above the other. Both

How do you constrain the elements of a开发者_高级运维 PanelPositioned so they can only be dragged within the current panel? I have two vertical lists of different data types, one above the other. Both use a PanelPositioned to allow drag & drop reordering, but the elements can be dragged up and down to the other panel, generating an error

<ice:panelPositioned id="dragPanel1" var="dataType1var"
    value="#{displayBean.dataType1List}" constraint="vertical">
    <ice:panelGroup style="cursor:move;">

    </ice:panelGroup>
</ice:panelPositioned>

<ice:panelPositioned id="dragPanel2" var="dataType2var"
    value="#{displayBean.dataType2List}" constraint="vertical">
    <ice:panelGroup style="cursor:move;">

    </ice:panelGroup>
</ice:panelPositioned>


For icefaces 3.0, add a beforeChangeListener to the ice:panelPositioned element. This listener should then call event.cancel() if the event.getType() != to PanelPositionedEvent.TYPE_MOVE and the event.getIndex() and event.getOldIndex() are both greater than 1. If it is a move, then it is within panel. add/delete are moving between panels.

For icefaces 1.8.2 (neve used 2.0), you would need to add a listener to the ice:panelPositioned element. There is no beforeChangeListener. you will need a before list and current list (two copies). Both initialize to same elements when initializing backing bean. The listener, if a move - set before list to current list otherwise set current list to before list. Must be a copy, not a reference.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号