@Override public void add(Editable point) { if (point instanceof PlanningSegment) { // hey, is this a closing segment? if (point instanceof ClosingSegment) { // do we already have one? if (this.getSegments().last() instanceof ClosingSegment) { // skip.... _toolParent.logError(ToolParent.WARNING, "Already have closing segment", null); } } // take a copy of the name, to stop it getting manmgled String name = point.getName(); super.add(point); if (point.getName() != name) ((PlanningSegment) point).setName(name); // better do a recalc, aswell recalculate(); } else { throw new RuntimeException("can't add this type to a composite track wrapper"); } }
/** popup a dialog to add a new leg */ public void addLeg() { if (_triggerNewLeg != null) _triggerNewLeg.createLegFor(this); else { if (_toolParent != null) _toolParent.logError( ToolParent.ERROR, "CompositeTrackWrapper does not have leg-trigger helper", null); else throw new RuntimeException("CompositeTrackWrapper has not been configured in app start"); } }