开发者

problem creating new connectore

I am using gwt-connector for my project and i am trying to create new connector each time a button is clicked. Here is the code:

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);
}   
}

but when i click on the button i am getting the following error:

[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)

please can anyone tell me what is going wrong. Thank you.


It seems like all your points are all on the same point. How about trying different points? Like say Connector con = new Connector(10, 15, 29, 100, startDecoration, endDecoration); or something.


I figured what went wrong.

 Connector con = new Connector(10, 10, 10, 10, startDecoration, endDecoration);

here i have 10,10,10,10 which was overlapping on one another. This was the reason for the error.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜