我在下面編寫了一個測試類,但我無法將其添加到com.smartgwt.client.widgets.Window中。將gwt連接器添加到smartgwt中
任何人都可以幫助我嗎?提前致謝!
package com.smartgwt.sample.showcase.client;
import pl.tecna.gwt.connectors.client.ConnectionPoint; import pl.tecna.gwt.connectors.client.Connector; import pl.tecna.gwt.connectors.client.Diagram; import pl.tecna.gwt.connectors.client.SectionDecoration; import pl.tecna.gwt.connectors.client.Shape;
import com.google.gwt.user.client.ui.AbsolutePanel; import com.google.gwt.user.client.ui.Composite; import com.google.gwt.user.client.ui.Image; import com.smartgwt.client.widgets.Label;
公共類NetworkMap {
公共NetworkMap(){ AbsolutePanel插件=新AbsolutePanel();
final Diagram diagram = new Diagram(widget);
final Label label = new Label("LABEL");
final Image image = new Image(「http://code.google.com/images/code_sm.png」); image.setPixelSize(153,55);
widget.add(label,50,250); widget.add(image,200,300);
Shape shapeLabel = new Shape(label); shapeForLabel.showOnDiagram(diagram);
形狀shapeForImage = new Shape(image); shapeForImage.showOnDiagram(diagram);
ConnectionPoint labelConnectionPoint = shapeForLabel.connectionPoints [Shape.E]; ConnectionPoint imageConnectionPoint = shapeForImage.connectionPoints [Shape.W];
Connector label2image = new Connector
(labelConnectionPoint.getAbsoluteLeft(),
labelConnectionPoint.getAbsoluteTop(),
imageConnectionPoint.getAbsoluteLeft(),
imageConnectionPoint.getAbsoluteTop(),
null,
new SectionDecoration(SectionDecoration.DECORATE_ARROW));
label2image.startEndPoint.glueToConnectionPoint(labelConnectionPoint);
label2image.endEndPoint.glueToConnectionPoint(imageConnectionPoint);
label2image.showOnDiagram(diagram);
/* // Create boundary panel
AbsolutePanel boundaryPanel = new AbsolutePanel();
initWidget(boundaryPanel); boundaryPanel.setSize(「700px」,「700px」); RootPanel.get()。add(boundaryPanel,10,10);
final Diagram diagram = new Diagram(boundaryPanel);
boundaryPanel.add(new Label(「GWT 1.7」的連接器示例),10,2);
//添加一些可以連接的元素 final Label label = new Label(「LABEL」); final Image image = new Image(「http://code.google.com/images/code_sm.png」); image.setPixelSize(153,55);
boundaryPanel.add(label,50,250); boundaryPanel.add(image,200,300);
Shape shapeLabel = new Shape(label); shapeForLabel。showOnDiagram(圖);
形狀shapeForImage = new Shape(image); shapeForImage.showOnDiagram(diagram);
//連接標籤和圖像 ConnectionPoint labelConnectionPoint = shapeForLabel.connectionPoints [Shape.E]; ConnectionPoint imageConnectionPoint = shapeForImage.connectionPoints [Shape.W];
Connector label2image = new Connector
(labelConnectionPoint.getAbsoluteLeft(),
labelConnectionPoint.getAbsoluteTop(),
imageConnectionPoint.getAbsoluteLeft(),
imageConnectionPoint.getAbsoluteTop(),
null,
new SectionDecoration(SectionDecoration.DECORATE_ARROW));
label2image.startEndPoint.glueToConnectionPoint(labelConnectionPoint);
label2image.endEndPoint.glueToConnectionPoint(imageConnectionPoint);
label2image.showOnDiagram(diagram);
*/
}
}