コード例 #1
0
 /*
  * @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;
 }
コード例 #2
0
 /*
  * @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;
   }
 }