Package edu.mit.blocks.workspace

Examples of edu.mit.blocks.workspace.WorkspaceEvent


            }
        }
        if (renderable.hasComment()) {
            renderable.removeComment();
        }
        workspace.notifyListeners(new WorkspaceEvent(workspace, widget, renderable.getBlockID(), WorkspaceEvent.BLOCK_REMOVED));
    }
View Full Code Here


            removeBlock(childRenderable, widget, container);
        }
        if (renderable.hasComment()) {
            renderable.removeComment();
        }
        workspace.notifyListeners(new WorkspaceEvent(workspace, widget, renderable.getBlockID(), WorkspaceEvent.BLOCK_REMOVED));
    }
View Full Code Here

                    + "parent block was valid, non-null, and existed.\n\tBut yet, when we get it's renderable"
                    + "representation, we recieve a null instance.\n\tIf the Block instance of an ID is non-null"
                    + "then its graphical RenderableBlock should be non-null as well");
        }
        parentRenderable.blockDisconnected(parentSocket);
        workspace.notifyListeners(new WorkspaceEvent(workspace, widget, link, WorkspaceEvent.BLOCKS_DISCONNECTED));
    }
View Full Code Here

                } else {
                    // drop and link the new block
                    link.connect();
                    dropBlock(childBlock);

                    workspace.notifyListeners(new WorkspaceEvent(
                            workspace,
                            workspace.getEnv().getRenderableBlock(link.getPlugBlockID()).getParentWidget(),
                            link, WorkspaceEvent.BLOCKS_CONNECTED));
                    workspace.getEnv().getRenderableBlock(link.getSocketBlockID()).moveConnectedBlocks();
                    workspace.getEnv().getRenderableBlock(link.getSocketBlockID()).repaintBlock();
View Full Code Here

            parent.validate();
        }

        block.setParentWidget(null);
        Workspace workspace = block.getWorkspace();
        workspace.notifyListeners(new WorkspaceEvent(workspace, widget, block.getBlockID(), WorkspaceEvent.BLOCK_REMOVED));

    }
View Full Code Here

                link = BlockLinkChecker.canLink(workspace, block, childBlock, socket, childBlock.getBeforeConnector());
            } else {
                link = null;
            }//assume link is not null
            link.connect();
            workspace.notifyListeners(new WorkspaceEvent(workspace, workspace.getEnv().getRenderableBlock(link.getPlugBlockID()).getParentWidget(), link, WorkspaceEvent.BLOCKS_CONNECTED));

        }
        if (node.getAfterNode() != null) {
            BlockConnector socket = block.getAfterConnector(); //assume has after connector
            BlockNode child = node.getAfterNode();
            RenderableBlock childRenderable = makeRenderable(workspace, child, widget);
            Block childBlock = workspace.getEnv().getBlock(childRenderable.getBlockID());

            //link blocks
            BlockLink link;
            if (childBlock.hasPlug()) {
                link = BlockLinkChecker.canLink(workspace, block, childBlock, socket, childBlock.getPlug());
            } else if (childBlock.hasBeforeConnector()) {
                link = BlockLinkChecker.canLink(workspace, block, childBlock, socket, childBlock.getBeforeConnector());
            } else {
                link = null;
            }//assume link is not null
            link.connect();
            workspace.notifyListeners(new WorkspaceEvent(workspace, workspace.getEnv().getRenderableBlock(link.getPlugBlockID()).getParentWidget(), link, WorkspaceEvent.BLOCKS_CONNECTED));

        }
        return renderable;
    }
View Full Code Here

    @Override
    public void mouseClicked(MouseEvent e) {
        toggle();
        RenderableBlock rb = workspace.getEnv().getRenderableBlock(getBlockID());
        rb.getComment().setVisible(isActive());
        workspace.notifyListeners(new WorkspaceEvent(workspace, rb.getComment().getCommentSource().getParentWidget(), WorkspaceEvent.BLOCK_COMMENT_VISBILITY_CHANGE));
        update();
        rb.revalidate();
        rb.repaint();
        workspace.getMiniMap().repaint();
    }
View Full Code Here

        BlockLink link = BlockLink.getBlockLink(workspace, this, b2, conn, conn2);
        RenderableBlock rb = workspace.getEnv().getRenderableBlock(link.getSocketBlockID());
        link.disconnect();
        rb.blockDisconnected(link.getSocket());
        workspace.notifyListeners(
                new WorkspaceEvent(workspace, rb.getParentWidget(), link, WorkspaceEvent.BLOCKS_DISCONNECTED));

    }
View Full Code Here

                //don't tell the block about the disconnect like we would normally do, because
                // we don't actually want it to have a chance to remove any expandable sockets
                // since the inserted block will be filling whatever socket was vacated by this
                // broken link.
                //NOTIFY WORKSPACE LISTENERS OF DISCONNECTION (not sure if this is great because the connection is immediately replaced)
                workspace.notifyListeners(new WorkspaceEvent(workspace, workspace.getEnv().getRenderableBlock(socketBlock.getBlockID()).getParentWidget(), link, WorkspaceEvent.BLOCKS_DISCONNECTED));
            }
        }
        if (plug.hasBlock()) {
            // in the case of insertion, breaking the link above will mean that
            // the plug shouldn't be connected by the time we reach here.  This
View Full Code Here

TOP

Related Classes of edu.mit.blocks.workspace.WorkspaceEvent

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.