/* * @see org.argouml.cognitive.ui.Wizard#canFinish() */ public boolean canFinish() { if (!super.canFinish()) { return false; } if (getStep() == 0) { return true; } if (getStep() == 1 && step1 != null && step1.getSelectedIndex() != -1) { return true; } if (getStep() == 2 && step2 != null && step2.getSelectedIndex() != -1) { return true; } return false; }
/* * @see org.argouml.cognitive.ui.Wizard#doAction(int) */ public void doAction(int oldStep) { LOG.debug("doAction " + oldStep); int choice = -1; ToDoItem item = (ToDoItem) getToDoItem(); ListSet offs = item.getOffenders(); switch (oldStep) { case 1: if (step1 != null) { choice = step1.getSelectedIndex(); } if (choice == -1) { throw new Error("nothing selected, should not get here"); } selectedCls = offs.elementAt(choice); break; //////////////// case 2: if (step2 != null) { choice = step2.getSelectedIndex(); } if (choice == -1) { throw new Error("nothing selected, should not get here"); } Object ae = null; Iterator iter = Model.getFacade().getAssociationEnds(selectedCls).iterator(); for (int n = 0; n <= choice; n++) { ae = iter.next(); } selectedAsc = Model.getFacade().getAssociation(ae); break; //////////////// case 3: if (selectedAsc != null) { List conns = new ArrayList(Model.getFacade().getConnections(selectedAsc)); Object ae0 = conns.get(0); Object ae1 = conns.get(1); try { Model.getCoreHelper().setAggregation(ae0, Model.getAggregationKind().getNone()); Model.getCoreHelper().setAggregation(ae1, Model.getAggregationKind().getNone()); } catch (Exception pve) { LOG.error("could not set aggregation", pve); } } break; } }
/* * @see org.argouml.cognitive.ui.Wizard#makePanel(int) */ public JPanel makePanel(int newStep) { switch (newStep) { case 1: if (step1 == null) { step1 = new WizStepChoice(this, instructions1, getOptions1()); step1.setTarget(getToDoItem()); } return step1; case 2: if (step2 == null) { step2 = new WizStepChoice(this, instructions2, getOptions2()); step2.setTarget(getToDoItem()); } return step2; case 3: if (step3 == null) { step3 = new WizStepConfirm(this, instructions3); } return step3; } return null; }