Search in sources :

Example 1 with Selectable

use of com.centurylink.mdw.designer.display.Selectable in project mdw-designer by CenturyLinkCloud.

the class RunTimeDesignerCanvas method mouseReleased.

public void mouseReleased(MouseEvent arg0) {
    if (arg0.getButton() == 1)
        return;
    if (!arg0.isPopupTrigger())
        return;
    Graph process = page.getProcess();
    int x = arg0.getX();
    int y = arg0.getY();
    if (process.zoom != 100) {
        x = x * 100 / process.zoom;
        y = y * 100 / process.zoom;
    }
    Object obj = process.objectAt(x, y, getGraphics());
    if (obj == null)
        return;
    if (obj instanceof Selectable) {
    // JPopupMenu popup = this.popup_activity; // TODO
    // if (popup!=null) popup.show(this, arg0.getX(), arg0.getY());
    } else if (obj instanceof Link) {
    }
}
Also used : Graph(com.centurylink.mdw.designer.display.Graph) SubGraph(com.centurylink.mdw.designer.display.SubGraph) Selectable(com.centurylink.mdw.designer.display.Selectable) Link(com.centurylink.mdw.designer.display.Link)

Example 2 with Selectable

use of com.centurylink.mdw.designer.display.Selectable in project mdw-designer by CenturyLinkCloud.

the class FlowchartPage method drop.

public void drop(DropTargetDropEvent e) {
    if (process.isReadonly()) {
        return;
    }
    try {
        if (e.isDataFlavorSupported(DataFlavor.stringFlavor)) {
            Transferable tr = e.getTransferable();
            e.acceptDrop(DnDConstants.ACTION_COPY_OR_MOVE);
            String s = (String) tr.getTransferData(DataFlavor.stringFlavor);
            int i = Integer.parseInt(s.substring(3));
            ActivityImplementorVO nmi = model.getNodeMetaInfo().get(i);
            Selectable object;
            int x = e.getLocation().x;
            int y = e.getLocation().y;
            if (process.zoom != 100) {
                x = x * 100 / process.zoom;
                y = y * 100 / process.zoom;
            }
            if (nmi.getImplementorClassName().equals(NodeMetaInfo.PSEUDO_PROCESS_ACTIVITY)) {
                String type = promptEmbeddedProcessType(process);
                if (type != null)
                    object = process.addSubGraph(x, y, type, recordchange);
                else
                    object = null;
            } else {
                object = process.addNode(nmi, x, y, recordchange);
            }
            e.dropComplete(true);
            if (object != null) {
                canvas.setSelectedObject(object);
                canvas.requestFocus();
                canvas.repaint();
            }
        } else {
            e.rejectDrop();
        }
    } catch (IOException io) {
        // io.printStackTrace();
        e.rejectDrop();
    } catch (UnsupportedFlavorException ufe) {
        // ufe.printStackTrace();
        e.rejectDrop();
    }
}
Also used : ActivityImplementorVO(com.centurylink.mdw.model.value.activity.ActivityImplementorVO) Selectable(com.centurylink.mdw.designer.display.Selectable) Transferable(java.awt.datatransfer.Transferable) IOException(java.io.IOException) UnsupportedFlavorException(java.awt.datatransfer.UnsupportedFlavorException) Point(java.awt.Point)

Example 3 with Selectable

use of com.centurylink.mdw.designer.display.Selectable in project mdw-designer by CenturyLinkCloud.

the class FlowchartPage method dragDropEnd.

public void dragDropEnd(DragSourceDropEvent e) {
    if (Constants.isMacOsX()) {
        ActivityImplementorVO nmi = model.getNodeMetaInfo().get(nodepane.getSelectedNode());
        Selectable object;
        Point p = canvas.getMousePosition();
        int x = p.x;
        int y = p.y;
        if (process.zoom != 100) {
            x = x * 100 / process.zoom;
            y = y * 100 / process.zoom;
        }
        if (nmi.getImplementorClassName().equals(NodeMetaInfo.PSEUDO_PROCESS_ACTIVITY)) {
            String type = promptEmbeddedProcessType(process);
            if (type != null)
                object = process.addSubGraph(x, y, type, recordchange);
            else
                object = null;
        } else {
            object = process.addNode(nmi, x, y, recordchange);
        }
        if (object != null) {
            canvas.setSelectedObject(object);
            canvas.requestFocus();
            canvas.repaint();
        }
    }
}
Also used : ActivityImplementorVO(com.centurylink.mdw.model.value.activity.ActivityImplementorVO) Selectable(com.centurylink.mdw.designer.display.Selectable) Point(java.awt.Point) Point(java.awt.Point)

Aggregations

Selectable (com.centurylink.mdw.designer.display.Selectable)3 ActivityImplementorVO (com.centurylink.mdw.model.value.activity.ActivityImplementorVO)2 Point (java.awt.Point)2 Graph (com.centurylink.mdw.designer.display.Graph)1 Link (com.centurylink.mdw.designer.display.Link)1 SubGraph (com.centurylink.mdw.designer.display.SubGraph)1 Transferable (java.awt.datatransfer.Transferable)1 UnsupportedFlavorException (java.awt.datatransfer.UnsupportedFlavorException)1 IOException (java.io.IOException)1