public boolean editLink(GLink link) { String pattern = (String) JOptionPane.showInputDialog( null, Localized.getString("faEditLinkMessage"), Localized.getString("faEditLinkTitle"), JOptionPane.QUESTION_MESSAGE, null, null, link.pattern); if (pattern != null) { removeLink(link); link.pattern = pattern; machine.addTransitionPattern( getState1(link).state.name, link.pattern, getState2(link).state.name); addElement(link); } return pattern != null; }
public void reconstruct() { elements.clear(); List stateNames = machine.getStateList(); ListIterator iterator = stateNames.listIterator(stateNames.size()); int x = 0; int y = 0; while (iterator.hasPrevious()) { addElement(new GElementFAState((FAState) iterator.previous(), 100 + x * 200, 50 + y * 200)); x++; if (x > 4) { y++; x = 0; } } List transitions = machine.getTransitions().getTransitions(); iterator = transitions.listIterator(); while (iterator.hasNext()) { FATransition transition = (FATransition) iterator.next(); GElementFAState s1 = getState(transition.s1); GElementFAState s2 = s1; if (transition.s1.equals(transition.s2) == false) s2 = getState(transition.s2); GLink link = getLink(s1, s2); if (link == null) addElement( new GLink( s1, GElementFAState.ANCHOR_CENTER, s2, GElementFAState.ANCHOR_CENTER, GLink.SHAPE_ARC, transition.symbol, 20)); else link.pattern = Tool.addSymbolToPattern(link.pattern, transition.symbol); } }