Update User Panels
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
|
||||
import ch.psi.pshell.ui.Panel;
|
||||
import ch.psi.utils.State;
|
||||
import ch.psi.utils.swing.SwingUtils;
|
||||
import java.io.IOException;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
@@ -10,95 +12,134 @@ import javax.swing.SwingUtilities;
|
||||
*/
|
||||
public class Experiment extends Panel {
|
||||
|
||||
//static String DEFAULT_PATH = "{data}/{year}_{month}/{date}_{seq}%03d";
|
||||
static String DEFAULT_PATH = "{data}/{year}_{month}/{date}/{date}_{seq}%04d_{name}";
|
||||
|
||||
public Experiment() {
|
||||
initComponents();
|
||||
updateRsync();
|
||||
}
|
||||
|
||||
//Overridable callbacks
|
||||
@Override
|
||||
public void onInitialize(int runCount) {
|
||||
SwingUtilities.invokeLater(()->{
|
||||
SwingUtilities.invokeLater(() -> {
|
||||
undo();
|
||||
});
|
||||
});
|
||||
textNamePattern.setText(getContext().getConfig().dataPath);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStateChange(State state, State former) {
|
||||
|
||||
updateControls();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onExecutedFile(String fileName, Object result) {
|
||||
}
|
||||
|
||||
|
||||
//Callback to perform update - in event thread
|
||||
@Override
|
||||
protected void doUpdate() {
|
||||
}
|
||||
|
||||
|
||||
void undo(){
|
||||
void undo() {
|
||||
try {
|
||||
textDataRoot.setText(getContext().getSetup().expandPath("{data}"));
|
||||
textDataPath.setText(getContext().getConfig().dataPath);
|
||||
|
||||
textDataPath.setText(getContext().getSetup().expandPath(getContext().getConfig().dataPath));
|
||||
textPGroup.setText(getContext().getSetting("pgroup") == null ? "" : getContext().getSetting("pgroup"));
|
||||
textProposal.setText(getContext().getSetting("proposal") == null ? "" : getContext().getSetting("proposal"));
|
||||
textProposer.setText(getContext().getSetting("proposer") == null ? "" : getContext().getSetting("proposer"));
|
||||
textSamples.setText(getContext().getSetting("sample") == null ? "" : getContext().getSetting("sample"));
|
||||
textAuthors.setText(getContext().getSetting("authors") == null ? "" : getContext().getSetting("authors").replace("|", "\n"));
|
||||
textPrefix.setText(getContext().getSetting("prefix") == null ? "" : getContext().getSetting("prefix"));
|
||||
} catch (Exception ex) {
|
||||
Logger.getLogger(Experiment.class.getName()).log(Level.SEVERE, null, ex);
|
||||
getLogger().log(Level.SEVERE, null, ex);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
void apply(){
|
||||
|
||||
|
||||
void apply() {
|
||||
|
||||
try {
|
||||
String proposal = textProposal.getText().trim();
|
||||
String pgroup = textPGroup.getText().trim();
|
||||
String proposer = textProposer.getText().trim();
|
||||
String samples = textSamples.getText().trim();
|
||||
String authors = textAuthors.getText().trim().replace("\n","|");
|
||||
String prefix = textPrefix.getText().trim();
|
||||
|
||||
String authors = textAuthors.getText().trim().replace("\n", "|");
|
||||
|
||||
getContext().setSetting("pgroup", pgroup);
|
||||
getContext().setSetting("proposal", proposal);
|
||||
getContext().setSetting("proposer", proposer);
|
||||
getContext().setSetting("sample", samples);
|
||||
getContext().setSetting("authors", authors);
|
||||
getContext().setSetting("prefix", prefix);
|
||||
|
||||
getContext().getConfig().dataPath = "{data}/{year}/{month}/" +
|
||||
(proposer.isEmpty() ? "bl-dev" : proposer) + "/" +
|
||||
(prefix.isEmpty() ? "pshell" : prefix) + "-{date}-{time}-{name}";
|
||||
getContext().getConfig().save();
|
||||
|
||||
|
||||
} catch (Exception ex) {
|
||||
Logger.getLogger(Experiment.class.getName()).log(Level.SEVERE, null, ex);
|
||||
getLogger().log(Level.SEVERE, null, ex);
|
||||
}
|
||||
undo();
|
||||
}
|
||||
|
||||
void reset(){
|
||||
|
||||
|
||||
void reset() {
|
||||
|
||||
try {
|
||||
textProposal.setText("");
|
||||
textPGroup.setText("");
|
||||
textProposer.setText("");
|
||||
textSamples.setText("");
|
||||
textAuthors.setText("");
|
||||
textPrefix.setText("");
|
||||
apply();
|
||||
apply();
|
||||
} catch (Exception ex) {
|
||||
Logger.getLogger(Experiment.class.getName()).log(Level.SEVERE, null, ex);
|
||||
getLogger().log(Level.SEVERE, null, ex);
|
||||
}
|
||||
undo();
|
||||
}
|
||||
|
||||
|
||||
boolean updatingRsync;
|
||||
|
||||
void updateRsync() {
|
||||
try {
|
||||
updatingRsync = true;
|
||||
String user = null;
|
||||
String host = null;
|
||||
String path = null;
|
||||
String remove = null;
|
||||
try {
|
||||
user = getSetting("RSYNC_USER");
|
||||
host = getSetting("RSYNC_HOST");
|
||||
path = getSetting("RSYNC_PATH");
|
||||
remove = getSetting("RSYNC_DEL");
|
||||
} catch (IOException ex) {
|
||||
}
|
||||
boolean enabled = ((user != null) && (!user.trim().isEmpty()));
|
||||
textRsyncUser.setText(enabled ? user : "");
|
||||
textRsyncHost.setText(enabled ? host : "");
|
||||
textRsyncPath.setText((enabled && (path != null)) ? path : "");
|
||||
checkRsyncRemove.setSelected((remove==null) ? false : remove.toLowerCase().equals("true"));
|
||||
checkRsyncEnable.setSelected(enabled);
|
||||
textRsyncUser.setEnabled(!enabled);
|
||||
textRsyncHost.setEnabled(!enabled);
|
||||
//textRsyncPath.setEnabled(!enabled);
|
||||
buttonUndoFolder.setEnabled(false);
|
||||
buttonSetFolder.setEnabled(false);
|
||||
|
||||
} finally {
|
||||
updatingRsync = false;
|
||||
}
|
||||
}
|
||||
|
||||
void updateControls() {
|
||||
boolean editable = getState().isInitialized() && !getState().isProcessing();
|
||||
textNamePattern.setEnabled(editable);
|
||||
spinnerSeq.setEnabled(editable);
|
||||
buttonDefaultPath.setEnabled(editable && !textNamePattern.getText().equals(DEFAULT_PATH));
|
||||
buttonSetPath.setEnabled(editable && !textNamePattern.getText().equals(getContext().getConfig().dataPath));
|
||||
buttonUndoPath.setEnabled(editable && !textNamePattern.getText().equals(getContext().getConfig().dataPath));
|
||||
buttonSetSeq.setEnabled(editable && !spinnerSeq.getValue().equals(getContext().getFileSequentialNumber()));
|
||||
buttonUndoSeq.setEnabled(editable && !spinnerSeq.getValue().equals(getContext().getFileSequentialNumber()));
|
||||
buttonApply.setEnabled(editable);
|
||||
|
||||
spinnerSeq.setValue(getContext().getFileSequentialNumber());
|
||||
textDataPath.setText(getContext().getSetup().expandPath(getContext().getConfig().dataPath));
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
@@ -116,16 +157,32 @@ public class Experiment extends Panel {
|
||||
jLabel7 = new javax.swing.JLabel();
|
||||
jScrollPane1 = new javax.swing.JScrollPane();
|
||||
textAuthors = new javax.swing.JTextArea();
|
||||
jLabel8 = new javax.swing.JLabel();
|
||||
textPrefix = new javax.swing.JTextField();
|
||||
jPanel2 = new javax.swing.JPanel();
|
||||
jLabel1 = new javax.swing.JLabel();
|
||||
jLabel2 = new javax.swing.JLabel();
|
||||
textDataRoot = new javax.swing.JTextField();
|
||||
textDataPath = new javax.swing.JTextField();
|
||||
buttonApply = new javax.swing.JButton();
|
||||
buttonUndo = new javax.swing.JButton();
|
||||
buttonClear = new javax.swing.JButton();
|
||||
panelDataFile = new javax.swing.JPanel();
|
||||
buttonSetSeq = new javax.swing.JButton();
|
||||
buttonUndoSeq = new javax.swing.JButton();
|
||||
buttonDefaultPath = new javax.swing.JButton();
|
||||
buttonSetPath = new javax.swing.JButton();
|
||||
buttonUndoPath = new javax.swing.JButton();
|
||||
jLabel9 = new javax.swing.JLabel();
|
||||
spinnerSeq = new javax.swing.JSpinner();
|
||||
textNamePattern = new javax.swing.JTextField();
|
||||
jLabel10 = new javax.swing.JLabel();
|
||||
jLabel2 = new javax.swing.JLabel();
|
||||
textDataPath = new javax.swing.JTextField();
|
||||
jPanel6 = new javax.swing.JPanel();
|
||||
jLabel11 = new javax.swing.JLabel();
|
||||
textRsyncUser = new javax.swing.JTextField();
|
||||
jLabel18 = new javax.swing.JLabel();
|
||||
textRsyncPath = new javax.swing.JTextField();
|
||||
checkRsyncEnable = new javax.swing.JCheckBox();
|
||||
buttonSetFolder = new javax.swing.JButton();
|
||||
jLabel12 = new javax.swing.JLabel();
|
||||
textRsyncHost = new javax.swing.JTextField();
|
||||
checkRsyncRemove = new javax.swing.JCheckBox();
|
||||
buttonUndoFolder = new javax.swing.JButton();
|
||||
|
||||
jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Metadata"));
|
||||
|
||||
@@ -149,112 +206,60 @@ public class Experiment extends Panel {
|
||||
jLabel7.setText("Authors:");
|
||||
|
||||
textAuthors.setColumns(20);
|
||||
textAuthors.setRows(5);
|
||||
textAuthors.setRows(4);
|
||||
jScrollPane1.setViewportView(textAuthors);
|
||||
|
||||
jLabel8.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
|
||||
jLabel8.setText("File Prefix:");
|
||||
|
||||
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
|
||||
jPanel1.setLayout(jPanel1Layout);
|
||||
jPanel1Layout.setHorizontalGroup(
|
||||
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel1Layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
|
||||
.addComponent(jLabel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(jLabel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(jLabel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(jLabel6, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(jLabel7, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(jLabel8, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jLabel5, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(jLabel4, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(jLabel3, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(textPrefix)
|
||||
.addComponent(textSamples)
|
||||
.addComponent(textProposer, javax.swing.GroupLayout.DEFAULT_SIZE, 547, Short.MAX_VALUE)
|
||||
.addComponent(jScrollPane1)
|
||||
.addComponent(textPGroup, javax.swing.GroupLayout.DEFAULT_SIZE, 221, Short.MAX_VALUE)
|
||||
.addComponent(textProposal)
|
||||
.addComponent(textPGroup))
|
||||
.addComponent(textProposer))
|
||||
.addGap(40, 40, 40)
|
||||
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
|
||||
.addComponent(jLabel6, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(jLabel7, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(textSamples, javax.swing.GroupLayout.DEFAULT_SIZE, 222, Short.MAX_VALUE)
|
||||
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 222, Short.MAX_VALUE))
|
||||
.addContainerGap())
|
||||
);
|
||||
|
||||
jPanel1Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {jLabel3, jLabel4, jLabel5, jLabel6, jLabel7, jLabel8});
|
||||
jPanel1Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {jLabel3, jLabel4, jLabel5, jLabel6, jLabel7});
|
||||
|
||||
jPanel1Layout.setVerticalGroup(
|
||||
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel1Layout.createSequentialGroup()
|
||||
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(textPrefix, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addContainerGap()
|
||||
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(textProposer, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(textProposal, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(textPGroup, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(textProposer, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(textSamples, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel1Layout.createSequentialGroup()
|
||||
.addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(0, 43, Short.MAX_VALUE))
|
||||
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE))
|
||||
.addContainerGap())
|
||||
);
|
||||
|
||||
jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("Data Location"));
|
||||
|
||||
jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
|
||||
jLabel1.setText("Root:");
|
||||
|
||||
jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
|
||||
jLabel2.setText("Path:");
|
||||
|
||||
textDataRoot.setDisabledTextColor(javax.swing.UIManager.getDefaults().getColor("TextField.foreground"));
|
||||
textDataRoot.setEnabled(false);
|
||||
|
||||
textDataPath.setDisabledTextColor(javax.swing.UIManager.getDefaults().getColor("TextField.foreground"));
|
||||
textDataPath.setEnabled(false);
|
||||
|
||||
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
|
||||
jPanel2.setLayout(jPanel2Layout);
|
||||
jPanel2Layout.setHorizontalGroup(
|
||||
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel2Layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jLabel2)
|
||||
.addComponent(jLabel1))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(textDataRoot)
|
||||
.addComponent(textDataPath))
|
||||
.addContainerGap())
|
||||
);
|
||||
|
||||
jPanel2Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {jLabel1, jLabel2});
|
||||
|
||||
jPanel2Layout.setVerticalGroup(
|
||||
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel2Layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(jLabel1)
|
||||
.addComponent(textDataRoot, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(textDataPath, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(textProposal, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(textPGroup, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
|
||||
.addGroup(jPanel1Layout.createSequentialGroup()
|
||||
.addComponent(jScrollPane1)
|
||||
.addGap(5, 5, 5)))
|
||||
.addContainerGap())
|
||||
);
|
||||
|
||||
@@ -279,12 +284,247 @@ public class Experiment extends Panel {
|
||||
}
|
||||
});
|
||||
|
||||
panelDataFile.setBorder(javax.swing.BorderFactory.createTitledBorder("Data Location"));
|
||||
|
||||
buttonSetSeq.setText("Save");
|
||||
buttonSetSeq.setEnabled(false);
|
||||
buttonSetSeq.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
buttonSetSeqActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
buttonUndoSeq.setText("Undo");
|
||||
buttonUndoSeq.setEnabled(false);
|
||||
buttonUndoSeq.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
buttonUndoSeqActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
buttonDefaultPath.setText("Default");
|
||||
buttonDefaultPath.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
buttonDefaultPathActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
buttonSetPath.setText("Save");
|
||||
buttonSetPath.setEnabled(false);
|
||||
buttonSetPath.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
buttonSetPathActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
buttonUndoPath.setText("Undo");
|
||||
buttonUndoPath.setEnabled(false);
|
||||
buttonUndoPath.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
buttonUndoPathActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
jLabel9.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
|
||||
jLabel9.setText("Sequential:");
|
||||
|
||||
spinnerSeq.setModel(new javax.swing.SpinnerNumberModel(0, 0, 99999, 1));
|
||||
spinnerSeq.addChangeListener(new javax.swing.event.ChangeListener() {
|
||||
public void stateChanged(javax.swing.event.ChangeEvent evt) {
|
||||
spinnerSeqStateChanged(evt);
|
||||
}
|
||||
});
|
||||
|
||||
textNamePattern.addKeyListener(new java.awt.event.KeyAdapter() {
|
||||
public void keyTyped(java.awt.event.KeyEvent evt) {
|
||||
textNamePatternKeyTyped(evt);
|
||||
}
|
||||
public void keyReleased(java.awt.event.KeyEvent evt) {
|
||||
textNamePatternKeyReleased(evt);
|
||||
}
|
||||
});
|
||||
|
||||
jLabel10.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
|
||||
jLabel10.setText("Name Pattern:");
|
||||
|
||||
jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
|
||||
jLabel2.setText("Path:");
|
||||
|
||||
textDataPath.setDisabledTextColor(javax.swing.UIManager.getDefaults().getColor("TextField.foreground"));
|
||||
textDataPath.setEnabled(false);
|
||||
|
||||
javax.swing.GroupLayout panelDataFileLayout = new javax.swing.GroupLayout(panelDataFile);
|
||||
panelDataFile.setLayout(panelDataFileLayout);
|
||||
panelDataFileLayout.setHorizontalGroup(
|
||||
panelDataFileLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(panelDataFileLayout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(panelDataFileLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(panelDataFileLayout.createSequentialGroup()
|
||||
.addGroup(panelDataFileLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addComponent(jLabel10)
|
||||
.addComponent(jLabel9))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(panelDataFileLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(panelDataFileLayout.createSequentialGroup()
|
||||
.addComponent(spinnerSeq, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(buttonSetSeq)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(buttonUndoSeq)
|
||||
.addGap(0, 0, Short.MAX_VALUE))
|
||||
.addComponent(textNamePattern))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addGroup(panelDataFileLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addGroup(panelDataFileLayout.createSequentialGroup()
|
||||
.addComponent(buttonSetPath)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(buttonUndoPath))
|
||||
.addComponent(buttonDefaultPath)))
|
||||
.addGroup(panelDataFileLayout.createSequentialGroup()
|
||||
.addGap(54, 54, 54)
|
||||
.addComponent(jLabel2)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(textDataPath)))
|
||||
.addContainerGap())
|
||||
);
|
||||
|
||||
panelDataFileLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {buttonDefaultPath, buttonSetPath, buttonUndoPath});
|
||||
|
||||
panelDataFileLayout.setVerticalGroup(
|
||||
panelDataFileLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(panelDataFileLayout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(panelDataFileLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(jLabel10)
|
||||
.addComponent(textNamePattern, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(buttonSetPath)
|
||||
.addComponent(buttonUndoPath))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(panelDataFileLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(jLabel9)
|
||||
.addComponent(spinnerSeq, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(buttonSetSeq)
|
||||
.addComponent(buttonUndoSeq)
|
||||
.addComponent(buttonDefaultPath))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addGroup(panelDataFileLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(textDataPath, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addContainerGap())
|
||||
);
|
||||
|
||||
jPanel6.setBorder(javax.swing.BorderFactory.createTitledBorder("Data Transfer"));
|
||||
|
||||
jLabel11.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
|
||||
jLabel11.setText("User:");
|
||||
|
||||
jLabel18.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
|
||||
jLabel18.setText("Destination Folder:");
|
||||
|
||||
textRsyncPath.addKeyListener(new java.awt.event.KeyAdapter() {
|
||||
public void keyReleased(java.awt.event.KeyEvent evt) {
|
||||
textRsyncPathKeyReleased(evt);
|
||||
}
|
||||
});
|
||||
|
||||
checkRsyncEnable.setText("Enable");
|
||||
checkRsyncEnable.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
checkRsyncEnableActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
buttonSetFolder.setText("Set");
|
||||
buttonSetFolder.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
buttonSetFolderActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
jLabel12.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
|
||||
jLabel12.setText("Host:");
|
||||
|
||||
checkRsyncRemove.setText("Remove local files after transfer");
|
||||
checkRsyncRemove.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
checkRsyncRemoveActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
buttonUndoFolder.setText("Undo");
|
||||
buttonUndoFolder.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
buttonUndoFolderActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6);
|
||||
jPanel6.setLayout(jPanel6Layout);
|
||||
jPanel6Layout.setHorizontalGroup(
|
||||
jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel6Layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel6Layout.createSequentialGroup()
|
||||
.addGap(21, 21, 21)
|
||||
.addComponent(jLabel18, javax.swing.GroupLayout.PREFERRED_SIZE, 157, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel6Layout.createSequentialGroup()
|
||||
.addComponent(checkRsyncRemove)
|
||||
.addGap(0, 0, Short.MAX_VALUE))
|
||||
.addGroup(jPanel6Layout.createSequentialGroup()
|
||||
.addComponent(textRsyncPath)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(buttonSetFolder)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(buttonUndoFolder))))
|
||||
.addGroup(jPanel6Layout.createSequentialGroup()
|
||||
.addComponent(checkRsyncEnable)
|
||||
.addGap(83, 83, 83)
|
||||
.addComponent(jLabel11)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(textRsyncUser)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addComponent(jLabel12)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(textRsyncHost)))
|
||||
.addContainerGap())
|
||||
);
|
||||
|
||||
jPanel6Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {buttonSetFolder, buttonUndoFolder});
|
||||
|
||||
jPanel6Layout.setVerticalGroup(
|
||||
jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel6Layout.createSequentialGroup()
|
||||
.addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel6Layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(jLabel11)
|
||||
.addComponent(textRsyncUser, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(checkRsyncEnable)
|
||||
.addComponent(jLabel12)
|
||||
.addComponent(textRsyncHost, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(textRsyncPath, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(buttonSetFolder)
|
||||
.addComponent(buttonUndoFolder))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(checkRsyncRemove))
|
||||
.addGroup(jPanel6Layout.createSequentialGroup()
|
||||
.addGap(42, 42, 42)
|
||||
.addComponent(jLabel18)))
|
||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
);
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
||||
this.setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(buttonClear)
|
||||
@@ -293,71 +533,231 @@ public class Experiment extends Panel {
|
||||
.addGap(18, 18, 18)
|
||||
.addComponent(buttonApply)
|
||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addComponent(panelDataFile, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(jPanel6, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
);
|
||||
|
||||
layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {buttonApply, buttonUndo});
|
||||
layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {buttonApply, buttonClear, buttonUndo});
|
||||
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(0, 0, 0)
|
||||
.addComponent(panelDataFile, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(jPanel6, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addGap(18, 18, 18)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(buttonApply)
|
||||
.addComponent(buttonUndo)
|
||||
.addComponent(buttonClear))
|
||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addContainerGap())
|
||||
);
|
||||
|
||||
layout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {buttonApply, buttonClear, buttonUndo});
|
||||
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
private void buttonUndoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonUndoActionPerformed
|
||||
try{
|
||||
try {
|
||||
undo();
|
||||
} catch (Exception ex){
|
||||
} catch (Exception ex) {
|
||||
showException(ex);
|
||||
}
|
||||
}//GEN-LAST:event_buttonUndoActionPerformed
|
||||
|
||||
private void buttonApplyActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonApplyActionPerformed
|
||||
try{
|
||||
try {
|
||||
apply();
|
||||
} catch (Exception ex){
|
||||
} catch (Exception ex) {
|
||||
showException(ex);
|
||||
}
|
||||
}//GEN-LAST:event_buttonApplyActionPerformed
|
||||
|
||||
private void buttonClearActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonClearActionPerformed
|
||||
try{
|
||||
try {
|
||||
reset();
|
||||
} catch (Exception ex){
|
||||
} catch (Exception ex) {
|
||||
showException(ex);
|
||||
}
|
||||
}
|
||||
}//GEN-LAST:event_buttonClearActionPerformed
|
||||
|
||||
private void buttonSetSeqActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonSetSeqActionPerformed
|
||||
try {
|
||||
getContext().setFileSequentialNumber(((Number) spinnerSeq.getValue()).intValue());
|
||||
updateControls();
|
||||
} catch (Exception ex) {
|
||||
showException(ex);
|
||||
}
|
||||
}//GEN-LAST:event_buttonSetSeqActionPerformed
|
||||
|
||||
private void buttonUndoSeqActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonUndoSeqActionPerformed
|
||||
try {
|
||||
spinnerSeq.setValue(getContext().getFileSequentialNumber());
|
||||
updateControls();
|
||||
} catch (Exception ex) {
|
||||
showException(ex);
|
||||
}
|
||||
}//GEN-LAST:event_buttonUndoSeqActionPerformed
|
||||
|
||||
private void buttonDefaultPathActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonDefaultPathActionPerformed
|
||||
textNamePattern.setText(DEFAULT_PATH);
|
||||
updateControls();
|
||||
}//GEN-LAST:event_buttonDefaultPathActionPerformed
|
||||
|
||||
private void buttonSetPathActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonSetPathActionPerformed
|
||||
try {
|
||||
getContext().getConfig().dataPath = textNamePattern.getText();
|
||||
getContext().getConfig().save();
|
||||
updateControls();
|
||||
} catch (Exception ex) {
|
||||
showException(ex);
|
||||
}
|
||||
}//GEN-LAST:event_buttonSetPathActionPerformed
|
||||
|
||||
private void buttonUndoPathActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonUndoPathActionPerformed
|
||||
try {
|
||||
textNamePattern.setText(getContext().getConfig().dataPath);
|
||||
updateControls();
|
||||
} catch (Exception ex) {
|
||||
showException(ex);
|
||||
}
|
||||
}//GEN-LAST:event_buttonUndoPathActionPerformed
|
||||
|
||||
private void spinnerSeqStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spinnerSeqStateChanged
|
||||
updateControls();
|
||||
}//GEN-LAST:event_spinnerSeqStateChanged
|
||||
|
||||
private void textNamePatternKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_textNamePatternKeyTyped
|
||||
|
||||
}//GEN-LAST:event_textNamePatternKeyTyped
|
||||
|
||||
private void textNamePatternKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_textNamePatternKeyReleased
|
||||
updateControls();
|
||||
}//GEN-LAST:event_textNamePatternKeyReleased
|
||||
|
||||
private void checkRsyncEnableActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_checkRsyncEnableActionPerformed
|
||||
if (!updatingRsync) {
|
||||
try {
|
||||
setSetting("RSYNC_USER", "");
|
||||
//setSetting("RSYNC_PATH", "");
|
||||
} catch (Exception ex) {
|
||||
getLogger().log(Level.SEVERE, null, ex);
|
||||
}
|
||||
if (checkRsyncEnable.isSelected()) {
|
||||
String user = textRsyncUser.getText().trim();
|
||||
String host = textRsyncHost.getText().trim();
|
||||
String path = textRsyncPath.getText().trim();
|
||||
boolean del = checkRsyncRemove.isEnabled();
|
||||
if (!user.isEmpty()) {
|
||||
try {
|
||||
//this.eval("authorize_user('" + user +"', aux_file = '/scratch/.rsync.tmp')");
|
||||
this.eval("authorize_user('" + user + "')");
|
||||
setSetting("RSYNC_USER", user);
|
||||
setSetting("RSYNC_HOST", host);
|
||||
setSetting("RSYNC_PATH", path);
|
||||
setSetting("RSYNC_DEL", del);
|
||||
} catch (Exception ex) {
|
||||
try {
|
||||
this.evalAsync("remove_user_key()");
|
||||
} catch (Exception e) {
|
||||
getLogger().log(Level.SEVERE, null, e);
|
||||
}
|
||||
showException(ex);
|
||||
}
|
||||
} else {
|
||||
showMessage("Error", "Enter a valid user name to enable data transfer");
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
this.evalAsync("remove_user_key()");
|
||||
} catch (Exception e) {
|
||||
getLogger().log(Level.SEVERE, null, e);
|
||||
}
|
||||
}
|
||||
updateRsync();
|
||||
}
|
||||
}//GEN-LAST:event_checkRsyncEnableActionPerformed
|
||||
|
||||
private void buttonSetFolderActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonSetFolderActionPerformed
|
||||
try {
|
||||
String path = textRsyncPath.getText().trim();
|
||||
setSetting("RSYNC_PATH", path);
|
||||
/*
|
||||
String ret = SwingUtils.getString(this, "Enter destination path:", String.valueOf(getSetting("RSYNC_PATH")));
|
||||
if ((ret != null) && (!ret.trim().isEmpty())) {
|
||||
setSetting("RSYNC_PATH", ret.trim());
|
||||
}
|
||||
*/
|
||||
updateRsync();
|
||||
} catch (Exception ex) {
|
||||
showException(ex);
|
||||
}
|
||||
}//GEN-LAST:event_buttonSetFolderActionPerformed
|
||||
|
||||
private void checkRsyncRemoveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_checkRsyncRemoveActionPerformed
|
||||
if (!updatingRsync) {
|
||||
try {
|
||||
setSetting("RSYNC_DEL", checkRsyncRemove.isSelected());
|
||||
} catch (Exception ex) {
|
||||
showException(ex);
|
||||
}
|
||||
}
|
||||
}//GEN-LAST:event_checkRsyncRemoveActionPerformed
|
||||
|
||||
private void buttonUndoFolderActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonUndoFolderActionPerformed
|
||||
try {
|
||||
updateRsync();
|
||||
} catch (Exception ex) {
|
||||
showException(ex);
|
||||
}
|
||||
}//GEN-LAST:event_buttonUndoFolderActionPerformed
|
||||
|
||||
private void textRsyncPathKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_textRsyncPathKeyReleased
|
||||
buttonUndoFolder.setEnabled(checkRsyncEnable.isSelected());
|
||||
buttonSetFolder.setEnabled(checkRsyncEnable.isSelected());
|
||||
}//GEN-LAST:event_textRsyncPathKeyReleased
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JButton buttonApply;
|
||||
private javax.swing.JButton buttonClear;
|
||||
private javax.swing.JButton buttonDefaultPath;
|
||||
private javax.swing.JButton buttonSetFolder;
|
||||
private javax.swing.JButton buttonSetPath;
|
||||
private javax.swing.JButton buttonSetSeq;
|
||||
private javax.swing.JButton buttonUndo;
|
||||
private javax.swing.JLabel jLabel1;
|
||||
private javax.swing.JButton buttonUndoFolder;
|
||||
private javax.swing.JButton buttonUndoPath;
|
||||
private javax.swing.JButton buttonUndoSeq;
|
||||
private javax.swing.JCheckBox checkRsyncEnable;
|
||||
private javax.swing.JCheckBox checkRsyncRemove;
|
||||
private javax.swing.JLabel jLabel10;
|
||||
private javax.swing.JLabel jLabel11;
|
||||
private javax.swing.JLabel jLabel12;
|
||||
private javax.swing.JLabel jLabel18;
|
||||
private javax.swing.JLabel jLabel2;
|
||||
private javax.swing.JLabel jLabel3;
|
||||
private javax.swing.JLabel jLabel4;
|
||||
private javax.swing.JLabel jLabel5;
|
||||
private javax.swing.JLabel jLabel6;
|
||||
private javax.swing.JLabel jLabel7;
|
||||
private javax.swing.JLabel jLabel8;
|
||||
private javax.swing.JLabel jLabel9;
|
||||
private javax.swing.JPanel jPanel1;
|
||||
private javax.swing.JPanel jPanel2;
|
||||
private javax.swing.JPanel jPanel6;
|
||||
private javax.swing.JScrollPane jScrollPane1;
|
||||
private javax.swing.JPanel panelDataFile;
|
||||
private javax.swing.JSpinner spinnerSeq;
|
||||
private javax.swing.JTextArea textAuthors;
|
||||
private javax.swing.JTextField textDataPath;
|
||||
private javax.swing.JTextField textDataRoot;
|
||||
private javax.swing.JTextField textNamePattern;
|
||||
private javax.swing.JTextField textPGroup;
|
||||
private javax.swing.JTextField textPrefix;
|
||||
private javax.swing.JTextField textProposal;
|
||||
private javax.swing.JTextField textProposer;
|
||||
private javax.swing.JTextField textRsyncHost;
|
||||
private javax.swing.JTextField textRsyncPath;
|
||||
private javax.swing.JTextField textRsyncUser;
|
||||
private javax.swing.JTextField textSamples;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user