Ejemplo n.º 1
0
    public final PropertyDescriptor[] getPropertyDescriptors() {
      try {
        PropertyDescriptor[] myRes = {
          prop("SymbolType", "the type of symbol plotted for this label"),
          prop("SymbolSize", "the scale of the symbol"),
          prop("Duration", "the lifetime of the buoy pattern"),
          prop("PatternName", "the name of this barrier"),
          prop("PatternBuoySpacing", "the spacing of the buoys in the wedge"),
          prop(
              "Orientation2",
              "the orientation of the second side of the wedge from kingpin (degs)"),
          prop(
              "Orientation1", "the orientation of the first side of the wedge from kingpin (degs)"),
          prop("KingpinRange", "the range of the kingpin from the jig point"),
          prop("KingpinBearing", "the bearing of the kingpin from the jig point (degs)"),
          prop("JigPoint", "the jig point for the construction of this wedge"),
          prop("NumberOfBuoys", "the number of buoys in this wedge"),
          prop("Color", "the default colour for this wedge"),
          prop("DateTimeGroup", "the DTG this pattern starts (DD/MM/YY)"),
          prop("BuoyLabelVisible", "whether the buoy labels are visible")
        };
        myRes[0].setPropertyEditorClass(
            MWC.GUI.Shapes.Symbols.SymbolFactoryPropertyEditor.SymbolFactoryBuoyPropertyEditor
                .class);
        myRes[1].setPropertyEditorClass(MWC.GUI.Shapes.Symbols.SymbolScalePropertyEditor.class);

        return myRes;

      } catch (IntrospectionException e) {
        // find out which property fell over
        MWC.Utilities.Errors.Trace.trace(e, "Creating editor for Wedge Builder");

        return super.getPropertyDescriptors();
      }
    }
Ejemplo n.º 2
0
    public final PropertyDescriptor[] getPropertyDescriptors() {
      try {
        final PropertyDescriptor[] res = {
          displayProp("StepSmall", "Small step", "the small step size"),
          displayProp("StepLarge", "Large step", "the large step size"),
          displayProp("AutoStep", "Auto step", "the automatic step"),
          displayProp("FontSize", "Font size", "the font size for the time label"),
          displayProp("DateFormat", "Date format", "the format to use for the date/time"),
          longProp("Highlighter", "the highlighter to use", TagListEditor.class)
        };

        // right, special processing here.  If we're in hi-res mode, we want to specify the very
        // hi res timers.
        if (HiResDate.inHiResProcessingMode()) {
          // use hi res property editor
          res[0].setPropertyEditorClass(MWC.GUI.Properties.HiFreqTimeStepPropertyEditor.class);
          res[1].setPropertyEditorClass(MWC.GUI.Properties.HiFreqTimeStepPropertyEditor.class);
        } else {
          res[0].setPropertyEditorClass(MWC.GUI.Properties.TimeStepPropertyEditor.class);
          res[1].setPropertyEditorClass(MWC.GUI.Properties.TimeStepPropertyEditor.class);
        }

        res[2].setPropertyEditorClass(MWC.GUI.Properties.TimeIntervalPropertyEditor.class);
        res[4].setPropertyEditorClass(MyDateEditor.class);

        return res;
      } catch (final Exception e) {
        MWC.Utilities.Errors.Trace.trace(e);
        return super.getPropertyDescriptors();
      }
    }
Ejemplo n.º 3
0
  // timer listener event
  public final void onTime(final java.awt.event.ActionEvent event) {
    // temporarily remove ourselves, to prevent being called twice
    _theTimer.removeTimerListener(this);

    // catch any exceptions raised here, it doesn't really
    // matter if we miss a time step
    try {

      // pass the step operation on to our parent
      doStep(_goingForward, _largeSteps);

    } catch (final Exception e) {
      MWC.Utilities.Errors.Trace.trace(e);
    }

    // register ourselves as a time again
    _theTimer.addTimerListener(this);
  }
Ejemplo n.º 4
0
  /**
   * private method to produce a time string from the indicated DTG we've moved it out of the
   * newTime box so that we can access it from a tester
   */
  public String getNewTime(final HiResDate DTG) {
    final String pattern = _dateFormatter.toPattern();

    String res = "";

    if (pattern.startsWith("'T+'")) {
      // hey, we're doing our "Special format".
      res = "T ";

      // get the T-zero time
      final HiResDate theTZero = getTimeZero();
      if (theTZero == null) {
        // no, return an error message
        return "N/A";
      }

      final long Tzero = theTZero.getMicros();

      // what's the elapsed time
      final long elapsed = DTG.getMicros() - Tzero;

      if (Math.abs(elapsed) > 1000000000000l) {
        res = "N/A";
      } else {

        // how many seconds is this?
        long secs = (long) (elapsed / 1000000d);

        // are we +ve?
        if (secs > 0) {
          res += "+";
        } else {
          res += "-";
        }

        // ok, we've handled the +ve/-ve make it absolute
        secs = Math.abs(secs);

        // which format do they want?
        String format = pattern.substring(pattern.indexOf(" "));

        // strip the format string
        format = format.trim();

        if (format.equals("SSS")) {
          // do we have our number formatter?
          if (_secondsFormat == null) _secondsFormat = new java.text.DecimalFormat("000s");

          res += _secondsFormat.format(secs);
        } else if (format.equals("MM:SS")) {
          // how many mins?
          final long mins = secs / 60;

          // and the seconds
          secs -= mins * 60;

          res += mins;

          res += ":";

          res += MWC.Utilities.TextFormatting.BriefFormatLocation.df2.format(secs);

        } else {
          MWC.Utilities.Errors.Trace.trace("Step control: invalid TZero format found:" + format);
        }
      }
    } else {
      // are we in hi-res mode or not?
      if (HiResDate.inHiResProcessingMode()) res = DebriefFormatDateTime.formatMicros(DTG);
      else res = _dateFormatter.format(DTG.getDate());
    }

    return res;
  }