public void undecorateSelectedNode(WorldObjectImpl node) { Object frame = node.getPiccolo().getAttribute(SELECTION_HANDLER_FRAME_ATTR); if (frame != null && frame instanceof SelectionBorder) { ((SelectionBorder) frame).destroy(); } node.setSelected(false); node.getPiccolo().addAttribute(SELECTION_HANDLER_FRAME_ATTR, null); }
protected void initializeSelection(PInputEvent pie) { canvasPressPt = pie.getCanvasPosition(); presspt = pie.getPosition(); pressNode = null; for (PNode node = pie.getPath().getPickedNode(); node != null; node = node.getParent()) { if (node instanceof PiccoloNodeInWorld) { WorldObjectImpl wo = (WorldObjectImpl) ((PiccoloNodeInWorld) node).getWorldObject(); if (wo != null && wo.isSelectable()) { moveStackToFront(wo); pressNode = wo; return; } } } }
protected void dragStandardSelection(PInputEvent e) { Iterator<WorldObjectImpl> selectionEn = selectedObjects.iterator(); if (selectionEn.hasNext()) { e.setHandled(true); PDimension d = e.getDeltaRelativeTo(selectableParent.getPiccolo()); while (selectionEn.hasNext()) { WorldObjectImpl node = selectionEn.next(); if (!node.isAnimating()) { PDimension gDist = new PDimension(); gDist.setSize(d); node.localToParent(node.globalToLocal(gDist)); node.dragOffset(gDist.getWidth(), gDist.getHeight()); } } } }
@Override public void paint(PaintContext paintContext) { super.paint(paintContext); Graphics2D g2 = paintContext.getGraphics(); Color bright2 = NengoStyle.colorAdd(color, new Color(0.4f, 0.4f, 0.4f)); if (paintContext.getScale() < 0.5) { g2.setColor(color); g2.fillOval(0, 0, _LINE_END_WIDTH, _LINE_END_HEIGHT); } else { Color color = getColor(); Color dark = NengoStyle.colorAdd(NengoStyle.colorTimes(color, 0.65), new Color(0.05f, 0.05f, 0.05f)); Color medium = color; Color bright1 = NengoStyle.colorAdd(color, new Color(0.15f, 0.15f, 0.15f)); Color hilite = NengoStyle.colorAdd(NengoStyle.colorTimes(color, 0.5), new Color(0.5f, 0.5f, 0.5f)); g2.setColor(dark); g2.fillOval(0, 0, _LINE_END_WIDTH, _LINE_END_HEIGHT); g2.setColor(medium); g2.fillOval(_LINE_END_WIDTH / 4, 0, _LINE_END_WIDTH / 2, _LINE_END_HEIGHT); g2.setColor(bright1); g2.fillOval( _LINE_END_WIDTH / 6, _LINE_END_HEIGHT / 2, 2 * _LINE_END_WIDTH / 3, _LINE_END_HEIGHT / 3); g2.setColor(bright2); g2.fillOval( _LINE_END_WIDTH / 6 + 2, _LINE_END_HEIGHT / 2 + 2, 2 * _LINE_END_WIDTH / 3 - 4, _LINE_END_HEIGHT / 3 - 2); g2.setColor(hilite); g2.fillOval( _LINE_END_WIDTH / 3 - 1, _LINE_END_HEIGHT / 6, _LINE_END_WIDTH / 3 + 2, 3 * _LINE_END_HEIGHT / 16); } }
@Override public void layoutChildren() { super.layoutChildren(); myLabel.setOffset(0, myBrainImage.getHeight() + 10); }
public void decorateSelectedNode(WorldObjectImpl node) { SelectionBorder frame = new SelectionBorder(world, node); node.setSelected(true); node.getPiccolo().addAttribute(SELECTION_HANDLER_FRAME_ATTR, frame); }