本文整理汇总了Java中org.piccolo2d.extras.nodes.PComposite.getAttribute方法的典型用法代码示例。如果您正苦于以下问题:Java PComposite.getAttribute方法的具体用法?Java PComposite.getAttribute怎么用?Java PComposite.getAttribute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.piccolo2d.extras.nodes.PComposite
的用法示例。
在下文中一共展示了PComposite.getAttribute方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: drag
import org.piccolo2d.extras.nodes.PComposite; //导入方法依赖的package包/类
@Override
@SuppressWarnings({"unchecked"})
protected void drag(PInputEvent e) {
LOGGER.trace("Method drag("
+ e + ") called.");
PNode pickedNode = e.getPickedNode();
if (pickedNode instanceof PComposite) {
super.drag(e);
PComposite vNode = (PComposite) pickedNode;
/* Redraw edges */
ArrayList<PPath> vEdges = (ArrayList<PPath>) vNode.getAttribute("edges");
for (PPath vEdge : vEdges) {
mPanel.updateEdge(vEdge, (Position) vNode.getAttribute("position"));
}
/* TODO Redraw the shadow */
PPath vShadow = (PPath) vNode.getAttribute("glow");
if (vShadow != null) {
vShadow.setOffset(vNode.getOffset());
}
}
}
示例2: deleteNode
import org.piccolo2d.extras.nodes.PComposite; //导入方法依赖的package包/类
@Override
public synchronized void deleteNode(Position pPosition) {
LOGGER.trace("Method deleteNode("
+ pPosition + ") called.");
PComposite vNode = mMapNode.get(pPosition);
if (vNode != null) {
/* Delete node from layer */
mLayerNode.removeChild(vNode);
/* Remove Shadow */
PPath vShadow = (PPath) vNode.getAttribute("glow");
if (vShadow != null) {
mLayerGlow.removeChild(vShadow);
}
/* Metadata */
if (pPosition instanceof NodeMetadata) {
/* Delete edges from layer */
for (PPath vEdge : mMapEdge.get(pPosition)) {
deleteEdge(pPosition, vEdge);
}
/* Delete edge from HashMap */
mMapEdge.remove(pPosition);
}
/* Delete node from HashMap */
mMapNode.remove(pPosition);
}
}