Hello good evening!
Smartgwt am using 2.0.4 and 1.7.1 gwt-connectors. An example of my problem
is the address: http://code.google.com/p/gwt-connectors/
I am trying to print the diagram, but connectors and lines are becoming
invisible. Even in print preview. Anyone know how to fix it? I tried using
css but it did not work .. to help my code follows:

public class WindowMap extends Window {

    public WindowMap(final Editor editor, ScreenSmall[] screenSmalls) {
        setTitle(Message.getInstance().titleMap());
        setWidth(1024);
        setHeight(768);
        setTop(45);
        setCanDragResize(true);
        setShowCustomScrollbars(true);
        setShowMinimizeButton(false);
        DOM.setElementAttribute(getElement(), "id", "map_container");
        addItem(new CompositeMap(screenSmalls));
        draw();
        addCloseClickHandler(new CloseClickHandler() {
            public void onCloseClick(CloseClientEvent event) {
                destroy();
                editor.setEnableMenuMap(false);
                editor.setEnableOpenMap(false);
            }
        });
    }
}



public class CompositeMap extends Composite {

    final AbsolutePanel boundaryPanel;
    final Diagram diagram;
    private TreeMap<String, ScreenSmall> hashIdAndScreen;
    private HashMap<String, NodeScreen> hashIdAndNode;

    public CompositeMap(ScreenSmall[] screenSmalls) {

        boundaryPanel = new AbsolutePanel();
        boundaryPanel.setSize("980px", "768px");
        diagram = new Diagram(boundaryPanel);
        // Create boundary panel
        RootPanel rootPanel = RootPanel.get();
        RootPanel.get().add(boundaryPanel, 0, 0);
        hashIdAndScreen = new TreeMap<String, ScreenSmall>();
        hashIdAndNode = new HashMap<String, NodeScreen>();
        // Rodar a lista de tela com as liga��es
        for (int i = 0; i < screenSmalls.length; i++) {
            ScreenSmall screenSmall = screenSmalls[i];
            hashIdAndScreen.put(screenSmall.getId(), screenSmall);
        }

        int line = 0;
        int cols = 450;

        //  for que come�a pela primeira tela (key = 1) e depois passa para
seus filhos e assim sucessivamente
        Set<String> keys = hashIdAndScreen.keySet();
        for (String key : keys)
        {
            ScreenSmall screenSmall = hashIdAndScreen.get(key);

            NodeScreen node1;
            if (hashIdAndNode.containsKey(screenSmall.getId())) {
                node1 = hashIdAndNode.get(screenSmall.getId());
            } else {
                cols = 450;
                node1 = createNode(boundaryPanel, diagram, screenSmall,
cols, line);
                hashIdAndNode.put(screenSmall.getId(), node1);
                line += 35;
            }

            // for para criar conectores com aqueles j� inclusos no mapa
            List<String> listIn = getIn(screenSmall.getPks());
            for(String id : listIn){
                NodeScreen node2 = hashIdAndNode.get(id);
                createConector(node1.getConnectionPointS(),
node2.getConnectionPointN(), diagram);
            }

            // for para aqueles que ainda n�o foram adicionados no mapa
            List<String> listNotIn = getNotIn(screenSmall.getPks());
            cols = (980 / (listNotIn.size() + 1)) - 250;
            int c = 1;
            for (String id : listNotIn) {
                ScreenSmall screenSmall2 = getScreenSmall(id);
                NodeScreen node2 = createNode(boundaryPanel, diagram,
screenSmall2, c * cols, line);
                hashIdAndNode.put(screenSmall2.getId(), node2);
                createConector(node1.getConnectionPointS(),
node2.getConnectionPointN(), diagram);
                c++;
            }
            line += 35;
        }
        initWidget(boundaryPanel);
        DOM.setStyleAttribute(boundaryPanel.getElement(), "position",
"relative");
        DOM.setStyleAttribute(boundaryPanel.getElement(), "overflow",
"visible");
        DOM.setStyleAttribute(rootPanel.getElement(), "position",
"absolute");
        DOM.setStyleAttribute(rootPanel.getElement(), "overflow", "hidden");
    }

    private List<String> getNotIn(List<String> pks){
        List<String> pkNotInclude = new ArrayList<String>();
        for (String pk : pks)
            if (!hashIdAndNode.containsKey(pk))
                pkNotInclude.add(pk);
        return pkNotInclude;
    }

    private List<String> getIn(List<String> pks){
        List<String> pkInclude = new ArrayList<String>();
        for (String pk : pks)
            if (hashIdAndNode.containsKey(pk))
                pkInclude.add(pk);
        return pkInclude;
    }

    private ScreenSmall getScreenSmall(String id) {
        return hashIdAndScreen.get(id);
    }

    private NodeScreen createNode(AbsolutePanel boundaryPanel, Diagram
diagram, ScreenSmall screenSmall, int x, int y) {
        NodeScreen nodeScreen = new NodeScreen();
        // Texto exibido
        final Button button = new Button(screenSmall.getName());
        button.setAutoWidth();
        button.setOverflow(Overflow.VISIBLE);
        boundaryPanel.add(button, x, y);
        // Fun��o de drag drop
        Shape shape = new Shape(button);
        shape.showOnDiagram(diagram);

        nodeScreen.setConnectionPointS(shape.connectionPoints[Shape.S]);
        nodeScreen.setConnectionPointN(shape.connectionPoints[Shape.N]);
        return nodeScreen;
    }

    private void createConector(ConnectionPoint start, ConnectionPoint end,
Diagram diagram) {
        Connector connector = new Connector(start.getAbsoluteLeft(),
start.getAbsoluteTop(), end.getAbsoluteLeft(), end.getAbsoluteTop(), null,
new SectionDecoration(SectionDecoration.DECORATE_ARROW));
        connector.startEndPoint.glueToConnectionPoint(start);
        connector.endEndPoint.glueToConnectionPoint(end);
        connector.showOnDiagram(diagram);
    }
}


public class NodeScreen {

    ConnectionPoint connectionPointS;
    ConnectionPoint connectionPointN;

    public ConnectionPoint getConnectionPointS() {
        return connectionPointS;
    }
    public void setConnectionPointS(ConnectionPoint connectionPointS) {
        this.connectionPointS = connectionPointS;
    }
    public ConnectionPoint getConnectionPointN() {
        return connectionPointN;
    }
    public void setConnectionPointN(ConnectionPoint connectionPointN) {
        this.connectionPointN = connectionPointN;
    }

}

Thanks!

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to