@Override public void update(Observable arg0, Object arg1) { boolean enable = false; if (arg1 != null && arg1.getClass() == UpdateMessage.class) switch ((UpdateMessage) arg1) { case SELECT: super.setSelected(true); break; case UNSELECT: super.setSelected(false); break; case ADD_ATTRIBUTE: enable = true; case ADD_ATTRIBUTE_NO_EDIT: addAttribute(component.getAttributes().getLast(), enable); break; case ADD_METHOD: enable = true; case ADD_METHOD_NO_EDIT: addMethod(component.getMethods().getLast(), enable); break; } else regenerateEntity(); }
/** Delete all TextBox and regenerate them. !! This method take time !! */ public void regenerateEntity() { boolean isStopRepaint = parent.getStopRepaint(); parent.setStopRepaint(true); methodsView.clear(); attributesView.clear(); entityName.setText(component.getName()); for (final Attribute a : component.getAttributes()) addAttribute(a, false); for (final Method m : component.getMethods()) addMethod(m, false); if (!isStopRepaint) parent.goRepaint(); updateHeight(); }