/*
* Copyright (c) 2005–2012 Goethe Center for Scientific Computing - Simulation and Modelling (G-CSC Frankfurt)
* Copyright (c) 2012-2015 Goethe Center for Scientific Computing - Computational Neuroscience (G-CSC Frankfurt)
*
* This file is part of NeuGen.
*
* NeuGen is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* as published by the Free Software Foundation.
*
* see: http://opensource.org/licenses/LGPL-3.0
* file://path/to/NeuGen/LICENSE
*
* NeuGen is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* This version of NeuGen includes copyright notice and attribution requirements.
* According to the LGPL this information must be displayed even if you modify
* the source code of NeuGen. The copyright statement/attribution may not be removed.
*
* Attribution Requirements:
*
* If you create derived work you must do the following regarding copyright
* notice and author attribution.
*
* Add an additional notice, stating that you modified NeuGen. In addition
* you must cite the publications listed below. A suitable notice might read
* "NeuGen source code modified by YourName 2012".
*
* Note, that these requirements are in full accordance with the LGPL v3
* (see 7. Additional Terms, b).
*
* Publications:
*
* S. Wolf, S. Grein, G. Queisser. NeuGen 2.0 -
* Employing NeuGen 2.0 to automatically generate realistic
* morphologies of hippocapal neurons and neural networks in 3D.
* Neuroinformatics, 2013, 11(2), pp. 137-148, doi: 10.1007/s12021-012-9170-1
*
*
* J. P. Eberhard, A. Wanner, G. Wittum. NeuGen -
* A tool for the generation of realistic morphology
* of cortical neurons and neural networks in 3D.
* Neurocomputing, 70(1-3), pp. 327-343, doi: 10.1016/j.neucom.2006.01.028
*
*/
/*
* NeuGenProject.java
*
* Created on 04.08.2009, 08:36:39
*/
package org.neugen.gui;
import org.neugen.utils.Utils;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Date;
import java.util.Properties;
import javax.swing.JFileChooser;
import org.apache.log4j.Logger;
import org.neugen.datastructures.Region;
import org.neugen.visual.Utils3D;
/**
* @author sergeiwolf
*/
@SuppressWarnings("serial")
public final class NeuGenProject extends javax.swing.JDialog {
private static final Logger logger = Logger.getLogger(NeuGenProject.class.getName());
private String projectType;
private String dirPath;
private String projectDirectory = null;
/** Creates new form NeuGenProject. //set model, um hippocampus hinzufügen */
public NeuGenProject(java.awt.Frame parent, boolean modal) {
super(parent, modal);
initComponents();
descriptionEditorPane.setEditable(false);
}
public String getProjectDirectory() {
return projectDirectory;
}
/** 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() {
bindingGroup = new org.jdesktop.beansbinding.BindingGroup();
chooseProjectLocation = new javax.swing.JPanel();
nameTextField = new javax.swing.JTextField();
headLabel = new javax.swing.JLabel();
nameLabel = new javax.swing.JLabel();
locationLabel = new javax.swing.JLabel();
folderLabel = new javax.swing.JLabel();
locationTextField = new javax.swing.JTextField();
folderTextField = new javax.swing.JTextField();
changeLocationButton = new javax.swing.JButton();
mainSplitPane = new javax.swing.JSplitPane();
chooseProjectTypePanel = new javax.swing.JPanel();
projectLabel = new javax.swing.JLabel();
descriptionLabel = new javax.swing.JLabel();
projectSubLabel = new javax.swing.JLabel();
descriptionScrollPane = new javax.swing.JScrollPane();
descriptionEditorPane = new javax.swing.JEditorPane();
projectScrollPane = new javax.swing.JScrollPane();
projectList = new javax.swing.JList();
buttonsPanel = new javax.swing.JPanel();
cancelButton = new javax.swing.JButton();
nextButton = new javax.swing.JButton();
backButton = new javax.swing.JButton();
finishButton = new javax.swing.JButton();
chooseProjectLocation.setName("chooseProjectLocation"); // NOI18N
org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(org.neugen.gui.NeuGenApp.class).getContext().getResourceMap(NeuGenProject.class);
nameTextField.setText(resourceMap.getString("nameTextField.text")); // NOI18N
nameTextField.setMaximumSize(new java.awt.Dimension(50, 28));
nameTextField.setName("nameTextField"); // NOI18N
nameTextField.setPreferredSize(new java.awt.Dimension(50, 28));
nameTextField.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyTyped(java.awt.event.KeyEvent evt) {
nameTextFieldKeyTyped(evt);
}
});
headLabel.setText(resourceMap.getString("headLabel.text")); // NOI18N
headLabel.setName("headLabel"); // NOI18N
nameLabel.setText(resourceMap.getString("nameLabel.text")); // NOI18N
nameLabel.setName("nameLabel"); // NOI18N
locationLabel.setText(resourceMap.getString("locationLabel.text")); // NOI18N
locationLabel.setName("locationLabel"); // NOI18N
folderLabel.setText(resourceMap.getString("folderLabel.text")); // NOI18N
folderLabel.setName("folderLabel"); // NOI18N
locationTextField.setText(resourceMap.getString("locationTextField.text")); // NOI18N
locationTextField.setMaximumSize(new java.awt.Dimension(50, 28));
locationTextField.setName("locationTextField"); // NOI18N
locationTextField.setPreferredSize(new java.awt.Dimension(50, 28));
folderTextField.setText(resourceMap.getString("folderTextField.text")); // NOI18N
folderTextField.setMaximumSize(new java.awt.Dimension(50, 28));
folderTextField.setName("folderTextField"); // NOI18N
folderTextField.setPreferredSize(new java.awt.Dimension(50, 28));
changeLocationButton.setText(resourceMap.getString("changeLocationButton.text")); // NOI18N
changeLocationButton.setName("changeLocationButton"); // NOI18N
changeLocationButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
changeLocationButtonActionPerformed(evt);
}
});
javax.swing.GroupLayout chooseProjectLocationLayout = new javax.swing.GroupLayout(chooseProjectLocation);
chooseProjectLocation.setLayout(chooseProjectLocationLayout);
chooseProjectLocationLayout.setHorizontalGroup(
chooseProjectLocationLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(chooseProjectLocationLayout.createSequentialGroup()
.addContainerGap()
.addGroup(chooseProjectLocationLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(headLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 343, Short.MAX_VALUE)
.addGroup(chooseProjectLocationLayout.createSequentialGroup()
.addGroup(chooseProjectLocationLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(locationLabel)
.addComponent(folderLabel)
.addComponent(nameLabel))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(chooseProjectLocationLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(nameTextField, javax.swing.GroupLayout.DEFAULT_SIZE, 225, Short.MAX_VALUE)
.addGroup(chooseProjectLocationLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(folderTextField, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(locationTextField, javax.swing.GroupLayout.DEFAULT_SIZE, 223, Short.MAX_VALUE)))))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(changeLocationButton)
.addGap(32, 32, 32))
);
chooseProjectLocationLayout.setVerticalGroup(
chooseProjectLocationLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(chooseProjectLocationLayout.createSequentialGroup()
.addGap(14, 14, 14)
.addComponent(headLabel)
.addGap(18, 18, 18)
.addGroup(chooseProjectLocationLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(nameLabel)
.addComponent(nameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(chooseProjectLocationLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(locationLabel)
.addComponent(locationTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(changeLocationButton))
.addGap(18, 18, 18)
.addGroup(chooseProjectLocationLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(folderLabel)
.addComponent(folderTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(28, Short.MAX_VALUE))
);
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setName("Form"); // NOI18N
mainSplitPane.setDividerLocation(300);
mainSplitPane.setDividerSize(0);
mainSplitPane.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);
mainSplitPane.setName("mainSplitPane"); // NOI18N
chooseProjectTypePanel.setName("chooseProjectTypePanel"); // NOI18N
projectLabel.setText(resourceMap.getString("projectLabel.text")); // NOI18N
projectLabel.setToolTipText(resourceMap.getString("projectLabel.toolTipText")); // NOI18N
projectLabel.setName("projectLabel"); // NOI18N
descriptionLabel.setText(resourceMap.getString("descriptionLabel.text")); // NOI18N
descriptionLabel.setName("descriptionLabel"); // NOI18N
projectSubLabel.setText(resourceMap.getString("projectSubLabel.text")); // NOI18N
projectSubLabel.setName("projectSubLabel"); // NOI18N
descriptionScrollPane.setName("descriptionScrollPane"); // NOI18N
descriptionEditorPane.setName("descriptionEditorPane"); // NOI18N
descriptionScrollPane.setViewportView(descriptionEditorPane);
projectScrollPane.setToolTipText(resourceMap.getString("projectScrollPane.toolTipText")); // NOI18N
projectScrollPane.setName("projectScrollPane"); // NOI18N
projectList.setModel(new javax.swing.AbstractListModel() {
String[] strings = { "Neocortex", "Hippocampus" };
public int getSize() { return strings.length; }
public Object getElementAt(int i) { return strings[i]; }
});
projectList.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
projectList.setName("projectList"); // NOI18N
projectList.setSelectedIndex(0);
projectList.addMouseListener(new java.awt.event.MouseAdapter() {
public void mousePressed(java.awt.event.MouseEvent evt) {
projectListMousePressed(evt);
}
});
projectList.addFocusListener(new java.awt.event.FocusAdapter() {
public void focusGained(java.awt.event.FocusEvent evt) {
projectListFocusGained(evt);
}
});
projectList.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyPressed(java.awt.event.KeyEvent evt) {
projectListKeyPressed(evt);
}
});
projectScrollPane.setViewportView(projectList);
javax.swing.GroupLayout chooseProjectTypePanelLayout = new javax.swing.GroupLayout(chooseProjectTypePanel);
chooseProjectTypePanel.setLayout(chooseProjectTypePanelLayout);
chooseProjectTypePanelLayout.setHorizontalGroup(
chooseProjectTypePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(chooseProjectTypePanelLayout.createSequentialGroup()
.addContainerGap()
.addGroup(chooseProjectTypePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(projectSubLabel)
.addComponent(projectScrollPane, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 431, Short.MAX_VALUE)
.addComponent(projectLabel, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 431, Short.MAX_VALUE)
.addComponent(descriptionLabel)
.addComponent(descriptionScrollPane))
.addContainerGap())
);
chooseProjectTypePanelLayout.setVerticalGroup(
chooseProjectTypePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(chooseProjectTypePanelLayout.createSequentialGroup()
.addContainerGap()
.addComponent(projectLabel)
.addGap(18, 18, 18)
.addComponent(projectSubLabel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(projectScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(17, 17, 17)
.addComponent(descriptionLabel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(descriptionScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(29, Short.MAX_VALUE))
);
mainSplitPane.setLeftComponent(chooseProjectTypePanel);
buttonsPanel.setName("buttonsPanel"); // NOI18N
cancelButton.setText(resourceMap.getString("cancelButton.text")); // NOI18N
cancelButton.setName("cancelButton"); // NOI18N
cancelButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
cancelButtonActionPerformed(evt);
}
});
nextButton.setText(resourceMap.getString("nextButton.text")); // NOI18N
nextButton.setName("nextButton"); // NOI18N
org.jdesktop.beansbinding.Binding binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, backButton, org.jdesktop.beansbinding.ELProperty.create("${enabled}"), nextButton, org.jdesktop.beansbinding.BeanProperty.create("selected"));
bindingGroup.addBinding(binding);
nextButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
nextButtonActionPerformed(evt);
}
});
backButton.setText(resourceMap.getString("backButton.text")); // NOI18N
backButton.setEnabled(false);
backButton.setName("backButton"); // NOI18N
backButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
backButtonActionPerformed(evt);
}
});
finishButton.setText(resourceMap.getString("finishButton.text")); // NOI18N
finishButton.setEnabled(false);
finishButton.setName("finishButton"); // NOI18N
finishButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
finishButtonActionPerformed(evt);
}
});
javax.swing.GroupLayout buttonsPanelLayout = new javax.swing.GroupLayout(buttonsPanel);
buttonsPanel.setLayout(buttonsPanelLayout);
buttonsPanelLayout.setHorizontalGroup(
buttonsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, buttonsPanelLayout.createSequentialGroup()
.addContainerGap(146, Short.MAX_VALUE)
.addComponent(backButton)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(nextButton)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(finishButton)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(cancelButton)
.addGap(27, 27, 27))
);
buttonsPanelLayout.setVerticalGroup(
buttonsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, buttonsPanelLayout.createSequentialGroup()
.addContainerGap(70, Short.MAX_VALUE)
.addGroup(buttonsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(cancelButton)
.addComponent(backButton)
.addComponent(nextButton)
.addComponent(finishButton))
.addGap(25, 25, 25))
);
mainSplitPane.setRightComponent(buttonsPanel);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(mainSplitPane, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 453, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(mainSplitPane, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 419, Short.MAX_VALUE)
);
bindingGroup.bind();
pack();
}// </editor-fold>//GEN-END:initComponents
private void cancelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancelButtonActionPerformed
this.dispose();
}//GEN-LAST:event_cancelButtonActionPerformed
private void nextButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_nextButtonActionPerformed
Object value = projectList.getSelectedValue();
projectType = value.toString();
nameTextField.setText(projectType);
File projectDir = new File("");
String path = projectDir.getAbsolutePath();
dirPath = path + System.getProperty("file.separator");
locationTextField.setText(path);
String projectPath = dirPath + projectType;
folderTextField.setText(projectPath);
if (!backButton.isEnabled()) {
mainSplitPane.remove(chooseProjectTypePanel);
mainSplitPane.add(chooseProjectLocation);
mainSplitPane.repaint();
backButton.setEnabled(true);
finishButton.setEnabled(true);
nextButton.setEnabled(false);
}
}//GEN-LAST:event_nextButtonActionPerformed
private void finishButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_finishButtonActionPerformed
String projectPath = folderTextField.getText().trim();
logger.info("project path: " + projectPath);
File projectDir = new File(projectPath);
boolean createProject = Utils.fileExists(projectDir);
if (createProject) {
if (projectType.equals(NeuGenConstants.HIPPOCAMPUS_PROJECT)) {
String sourcePath = NeuGenConstants.CONFIG_DIR + System.getProperty("file.separator") + NeuGenConstants.HIPPOCAMPUS_PROJECT.toLowerCase();
File sourceDir = new File(sourcePath);
//logger.info(projectType.toLowerCase() + ", path: " + sourceDir.getPath());
try {
Utils.copyDir(sourceDir, projectDir);
Properties prop = getProjectProp(projectPath);
OutputStream out = new FileOutputStream(projectPath + System.getProperty("file.separator") + NeuGenConstants.NEUGEN_PROJECT_FILE);
prop.storeToXML(out, "NeuGen project directory ", "UTF8");
out.close();
Region.setCortColumn(false);
Region.setCa1Region(true);
} catch (FileNotFoundException ex) {
logger.error(ex);
} catch (IOException ex) {
logger.error(ex);
}
} else if (projectType.equals(NeuGenConstants.NEOCORTEX_PROJECT)) {
String sourcePath = NeuGenConstants.CONFIG_DIR + System.getProperty("file.separator") + NeuGenConstants.NEOCORTEX_PROJECT.toLowerCase();
logger.info("source path: " + sourcePath);
logger.info("project path: " + projectDir.getPath());
File sourceDir = new File(sourcePath);
logger.info(projectType.toLowerCase() + ", path: " + sourceDir.getPath());
try {
Utils.copyDir(sourceDir, projectDir);
Properties prop = getProjectProp(projectPath);
OutputStream out = new FileOutputStream(projectPath + System.getProperty("file.separator") + NeuGenConstants.NEUGEN_PROJECT_FILE);
prop.storeToXML(out, "NeuGen project directory ", "UTF8");
out.close();
Region.setCortColumn(true);
Region.setCa1Region(false);
} catch (FileNotFoundException ex) {
logger.error(ex);
} catch (IOException ex) {
logger.error(ex);
}
}
projectDirectory = projectPath;
}
//logger.info("project directory: " + projectDirectory);
//logger.info("projectDir: " + this.dirPath);
this.dispose();
}//GEN-LAST:event_finishButtonActionPerformed
public Properties getProjectProp(String projectPath) {
Properties prop = new Properties();
String filePath = projectPath + System.getProperty("file.separator") + NeuGenConstants.NEUGEN_PROJECT_FILE;
File projectInfoFile = new File(filePath);
try {
InputStream is = new FileInputStream(projectInfoFile);
try {
prop.loadFromXML(is);
} catch (IOException ex) {
logger.error(ex);
}
} catch (FileNotFoundException ex) {
logger.error(ex);
}
prop.setProperty(NeuGenConstants.PROP_DATE_KEY, (new Date().toString()));
prop.setProperty(NeuGenConstants.PROP_PROJECT_NAME_KEY, projectType);
String projectName = new File(projectPath).getName();
prop.setProperty(projectName, prop.getProperty(NeuGenConstants.PROPERTIES_KEY));
return prop;
}
private void backButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_backButtonActionPerformed
if (!nextButton.isEnabled()) {
mainSplitPane.remove(chooseProjectLocation);
mainSplitPane.add(chooseProjectTypePanel);
mainSplitPane.repaint();
backButton.setEnabled(false);
finishButton.setEnabled(false);
nextButton.setEnabled(true);
}
}//GEN-LAST:event_backButtonActionPerformed
private void changeLocationButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_changeLocationButtonActionPerformed
JFileChooser fch = new JFileChooser("");
fch.setDialogTitle("Create Project");
fch.resetChoosableFileFilters();
fch.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
int fileChooserOption = 0;
fileChooserOption = fch.showOpenDialog(this);
//fileChooserOption = fch.showDialog(this, "Create Project");
if (fileChooserOption == JFileChooser.APPROVE_OPTION) {
String path = fch.getSelectedFile().getPath();
locationTextField.setText(path);
dirPath = path + System.getProperty("file.separator");
String projectPath = dirPath + projectType;
folderTextField.setText(projectPath);
}
}//GEN-LAST:event_changeLocationButtonActionPerformed
private void nameTextFieldKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_nameTextFieldKeyTyped
//System.out.println(nameTextField.getText() + evt.getKeyChar());
folderTextField.setText(dirPath + nameTextField.getText() + evt.getKeyChar());
}//GEN-LAST:event_nameTextFieldKeyTyped
private void projectListMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_projectListMousePressed
Object value = projectList.getSelectedValue();
if (value != null) {
//logger.info(value.toString());
projectDescription(value.toString());
}
}//GEN-LAST:event_projectListMousePressed
private void projectListKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_projectListKeyPressed
Object value = projectList.getSelectedValue();
if (value != null) {
projectDescription(value.toString());
}
}//GEN-LAST:event_projectListKeyPressed
private void projectListFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_projectListFocusGained
Object value = projectList.getSelectedValue();
if (value != null) {
projectDescription(value.toString());
}
}//GEN-LAST:event_projectListFocusGained
public void projectDescription(String command) {
if (command.equals(NeuGenConstants.HIPPOCAMPUS_PROJECT)) {
descriptionEditorPane.setText(NeuGenConstants.HIPPOCAMPUT_DESCRIPTION);
} else if (command.equals(NeuGenConstants.NEOCORTEX_PROJECT)) {
descriptionEditorPane.setText(NeuGenConstants.NEOCOREX_DESCRIPTION);
}
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton backButton;
private javax.swing.JPanel buttonsPanel;
private javax.swing.JButton cancelButton;
private javax.swing.JButton changeLocationButton;
private javax.swing.JPanel chooseProjectLocation;
private javax.swing.JPanel chooseProjectTypePanel;
private javax.swing.JEditorPane descriptionEditorPane;
private javax.swing.JLabel descriptionLabel;
private javax.swing.JScrollPane descriptionScrollPane;
private javax.swing.JButton finishButton;
private javax.swing.JLabel folderLabel;
private javax.swing.JTextField folderTextField;
private javax.swing.JLabel headLabel;
private javax.swing.JLabel locationLabel;
private javax.swing.JTextField locationTextField;
private javax.swing.JSplitPane mainSplitPane;
private javax.swing.JLabel nameLabel;
private javax.swing.JTextField nameTextField;
private javax.swing.JButton nextButton;
private javax.swing.JLabel projectLabel;
private javax.swing.JList projectList;
private javax.swing.JScrollPane projectScrollPane;
private javax.swing.JLabel projectSubLabel;
private org.jdesktop.beansbinding.BindingGroup bindingGroup;
// End of variables declaration//GEN-END:variables
public String getProjectName() {
return projectType;
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
NeuGenProject dialog = new NeuGenProject(new javax.swing.JFrame(), true);
dialog.addWindowListener(new java.awt.event.WindowAdapter() {
@Override
public void windowClosing(java.awt.event.WindowEvent e) {
// System.exit(0);
}
});
dialog.setVisible(true);
}
});
}
}