我需要获得可拖动面板的下降位置.但我无法弄清楚如何做到这一点.我试图获得这种风格,但我得到了无关的信息.
这是我的xhtml:
<h:form id="dnd">
<p:panel id="draggable1"
style="z-index:1; width: 60px; height: 60px;">
<h:outputText value="CAM-1" />
<p:draggable for="draggable1"
revert ="false"/>
</p:panel>
<p:panel id="droppable"
style="z-index:1; width: 600px; height: 600px;">
<p:droppable for="droppable">
<p:ajax listener="#{myBean.onDrop}" />
</p:droppable>
</p:panel>
</h:form>
Run Code Online (Sandbox Code Playgroud)
这是我的支持bean:
public void onDrop(DragDropEvent dragDropEvent) {
String dragId = dragDropEvent.getDragId();
UIComponent draggedItem = FacesContext.getCurrentInstance().getViewRoot().findComponent(dragId);
System.out.println(draggedItem.getClientId());
Panel draggedPanel = (Panel) draggedItem;
String style = draggedPanel.getStyle();
System.out.println(style);
String styleClass = draggedPanel.getStyleClass();
System.out.println(styleClass);
}
Run Code Online (Sandbox Code Playgroud)
任何帮助将不胜感激.提前致谢.