@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(); }
public void removeSelected() { for (Object obj : theView.getLoadedList().getSelectedValuesList()) { PlayerCharacter pc = model.get(obj); model.removeElement(obj); messageHandler.handleMessage(new PlayerCharacterWasClosedMessage(this, pc)); } }
/** 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(); }