diff m-toolbox/classes/+utils/@jmysql/queryDialog.m @ 0:f0afece42f48

Import.
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Wed, 23 Nov 2011 19:22:13 +0100
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/m-toolbox/classes/+utils/@jmysql/queryDialog.m	Wed Nov 23 19:22:13 2011 +0100
@@ -0,0 +1,63 @@
+% QUERYDIALOG a visual query builder for querying an LTPDA repository.
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% DESCRIPTION: QUERYDIALOG a visual query builder for querying an LTPDA
+%              repository.
+%
+% CALL:        utils.jmysql.queryDialog();
+%              utils.jmysql.queryDialog(conn);
+%
+% INPUTS:
+%              conn - a connection object like that returned from
+%                     utils.jmysql.connect.
+%
+%
+% VERSION:     $Id: queryDialog.m,v 1.2 2009/09/22 14:40:07 ingo Exp $
+%
+% HISTORY:     24-05-2007 M Hewitson
+%                 Creation
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+
+
+function  queryDialog(varargin)
+  
+  if nargin == 1 && ~isa(varargin{1}, 'mpipeline.repository.RepositoryConnection')
+    error('### The first argument should be empty or a RepositoryConnection');
+  end
+  
+  
+  % Inputs
+  conn = [];
+  if nargin > 0
+    conn  = varargin{1};
+  end
+  
+  if isempty(conn)
+    conn = utils.jmysql.connect();
+  end
+  
+  if ~conn.isConnected
+    conn.openConnection
+  end
+  
+  if ~conn.isConnected
+    error('### Failed to connect to repository.');
+  end
+  
+  % open a query dialog
+  if nargin == 0
+    closeConnectionOnExit = true;
+  else
+    closeConnectionOnExit = false;
+  end
+  warning('off', 'MATLAB:JavaEDTAutoDelegation');
+  qrd = mpipeline.repository.RepositoryQueryDialog([], false, conn, false, closeConnectionOnExit);
+  qrd.setVisible(true)
+  warning('off', 'MATLAB:JavaEDTAutoDelegation');
+  
+  
+  
+end
+