Merge pull request #3075 from APriestman/3027_fileChooser

Allow user to select sqlite db file directly
This commit is contained in:
Richard Cordovano 2017-09-15 15:50:39 -04:00 committed by GitHub
commit ad42028d0e
4 changed files with 122 additions and 29 deletions

View File

@ -74,3 +74,5 @@ GlobalSettingsPanel.bnManageProperties.text=Manage Correlation Properties
ImportHashDatabaseDialog.lbInstructions.text=Choose an .idx file to import into the central repository. ImportHashDatabaseDialog.lbInstructions.text=Choose an .idx file to import into the central repository.
ImportHashDatabaseDialog.lbFilePath.text=File Path: ImportHashDatabaseDialog.lbFilePath.text=File Path:
ImportHashDatabaseDialog.tfFilePath.text= ImportHashDatabaseDialog.tfFilePath.text=
EamDbSettingsDialog.lbDatabaseDesc.text=Database File:
EamDbSettingsDialog.lbFullDbPath.text=jLabel2

View File

@ -44,7 +44,7 @@
<Group type="102" alignment="0" attributes="0"> <Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="10" max="-2" attributes="0"/> <EmptySpace min="-2" pref="10" max="-2" attributes="0"/>
<Component id="pnSQLiteSettings" min="-2" max="-2" attributes="0"/> <Component id="pnSQLiteSettings" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/> <EmptySpace pref="11" max="32767" attributes="0"/>
<Component id="pnButtons" min="-2" max="-2" attributes="0"/> <Component id="pnButtons" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="10" max="-2" attributes="0"/> <EmptySpace min="-2" pref="10" max="-2" attributes="0"/>
</Group> </Group>
@ -114,20 +114,22 @@
<Layout> <Layout>
<DimensionLayout dim="0"> <DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0"> <Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0"> <Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0"> <Group type="103" groupAlignment="0" attributes="0">
<Component id="lbHostName" alignment="0" min="-2" max="-2" attributes="0"/> <Component id="lbHostName" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="lbPort" alignment="0" min="-2" max="-2" attributes="0"/> <Component id="lbPort" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="lbUserName" alignment="0" min="-2" max="-2" attributes="0"/> <Component id="lbUserName" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="lbDatabaseType" alignment="0" min="-2" pref="82" max="-2" attributes="0"/> <Component id="lbDatabaseType" alignment="0" min="-2" pref="82" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0"> <Group type="103" alignment="0" groupAlignment="1" max="-2" attributes="0">
<Component id="lbDatabasePath" alignment="0" min="-2" max="-2" attributes="0"/> <Component id="lbDatabasePath" alignment="0" max="32767" attributes="0"/>
<Component id="lbUserPassword" alignment="1" min="-2" max="-2" attributes="0"/> <Component id="lbUserPassword" alignment="0" max="32767" attributes="0"/>
</Group> </Group>
<Component id="lbDatabaseDesc" alignment="0" min="-2" pref="78" max="-2" attributes="0"/>
</Group> </Group>
<EmptySpace min="-2" pref="10" max="-2" attributes="0"/> <EmptySpace min="-2" pref="10" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0"> <Group type="103" groupAlignment="0" attributes="0">
<Component id="lbFullDbPath" max="32767" attributes="0"/>
<Group type="102" attributes="0"> <Group type="102" attributes="0">
<Component id="cbDatabaseType" min="-2" max="-2" attributes="0"/> <Component id="cbDatabaseType" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
@ -140,9 +142,9 @@
<Component id="bnDatabasePathFileOpen" min="-2" max="-2" attributes="0"/> <Component id="bnDatabasePathFileOpen" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="11" max="-2" attributes="0"/> <EmptySpace min="-2" pref="11" max="-2" attributes="0"/>
</Group> </Group>
<Group type="102" attributes="0"> <Group type="102" alignment="1" attributes="0">
<Group type="103" groupAlignment="0" attributes="0"> <Group type="103" groupAlignment="1" attributes="0">
<Component id="tbDbHostname" max="32767" attributes="0"/> <Component id="tbDbHostname" alignment="0" max="32767" attributes="0"/>
<Component id="jpDbPassword" alignment="0" max="32767" attributes="0"/> <Component id="jpDbPassword" alignment="0" max="32767" attributes="0"/>
<Component id="tbDbUsername" alignment="1" max="32767" attributes="0"/> <Component id="tbDbUsername" alignment="1" max="32767" attributes="0"/>
<Component id="tbDbPort" alignment="0" max="32767" attributes="0"/> <Component id="tbDbPort" alignment="0" max="32767" attributes="0"/>
@ -151,6 +153,11 @@
</Group> </Group>
</Group> </Group>
</Group> </Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="55" max="-2" attributes="0"/>
<Component id="filler1" min="-2" max="-2" attributes="0"/>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group>
</Group> </Group>
</DimensionLayout> </DimensionLayout>
<DimensionLayout dim="1"> <DimensionLayout dim="1">
@ -170,7 +177,7 @@
<Component id="tfDatabasePath" alignment="3" min="-2" pref="23" max="-2" attributes="0"/> <Component id="tfDatabasePath" alignment="3" min="-2" pref="23" max="-2" attributes="0"/>
<Component id="bnDatabasePathFileOpen" alignment="3" min="-2" max="-2" attributes="0"/> <Component id="bnDatabasePathFileOpen" alignment="3" min="-2" max="-2" attributes="0"/>
</Group> </Group>
<EmptySpace min="0" pref="0" max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0"> <Group type="103" groupAlignment="3" attributes="0">
<Component id="tbDbHostname" alignment="3" min="-2" max="-2" attributes="0"/> <Component id="tbDbHostname" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="lbHostName" alignment="3" min="-2" pref="22" max="-2" attributes="0"/> <Component id="lbHostName" alignment="3" min="-2" pref="22" max="-2" attributes="0"/>
@ -186,11 +193,18 @@
<Component id="lbUserName" alignment="3" min="-2" pref="20" max="-2" attributes="0"/> <Component id="lbUserName" alignment="3" min="-2" pref="20" max="-2" attributes="0"/>
</Group> </Group>
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0"> <Group type="103" groupAlignment="0" attributes="0">
<Component id="lbUserPassword" alignment="3" min="-2" pref="20" max="-2" attributes="0"/> <Component id="jpDbPassword" min="-2" max="-2" attributes="0"/>
<Component id="jpDbPassword" alignment="3" min="-2" max="-2" attributes="0"/> <Component id="lbUserPassword" min="-2" pref="20" max="-2" attributes="0"/>
</Group> </Group>
<EmptySpace min="-2" pref="10" max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="lbFullDbPath" alignment="3" max="32767" attributes="0"/>
<Component id="lbDatabaseDesc" alignment="3" max="32767" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Component id="filler1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group> </Group>
</Group> </Group>
</DimensionLayout> </DimensionLayout>
@ -286,6 +300,30 @@
</Property> </Property>
</Properties> </Properties>
</Component> </Component>
<Component class="javax.swing.JLabel" name="lbDatabaseDesc">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/centralrepository/optionspanel/Bundle.properties" key="EamDbSettingsDialog.lbDatabaseDesc.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="lbFullDbPath">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/centralrepository/optionspanel/Bundle.properties" key="EamDbSettingsDialog.lbFullDbPath.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.Box$Filler" name="filler1">
<Properties>
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[0, 32767]"/>
</Property>
</Properties>
<AuxValues>
<AuxValue name="classDetails" type="java.lang.String" value="Box.Filler.VerticalGlue"/>
</AuxValues>
</Component>
</SubComponents> </SubComponents>
</Container> </Container>
</SubComponents> </SubComponents>

View File

@ -22,6 +22,7 @@ import javax.swing.JTextField;
import javax.swing.SwingUtilities; import javax.swing.SwingUtilities;
import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener; import javax.swing.event.DocumentListener;
import javax.swing.filechooser.FileFilter;
import org.netbeans.spi.options.OptionsPanelController; import org.netbeans.spi.options.OptionsPanelController;
import org.openide.util.NbBundle.Messages; import org.openide.util.NbBundle.Messages;
import org.openide.windows.WindowManager; import org.openide.windows.WindowManager;
@ -76,8 +77,26 @@ public class EamDbSettingsDialog extends JDialog {
} }
initComponents(); initComponents();
fcDatabasePath.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); fcDatabasePath.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
fcDatabasePath.setDialogTitle(Bundle.EamDbSettingsDialog_fcDatabasePath_title()); fcDatabasePath.setAcceptAllFileFilterUsed(false);
fcDatabasePath.setDialogTitle(Bundle.EamDbSettingsDialog_fcDatabasePath_title());
fcDatabasePath.setFileFilter(new FileFilter() {
@Override
public boolean accept(File pathname) {
if (pathname.isDirectory()) {
return true;
} else if (pathname.getName().toLowerCase().equals((CENTRAL_REPO_DB_NAME + CENTRAL_REPO_SQLITE_EXT).toLowerCase())) {
return true;
} else {
return false;
}
}
@Override
public String getDescription() {
return "Directories and Central Repository databases";
}
});
cbDatabaseType.setSelectedItem(selectedPlatform); cbDatabaseType.setSelectedItem(selectedPlatform);
customizeComponents(); customizeComponents();
valid(); valid();
@ -114,6 +133,9 @@ public class EamDbSettingsDialog extends JDialog {
cbDatabaseType = new javax.swing.JComboBox<>(); cbDatabaseType = new javax.swing.JComboBox<>();
lbSingleUserSqLite = new javax.swing.JLabel(); lbSingleUserSqLite = new javax.swing.JLabel();
lbDatabaseType = new javax.swing.JLabel(); lbDatabaseType = new javax.swing.JLabel();
lbDatabaseDesc = new javax.swing.JLabel();
lbFullDbPath = new javax.swing.JLabel();
filler1 = new javax.swing.Box.Filler(new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 32767));
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
@ -185,6 +207,10 @@ public class EamDbSettingsDialog extends JDialog {
org.openide.awt.Mnemonics.setLocalizedText(lbDatabaseType, org.openide.util.NbBundle.getMessage(EamDbSettingsDialog.class, "EamDbSettingsDialog.lbDatabaseType.text")); // NOI18N org.openide.awt.Mnemonics.setLocalizedText(lbDatabaseType, org.openide.util.NbBundle.getMessage(EamDbSettingsDialog.class, "EamDbSettingsDialog.lbDatabaseType.text")); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(lbDatabaseDesc, org.openide.util.NbBundle.getMessage(EamDbSettingsDialog.class, "EamDbSettingsDialog.lbDatabaseDesc.text")); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(lbFullDbPath, org.openide.util.NbBundle.getMessage(EamDbSettingsDialog.class, "EamDbSettingsDialog.lbFullDbPath.text")); // NOI18N
javax.swing.GroupLayout pnSQLiteSettingsLayout = new javax.swing.GroupLayout(pnSQLiteSettings); javax.swing.GroupLayout pnSQLiteSettingsLayout = new javax.swing.GroupLayout(pnSQLiteSettings);
pnSQLiteSettings.setLayout(pnSQLiteSettingsLayout); pnSQLiteSettings.setLayout(pnSQLiteSettingsLayout);
pnSQLiteSettingsLayout.setHorizontalGroup( pnSQLiteSettingsLayout.setHorizontalGroup(
@ -196,11 +222,13 @@ public class EamDbSettingsDialog extends JDialog {
.addComponent(lbPort) .addComponent(lbPort)
.addComponent(lbUserName) .addComponent(lbUserName)
.addComponent(lbDatabaseType, javax.swing.GroupLayout.PREFERRED_SIZE, 82, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(lbDatabaseType, javax.swing.GroupLayout.PREFERRED_SIZE, 82, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(pnSQLiteSettingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(pnSQLiteSettingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(lbDatabasePath) .addComponent(lbDatabasePath, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(lbUserPassword, javax.swing.GroupLayout.Alignment.TRAILING))) .addComponent(lbUserPassword, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addComponent(lbDatabaseDesc, javax.swing.GroupLayout.PREFERRED_SIZE, 78, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(10, 10, 10) .addGap(10, 10, 10)
.addGroup(pnSQLiteSettingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(pnSQLiteSettingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(lbFullDbPath, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(pnSQLiteSettingsLayout.createSequentialGroup() .addGroup(pnSQLiteSettingsLayout.createSequentialGroup()
.addComponent(cbDatabaseType, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(cbDatabaseType, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
@ -211,13 +239,17 @@ public class EamDbSettingsDialog extends JDialog {
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(bnDatabasePathFileOpen) .addComponent(bnDatabasePathFileOpen)
.addGap(11, 11, 11)) .addGap(11, 11, 11))
.addGroup(pnSQLiteSettingsLayout.createSequentialGroup() .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pnSQLiteSettingsLayout.createSequentialGroup()
.addGroup(pnSQLiteSettingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(pnSQLiteSettingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(tbDbHostname) .addComponent(tbDbHostname, javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jpDbPassword) .addComponent(jpDbPassword, javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(tbDbUsername, javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(tbDbUsername)
.addComponent(tbDbPort)) .addComponent(tbDbPort, javax.swing.GroupLayout.Alignment.LEADING))
.addGap(10, 10, 10)))) .addGap(10, 10, 10))))
.addGroup(pnSQLiteSettingsLayout.createSequentialGroup()
.addGap(55, 55, 55)
.addComponent(filler1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, Short.MAX_VALUE))
); );
pnSQLiteSettingsLayout.setVerticalGroup( pnSQLiteSettingsLayout.setVerticalGroup(
pnSQLiteSettingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) pnSQLiteSettingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
@ -233,7 +265,7 @@ public class EamDbSettingsDialog extends JDialog {
.addComponent(lbDatabasePath, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(lbDatabasePath, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(tfDatabasePath, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(tfDatabasePath, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(bnDatabasePathFileOpen)) .addComponent(bnDatabasePathFileOpen))
.addGap(0, 0, 0) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(pnSQLiteSettingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addGroup(pnSQLiteSettingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(tbDbHostname, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(tbDbHostname, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(lbHostName, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(lbHostName, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE))
@ -246,10 +278,16 @@ public class EamDbSettingsDialog extends JDialog {
.addComponent(tbDbUsername, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(tbDbUsername, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(lbUserName, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(lbUserName, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(pnSQLiteSettingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jpDbPassword, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(lbUserPassword, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(pnSQLiteSettingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addGroup(pnSQLiteSettingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(lbUserPassword, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(lbFullDbPath, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jpDbPassword, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(lbDatabaseDesc, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGap(10, 10, 10)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(filler1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
); );
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
@ -268,7 +306,7 @@ public class EamDbSettingsDialog extends JDialog {
.addGroup(layout.createSequentialGroup() .addGroup(layout.createSequentialGroup()
.addGap(10, 10, 10) .addGap(10, 10, 10)
.addComponent(pnSQLiteSettings, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(pnSQLiteSettings, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 11, Short.MAX_VALUE)
.addComponent(pnButtons, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(pnButtons, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(10, 10, 10)) .addGap(10, 10, 10))
); );
@ -307,6 +345,9 @@ public class EamDbSettingsDialog extends JDialog {
fcDatabasePath.setSelectedFile(new File(dbSettingsSqlite.getDbDirectory())); fcDatabasePath.setSelectedFile(new File(dbSettingsSqlite.getDbDirectory()));
if (fcDatabasePath.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) { if (fcDatabasePath.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) {
File databaseFile = fcDatabasePath.getSelectedFile(); File databaseFile = fcDatabasePath.getSelectedFile();
if (databaseFile.isFile()) {
databaseFile = fcDatabasePath.getCurrentDirectory();
}
try { try {
tfDatabasePath.setText(databaseFile.getCanonicalPath()); tfDatabasePath.setText(databaseFile.getCanonicalPath());
valid(); valid();
@ -532,9 +573,15 @@ public class EamDbSettingsDialog extends JDialog {
customizeComponents(); customizeComponents();
}//GEN-LAST:event_cbDatabaseTypeActionPerformed }//GEN-LAST:event_cbDatabaseTypeActionPerformed
private void updateFullDbPath(){
lbFullDbPath.setText(tfDatabasePath.getText() + File.separator + CENTRAL_REPO_DB_NAME + CENTRAL_REPO_SQLITE_EXT);
}
private void displayDatabaseSettings(boolean isPostgres) { private void displayDatabaseSettings(boolean isPostgres) {
lbDatabasePath.setVisible(!isPostgres); lbDatabasePath.setVisible(!isPostgres);
tfDatabasePath.setVisible(!isPostgres); tfDatabasePath.setVisible(!isPostgres);
lbDatabaseDesc.setVisible(!isPostgres);
lbFullDbPath.setVisible(!isPostgres);
lbSingleUserSqLite.setVisible(!isPostgres); lbSingleUserSqLite.setVisible(!isPostgres);
bnDatabasePathFileOpen.setVisible(!isPostgres); bnDatabasePathFileOpen.setVisible(!isPostgres);
lbHostName.setVisible(isPostgres); lbHostName.setVisible(isPostgres);
@ -762,6 +809,7 @@ public class EamDbSettingsDialog extends JDialog {
public void changedUpdate(DocumentEvent e) { public void changedUpdate(DocumentEvent e) {
firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null); firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
testingStatus = DatabaseTestResult.UNTESTED; testingStatus = DatabaseTestResult.UNTESTED;
updateFullDbPath();
valid(); valid();
} }
@ -769,6 +817,7 @@ public class EamDbSettingsDialog extends JDialog {
public void insertUpdate(DocumentEvent e) { public void insertUpdate(DocumentEvent e) {
firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null); firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
testingStatus = DatabaseTestResult.UNTESTED; testingStatus = DatabaseTestResult.UNTESTED;
updateFullDbPath();
valid(); valid();
} }
@ -776,6 +825,7 @@ public class EamDbSettingsDialog extends JDialog {
public void removeUpdate(DocumentEvent e) { public void removeUpdate(DocumentEvent e) {
firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null); firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
testingStatus = DatabaseTestResult.UNTESTED; testingStatus = DatabaseTestResult.UNTESTED;
updateFullDbPath();
valid(); valid();
} }
@ -796,9 +846,12 @@ public class EamDbSettingsDialog extends JDialog {
private javax.swing.JButton bnOk; private javax.swing.JButton bnOk;
private javax.swing.JComboBox<EamDbPlatformEnum> cbDatabaseType; private javax.swing.JComboBox<EamDbPlatformEnum> cbDatabaseType;
private javax.swing.JFileChooser fcDatabasePath; private javax.swing.JFileChooser fcDatabasePath;
private javax.swing.Box.Filler filler1;
private javax.swing.JPasswordField jpDbPassword; private javax.swing.JPasswordField jpDbPassword;
private javax.swing.JLabel lbDatabaseDesc;
private javax.swing.JLabel lbDatabasePath; private javax.swing.JLabel lbDatabasePath;
private javax.swing.JLabel lbDatabaseType; private javax.swing.JLabel lbDatabaseType;
private javax.swing.JLabel lbFullDbPath;
private javax.swing.JLabel lbHostName; private javax.swing.JLabel lbHostName;
private javax.swing.JLabel lbPort; private javax.swing.JLabel lbPort;
private javax.swing.JLabel lbSingleUserSqLite; private javax.swing.JLabel lbSingleUserSqLite;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 13 KiB