我正在为我的项目使用gwt-connector,我每次点击一个按钮时都会尝试创建新的连接器。这是代码:
public class ERD1 implements EntryPoint {
public void onModuleLoad() {
AbsolutePanel boundaryPanel = new AbsolutePanel();
boundaryPanel.setPixelSize(1000, 1000);
final Diagram d = new Diagram(boundaryPanel);
Button b = new Button();
b.addClickListener(new ClickListener(){
@Override
public void onClick(Widget sender) {
SectionDecoration startDecoration = new SectionDecoration
(SectionDecoration.DECORATE_ARROW);
SectionDecoration endDecoration = new SectionDecoration
(SectionDecoration.DECORATE_ARROW);
Connector con = new Connector(10, 10, 10, 10, startDecoration, endDecoration);
con.showOnDiagram(d);
}
});
boundaryPanel.add(b, 10, 40);
RootPanel.get().add(boundaryPanel);
}
}
但是当我点击按钮时,我收到以下错误:
[ERROR] Uncaught exception escaped
java.lang.IllegalArgumentException: Sections must be horizontal or vertical!
at pl.tecna.gwt.connectors.client.Section.<init>(Section.java:44)
at pl.tecna.gwt.connectors.client.Connector.recreateSections(Connector.java:226)
at pl.tecna.gwt.connectors.client.Connector.showOnDiagram(Connector.java:162)
at com.e.r.d.client.ERD1$1.onClick(ERD1.java:45)
at com.google.gwt.user.client.ui.ListenerWrapper$WrappedClickListener.onClick(ListenerWrapper.java:245)
at com.google.gwt.event.dom.client.ClickEvent.dispatch(ClickEvent.java:54)
at com.google.gwt.event.dom.client.ClickEvent.dispatch(ClickEvent.java:1)
at com.google.gwt.event.shared.HandlerManager$HandlerRegistry.fireEvent(HandlerManager.java:65)
at com.google.gwt.event.shared.HandlerManager$HandlerRegistry.access$1(HandlerManager.java:53)
at com.google.gwt.event.shared.HandlerManager.fireEvent(HandlerManager.java:178)
at com.google.gwt.user.client.ui.Widget.fireEvent(Widget.java:52)
at com.google.gwt.event.dom.client.DomEvent.fireNativeEvent(DomEvent.java:116)
at com.google.gwt.user.client.ui.Widget.onBrowserEvent(Widget.java:90)
at com.google.gwt.user.client.DOM.dispatchEventImpl(DOM.java:1320)
at com.google.gwt.user.client.DOM.dispatchEventAndCatch(DOM.java:1299)
at com.google.gwt.user.client.DOM.dispatchEvent(DOM.java:1262)
at sun.reflect.GeneratedMethodAccessor10.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
at com.google.gwt.dev.shell.ie.IDispatchImpl.callMethod(IDispatchImpl.java:126)
at com.google.gwt.dev.shell.ie.IDispatchProxy.invoke(IDispatchProxy.java:155)
at com.google.gwt.dev.shell.ie.IDispatchImpl.Invoke(IDispatchImpl.java:294)
at com.google.gwt.dev.shell.ie.IDispatchImpl.method6(IDispatchImpl.java:194)
at org.eclipse.swt.internal.ole.win32.COMObject.callback6(COMObject.java:117)
at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:1925)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2966)
at com.google.gwt.dev.SwtHostedModeBase.processEvents(SwtHostedModeBase.java:264)
at com.google.gwt.dev.HostedModeBase.pumpEventLoop(HostedModeBase.java:557)
at com.google.gwt.dev.HostedModeBase.run(HostedModeBase.java:405)
at com.google.gwt.dev.HostedMode.main(HostedMode.java:232)
请有人告诉我出了什么问题。 谢谢。
答案 0 :(得分:0)
我认为出了什么问题。
Connector con = new Connector(10, 10, 10, 10, startDecoration, endDecoration);
这里我有10,10,10,10彼此重叠。这就是错误的原因。
答案 1 :(得分:0)
似乎所有要点都在同一点上。尝试不同点怎么样?比如说Connector con = new Connector(10, 15, 29, 100, startDecoration, endDecoration);
或其他什么。