function initialize(h)

import javax.swing.*;
import com.mathworks.toolbox.timeseries.*;
import com.mathworks.mwswing.*;

%% Builds the Data Selection GUI

import javax.swing.*; 
onoff = {'off';'on'};

%% Main figure
h.Figure = figure('Units','Characters','Position',[104 27.684 73 23.836],'Toolbar',...
    'None','Numbertitle','off','Menubar','None','Name','Shift Time Series',...
    'Visible','off','closeRequestFcn',@(es,ed) set(h,'Visible','off'),...
    'HandleVisibility','callback');

%% Top Time view selection panel
LBLselts = uicontrol('Style','Text','Parent',h.Figure,'Units','Characters',...
    'Position',[2.8 20.9138 16.4 1.1535],'String','Select time view','HorizontalAlignment',...
    'Left');
set(h.Figure,'Color',get(LBLselts,'BackgroundColor'))
h.Handles.COMBOselectView = uicontrol('Style','Popupmenu','Parent', ...
    h.Figure,'Units','Characters','Position',[21.4 20.3755 48.8 2.0763],...
    'String',{''},'Callback',{@localSwitchView h},'BackgroundColor',[1 1 1]);

%% Build time series table
h.Handles.tsTable = eventTable({});
thisScrollPane = MJScrollPane(h.Handles.tsTable); 
pos = hgconvertunits(h.Figure,[2.6 6.5341 68.8 12.7648],'Characters',...
        'Pixels',h.Figure);
[junk,h.Handles.tsTablePnl] = ...
    javacomponent(thisScrollPane,pos,h.Figure);
set(h.Handles.tsTablePnl,'Units','Pixels','Parent',h.Figure,'Position',...
    pos)

%% Time units label
h.Handles.LBLunits  = uicontrol('style','Text','Parent',h.Figure,'Units','Characters',...
    'Position',[2.6 4 68 1.7687],'String','','HorizontalAlignment',...
    'Left');

%% Dialog buttons
BTNok = uicontrol('style','Pushbutton','Parent',h.Figure,'Units','Characters',...
    'Position',[25 1.3073 13.8 1.7687],'String','OK','Callback',{@localOK h});
BTNapply = uicontrol('style','Pushbutton','Parent',h.Figure,'Units','Characters',...
    'Position',[40.8 1.3073 13.8 1.7687],'String','Apply','Callback',@(es,ed) eval(h));
BTNcancel = uicontrol('style','Pushbutton','Parent',h.Figure,'Units','Characters',...
    'Position',[56.2 1.3073 13.8 1.7687],'String','Cancel','Callback', ...
    @(es,ed) set(h,'Visible','off'));

%% Install viewnode and visibility listeners
h.generic_listeners
  
function localOK(eventSrc, eventData, h)

%% OK button callback 
status = h.eval;
if status
   h.Visible = 'off';
end

function localSwitchView(eventSrc, eventData, h)

%% View combo callback which changes the viewNode
ind = get(eventSrc,'Value');
viewnames =  get(eventSrc,'String');
h.switchview(viewnames{ind});