Desktop tool for browsing account info from EVE-Online
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ShipsPage.java 3.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. /*
  2. * Copyright (c) 2009 Chris Smith
  3. *
  4. * Permission is hereby granted, free of charge, to any person obtaining a copy
  5. * of this software and associated documentation files (the "Software"), to deal
  6. * in the Software without restriction, including without limitation the rights
  7. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  8. * copies of the Software, and to permit persons to whom the Software is
  9. * furnished to do so, subject to the following conditions:
  10. *
  11. * The above copyright notice and this permission notice shall be included in
  12. * all copies or substantial portions of the Software.
  13. *
  14. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  19. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  20. * SOFTWARE.
  21. */
  22. package uk.co.md87.evetool.ui.pages;
  23. import java.awt.event.ActionListener;
  24. import java.util.ArrayList;
  25. import java.util.List;
  26. import uk.co.md87.evetool.AccountManager;
  27. import uk.co.md87.evetool.ApiFactory;
  28. import uk.co.md87.evetool.api.wrappers.data.BasicShipInfo;
  29. import uk.co.md87.evetool.ui.MainWindow;
  30. import uk.co.md87.evetool.ui.data.BasicShipInfoSurrogate;
  31. import uk.co.md87.evetool.ui.listable.ListableConfig;
  32. /**
  33. *
  34. * TODO: Document ShipsPage
  35. * @author chris
  36. */
  37. public class ShipsPage extends ListablePage<BasicShipInfoSurrogate> implements ActionListener {
  38. /**
  39. * A version number for this class. It should be changed whenever the class
  40. * structure is changed (or anything else that would prevent serialized
  41. * objects being unserialized with the new class).
  42. */
  43. private static final long serialVersionUID = 10;
  44. public ShipsPage(final MainWindow window, final AccountManager manager,
  45. final ApiFactory factory) {
  46. super(window, manager, factory);
  47. config = new ListableConfig();
  48. config.topLeft = new ListableConfig.BasicConfigElement("name");
  49. config.topRight = new ListableConfig.CompoundConfigElement();
  50. config.bottomLeft = new ListableConfig.BasicConfigElement("can fly");
  51. config.bottomRight = new ListableConfig.CompoundConfigElement();
  52. config.group = new ListableConfig.BasicConfigElement("group name");
  53. config.sortOrder = new ListableConfig.ConfigElement[]{
  54. new ListableConfig.BasicConfigElement("group name"),
  55. new ListableConfig.BasicConfigElement("name"),
  56. };
  57. }
  58. /** {@inheritDoc} */
  59. @Override
  60. public boolean isReady() {
  61. return character != null && character.getSheet() != null
  62. && character.getSheet().wasSuccessful();
  63. }
  64. /** {@inheritDoc} */
  65. @Override
  66. protected List<BasicShipInfoSurrogate> getListables() {
  67. final List<BasicShipInfoSurrogate> list = new ArrayList<BasicShipInfoSurrogate>();
  68. for (BasicShipInfo ship : factory.getApi().getShipList().getResult()
  69. .getShips().values()) {
  70. list.add(new BasicShipInfoSurrogate(ship, character.getSheet().getResult()));
  71. }
  72. return list;
  73. }
  74. }