Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change ID tool panel to take an output path #1157

Open
wants to merge 2 commits into
base: expose_idtool_forces_file
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -522,5 +522,12 @@ public ExternalLoads getExternalLoads() {
return idTool.getExternalLoads();
}

public String getOutputGenForceFileName() { return idTool.getOutputGenForceFileName(); }
public void setOutputGenSetForceFileName(String name) {
if (!getOutputGenForceFileName().equals(name)) {
idTool.setOutputGenForceFileName(name);
setModified(Operation.OutputDataChanged);
}
}
}

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.1" encoding="UTF-8" ?>
<?xml version="1.0" encoding="UTF-8" ?>

<Form version="1.3" maxVersion="1.3" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<NonVisualComponents>
Expand Down Expand Up @@ -154,7 +154,7 @@
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="jTabbedPane1" pref="459" max="32767" attributes="0"/>
<Component id="jTabbedPane1" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
Expand All @@ -163,7 +163,7 @@
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="jTabbedPane1" pref="267" max="32767" attributes="0"/>
<Component id="jTabbedPane1" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
Expand Down Expand Up @@ -231,7 +231,7 @@
<EmptySpace max="-2" attributes="0"/>
<Component id="jLabel11" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="outputDirectory" pref="354" max="32767" attributes="3"/>
<Component id="outputDirectory" pref="343" max="32767" attributes="3"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
Expand All @@ -252,7 +252,7 @@
<SubComponents>
<Component class="javax.swing.JLabel" name="jLabel11">
<Properties>
<Property name="text" type="java.lang.String" value="Directory"/>
<Property name="text" type="java.lang.String" value="Storage file"/>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would not call this "Storage file" as it is generic name, I'd go with "Forces file" or "Generalized forces file" if space allows. Otherwise looks good.
Any thoughts or feedback @jimmyDunne or @chrisdembia

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like “generalized forces file”

</Properties>
</Component>
<Component class="org.opensim.swingui.FileTextFieldAndChooser" name="outputDirectory">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@
import org.opensim.view.excitationEditor.ExcitationEditorJFrame;
import org.opensim.view.pub.OpenSimDB;

import java.nio.file.Path;
import java.nio.file.Paths;

/**
*
* @author erang
Expand Down Expand Up @@ -93,9 +96,11 @@ public void actionPerformed(ActionEvent ae) {
//rraPanel.setBorder(new ComponentTitledBorder(rraPanelCheckBox, rraPanel, BorderFactory.createEtchedBorder()));

// File chooser settings
outputDirectory.setIncludeOpenButton(true);
outputDirectory.setDirectoriesOnly(true);
outputDirectory.setIncludeOpenButton(false);
outputDirectory.setExtensionsAndDescription(".sto", "Storage file for inverse dynamics analysis");
outputDirectory.setDirectoriesOnly(false);
outputDirectory.setCheckIfFileExists(false);
outputDirectory.setSaveMode(true);

setSettingsFileDescription("Settings file for "+modeName);

Expand Down Expand Up @@ -182,7 +187,8 @@ public void updateFromModel() {

// Output
outputName.setText(toolModel.getOutputPrefix());
outputDirectory.setFileName(toolModel.getResultsDirectory(),false);
Path p = Paths.get(toolModel.getResultsDirectory(), toolModel.getOutputGenForceFileName());
outputDirectory.setFileName(p.toString(),false);
//outputPrecision.setText(numFormat.format(toolModel.getOutputPrecision()));

// Actuators & external loads
Expand Down Expand Up @@ -389,7 +395,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {

outputPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Output"));

jLabel11.setText("Directory");
jLabel11.setText("Storage file");

outputDirectory.addChangeListener(new javax.swing.event.ChangeListener() {
public void stateChanged(javax.swing.event.ChangeEvent evt) {
Expand All @@ -405,7 +411,7 @@ public void stateChanged(javax.swing.event.ChangeEvent evt) {
.addContainerGap()
.add(jLabel11)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(outputDirectory, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 354, Short.MAX_VALUE)
.add(outputDirectory, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 343, Short.MAX_VALUE)
.addContainerGap())
);
outputPanelLayout.setVerticalGroup(
Expand Down Expand Up @@ -608,14 +614,14 @@ public void focusLost(java.awt.event.FocusEvent evt) {
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(layout.createSequentialGroup()
.addContainerGap()
.add(jTabbedPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 459, Short.MAX_VALUE)
.add(jTabbedPane1)
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(layout.createSequentialGroup()
.addContainerGap()
.add(jTabbedPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 267, Short.MAX_VALUE)
.add(jTabbedPane1)
.addContainerGap())
);
}// </editor-fold>//GEN-END:initComponents
Expand Down Expand Up @@ -752,7 +758,9 @@ private void finalTimeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIR
//------------------------------------------------------------------------

private void outputDirectoryStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_outputDirectoryStateChanged
toolModel.setResultsDirectory(outputDirectory.getFileName());
Path p = Paths.get(outputDirectory.getFileName());
toolModel.setResultsDirectory(p.getParent().toString());
toolModel.setOutputGenSetForceFileName(p.getFileName().toString());
}//GEN-LAST:event_outputDirectoryStateChanged

private void outputNameFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_outputNameFocusLost
Expand Down