使用primefaces 5.0面板意外更改位置

时间:2014-08-28 16:51:34

标签: css jsf jsf-2 primefaces

大家好我正在做一个带有primefaces 5的便签系统,这些音符与图像重叠,音符的位置和文本都保存在posgrest数据库中。

基本上我到目前为止所做的是一个可拖动的文本区域,它从数据库中获取一些css值,但是当我在数据库中保存数据时,我有一个问题,即音符回到0,0位置并且是不能拖动,你必须重新加载页面。我使用事件模糊保存值。

这就是发生的事情 postConstruct如何加载屏幕中的元素呢 enter image description here 这是保存更改后发生的情况,但在数据库中保存得很好。 enter image description here

这是我的代码

xhtml文件

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui">
<h:head>


</h:head>
<h:body>

<h:form id="notesForm">

    <p:panel id="board">
     <h:graphicImage library="images" name="prime.png"
            style="z-index:-100">
        </h:graphicImage>
        <p:dataList value="#{anotationBean.listanotationModel}"
            var="anotation" type="definition">

            <p:panel id="opnl"
                style="background: transparent; padding: 0px; width: 180px; height:10px; top:#{anotation.posy}; left:#{anotation.posx}">
                <p:ajax event="close" listener="#{anotationBean.onClose}" />
                <p:inputTextarea rows="5" cols="30" value="#{anotation.text}"
                    style="width: 80%; height:80%; background-color:#{anotation.bodycolor};color:#{anotation.fontcolor};  ">
                    <p:ajax event="blur" update="opnl"
                        listener="#{anotationBean.saveAnotation(anotation)}" />
                </p:inputTextarea>


            </p:panel>
            <p:resizable for="opnl" minWidth="100" minHeight="100" />
            <p:draggable for="opnl" opacity="0.3" />

        </p:dataList>


    </p:panel>


</h:form>

</h:body>
</html>

感谢您的时间和答案,我真的很赞成改善我的代码行为

0 个答案:

没有答案