Пример #1
0
 public void actionPerformed(ActionEvent e) {
   if (e.getSource().equals(add)) {
     remove(add);
     add(cancel);
     invalidate();
     me.validate();
     SelectedEvent.addBVSelectedEventListener(new WaitingForAequi());
     jd =
         new JOptionPane(
                 "Bitte äquivalente ISBN anklicken/scannen!", JOptionPane.INFORMATION_MESSAGE)
             .createDialog("Auswählen");
     jd.setModal(false);
     jd.setVisible(true);
   }
   if (e.getSource().equals(remove)) {
     new Deb(debug, bvc.getSelectedIndex());
     new Deb(debug, bvc.getSelected());
     if (bvc.getSelectedIndex() > -1) {
       OBUBookUse.delEqui(
           Ean.getEan(OBUBookUse.getEquisOfString(isbn).get(bvc.getSelectedIndex())));
     } else {
       new Warn("Keine Äquivalenz gewählt!\n Ignoriere Anweisung.");
     }
     cancel.doClick();
   }
 }
  public void actionPerformed(ActionEvent e) { // JPChooser
    state = State.values()[Integer.parseInt(e.getActionCommand())];
    switch (state) {
      case info:
        SelectedEvent.makeEvent(
            this,
            SelectedEvent.SelectedEventType.ISBNSelected,
            Ean.getEan(((VBTVDatamodell) mymodell).tablecells.get(lastselected).get(0).toString()));
        break;
      case edit:
        SelectedEvent.makeEvent(
            this,
            SelectedEvent.SelectedEventType.ISBNSelected,
            Ean.getEan(((VBTVDatamodell) mymodell).tablecells.get(lastselected).get(0).toString()));
        break;
      case zukauf:
        SelectedEvent.makeEvent(
            this,
            SelectedEvent.SelectedEventType.ISBNBuySelected,
            Ean.getEan(((VBTVDatamodell) mymodell).tablecells.get(lastselected).get(0).toString()));
        break;
      case register:
        booktyp = null;
        new Warn("Bitte den Buchtyp für die zu \n registrierenden Bücher wählen!");
        break;
      case neu:
        if (booktyp == null) { // new selected manually
          SelectedEvent.makeEvent(this, SelectedEvent.SelectedEventType.ISBNUnknownSelected);
          break;
        } else {
          if (OBTBookType.isKnownISBN(Ean.getEan(booktyp.get(0)))) {
            SelectedEvent.makeEvent(this, SelectedEvent.SelectedEventType.ISBNUnknownSelected);
            break;
          }
        }
        // selected by scan nothing to do!

        break;
    }
  }
  public void thingSelected(SelectedEvent e) {
    switch (e.getId()) {
      case ISBNSelected:
        if (state == State.neu) {
          stateChanged(State.info);
        }
        booktyp = mymodell.getBookType(e.getEan());
        new Deb(debug, booktyp);
        break;
      case ISBNUnknownSelected:
        booktyp = newBooktype();
        if (e.getEan() != null) {
          booktyp.set(0, e.getEan().toString());
          stateChanged(State.neu);
        }

        break;
      case ISBNBuySelected:
        booktyp = mymodell.getBookType(e.getEan());

        break;
      case BookUnknownSelected:
        if (state != State.register) {
          stateChanged(State.register);
          SelectedEvent.addBVSelectedEventListener(new WaitingForBT(new OBook(e.getEan())));
          invalidate();
          me.validate();
        } else {
          new OBook(e.getEan()).setBookType(Ean.getEan(booktyp.firstElement()));
        }
      case BookTypOnTop:
        if (state != State.info) {
          stateChanged(State.info);
        }
        invalidate();
        me.validate();
        break;
      default:
    }

    booktypepanel.reMakePanel(state, booktyp);
  }