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()); }
private void updateVariable(TPLTuple<String, String> varVal) { // System.err.println("updateVariable"); for (Entry entry : mEntryList) { String var = entry.getVarName(); // the name of the current variable String typ = entry.getVarType(); if (var.equals(varVal.getFirst())) { TPLTuple<String, AttributedString> formatedPair = TextFormat.fillWithAttributes("#r#" + typ + " " + var + " = " + varVal.getSecond()); entry.mFormatted = formatedPair.getFirst(); entry.mAttributed = formatedPair.getSecond(); entry.mHasChanged = true; } } }
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(); } }