public VarBadge(SuperNode superNode) { // mWorkSpace = ws; mSuperNode = superNode; // Initialize the entry list SuperNode parentNode = mSuperNode; mEntryList.clear(); while (parentNode != null) { Vector<VarDef> varDefList = parentNode.getVarDefList(); for (VarDef varDef : varDefList) { mEntryList.add( new Entry( parentNode, false, varDef.getConcreteSyntax(), varDef.getFormattedSyntax(), TextFormat.fillWithAttributes(varDef.getFormattedSyntax()).getSecond())); } parentNode = parentNode.getParentNode(); } // Initialize size and location setSize(new Dimension(1, 1)); setLocation( superNode.getVariableBadge().getPosition().getXPos(), superNode.getVariableBadge().getPosition().getYPos()); }
public void update(Observable o, Object obj) { // mLogger.message("VarBadge.update(" + obj + ")"); // Clear the entry list mEntryList.clear(); // Recompute the entry list SuperNode parentNode = mSuperNode; while (parentNode != null) { for (VarDef varDef : parentNode.getVarDefList()) { String varName = varDef.getName(); // if (!containsEntryFor(varName)) { mEntryList.add( new Entry( parentNode, false, varDef.getConcreteSyntax(), varDef.getFormattedSyntax(), TextFormat.fillWithAttributes(varDef.getFormattedSyntax()).getSecond())); // } } parentNode = parentNode.getParentNode(); } }
public void updateLocation(Point vector) { // Set new location setLocation(new Point(getLocation().x + vector.x, getLocation().y + vector.y)); // Set the location on data model mSuperNode.getVariableBadge().setPosition(new Position(getLocation().x, getLocation().y)); }