Exemplo n.º 1
0
 public FarmingGraphPage(final FarmStrategy farmStrategy) {
   this.farmStrategy = farmStrategy;
   add(new Label("strategyName", farmStrategy.getStrategyName()));
   add(
       ArmoryImage.createArmoryImage(
           (AuctioneerWebApp) getApplication(), "icon", farmStrategy.getIconItem()));
 }
Exemplo n.º 2
0
  public FarmingGraphPage(PageParameters parameters) throws Exception {
    final int farmStrategyID = parameters.getInt("farmStrategyID");
    farmStrategy = farmStrategyBO.getById(FarmStrategyId.farmStrategyId(farmStrategyID));
    add(new Label("strategyName", farmStrategy.getStrategyName()));
    add(
        ArmoryImage.createArmoryImage(
            (AuctioneerWebApp) getApplication(), "icon", farmStrategy.getIconItem()));
    setPageTitle("Farming - " + farmStrategy.getStrategyName());

    final PropertyModel<List<FarmStrategyLoot>> materialListModel =
        new PropertyModel<List<FarmStrategyLoot>>(this, "farmStrategy.loot");

    ListView<FarmStrategyLoot> listView =
        new ListView<FarmStrategyLoot>("lootList", materialListModel) {
          private static final long serialVersionUID = 1L;

          @Override
          protected void populateItem(ListItem<FarmStrategyLoot> item) {

            final FarmStrategyLoot loot = item.getModelObject();
            PageParameters params = new PageParameters();
            params.add("itemID", String.valueOf(loot.getItem().getArmoryId().toInt()));
            final Link<String> lootLine =
                new BookmarkablePageLink<String>("lootLine", PriceWatchGraphPage.class, params);

            lootLine.add(new WowheadTooltip(loot.getItem().getArmoryId()));
            lootLine.add(
                ArmoryImage.createArmoryImage(
                    (AuctioneerWebApp) getApplication(), "icon", loot.getItem()));
            final String name = loot.getItemCount() + " x " + loot.getItem().getItemName();
            lootLine.add(new Label("name", name));
            item.add(lootLine);
          }
        };
    listView.setReuseItems(true);
    listView.setOutputMarkupId(true);
    add(listView);

    add(new Label("minProfit", goldToString(farmStrategy.getTotalSafeProfit())));
    add(new Label("medianProfit", goldToString(farmStrategy.getTotalProfit())));
  }
Exemplo n.º 3
0
  private Highstock addMarginSeriesData(final Highstock hs) {
    final List<FarmStrategyProfit> profits = farmStrategy.getProfits();
    // Fill Data
    final List<Data> medianProfit = new ArrayList<Data>();
    final List<Data> minProfit = new ArrayList<Data>();
    final List<Data> profitSampleSize = new ArrayList<Data>();

    for (FarmStrategyProfit profit : profits) {
      medianProfit.add(
          new Data(profit.getProfitTimestamp(), profit.getMedianSalePrice().toLong() / 10000.0));
      minProfit.add(
          new Data(profit.getProfitTimestamp(), profit.getMinSalePrice().toLong() / 10000.0));
      profitSampleSize.add(new Data(profit.getProfitTimestamp(), profit.getSalePriceSampleSize()));
    }
    hs.series()
        .add(
            new Series(medianProfit)
                .color(MIN_SALE_PRICE_SERIES_COLOR)
                .name("Median Profit")
                .index(0)
                .type("area")
                .shadow(true));
    hs.series()
        .add(
            new Series(minProfit)
                .color(MIN_MATERIAL_COST_SERIES_COLOR)
                .name("Minimaler Profit")
                .index(1)
                .type("area")
                .shadow(true));
    hs.series()
        .add(
            new Series(profitSampleSize)
                .color(MATERIAL_SAMPLE_SIZE_SERIES_COLOR)
                .name("Samples")
                .index(4)
                .type("area")
                .showInLegend(false)
                .shadow(true)
                .yAxis(1));

    return hs;
  }