Exemplo n.º 1
0
 public void removeSelected() {
   for (Object obj : theView.getLoadedList().getSelectedValuesList()) {
     PlayerCharacter pc = model.get(obj);
     model.removeElement(obj);
     messageHandler.handleMessage(new PlayerCharacterWasClosedMessage(this, pc));
   }
 }
Exemplo n.º 2
0
  @Override
  public void actionPerformed(ActionEvent e) {
    if (e.getSource() == theView.getRemoveButton()) {
      removeSelected();
    }

    if (e.getSource() == theView.getSaveButton()) {
      for (Object obj : theView.getLoadedList().getSelectedValuesList()) {
        PlayerCharacter pc = model.get(obj);
        savePC(pc, false);
      }
    }

    if (e.getSource() == theView.getSaveAsButton()) {
      for (Object obj : theView.getLoadedList().getSelectedValuesList()) {
        PlayerCharacter pc = model.get(obj);
        savePC(pc, true);
      }
    }

    if (e.getSource() == theView.getLoadButton()) {
      handleOpen();
    }

    theView.getLoadedList().repaint();
  }
Exemplo n.º 3
0
 /** Starts the plugin, registering itself with the <code>TabAddMessage</code>. */
 @Override
 public void start(PCGenMessageHandler mh) {
   messageHandler = mh;
   theView = new PCGTrackerView();
   theView.getLoadedList().setModel(model);
   initListeners();
   messageHandler.handleMessage(
       new RequestAddTabToGMGenMessage(this, getLocalizedName(), getView()));
   initMenus();
 }
Exemplo n.º 4
0
 /** Registers all the listeners for any actions. */
 public void initListeners() {
   theView.getRemoveButton().addActionListener(this);
   theView.getSaveButton().addActionListener(this);
   theView.getSaveAsButton().addActionListener(this);
   theView.getLoadButton().addActionListener(this);
 }