function edit(view,h)


%% Listeners which keep the panels udpated. These are @viewplot
%% specific
h.Listeners = [handle.listener(view.AxesGrid,'Viewchanged',@(es,ed) axespanel(h,view,'Y'));...
               handle.listener(view.AxesGrid,'Viewchanged',@(es,ed) updatetime(view,h));...
               handle.listener(view.AxesGrid,'Viewchanged',@(es,ed) updatechartable(view,h));...
               handle.listener(view,view.findprop('TimeUnits'),'PropertyPreSet',...
                   {@localUpdateCharUnits view h})];
%% Initialize prop editor
h.initialize(view)

%% Add panels
h.axespanel(view,'Y');
view.timepnl(h);
charlist = {'Mean','tsguis.tsMeanData','tsguis.tsMeanView';...
            'STD','tsguis.tsMeanData','tsguis.tsStdView';...
            'Median','tsguis.tsMeanData','tsguis.tsMedianView'};
s = struct('charlist',{charlist},...
    'additionalDataProps',{{'Starttime','Endtime'}},'additionalDataPropDefaults',...
    {{'',''}},'additionalHeadings',{{'Start Time','End Time'}});
h.charpanel(view,s,@localParseTime);


function localUpdateCharUnits(es,ed,h,thispropedit)

%% Callback for changes in the plot time units which will update the
%% Start and End Times on the @timeplot char panel
updatechartable(h,thispropedit,tsunitconv(ed.NewValue,h.TimeUnits))

function outTime = localParseTime(h,thisTime)

%% Custom parser for processing absolute time/dates entered into the
%% char panel as start and end times

if strcmp(h.AbsoluteTime,'off')
    outTime = eval(thisTime,'[]');
    return
else % Convert abs data to rel time
    try
        outTime = tsunitconv(h.TimeUnits,'days')*...
            (datenum(thisTime,h.TimeFormat)-datenum(h.StartDate));
    catch
        outTime = []; % Empty signified error
    end
end

