Пример #1
0
  /**
   * The constructor that will add the items to this panel.
   *
   * @param freeColClient The <code>FreeColClient</code> for the game.
   */
  @SuppressWarnings("unchecked") // FIXME in Java7
  public ReportProductionPanel(FreeColClient freeColClient) {
    super(freeColClient, Messages.message("reportProductionAction.name"));

    // TODO: can we extend this to cover farmed goods?
    goodsTypes = new ArrayList<GoodsType>();
    List<String> goodsNames = new ArrayList<String>();
    goodsNames.add(Messages.message("nothing"));
    for (GoodsType goodsType : getSpecification().getGoodsTypeList()) {
      if (!goodsType.isFarmed()) {
        goodsTypes.add(goodsType);
        goodsNames.add(Messages.message(goodsType.getNameKey()));
      }
    }

    String[] model = goodsNames.toArray(new String[goodsTypes.size() + 1]);
    for (int index = 0; index < NUMBER_OF_GOODS; index++) {
      boxes[index] = new JComboBox(model);
    }

    selectLabel = new JLabel(Messages.message("report.production.selectGoods"));
    selectButton = new JButton(Messages.message("report.production.update"));
    selectButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent event) {
            update();
          }
        });

    reportPanel.setLayout(new MigLayout("gap 0 0", "[fill]", "[fill]"));
    update();
  }