-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
user selects the db properties file when MIPMap starts
- Loading branch information
Showing
10 changed files
with
297 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
,kostis,kostis-lab-pc,14.04.2020 17:40,file:///home/kostis/.config/libreoffice/4; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
,kostis,kostis-lab-pc,29.04.2020 18:08,file:///home/kostis/.config/libreoffice/4; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 67 additions & 0 deletions
67
MIPMapGUI/mipmapgui/src/it/unibas/spicygui/DBPropertiesChooserJFrame.form
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
|
||
<Form version="1.5" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JFrameFormInfo"> | ||
<Properties> | ||
<Property name="defaultCloseOperation" type="int" value="3"/> | ||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> | ||
<Dimension value="[500, 450]"/> | ||
</Property> | ||
</Properties> | ||
<SyntheticProperties> | ||
<SyntheticProperty name="formSizePolicy" type="int" value="1"/> | ||
<SyntheticProperty name="generateCenter" type="boolean" value="false"/> | ||
</SyntheticProperties> | ||
<AuxValues> | ||
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/> | ||
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/> | ||
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/> | ||
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="true"/> | ||
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/> | ||
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/> | ||
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/> | ||
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/> | ||
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/> | ||
</AuxValues> | ||
|
||
<Layout> | ||
<DimensionLayout dim="0"> | ||
<Group type="103" groupAlignment="0" attributes="0"> | ||
<Group type="102" alignment="1" attributes="0"> | ||
<EmptySpace pref="78" max="32767" attributes="0"/> | ||
<Component id="jFileChooser1" min="-2" max="-2" attributes="0"/> | ||
<EmptySpace min="-2" pref="66" max="-2" attributes="0"/> | ||
</Group> | ||
<Group type="102" alignment="0" attributes="0"> | ||
<EmptySpace min="-2" pref="92" max="-2" attributes="0"/> | ||
<Component id="jLabel1" min="-2" max="-2" attributes="0"/> | ||
<EmptySpace max="32767" attributes="0"/> | ||
</Group> | ||
</Group> | ||
</DimensionLayout> | ||
<DimensionLayout dim="1"> | ||
<Group type="103" groupAlignment="0" attributes="0"> | ||
<Group type="102" alignment="1" attributes="0"> | ||
<EmptySpace pref="68" max="32767" attributes="0"/> | ||
<Component id="jLabel1" min="-2" max="-2" attributes="0"/> | ||
<EmptySpace type="separate" max="-2" attributes="0"/> | ||
<Component id="jFileChooser1" min="-2" max="-2" attributes="0"/> | ||
<EmptySpace min="-2" pref="66" max="-2" attributes="0"/> | ||
</Group> | ||
</Group> | ||
</DimensionLayout> | ||
</Layout> | ||
<SubComponents> | ||
<Component class="javax.swing.JFileChooser" name="jFileChooser1"> | ||
<Events> | ||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jFileChooser1ActionPerformed"/> | ||
</Events> | ||
</Component> | ||
<Component class="javax.swing.JLabel" name="jLabel1"> | ||
<Properties> | ||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> | ||
<ResourceString bundle="it/unibas/spicygui/Bundle.properties" key="DBPropertiesChooserJFrame.jLabel1.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/> | ||
</Property> | ||
</Properties> | ||
</Component> | ||
</SubComponents> | ||
</Form> |
159 changes: 159 additions & 0 deletions
159
MIPMapGUI/mipmapgui/src/it/unibas/spicygui/DBPropertiesChooserJFrame.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,159 @@ | ||
/* | ||
* To change this license header, choose License Headers in Project Properties. | ||
* To change this template file, choose Tools | Templates | ||
* and open the template in the editor. | ||
*/ | ||
package it.unibas.spicygui; | ||
|
||
import it.unibas.spicygui.vista.Vista; | ||
import java.io.File; | ||
import java.sql.Timestamp; | ||
import javax.swing.JFileChooser; | ||
import javax.swing.filechooser.FileNameExtensionFilter; | ||
import org.openide.util.Lookup; | ||
import org.openide.windows.WindowManager; | ||
|
||
/** | ||
* | ||
* @author kostis | ||
*/ | ||
public class DBPropertiesChooserJFrame extends javax.swing.JFrame { | ||
private Vista vista; | ||
private String dbPropertiesFile; | ||
private Installer installer; | ||
private int returnVal; | ||
/** | ||
* Creates new form DBPropertiesChooserJFrame | ||
*/ | ||
public DBPropertiesChooserJFrame(Installer inst) { | ||
System.out.println("~~~ This is the DBPropertiesChooserJFrame constructor ~~~"); | ||
executeInjection(); | ||
initComponents(); | ||
this.installer = inst; | ||
setFileChooserProperties(); | ||
System.out.println("~~~ We done initializing and preparing swing components!! ~~~"); | ||
} | ||
|
||
//kostisk | ||
public void setFileChooserProperties() { | ||
this.jFileChooser1.resetChoosableFileFilters(); | ||
this.jFileChooser1.setDialogType(JFileChooser.SAVE_DIALOG); | ||
this.jFileChooser1.setFileFilter(new FileNameExtensionFilter("PROPERTIES FILE", "properties")); | ||
this.jFileChooser1.setFileSelectionMode(JFileChooser.FILES_ONLY); | ||
//return fileChooser; | ||
} | ||
|
||
private void executeInjection() { | ||
/*if (this.modello == null) { | ||
this.modello = Lookup.getDefault().lookup(Modello.class); | ||
}*/ | ||
if (this.vista == null) { | ||
this.vista = Lookup.getDefault().lookup(Vista.class); | ||
} | ||
} | ||
|
||
/** | ||
* 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") | ||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents | ||
private void initComponents() { | ||
|
||
jFileChooser1 = new javax.swing.JFileChooser(); | ||
jLabel1 = new javax.swing.JLabel(); | ||
|
||
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); | ||
setMinimumSize(new java.awt.Dimension(500, 450)); | ||
|
||
jFileChooser1.addActionListener(new java.awt.event.ActionListener() { | ||
public void actionPerformed(java.awt.event.ActionEvent evt) { | ||
jFileChooser1ActionPerformed(evt); | ||
} | ||
}); | ||
|
||
org.openide.awt.Mnemonics.setLocalizedText(jLabel1, org.openide.util.NbBundle.getMessage(DBPropertiesChooserJFrame.class, "DBPropertiesChooserJFrame.jLabel1.text")); // NOI18N | ||
|
||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); | ||
getContentPane().setLayout(layout); | ||
layout.setHorizontalGroup( | ||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | ||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() | ||
.addContainerGap(78, Short.MAX_VALUE) | ||
.addComponent(jFileChooser1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) | ||
.addGap(66, 66, 66)) | ||
.addGroup(layout.createSequentialGroup() | ||
.addGap(92, 92, 92) | ||
.addComponent(jLabel1) | ||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) | ||
); | ||
layout.setVerticalGroup( | ||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | ||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() | ||
.addContainerGap(68, Short.MAX_VALUE) | ||
.addComponent(jLabel1) | ||
.addGap(18, 18, 18) | ||
.addComponent(jFileChooser1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) | ||
.addGap(66, 66, 66)) | ||
); | ||
|
||
pack(); | ||
}// </editor-fold>//GEN-END:initComponents | ||
|
||
private void jFileChooser1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jFileChooser1ActionPerformed | ||
// TODO add your handling code here: | ||
//this.returnVal = jFileChooser1.showOpenDialog(WindowManager.getDefault().getMainWindow()); | ||
|
||
if (returnVal == jFileChooser1.APPROVE_OPTION) { | ||
File file = jFileChooser1.getSelectedFile(); | ||
this.dbPropertiesFile=file.getAbsolutePath(); | ||
this.installer.setPostgresDbConfFile(this.dbPropertiesFile); | ||
this.installer.configureDatabaseProperties(); | ||
this.installer.createDB(); | ||
java.util.Date date2= new java.util.Date(); | ||
System.out.println("~~~ MIPMap done loading: "+new Timestamp(date2.getTime())+" ~~~"); | ||
this.dispose(); | ||
} | ||
}//GEN-LAST:event_jFileChooser1ActionPerformed | ||
|
||
/** | ||
* @param args the command line arguments | ||
*/ | ||
public static void main(String args[]) { | ||
/* Set the Nimbus look and feel */ | ||
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> | ||
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. | ||
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html | ||
*/ | ||
try { | ||
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { | ||
if ("Metal".equals(info.getName())) { | ||
javax.swing.UIManager.setLookAndFeel(info.getClassName()); | ||
break; | ||
} | ||
} | ||
} catch (ClassNotFoundException ex) { | ||
java.util.logging.Logger.getLogger(DBPropertiesChooserJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); | ||
} catch (InstantiationException ex) { | ||
java.util.logging.Logger.getLogger(DBPropertiesChooserJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); | ||
} catch (IllegalAccessException ex) { | ||
java.util.logging.Logger.getLogger(DBPropertiesChooserJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); | ||
} catch (javax.swing.UnsupportedLookAndFeelException ex) { | ||
java.util.logging.Logger.getLogger(DBPropertiesChooserJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); | ||
} | ||
//</editor-fold> | ||
|
||
/* Create and display the form */ | ||
java.awt.EventQueue.invokeLater(new Runnable() { | ||
public void run() { | ||
//new DBPropertiesChooserJFrame().setVisible(true); | ||
} | ||
}); | ||
} | ||
|
||
// Variables declaration - do not modify//GEN-BEGIN:variables | ||
private javax.swing.JFileChooser jFileChooser1; | ||
private javax.swing.JLabel jLabel1; | ||
// End of variables declaration//GEN-END:variables | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.