SchemaSpyGUIApp.java 91 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764
  1. /*
  2. * SchemaSpyGUIApp.java
  3. *
  4. * Created on 07.01.2009, 22:21:15
  5. */
  6. package schemaspygui;
  7. import java.io.File;
  8. import java.io.FileOutputStream;
  9. import java.io.FileInputStream;
  10. import java.io.IOException;
  11. import javax.swing.*;
  12. import javax.swing.UIManager;
  13. import javax.swing.filechooser.FileFilter;
  14. import java.util.Set;
  15. import java.util.Properties;
  16. /**
  17. *
  18. * @author Joachim Uhl
  19. */
  20. public class SchemaSpyGUIApp extends javax.swing.JFrame {
  21. /** Creates new form SchemaSpyGUIApp */
  22. public SchemaSpyGUIApp() {
  23. setLookandFeel();
  24. initParams();
  25. initComponents();
  26. }
  27. /** This method is called from within the constructor to
  28. * initialize the form.
  29. * WARNING: Do NOT modify this code. The content of this method is
  30. * always regenerated by the Form Editor.
  31. */
  32. @SuppressWarnings("unchecked")
  33. // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
  34. private void initComponents() {
  35. jToolBar = new javax.swing.JToolBar();
  36. exitButton = new javax.swing.JButton();
  37. quickSaveButton = new javax.swing.JButton();
  38. quickLoadButton = new javax.swing.JButton();
  39. jSeparator2 = new javax.swing.JToolBar.Separator();
  40. saveParamFileButton = new javax.swing.JButton();
  41. loadParamFileButton = new javax.swing.JButton();
  42. clearFieldsButton = new javax.swing.JButton();
  43. jSeparator1 = new javax.swing.JToolBar.Separator();
  44. startSchemaSpyButton = new javax.swing.JButton();
  45. showOutputButton = new javax.swing.JButton();
  46. jTabbedPane = new javax.swing.JTabbedPane();
  47. reqParamPanel = new javax.swing.JPanel();
  48. lbl_DBType = new javax.swing.JLabel();
  49. dbTypeCBox = new javax.swing.JComboBox();
  50. lbl_PathtoDBdrvr = new javax.swing.JLabel();
  51. lbl_DBName = new javax.swing.JLabel();
  52. lbl_DBHost = new javax.swing.JLabel();
  53. lbl_DBPort = new javax.swing.JLabel();
  54. lbl_DBUser = new javax.swing.JLabel();
  55. lbl_DBPwd = new javax.swing.JLabel();
  56. lbl_PathSchemSpy = new javax.swing.JLabel();
  57. dbPwdField = new javax.swing.JPasswordField();
  58. dbUserTField = new javax.swing.JTextField();
  59. dbNameTField = new javax.swing.JTextField();
  60. dbHostTField = new javax.swing.JTextField();
  61. dbPortTField = new javax.swing.JTextField();
  62. dbDriverPTField = new javax.swing.JTextField();
  63. driverButton = new javax.swing.JButton();
  64. sSpyPathTField = new javax.swing.JTextField();
  65. sSpyPathButton = new javax.swing.JButton();
  66. lbl_PropertiePath = new javax.swing.JLabel();
  67. propertiePathTField = new javax.swing.JTextField();
  68. propertiePathButton = new javax.swing.JButton();
  69. propertiesTField = new javax.swing.JTextField();
  70. lbl_prop = new javax.swing.JLabel();
  71. flagsPanel = new javax.swing.JPanel();
  72. aHTMLCBox = new javax.swing.JCheckBox();
  73. noHTMLCBox = new javax.swing.JCheckBox();
  74. dincFKCBox = new javax.swing.JCheckBox();
  75. noAdsCBox = new javax.swing.JCheckBox();
  76. noLogoCBox = new javax.swing.JCheckBox();
  77. noRowsBox = new javax.swing.JCheckBox();
  78. railsCBox = new javax.swing.JCheckBox();
  79. qualityPanel = new javax.swing.JPanel();
  80. highQuCBox = new javax.swing.JCheckBox();
  81. lowQuCBox = new javax.swing.JCheckBox();
  82. singleSignCBox = new javax.swing.JCheckBox();
  83. showFinishCBox = new javax.swing.JCheckBox();
  84. savePassCBox = new javax.swing.JCheckBox();
  85. outputOptionsPanel = new javax.swing.JPanel();
  86. lbl_OutDir = new javax.swing.JLabel();
  87. pathOutputTField = new javax.swing.JTextField();
  88. outDirButton = new javax.swing.JButton();
  89. allSchemasCBox = new javax.swing.JCheckBox();
  90. schemaTField = new javax.swing.JTextField();
  91. lbl_Schema = new javax.swing.JLabel();
  92. lbl_Desc = new javax.swing.JLabel();
  93. descTAreaScrollPane = new javax.swing.JScrollPane();
  94. descTArea = new javax.swing.JTextArea();
  95. lbl_TableRegEx = new javax.swing.JLabel();
  96. tNameRExTField = new javax.swing.JTextField();
  97. lbl_TableExRegEx = new javax.swing.JLabel();
  98. tNameExRExTField = new javax.swing.JTextField();
  99. lbl_ColumnRegEx = new javax.swing.JLabel();
  100. cNameRExTField = new javax.swing.JTextField();
  101. colExRelCBox = new javax.swing.JCheckBox();
  102. stylePanel = new javax.swing.JPanel();
  103. charsetComBox = new javax.swing.JComboBox();
  104. lbl_Charset = new javax.swing.JLabel();
  105. lbl_Font = new javax.swing.JLabel();
  106. fontNameTField = new javax.swing.JTextField();
  107. lbl_fontSize = new javax.swing.JLabel();
  108. fontSizeTField = new javax.swing.JTextField();
  109. lbl_css = new javax.swing.JLabel();
  110. cssPathTField = new javax.swing.JTextField();
  111. jButton1 = new javax.swing.JButton();
  112. metaFilePathButton = new javax.swing.JButton();
  113. metaFilePathTField = new javax.swing.JTextField();
  114. lbl_OutDir1 = new javax.swing.JLabel();
  115. outputPanel = new javax.swing.JPanel();
  116. sSpyOutTAreaScrollPane = new javax.swing.JScrollPane();
  117. sSpyOutTArea = new javax.swing.JTextArea();
  118. mainMenuBar = new javax.swing.JMenuBar();
  119. fileMenu = new javax.swing.JMenu();
  120. sParamMenuItem = new javax.swing.JMenuItem();
  121. lParamMenuItem = new javax.swing.JMenuItem();
  122. exitMenuItem = new javax.swing.JMenuItem();
  123. infoMenu = new javax.swing.JMenu();
  124. helpMenueAboutItem = new javax.swing.JMenuItem();
  125. setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
  126. java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("schemaspygui/resources/ReleaseText"); // NOI18N
  127. setTitle(bundle.getString("ProgramName")); // NOI18N
  128. setName("SchemaSpyGUIAppMainFrame"); // NOI18N
  129. jToolBar.setRollover(true);
  130. exitButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/schemaspygui/resources/door_out.png"))); // NOI18N
  131. exitButton.setText("Exit");
  132. exitButton.setFocusable(false);
  133. exitButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
  134. exitButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
  135. exitButton.addActionListener(new java.awt.event.ActionListener() {
  136. public void actionPerformed(java.awt.event.ActionEvent evt) {
  137. exitButtonActionPerformed(evt);
  138. }
  139. });
  140. jToolBar.add(exitButton);
  141. quickSaveButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/schemaspygui/resources/disk.png"))); // NOI18N
  142. quickSaveButton.setText("Quick Save");
  143. quickSaveButton.setToolTipText("<html>Saves your settings in a default xml file</html>");
  144. quickSaveButton.setFocusable(false);
  145. quickSaveButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
  146. quickSaveButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
  147. quickSaveButton.addActionListener(new java.awt.event.ActionListener() {
  148. public void actionPerformed(java.awt.event.ActionEvent evt) {
  149. quickSaveButtonActionPerformed(evt);
  150. }
  151. });
  152. jToolBar.add(quickSaveButton);
  153. quickLoadButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/schemaspygui/resources/folder_page_white.png"))); // NOI18N
  154. quickLoadButton.setText("Quick Load");
  155. quickLoadButton.setToolTipText("<html>Loads your settings out of the default xml file</html>");
  156. quickLoadButton.setFocusable(false);
  157. quickLoadButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
  158. quickLoadButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
  159. quickLoadButton.addActionListener(new java.awt.event.ActionListener() {
  160. public void actionPerformed(java.awt.event.ActionEvent evt) {
  161. quickLoadButtonActionPerformed(evt);
  162. }
  163. });
  164. jToolBar.add(quickLoadButton);
  165. jToolBar.add(jSeparator2);
  166. saveParamFileButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/schemaspygui/resources/disk_multiple.png"))); // NOI18N
  167. saveParamFileButton.setText("Save File");
  168. saveParamFileButton.setToolTipText("<html>Save your settings with a filename (xml format) you can choose</html>");
  169. saveParamFileButton.setFocusable(false);
  170. saveParamFileButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
  171. saveParamFileButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
  172. saveParamFileButton.addActionListener(new java.awt.event.ActionListener() {
  173. public void actionPerformed(java.awt.event.ActionEvent evt) {
  174. saveParamFileButtonActionPerformed(evt);
  175. }
  176. });
  177. jToolBar.add(saveParamFileButton);
  178. loadParamFileButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/schemaspygui/resources/folder_explore.png"))); // NOI18N
  179. loadParamFileButton.setText("Load File");
  180. loadParamFileButton.setToolTipText("<html>Load your settings.<br>Choose freely which xml config file you need</html>");
  181. loadParamFileButton.setFocusable(false);
  182. loadParamFileButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
  183. loadParamFileButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
  184. loadParamFileButton.addActionListener(new java.awt.event.ActionListener() {
  185. public void actionPerformed(java.awt.event.ActionEvent evt) {
  186. loadParamFileButtonActionPerformed(evt);
  187. }
  188. });
  189. jToolBar.add(loadParamFileButton);
  190. clearFieldsButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/schemaspygui/resources/cross.png"))); // NOI18N
  191. clearFieldsButton.setText("Clear Fields");
  192. clearFieldsButton.setFocusable(false);
  193. clearFieldsButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
  194. clearFieldsButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
  195. clearFieldsButton.addActionListener(new java.awt.event.ActionListener() {
  196. public void actionPerformed(java.awt.event.ActionEvent evt) {
  197. clearFieldsButtonActionPerformed(evt);
  198. }
  199. });
  200. jToolBar.add(clearFieldsButton);
  201. jToolBar.add(jSeparator1);
  202. startSchemaSpyButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/schemaspygui/resources/database_connect.png"))); // NOI18N
  203. startSchemaSpyButton.setText("Start SchemaSpy");
  204. startSchemaSpyButton.setFocusable(false);
  205. startSchemaSpyButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
  206. startSchemaSpyButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
  207. startSchemaSpyButton.addActionListener(new java.awt.event.ActionListener() {
  208. public void actionPerformed(java.awt.event.ActionEvent evt) {
  209. startSchemaSpyButtonActionPerformed(evt);
  210. }
  211. });
  212. jToolBar.add(startSchemaSpyButton);
  213. showOutputButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/schemaspygui/resources/database_go.png"))); // NOI18N
  214. showOutputButton.setText("Show Output");
  215. showOutputButton.setFocusable(false);
  216. showOutputButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
  217. showOutputButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
  218. showOutputButton.addActionListener(new java.awt.event.ActionListener() {
  219. public void actionPerformed(java.awt.event.ActionEvent evt) {
  220. showOutputButtonActionPerformed(evt);
  221. }
  222. });
  223. jToolBar.add(showOutputButton);
  224. jTabbedPane.setToolTipText("");
  225. reqParamPanel.setToolTipText("");
  226. lbl_DBType.setFont(lbl_DBType.getFont());
  227. lbl_DBType.setText("DB Type:"); // NOI18N
  228. dbTypeCBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { " ", "db2", "db2net", "derby", "derbynet", "firebird", "hsqldb", "informix", "maxdb", "mssql", "mssql05", "mssql-jtds", "mssql05-jtds", "mysql", "ora", "orathin", "pgsql", "sybase", "sybase2", "udbt4" }));
  229. dbTypeCBox.setToolTipText("Choose your type of database (-t)");
  230. dbTypeCBox.addActionListener(new java.awt.event.ActionListener() {
  231. public void actionPerformed(java.awt.event.ActionEvent evt) {
  232. dbTypeCBoxActionPerformed(evt);
  233. }
  234. });
  235. lbl_PathtoDBdrvr.setText("Path to DB driver:"); // NOI18N
  236. lbl_DBName.setText("DB name:"); // NOI18N
  237. lbl_DBHost.setText("DB Host:"); // NOI18N
  238. lbl_DBPort.setText("DB Port:"); // NOI18N
  239. lbl_DBUser.setText("DB User:"); // NOI18N
  240. lbl_DBPwd.setText("Password:"); // NOI18N
  241. lbl_PathSchemSpy.setText("Path to SchemaSpy:"); // NOI18N
  242. dbPwdField.setToolTipText("<html>Enter the User Password (-p)<br>It's not displayed in the SchemaSpy Output,<br>but be careful with the \"Save User Password\" option.<br> Currently the PWD is stored in clear text.\n</html>");
  243. dbUserTField.setToolTipText("Enter the User name (-u)");
  244. dbNameTField.setToolTipText("Enter the Database Name to connect to (-db)");
  245. dbHostTField.setToolTipText("Enter your DB Host (-host)");
  246. dbPortTField.setToolTipText("Enter the port for the DB (-port)");
  247. dbDriverPTField.setToolTipText("The path to your DB driver");
  248. driverButton.setText("Choose"); // NOI18N
  249. driverButton.setToolTipText("Click to choose the path to database driver file (-dp)"); // NOI18N
  250. driverButton.addActionListener(new java.awt.event.ActionListener() {
  251. public void actionPerformed(java.awt.event.ActionEvent evt) {
  252. driverButtonActionPerformed(evt);
  253. }
  254. });
  255. sSpyPathTField.setToolTipText("The path to the schemaSpy.jar file (executable)");
  256. sSpyPathButton.setText("Choose"); // NOI18N
  257. sSpyPathButton.setToolTipText("Click to choose the path to SchemaSpy"); // NOI18N
  258. sSpyPathButton.addActionListener(new java.awt.event.ActionListener() {
  259. public void actionPerformed(java.awt.event.ActionEvent evt) {
  260. sSpyPathButtonActionPerformed(evt);
  261. }
  262. });
  263. lbl_PropertiePath.setText("Path propertie file:"); // NOI18N
  264. propertiePathTField.setToolTipText("<html>Specifies additional properties to be used when connecting to the database.<br> Specify a .properties file with key=value entries.<br>\nHave a look at the .propertie Files in the subdirectory /properties in your SchemaSpyGUI folder.</html>");
  265. propertiePathButton.setText("Choose"); // NOI18N
  266. propertiePathButton.setToolTipText("Click to choose the path to your database specific propertie file"); // NOI18N
  267. propertiePathButton.addActionListener(new java.awt.event.ActionListener() {
  268. public void actionPerformed(java.awt.event.ActionEvent evt) {
  269. propertiePathButtonActionPerformed(evt);
  270. }
  271. });
  272. propertiesTField.setToolTipText("Specify the entries directly, escaping the ='s with \\= and separating each key\\=value pair with a ;.");
  273. lbl_prop.setText("Properties directly:");
  274. flagsPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(" Flags "));
  275. aHTMLCBox.setText("Allow HTML in comments"); // NOI18N
  276. aHTMLCBox.setToolTipText("<html>Any HTML embedded in comments normally gets encoded so that it's rendered as text.<br> This option allows it to be rendered as HTML. (-ahic)</html>");
  277. noHTMLCBox.setText("No HTML"); // NOI18N
  278. noHTMLCBox.setToolTipText("<html>Only generate files needed for insertion/deletion of data (e.g. for scripts)<br> and an XML representation of the schema. (-nohtml)</html>");
  279. dincFKCBox.setText("Don't include foreign key"); // NOI18N
  280. dincFKCBox.setToolTipText("Don't include implied foreign key relationships. (-noimplied)");
  281. noAdsCBox.setText("No Ads");
  282. noAdsCBox.setToolTipText("Don't show ads (-noads)");
  283. noAdsCBox.setEnabled(false);
  284. noLogoCBox.setText("No Logo");
  285. noLogoCBox.setToolTipText("Don't show Sourceforge.net image logo. (-nologo)");
  286. noRowsBox.setText("Don't query or display row counts");
  287. noRowsBox.setToolTipText("(-norows)");
  288. railsCBox.setText("Ruby on Rails-based database");
  289. railsCBox.setToolTipText("(-rails)");
  290. qualityPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("Quality Image Diagrams:"));
  291. qualityPanel.setToolTipText("Generate either higher or lower-quality diagrams. Depends Graphviz istallation.");
  292. highQuCBox.setText("High Quality");
  293. highQuCBox.setToolTipText("(-hq)");
  294. lowQuCBox.setText("Low Quality");
  295. lowQuCBox.setToolTipText("(-lq)");
  296. org.jdesktop.layout.GroupLayout qualityPanelLayout = new org.jdesktop.layout.GroupLayout(qualityPanel);
  297. qualityPanel.setLayout(qualityPanelLayout);
  298. qualityPanelLayout.setHorizontalGroup(
  299. qualityPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
  300. .add(qualityPanelLayout.createSequentialGroup()
  301. .addContainerGap()
  302. .add(qualityPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
  303. .add(highQuCBox)
  304. .add(lowQuCBox))
  305. .addContainerGap(37, Short.MAX_VALUE))
  306. );
  307. qualityPanelLayout.setVerticalGroup(
  308. qualityPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
  309. .add(qualityPanelLayout.createSequentialGroup()
  310. .add(highQuCBox)
  311. .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
  312. .add(lowQuCBox))
  313. );
  314. singleSignCBox.setText("Single Sign-On");
  315. singleSignCBox.setToolTipText("Don't require a user to be specified with -u to simplify configuration when running in a single sign-on environment (-sso)");
  316. singleSignCBox.setEnabled(false);
  317. showFinishCBox.setText("Show Output when finished");
  318. org.jdesktop.layout.GroupLayout flagsPanelLayout = new org.jdesktop.layout.GroupLayout(flagsPanel);
  319. flagsPanel.setLayout(flagsPanelLayout);
  320. flagsPanelLayout.setHorizontalGroup(
  321. flagsPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
  322. .add(flagsPanelLayout.createSequentialGroup()
  323. .add(44, 44, 44)
  324. .add(flagsPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
  325. .add(flagsPanelLayout.createSequentialGroup()
  326. .add(aHTMLCBox, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  327. .add(46, 46, 46))
  328. .add(noRowsBox, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  329. .add(flagsPanelLayout.createSequentialGroup()
  330. .add(railsCBox, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  331. .add(16, 16, 16))
  332. .add(flagsPanelLayout.createSequentialGroup()
  333. .add(qualityPanel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  334. .add(49, 49, 49)))
  335. .add(17, 17, 17)
  336. .add(flagsPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
  337. .add(flagsPanelLayout.createSequentialGroup()
  338. .add(flagsPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
  339. .add(dincFKCBox, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  340. .add(flagsPanelLayout.createSequentialGroup()
  341. .add(noHTMLCBox, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  342. .add(76, 76, 76)))
  343. .add(9, 9, 9)
  344. .add(flagsPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
  345. .add(flagsPanelLayout.createSequentialGroup()
  346. .add(noAdsCBox, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  347. .add(6, 6, 6))
  348. .add(noLogoCBox, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
  349. .add(flagsPanelLayout.createSequentialGroup()
  350. .add(showFinishCBox)
  351. .add(60, 60, 60))
  352. .add(flagsPanelLayout.createSequentialGroup()
  353. .add(singleSignCBox, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  354. .add(122, 122, 122)))
  355. .add(77, 77, 77))
  356. );
  357. flagsPanelLayout.setVerticalGroup(
  358. flagsPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
  359. .add(org.jdesktop.layout.GroupLayout.TRAILING, flagsPanelLayout.createSequentialGroup()
  360. .addContainerGap(11, Short.MAX_VALUE)
  361. .add(flagsPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
  362. .add(flagsPanelLayout.createSequentialGroup()
  363. .add(flagsPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
  364. .add(flagsPanelLayout.createSequentialGroup()
  365. .add(flagsPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
  366. .add(flagsPanelLayout.createSequentialGroup()
  367. .add(aHTMLCBox)
  368. .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
  369. .add(noRowsBox)
  370. .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
  371. .add(railsCBox))
  372. .add(flagsPanelLayout.createSequentialGroup()
  373. .add(noHTMLCBox)
  374. .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
  375. .add(dincFKCBox)
  376. .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
  377. .add(singleSignCBox)))
  378. .add(18, 18, 18)
  379. .add(showFinishCBox))
  380. .add(flagsPanelLayout.createSequentialGroup()
  381. .add(noLogoCBox)
  382. .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
  383. .add(noAdsCBox)))
  384. .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 43, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
  385. .add(org.jdesktop.layout.GroupLayout.TRAILING, flagsPanelLayout.createSequentialGroup()
  386. .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 80, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
  387. .add(qualityPanel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
  388. .addContainerGap())
  389. );
  390. savePassCBox.setText("Save User Password");
  391. savePassCBox.setToolTipText("<html><b>WARNING:</b> Saves DB User Password as plain text!</html>");
  392. org.jdesktop.layout.GroupLayout reqParamPanelLayout = new org.jdesktop.layout.GroupLayout(reqParamPanel);
  393. reqParamPanel.setLayout(reqParamPanelLayout);
  394. reqParamPanelLayout.setHorizontalGroup(
  395. reqParamPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
  396. .add(reqParamPanelLayout.createSequentialGroup()
  397. .add(reqParamPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
  398. .add(reqParamPanelLayout.createSequentialGroup()
  399. .add(28, 28, 28)
  400. .add(reqParamPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
  401. .add(reqParamPanelLayout.createSequentialGroup()
  402. .add(51, 51, 51)
  403. .add(lbl_DBName, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
  404. .add(reqParamPanelLayout.createSequentialGroup()
  405. .add(53, 53, 53)
  406. .add(reqParamPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
  407. .add(lbl_DBType)
  408. .add(reqParamPanelLayout.createSequentialGroup()
  409. .add(lbl_DBHost, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  410. .add(2, 2, 2))))
  411. .add(reqParamPanelLayout.createSequentialGroup()
  412. .add(55, 55, 55)
  413. .add(lbl_DBUser, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
  414. .add(lbl_PathtoDBdrvr)
  415. .add(lbl_PathSchemSpy)
  416. .add(lbl_PropertiePath)
  417. .add(lbl_prop))
  418. .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
  419. .add(reqParamPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
  420. .add(propertiesTField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 381, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
  421. .add(reqParamPanelLayout.createSequentialGroup()
  422. .add(reqParamPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
  423. .add(org.jdesktop.layout.GroupLayout.LEADING, dbDriverPTField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 306, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
  424. .add(org.jdesktop.layout.GroupLayout.LEADING, sSpyPathTField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 306, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
  425. .add(org.jdesktop.layout.GroupLayout.LEADING, propertiePathTField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 306, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
  426. .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
  427. .add(reqParamPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
  428. .add(propertiePathButton, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  429. .add(sSpyPathButton, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  430. .add(driverButton, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
  431. .add(reqParamPanelLayout.createSequentialGroup()
  432. .add(reqParamPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
  433. .add(dbTypeCBox, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 122, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
  434. .add(dbNameTField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 171, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
  435. .add(dbUserTField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 171, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
  436. .add(dbHostTField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 171, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
  437. .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
  438. .add(reqParamPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
  439. .add(savePassCBox)
  440. .add(reqParamPanelLayout.createSequentialGroup()
  441. .add(reqParamPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
  442. .add(lbl_DBPwd, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 66, Short.MAX_VALUE)
  443. .add(reqParamPanelLayout.createSequentialGroup()
  444. .add(8, 8, 8)
  445. .add(lbl_DBPort, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  446. .add(18, 18, 18)))
  447. .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
  448. .add(reqParamPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
  449. .add(dbPortTField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 89, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
  450. .add(dbPwdField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 89, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))))
  451. .add(41, 41, 41)))
  452. .add(54, 54, 54))
  453. .add(reqParamPanelLayout.createSequentialGroup()
  454. .addContainerGap()
  455. .add(flagsPanel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
  456. .addContainerGap())
  457. );
  458. reqParamPanelLayout.setVerticalGroup(
  459. reqParamPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
  460. .add(org.jdesktop.layout.GroupLayout.TRAILING, reqParamPanelLayout.createSequentialGroup()
  461. .addContainerGap()
  462. .add(reqParamPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
  463. .add(dbTypeCBox, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
  464. .add(lbl_DBType))
  465. .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
  466. .add(reqParamPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
  467. .add(dbHostTField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
  468. .add(lbl_DBHost)
  469. .add(dbPortTField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
  470. .add(lbl_DBPort))
  471. .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
  472. .add(reqParamPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
  473. .add(dbNameTField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
  474. .add(lbl_DBName))
  475. .add(6, 6, 6)
  476. .add(reqParamPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
  477. .add(dbUserTField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
  478. .add(dbPwdField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
  479. .add(lbl_DBPwd)
  480. .add(lbl_DBUser))
  481. .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
  482. .add(savePassCBox)
  483. .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 15, Short.MAX_VALUE)
  484. .add(reqParamPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
  485. .add(dbDriverPTField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
  486. .add(driverButton)
  487. .add(lbl_PathtoDBdrvr))
  488. .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
  489. .add(reqParamPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
  490. .add(sSpyPathTField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
  491. .add(sSpyPathButton)
  492. .add(lbl_PathSchemSpy))
  493. .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
  494. .add(reqParamPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
  495. .add(propertiePathTField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
  496. .add(propertiePathButton)
  497. .add(lbl_PropertiePath))
  498. .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
  499. .add(reqParamPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
  500. .add(propertiesTField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
  501. .add(lbl_prop))
  502. .add(18, 18, 18)
  503. .add(flagsPanel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
  504. .addContainerGap())
  505. );
  506. jTabbedPane.addTab("Parameters/Flags", reqParamPanel);
  507. outputOptionsPanel.setToolTipText("");
  508. lbl_OutDir.setText("Output directory:"); // NOI18N
  509. pathOutputTField.setToolTipText("Choose the path to your SchemaSpy output dir (-o)");
  510. outDirButton.setText("Choose"); // NOI18N
  511. outDirButton.setToolTipText("Click to choose the path to your SchemaSpy output dir (-o). You can leave this blank. SchemaSpyGUI will generate a path out of your db-name, db-user and db-schema name"); // NOI18N
  512. outDirButton.addActionListener(new java.awt.event.ActionListener() {
  513. public void actionPerformed(java.awt.event.ActionEvent evt) {
  514. outDirButtonActionPerformed(evt);
  515. }
  516. });
  517. allSchemasCBox.setText("All Schemas");
  518. allSchemasCBox.setToolTipText("Evaluate all schemas in a database (-all)");
  519. allSchemasCBox.addChangeListener(new javax.swing.event.ChangeListener() {
  520. public void stateChanged(javax.swing.event.ChangeEvent evt) {
  521. allSchemasCBoxStateChanged(evt);
  522. }
  523. });
  524. schemaTField.setToolTipText("<html>Database schema (optional if the same as user or isn't supported by your database)(-s).<br> Evaluate specified schemas.(-schemas \"s1,s2\")</html>");
  525. lbl_Schema.setText("Schema/s to explore:"); // NOI18N
  526. lbl_Schema.setToolTipText("Schemas coma separated");
  527. lbl_Desc.setText("Description on summary page:"); // NOI18N
  528. descTArea.setColumns(20);
  529. descTArea.setRows(4);
  530. descTArea.setToolTipText("Displays the specified textual description on summary pages (-desc).\nFor example: <a href\\='http://schemaspy.sourceforge.net'>SchemaSpy</a>");
  531. descTAreaScrollPane.setViewportView(descTArea);
  532. lbl_TableRegEx.setText("Table name RegExp:"); // NOI18N
  533. tNameRExTField.setToolTipText("<html>This is a regular expression that's used to determine which tables/views to include (-i).<br> For example: (.*book.*)|(library.*)</html>");
  534. lbl_TableExRegEx.setText("Table Exclusion RegExp:");
  535. tNameExRExTField.setToolTipText("This is a regular expression that's used to determine which tables/views to exclude (-I).");
  536. lbl_ColumnRegEx.setText("Column Exclusion RegExp:"); // NOI18N
  537. cNameRExTField.setToolTipText("<html>Exclude matching columns from relationship analysis to simplify the generated graphs (-x).<br>For example: (book.isbn)|(borrower.address)</html>");
  538. colExRelCBox.setText("Excluded relationships");
  539. colExRelCBox.setToolTipText("<html>Set the columns to exclude from relationship diagrams where<br>the specified columns aren't directly referenced by the focal table. (-X)</html>");
  540. stylePanel.setBorder(javax.swing.BorderFactory.createTitledBorder(" Style: (Modify the .css to specify HTML fonts) "));
  541. stylePanel.setToolTipText("Modify the .css to specify HTML fonts.");
  542. charsetComBox.setEditable(true);
  543. charsetComBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "", "UTF-8", "ISO-8859-1", "ISO-8859-2", "ISO-8859-3", "ISO-8859-4", "ISO-8859-5", "ISO-8859-6", "ISO-8859-7", "ISO-8859-8", "ISO-8859-9", "ISO-8859-10", "ISO-8859-11", "ISO-8859-12", "ISO-8859-13", "ISO-8859-14", "ISO-8859-15" }));
  544. charsetComBox.setToolTipText("Default by SchemaSpy: ISO-8859-1 (-charset)");
  545. lbl_Charset.setText("Charset:");
  546. lbl_Font.setText("Font Name:");
  547. fontNameTField.setToolTipText("Default font: \"Helvetica\" (-font). Use the file font name instead of Real name, ej. times or timesb instead of \"Times New Roman\" or \"Times New Roman Bold\"");
  548. lbl_fontSize.setText("Font size:");
  549. fontSizeTField.setToolTipText("Fontsize default: 11 (-fontsize)");
  550. lbl_css.setText("Style css file:");
  551. cssPathTField.setToolTipText("css file default: schemaSpy.css (-css)");
  552. jButton1.setText("Choose");
  553. jButton1.setToolTipText("Click to choose the path to css file (-css)");
  554. jButton1.addActionListener(new java.awt.event.ActionListener() {
  555. public void actionPerformed(java.awt.event.ActionEvent evt) {
  556. jButton1ActionPerformed(evt);
  557. }
  558. });
  559. org.jdesktop.layout.GroupLayout stylePanelLayout = new org.jdesktop.layout.GroupLayout(stylePanel);
  560. stylePanel.setLayout(stylePanelLayout);
  561. stylePanelLayout.setHorizontalGroup(
  562. stylePanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
  563. .add(stylePanelLayout.createSequentialGroup()
  564. .add(stylePanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
  565. .add(stylePanelLayout.createSequentialGroup()
  566. .add(lbl_Charset)
  567. .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
  568. .add(charsetComBox, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 136, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
  569. .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
  570. .add(lbl_Font)
  571. .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
  572. .add(fontNameTField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 136, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
  573. .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
  574. .add(lbl_fontSize)
  575. .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
  576. .add(fontSizeTField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 39, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
  577. .add(stylePanelLayout.createSequentialGroup()
  578. .add(lbl_css)
  579. .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
  580. .add(cssPathTField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
  581. .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
  582. .add(jButton1)))
  583. .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
  584. );
  585. stylePanelLayout.setVerticalGroup(
  586. stylePanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
  587. .add(stylePanelLayout.createSequentialGroup()
  588. .add(stylePanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
  589. .add(lbl_Charset)
  590. .add(charsetComBox, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
  591. .add(lbl_Font)
  592. .add(fontNameTField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
  593. .add(lbl_fontSize)
  594. .add(fontSizeTField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
  595. .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
  596. .add(stylePanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
  597. .add(lbl_css)
  598. .add(cssPathTField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
  599. .add(jButton1)))
  600. );
  601. metaFilePathButton.setText("Choose"); // NOI18N
  602. metaFilePathButton.setToolTipText("Click to choose the path to your Metafile (-meta). You can leave this blank."); // NOI18N
  603. metaFilePathButton.addActionListener(new java.awt.event.ActionListener() {
  604. public void actionPerformed(java.awt.event.ActionEvent evt) {
  605. metaFilePathButtonActionPerformed(evt);
  606. }
  607. });
  608. metaFilePathTField.setToolTipText("Choose the path to your Metafile (-meta)");
  609. lbl_OutDir1.setText("Metafile Path:"); // NOI18N
  610. org.jdesktop.layout.GroupLayout outputOptionsPanelLayout = new org.jdesktop.layout.GroupLayout(outputOptionsPanel);
  611. outputOptionsPanel.setLayout(outputOptionsPanelLayout);
  612. outputOptionsPanelLayout.setHorizontalGroup(
  613. outputOptionsPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
  614. .add(outputOptionsPanelLayout.createSequentialGroup()
  615. .add(38, 38, 38)
  616. .add(outputOptionsPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
  617. .add(lbl_Desc)
  618. .add(outputOptionsPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
  619. .add(org.jdesktop.layout.GroupLayout.LEADING, descTAreaScrollPane, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 517, Short.MAX_VALUE)
  620. .add(org.jdesktop.layout.GroupLayout.LEADING, outputOptionsPanelLayout.createSequentialGroup()
  621. .add(outputOptionsPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
  622. .add(org.jdesktop.layout.GroupLayout.TRAILING, lbl_ColumnRegEx)
  623. .add(org.jdesktop.layout.GroupLayout.TRAILING, lbl_TableExRegEx)
  624. .add(org.jdesktop.layout.GroupLayout.TRAILING, lbl_TableRegEx))
  625. .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
  626. .add(outputOptionsPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
  627. .add(tNameRExTField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 387, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
  628. .add(tNameExRExTField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 387, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
  629. .add(cNameRExTField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 387, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
  630. .add(colExRelCBox))))
  631. .add(stylePanel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
  632. .add(19, 19, 19))
  633. .add(outputOptionsPanelLayout.createSequentialGroup()
  634. .add(29, 29, 29)
  635. .add(outputOptionsPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
  636. .add(lbl_Schema)
  637. .add(lbl_OutDir)
  638. .add(lbl_OutDir1))
  639. .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
  640. .add(outputOptionsPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
  641. .add(metaFilePathTField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 309, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
  642. .add(schemaTField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 309, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
  643. .add(pathOutputTField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 309, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
  644. .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
  645. .add(outputOptionsPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
  646. .add(metaFilePathButton, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 96, Short.MAX_VALUE)
  647. .add(outDirButton, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 96, Short.MAX_VALUE)
  648. .add(allSchemasCBox, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 96, Short.MAX_VALUE))
  649. .add(28, 28, 28))
  650. );
  651. outputOptionsPanelLayout.setVerticalGroup(
  652. outputOptionsPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
  653. .add(outputOptionsPanelLayout.createSequentialGroup()
  654. .addContainerGap()
  655. .add(outputOptionsPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
  656. .add(pathOutputTField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
  657. .add(lbl_OutDir)
  658. .add(outDirButton))
  659. .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
  660. .add(outputOptionsPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
  661. .add(schemaTField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
  662. .add(lbl_Schema)
  663. .add(allSchemasCBox))
  664. .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
  665. .add(outputOptionsPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
  666. .add(metaFilePathTField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
  667. .add(metaFilePathButton)
  668. .add(lbl_OutDir1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 14, Short.MAX_VALUE))
  669. .add(29, 29, 29)
  670. .add(lbl_Desc)
  671. .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
  672. .add(descTAreaScrollPane, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 118, Short.MAX_VALUE)
  673. .add(18, 18, 18)
  674. .add(outputOptionsPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
  675. .add(lbl_TableRegEx)
  676. .add(tNameRExTField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
  677. .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
  678. .add(outputOptionsPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
  679. .add(lbl_TableExRegEx)
  680. .add(tNameExRExTField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
  681. .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
  682. .add(outputOptionsPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
  683. .add(lbl_ColumnRegEx)
  684. .add(cNameRExTField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
  685. .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
  686. .add(colExRelCBox)
  687. .add(18, 18, 18)
  688. .add(stylePanel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
  689. .addContainerGap())
  690. );
  691. jTabbedPane.addTab("Ouput Options", outputOptionsPanel);
  692. outputPanel.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
  693. sSpyOutTArea.setEditable(false);
  694. sSpyOutTArea.setLineWrap(true);
  695. sSpyOutTArea.setWrapStyleWord(true);
  696. sSpyOutTAreaScrollPane.setViewportView(sSpyOutTArea);
  697. org.jdesktop.layout.GroupLayout outputPanelLayout = new org.jdesktop.layout.GroupLayout(outputPanel);
  698. outputPanel.setLayout(outputPanelLayout);
  699. outputPanelLayout.setHorizontalGroup(
  700. outputPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
  701. .add(outputPanelLayout.createSequentialGroup()
  702. .addContainerGap()
  703. .add(sSpyOutTAreaScrollPane)
  704. .addContainerGap())
  705. );
  706. outputPanelLayout.setVerticalGroup(
  707. outputPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
  708. .add(org.jdesktop.layout.GroupLayout.TRAILING, outputPanelLayout.createSequentialGroup()
  709. .addContainerGap()
  710. .add(sSpyOutTAreaScrollPane, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 452, Short.MAX_VALUE)
  711. .addContainerGap())
  712. );
  713. jTabbedPane.addTab("SchemaSpy Output", outputPanel);
  714. fileMenu.setText("File"); // NOI18N
  715. sParamMenuItem.setText("Save Parameters ..."); // NOI18N
  716. sParamMenuItem.addActionListener(new java.awt.event.ActionListener() {
  717. public void actionPerformed(java.awt.event.ActionEvent evt) {
  718. sParamMenuItemActionPerformed(evt);
  719. }
  720. });
  721. fileMenu.add(sParamMenuItem);
  722. lParamMenuItem.setText("Load Parameters ..."); // NOI18N
  723. lParamMenuItem.addActionListener(new java.awt.event.ActionListener() {
  724. public void actionPerformed(java.awt.event.ActionEvent evt) {
  725. lParamMenuItemActionPerformed(evt);
  726. }
  727. });
  728. fileMenu.add(lParamMenuItem);
  729. exitMenuItem.setText("Exit"); // NOI18N
  730. exitMenuItem.addActionListener(new java.awt.event.ActionListener() {
  731. public void actionPerformed(java.awt.event.ActionEvent evt) {
  732. exitMenuItemActionPerformed(evt);
  733. }
  734. });
  735. fileMenu.add(exitMenuItem);
  736. mainMenuBar.add(fileMenu);
  737. infoMenu.setText("Help"); // NOI18N
  738. helpMenueAboutItem.setText("About"); // NOI18N
  739. helpMenueAboutItem.addActionListener(new java.awt.event.ActionListener() {
  740. public void actionPerformed(java.awt.event.ActionEvent evt) {
  741. helpMenueAboutItemActionPerformed(evt);
  742. }
  743. });
  744. infoMenu.add(helpMenueAboutItem);
  745. mainMenuBar.add(infoMenu);
  746. setJMenuBar(mainMenuBar);
  747. org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
  748. getContentPane().setLayout(layout);
  749. layout.setHorizontalGroup(
  750. layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
  751. .add(jToolBar, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 579, Short.MAX_VALUE)
  752. .add(jTabbedPane, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 579, Short.MAX_VALUE)
  753. );
  754. layout.setVerticalGroup(
  755. layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
  756. .add(layout.createSequentialGroup()
  757. .add(jToolBar, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
  758. .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
  759. .add(jTabbedPane, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 504, Short.MAX_VALUE))
  760. );
  761. pack();
  762. }// </editor-fold>//GEN-END:initComponents
  763. private void sParamMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_sParamMenuItemActionPerformed
  764. operations.saveParam("Menu");
  765. }//GEN-LAST:event_sParamMenuItemActionPerformed
  766. private void lParamMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_lParamMenuItemActionPerformed
  767. operations.loadParam("Menu");
  768. }//GEN-LAST:event_lParamMenuItemActionPerformed
  769. private void exitMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exitMenuItemActionPerformed
  770. operations.systemEnd();
  771. }//GEN-LAST:event_exitMenuItemActionPerformed
  772. private void helpMenueAboutItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_helpMenueAboutItemActionPerformed
  773. operations.showAbout(this);
  774. }//GEN-LAST:event_helpMenueAboutItemActionPerformed
  775. private void quickLoadButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_quickLoadButtonActionPerformed
  776. operations.loadParam("Quick");
  777. }//GEN-LAST:event_quickLoadButtonActionPerformed
  778. private void quickSaveButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_quickSaveButtonActionPerformed
  779. operations.saveParam("Quick");
  780. }//GEN-LAST:event_quickSaveButtonActionPerformed
  781. private void clearFieldsButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_clearFieldsButtonActionPerformed
  782. operations.clearAllFields();
  783. }//GEN-LAST:event_clearFieldsButtonActionPerformed
  784. private void exitButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exitButtonActionPerformed
  785. operations.systemEnd();
  786. }//GEN-LAST:event_exitButtonActionPerformed
  787. private void saveParamFileButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_saveParamFileButtonActionPerformed
  788. operations.saveParam("Menu");
  789. }//GEN-LAST:event_saveParamFileButtonActionPerformed
  790. private void loadParamFileButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_loadParamFileButtonActionPerformed
  791. operations.loadParam("Menu");
  792. }//GEN-LAST:event_loadParamFileButtonActionPerformed
  793. private void driverButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_driverButtonActionPerformed
  794. operations.setPath("driverDirPath");
  795. }//GEN-LAST:event_driverButtonActionPerformed
  796. private void sSpyPathButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_sSpyPathButtonActionPerformed
  797. operations.setPath("sSpyFilePath");
  798. }//GEN-LAST:event_sSpyPathButtonActionPerformed
  799. private void propertiePathButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_propertiePathButtonActionPerformed
  800. operations.setPath("propertiePath");
  801. }//GEN-LAST:event_propertiePathButtonActionPerformed
  802. private void dbTypeCBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_dbTypeCBoxActionPerformed
  803. // nothing TODO here at the moment
  804. }//GEN-LAST:event_dbTypeCBoxActionPerformed
  805. private void outDirButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_outDirButtonActionPerformed
  806. operations.setPath("outDirPath");
  807. }//GEN-LAST:event_outDirButtonActionPerformed
  808. private void allSchemasCBoxStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_allSchemasCBoxStateChanged
  809. if (allSchemasCBox.isSelected())
  810. schemaTField.setEnabled(false);
  811. else schemaTField.setEnabled(true);
  812. }//GEN-LAST:event_allSchemasCBoxStateChanged
  813. private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
  814. operations.setPath("cssPath");
  815. }//GEN-LAST:event_jButton1ActionPerformed
  816. private void startSchemaSpyButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_startSchemaSpyButtonActionPerformed
  817. jTabbedPane.setSelectedIndex(2);
  818. operations.startSchemaSpy(gui);
  819. }//GEN-LAST:event_startSchemaSpyButtonActionPerformed
  820. private void showOutputButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_showOutputButtonActionPerformed
  821. operations.showOutput();
  822. }//GEN-LAST:event_showOutputButtonActionPerformed
  823. private void metaFilePathButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_metaFilePathButtonActionPerformed
  824. operations.setPath("metaFilePath");
  825. }//GEN-LAST:event_metaFilePathButtonActionPerformed
  826. private void setLookandFeel() {
  827. try {
  828. UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
  829. } catch(Exception e) {
  830. e.printStackTrace();
  831. }
  832. }
  833. private void initParams() {
  834. this.gui = this;
  835. params = new Properties();
  836. operations = new Operations();
  837. sSpyPathTField = null;
  838. dbDriverPTField = null;
  839. pathOutputTField = null;
  840. ToolTipManager.sharedInstance().setDismissDelay(12000);
  841. }
  842. public boolean getAutoLaunchInfo() {
  843. boolean info = operations.getAutoLaunch();
  844. return info;
  845. }
  846. public void setOutputText(String outputText) {
  847. operations.setText(outputText);
  848. }
  849. public void startShowOutput() {
  850. operations.showOutput();
  851. }
  852. private SchemaSpyGUIApp gui;
  853. private Operations operations;
  854. private Properties params;
  855. private Build build;
  856. private RunSchemaSpy op;
  857. private Thread t1;
  858. // Variables declaration - do not modify//GEN-BEGIN:variables
  859. private javax.swing.JCheckBox aHTMLCBox;
  860. private javax.swing.JCheckBox allSchemasCBox;
  861. private javax.swing.JTextField cNameRExTField;
  862. private javax.swing.JComboBox charsetComBox;
  863. private javax.swing.JButton clearFieldsButton;
  864. private javax.swing.JCheckBox colExRelCBox;
  865. private javax.swing.JTextField cssPathTField;
  866. private javax.swing.JTextField dbDriverPTField;
  867. private javax.swing.JTextField dbHostTField;
  868. private javax.swing.JTextField dbNameTField;
  869. private javax.swing.JTextField dbPortTField;
  870. private javax.swing.JPasswordField dbPwdField;
  871. private javax.swing.JComboBox dbTypeCBox;
  872. private javax.swing.JTextField dbUserTField;
  873. private javax.swing.JTextArea descTArea;
  874. private javax.swing.JScrollPane descTAreaScrollPane;
  875. private javax.swing.JCheckBox dincFKCBox;
  876. private javax.swing.JButton driverButton;
  877. private javax.swing.JButton exitButton;
  878. private javax.swing.JMenuItem exitMenuItem;
  879. private javax.swing.JMenu fileMenu;
  880. private javax.swing.JPanel flagsPanel;
  881. private javax.swing.JTextField fontNameTField;
  882. private javax.swing.JTextField fontSizeTField;
  883. private javax.swing.JMenuItem helpMenueAboutItem;
  884. private javax.swing.JCheckBox highQuCBox;
  885. private javax.swing.JMenu infoMenu;
  886. private javax.swing.JButton jButton1;
  887. private javax.swing.JToolBar.Separator jSeparator1;
  888. private javax.swing.JToolBar.Separator jSeparator2;
  889. private javax.swing.JTabbedPane jTabbedPane;
  890. private javax.swing.JToolBar jToolBar;
  891. private javax.swing.JMenuItem lParamMenuItem;
  892. private javax.swing.JLabel lbl_Charset;
  893. private javax.swing.JLabel lbl_ColumnRegEx;
  894. private javax.swing.JLabel lbl_DBHost;
  895. private javax.swing.JLabel lbl_DBName;
  896. private javax.swing.JLabel lbl_DBPort;
  897. private javax.swing.JLabel lbl_DBPwd;
  898. private javax.swing.JLabel lbl_DBType;
  899. private javax.swing.JLabel lbl_DBUser;
  900. private javax.swing.JLabel lbl_Desc;
  901. private javax.swing.JLabel lbl_Font;
  902. private javax.swing.JLabel lbl_OutDir;
  903. private javax.swing.JLabel lbl_OutDir1;
  904. private javax.swing.JLabel lbl_PathSchemSpy;
  905. private javax.swing.JLabel lbl_PathtoDBdrvr;
  906. private javax.swing.JLabel lbl_PropertiePath;
  907. private javax.swing.JLabel lbl_Schema;
  908. private javax.swing.JLabel lbl_TableExRegEx;
  909. private javax.swing.JLabel lbl_TableRegEx;
  910. private javax.swing.JLabel lbl_css;
  911. private javax.swing.JLabel lbl_fontSize;
  912. private javax.swing.JLabel lbl_prop;
  913. private javax.swing.JButton loadParamFileButton;
  914. private javax.swing.JCheckBox lowQuCBox;
  915. private javax.swing.JMenuBar mainMenuBar;
  916. private javax.swing.JButton metaFilePathButton;
  917. private javax.swing.JTextField metaFilePathTField;
  918. private javax.swing.JCheckBox noAdsCBox;
  919. private javax.swing.JCheckBox noHTMLCBox;
  920. private javax.swing.JCheckBox noLogoCBox;
  921. private javax.swing.JCheckBox noRowsBox;
  922. private javax.swing.JButton outDirButton;
  923. private javax.swing.JPanel outputOptionsPanel;
  924. private javax.swing.JPanel outputPanel;
  925. private javax.swing.JTextField pathOutputTField;
  926. private javax.swing.JButton propertiePathButton;
  927. private javax.swing.JTextField propertiePathTField;
  928. private javax.swing.JTextField propertiesTField;
  929. private javax.swing.JPanel qualityPanel;
  930. private javax.swing.JButton quickLoadButton;
  931. private javax.swing.JButton quickSaveButton;
  932. private javax.swing.JCheckBox railsCBox;
  933. private javax.swing.JPanel reqParamPanel;
  934. private javax.swing.JMenuItem sParamMenuItem;
  935. private javax.swing.JTextArea sSpyOutTArea;
  936. private javax.swing.JScrollPane sSpyOutTAreaScrollPane;
  937. private javax.swing.JButton sSpyPathButton;
  938. private javax.swing.JTextField sSpyPathTField;
  939. private javax.swing.JButton saveParamFileButton;
  940. private javax.swing.JCheckBox savePassCBox;
  941. private javax.swing.JTextField schemaTField;
  942. private javax.swing.JCheckBox showFinishCBox;
  943. private javax.swing.JButton showOutputButton;
  944. private javax.swing.JCheckBox singleSignCBox;
  945. private javax.swing.JButton startSchemaSpyButton;
  946. private javax.swing.JPanel stylePanel;
  947. private javax.swing.JTextField tNameExRExTField;
  948. private javax.swing.JTextField tNameRExTField;
  949. // End of variables declaration//GEN-END:variables
  950. /*
  951. * Class for Application Functions like saveParam etc.
  952. * */
  953. private class Operations {
  954. public Operations () {
  955. build = new Build();
  956. }
  957. /**
  958. * Starts the schema scanning with SchemaSpy in a separate thread
  959. * @param gui
  960. */
  961. private void startSchemaSpy(SchemaSpyGUIApp gui) {
  962. String run_command;
  963. String displ_command;
  964. sSpyOutTArea.setText("");
  965. if (checkPath()) {
  966. run_command = build.buildCommand("run");
  967. displ_command = build.buildCommand("displ");
  968. op = new RunSchemaSpy(gui, run_command, displ_command);
  969. t1 = new Thread(op);
  970. t1.setName("SSpy");
  971. t1.start();
  972. }
  973. }
  974. /**
  975. * Shows the about box
  976. * @param frame
  977. */
  978. private void showAbout(JFrame frame) {
  979. JDialog aboutBox = new AboutBox(frame);
  980. aboutBox.setVisible(true);
  981. }
  982. /**
  983. * Sets the text in Output Area
  984. * @param text
  985. */
  986. public void setText (String text) {
  987. sSpyOutTArea.append(text);
  988. }
  989. private void setPath (String button) {
  990. String openDialogDefaultPath = ".";
  991. if (button.equals("driverDirPath")) {
  992. if (!dbDriverPTField.getText().equals("")) {
  993. //openDialogDefaultPath = makePathUsable(dbDriverPTField.getText());
  994. openDialogDefaultPath = dbDriverPTField.getText();
  995. }
  996. }
  997. if (button.equals("outDirPath")) {
  998. if (!pathOutputTField.getText().equals("")) {
  999. //openDialogDefaultPath = makePathUsable(pathOutputTField.getText());
  1000. openDialogDefaultPath = pathOutputTField.getText();
  1001. }
  1002. }
  1003. if (button.equals("sSpyFilePath")) {
  1004. if (!sSpyPathTField.getText().equals("")) {
  1005. //openDialogDefaultPath = makePathUsable(sSpyPathTField.getText());
  1006. openDialogDefaultPath = sSpyPathTField.getText();
  1007. }
  1008. }
  1009. if (button.equals("propertiePath")) {
  1010. if (!propertiePathTField.getText().equals("")) {
  1011. //openDialogDefaultPath = makePathUsable(propertiePathTField.getText());
  1012. openDialogDefaultPath = propertiePathTField.getText();
  1013. }
  1014. }
  1015. if (button.equals("cssPath")) {
  1016. if (!cssPathTField.getText().equals("")) {
  1017. //openDialogDefaultPath = makePathUsable(cssPathTField.getText());
  1018. openDialogDefaultPath = cssPathTField.getText();
  1019. }
  1020. }
  1021. if (button.equals("metaFilePath")) {
  1022. if (!metaFilePathTField.getText().equals("")) {
  1023. //openDialogDefaultPath = makePathUsable(cssPathTField.getText());
  1024. openDialogDefaultPath = metaFilePathTField.getText();
  1025. }
  1026. }
  1027. JFileChooser openDialog = new JFileChooser(openDialogDefaultPath);
  1028. if (button.equals("outDirPath")) {
  1029. openDialog.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
  1030. }
  1031. else if (button.equals("cssPath")) {
  1032. openDialog.setFileSelectionMode(JFileChooser.FILES_ONLY);
  1033. openDialog.setFileFilter(getCssFilter());
  1034. }
  1035. else {
  1036. openDialog.setFileSelectionMode(JFileChooser.FILES_ONLY);
  1037. }
  1038. /*
  1039. if (button.equals("driverDirPath")) {
  1040. openDialog.setFileSelectionMode(JFileChooser.FILES_ONLY);
  1041. }
  1042. if (button.equals("sSpyFilePath")) {
  1043. openDialog.setFileSelectionMode(JFileChooser.FILES_ONLY);
  1044. }
  1045. if (button.equals("propertiePath")) {
  1046. openDialog.setFileSelectionMode(JFileChooser.FILES_ONLY);
  1047. }
  1048. */
  1049. openDialog.setDialogType(JFileChooser.OPEN_DIALOG);
  1050. int returnVal = openDialog.showOpenDialog(gui);
  1051. if (returnVal == JFileChooser.APPROVE_OPTION) {
  1052. String path = openDialog.getSelectedFile().getAbsolutePath();
  1053. if (button.equals("driverDirPath")) {
  1054. dbDriverPTField.setText(path);
  1055. }
  1056. if (button.equals("outDirPath")) {
  1057. pathOutputTField.setText(path);
  1058. }
  1059. if (button.equals("sSpyFilePath")) {
  1060. sSpyPathTField.setText(path);
  1061. }
  1062. if (button.equals("propertiePath")) {
  1063. propertiePathTField.setText(path);
  1064. }
  1065. if (button.equals("cssPath")) {
  1066. cssPathTField.setText(path);
  1067. }
  1068. if (button.equals("metaFilePath")) {
  1069. metaFilePathTField.setText(path);
  1070. }
  1071. }
  1072. }
  1073. private String getCBoxString (JCheckBox cBox) {
  1074. if (cBox.isSelected()) {
  1075. return "true";
  1076. } else {
  1077. return "false";
  1078. }
  1079. }
  1080. private FileFilter getXmlFilter() {
  1081. FileFilter ff = new FileFilter() {
  1082. @Override
  1083. public boolean accept(File f) {
  1084. return f.getName().toLowerCase().endsWith(".xml")
  1085. || f.isDirectory();
  1086. }
  1087. @Override
  1088. public String getDescription() {
  1089. return "XML Files";
  1090. }
  1091. };
  1092. return ff;
  1093. }
  1094. private FileFilter getCssFilter() {
  1095. FileFilter ff = new FileFilter() {
  1096. @Override
  1097. public boolean accept(File f) {
  1098. return f.getName().toLowerCase().endsWith(".css")
  1099. || f.isDirectory();
  1100. }
  1101. @Override
  1102. public String getDescription() {
  1103. return "CSS Files";
  1104. }
  1105. };
  1106. return ff;
  1107. }
  1108. private void saveParam(String option) {
  1109. params.setProperty("dbTypeCBox", (String)dbTypeCBox.getSelectedItem());
  1110. params.setProperty("dbHostTField", dbHostTField.getText());
  1111. params.setProperty("dbNameTField", dbNameTField.getText());
  1112. params.setProperty("dbPortTField", dbPortTField.getText());
  1113. params.setProperty("dbUserTField", dbUserTField.getText());
  1114. // Save password
  1115. if (savePassCBox.isSelected()){
  1116. params.setProperty("dbPwdField", String.valueOf(dbPwdField.getPassword()));
  1117. }
  1118. else params.setProperty("dbPwdField", "");
  1119. params.setProperty("dbDriverPTField", dbDriverPTField.getText());
  1120. params.setProperty("pathOutputTField", pathOutputTField.getText());
  1121. params.setProperty("sSpyPathTField", sSpyPathTField.getText());
  1122. params.setProperty("propertiePathTField", propertiePathTField.getText());
  1123. params.setProperty("propertiesTField", propertiesTField.getText());
  1124. params.setProperty("metaFilePathTField", metaFilePathTField.getText());
  1125. params.setProperty("schemaTField", schemaTField.getText());
  1126. params.setProperty("allSchemasCBox", getCBoxString(allSchemasCBox));
  1127. params.setProperty("descTArea", descTArea.getText().replace("\"", "'"));
  1128. params.setProperty("tNameRExTField", tNameRExTField.getText());
  1129. params.setProperty("tNameExRExTField", tNameExRExTField.getText());
  1130. params.setProperty("cNameRExTField", cNameRExTField.getText());
  1131. params.setProperty("colExRelCBox", getCBoxString(colExRelCBox));
  1132. params.setProperty("charsetComBox", (String)charsetComBox.getSelectedItem());
  1133. params.setProperty("fontSizeTField", fontSizeTField.getText());
  1134. params.setProperty("fontNameTField", fontNameTField.getText());
  1135. params.setProperty("cssPathTField", cssPathTField.getText());
  1136. params.setProperty("aHTMLCBox", getCBoxString(aHTMLCBox));
  1137. params.setProperty("noRowsBox", getCBoxString(noRowsBox));
  1138. params.setProperty("dincFKCBox", getCBoxString(dincFKCBox));
  1139. params.setProperty("noHTMLCBox", getCBoxString(noHTMLCBox));
  1140. params.setProperty("railsCBox", getCBoxString(railsCBox));
  1141. // TODO: Single Sign-On (-sso).
  1142. //params.setProperty("singleSignCBox", getCBoxString(singleSignCBox));
  1143. // Quality Images
  1144. params.setProperty("highQuCBox", getCBoxString(highQuCBox));
  1145. params.setProperty("lowQuCBox", getCBoxString(lowQuCBox));
  1146. //----------
  1147. params.setProperty("noAdsCBox", getCBoxString(noAdsCBox));
  1148. params.setProperty("noLogoCBox", getCBoxString(noLogoCBox));
  1149. params.setProperty("savePassCBox", getCBoxString(savePassCBox));
  1150. params.setProperty("showFinishCBox", getCBoxString(showFinishCBox));
  1151. String name = "", coment = "";
  1152. if (option.equals("Quick")) {
  1153. name = "SSpyGUIQuick.xml";
  1154. coment = "Saved parameters for SchemaSpyGUI. Load it with: Quick Load Parameters";
  1155. }
  1156. // Save JFileChooser
  1157. else if (option.equals("Menu")) {
  1158. JFileChooser saveDialog = new JFileChooser(".");
  1159. saveDialog.setFileSelectionMode(JFileChooser.FILES_ONLY);
  1160. saveDialog.setDialogType(JFileChooser.SAVE_DIALOG);
  1161. saveDialog.setDialogTitle("Save Parameters ...");
  1162. saveDialog.setFileFilter(getXmlFilter());
  1163. int returnVal = saveDialog.showOpenDialog(gui);
  1164. if (returnVal == JFileChooser.APPROVE_OPTION) {
  1165. name = saveDialog.getSelectedFile().getAbsolutePath();
  1166. coment = "Saved parameters for SchemaSpyGUI. Load it with Load Menu";
  1167. }
  1168. }
  1169. if (!name.equals("")) {
  1170. // Add xml extension
  1171. if (!name.endsWith(".xml"))
  1172. name += ".xml";
  1173. try {
  1174. FileOutputStream fos = new FileOutputStream(name);
  1175. params.storeToXML(fos, coment);
  1176. fos.close();
  1177. } catch (IOException ioe) {
  1178. ioe.printStackTrace();
  1179. }
  1180. }
  1181. }
  1182. private void loadParam(String option) {
  1183. String name = "";
  1184. if (option.equals("Quick")) {
  1185. name = "SSpyGUIQuick.xml";
  1186. }
  1187. else if (option.equals("Menu")) {
  1188. JFileChooser openDialog = new JFileChooser(".");
  1189. openDialog.setFileSelectionMode(JFileChooser.FILES_ONLY);
  1190. openDialog.setDialogType(JFileChooser.OPEN_DIALOG);
  1191. openDialog.setDialogTitle("Load Parameters ...");
  1192. openDialog.setFileFilter(getXmlFilter());
  1193. int returnVal = openDialog.showOpenDialog(gui);
  1194. if (returnVal == JFileChooser.APPROVE_OPTION) {
  1195. name = openDialog.getSelectedFile().getAbsolutePath();
  1196. }
  1197. }
  1198. File file = new File(name);
  1199. if (file.exists()) {
  1200. try {
  1201. FileInputStream in = new FileInputStream(file);
  1202. params.loadFromXML(in);
  1203. in.close();
  1204. clearAllFields();
  1205. insertInFields();
  1206. } catch (IOException ioe) {
  1207. ioe.printStackTrace();
  1208. }
  1209. }
  1210. }
  1211. private void insertInFields () {
  1212. dbTypeCBox.setSelectedItem(params.getProperty("dbTypeCBox"));
  1213. dbHostTField.setText(params.getProperty("dbHostTField"));
  1214. dbNameTField.setText(params.getProperty("dbNameTField"));
  1215. dbPortTField.setText(params.getProperty("dbPortTField"));
  1216. dbUserTField.setText(params.getProperty("dbUserTField"));
  1217. // Load Password
  1218. dbPwdField.setText(params.getProperty("dbPwdField"));
  1219. dbDriverPTField.setText(params.getProperty("dbDriverPTField"));
  1220. pathOutputTField.setText(params.getProperty("pathOutputTField"));
  1221. sSpyPathTField.setText(params.getProperty("sSpyPathTField"));
  1222. propertiePathTField.setText(params.getProperty("propertiePathTField"));
  1223. propertiesTField.setText(params.getProperty("propertiesTField"));
  1224. metaFilePathTField.setText(params.getProperty("metaFilePathTField"));
  1225. schemaTField.setText(params.getProperty("schemaTField"));
  1226. if (params.getProperty("allSchemasCBox").equals("true")) {allSchemasCBox.setSelected(true);}
  1227. descTArea.setText(params.getProperty("descTArea"));
  1228. tNameRExTField.setText(params.getProperty("tNameRExTField"));
  1229. tNameExRExTField.setText(params.getProperty("tNameExRExTField"));
  1230. cNameRExTField.setText(params.getProperty("cNameRExTField"));
  1231. if (params.getProperty("colExRelCBox").equals("true")) {colExRelCBox.setSelected(true);}
  1232. charsetComBox.setSelectedItem(params.getProperty("charsetComBox"));
  1233. fontSizeTField.setText(params.getProperty("fontSizeTField"));
  1234. fontNameTField.setText(params.getProperty("fontNameTField"));
  1235. cssPathTField.setText(params.getProperty("cssPathTField"));
  1236. if (params.getProperty("aHTMLCBox").equals("true")) {aHTMLCBox.setSelected(true);}
  1237. if (params.getProperty("noRowsBox").equals("true")) {noRowsBox.setSelected(true);}
  1238. if (params.getProperty("dincFKCBox").equals("true")) {dincFKCBox.setSelected(true);}
  1239. if (params.getProperty("noHTMLCBox").equals("true")) {noHTMLCBox.setSelected(true);}
  1240. if (params.getProperty("railsCBox").equals("true")) {railsCBox.setSelected(true);}
  1241. // TODO: Single Sign-On (-sso).
  1242. //if (params.getProperty("singleSignCBox").equals("true")) {singleSignCBox.setSelected(true);}
  1243. // Quality Images
  1244. if (params.getProperty("highQuCBox").equals("true")) {highQuCBox.setSelected(true);}
  1245. if (params.getProperty("lowQuCBox").equals("true")) {lowQuCBox.setSelected(true);}
  1246. //---------
  1247. if (params.getProperty("noAdsCBox").equals("true")) {noAdsCBox.setSelected(true);}
  1248. if (params.getProperty("noLogoCBox").equals("true")) {noLogoCBox.setSelected(true);}
  1249. if (params.getProperty("savePassCBox").equals("true")) {savePassCBox.setSelected(true);}
  1250. if (params.getProperty("showFinishCBox").equals("true")) {showFinishCBox.setSelected(true);}
  1251. }
  1252. private void clearAllFields() {
  1253. dbTypeCBox.setSelectedItem("");
  1254. dbHostTField.setText("");
  1255. dbNameTField.setText("");
  1256. dbPortTField.setText("");
  1257. dbUserTField.setText("");
  1258. // Password
  1259. dbPwdField.setText("");
  1260. dbDriverPTField.setText("");
  1261. pathOutputTField.setText("");
  1262. sSpyPathTField.setText("");
  1263. propertiePathTField.setText("");
  1264. propertiesTField.setText("");
  1265. metaFilePathTField.setText("");
  1266. schemaTField.setText("");
  1267. allSchemasCBox.setSelected(false);
  1268. descTArea.setText("");
  1269. tNameRExTField.setText("");
  1270. tNameExRExTField.setText("");
  1271. cNameRExTField.setText("");
  1272. colExRelCBox.setSelected(false);
  1273. charsetComBox.setSelectedIndex(0);
  1274. fontSizeTField.setText("");
  1275. fontNameTField.setText("");
  1276. cssPathTField.setText("");
  1277. aHTMLCBox.setSelected(false);
  1278. noRowsBox.setSelected(false);
  1279. dincFKCBox.setSelected(false);
  1280. noHTMLCBox.setSelected(false);
  1281. railsCBox.setSelected(false);
  1282. // TODO: Single Sign-On (-sso).
  1283. //singleSignCBox.setSelected(false);
  1284. // Quality Images
  1285. highQuCBox.setSelected(false);
  1286. lowQuCBox.setSelected(false);
  1287. //--------------------------
  1288. noAdsCBox.setSelected(false);
  1289. noLogoCBox.setSelected(false);
  1290. savePassCBox.setSelected(false);
  1291. showFinishCBox.setSelected(false);
  1292. }
  1293. private String makePathUsable(String s) {
  1294. //s.replace("\\","\\\\"); // This don't work is: s = s.replace("\\","\\\\");
  1295. // Add " for directories and files with spaces
  1296. //Bug: Linux doesn't work with "s"
  1297. //Error: Unable to access jarfile
  1298. //simple hack but no support for directories with
  1299. //spaces currently under Linux
  1300. if (isWindows()) {s = "\"" + s + "\"";}
  1301. else{}
  1302. return s;
  1303. }
  1304. //TODO: copy from isWindows() of BrowserOutputStart ... pooling?
  1305. public boolean isWindows() {
  1306. String os = System.getProperty("os.name");
  1307. if ( os != null && os.startsWith("Windows")) {
  1308. return true;
  1309. } else {
  1310. return false;
  1311. }
  1312. }
  1313. private boolean checkPath() {
  1314. boolean bool = false;
  1315. File sSpyPath = new File(sSpyPathTField.getText());
  1316. File dbDriverPath = new File(dbDriverPTField.getText());
  1317. File outDirPath = new File(pathOutputTField.getText());
  1318. if (sSpyPath.exists()) {
  1319. bool = true;
  1320. } else {
  1321. setText("This is not a valid path to SchemaSpy: " + sSpyPathTField.getText()+ "\n");
  1322. if (!sSpyPath.canRead()) {
  1323. setText("Jar File ist not readable!\n");
  1324. }
  1325. }
  1326. if (dbDriverPTField.getText().equals("")) {
  1327. setText("You have not specified a driver path. SchemaSpy will try to \n" +
  1328. "use the path in internal .properties file.\n" +
  1329. "It's possible that these will not work. In this case, please specify a path.\n");
  1330. } else {
  1331. if (!dbDriverPath.exists() || !dbDriverPath.canRead()) {
  1332. if (bool) {bool = false;}
  1333. setText("This is not a valid path to the DB driver: " + dbDriverPTField.getText() + "\n");
  1334. if (!dbDriverPath.canRead()) {
  1335. setText("File ist not readable!\n");
  1336. }
  1337. }
  1338. }
  1339. // SchemaSpy Creates a directory if not exist
  1340. if (!pathOutputTField.getText().equals("") && !outDirPath.exists()) { // && !outDirPath.canWrite()) {
  1341. //if (bool){bool = false;}
  1342. setText("This is not a valid path for the output directory, but SchemaSpy will create it: " + pathOutputTField.getText() + "\n");
  1343. if (!sSpyPath.canWrite()) {
  1344. if (bool){bool = false;}
  1345. setText("SchemaSpy can not write!\n");
  1346. }
  1347. }
  1348. return bool;
  1349. }
  1350. private String buildOutputDir () {
  1351. String dirName = dbUserTField.getText() + "_" + dbNameTField.getText()
  1352. + "_" + schemaTField.getText().replace(",", "-");
  1353. File dir = new File(dirName);
  1354. if(!dir.exists()) {
  1355. dir.mkdir();
  1356. }
  1357. String dirPath = dir.getAbsolutePath();
  1358. pathOutputTField.setText(dirPath);
  1359. return dirPath;
  1360. }
  1361. public void showOutput() {
  1362. if (!pathOutputTField.getText().equals("")) {
  1363. String url = pathOutputTField.getText() + File.separator + "index.html";
  1364. BrowserOutputStart show = new BrowserOutputStart(url);
  1365. show.launch();
  1366. }
  1367. }
  1368. /**
  1369. * Try are the Threads launched by the program are alive
  1370. * @return Alive
  1371. */
  1372. private boolean isThreadAlive() {
  1373. Boolean tAlive = false;
  1374. if (t1 != null) {
  1375. // Search into alive threads the SchemaSpy threads.
  1376. Set<Thread> set = Thread.getAllStackTraces().keySet();
  1377. for (Thread at : set) {
  1378. if (at.getName().equals("SSpy")||
  1379. at.getName().equals("terrOut") ||
  1380. at.getName().equals("tinOut")) {
  1381. if (at.isAlive()) {
  1382. tAlive = true;
  1383. }
  1384. }
  1385. }
  1386. }
  1387. return tAlive;
  1388. }
  1389. public boolean getAutoLaunch() {
  1390. if (showFinishCBox.isSelected())
  1391. return true;
  1392. else return false;
  1393. }
  1394. private void systemEnd() {
  1395. // If some alive show Warning message
  1396. if (isThreadAlive()) {
  1397. int returnVal = JOptionPane.showConfirmDialog(gui,
  1398. "SchemaSpy is Running.\n" +
  1399. "Closing SchemaSpyGUI do NOT finalize the SchemaSpy prosses.\n" +
  1400. "Do you really want close SchemaSpyGUI?\n",
  1401. "Exit SchemaSpyGUI",
  1402. JOptionPane.WARNING_MESSAGE,
  1403. JOptionPane.YES_NO_OPTION);
  1404. if (returnVal == JOptionPane.YES_OPTION) {
  1405. System.exit(0);
  1406. } // else do nothing
  1407. }
  1408. // No threads alive
  1409. else {
  1410. System.exit(0);
  1411. }
  1412. }
  1413. }
  1414. /**
  1415. * Inner Class with Methods to build the command line for SchemaSpy
  1416. */
  1417. private class Build {
  1418. /**
  1419. * Build the commad line to launch SchemaSpy
  1420. * @param type "displ" returns the Command line without password
  1421. * @return Command line string for SchemaSpy
  1422. */
  1423. private String buildCommand (String type) {
  1424. //first the path to SchemaSpy.jar
  1425. String s = "java -jar " + operations.makePathUsable(sSpyPathTField.getText());
  1426. //second the path to the driver for the selected DB type
  1427. if (!dbDriverPTField.getText().equals("")) {
  1428. s = s + " -dp " + operations.makePathUsable(dbDriverPTField.getText());
  1429. }
  1430. //then the needed database type
  1431. if (!((String)dbTypeCBox.getSelectedItem()).equals("")) {
  1432. s = s + " -t " + (String)dbTypeCBox.getSelectedItem();
  1433. }
  1434. //and now the necessary database specific informations
  1435. //e.g. database name, schema, user, host etc.
  1436. if (!dbNameTField.getText().equals("")) {
  1437. s = s + " -db " + dbNameTField.getText();
  1438. }
  1439. // Select schemas
  1440. if (allSchemasCBox.isSelected()) {
  1441. s = s + " -all ";
  1442. } else if (!schemaTField.getText().equals("")) {
  1443. // Try remove space before coma
  1444. String sc = schemaTField.getText().replace(", ", ",");
  1445. String[] schemas = sc.split(",");
  1446. if (schemas.length == 1) {
  1447. s = s + " -s " + sc;
  1448. } else {
  1449. s = s + " -schemas \"" + sc + "\"";
  1450. }
  1451. }
  1452. if (!dbHostTField.getText().equals("")) {
  1453. s = s + " -host " + dbHostTField.getText();
  1454. }
  1455. if (!dbPortTField.getText().equals("")) {
  1456. s = s + " -port " + dbPortTField.getText();
  1457. }
  1458. // TODO: Single Sign-On (-sso).
  1459. if (!dbUserTField.getText().equals("")) {
  1460. s = s + " -u " + dbUserTField.getText();
  1461. }
  1462. //now the optional informations like RegEx for columns, tables, etc
  1463. // Properties database connection
  1464. if (!propertiePathTField.getText().equals("")) {
  1465. s = s + " -connprops " + operations.makePathUsable(propertiePathTField.getText());
  1466. }
  1467. if (!propertiesTField.getText().equals("")) {
  1468. s = s + " -connprops " + "\"" + propertiesTField.getText() + "\"";
  1469. }
  1470. if (!metaFilePathTField.getText().equals("")) {
  1471. s = s + " -meta " + operations.makePathUsable(metaFilePathTField.getText());
  1472. }
  1473. // Columns Exclusions
  1474. if (!cNameRExTField.getText().equals("")) {
  1475. if (colExRelCBox.isSelected()) {
  1476. s = s + " -X " + operations.makePathUsable(cNameRExTField.getText());
  1477. } else {
  1478. s = s + " -x " + operations.makePathUsable(cNameRExTField.getText());
  1479. }
  1480. }
  1481. // Tables inclusions
  1482. if (!tNameRExTField.getText().equals("")) {
  1483. s = s + " -i " + operations.makePathUsable(tNameRExTField.getText());
  1484. }
  1485. // Tables Exclusions
  1486. if (!tNameExRExTField.getText().equals("")) {
  1487. s = s + " -I " + "\"" + tNameExRExTField.getText() + "\"";
  1488. }
  1489. if (!((String)charsetComBox.getSelectedItem()).equals("")) {
  1490. s = s + " -charset " + (String)charsetComBox.getSelectedItem();
  1491. }
  1492. if (!(fontSizeTField.getText().equals(""))) {
  1493. s = s + " -fontsize " + fontSizeTField.getText();
  1494. }
  1495. if (!(fontNameTField.getText().equals(""))) {
  1496. s = s + " -font " + "\"" + fontNameTField.getText() + "\"";
  1497. }
  1498. if (!(cssPathTField.getText().equals(""))) {
  1499. s = s + " -css " + operations.makePathUsable(cssPathTField.getText());
  1500. }
  1501. if (!descTArea.getText().equals("")) {
  1502. // For if someone put " instead of '
  1503. s = s + " -desc " + operations.makePathUsable(descTArea.getText().replace("\"", "'"));
  1504. }
  1505. if (!pathOutputTField.getText().equals("")) {
  1506. s = s + " -o " + operations.makePathUsable(pathOutputTField.getText());
  1507. } else {
  1508. s = s + " -o " + operations.makePathUsable(operations.buildOutputDir());
  1509. }
  1510. //now we insert the flags (e.g. Allow HTML in comments) if there are
  1511. //some checked
  1512. if (aHTMLCBox.isSelected()) {
  1513. s = s + " -ahic ";
  1514. }
  1515. if (noRowsBox.isSelected()) {
  1516. s = s + " -norows ";
  1517. }
  1518. if (dincFKCBox.isSelected()) {
  1519. s = s + " -noimplied ";
  1520. }
  1521. if (noHTMLCBox.isSelected()) {
  1522. s = s + " -nohtml ";
  1523. }
  1524. if (railsCBox.isSelected()) {
  1525. s = s + " -rails ";
  1526. }
  1527. if (highQuCBox.isSelected()) {
  1528. s = s + " -hq ";
  1529. }
  1530. if (lowQuCBox.isSelected()) {
  1531. s = s + " -lq ";
  1532. }
  1533. //---------------------------
  1534. if (noAdsCBox.isSelected()) {
  1535. s = s + " -noads ";
  1536. }
  1537. if (noLogoCBox.isSelected()) {
  1538. s = s + " -nologo ";
  1539. }
  1540. //last but not least String with no password if "displ" is selected
  1541. //else String + PWD for starting SchemaSpy
  1542. if (type.equals("displ")) {
  1543. return s;
  1544. } else {
  1545. if (!String.valueOf(dbPwdField.getPassword()).equals("")) {
  1546. s = s + " -p " + String.valueOf(dbPwdField.getPassword());
  1547. }
  1548. return s;
  1549. }
  1550. }
  1551. }
  1552. }