function shiftaxes(this,direction)

%% Get the table data and selected row
row = this.Handles.axesTable.getTable.getSelectedRow;
if isempty(row)
    return
end
row=row+1;

%% Check that the shift operation is within range
if row+direction>this.Plot.AxesGrid.size(1) || row+direction<1
    return
end

%% Find the waveform in the corresponding axes and the one above it
rowindices = get(this.Timeplot.Waves,{'RowIndex'});
thiswavepos = [];
otherwavepos = [];
for k=1:length(rowindices)
    if rowindices{k,1} == row
        thiswavepos = k;
    elseif rowindices{k,1} == row+direction
        otherwavepos = k;
    end
end

%% Interchange the position of the two waves
if ~isempty(thiswavepos) && ~isempty(otherwavepos)
    this.Timeplot.Waves(thiswavepos).RowIndex = ...
        repmat(row+direction,this.Timeplot.Waves(thiswavepos).Data.getsize);
    this.Timeplot.Waves(otherwavepos).RowIndex = ...
        repmat(row,this.Timeplot.Waves(otherwavepos).Data.getsize);   
end

%% Interchnage axes properties
% Cache row 
temp_ylim = this.Timeplot.AxesGrid.getylim(row);
temp_ymode = this.Timeplot.AxesGrid.YlimMode{row};
temp_rowlabel = this.Timeplot.AxesGrid.RowLabel{row};
% Overwrite row
this.Timeplot.AxesGrid.setylim(this.Timeplot.AxesGrid.getylim(row+direction),row);
this.Timeplot.AxesGrid.YlimMode{row} = this.Timeplot.AxesGrid.YlimMode{row+direction};
this.Timeplot.AxesGrid.RowLabel{row} = this.Timeplot.AxesGrid.RowLabel{row+direction};
% Overwrote row+direction
this.Timeplot.AxesGrid.YlimMode{row+direction} = temp_ymode;
this.Timeplot.AxesGrid.setylim(temp_ylim ,row+direction);
this.Timeplot.AxesGrid.RowLabel{row+direction} = temp_rowlabel;

%% Refresh axes table
this.axestable
this.Timeplot.AxesGrid.send('datachange')