diff --git a/src/avatartranslator/AvatarStateMachine.java b/src/avatartranslator/AvatarStateMachine.java index b561b93488ce0ea54dbd70baf5a8b0dd12111511..5641ed591ea087088a37898c5158a1f15359daca 100644 --- a/src/avatartranslator/AvatarStateMachine.java +++ b/src/avatartranslator/AvatarStateMachine.java @@ -94,11 +94,12 @@ public class AvatarStateMachine extends AvatarElement { return sb.toString(); } + // Assumes no after clause on composite relation public void removeCompositeStates(AvatarBlock _block) { TraceManager.addDev("\n-------------- Remove composite states ---------------\n"); - LinkedList <AvatarState> lists = removeAllInternalStartStates(); + LinkedList <AvatarState> lists = removeAllInternalStartStates(); AvatarTransition at = getAvatarCompositeTransition(); @@ -107,42 +108,41 @@ public class AvatarStateMachine extends AvatarElement { } // We modify all composite states with intermediate states - for(int i=0; i<elements.size(); i++) { - AvatarStateMachineElement element = elements.get(i); + AvatarStateMachineElement element = elements.get(i); if (element instanceof AvatarState) { modifyStateForCompositeSupport((AvatarState)element); } } - // For each composite transition: Welink it to all the substates of the current state - AvatarState src; - while(((at = getAvatarCompositeTransition()) != null)) { - src = (AvatarState)(getPreviousElementOf(at)); - elements.remove(at); - - // Add a new state after the transition - /*String tmp = findUniqueStateName("forCompositeTransition_state"); - AvatarState as = new AvatarState(tmp, at.getReferenceObject()); - elements.add(as); - AvatarTransition ats = new AvatarTransition("forCompositeTransition_trans", at.getReferenceObject()); - elements.add(ats); - ats.addNext(at.getNext(0)); - at.removeAllNexts(); - at.addNext(as); - as.addNext(ats);*/ - - // Link a clone of the transition to all internal states - - for(int j=0; j<elements.size(); j++) { - AvatarStateMachineElement elt = elements.get(j); - if ((elt instanceof AvatarState) && (elt.hasInUpperState(src))) { - AvatarTransition att = cloneCompositeTransition(at); - elt.addNext(att); - } - } - - } + // For each composite transition: Welink it to all the substates of the current state + AvatarState src; + while(((at = getAvatarCompositeTransition()) != null)) { + src = (AvatarState)(getPreviousElementOf(at)); + elements.remove(at); + + // Add a new state after the transition + /*String tmp = findUniqueStateName("forCompositeTransition_state"); + AvatarState as = new AvatarState(tmp, at.getReferenceObject()); + elements.add(as); + AvatarTransition ats = new AvatarTransition("forCompositeTransition_trans", at.getReferenceObject()); + elements.add(ats); + ats.addNext(at.getNext(0)); + at.removeAllNexts(); + at.addNext(as); + as.addNext(ats);*/ + + // Link a clone of the transition to all internal states + + for(int j=0; j<elements.size(); j++) { + AvatarStateMachineElement elt = elements.get(j); + if ((elt instanceof AvatarState) && (elt.hasInUpperState(src))) { + AvatarTransition att = cloneCompositeTransition(at); + elt.addNext(att); + } + } + + } } @@ -268,15 +268,15 @@ public class AvatarStateMachine extends AvatarElement { for(AvatarStateMachineElement element: elements) { if (element instanceof AvatarTransition) { - AvatarTransition at = (AvatarTransition)element; + AvatarTransition at = (AvatarTransition)element; //TraceManager.addDev("at? element=" + element); // Transition fully in the internal state? if (element.getNext(0).hasInUpperState(_state) == true) { - AvatarStateMachineElement previous = getPreviousElementOf(element); + AvatarStateMachineElement previous = getPreviousElementOf(element); if (previous.hasInUpperState(_state) == true) { - if (!(at.isEmpty())) { - v.add(at); - } + if (!(at.isEmpty())) { + v.add(at); + } } } } @@ -316,7 +316,7 @@ public class AvatarStateMachine extends AvatarElement { if (_at.getNbOfAction() > 1) { TraceManager.addDev("New split state"); - String tmp = findUniqueStateName("splitstate_action__"); + String tmp = findUniqueStateName("splitstate_action__"); AvatarState as = new AvatarState(tmp, null); as.setHidden(true); as.setState(_currentState); @@ -398,7 +398,7 @@ public class AvatarStateMachine extends AvatarElement { } // Checks whether the previous element is a state with an internal state machine - private boolean isACompositeTransition(AvatarTransition _at) { + public boolean isACompositeTransition(AvatarTransition _at) { AvatarStateMachineElement element = getPreviousElementOf(_at); if (element == null) { return false; diff --git a/src/avatartranslator/AvatarTransition.java b/src/avatartranslator/AvatarTransition.java index 410d529e686f62369d9ac8045eb137a44c14c0b1..86edf8370596754a5062253114643765249839ed 100644 --- a/src/avatartranslator/AvatarTransition.java +++ b/src/avatartranslator/AvatarTransition.java @@ -51,292 +51,292 @@ import myutil.*; public class AvatarTransition extends AvatarStateMachineElement { - private String guard = "[ ]"; - private String minDelay = "", maxDelay = ""; - private String minCompute = "", maxCompute = ""; - - private LinkedList<String> actions; // actions on variable, or method call - + private String guard = "[ ]"; + private String minDelay = "", maxDelay = ""; + private String minCompute = "", maxCompute = ""; + + private LinkedList<String> actions; // actions on variable, or method call + public AvatarTransition(String _name, Object _referenceObject) { super(_name, _referenceObject); - actions = new LinkedList<String>(); + actions = new LinkedList<String>(); + } + + + public String getGuard() { + return guard; + } + + public void setGuard(String _guard) { + guard = _guard; + } + + public void addGuard(String _g) { + guard = "(" + guard + ") and (" + _g + ")"; + } + + public int getNbOfAction() { + return actions.size(); + } + + public String getAction(int _index) { + return actions.get(_index); + } + + public void addAction(String _action) { + actions.add(_action); + } + + public void setDelays(String _minDelay, String _maxDelay) { + minDelay = _minDelay; + maxDelay = _maxDelay; + } + + public void setComputes(String _minCompute, String _maxCompute) { + minCompute = _minCompute; + maxCompute = _maxCompute; + } + + public String getMinDelay() { + return minDelay; + } + + public String getMaxDelay() { + if (maxDelay.trim().length() ==0) { + return getMinDelay(); + } + return maxDelay; + } + + public String getMinCompute() { + return minCompute; + } + + public String getMaxCompute() { + if (maxCompute.trim().length() ==0) { + return getMinCompute(); + } + return maxCompute; + } + + public boolean hasElseGuard() { + if (guard == null) { + return false; + } + + return AvatarSpecification.isElseGuard(guard); + } + + public boolean hasNonDeterministicGuard() { + if (guard == null) { + return false; + } + + String tmp = Conversion.replaceAllChar(guard, ' ', "").trim(); + + return tmp.compareTo("[]") == 0; + + } + + public boolean isEmpty() { + if (hasDelay() || hasCompute()) { + return false; + } + + return (actions.size() == 0); + } + + + public AvatarTransition cloneMe() { + AvatarTransition at = new AvatarTransition(getName(), getReferenceObject()); + at.setGuard(getGuard()); + at.setDelays(getMinDelay(), getMaxDelay()); + at.setComputes(getMinCompute(), getMaxCompute()); + + for(int i=0; i<getNbOfAction(); i++) { + at.addAction(getAction(i)); + } + + for(int i=0; i<nbOfNexts(); i++) { + at.addNext(getNext(i)); + } + + return at; + } + + public AvatarStateMachineElement basicCloneMe() { + AvatarTransition at = new AvatarTransition(getName() + "_clone", getReferenceObject()); + + at.setGuard(getGuard()); + + for(int i=0; i<getNbOfAction(); i++) { + at.addAction(getAction(i)); + } + + at.setComputes(getMinCompute(), getMaxCompute()); + + return at; + } + + public void removeAllActionsButTheFirstOne() { + if (actions.size() < 2) { + return; + } + String action = actions.get(0); + actions.clear(); + actions.add(action); + } + + public void removeFirstAction() { + actions.remove(0); } - - - public String getGuard() { - return guard; - } - - public void setGuard(String _guard) { - guard = _guard; - } - - public void addGuard(String _g) { - guard = "(" + guard + ") and (" + _g + ")"; - } - - public int getNbOfAction() { - return actions.size(); - } - - public String getAction(int _index) { - return actions.get(_index); - } - - public void addAction(String _action) { - actions.add(_action); - } - - public void setDelays(String _minDelay, String _maxDelay) { - minDelay = _minDelay; - maxDelay = _maxDelay; - } - - public void setComputes(String _minCompute, String _maxCompute) { - minCompute = _minCompute; - maxCompute = _maxCompute; - } - - public String getMinDelay() { - return minDelay; - } - - public String getMaxDelay() { - if (maxDelay.trim().length() ==0) { - return getMinDelay(); - } - return maxDelay; - } - - public String getMinCompute() { - return minCompute; - } - - public String getMaxCompute() { - if (maxCompute.trim().length() ==0) { - return getMinCompute(); - } - return maxCompute; - } - - public boolean hasElseGuard() { - if (guard == null) { - return false; - } - - return AvatarSpecification.isElseGuard(guard); - } - - public boolean hasNonDeterministicGuard() { - if (guard == null) { - return false; - } - - String tmp = Conversion.replaceAllChar(guard, ' ', "").trim(); - - return tmp.compareTo("[]") == 0; - - } - - public boolean isEmpty() { - if (hasDelay() || hasCompute()) { - return false; - } - - return (actions.size() == 0); - } - - - public AvatarTransition cloneMe() { - AvatarTransition at = new AvatarTransition(getName(), getReferenceObject()); - at.setGuard(getGuard()); - at.setDelays(getMinDelay(), getMaxDelay()); - at.setComputes(getMinCompute(), getMaxCompute()); - - for(int i=0; i<getNbOfAction(); i++) { - at.addAction(getAction(i)); - } - - for(int i=0; i<nbOfNexts(); i++) { - at.addNext(getNext(i)); - } - - return at; - } - - public AvatarStateMachineElement basicCloneMe() { - AvatarTransition at = new AvatarTransition(getName() + "_clone", getReferenceObject()); - - at.setGuard(getGuard()); - - for(int i=0; i<getNbOfAction(); i++) { - at.addAction(getAction(i)); - } - - at.setComputes(getMinCompute(), getMaxCompute()); - - return at; - } - - public void removeAllActionsButTheFirstOne() { - if (actions.size() < 2) { - return; - } - String action = actions.get(0); - actions.clear(); - actions.add(action); - } - - public void removeFirstAction() { - actions.remove(0); - } - - public void removeAllActions() { - actions.clear(); - } - - // No actions - //public boolean isAGuardTransition() { - //} - - public boolean isGuarded() { - if (guard == null) { - return false; - } - - if (guard.trim().length() == 0) { - return false; - } - - String s = Conversion.replaceAllString(guard, " ", "").trim(); - if (s.compareTo("[]") == 0) { - return false; - } - - return true; - } - - public boolean hasDelay() { - if (minDelay.trim().length() == 0) { - return false; - } - - return true; - } - - public boolean hasCompute() { - if (minCompute.trim().length() ==0) { - return false; - } - return true; - } - - public boolean hasActions() { - if (actions.size() == 0) { - return false; - } - - for(String s: actions) { - if (s.trim().length() > 0) { - return true; - } - } - - return false; - } - - public String specificToString() { - String ret = ""; - if (hasDelay()) { - ret += "minDelay=" + getMinDelay() + " maxDelay=" + getMaxDelay() + "\n"; - } - - if (hasCompute()) { - ret += "minCompute=" + getMinCompute() + " maxcompute=" + getMaxCompute() + "\n"; - } - - for(String s: actions) { - if (s.trim().length() > 0) { - ret += s.trim() + " / "; - } - } - - if (ret.length() > 0) { - ret = "\n" + ret; - } - - return ret; - } - - - // Assumes actions are correctly formatted - public boolean hasMethodCall() { - - - for(String action: actions) { - if (isAMethodCall(action)) { - return true; - } - } - return false; - - } - - public static boolean isAMethodCall(String _action) { - int index; - index = _action.indexOf("="); - - // Method of the form f(...) - if (index == -1) { - return true; - } - - // Method of the form x = f(...) - _action = _action.substring(index+1, _action.length()).trim(); - index = _action.indexOf("("); - if (index != -1) { - _action = _action.substring(0, index).trim(); - if (_action.length() == 0) { - return false; - - } - boolean b1 = (_action.substring(0,1)).matches("[a-zA-Z]"); - boolean b2 = _action.matches("\\w*"); - if (b1 && b2) { - return true; - } - } - - return false; - } - - public String getNiceName() { - if (isGuarded()) - return "Transition (guard=" + guard + ", ...)"; - - if (hasDelay()) - return "Transition (delay=(" + minDelay + ", " + maxDelay + "), ...)"; - - if (actions.size() > 0) { - return "Transition (" + actions.get(0) + ", ...)"; - } - - return "Empty transition"; - } - + + public void removeAllActions() { + actions.clear(); + } + + // No actions + //public boolean isAGuardTransition() { + //} + + public boolean isGuarded() { + if (guard == null) { + return false; + } + + if (guard.trim().length() == 0) { + return false; + } + + String s = Conversion.replaceAllString(guard, " ", "").trim(); + if (s.compareTo("[]") == 0) { + return false; + } + + return true; + } + + public boolean hasDelay() { + if (minDelay.trim().length() == 0) { + return false; + } + + return true; + } + + public boolean hasCompute() { + if (minCompute.trim().length() ==0) { + return false; + } + return true; + } + + public boolean hasActions() { + if (actions.size() == 0) { + return false; + } + + for(String s: actions) { + if (s.trim().length() > 0) { + return true; + } + } + + return false; + } + + public String specificToString() { + String ret = ""; + if (hasDelay()) { + ret += "minDelay=" + getMinDelay() + " maxDelay=" + getMaxDelay() + "\n"; + } + + if (hasCompute()) { + ret += "minCompute=" + getMinCompute() + " maxcompute=" + getMaxCompute() + "\n"; + } + + for(String s: actions) { + if (s.trim().length() > 0) { + ret += s.trim() + " / "; + } + } + + if (ret.length() > 0) { + ret = "\n" + ret; + } + + return ret; + } + + + // Assumes actions are correctly formatted + public boolean hasMethodCall() { + + + for(String action: actions) { + if (isAMethodCall(action)) { + return true; + } + } + return false; + + } + + public static boolean isAMethodCall(String _action) { + int index; + index = _action.indexOf("="); + + // Method of the form f(...) + if (index == -1) { + return true; + } + + // Method of the form x = f(...) + _action = _action.substring(index+1, _action.length()).trim(); + index = _action.indexOf("("); + if (index != -1) { + _action = _action.substring(0, index).trim(); + if (_action.length() == 0) { + return false; + + } + boolean b1 = (_action.substring(0,1)).matches("[a-zA-Z]"); + boolean b2 = _action.matches("\\w*"); + if (b1 && b2) { + return true; + } + } + + return false; + } + + public String getNiceName() { + if (isGuarded()) + return "Transition (guard=" + guard + ", ...)"; + + if (hasDelay()) + return "Transition (delay=(" + minDelay + ", " + maxDelay + "), ...)"; + + if (actions.size() > 0) { + return "Transition (" + actions.get(0) + ", ...)"; + } + + return "Empty transition"; + } + public static String getVariableInAction(String action) { action = action.trim(); int index = action.indexOf("="); if (index == -1) { return action; } - + return action.substring(0, index).trim(); } - - - - - - -} \ No newline at end of file + + + + + + +} diff --git a/src/tmltranslator/tmlcp/TMLCPActivityDiagram.java b/src/tmltranslator/tmlcp/TMLCPActivityDiagram.java index 61b5a538ebac09bc6b5836a94364409cfabe2c29..9f0efa121a67a981935cb9a0702b0c2d058de9ad 100755 --- a/src/tmltranslator/tmlcp/TMLCPActivityDiagram.java +++ b/src/tmltranslator/tmlcp/TMLCPActivityDiagram.java @@ -343,8 +343,10 @@ public class TMLCPActivityDiagram extends TMLElement { int ID = 0; for(TMLCPElement elt: elements) { while(((index = elt.getNextElements().indexOf(junction)) != -1)) { - TMLCPRefAD ref = new TMLCPRefAD(toAD, toAD.getName() + "_" + ID, junction.getReferenceObject()); - ID ++; + //TMLCPRefAD ref = new TMLCPRefAD(toAD, toAD.getName() + "_" + ID, junction.getReferenceObject()); + //ID ++; + TMLCPRefAD ref = new TMLCPRefAD(toAD, toAD.getName(), junction.getReferenceObject()); + //ID ++; refsAD.add(ref); //elements.add(ref); elt.setNextElementAtIndex(ref, index); diff --git a/src/ui/AvatarDesignPanelTranslator.java b/src/ui/AvatarDesignPanelTranslator.java index ebf65d474badaac61a9f74713230d7e0b49fcf40..82d05fd2223f1f7be72245c8595b4f607525b419 100644 --- a/src/ui/AvatarDesignPanelTranslator.java +++ b/src/ui/AvatarDesignPanelTranslator.java @@ -1244,6 +1244,15 @@ public class AvatarDesignPanelTranslator { listE.addCor(at, tgc); tgc.setAVATARID(at.getID()); asm.addElement(at); + + // Check for after on composite transitions + if (at.hasDelay() && (element1 instanceof AvatarState) && asm.isACompositeTransition(at)) { + CheckingError ce = new CheckingError(CheckingError.BEHAVIOR_ERROR, "After clause cannot be used on composite transitions. Use timers instead."); + ce.setAvatarBlock(_ab); + ce.setTDiagramPanel(tdp); + ce.setTGComponent(tgc); + addCheckingError(ce); + } } } } @@ -1490,6 +1499,10 @@ public class AvatarDesignPanelTranslator { return !(TAttribute.isAValidId(tmp, false, false)); } + public void checkForAfterOnCompositeTransition() { + + } + } diff --git a/src/ui/avatarinteractivesimulation/AvatarSpecificationSimulationSDPanel.java b/src/ui/avatarinteractivesimulation/AvatarSpecificationSimulationSDPanel.java index f7ac4f470b9f2156a936b84551615e6c48e1eaa0..855be4c0367810fce69f967581a1183724890224 100644 --- a/src/ui/avatarinteractivesimulation/AvatarSpecificationSimulationSDPanel.java +++ b/src/ui/avatarinteractivesimulation/AvatarSpecificationSimulationSDPanel.java @@ -87,7 +87,7 @@ public class AvatarSpecificationSimulationSDPanel extends JPanel implements Mous private int verticalLink = 10; private int lengthAsync = 50; private int spaceBroadcast = 25; - + private boolean showHiddenStates = false; @@ -116,10 +116,10 @@ public class AvatarSpecificationSimulationSDPanel extends JPanel implements Mous // Saving states private class StateYCd { - public String stateName; - public int y; + public String stateName; + public int y; } - + private HashMap<AvatarSimulationBlock, ArrayList<StateYCd>> statesMap = new HashMap<AvatarSimulationBlock, ArrayList<StateYCd>>(); // Graphics @@ -163,8 +163,8 @@ public class AvatarSpecificationSimulationSDPanel extends JPanel implements Mous } public void setShowHiddenStates(boolean _showHiddenStates) { - showHiddenStates = _showHiddenStates; - repaint(); + showHiddenStates = _showHiddenStates; + repaint(); } protected void paintComponent(Graphics g) { @@ -173,7 +173,7 @@ public class AvatarSpecificationSimulationSDPanel extends JPanel implements Mous return; } - statesMap.clear(); + statesMap.clear(); //TraceManager.addDev("Painting components"); lastGraphics = (Graphics2D)g; @@ -270,14 +270,56 @@ public class AvatarSpecificationSimulationSDPanel extends JPanel implements Mous //Vector<AvatarSimulationBlock> blocks = ass.getSimulationBlocks(); Vector<AvatarSimulationBlock> blocks = ass.getSelectedSimulationBlocks(); + // Find starting clock value if (allTransactions.size() > 0) { - ast = allTransactions.get(Math.max(0, allTransactions.size()-1000)); + ast = allTransactions.get(Math.max(0, allTransactions.size()-drawnTransactions)); clockValue = ast.clockValueWhenFinished-ast.duration; clockValueMouse = clockValue; g.drawString("@" + clockValue, 10, currentY+g.getFontMetrics().getHeight()/2); + + // Find first name of states + if (allTransactions.size()-drawnTransactions > 0) { + AvatarSimulationTransaction astEnd = allTransactions.get(allTransactions.size() - drawnTransactions - 1); + for(AvatarSimulationBlock block: blocks) { + String tmp = "start state"; + for(AvatarSimulationTransaction astr: allTransactions) { + if (astr == astEnd) break; + if ((astr.asb == block) && (astr.executedElement instanceof AvatarState)){ + tmp = ((AvatarState)(astr.executedElement)).getName(); + } + } + ArrayList<StateYCd> states = null; + if (statesMap.containsKey(block)) { + states = statesMap.get(block); + } else { + states = new ArrayList<StateYCd>(); + statesMap.put(block, states); + } + StateYCd ycd = new StateYCd(); + ycd.stateName = tmp; + ycd.y = 0; + states.add(ycd); + } + } else { + for(AvatarSimulationBlock block: blocks) { + ArrayList<StateYCd> states = null; + if (statesMap.containsKey(block)) { + states = statesMap.get(block); + } else { + states = new ArrayList<StateYCd>(); + statesMap.put(block, states); + } + StateYCd ycd = new StateYCd(); + ycd.stateName = "start state"; + ycd.y = 0; + states.add(ycd); + } + } } + + int realLast; if (lastDrawnTransactions == 0) { realLast = allTransactions.size(); @@ -297,20 +339,20 @@ public class AvatarSpecificationSimulationSDPanel extends JPanel implements Mous transactionsOfPoints.clear(); if (ast.executedElement instanceof AvatarState) { - if ((showHiddenStates) || (!((AvatarState)ast.executedElement).isHidden())) { - newCurrentY = drawState(g, ast, (AvatarState)(ast.executedElement), xOfBlock, currentY); - ArrayList<StateYCd> states = null; - if (statesMap.containsKey(ast.asb)) { - states = statesMap.get(ast.asb); - } else { - states = new ArrayList<StateYCd>(); - statesMap.put(ast.asb, states); - } - StateYCd ycd = new StateYCd(); - ycd.stateName = ((AvatarState)(ast.executedElement)).getName(); - ycd.y = currentY + verticalLink; - states.add(ycd); - } + if ((showHiddenStates) || (!((AvatarState)ast.executedElement).isHidden())) { + newCurrentY = drawState(g, ast, (AvatarState)(ast.executedElement), xOfBlock, currentY); + ArrayList<StateYCd> states = null; + if (statesMap.containsKey(ast.asb)) { + states = statesMap.get(ast.asb); + } else { + states = new ArrayList<StateYCd>(); + statesMap.put(ast.asb, states); + } + StateYCd ycd = new StateYCd(); + ycd.stateName = ((AvatarState)(ast.executedElement)).getName(); + ycd.y = currentY + verticalLink; + states.add(ycd); + } } else if (ast.executedElement instanceof AvatarTransition) { newCurrentY = drawTransition(g, (AvatarTransition)(ast.executedElement), ast, xOfBlock, currentY); } else if (ast.executedElement instanceof AvatarActionOnSignal) { @@ -721,24 +763,24 @@ public class AvatarSpecificationSimulationSDPanel extends JPanel implements Mous } private String getNameOfState(AvatarSimulationBlock block, int y) { - if (!(statesMap.containsKey(block))) { - return null; - } - - String name = null; - ArrayList<StateYCd> ycd = statesMap.get(block); - if (ycd == null) { - return name; - } - - for(StateYCd st: ycd) { - if (st.y > y) { - return name; - } - name = st.stateName; - } - - return name; + if (!(statesMap.containsKey(block))) { + return null; + } + + String name = null; + ArrayList<StateYCd> ycd = statesMap.get(block); + if (ycd == null) { + return name; + } + + for(StateYCd st: ycd) { + if (st.y > y) { + return name; + } + name = st.stateName; + } + + return name; } private void drawInfo(Graphics g) { @@ -750,7 +792,7 @@ public class AvatarSpecificationSimulationSDPanel extends JPanel implements Mous g.drawString(timeValue, maxX-spaceAtEnd + 1, yMouse+g.getFontMetrics().getHeight()/2); - //TraceManager.addDev("yMouse=" + yMouse); + //TraceManager.addDev("yMouse=" + yMouse); /*if (minIdValueMouse == maxIdValueMouse) { g.drawString("ID: " + minIdValueMouse, 10, yMouse+(g.getFontMetrics().getHeight()/2)+12); @@ -763,29 +805,27 @@ public class AvatarSpecificationSimulationSDPanel extends JPanel implements Mous Vector<AvatarSimulationBlock> blocks = ass.getSelectedSimulationBlocks(); int x = spaceAtEnd; - Font normal = g.getFont(); - Font it = normal.deriveFont(Font.ITALIC); + Font normal = g.getFont(); + Font it = normal.deriveFont(Font.ITALIC); for(AvatarSimulationBlock block: blocks) { name = block.getBlock().getName(); w = g.getFontMetrics().stringWidth(name); g.drawString(name, x + ((spaceBetweenLifeLines-w)/2), yMouse - spaceVerticalText); - - - // Write the name of the current state - name = getNameOfState(block, yMouse); - if (name == null) { - name = "start state"; - } else { - name = "state: " + name; - } - - g.setFont(it); - w = g.getFontMetrics().stringWidth(name); + + + // Write the name of the current state + name = getNameOfState(block, yMouse); + if (name == null) { + name = " - "; + } + + g.setFont(it); + w = g.getFontMetrics().stringWidth(name); g.drawString(name, x + ((spaceBetweenLifeLines-w)/2), yMouse + (6 * spaceVerticalText)); - g.setFont(normal); - - // Add the space between lifelines + g.setFont(normal); + + // Add the space between lifelines x += spaceBetweenLifeLines; } g.setColor(c);