Esempio n. 1
0
  private void createUIComponents() {
    portFreightTableModel = new FreightTableModel(Game.getInstance().getFreightMarket());
    portFreightTable = new JTable(portFreightTableModel);
    TableRowSorter<FreightTableModel> portTableSorter =
        new TableRowSorter<FreightTableModel>(portFreightTableModel);
    portTableSorter.setRowFilter(new FreightTableModel.PortRowFilter(portProxy));
    portFreightTable.setRowSorter(portTableSorter);

    Company playerCompany = Game.getInstance().getPlayerCompany();
    List<ShipModel> shipsInPortList = playerCompany.findShipsInPort(portProxy);

    shipsInPortListBox = new JList(shipsInPortList.toArray());

    // TODO this is fugly-hacked at the moment.
    FreightTableModel shipFreightTableModel = null;

    if (shipsInPortList.size() > 0) {
      shipFreightTableModel = new FreightTableModel(shipsInPortList.get(0));
    } else {
      shipFreightTableModel = new FreightTableModel(null);
    }

    shipFreightTable = new JTable(shipFreightTableModel);
    TableRowSorter<FreightTableModel> shipTableSorter =
        new TableRowSorter<FreightTableModel>(shipFreightTableModel);
    shipFreightTable.setRowSorter(shipTableSorter);

    nameOfPort = new JLabel();
    nameOfPort.setText(portProxy.getName());
  }
Esempio n. 2
0
 public static void main(String[] args) throws ShipnameAlreadyExistsException {
   GameTestUtil.setupInstanceForTest();
   String portName = "Durban";
   try {
     Main.displayFrame(new PortWindow(Game.getInstance().getPortByName(portName).getProxy()));
   } catch (NoSuchPortException e) {
     Logger logger = LoggerFactory.getLogger(PortWindow.class);
     logger.error(String.format("Could not find port %s", portName), e);
   }
 }