admin管理员组文章数量:1418689
Drag and Drop works fine when using a Wildfly in Eclipse during development, however after building the .war in production mode and deploying on Wildfly the drop target is not recognized as one (see gif at the bottom):
Expected Behaviour:
Before the update to Vaadin 24.6. everything worked fine, too.
Example to reproduce is similiar to Documentation here
public TestDropComponent() {
VerticalLayout dropLayout= new VerticalLayout();
DropTarget<VerticalLayout> dropTarget = DropTarget.create(dropLayout);
dropTarget.setDropEffect(DropEffect.MOVE);
dropTarget.addDropListener(e -> System.out.println("Element dropped"));
dropTarget.setActive(true);
this.add(dropLayout);
Div box1 = new Div();
DragSource<Div> box1DragSource = DragSource.create(box1);
add(box1);
}
Browser Console may be usefull:
VM1176:3 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'updateDragSource')
at HorizontalLayout.eval (eval at EE (FlowClient-CjLkgOY_.js:3:44102), <anonymous>:3:60)
at Object.eval (eval at EE (FlowClient-CjLkgOY_.js:3:44102), <anonymous>:3:83)
at EE (FlowClient-CjLkgOY_.js:3:44163)
at Zg (FlowClient-CjLkgOY_.js:3:23009)
at u0 (FlowClient-CjLkgOY_.js:1:24807)
at em (FlowClient-CjLkgOY_.js:1:17085)
at z.fb (FlowClient-CjLkgOY_.js:3:72829)
at ro (FlowClient-CjLkgOY_.js:3:15668)
at TE (FlowClient-CjLkgOY_.js:3:46524)
at z.D (FlowClient-CjLkgOY_.js:3:72615)
at Yr (FlowClient-CjLkgOY_.js:1:41683)
at z.eb (FlowClient-CjLkgOY_.js:3:61800)
at z.J (FlowClient-CjLkgOY_.js:3:66191)
at FlowClient-CjLkgOY_.js:3:12557
VM1199:3 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'updateDropTarget')
at HorizontalLayout.eval (eval at EE (FlowClient-CjLkgOY_.js:3:44102), <anonymous>:3:60)
at Object.eval (eval at EE (FlowClient-CjLkgOY_.js:3:44102), <anonymous>:3:83)
at EE (FlowClient-CjLkgOY_.js:3:44163)
at Zg (FlowClient-CjLkgOY_.js:3:23009)
at u0 (FlowClient-CjLkgOY_.js:1:24807)
at em (FlowClient-CjLkgOY_.js:1:17085)
at z.fb (FlowClient-CjLkgOY_.js:3:72829)
at ro (FlowClient-CjLkgOY_.js:3:15668)
at TE (FlowClient-CjLkgOY_.js:3:46524)
at z.D (FlowClient-CjLkgOY_.js:3:72615)
at Yr (FlowClient-CjLkgOY_.js:1:41683)
at z.eb (FlowClient-CjLkgOY_.js:3:61800)
at z.J (FlowClient-CjLkgOY_.js:3:66191)
at FlowClient-CjLkgOY_.js:3:12557
Any guidance what causes this behaviour would be greatly appreciated.
EDIT: I compared the html of the working and not-working version, the difference in the working version is marked:
align-items: center; min-width: 50%;"><vaadin-horizontal-layout id="Target Id: 0/1" class="" style="width: 100%; border-color: rgb(16, 110, 190); border-width: 1px; margin-bottom: 10px; border-style: dashed; height: 100%;"><vaadin-horizontal-layout id="source" draggable="true" style="width: 100%; height: 100%;"><
Drag and Drop works fine when using a Wildfly in Eclipse during development, however after building the .war in production mode and deploying on Wildfly the drop target is not recognized as one (see gif at the bottom):
Expected Behaviour:
Before the update to Vaadin 24.6. everything worked fine, too.
Example to reproduce is similiar to Documentation here
public TestDropComponent() {
VerticalLayout dropLayout= new VerticalLayout();
DropTarget<VerticalLayout> dropTarget = DropTarget.create(dropLayout);
dropTarget.setDropEffect(DropEffect.MOVE);
dropTarget.addDropListener(e -> System.out.println("Element dropped"));
dropTarget.setActive(true);
this.add(dropLayout);
Div box1 = new Div();
DragSource<Div> box1DragSource = DragSource.create(box1);
add(box1);
}
Browser Console may be usefull:
VM1176:3 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'updateDragSource')
at HorizontalLayout.eval (eval at EE (FlowClient-CjLkgOY_.js:3:44102), <anonymous>:3:60)
at Object.eval (eval at EE (FlowClient-CjLkgOY_.js:3:44102), <anonymous>:3:83)
at EE (FlowClient-CjLkgOY_.js:3:44163)
at Zg (FlowClient-CjLkgOY_.js:3:23009)
at u0 (FlowClient-CjLkgOY_.js:1:24807)
at em (FlowClient-CjLkgOY_.js:1:17085)
at z.fb (FlowClient-CjLkgOY_.js:3:72829)
at ro (FlowClient-CjLkgOY_.js:3:15668)
at TE (FlowClient-CjLkgOY_.js:3:46524)
at z.D (FlowClient-CjLkgOY_.js:3:72615)
at Yr (FlowClient-CjLkgOY_.js:1:41683)
at z.eb (FlowClient-CjLkgOY_.js:3:61800)
at z.J (FlowClient-CjLkgOY_.js:3:66191)
at FlowClient-CjLkgOY_.js:3:12557
VM1199:3 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'updateDropTarget')
at HorizontalLayout.eval (eval at EE (FlowClient-CjLkgOY_.js:3:44102), <anonymous>:3:60)
at Object.eval (eval at EE (FlowClient-CjLkgOY_.js:3:44102), <anonymous>:3:83)
at EE (FlowClient-CjLkgOY_.js:3:44163)
at Zg (FlowClient-CjLkgOY_.js:3:23009)
at u0 (FlowClient-CjLkgOY_.js:1:24807)
at em (FlowClient-CjLkgOY_.js:1:17085)
at z.fb (FlowClient-CjLkgOY_.js:3:72829)
at ro (FlowClient-CjLkgOY_.js:3:15668)
at TE (FlowClient-CjLkgOY_.js:3:46524)
at z.D (FlowClient-CjLkgOY_.js:3:72615)
at Yr (FlowClient-CjLkgOY_.js:1:41683)
at z.eb (FlowClient-CjLkgOY_.js:3:61800)
at z.J (FlowClient-CjLkgOY_.js:3:66191)
at FlowClient-CjLkgOY_.js:3:12557
Any guidance what causes this behaviour would be greatly appreciated.
EDIT: I compared the html of the working and not-working version, the difference in the working version is marked:
Share Improve this question edited Jan 29 at 14:02 Toden asked Jan 29 at 13:32 TodenToden 334 bronze badgesalign-items: center; min-width: 50%;"><vaadin-horizontal-layout id="Target Id: 0/1" class="" style="width: 100%; border-color: rgb(16, 110, 190); border-width: 1px; margin-bottom: 10px; border-style: dashed; height: 100%;"><vaadin-horizontal-layout id="source" draggable="true" style="width: 100%; height: 100%;"><
2 Answers
Reset to default 0I can spot one difference to my code where I am using the feature with success, I am setting the effect also in the source.
dragSource.setEffectAllowed(EffectAllowed.MOVE);
The dndConnector.js is not loaded and that's why the JS console is showing the errors. This can happen if the Production build of the Vaadin application did not include that JS resource as part of the packaging. Vaadin adds such resources if your Route annotated classes use those resources. However, it can not determine the required resources if something is constructed indirectly (for example, via Java reflection). In such cases, there are other means of informing Vaadin about it using @Use and @JsModule annotations.
本文标签:
版权声明:本文标题:java - Vaadin DropTarget is not working in Production Mode anymore after updating from 24.1. to 24.6 - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745295145a2652030.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论