/*
* SchemaSpyGUIApp.java
*
* Created on 07.01.2009, 22:21:15
*/
package schemaspygui;
import java.io.File;
import java.io.FileOutputStream;
import java.io.FileInputStream;
import java.io.IOException;
import javax.swing.*;
import javax.swing.UIManager;
import javax.swing.filechooser.FileFilter;
import java.util.Set;
import java.util.Properties;
/**
*
* @author Joachim Uhl
*/
public class SchemaSpyGUIApp extends javax.swing.JFrame {
/** Creates new form SchemaSpyGUIApp */
public SchemaSpyGUIApp() {
setLookandFeel();
initParams();
initComponents();
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// //GEN-BEGIN:initComponents
private void initComponents() {
jToolBar = new javax.swing.JToolBar();
exitButton = new javax.swing.JButton();
quickSaveButton = new javax.swing.JButton();
quickLoadButton = new javax.swing.JButton();
jSeparator2 = new javax.swing.JToolBar.Separator();
saveParamFileButton = new javax.swing.JButton();
loadParamFileButton = new javax.swing.JButton();
clearFieldsButton = new javax.swing.JButton();
jSeparator1 = new javax.swing.JToolBar.Separator();
startSchemaSpyButton = new javax.swing.JButton();
showOutputButton = new javax.swing.JButton();
jTabbedPane = new javax.swing.JTabbedPane();
reqParamPanel = new javax.swing.JPanel();
lbl_DBType = new javax.swing.JLabel();
dbTypeCBox = new javax.swing.JComboBox();
lbl_PathtoDBdrvr = new javax.swing.JLabel();
lbl_DBName = new javax.swing.JLabel();
lbl_DBHost = new javax.swing.JLabel();
lbl_DBPort = new javax.swing.JLabel();
lbl_DBUser = new javax.swing.JLabel();
lbl_DBPwd = new javax.swing.JLabel();
lbl_PathSchemSpy = new javax.swing.JLabel();
dbPwdField = new javax.swing.JPasswordField();
dbUserTField = new javax.swing.JTextField();
dbNameTField = new javax.swing.JTextField();
dbHostTField = new javax.swing.JTextField();
dbPortTField = new javax.swing.JTextField();
dbDriverPTField = new javax.swing.JTextField();
driverButton = new javax.swing.JButton();
sSpyPathTField = new javax.swing.JTextField();
sSpyPathButton = new javax.swing.JButton();
lbl_PropertiePath = new javax.swing.JLabel();
propertiePathTField = new javax.swing.JTextField();
propertiePathButton = new javax.swing.JButton();
propertiesTField = new javax.swing.JTextField();
lbl_prop = new javax.swing.JLabel();
flagsPanel = new javax.swing.JPanel();
aHTMLCBox = new javax.swing.JCheckBox();
noHTMLCBox = new javax.swing.JCheckBox();
dincFKCBox = new javax.swing.JCheckBox();
noAdsCBox = new javax.swing.JCheckBox();
noLogoCBox = new javax.swing.JCheckBox();
noRowsBox = new javax.swing.JCheckBox();
railsCBox = new javax.swing.JCheckBox();
qualityPanel = new javax.swing.JPanel();
highQuCBox = new javax.swing.JCheckBox();
lowQuCBox = new javax.swing.JCheckBox();
singleSignCBox = new javax.swing.JCheckBox();
showFinishCBox = new javax.swing.JCheckBox();
savePassCBox = new javax.swing.JCheckBox();
outputOptionsPanel = new javax.swing.JPanel();
lbl_OutDir = new javax.swing.JLabel();
pathOutputTField = new javax.swing.JTextField();
outDirButton = new javax.swing.JButton();
allSchemasCBox = new javax.swing.JCheckBox();
schemaTField = new javax.swing.JTextField();
lbl_Schema = new javax.swing.JLabel();
lbl_Desc = new javax.swing.JLabel();
descTAreaScrollPane = new javax.swing.JScrollPane();
descTArea = new javax.swing.JTextArea();
lbl_TableRegEx = new javax.swing.JLabel();
tNameRExTField = new javax.swing.JTextField();
lbl_TableExRegEx = new javax.swing.JLabel();
tNameExRExTField = new javax.swing.JTextField();
lbl_ColumnRegEx = new javax.swing.JLabel();
cNameRExTField = new javax.swing.JTextField();
colExRelCBox = new javax.swing.JCheckBox();
stylePanel = new javax.swing.JPanel();
charsetComBox = new javax.swing.JComboBox();
lbl_Charset = new javax.swing.JLabel();
lbl_Font = new javax.swing.JLabel();
fontNameTField = new javax.swing.JTextField();
lbl_fontSize = new javax.swing.JLabel();
fontSizeTField = new javax.swing.JTextField();
lbl_css = new javax.swing.JLabel();
cssPathTField = new javax.swing.JTextField();
jButton1 = new javax.swing.JButton();
metaFilePathButton = new javax.swing.JButton();
metaFilePathTField = new javax.swing.JTextField();
lbl_OutDir1 = new javax.swing.JLabel();
outputPanel = new javax.swing.JPanel();
sSpyOutTAreaScrollPane = new javax.swing.JScrollPane();
sSpyOutTArea = new javax.swing.JTextArea();
mainMenuBar = new javax.swing.JMenuBar();
fileMenu = new javax.swing.JMenu();
sParamMenuItem = new javax.swing.JMenuItem();
lParamMenuItem = new javax.swing.JMenuItem();
exitMenuItem = new javax.swing.JMenuItem();
infoMenu = new javax.swing.JMenu();
helpMenueAboutItem = new javax.swing.JMenuItem();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("schemaspygui/resources/ReleaseText"); // NOI18N
setTitle(bundle.getString("ProgramName")); // NOI18N
setName("SchemaSpyGUIAppMainFrame"); // NOI18N
jToolBar.setRollover(true);
exitButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/schemaspygui/resources/door_out.png"))); // NOI18N
exitButton.setText("Exit");
exitButton.setFocusable(false);
exitButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
exitButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
exitButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
exitButtonActionPerformed(evt);
}
});
jToolBar.add(exitButton);
quickSaveButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/schemaspygui/resources/disk.png"))); // NOI18N
quickSaveButton.setText("Quick Save");
quickSaveButton.setToolTipText("Saves your settings in a default xml file");
quickSaveButton.setFocusable(false);
quickSaveButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
quickSaveButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
quickSaveButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
quickSaveButtonActionPerformed(evt);
}
});
jToolBar.add(quickSaveButton);
quickLoadButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/schemaspygui/resources/folder_page_white.png"))); // NOI18N
quickLoadButton.setText("Quick Load");
quickLoadButton.setToolTipText("Loads your settings out of the default xml file");
quickLoadButton.setFocusable(false);
quickLoadButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
quickLoadButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
quickLoadButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
quickLoadButtonActionPerformed(evt);
}
});
jToolBar.add(quickLoadButton);
jToolBar.add(jSeparator2);
saveParamFileButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/schemaspygui/resources/disk_multiple.png"))); // NOI18N
saveParamFileButton.setText("Save File");
saveParamFileButton.setToolTipText("Save your settings with a filename (xml format) you can choose");
saveParamFileButton.setFocusable(false);
saveParamFileButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
saveParamFileButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
saveParamFileButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
saveParamFileButtonActionPerformed(evt);
}
});
jToolBar.add(saveParamFileButton);
loadParamFileButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/schemaspygui/resources/folder_explore.png"))); // NOI18N
loadParamFileButton.setText("Load File");
loadParamFileButton.setToolTipText("Load your settings.
Choose freely which xml config file you need");
loadParamFileButton.setFocusable(false);
loadParamFileButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
loadParamFileButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
loadParamFileButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
loadParamFileButtonActionPerformed(evt);
}
});
jToolBar.add(loadParamFileButton);
clearFieldsButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/schemaspygui/resources/cross.png"))); // NOI18N
clearFieldsButton.setText("Clear Fields");
clearFieldsButton.setFocusable(false);
clearFieldsButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
clearFieldsButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
clearFieldsButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
clearFieldsButtonActionPerformed(evt);
}
});
jToolBar.add(clearFieldsButton);
jToolBar.add(jSeparator1);
startSchemaSpyButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/schemaspygui/resources/database_connect.png"))); // NOI18N
startSchemaSpyButton.setText("Start SchemaSpy");
startSchemaSpyButton.setFocusable(false);
startSchemaSpyButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
startSchemaSpyButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
startSchemaSpyButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
startSchemaSpyButtonActionPerformed(evt);
}
});
jToolBar.add(startSchemaSpyButton);
showOutputButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/schemaspygui/resources/database_go.png"))); // NOI18N
showOutputButton.setText("Show Output");
showOutputButton.setFocusable(false);
showOutputButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
showOutputButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
showOutputButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
showOutputButtonActionPerformed(evt);
}
});
jToolBar.add(showOutputButton);
jTabbedPane.setToolTipText("");
reqParamPanel.setToolTipText("");
lbl_DBType.setFont(lbl_DBType.getFont());
lbl_DBType.setText("DB Type:"); // NOI18N
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" }));
dbTypeCBox.setToolTipText("Choose your type of database (-t)");
dbTypeCBox.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
dbTypeCBoxActionPerformed(evt);
}
});
lbl_PathtoDBdrvr.setText("Path to DB driver:"); // NOI18N
lbl_DBName.setText("DB name:"); // NOI18N
lbl_DBHost.setText("DB Host:"); // NOI18N
lbl_DBPort.setText("DB Port:"); // NOI18N
lbl_DBUser.setText("DB User:"); // NOI18N
lbl_DBPwd.setText("Password:"); // NOI18N
lbl_PathSchemSpy.setText("Path to SchemaSpy:"); // NOI18N
dbPwdField.setToolTipText("Enter the User Password (-p)
It's not displayed in the SchemaSpy Output,
but be careful with the \"Save User Password\" option.
Currently the PWD is stored in clear text.\n");
dbUserTField.setToolTipText("Enter the User name (-u)");
dbNameTField.setToolTipText("Enter the Database Name to connect to (-db)");
dbHostTField.setToolTipText("Enter your DB Host (-host)");
dbPortTField.setToolTipText("Enter the port for the DB (-port)");
dbDriverPTField.setToolTipText("The path to your DB driver");
driverButton.setText("Choose"); // NOI18N
driverButton.setToolTipText("Click to choose the path to database driver file (-dp)"); // NOI18N
driverButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
driverButtonActionPerformed(evt);
}
});
sSpyPathTField.setToolTipText("The path to the schemaSpy.jar file (executable)");
sSpyPathButton.setText("Choose"); // NOI18N
sSpyPathButton.setToolTipText("Click to choose the path to SchemaSpy"); // NOI18N
sSpyPathButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
sSpyPathButtonActionPerformed(evt);
}
});
lbl_PropertiePath.setText("Path propertie file:"); // NOI18N
propertiePathTField.setToolTipText("Specifies additional properties to be used when connecting to the database.
Specify a .properties file with key=value entries.
\nHave a look at the .propertie Files in the subdirectory /properties in your SchemaSpyGUI folder.");
propertiePathButton.setText("Choose"); // NOI18N
propertiePathButton.setToolTipText("Click to choose the path to your database specific propertie file"); // NOI18N
propertiePathButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
propertiePathButtonActionPerformed(evt);
}
});
propertiesTField.setToolTipText("Specify the entries directly, escaping the ='s with \\= and separating each key\\=value pair with a ;.");
lbl_prop.setText("Properties directly:");
flagsPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(" Flags "));
aHTMLCBox.setText("Allow HTML in comments"); // NOI18N
aHTMLCBox.setToolTipText("Any HTML embedded in comments normally gets encoded so that it's rendered as text.
This option allows it to be rendered as HTML. (-ahic)");
noHTMLCBox.setText("No HTML"); // NOI18N
noHTMLCBox.setToolTipText("Only generate files needed for insertion/deletion of data (e.g. for scripts)
and an XML representation of the schema. (-nohtml)");
dincFKCBox.setText("Don't include foreign key"); // NOI18N
dincFKCBox.setToolTipText("Don't include implied foreign key relationships. (-noimplied)");
noAdsCBox.setText("No Ads");
noAdsCBox.setToolTipText("Don't show ads (-noads)");
noAdsCBox.setEnabled(false);
noLogoCBox.setText("No Logo");
noLogoCBox.setToolTipText("Don't show Sourceforge.net image logo. (-nologo)");
noRowsBox.setText("Don't query or display row counts");
noRowsBox.setToolTipText("(-norows)");
railsCBox.setText("Ruby on Rails-based database");
railsCBox.setToolTipText("(-rails)");
qualityPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("Quality Image Diagrams:"));
qualityPanel.setToolTipText("Generate either higher or lower-quality diagrams. Depends Graphviz istallation.");
highQuCBox.setText("High Quality");
highQuCBox.setToolTipText("(-hq)");
lowQuCBox.setText("Low Quality");
lowQuCBox.setToolTipText("(-lq)");
org.jdesktop.layout.GroupLayout qualityPanelLayout = new org.jdesktop.layout.GroupLayout(qualityPanel);
qualityPanel.setLayout(qualityPanelLayout);
qualityPanelLayout.setHorizontalGroup(
qualityPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(qualityPanelLayout.createSequentialGroup()
.addContainerGap()
.add(qualityPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(highQuCBox)
.add(lowQuCBox))
.addContainerGap(37, Short.MAX_VALUE))
);
qualityPanelLayout.setVerticalGroup(
qualityPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(qualityPanelLayout.createSequentialGroup()
.add(highQuCBox)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(lowQuCBox))
);
singleSignCBox.setText("Single Sign-On");
singleSignCBox.setToolTipText("Don't require a user to be specified with -u to simplify configuration when running in a single sign-on environment (-sso)");
singleSignCBox.setEnabled(false);
showFinishCBox.setText("Show Output when finished");
org.jdesktop.layout.GroupLayout flagsPanelLayout = new org.jdesktop.layout.GroupLayout(flagsPanel);
flagsPanel.setLayout(flagsPanelLayout);
flagsPanelLayout.setHorizontalGroup(
flagsPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(flagsPanelLayout.createSequentialGroup()
.add(44, 44, 44)
.add(flagsPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(flagsPanelLayout.createSequentialGroup()
.add(aHTMLCBox, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.add(46, 46, 46))
.add(noRowsBox, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.add(flagsPanelLayout.createSequentialGroup()
.add(railsCBox, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.add(16, 16, 16))
.add(flagsPanelLayout.createSequentialGroup()
.add(qualityPanel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.add(49, 49, 49)))
.add(17, 17, 17)
.add(flagsPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(flagsPanelLayout.createSequentialGroup()
.add(flagsPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(dincFKCBox, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.add(flagsPanelLayout.createSequentialGroup()
.add(noHTMLCBox, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.add(76, 76, 76)))
.add(9, 9, 9)
.add(flagsPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(flagsPanelLayout.createSequentialGroup()
.add(noAdsCBox, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.add(6, 6, 6))
.add(noLogoCBox, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
.add(flagsPanelLayout.createSequentialGroup()
.add(showFinishCBox)
.add(60, 60, 60))
.add(flagsPanelLayout.createSequentialGroup()
.add(singleSignCBox, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.add(122, 122, 122)))
.add(77, 77, 77))
);
flagsPanelLayout.setVerticalGroup(
flagsPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(org.jdesktop.layout.GroupLayout.TRAILING, flagsPanelLayout.createSequentialGroup()
.addContainerGap(11, Short.MAX_VALUE)
.add(flagsPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(flagsPanelLayout.createSequentialGroup()
.add(flagsPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(flagsPanelLayout.createSequentialGroup()
.add(flagsPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
.add(flagsPanelLayout.createSequentialGroup()
.add(aHTMLCBox)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(noRowsBox)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(railsCBox))
.add(flagsPanelLayout.createSequentialGroup()
.add(noHTMLCBox)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(dincFKCBox)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(singleSignCBox)))
.add(18, 18, 18)
.add(showFinishCBox))
.add(flagsPanelLayout.createSequentialGroup()
.add(noLogoCBox)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(noAdsCBox)))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 43, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
.add(org.jdesktop.layout.GroupLayout.TRAILING, flagsPanelLayout.createSequentialGroup()
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 80, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.add(qualityPanel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
.addContainerGap())
);
savePassCBox.setText("Save User Password");
savePassCBox.setToolTipText("WARNING: Saves DB User Password as plain text!");
org.jdesktop.layout.GroupLayout reqParamPanelLayout = new org.jdesktop.layout.GroupLayout(reqParamPanel);
reqParamPanel.setLayout(reqParamPanelLayout);
reqParamPanelLayout.setHorizontalGroup(
reqParamPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(reqParamPanelLayout.createSequentialGroup()
.add(reqParamPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(reqParamPanelLayout.createSequentialGroup()
.add(28, 28, 28)
.add(reqParamPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
.add(reqParamPanelLayout.createSequentialGroup()
.add(51, 51, 51)
.add(lbl_DBName, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.add(reqParamPanelLayout.createSequentialGroup()
.add(53, 53, 53)
.add(reqParamPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(lbl_DBType)
.add(reqParamPanelLayout.createSequentialGroup()
.add(lbl_DBHost, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.add(2, 2, 2))))
.add(reqParamPanelLayout.createSequentialGroup()
.add(55, 55, 55)
.add(lbl_DBUser, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.add(lbl_PathtoDBdrvr)
.add(lbl_PathSchemSpy)
.add(lbl_PropertiePath)
.add(lbl_prop))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(reqParamPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(propertiesTField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 381, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.add(reqParamPanelLayout.createSequentialGroup()
.add(reqParamPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
.add(org.jdesktop.layout.GroupLayout.LEADING, dbDriverPTField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 306, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.add(org.jdesktop.layout.GroupLayout.LEADING, sSpyPathTField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 306, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.add(org.jdesktop.layout.GroupLayout.LEADING, propertiePathTField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 306, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(reqParamPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(propertiePathButton, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.add(sSpyPathButton, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.add(driverButton, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
.add(reqParamPanelLayout.createSequentialGroup()
.add(reqParamPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(dbTypeCBox, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 122, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.add(dbNameTField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 171, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.add(dbUserTField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 171, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.add(dbHostTField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 171, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
.add(reqParamPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(savePassCBox)
.add(reqParamPanelLayout.createSequentialGroup()
.add(reqParamPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(lbl_DBPwd, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 66, Short.MAX_VALUE)
.add(reqParamPanelLayout.createSequentialGroup()
.add(8, 8, 8)
.add(lbl_DBPort, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.add(18, 18, 18)))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(reqParamPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(dbPortTField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 89, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.add(dbPwdField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 89, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))))
.add(41, 41, 41)))
.add(54, 54, 54))
.add(reqParamPanelLayout.createSequentialGroup()
.addContainerGap()
.add(flagsPanel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
.addContainerGap())
);
reqParamPanelLayout.setVerticalGroup(
reqParamPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(org.jdesktop.layout.GroupLayout.TRAILING, reqParamPanelLayout.createSequentialGroup()
.addContainerGap()
.add(reqParamPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(dbTypeCBox, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.add(lbl_DBType))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(reqParamPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(dbHostTField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.add(lbl_DBHost)
.add(dbPortTField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.add(lbl_DBPort))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(reqParamPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(dbNameTField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.add(lbl_DBName))
.add(6, 6, 6)
.add(reqParamPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(dbUserTField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.add(dbPwdField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.add(lbl_DBPwd)
.add(lbl_DBUser))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(savePassCBox)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 15, Short.MAX_VALUE)
.add(reqParamPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(dbDriverPTField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.add(driverButton)
.add(lbl_PathtoDBdrvr))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(reqParamPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(sSpyPathTField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.add(sSpyPathButton)
.add(lbl_PathSchemSpy))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(reqParamPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(propertiePathTField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.add(propertiePathButton)
.add(lbl_PropertiePath))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(reqParamPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(propertiesTField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.add(lbl_prop))
.add(18, 18, 18)
.add(flagsPanel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
);
jTabbedPane.addTab("Parameters/Flags", reqParamPanel);
outputOptionsPanel.setToolTipText("");
lbl_OutDir.setText("Output directory:"); // NOI18N
pathOutputTField.setToolTipText("Choose the path to your SchemaSpy output dir (-o)");
outDirButton.setText("Choose"); // NOI18N
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
outDirButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
outDirButtonActionPerformed(evt);
}
});
allSchemasCBox.setText("All Schemas");
allSchemasCBox.setToolTipText("Evaluate all schemas in a database (-all)");
allSchemasCBox.addChangeListener(new javax.swing.event.ChangeListener() {
public void stateChanged(javax.swing.event.ChangeEvent evt) {
allSchemasCBoxStateChanged(evt);
}
});
schemaTField.setToolTipText("Database schema (optional if the same as user or isn't supported by your database)(-s).
Evaluate specified schemas.(-schemas \"s1,s2\")");
lbl_Schema.setText("Schema/s to explore:"); // NOI18N
lbl_Schema.setToolTipText("Schemas coma separated");
lbl_Desc.setText("Description on summary page:"); // NOI18N
descTArea.setColumns(20);
descTArea.setRows(4);
descTArea.setToolTipText("Displays the specified textual description on summary pages (-desc).\nFor example: SchemaSpy");
descTAreaScrollPane.setViewportView(descTArea);
lbl_TableRegEx.setText("Table name RegExp:"); // NOI18N
tNameRExTField.setToolTipText("This is a regular expression that's used to determine which tables/views to include (-i).
For example: (.*book.*)|(library.*)");
lbl_TableExRegEx.setText("Table Exclusion RegExp:");
tNameExRExTField.setToolTipText("This is a regular expression that's used to determine which tables/views to exclude (-I).");
lbl_ColumnRegEx.setText("Column Exclusion RegExp:"); // NOI18N
cNameRExTField.setToolTipText("Exclude matching columns from relationship analysis to simplify the generated graphs (-x).
For example: (book.isbn)|(borrower.address)");
colExRelCBox.setText("Excluded relationships");
colExRelCBox.setToolTipText("Set the columns to exclude from relationship diagrams where
the specified columns aren't directly referenced by the focal table. (-X)");
stylePanel.setBorder(javax.swing.BorderFactory.createTitledBorder(" Style: (Modify the .css to specify HTML fonts) "));
stylePanel.setToolTipText("Modify the .css to specify HTML fonts.");
charsetComBox.setEditable(true);
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" }));
charsetComBox.setToolTipText("Default by SchemaSpy: ISO-8859-1 (-charset)");
lbl_Charset.setText("Charset:");
lbl_Font.setText("Font Name:");
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\"");
lbl_fontSize.setText("Font size:");
fontSizeTField.setToolTipText("Fontsize default: 11 (-fontsize)");
lbl_css.setText("Style css file:");
cssPathTField.setToolTipText("css file default: schemaSpy.css (-css)");
jButton1.setText("Choose");
jButton1.setToolTipText("Click to choose the path to css file (-css)");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
org.jdesktop.layout.GroupLayout stylePanelLayout = new org.jdesktop.layout.GroupLayout(stylePanel);
stylePanel.setLayout(stylePanelLayout);
stylePanelLayout.setHorizontalGroup(
stylePanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(stylePanelLayout.createSequentialGroup()
.add(stylePanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
.add(stylePanelLayout.createSequentialGroup()
.add(lbl_Charset)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(charsetComBox, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 136, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(lbl_Font)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(fontNameTField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 136, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(lbl_fontSize)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(fontSizeTField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 39, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
.add(stylePanelLayout.createSequentialGroup()
.add(lbl_css)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(cssPathTField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jButton1)))
.addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
stylePanelLayout.setVerticalGroup(
stylePanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(stylePanelLayout.createSequentialGroup()
.add(stylePanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(lbl_Charset)
.add(charsetComBox, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.add(lbl_Font)
.add(fontNameTField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.add(lbl_fontSize)
.add(fontSizeTField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(stylePanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(lbl_css)
.add(cssPathTField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.add(jButton1)))
);
metaFilePathButton.setText("Choose"); // NOI18N
metaFilePathButton.setToolTipText("Click to choose the path to your Metafile (-meta). You can leave this blank."); // NOI18N
metaFilePathButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
metaFilePathButtonActionPerformed(evt);
}
});
metaFilePathTField.setToolTipText("Choose the path to your Metafile (-meta)");
lbl_OutDir1.setText("Metafile Path:"); // NOI18N
org.jdesktop.layout.GroupLayout outputOptionsPanelLayout = new org.jdesktop.layout.GroupLayout(outputOptionsPanel);
outputOptionsPanel.setLayout(outputOptionsPanelLayout);
outputOptionsPanelLayout.setHorizontalGroup(
outputOptionsPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(outputOptionsPanelLayout.createSequentialGroup()
.add(38, 38, 38)
.add(outputOptionsPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(lbl_Desc)
.add(outputOptionsPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
.add(org.jdesktop.layout.GroupLayout.LEADING, descTAreaScrollPane, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 517, Short.MAX_VALUE)
.add(org.jdesktop.layout.GroupLayout.LEADING, outputOptionsPanelLayout.createSequentialGroup()
.add(outputOptionsPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
.add(org.jdesktop.layout.GroupLayout.TRAILING, lbl_ColumnRegEx)
.add(org.jdesktop.layout.GroupLayout.TRAILING, lbl_TableExRegEx)
.add(org.jdesktop.layout.GroupLayout.TRAILING, lbl_TableRegEx))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(outputOptionsPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
.add(tNameRExTField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 387, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.add(tNameExRExTField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 387, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.add(cNameRExTField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 387, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.add(colExRelCBox))))
.add(stylePanel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
.add(19, 19, 19))
.add(outputOptionsPanelLayout.createSequentialGroup()
.add(29, 29, 29)
.add(outputOptionsPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
.add(lbl_Schema)
.add(lbl_OutDir)
.add(lbl_OutDir1))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(outputOptionsPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(metaFilePathTField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 309, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.add(schemaTField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 309, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.add(pathOutputTField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 309, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(outputOptionsPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(metaFilePathButton, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 96, Short.MAX_VALUE)
.add(outDirButton, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 96, Short.MAX_VALUE)
.add(allSchemasCBox, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 96, Short.MAX_VALUE))
.add(28, 28, 28))
);
outputOptionsPanelLayout.setVerticalGroup(
outputOptionsPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(outputOptionsPanelLayout.createSequentialGroup()
.addContainerGap()
.add(outputOptionsPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(pathOutputTField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.add(lbl_OutDir)
.add(outDirButton))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(outputOptionsPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(schemaTField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.add(lbl_Schema)
.add(allSchemasCBox))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(outputOptionsPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(metaFilePathTField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.add(metaFilePathButton)
.add(lbl_OutDir1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 14, Short.MAX_VALUE))
.add(29, 29, 29)
.add(lbl_Desc)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(descTAreaScrollPane, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 118, Short.MAX_VALUE)
.add(18, 18, 18)
.add(outputOptionsPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(lbl_TableRegEx)
.add(tNameRExTField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(outputOptionsPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(lbl_TableExRegEx)
.add(tNameExRExTField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(outputOptionsPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(lbl_ColumnRegEx)
.add(cNameRExTField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(colExRelCBox)
.add(18, 18, 18)
.add(stylePanel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
);
jTabbedPane.addTab("Ouput Options", outputOptionsPanel);
outputPanel.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
sSpyOutTArea.setEditable(false);
sSpyOutTArea.setLineWrap(true);
sSpyOutTArea.setWrapStyleWord(true);
sSpyOutTAreaScrollPane.setViewportView(sSpyOutTArea);
org.jdesktop.layout.GroupLayout outputPanelLayout = new org.jdesktop.layout.GroupLayout(outputPanel);
outputPanel.setLayout(outputPanelLayout);
outputPanelLayout.setHorizontalGroup(
outputPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(outputPanelLayout.createSequentialGroup()
.addContainerGap()
.add(sSpyOutTAreaScrollPane)
.addContainerGap())
);
outputPanelLayout.setVerticalGroup(
outputPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(org.jdesktop.layout.GroupLayout.TRAILING, outputPanelLayout.createSequentialGroup()
.addContainerGap()
.add(sSpyOutTAreaScrollPane, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 452, Short.MAX_VALUE)
.addContainerGap())
);
jTabbedPane.addTab("SchemaSpy Output", outputPanel);
fileMenu.setText("File"); // NOI18N
sParamMenuItem.setText("Save Parameters ..."); // NOI18N
sParamMenuItem.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
sParamMenuItemActionPerformed(evt);
}
});
fileMenu.add(sParamMenuItem);
lParamMenuItem.setText("Load Parameters ..."); // NOI18N
lParamMenuItem.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
lParamMenuItemActionPerformed(evt);
}
});
fileMenu.add(lParamMenuItem);
exitMenuItem.setText("Exit"); // NOI18N
exitMenuItem.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
exitMenuItemActionPerformed(evt);
}
});
fileMenu.add(exitMenuItem);
mainMenuBar.add(fileMenu);
infoMenu.setText("Help"); // NOI18N
helpMenueAboutItem.setText("About"); // NOI18N
helpMenueAboutItem.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
helpMenueAboutItemActionPerformed(evt);
}
});
infoMenu.add(helpMenueAboutItem);
mainMenuBar.add(infoMenu);
setJMenuBar(mainMenuBar);
org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(jToolBar, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 579, Short.MAX_VALUE)
.add(jTabbedPane, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 579, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(layout.createSequentialGroup()
.add(jToolBar, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jTabbedPane, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 504, Short.MAX_VALUE))
);
pack();
}// //GEN-END:initComponents
private void sParamMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_sParamMenuItemActionPerformed
operations.saveParam("Menu");
}//GEN-LAST:event_sParamMenuItemActionPerformed
private void lParamMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_lParamMenuItemActionPerformed
operations.loadParam("Menu");
}//GEN-LAST:event_lParamMenuItemActionPerformed
private void exitMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exitMenuItemActionPerformed
operations.systemEnd();
}//GEN-LAST:event_exitMenuItemActionPerformed
private void helpMenueAboutItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_helpMenueAboutItemActionPerformed
operations.showAbout(this);
}//GEN-LAST:event_helpMenueAboutItemActionPerformed
private void quickLoadButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_quickLoadButtonActionPerformed
operations.loadParam("Quick");
}//GEN-LAST:event_quickLoadButtonActionPerformed
private void quickSaveButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_quickSaveButtonActionPerformed
operations.saveParam("Quick");
}//GEN-LAST:event_quickSaveButtonActionPerformed
private void clearFieldsButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_clearFieldsButtonActionPerformed
operations.clearAllFields();
}//GEN-LAST:event_clearFieldsButtonActionPerformed
private void exitButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exitButtonActionPerformed
operations.systemEnd();
}//GEN-LAST:event_exitButtonActionPerformed
private void saveParamFileButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_saveParamFileButtonActionPerformed
operations.saveParam("Menu");
}//GEN-LAST:event_saveParamFileButtonActionPerformed
private void loadParamFileButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_loadParamFileButtonActionPerformed
operations.loadParam("Menu");
}//GEN-LAST:event_loadParamFileButtonActionPerformed
private void driverButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_driverButtonActionPerformed
operations.setPath("driverDirPath");
}//GEN-LAST:event_driverButtonActionPerformed
private void sSpyPathButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_sSpyPathButtonActionPerformed
operations.setPath("sSpyFilePath");
}//GEN-LAST:event_sSpyPathButtonActionPerformed
private void propertiePathButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_propertiePathButtonActionPerformed
operations.setPath("propertiePath");
}//GEN-LAST:event_propertiePathButtonActionPerformed
private void dbTypeCBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_dbTypeCBoxActionPerformed
// nothing TODO here at the moment
}//GEN-LAST:event_dbTypeCBoxActionPerformed
private void outDirButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_outDirButtonActionPerformed
operations.setPath("outDirPath");
}//GEN-LAST:event_outDirButtonActionPerformed
private void allSchemasCBoxStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_allSchemasCBoxStateChanged
if (allSchemasCBox.isSelected())
schemaTField.setEnabled(false);
else schemaTField.setEnabled(true);
}//GEN-LAST:event_allSchemasCBoxStateChanged
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
operations.setPath("cssPath");
}//GEN-LAST:event_jButton1ActionPerformed
private void startSchemaSpyButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_startSchemaSpyButtonActionPerformed
jTabbedPane.setSelectedIndex(2);
operations.startSchemaSpy(gui);
}//GEN-LAST:event_startSchemaSpyButtonActionPerformed
private void showOutputButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_showOutputButtonActionPerformed
operations.showOutput();
}//GEN-LAST:event_showOutputButtonActionPerformed
private void metaFilePathButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_metaFilePathButtonActionPerformed
operations.setPath("metaFilePath");
}//GEN-LAST:event_metaFilePathButtonActionPerformed
private void setLookandFeel() {
try {
UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
} catch(Exception e) {
e.printStackTrace();
}
}
private void initParams() {
this.gui = this;
params = new Properties();
operations = new Operations();
sSpyPathTField = null;
dbDriverPTField = null;
pathOutputTField = null;
ToolTipManager.sharedInstance().setDismissDelay(12000);
}
public boolean getAutoLaunchInfo() {
boolean info = operations.getAutoLaunch();
return info;
}
public void setOutputText(String outputText) {
operations.setText(outputText);
}
public void startShowOutput() {
operations.showOutput();
}
private SchemaSpyGUIApp gui;
private Operations operations;
private Properties params;
private Build build;
private RunSchemaSpy op;
private Thread t1;
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JCheckBox aHTMLCBox;
private javax.swing.JCheckBox allSchemasCBox;
private javax.swing.JTextField cNameRExTField;
private javax.swing.JComboBox charsetComBox;
private javax.swing.JButton clearFieldsButton;
private javax.swing.JCheckBox colExRelCBox;
private javax.swing.JTextField cssPathTField;
private javax.swing.JTextField dbDriverPTField;
private javax.swing.JTextField dbHostTField;
private javax.swing.JTextField dbNameTField;
private javax.swing.JTextField dbPortTField;
private javax.swing.JPasswordField dbPwdField;
private javax.swing.JComboBox dbTypeCBox;
private javax.swing.JTextField dbUserTField;
private javax.swing.JTextArea descTArea;
private javax.swing.JScrollPane descTAreaScrollPane;
private javax.swing.JCheckBox dincFKCBox;
private javax.swing.JButton driverButton;
private javax.swing.JButton exitButton;
private javax.swing.JMenuItem exitMenuItem;
private javax.swing.JMenu fileMenu;
private javax.swing.JPanel flagsPanel;
private javax.swing.JTextField fontNameTField;
private javax.swing.JTextField fontSizeTField;
private javax.swing.JMenuItem helpMenueAboutItem;
private javax.swing.JCheckBox highQuCBox;
private javax.swing.JMenu infoMenu;
private javax.swing.JButton jButton1;
private javax.swing.JToolBar.Separator jSeparator1;
private javax.swing.JToolBar.Separator jSeparator2;
private javax.swing.JTabbedPane jTabbedPane;
private javax.swing.JToolBar jToolBar;
private javax.swing.JMenuItem lParamMenuItem;
private javax.swing.JLabel lbl_Charset;
private javax.swing.JLabel lbl_ColumnRegEx;
private javax.swing.JLabel lbl_DBHost;
private javax.swing.JLabel lbl_DBName;
private javax.swing.JLabel lbl_DBPort;
private javax.swing.JLabel lbl_DBPwd;
private javax.swing.JLabel lbl_DBType;
private javax.swing.JLabel lbl_DBUser;
private javax.swing.JLabel lbl_Desc;
private javax.swing.JLabel lbl_Font;
private javax.swing.JLabel lbl_OutDir;
private javax.swing.JLabel lbl_OutDir1;
private javax.swing.JLabel lbl_PathSchemSpy;
private javax.swing.JLabel lbl_PathtoDBdrvr;
private javax.swing.JLabel lbl_PropertiePath;
private javax.swing.JLabel lbl_Schema;
private javax.swing.JLabel lbl_TableExRegEx;
private javax.swing.JLabel lbl_TableRegEx;
private javax.swing.JLabel lbl_css;
private javax.swing.JLabel lbl_fontSize;
private javax.swing.JLabel lbl_prop;
private javax.swing.JButton loadParamFileButton;
private javax.swing.JCheckBox lowQuCBox;
private javax.swing.JMenuBar mainMenuBar;
private javax.swing.JButton metaFilePathButton;
private javax.swing.JTextField metaFilePathTField;
private javax.swing.JCheckBox noAdsCBox;
private javax.swing.JCheckBox noHTMLCBox;
private javax.swing.JCheckBox noLogoCBox;
private javax.swing.JCheckBox noRowsBox;
private javax.swing.JButton outDirButton;
private javax.swing.JPanel outputOptionsPanel;
private javax.swing.JPanel outputPanel;
private javax.swing.JTextField pathOutputTField;
private javax.swing.JButton propertiePathButton;
private javax.swing.JTextField propertiePathTField;
private javax.swing.JTextField propertiesTField;
private javax.swing.JPanel qualityPanel;
private javax.swing.JButton quickLoadButton;
private javax.swing.JButton quickSaveButton;
private javax.swing.JCheckBox railsCBox;
private javax.swing.JPanel reqParamPanel;
private javax.swing.JMenuItem sParamMenuItem;
private javax.swing.JTextArea sSpyOutTArea;
private javax.swing.JScrollPane sSpyOutTAreaScrollPane;
private javax.swing.JButton sSpyPathButton;
private javax.swing.JTextField sSpyPathTField;
private javax.swing.JButton saveParamFileButton;
private javax.swing.JCheckBox savePassCBox;
private javax.swing.JTextField schemaTField;
private javax.swing.JCheckBox showFinishCBox;
private javax.swing.JButton showOutputButton;
private javax.swing.JCheckBox singleSignCBox;
private javax.swing.JButton startSchemaSpyButton;
private javax.swing.JPanel stylePanel;
private javax.swing.JTextField tNameExRExTField;
private javax.swing.JTextField tNameRExTField;
// End of variables declaration//GEN-END:variables
/*
* Class for Application Functions like saveParam etc.
* */
private class Operations {
public Operations () {
build = new Build();
}
/**
* Starts the schema scanning with SchemaSpy in a separate thread
* @param gui
*/
private void startSchemaSpy(SchemaSpyGUIApp gui) {
String run_command;
String displ_command;
sSpyOutTArea.setText("");
if (checkPath()) {
run_command = build.buildCommand("run");
displ_command = build.buildCommand("displ");
op = new RunSchemaSpy(gui, run_command, displ_command);
t1 = new Thread(op);
t1.setName("SSpy");
t1.start();
}
}
/**
* Shows the about box
* @param frame
*/
private void showAbout(JFrame frame) {
JDialog aboutBox = new AboutBox(frame);
aboutBox.setVisible(true);
}
/**
* Sets the text in Output Area
* @param text
*/
public void setText (String text) {
sSpyOutTArea.append(text);
}
private void setPath (String button) {
String openDialogDefaultPath = ".";
if (button.equals("driverDirPath")) {
if (!dbDriverPTField.getText().equals("")) {
//openDialogDefaultPath = makePathUsable(dbDriverPTField.getText());
openDialogDefaultPath = dbDriverPTField.getText();
}
}
if (button.equals("outDirPath")) {
if (!pathOutputTField.getText().equals("")) {
//openDialogDefaultPath = makePathUsable(pathOutputTField.getText());
openDialogDefaultPath = pathOutputTField.getText();
}
}
if (button.equals("sSpyFilePath")) {
if (!sSpyPathTField.getText().equals("")) {
//openDialogDefaultPath = makePathUsable(sSpyPathTField.getText());
openDialogDefaultPath = sSpyPathTField.getText();
}
}
if (button.equals("propertiePath")) {
if (!propertiePathTField.getText().equals("")) {
//openDialogDefaultPath = makePathUsable(propertiePathTField.getText());
openDialogDefaultPath = propertiePathTField.getText();
}
}
if (button.equals("cssPath")) {
if (!cssPathTField.getText().equals("")) {
//openDialogDefaultPath = makePathUsable(cssPathTField.getText());
openDialogDefaultPath = cssPathTField.getText();
}
}
if (button.equals("metaFilePath")) {
if (!metaFilePathTField.getText().equals("")) {
//openDialogDefaultPath = makePathUsable(cssPathTField.getText());
openDialogDefaultPath = metaFilePathTField.getText();
}
}
JFileChooser openDialog = new JFileChooser(openDialogDefaultPath);
if (button.equals("outDirPath")) {
openDialog.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
}
else if (button.equals("cssPath")) {
openDialog.setFileSelectionMode(JFileChooser.FILES_ONLY);
openDialog.setFileFilter(getCssFilter());
}
else {
openDialog.setFileSelectionMode(JFileChooser.FILES_ONLY);
}
/*
if (button.equals("driverDirPath")) {
openDialog.setFileSelectionMode(JFileChooser.FILES_ONLY);
}
if (button.equals("sSpyFilePath")) {
openDialog.setFileSelectionMode(JFileChooser.FILES_ONLY);
}
if (button.equals("propertiePath")) {
openDialog.setFileSelectionMode(JFileChooser.FILES_ONLY);
}
*/
openDialog.setDialogType(JFileChooser.OPEN_DIALOG);
int returnVal = openDialog.showOpenDialog(gui);
if (returnVal == JFileChooser.APPROVE_OPTION) {
String path = openDialog.getSelectedFile().getAbsolutePath();
if (button.equals("driverDirPath")) {
dbDriverPTField.setText(path);
}
if (button.equals("outDirPath")) {
pathOutputTField.setText(path);
}
if (button.equals("sSpyFilePath")) {
sSpyPathTField.setText(path);
}
if (button.equals("propertiePath")) {
propertiePathTField.setText(path);
}
if (button.equals("cssPath")) {
cssPathTField.setText(path);
}
if (button.equals("metaFilePath")) {
metaFilePathTField.setText(path);
}
}
}
private String getCBoxString (JCheckBox cBox) {
if (cBox.isSelected()) {
return "true";
} else {
return "false";
}
}
private FileFilter getXmlFilter() {
FileFilter ff = new FileFilter() {
@Override
public boolean accept(File f) {
return f.getName().toLowerCase().endsWith(".xml")
|| f.isDirectory();
}
@Override
public String getDescription() {
return "XML Files";
}
};
return ff;
}
private FileFilter getCssFilter() {
FileFilter ff = new FileFilter() {
@Override
public boolean accept(File f) {
return f.getName().toLowerCase().endsWith(".css")
|| f.isDirectory();
}
@Override
public String getDescription() {
return "CSS Files";
}
};
return ff;
}
private void saveParam(String option) {
params.setProperty("dbTypeCBox", (String)dbTypeCBox.getSelectedItem());
params.setProperty("dbHostTField", dbHostTField.getText());
params.setProperty("dbNameTField", dbNameTField.getText());
params.setProperty("dbPortTField", dbPortTField.getText());
params.setProperty("dbUserTField", dbUserTField.getText());
// Save password
if (savePassCBox.isSelected()){
params.setProperty("dbPwdField", String.valueOf(dbPwdField.getPassword()));
}
else params.setProperty("dbPwdField", "");
params.setProperty("dbDriverPTField", dbDriverPTField.getText());
params.setProperty("pathOutputTField", pathOutputTField.getText());
params.setProperty("sSpyPathTField", sSpyPathTField.getText());
params.setProperty("propertiePathTField", propertiePathTField.getText());
params.setProperty("propertiesTField", propertiesTField.getText());
params.setProperty("metaFilePathTField", metaFilePathTField.getText());
params.setProperty("schemaTField", schemaTField.getText());
params.setProperty("allSchemasCBox", getCBoxString(allSchemasCBox));
params.setProperty("descTArea", descTArea.getText().replace("\"", "'"));
params.setProperty("tNameRExTField", tNameRExTField.getText());
params.setProperty("tNameExRExTField", tNameExRExTField.getText());
params.setProperty("cNameRExTField", cNameRExTField.getText());
params.setProperty("colExRelCBox", getCBoxString(colExRelCBox));
params.setProperty("charsetComBox", (String)charsetComBox.getSelectedItem());
params.setProperty("fontSizeTField", fontSizeTField.getText());
params.setProperty("fontNameTField", fontNameTField.getText());
params.setProperty("cssPathTField", cssPathTField.getText());
params.setProperty("aHTMLCBox", getCBoxString(aHTMLCBox));
params.setProperty("noRowsBox", getCBoxString(noRowsBox));
params.setProperty("dincFKCBox", getCBoxString(dincFKCBox));
params.setProperty("noHTMLCBox", getCBoxString(noHTMLCBox));
params.setProperty("railsCBox", getCBoxString(railsCBox));
// TODO: Single Sign-On (-sso).
//params.setProperty("singleSignCBox", getCBoxString(singleSignCBox));
// Quality Images
params.setProperty("highQuCBox", getCBoxString(highQuCBox));
params.setProperty("lowQuCBox", getCBoxString(lowQuCBox));
//----------
params.setProperty("noAdsCBox", getCBoxString(noAdsCBox));
params.setProperty("noLogoCBox", getCBoxString(noLogoCBox));
params.setProperty("savePassCBox", getCBoxString(savePassCBox));
params.setProperty("showFinishCBox", getCBoxString(showFinishCBox));
String name = "", coment = "";
if (option.equals("Quick")) {
name = "SSpyGUIQuick.xml";
coment = "Saved parameters for SchemaSpyGUI. Load it with: Quick Load Parameters";
}
// Save JFileChooser
else if (option.equals("Menu")) {
JFileChooser saveDialog = new JFileChooser(".");
saveDialog.setFileSelectionMode(JFileChooser.FILES_ONLY);
saveDialog.setDialogType(JFileChooser.SAVE_DIALOG);
saveDialog.setDialogTitle("Save Parameters ...");
saveDialog.setFileFilter(getXmlFilter());
int returnVal = saveDialog.showOpenDialog(gui);
if (returnVal == JFileChooser.APPROVE_OPTION) {
name = saveDialog.getSelectedFile().getAbsolutePath();
coment = "Saved parameters for SchemaSpyGUI. Load it with Load Menu";
}
}
if (!name.equals("")) {
// Add xml extension
if (!name.endsWith(".xml"))
name += ".xml";
try {
FileOutputStream fos = new FileOutputStream(name);
params.storeToXML(fos, coment);
fos.close();
} catch (IOException ioe) {
ioe.printStackTrace();
}
}
}
private void loadParam(String option) {
String name = "";
if (option.equals("Quick")) {
name = "SSpyGUIQuick.xml";
}
else if (option.equals("Menu")) {
JFileChooser openDialog = new JFileChooser(".");
openDialog.setFileSelectionMode(JFileChooser.FILES_ONLY);
openDialog.setDialogType(JFileChooser.OPEN_DIALOG);
openDialog.setDialogTitle("Load Parameters ...");
openDialog.setFileFilter(getXmlFilter());
int returnVal = openDialog.showOpenDialog(gui);
if (returnVal == JFileChooser.APPROVE_OPTION) {
name = openDialog.getSelectedFile().getAbsolutePath();
}
}
File file = new File(name);
if (file.exists()) {
try {
FileInputStream in = new FileInputStream(file);
params.loadFromXML(in);
in.close();
clearAllFields();
insertInFields();
} catch (IOException ioe) {
ioe.printStackTrace();
}
}
}
private void insertInFields () {
dbTypeCBox.setSelectedItem(params.getProperty("dbTypeCBox"));
dbHostTField.setText(params.getProperty("dbHostTField"));
dbNameTField.setText(params.getProperty("dbNameTField"));
dbPortTField.setText(params.getProperty("dbPortTField"));
dbUserTField.setText(params.getProperty("dbUserTField"));
// Load Password
dbPwdField.setText(params.getProperty("dbPwdField"));
dbDriverPTField.setText(params.getProperty("dbDriverPTField"));
pathOutputTField.setText(params.getProperty("pathOutputTField"));
sSpyPathTField.setText(params.getProperty("sSpyPathTField"));
propertiePathTField.setText(params.getProperty("propertiePathTField"));
propertiesTField.setText(params.getProperty("propertiesTField"));
metaFilePathTField.setText(params.getProperty("metaFilePathTField"));
schemaTField.setText(params.getProperty("schemaTField"));
if (params.getProperty("allSchemasCBox").equals("true")) {allSchemasCBox.setSelected(true);}
descTArea.setText(params.getProperty("descTArea"));
tNameRExTField.setText(params.getProperty("tNameRExTField"));
tNameExRExTField.setText(params.getProperty("tNameExRExTField"));
cNameRExTField.setText(params.getProperty("cNameRExTField"));
if (params.getProperty("colExRelCBox").equals("true")) {colExRelCBox.setSelected(true);}
charsetComBox.setSelectedItem(params.getProperty("charsetComBox"));
fontSizeTField.setText(params.getProperty("fontSizeTField"));
fontNameTField.setText(params.getProperty("fontNameTField"));
cssPathTField.setText(params.getProperty("cssPathTField"));
if (params.getProperty("aHTMLCBox").equals("true")) {aHTMLCBox.setSelected(true);}
if (params.getProperty("noRowsBox").equals("true")) {noRowsBox.setSelected(true);}
if (params.getProperty("dincFKCBox").equals("true")) {dincFKCBox.setSelected(true);}
if (params.getProperty("noHTMLCBox").equals("true")) {noHTMLCBox.setSelected(true);}
if (params.getProperty("railsCBox").equals("true")) {railsCBox.setSelected(true);}
// TODO: Single Sign-On (-sso).
//if (params.getProperty("singleSignCBox").equals("true")) {singleSignCBox.setSelected(true);}
// Quality Images
if (params.getProperty("highQuCBox").equals("true")) {highQuCBox.setSelected(true);}
if (params.getProperty("lowQuCBox").equals("true")) {lowQuCBox.setSelected(true);}
//---------
if (params.getProperty("noAdsCBox").equals("true")) {noAdsCBox.setSelected(true);}
if (params.getProperty("noLogoCBox").equals("true")) {noLogoCBox.setSelected(true);}
if (params.getProperty("savePassCBox").equals("true")) {savePassCBox.setSelected(true);}
if (params.getProperty("showFinishCBox").equals("true")) {showFinishCBox.setSelected(true);}
}
private void clearAllFields() {
dbTypeCBox.setSelectedItem("");
dbHostTField.setText("");
dbNameTField.setText("");
dbPortTField.setText("");
dbUserTField.setText("");
// Password
dbPwdField.setText("");
dbDriverPTField.setText("");
pathOutputTField.setText("");
sSpyPathTField.setText("");
propertiePathTField.setText("");
propertiesTField.setText("");
metaFilePathTField.setText("");
schemaTField.setText("");
allSchemasCBox.setSelected(false);
descTArea.setText("");
tNameRExTField.setText("");
tNameExRExTField.setText("");
cNameRExTField.setText("");
colExRelCBox.setSelected(false);
charsetComBox.setSelectedIndex(0);
fontSizeTField.setText("");
fontNameTField.setText("");
cssPathTField.setText("");
aHTMLCBox.setSelected(false);
noRowsBox.setSelected(false);
dincFKCBox.setSelected(false);
noHTMLCBox.setSelected(false);
railsCBox.setSelected(false);
// TODO: Single Sign-On (-sso).
//singleSignCBox.setSelected(false);
// Quality Images
highQuCBox.setSelected(false);
lowQuCBox.setSelected(false);
//--------------------------
noAdsCBox.setSelected(false);
noLogoCBox.setSelected(false);
savePassCBox.setSelected(false);
showFinishCBox.setSelected(false);
}
private String makePathUsable(String s) {
//s.replace("\\","\\\\"); // This don't work is: s = s.replace("\\","\\\\");
// Add " for directories and files with spaces
//Bug: Linux doesn't work with "s"
//Error: Unable to access jarfile
//simple hack but no support for directories with
//spaces currently under Linux
if (isWindows()) {s = "\"" + s + "\"";}
else{}
return s;
}
//TODO: copy from isWindows() of BrowserOutputStart ... pooling?
public boolean isWindows() {
String os = System.getProperty("os.name");
if ( os != null && os.startsWith("Windows")) {
return true;
} else {
return false;
}
}
private boolean checkPath() {
boolean bool = false;
File sSpyPath = new File(sSpyPathTField.getText());
File dbDriverPath = new File(dbDriverPTField.getText());
File outDirPath = new File(pathOutputTField.getText());
if (sSpyPath.exists()) {
bool = true;
} else {
setText("This is not a valid path to SchemaSpy: " + sSpyPathTField.getText()+ "\n");
if (!sSpyPath.canRead()) {
setText("Jar File ist not readable!\n");
}
}
if (dbDriverPTField.getText().equals("")) {
setText("You have not specified a driver path. SchemaSpy will try to \n" +
"use the path in internal .properties file.\n" +
"It's possible that these will not work. In this case, please specify a path.\n");
} else {
if (!dbDriverPath.exists() || !dbDriverPath.canRead()) {
if (bool) {bool = false;}
setText("This is not a valid path to the DB driver: " + dbDriverPTField.getText() + "\n");
if (!dbDriverPath.canRead()) {
setText("File ist not readable!\n");
}
}
}
// SchemaSpy Creates a directory if not exist
if (!pathOutputTField.getText().equals("") && !outDirPath.exists()) { // && !outDirPath.canWrite()) {
//if (bool){bool = false;}
setText("This is not a valid path for the output directory, but SchemaSpy will create it: " + pathOutputTField.getText() + "\n");
if (!sSpyPath.canWrite()) {
if (bool){bool = false;}
setText("SchemaSpy can not write!\n");
}
}
return bool;
}
private String buildOutputDir () {
String dirName = dbUserTField.getText() + "_" + dbNameTField.getText()
+ "_" + schemaTField.getText().replace(",", "-");
File dir = new File(dirName);
if(!dir.exists()) {
dir.mkdir();
}
String dirPath = dir.getAbsolutePath();
pathOutputTField.setText(dirPath);
return dirPath;
}
public void showOutput() {
if (!pathOutputTField.getText().equals("")) {
String url = pathOutputTField.getText() + File.separator + "index.html";
BrowserOutputStart show = new BrowserOutputStart(url);
show.launch();
}
}
/**
* Try are the Threads launched by the program are alive
* @return Alive
*/
private boolean isThreadAlive() {
Boolean tAlive = false;
if (t1 != null) {
// Search into alive threads the SchemaSpy threads.
Set set = Thread.getAllStackTraces().keySet();
for (Thread at : set) {
if (at.getName().equals("SSpy")||
at.getName().equals("terrOut") ||
at.getName().equals("tinOut")) {
if (at.isAlive()) {
tAlive = true;
}
}
}
}
return tAlive;
}
public boolean getAutoLaunch() {
if (showFinishCBox.isSelected())
return true;
else return false;
}
private void systemEnd() {
// If some alive show Warning message
if (isThreadAlive()) {
int returnVal = JOptionPane.showConfirmDialog(gui,
"SchemaSpy is Running.\n" +
"Closing SchemaSpyGUI do NOT finalize the SchemaSpy prosses.\n" +
"Do you really want close SchemaSpyGUI?\n",
"Exit SchemaSpyGUI",
JOptionPane.WARNING_MESSAGE,
JOptionPane.YES_NO_OPTION);
if (returnVal == JOptionPane.YES_OPTION) {
System.exit(0);
} // else do nothing
}
// No threads alive
else {
System.exit(0);
}
}
}
/**
* Inner Class with Methods to build the command line for SchemaSpy
*/
private class Build {
/**
* Build the commad line to launch SchemaSpy
* @param type "displ" returns the Command line without password
* @return Command line string for SchemaSpy
*/
private String buildCommand (String type) {
//first the path to SchemaSpy.jar
String s = "java -jar " + operations.makePathUsable(sSpyPathTField.getText());
//second the path to the driver for the selected DB type
if (!dbDriverPTField.getText().equals("")) {
s = s + " -dp " + operations.makePathUsable(dbDriverPTField.getText());
}
//then the needed database type
if (!((String)dbTypeCBox.getSelectedItem()).equals("")) {
s = s + " -t " + (String)dbTypeCBox.getSelectedItem();
}
//and now the necessary database specific informations
//e.g. database name, schema, user, host etc.
if (!dbNameTField.getText().equals("")) {
s = s + " -db " + dbNameTField.getText();
}
// Select schemas
if (allSchemasCBox.isSelected()) {
s = s + " -all ";
} else if (!schemaTField.getText().equals("")) {
// Try remove space before coma
String sc = schemaTField.getText().replace(", ", ",");
String[] schemas = sc.split(",");
if (schemas.length == 1) {
s = s + " -s " + sc;
} else {
s = s + " -schemas \"" + sc + "\"";
}
}
if (!dbHostTField.getText().equals("")) {
s = s + " -host " + dbHostTField.getText();
}
if (!dbPortTField.getText().equals("")) {
s = s + " -port " + dbPortTField.getText();
}
// TODO: Single Sign-On (-sso).
if (!dbUserTField.getText().equals("")) {
s = s + " -u " + dbUserTField.getText();
}
//now the optional informations like RegEx for columns, tables, etc
// Properties database connection
if (!propertiePathTField.getText().equals("")) {
s = s + " -connprops " + operations.makePathUsable(propertiePathTField.getText());
}
if (!propertiesTField.getText().equals("")) {
s = s + " -connprops " + "\"" + propertiesTField.getText() + "\"";
}
if (!metaFilePathTField.getText().equals("")) {
s = s + " -meta " + operations.makePathUsable(metaFilePathTField.getText());
}
// Columns Exclusions
if (!cNameRExTField.getText().equals("")) {
if (colExRelCBox.isSelected()) {
s = s + " -X " + operations.makePathUsable(cNameRExTField.getText());
} else {
s = s + " -x " + operations.makePathUsable(cNameRExTField.getText());
}
}
// Tables inclusions
if (!tNameRExTField.getText().equals("")) {
s = s + " -i " + operations.makePathUsable(tNameRExTField.getText());
}
// Tables Exclusions
if (!tNameExRExTField.getText().equals("")) {
s = s + " -I " + "\"" + tNameExRExTField.getText() + "\"";
}
if (!((String)charsetComBox.getSelectedItem()).equals("")) {
s = s + " -charset " + (String)charsetComBox.getSelectedItem();
}
if (!(fontSizeTField.getText().equals(""))) {
s = s + " -fontsize " + fontSizeTField.getText();
}
if (!(fontNameTField.getText().equals(""))) {
s = s + " -font " + "\"" + fontNameTField.getText() + "\"";
}
if (!(cssPathTField.getText().equals(""))) {
s = s + " -css " + operations.makePathUsable(cssPathTField.getText());
}
if (!descTArea.getText().equals("")) {
// For if someone put " instead of '
s = s + " -desc " + operations.makePathUsable(descTArea.getText().replace("\"", "'"));
}
if (!pathOutputTField.getText().equals("")) {
s = s + " -o " + operations.makePathUsable(pathOutputTField.getText());
} else {
s = s + " -o " + operations.makePathUsable(operations.buildOutputDir());
}
//now we insert the flags (e.g. Allow HTML in comments) if there are
//some checked
if (aHTMLCBox.isSelected()) {
s = s + " -ahic ";
}
if (noRowsBox.isSelected()) {
s = s + " -norows ";
}
if (dincFKCBox.isSelected()) {
s = s + " -noimplied ";
}
if (noHTMLCBox.isSelected()) {
s = s + " -nohtml ";
}
if (railsCBox.isSelected()) {
s = s + " -rails ";
}
if (highQuCBox.isSelected()) {
s = s + " -hq ";
}
if (lowQuCBox.isSelected()) {
s = s + " -lq ";
}
//---------------------------
if (noAdsCBox.isSelected()) {
s = s + " -noads ";
}
if (noLogoCBox.isSelected()) {
s = s + " -nologo ";
}
//last but not least String with no password if "displ" is selected
//else String + PWD for starting SchemaSpy
if (type.equals("displ")) {
return s;
} else {
if (!String.valueOf(dbPwdField.getPassword()).equals("")) {
s = s + " -p " + String.valueOf(dbPwdField.getPassword());
}
return s;
}
}
}
}