当前位置: 首页>>代码示例>>Java>>正文


Java PageChangeEventManager类代码示例

本文整理汇总了Java中edu.mit.blocks.workspace.PageChangeEventManager的典型用法代码示例。如果您正苦于以下问题:Java PageChangeEventManager类的具体用法?Java PageChangeEventManager怎么用?Java PageChangeEventManager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


PageChangeEventManager类属于edu.mit.blocks.workspace包,在下文中一共展示了PageChangeEventManager类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: automateBlockDeletion

import edu.mit.blocks.workspace.PageChangeEventManager; //导入依赖的package包/类
/**
 * @requires the current block with focus must exist with non-null
 * 			 ID in a non-null widget with a non-null parent
 * @modifies the current block with focus
 * @effects  removes the current block with focus and all
 * 			 its children from the GUI and destroys the link
 * 			 between the block with focus and it's parent
 * 			 block if one exists
 */
protected void automateBlockDeletion(Workspace workspace) {
    TypeBlockManager typeBlockManager = workspace.getTypeBlockManager();
    if (!typeBlockManager.isEnabled()) {
        System.err.println("AutoMateBlockDeletion invoked but typeBlockManager is disabled.");
        return;
    }
    if (!isNullBlockInstance(typeBlockManager.focusManager.getFocusBlockID())) {
        typeBlockManager.deleteBlockAndChildren();
        PageChangeEventManager.notifyListeners();
    }
}
 
开发者ID:heqichen,项目名称:openblocks,代码行数:21,代码来源:TypeBlockManager.java

示例2: actionPerformed

import edu.mit.blocks.workspace.PageChangeEventManager; //导入依赖的package包/类
public void actionPerformed(ActionEvent e) {
    if (childBlock.getLocation().distance(focusPoint) < 75) {
        //if parent block exist, then preform automatic linking
        childBlock.setLocation(focusPoint);
        if (parentBlock != null && parentBlock.getBlockID() != null && !parentBlock.getBlockID().equals(Block.NULL)) {
            BlockLink link = LinkFinderUtil.connectBlocks(workspace, workspace.getEnv().getBlock(childBlock.getBlockID()), workspace.getEnv().getBlock(parentBlock.getBlockID()));
            if (link == null) {
                dropBlock(childBlock);
                childBlock.repaintBlock();
                childBlock.repaint();
            } 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();
                workspace.getEnv().getRenderableBlock(link.getSocketBlockID()).repaint();
            }
        } else {
            dropBlock(childBlock);
            childBlock.repaintBlock();
            childBlock.repaint();
        }

        //stop the timer
        timer.stop();
        if (workspace.getEnv().getBlock(childBlock.getBlockID()).getGenusName().equals("number")) {
            childBlock.switchToLabelEditingMode(false);
        } else {
            childBlock.switchToLabelEditingMode(true);
        }

        //TODO: check if focumanager's before parent is same as
        //the parent we have here and check if new focusblock is child block
        PageChangeEventManager.notifyListeners();
    } else {
        //childBlock.setLocation(focusPoint);
        // TODO: This needs to change if the parent block doesn't have any more sockets for children
        // Need to adjust focusPoint somehow.
        childBlock.setLocation(
                (int) (focusPoint.getX() * 0.67) + (int) (childBlock.getX() * 0.34),
                (int) (focusPoint.getY() * 0.67) + (int) (childBlock.getY() * 0.34));

    }
}
 
开发者ID:heqichen,项目名称:openblocks,代码行数:51,代码来源:BlockDropAnimator.java


注:本文中的edu.mit.blocks.workspace.PageChangeEventManager类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。