Пример #1
0
  /**
   * add to properties
   *
   * @param comps comps
   */
  public void getPropertiesComponents(List comps) {
    super.getPropertiesComponents(comps);
    binWidthField = new TimeLengthField("Bin Width", true);
    binRoundToField = new TimeLengthField("Bin Round To", true);
    binWidthField.setTime(binWidth);
    binRoundToField.setTime(binRoundTo);
    List roundToItems =
        Misc.toList(
            new Object[] {
              new TwoFacedObject("Change", new Double(0)),
              new TwoFacedObject("On the hour", new Double(60)),
              new TwoFacedObject("5 after", new Double(5)),
              new TwoFacedObject("10 after", new Double(10)),
              new TwoFacedObject("15 after", new Double(15)),
              new TwoFacedObject("20 after", new Double(20)),
              new TwoFacedObject("30 after", new Double(30)),
              new TwoFacedObject("45 after", new Double(45)),
              new TwoFacedObject("10 to", new Double(50)),
              new TwoFacedObject("5 to", new Double(55))
            });

    roundToCbx =
        GuiUtils.makeComboBox(
            roundToItems, roundToItems.get(0), false, this, "setRoundToFromComboBox");

    List widthItems =
        Misc.toList(
            new Object[] {
              new TwoFacedObject("Change", new Double(0)),
              new TwoFacedObject("5 minutes", new Double(5)),
              new TwoFacedObject("10 minutes", new Double(10)),
              new TwoFacedObject("15 minutes", new Double(15)),
              new TwoFacedObject("20 minutes", new Double(20)),
              new TwoFacedObject("30 minutes", new Double(30)),
              new TwoFacedObject("45 minutes", new Double(45)),
              new TwoFacedObject("1 hour", new Double(60)),
              new TwoFacedObject("6 hours", new Double(60 * 6)),
              new TwoFacedObject("12 hours", new Double(60 * 12)),
              new TwoFacedObject("1 day", new Double(60 * 24))
            });

    widthCbx =
        GuiUtils.makeComboBox(widthItems, widthItems.get(0), false, this, "setWidthFromComboBox");

    comps.add(GuiUtils.filler());
    comps.add(getPropertiesHeader("Time Binning"));

    comps.add(GuiUtils.rLabel("Bin Size:"));
    comps.add(GuiUtils.left(GuiUtils.hbox(binWidthField.getContents(), widthCbx, 5)));
    comps.add(GuiUtils.rLabel("Round To:"));
    comps.add(GuiUtils.left(GuiUtils.hbox(binRoundToField.getContents(), roundToCbx, 5)));
  }
Пример #2
0
  /**
   * apply the properties
   *
   * @return success
   */
  public boolean applyProperties() {
    if (!super.applyProperties()) {
      return false;
    }
    boolean changed = false;
    String what = "";
    try {
      what = "Bad bin value";
      changed |= (binRoundToField.getTime() != binRoundTo) || (binWidth != binWidthField.getTime());
      binRoundTo = binRoundToField.getTime();
      binWidth = binWidthField.getTime();

      what = "Bad grid points X value";
      changed |= (gridX != gridProperties.getGridX());
      what = "Bad grid points Y value";
      changed |= (gridY != gridProperties.getGridY());
      what = "Bad grid passes value";
      changed |= (numGridPasses != gridProperties.getNumGridPasses());
      what = "Bad grid unit value";
      changed |= (!gridUnit.equals(gridProperties.getGridUnit()));
      what = "Bad grid search value";
      changed |= (gridSearchRadius != gridProperties.getGridSearchRadius());
      what = "Bad grid gain value";
      changed |= (gridGain != gridProperties.getGridGain());
    } catch (NumberFormatException nfe) {
      LogUtil.userErrorMessage(what);
      return false;
    }

    gridX = gridProperties.getGridX();
    gridY = gridProperties.getGridY();
    gridUnit = gridProperties.getGridUnit();
    numGridPasses = gridProperties.getNumGridPasses();
    gridGain = gridProperties.getGridGain();
    gridSearchRadius = gridProperties.getGridSearchRadius();
    if (makeGridFields != makeGridFieldsCbx.isSelected()) {
      makeGridFields = makeGridFieldsCbx.isSelected();
      dataChoices = null;
      getDataChoices();
      getDataContext().dataSourceChanged(this);
    }

    if (changed) {
      flushCache();
    }

    return true;
  }
Пример #3
0
 /**
  * set the property
  *
  * @param tfo value_
  */
 public void setWidthFromComboBox(TwoFacedObject tfo) {
   double value = ((Double) tfo.getId()).doubleValue();
   if (value == 0.0) {
     return;
   }
   binWidthField.setTime(value);
   widthCbx.setSelectedIndex(0);
 }