mirror of
https://github.com/nasa/trick.git
synced 2025-01-23 04:48:00 +00:00
Some Trick jobs are labeled "simobject.classPtr->Foo()" trick_dp barfs on the "->" string
Backporting fix that does not split string on '-' character if it is part of "->" string. refs #51
This commit is contained in:
parent
c4ed577d87
commit
2784232457
@ -194,9 +194,11 @@ public class TrickQPActionController {
|
|||||||
* Helper method for adding specified new {@link ProductVar} variables to selected node(s) in the tree.
|
* Helper method for adding specified new {@link ProductVar} variables to selected node(s) in the tree.
|
||||||
* If newVars has only one element, it's for single variable. If newVars has more than one variable,
|
* If newVars has only one element, it's for single variable. If newVars has more than one variable,
|
||||||
* it's for array variable.
|
* it's for array variable.
|
||||||
|
* @param newVars new variables
|
||||||
|
* @param selectedTreeNodes tree to add new variables
|
||||||
*/
|
*/
|
||||||
public void handleAddVarToSelected(ProductVar[] newVars, ArrayList<DefaultMutableTreeNode> selectedTreeNodes) {
|
public void handleAddVarToSelected(ProductVar[] newVars, ArrayList<DefaultMutableTreeNode> selectedTreeNodes) {
|
||||||
CommonTreeNode plotNode;
|
CommonTreeNode plotNode;
|
||||||
CommonTreeNode pageNode;
|
CommonTreeNode pageNode;
|
||||||
CommonTreeNode tableNode;
|
CommonTreeNode tableNode;
|
||||||
for (int j = 0; j < selectedTreeNodes.size(); j++) {
|
for (int j = 0; j < selectedTreeNodes.size(); j++) {
|
||||||
@ -216,35 +218,35 @@ public class TrickQPActionController {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (newVars.length > 1) {
|
if (newVars.length > 1) {
|
||||||
JOptionPane.showMessageDialog(application.getMainFrame(),
|
JOptionPane.showMessageDialog(application.getMainFrame(),
|
||||||
"You can not add more than one variable to a curve!",
|
"You can not add more than one variable to a curve!",
|
||||||
"Ineligible Curve",
|
"Ineligible Curve",
|
||||||
JOptionPane.WARNING_MESSAGE);
|
JOptionPane.WARNING_MESSAGE);
|
||||||
} else if (newVars.length == 1) {
|
} else if (newVars.length == 1) {
|
||||||
addVarToCurve(treeNode, newVars[0]);
|
addVarToCurve(treeNode, newVars[0]);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case CommonTreeNode.VARCASE_NODE:
|
case CommonTreeNode.VARCASE_NODE:
|
||||||
if (newVars.length > 1) {
|
if (newVars.length > 1) {
|
||||||
JOptionPane.showMessageDialog(application.getMainFrame(),
|
JOptionPane.showMessageDialog(application.getMainFrame(),
|
||||||
"You can not add more than one variable to a varcase!",
|
"You can not add more than one variable to a varcase!",
|
||||||
"Ineligible Varcase",
|
"Ineligible Varcase",
|
||||||
JOptionPane.WARNING_MESSAGE);
|
JOptionPane.WARNING_MESSAGE);
|
||||||
} else if (newVars.length == 1) {
|
} else if (newVars.length == 1) {
|
||||||
addVarToVarcase(treeNode, newVars[0]);
|
addVarToVarcase(treeNode, newVars[0]);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case CommonTreeNode.PLOT_NODE:
|
case CommonTreeNode.PLOT_NODE:
|
||||||
for (ProductVar eachVar : newVars) {
|
for (ProductVar eachVar : newVars) {
|
||||||
addVarToPlot(treeNode, eachVar, true);
|
addVarToPlot(treeNode, eachVar, true);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case CommonTreeNode.PAGE_NODE:
|
case CommonTreeNode.PAGE_NODE:
|
||||||
// create a plot for each var
|
// create a plot for each var
|
||||||
for (ProductVar eachVar : newVars) {
|
for (ProductVar eachVar : newVars) {
|
||||||
plotNode = addPlotToPage(treeNode, null, true);
|
plotNode = addPlotToPage(treeNode, null, true);
|
||||||
addVarToPlot(plotNode, eachVar, true);
|
addVarToPlot(plotNode, eachVar, true);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case CommonTreeNode.X_NODE:
|
case CommonTreeNode.X_NODE:
|
||||||
case CommonTreeNode.Y_NODE:
|
case CommonTreeNode.Y_NODE:
|
||||||
@ -253,24 +255,24 @@ public class TrickQPActionController {
|
|||||||
// TODO: show warning!
|
// TODO: show warning!
|
||||||
break;
|
break;
|
||||||
case CommonTreeNode.TABLE_NODE:
|
case CommonTreeNode.TABLE_NODE:
|
||||||
// create a new column for each var in the table
|
// create a new column for each var in the table
|
||||||
// TODO: 1st column time
|
// TODO: 1st column time
|
||||||
for (ProductVar eachVar : newVars) {
|
for (ProductVar eachVar : newVars) {
|
||||||
addColumnToTable(treeNode, new ProductColumn(eachVar), true);
|
addColumnToTable(treeNode, new ProductColumn(eachVar), true);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case CommonTreeNode.COLUMN_NODE:
|
case CommonTreeNode.COLUMN_NODE:
|
||||||
if (newVars.length > 1) {
|
if (newVars.length > 1) {
|
||||||
JOptionPane.showMessageDialog(application.getMainFrame(),
|
JOptionPane.showMessageDialog(application.getMainFrame(),
|
||||||
"You can not add more than one variable to a column!",
|
"You can not add more than one variable to a column!",
|
||||||
"Ineligible Column",
|
"Ineligible Column",
|
||||||
JOptionPane.WARNING_MESSAGE);
|
JOptionPane.WARNING_MESSAGE);
|
||||||
} else if (newVars.length == 1) {
|
} else if (newVars.length == 1) {
|
||||||
// One column has one variable, can't add var if there is already variable defined.
|
// One column has one variable, can't add var if there is already variable defined.
|
||||||
if (treeNode.getChildCount() < 1) {
|
if (treeNode.getChildCount() < 1) {
|
||||||
addVarToColumn(treeNode, newVars[0], true);
|
addVarToColumn(treeNode, newVars[0], true);
|
||||||
} else {
|
} else {
|
||||||
JOptionPane.showMessageDialog(application.getMainFrame(),
|
JOptionPane.showMessageDialog(application.getMainFrame(),
|
||||||
"The column already has a variable!",
|
"The column already has a variable!",
|
||||||
"Ineligible Column",
|
"Ineligible Column",
|
||||||
JOptionPane.WARNING_MESSAGE);
|
JOptionPane.WARNING_MESSAGE);
|
||||||
@ -280,28 +282,28 @@ public class TrickQPActionController {
|
|||||||
//case CommonTreeNode.PROGRAMS_NODE:
|
//case CommonTreeNode.PROGRAMS_NODE:
|
||||||
//case CommonTreeNode.PROGRAM_NODE:
|
//case CommonTreeNode.PROGRAM_NODE:
|
||||||
case CommonTreeNode.INPUT_NODE:
|
case CommonTreeNode.INPUT_NODE:
|
||||||
if (application.programsNode.getChildCount() > 0) {
|
if (application.programsNode.getChildCount() > 0) {
|
||||||
//CommonTreeNode inputNode = (CommonTreeNode)(((CommonTreeNode)application.programsNode.getChildAt(0)).getChildAt(0));
|
//CommonTreeNode inputNode = (CommonTreeNode)(((CommonTreeNode)application.programsNode.getChildAt(0)).getChildAt(0));
|
||||||
for (ProductVar eachVar : newVars) {
|
for (ProductVar eachVar : newVars) {
|
||||||
addVarToInput(eachVar, true);
|
addVarToInput(eachVar, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case CommonTreeNode.PLOTS_NODE:
|
case CommonTreeNode.PLOTS_NODE:
|
||||||
pageNode = addPageToPlots(new ProductPage());
|
pageNode = addPageToPlots(new ProductPage());
|
||||||
for (ProductVar eachVar : newVars) {
|
for (ProductVar eachVar : newVars) {
|
||||||
plotNode = addPlotToPage(pageNode, new ProductPlot(), true);
|
plotNode = addPlotToPage(pageNode, new ProductPlot(), true);
|
||||||
addVarToPlot(plotNode, eachVar, true);
|
addVarToPlot(plotNode, eachVar, true);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case CommonTreeNode.TABLES_NODE:
|
case CommonTreeNode.TABLES_NODE:
|
||||||
tableNode = addNewTable(null);
|
tableNode = addNewTable(null);
|
||||||
// TODO: time should be from varlist instead of hardcode
|
// TODO: time should be from varlist instead of hardcode
|
||||||
ProductVar timeVar = new ProductVar(TrickApplication.DEFAULT_TIME_NAME, "s");
|
ProductVar timeVar = new ProductVar(TrickApplication.DEFAULT_TIME_NAME, "s");
|
||||||
addColumnToTable(tableNode, new ProductColumn(timeVar), true);
|
addColumnToTable(tableNode, new ProductColumn(timeVar), true);
|
||||||
for (ProductVar eachVar : newVars) {
|
for (ProductVar eachVar : newVars) {
|
||||||
addColumnToTable(tableNode, new ProductColumn(eachVar), true);
|
addColumnToTable(tableNode, new ProductColumn(eachVar), true);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
} // end switch
|
} // end switch
|
||||||
} // end if selected node is instanceof CommonTreeNode
|
} // end if selected node is instanceof CommonTreeNode
|
||||||
@ -312,28 +314,28 @@ public class TrickQPActionController {
|
|||||||
* Invoked when Search is performed.
|
* Invoked when Search is performed.
|
||||||
*/
|
*/
|
||||||
public void handleSearchVar() {
|
public void handleSearchVar() {
|
||||||
if (hiddenVarListForSearch == null) {
|
if (hiddenVarListForSearch == null) {
|
||||||
hiddenVarListForSearch = new ArrayList<Object>();
|
hiddenVarListForSearch = new ArrayList<Object>();
|
||||||
} else {
|
} else {
|
||||||
for (Object hiddenObj : hiddenVarListForSearch) {
|
for (Object hiddenObj : hiddenVarListForSearch) {
|
||||||
LogVar hiddenVar = (LogVar)hiddenObj;
|
LogVar hiddenVar = (LogVar)hiddenObj;
|
||||||
if (hiddenVar.getPrevDisplay() != null) {
|
if (hiddenVar.getPrevDisplay() != null) {
|
||||||
hiddenVar.setDisplay(hiddenVar.getPrevDisplay());
|
hiddenVar.setDisplay(hiddenVar.getPrevDisplay());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
hiddenVarListForSearch.clear();
|
hiddenVarListForSearch.clear();
|
||||||
application.varList.refreshData();
|
application.varList.refreshData();
|
||||||
}
|
}
|
||||||
if (!application.searchField.getText().isEmpty()) {
|
if (!application.searchField.getText().isEmpty()) {
|
||||||
for (Object eachObj : application.varList.getAllData()) {
|
for (Object eachObj : application.varList.getAllData()) {
|
||||||
LogVar eachVar = (LogVar)eachObj;
|
LogVar eachVar = (LogVar)eachObj;
|
||||||
if (!UIUtils.searchWithWildcard(eachVar.getName(), application.searchField.getText())) {
|
if (!UIUtils.searchWithWildcard(eachVar.getName(), application.searchField.getText())) {
|
||||||
hiddenVarListForSearch.add(eachVar);
|
hiddenVarListForSearch.add(eachVar);
|
||||||
eachVar.setPrevDisplay(eachVar.getDisplay());
|
eachVar.setPrevDisplay(eachVar.getDisplay());
|
||||||
eachVar.setDisplay(DisplayType.HIDDEN);
|
eachVar.setDisplay(DisplayType.HIDDEN);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
application.varList.refreshData();
|
application.varList.refreshData();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -349,25 +351,16 @@ public class TrickQPActionController {
|
|||||||
|
|
||||||
for (int i = 0; i < selectedVars.length; i++) {
|
for (int i = 0; i < selectedVars.length; i++) {
|
||||||
LogVar varFrom = (LogVar)selectedVars[i];
|
LogVar varFrom = (LogVar)selectedVars[i];
|
||||||
if (varFrom.getName().indexOf('-') != -1) {
|
if (varFrom.getName().matches("-(?!>)")) {
|
||||||
// arrayed variable
|
|
||||||
/***
|
|
||||||
if (varFrom.getName().indexOf('-') < varFrom.getName().lastIndexOf('-')) {
|
|
||||||
JOptionPane.showMessageDialog(application.getMainFrame(),
|
|
||||||
"Too many ranged dimensions. \nPlease use Expand Var to get to one ranged dimension\n" +
|
|
||||||
"(or to a singular variable with no ranges).",
|
|
||||||
"Error", JOptionPane.WARNING_MESSAGE);
|
|
||||||
return;
|
|
||||||
}***/
|
|
||||||
List<String> vars = get_components_from_array(varFrom.getName()); // expand variable
|
List<String> vars = get_components_from_array(varFrom.getName()); // expand variable
|
||||||
if ( (selectedTreeNodes!=null) && (selectedTreeNodes.size()>0)
|
if ( (selectedTreeNodes!=null) && (selectedTreeNodes.size()>0)
|
||||||
&& (((CommonTreeNode)selectedTreeNodes.get(0)).getNodeType()!=CommonTreeNode.PLOTS_NODE) ) {
|
&& (((CommonTreeNode)selectedTreeNodes.get(0)).getNodeType()!=CommonTreeNode.PLOTS_NODE) ) {
|
||||||
ProductVar[] newVars = new ProductVar[vars.size()];
|
ProductVar[] newVars = new ProductVar[vars.size()];
|
||||||
// stick all arrayed components under the selected node
|
// stick all arrayed components under the selected node
|
||||||
for (int ii=0; ii<vars.size(); ii++) {
|
for (int ii=0; ii<vars.size(); ii++) {
|
||||||
newVars[ii] = new ProductVar(vars.get(ii), varFrom.getUnits());
|
newVars[ii] = new ProductVar(vars.get(ii), varFrom.getUnits());
|
||||||
}
|
}
|
||||||
handleAddVarToSelected(newVars, selectedTreeNodes);
|
handleAddVarToSelected(newVars, selectedTreeNodes);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// put components on new page, 1 curve per plot, 9 plots per page
|
// put components on new page, 1 curve per plot, 9 plots per page
|
||||||
@ -442,21 +435,21 @@ public class TrickQPActionController {
|
|||||||
num_components++;
|
num_components++;
|
||||||
// done if it's the last row
|
// done if it's the last row
|
||||||
if (row == all_vars.length - 1) {
|
if (row == all_vars.length - 1) {
|
||||||
done = true;
|
done = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (done) {
|
if (done) {
|
||||||
if (num_components>0) {
|
if (num_components>0) {
|
||||||
//System.out.println("\ncomponents= " +components + ", num_components=" + num_components);
|
//System.out.println("\ncomponents= " +components + ", num_components=" + num_components);
|
||||||
if (num_components>1) {
|
if (num_components>1) {
|
||||||
create_array_from_components(components);
|
create_array_from_components(components);
|
||||||
//application.varList.addData(get_array_from_components(components));
|
//application.varList.addData(get_array_from_components(components));
|
||||||
}
|
}
|
||||||
current_nonarrayed_name = "";
|
current_nonarrayed_name = "";
|
||||||
components.clear();
|
components.clear();
|
||||||
num_components = 0;
|
num_components = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} // end for row
|
} // end for row
|
||||||
@ -589,7 +582,7 @@ public class TrickQPActionController {
|
|||||||
public List<String> get_components_from_array(String arrayvar) {
|
public List<String> get_components_from_array(String arrayvar) {
|
||||||
// MAX_DIMENSIONS is how many ranges we can handle splitting in a variable
|
// MAX_DIMENSIONS is how many ranges we can handle splitting in a variable
|
||||||
final int MAX_DIMENSIONS = 3;
|
final int MAX_DIMENSIONS = 3;
|
||||||
String[] parts = arrayvar.split("-");
|
String[] parts = arrayvar.split("-(?!>)");
|
||||||
int numparts = parts.length;
|
int numparts = parts.length;
|
||||||
if (numparts==1) {
|
if (numparts==1) {
|
||||||
// no range to split
|
// no range to split
|
||||||
@ -634,7 +627,7 @@ public class TrickQPActionController {
|
|||||||
// otherwise, entpart is an empty string.
|
// otherwise, entpart is an empty string.
|
||||||
int lastEndBracket = arrayvar.lastIndexOf(']');
|
int lastEndBracket = arrayvar.lastIndexOf(']');
|
||||||
if (lastEndBracket < (arrayvar.length()-1)) {
|
if (lastEndBracket < (arrayvar.length()-1)) {
|
||||||
endpart = arrayvar.substring(lastEndBracket+1);
|
endpart = arrayvar.substring(lastEndBracket+1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// build a string for each component and return as a list
|
// build a string for each component and return as a list
|
||||||
@ -684,15 +677,15 @@ public class TrickQPActionController {
|
|||||||
|
|
||||||
// if nothing is selected, expand all expandable vars
|
// if nothing is selected, expand all expandable vars
|
||||||
if (selectedVars == null || selectedVars.length == 0) {
|
if (selectedVars == null || selectedVars.length == 0) {
|
||||||
for (Object eachObj : application.varList.getAllData()) {
|
for (Object eachObj : application.varList.getAllData()) {
|
||||||
LogVar eachVar = (LogVar)eachObj;
|
LogVar eachVar = (LogVar)eachObj;
|
||||||
// expand all array-ed vars
|
// expand all array-ed vars
|
||||||
if (eachVar.getName().indexOf("-") != -1) {
|
if (eachVar.getName().indexOf("-") != -1) {
|
||||||
eachVar.setDisplay(DisplayType.EXPANDED);
|
eachVar.setDisplay(DisplayType.EXPANDED);
|
||||||
} else if (eachVar.getName().indexOf("[") != -1) { // if the var is one of array-ed var element, hide it
|
} else if (eachVar.getName().indexOf("[") != -1) { // if the var is one of array-ed var element, hide it
|
||||||
eachVar.setDisplay(DisplayType.NORMAL);
|
eachVar.setDisplay(DisplayType.NORMAL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else { // otherwise only expand selected vars
|
} else { // otherwise only expand selected vars
|
||||||
int varlist_indices[] = application.varList.getJList().getSelectedIndices();
|
int varlist_indices[] = application.varList.getJList().getSelectedIndices();
|
||||||
for (int ii=0; ii < selectedVars.length; ii++) {
|
for (int ii=0; ii < selectedVars.length; ii++) {
|
||||||
@ -730,27 +723,27 @@ public class TrickQPActionController {
|
|||||||
|
|
||||||
// only want something like [0-2][0-2] and don't want things like [0][0-2]
|
// only want something like [0-2][0-2] and don't want things like [0][0-2]
|
||||||
String arrayEx = "\\w+(\\[[0-9]+\\-[0-9]+\\])+\\w*";
|
String arrayEx = "\\w+(\\[[0-9]+\\-[0-9]+\\])+\\w*";
|
||||||
Pattern arrayPattern = Pattern.compile(arrayEx);
|
Pattern arrayPattern = Pattern.compile(arrayEx);
|
||||||
|
|
||||||
// if nothing is selected, contract all contractable vars
|
// if nothing is selected, contract all contractable vars
|
||||||
if (selectedVars == null || selectedVars.length == 0) {
|
if (selectedVars == null || selectedVars.length == 0) {
|
||||||
for (Object eachObj : application.varList.getAllData()) {
|
for (Object eachObj : application.varList.getAllData()) {
|
||||||
LogVar eachVar = (LogVar)eachObj;
|
LogVar eachVar = (LogVar)eachObj;
|
||||||
// contract all array-ed vars
|
// contract all array-ed vars
|
||||||
Matcher matcher = arrayPattern.matcher(eachVar.getName());
|
Matcher matcher = arrayPattern.matcher(eachVar.getName());
|
||||||
// if only based on dash (-), [0][0-2] would be displayed.
|
// if only based on dash (-), [0][0-2] would be displayed.
|
||||||
// I am thinking at this point, only [0-2][0-2] should be displayed,
|
// I am thinking at this point, only [0-2][0-2] should be displayed,
|
||||||
// all its elements such as [0][0-2], [1][0-2], or [2][0-2] should be hidden.
|
// all its elements such as [0][0-2], [1][0-2], or [2][0-2] should be hidden.
|
||||||
// so changed to use Java Pattern & Matcher
|
// so changed to use Java Pattern & Matcher
|
||||||
//if (eachVar.getName().indexOf("-") != -1) {
|
//if (eachVar.getName().indexOf("-") != -1) {
|
||||||
if (matcher.find()) {
|
if (matcher.find()) {
|
||||||
eachVar.setDisplay(DisplayType.CONTRACTED);
|
eachVar.setDisplay(DisplayType.CONTRACTED);
|
||||||
} else if (eachVar.getLevel() > 0 && eachVar.getName().indexOf("[") != -1 && eachVar.getName().endsWith("]")) {
|
} else if (eachVar.getLevel() > 0 && eachVar.getName().indexOf("[") != -1 && eachVar.getName().endsWith("]")) {
|
||||||
// if the var is one of array-ed var element & "[]" can't be in the middle (could be a pointer), also if this varisn't at level 0, hide it
|
// if the var is one of array-ed var element & "[]" can't be in the middle (could be a pointer), also if this varisn't at level 0, hide it
|
||||||
//System.out.println("HIDDEN var..." + eachVar.getName() + " and its level ..." + eachVar.getLevel());
|
//System.out.println("HIDDEN var..." + eachVar.getName() + " and its level ..." + eachVar.getLevel());
|
||||||
eachVar.setDisplay(DisplayType.HIDDEN);
|
eachVar.setDisplay(DisplayType.HIDDEN);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else { // otherwise only contract selected variables
|
} else { // otherwise only contract selected variables
|
||||||
int varlist_indices[] = application.varList.getJList().getSelectedIndices();
|
int varlist_indices[] = application.varList.getJList().getSelectedIndices();
|
||||||
for (int ii=0; ii < selectedVars.length; ii++) {
|
for (int ii=0; ii < selectedVars.length; ii++) {
|
||||||
@ -795,12 +788,12 @@ public class TrickQPActionController {
|
|||||||
selectedVarUnits);
|
selectedVarUnits);
|
||||||
|
|
||||||
if (newUnits != null) {
|
if (newUnits != null) {
|
||||||
changeVarUnits(firstSelectedVar, newUnits.toString());
|
changeVarUnits(firstSelectedVar, newUnits.toString());
|
||||||
application.varList.refreshData();
|
application.varList.refreshData();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
JOptionPane.showMessageDialog(application.getMainFrame(),
|
JOptionPane.showMessageDialog(application.getMainFrame(),
|
||||||
"Units for " + firstSelectedVar.getName() + " is not available. Can't change units!",
|
"Units for " + firstSelectedVar.getName() + " is not available. Can't change units!",
|
||||||
"No Units Sepcification",
|
"No Units Sepcification",
|
||||||
JOptionPane.WARNING_MESSAGE);
|
JOptionPane.WARNING_MESSAGE);
|
||||||
@ -812,21 +805,21 @@ public class TrickQPActionController {
|
|||||||
* Helper method for changing the units for a {@link LogVar}.
|
* Helper method for changing the units for a {@link LogVar}.
|
||||||
*/
|
*/
|
||||||
private void changeVarUnits(LogVar fromVar, String newUnits) {
|
private void changeVarUnits(LogVar fromVar, String newUnits) {
|
||||||
// if arrayed var, need to change the units for all elements
|
// if arrayed var, need to change the units for all elements
|
||||||
if (fromVar.getName().indexOf('-') != -1) {
|
if (fromVar.getName().indexOf('-') != -1) {
|
||||||
Object[] allVars = application.varList.getAllData();
|
Object[] allVars = application.varList.getAllData();
|
||||||
for (int row = application.varList.getJList().getSelectedIndex() + 1; row < allVars.length; row++) {
|
for (int row = application.varList.getJList().getSelectedIndex() + 1; row < allVars.length; row++) {
|
||||||
LogVar var = (LogVar) allVars[row];
|
LogVar var = (LogVar) allVars[row];
|
||||||
if (var.getLevel() > fromVar.getLevel()) {
|
if (var.getLevel() > fromVar.getLevel()) {
|
||||||
changeVarUnits(var, newUnits);
|
changeVarUnits(var, newUnits);
|
||||||
} else {
|
} else {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// change the units for the var including both array and non-array vars
|
// change the units for the var including both array and non-array vars
|
||||||
fromVar.setUnits(newUnits);
|
fromVar.setUnits(newUnits);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -853,33 +846,34 @@ public class TrickQPActionController {
|
|||||||
* TODO: Haven't added this mechanism to any other places as this is the
|
* TODO: Haven't added this mechanism to any other places as this is the
|
||||||
* only one is called by other application for now. Add other
|
* only one is called by other application for now. Add other
|
||||||
* places if necessary.
|
* places if necessary.
|
||||||
|
* @param dirList list of directories
|
||||||
*/
|
*/
|
||||||
public void handleAddRuns(final String[] dirList) {
|
public void handleAddRuns(final String[] dirList) {
|
||||||
|
|
||||||
if (dirList != null && dirList.length > 0) {
|
if (dirList != null && dirList.length > 0) {
|
||||||
// start another thread for updating the list gui
|
// start another thread for updating the list gui
|
||||||
(new Thread() {
|
(new Thread() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
for (String dir : dirList) {
|
for (String dir : dirList) {
|
||||||
File runDir = new File(dir);
|
File runDir = new File(dir);
|
||||||
if (runDir.exists()) {
|
if (runDir.exists()) {
|
||||||
application.runList.addData(new SessionRun(runDir.getAbsolutePath()));
|
application.runList.addData(new SessionRun(runDir.getAbsolutePath()));
|
||||||
try {
|
try {
|
||||||
// TODO: find out why has to be refresh for each run added?
|
// TODO: find out why has to be refresh for each run added?
|
||||||
SwingUtilities.invokeAndWait(new Runnable() {
|
SwingUtilities.invokeAndWait(new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
handleRefreshDP();
|
handleRefreshDP();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} catch (Exception ie) {
|
} catch (Exception ie) {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}).start();
|
}).start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -954,73 +948,76 @@ public class TrickQPActionController {
|
|||||||
* Invoked when New Program is selected from Programs menu.
|
* Invoked when New Program is selected from Programs menu.
|
||||||
*/
|
*/
|
||||||
public void handleNewProgram() {
|
public void handleNewProgram() {
|
||||||
addNewProgram(new ProductExternalFunction());
|
addNewProgram(new ProductExternalFunction());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Invoked when new output is entered.
|
* Invoked when new output is entered.
|
||||||
|
* @param newOutput not sure
|
||||||
*/
|
*/
|
||||||
public void handleNewProgramOutput(String newOutput) {
|
public void handleNewProgramOutput(String newOutput) {
|
||||||
addVarToOutput(new ProductMeasurement(newOutput), true);
|
addVarToOutput(new ProductMeasurement(newOutput), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Invoked when Subtract is selected.
|
* Invoked when Subtract is selected.
|
||||||
*
|
*
|
||||||
* This function generates nodes for (var1 - var2)
|
* This function generates nodes for (var1 - var2)
|
||||||
|
* @param var1 var1
|
||||||
|
* @param var2 var2
|
||||||
*/
|
*/
|
||||||
public void handleSubtractFunction(LogVar var1, LogVar var2) {
|
public void handleSubtractFunction(LogVar var1, LogVar var2) {
|
||||||
String units = null;
|
String units = null;
|
||||||
StringBuffer varBuffer = new StringBuffer();
|
StringBuffer varBuffer = new StringBuffer();
|
||||||
varBuffer.append("delta(");
|
varBuffer.append("delta(");
|
||||||
|
|
||||||
// if this var is not a true log var, quit
|
// if this var is not a true log var, quit
|
||||||
if (!var1.getIsFromLog()) {
|
if (!var1.getIsFromLog()) {
|
||||||
JOptionPane.showMessageDialog(application.getMainFrame(),
|
JOptionPane.showMessageDialog(application.getMainFrame(),
|
||||||
"Variable " + var1.getName() + " can't not be used for functions !\n",
|
"Variable " + var1.getName() + " can't not be used for functions !\n",
|
||||||
"Error",
|
"Error",
|
||||||
JOptionPane.ERROR_MESSAGE);
|
JOptionPane.ERROR_MESSAGE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!var2.getIsFromLog()) {
|
if (!var2.getIsFromLog()) {
|
||||||
JOptionPane.showMessageDialog(application.getMainFrame(),
|
JOptionPane.showMessageDialog(application.getMainFrame(),
|
||||||
"Variable " + var2.getName() + " can't not be used for functions !\n",
|
"Variable " + var2.getName() + " can't not be used for functions !\n",
|
||||||
"Error",
|
"Error",
|
||||||
JOptionPane.ERROR_MESSAGE);
|
JOptionPane.ERROR_MESSAGE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// var1
|
// var1
|
||||||
varBuffer.append(var1.getName());
|
varBuffer.append(var1.getName());
|
||||||
varBuffer.append(":");
|
varBuffer.append(":");
|
||||||
if (var1.getRunDir() == null) {
|
if (var1.getRunDir() == null) {
|
||||||
if (application.runList.getSelectedFirstData() == null) {
|
if (application.runList.getSelectedFirstData() == null) {
|
||||||
varBuffer.append(((SessionRun)application.runList.getAllData()[0]).getDir());
|
varBuffer.append(((SessionRun)application.runList.getAllData()[0]).getDir());
|
||||||
} else {
|
} else {
|
||||||
varBuffer.append(((SessionRun)application.runList.getSelectedFirstData()).getDir());
|
varBuffer.append(((SessionRun)application.runList.getSelectedFirstData()).getDir());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
varBuffer.append(var1.getRunDir());
|
varBuffer.append(var1.getRunDir());
|
||||||
}
|
}
|
||||||
// TODO: do we set units for delta?
|
// TODO: do we set units for delta?
|
||||||
units = var1.getUnits();
|
units = var1.getUnits();
|
||||||
varBuffer.append(",");
|
varBuffer.append(",");
|
||||||
|
|
||||||
// var2
|
// var2
|
||||||
varBuffer.append(var2.getName());
|
varBuffer.append(var2.getName());
|
||||||
varBuffer.append(":");
|
varBuffer.append(":");
|
||||||
if (var2.getRunDir() == null) {
|
if (var2.getRunDir() == null) {
|
||||||
if (application.runList.getSelectedFirstData() == null) {
|
if (application.runList.getSelectedFirstData() == null) {
|
||||||
varBuffer.append(((SessionRun)application.runList.getAllData()[0]).getDir());
|
varBuffer.append(((SessionRun)application.runList.getAllData()[0]).getDir());
|
||||||
} else {
|
} else {
|
||||||
varBuffer.append(((SessionRun)application.runList.getSelectedFirstData()).getDir());
|
varBuffer.append(((SessionRun)application.runList.getSelectedFirstData()).getDir());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
varBuffer.append(var2.getRunDir());
|
varBuffer.append(var2.getRunDir());
|
||||||
}
|
}
|
||||||
varBuffer.append(")");
|
varBuffer.append(")");
|
||||||
|
|
||||||
ProductVar newVar = new ProductVar(varBuffer.toString(), units);
|
ProductVar newVar = new ProductVar(varBuffer.toString(), units);
|
||||||
ProductPage newPage = new ProductPage();
|
ProductPage newPage = new ProductPage();
|
||||||
CommonTreeNode pageNode = new CommonTreeNode(newPage, CommonTreeNode.PAGE_NODE);
|
CommonTreeNode pageNode = new CommonTreeNode(newPage, CommonTreeNode.PAGE_NODE);
|
||||||
application.productTree.addNode(application.plotsNode, pageNode, true);
|
application.productTree.addNode(application.plotsNode, pageNode, true);
|
||||||
ProductPlot newPlot = new ProductPlot();
|
ProductPlot newPlot = new ProductPlot();
|
||||||
@ -1034,7 +1031,7 @@ public class TrickQPActionController {
|
|||||||
* @param fileName The name of DP XML file.
|
* @param fileName The name of DP XML file.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("rawtypes")
|
@SuppressWarnings("rawtypes")
|
||||||
public void openDP(String fileName) {
|
public void openDP(String fileName) {
|
||||||
if (fileName == null) {
|
if (fileName == null) {
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
@ -1142,7 +1139,7 @@ public class TrickQPActionController {
|
|||||||
|
|
||||||
// do nothing if no data recording files found
|
// do nothing if no data recording files found
|
||||||
if (files == null ) {
|
if (files == null ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
String runDirPath = runDir.toString();
|
String runDirPath = runDir.toString();
|
||||||
@ -1157,74 +1154,74 @@ public class TrickQPActionController {
|
|||||||
// ignore those frame log related files.
|
// ignore those frame log related files.
|
||||||
// TODO: better way!
|
// TODO: better way!
|
||||||
if (files[i].getPath().endsWith("log_frame.header") ||
|
if (files[i].getPath().endsWith("log_frame.header") ||
|
||||||
files[i].getPath().endsWith("log_trickjobs.header") ||
|
files[i].getPath().endsWith("log_trickjobs.header") ||
|
||||||
files[i].getPath().endsWith("log_userjobs.header") ||
|
files[i].getPath().endsWith("log_userjobs.header") ||
|
||||||
files[i].getPath().endsWith("log_frame.trk") ||
|
files[i].getPath().endsWith("log_frame.trk") ||
|
||||||
files[i].getPath().endsWith("log_trickjobs.trk") ||
|
files[i].getPath().endsWith("log_trickjobs.trk") ||
|
||||||
files[i].getPath().endsWith("log_userjobs.trk")) {
|
files[i].getPath().endsWith("log_userjobs.trk")) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// if the file is not the .header file, check to see
|
// if the file is not the .header file, check to see
|
||||||
// if the corresponding .header file exists. If yes, skip
|
// if the corresponding .header file exists. If yes, skip
|
||||||
// this data file as processing a header file which is much
|
// this data file as processing a header file which is much
|
||||||
// smaller should be faster
|
// smaller should be faster
|
||||||
if (!files[i].getPath().endsWith(".header")) {
|
if (!files[i].getPath().endsWith(".header")) {
|
||||||
String onlyName = UIUtils.getFileNameWithoutExtension(files[i]);
|
String onlyName = UIUtils.getFileNameWithoutExtension(files[i]);
|
||||||
if (new File(runDir, onlyName + ".header").exists()) {
|
if (new File(runDir, onlyName + ".header").exists()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
DataReader reader = null;
|
DataReader reader = null;
|
||||||
|
|
||||||
if (files[i].getName().toLowerCase().endsWith(".header")) {
|
if (files[i].getName().toLowerCase().endsWith(".header")) {
|
||||||
reader = new LogHeaderReader(files[i]);
|
reader = new LogHeaderReader(files[i]);
|
||||||
} else if (files[i].getName().toLowerCase().endsWith(".trk")) {
|
} else if (files[i].getName().toLowerCase().endsWith(".trk")) {
|
||||||
reader = new BinaryDataReader(files[i]);
|
reader = new BinaryDataReader(files[i]);
|
||||||
} else if (files[i].getName().toLowerCase().endsWith(".h5")) {
|
} else if (files[i].getName().toLowerCase().endsWith(".h5")) {
|
||||||
// TODO: add reading .h5
|
// TODO: add reading .h5
|
||||||
continue;
|
continue;
|
||||||
} else if (files[i].getName().toLowerCase().endsWith(".csv")) {
|
} else if (files[i].getName().toLowerCase().endsWith(".csv")) {
|
||||||
reader = new CSVDataReader(files[i]);
|
reader = new CSVDataReader(files[i]);
|
||||||
}
|
}
|
||||||
if (reader == null) {
|
if (reader == null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Object> new_vars = reader.getRecordedVarList();
|
List<Object> new_vars = reader.getRecordedVarList();
|
||||||
List<Object> run_vars = new ArrayList<Object>();
|
List<Object> run_vars = new ArrayList<Object>();
|
||||||
if (runVarMap.containsKey(runDirPath)) {
|
if (runVarMap.containsKey(runDirPath)) {
|
||||||
// at least one file already read in for this RUN dir
|
// at least one file already read in for this RUN dir
|
||||||
run_vars = runVarMap.get(runDirPath);
|
run_vars = runVarMap.get(runDirPath);
|
||||||
}
|
}
|
||||||
for (Object obj : new_vars) {
|
for (Object obj : new_vars) {
|
||||||
if (!run_vars.contains(obj)) {
|
if (!run_vars.contains(obj)) {
|
||||||
// add all arrayed variable's components to varlist
|
// add all arrayed variable's components to varlist
|
||||||
LogVar mainvar = (LogVar) obj;
|
LogVar mainvar = (LogVar) obj;
|
||||||
List<String> components = get_components_from_array(mainvar
|
List<String> components = get_components_from_array(mainvar
|
||||||
.getName());
|
.getName());
|
||||||
// List<Object> new_vars = new ArrayList<Object>();
|
// List<Object> new_vars = new ArrayList<Object>();
|
||||||
if (components != null) {
|
if (components != null) {
|
||||||
// arrayed
|
// arrayed
|
||||||
for (String name : components) {
|
for (String name : components) {
|
||||||
LogVar compvar = new LogVar(obj);
|
LogVar compvar = new LogVar(obj);
|
||||||
compvar.setName(name);
|
compvar.setName(name);
|
||||||
run_vars.add(compvar);
|
run_vars.add(compvar);
|
||||||
// add new component variable to displayed varlist
|
// add new component variable to displayed varlist
|
||||||
application.varList.addData(compvar);
|
application.varList.addData(compvar);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// non-arrayed
|
// non-arrayed
|
||||||
run_vars.add(obj);
|
run_vars.add(obj);
|
||||||
// add new variable to displayed varlist
|
// add new variable to displayed varlist
|
||||||
application.varList.addData(obj);
|
application.varList.addData(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
application.varList.getJList().clearSelection();
|
application.varList.getJList().clearSelection();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// add this <key: RUN dir> <values: all variables> to the HashMap
|
// add this <key: RUN dir> <values: all variables> to the HashMap
|
||||||
runVarMap.put(runDirPath, run_vars);
|
runVarMap.put(runDirPath, run_vars);
|
||||||
}
|
}
|
||||||
//System.out.println("\nmap (" +runVarMap.get(runDirPath).size() +") :" +runVarMap.get(runDirPath) +"\n");
|
//System.out.println("\nmap (" +runVarMap.get(runDirPath).size() +") :" +runVarMap.get(runDirPath) +"\n");
|
||||||
|
|
||||||
@ -1287,7 +1284,7 @@ public class TrickQPActionController {
|
|||||||
int childCount = curveNode.getChildCount();
|
int childCount = curveNode.getChildCount();
|
||||||
// TODO: increase to 2 if need to support X, Y, & Z.
|
// TODO: increase to 2 if need to support X, Y, & Z.
|
||||||
if (childCount > 1) {
|
if (childCount > 1) {
|
||||||
JOptionPane.showMessageDialog(application.getMainFrame(),
|
JOptionPane.showMessageDialog(application.getMainFrame(),
|
||||||
"You can not add a variable to a curver that has 2 variables already!",
|
"You can not add a variable to a curver that has 2 variables already!",
|
||||||
"Ineligible Curve",
|
"Ineligible Curve",
|
||||||
JOptionPane.WARNING_MESSAGE);
|
JOptionPane.WARNING_MESSAGE);
|
||||||
@ -1345,7 +1342,7 @@ public class TrickQPActionController {
|
|||||||
int childCount = varcaseNode.getChildCount();
|
int childCount = varcaseNode.getChildCount();
|
||||||
// TODO: increase to 2 if need to support X, Y, & Z.
|
// TODO: increase to 2 if need to support X, Y, & Z.
|
||||||
if (childCount > 1) {
|
if (childCount > 1) {
|
||||||
JOptionPane.showMessageDialog(application.getMainFrame(),
|
JOptionPane.showMessageDialog(application.getMainFrame(),
|
||||||
"You can not add a variable to a varcase that has 2 variables already!",
|
"You can not add a variable to a varcase that has 2 variables already!",
|
||||||
"Ineligible Varcase",
|
"Ineligible Varcase",
|
||||||
JOptionPane.WARNING_MESSAGE);
|
JOptionPane.WARNING_MESSAGE);
|
||||||
@ -1434,6 +1431,7 @@ public class TrickQPActionController {
|
|||||||
* The valid range would be [0, total child count of this plot].
|
* The valid range would be [0, total child count of this plot].
|
||||||
* @param isNew <code>true</code>, if the user object of the plot node does not
|
* @param isNew <code>true</code>, if the user object of the plot node does not
|
||||||
* have the curve user object in its curve list, <code>false</code> otherwise.
|
* have the curve user object in its curve list, <code>false</code> otherwise.
|
||||||
|
* @return curve node.
|
||||||
*/
|
*/
|
||||||
public CommonTreeNode addCurveToPlot(CommonTreeNode plotNode, Object curve, int idx, boolean isNew) {
|
public CommonTreeNode addCurveToPlot(CommonTreeNode plotNode, Object curve, int idx, boolean isNew) {
|
||||||
CommonTreeNode curveNode = null;
|
CommonTreeNode curveNode = null;
|
||||||
@ -1445,11 +1443,11 @@ public class TrickQPActionController {
|
|||||||
application.productTree.addNode(plotNode, curveNode, idx, true);
|
application.productTree.addNode(plotNode, curveNode, idx, true);
|
||||||
ProductCurve productCurve = (ProductCurve)curveNode.getUserObject();
|
ProductCurve productCurve = (ProductCurve)curveNode.getUserObject();
|
||||||
if (isNew) {
|
if (isNew) {
|
||||||
if (idx == -1) {
|
if (idx == -1) {
|
||||||
((ProductPlot)plotNode.getUserObject()).addCurve(productCurve);
|
((ProductPlot)plotNode.getUserObject()).addCurve(productCurve);
|
||||||
} else {
|
} else {
|
||||||
((ProductPlot)plotNode.getUserObject()).addCurve(productCurve, idx);
|
((ProductPlot)plotNode.getUserObject()).addCurve(productCurve, idx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// if the curve has <varcase>...</varcase>
|
// if the curve has <varcase>...</varcase>
|
||||||
@ -1484,9 +1482,10 @@ public class TrickQPActionController {
|
|||||||
* is created based on the specified curve object.
|
* is created based on the specified curve object.
|
||||||
* @param isNew <code>true</code>, if the user object of the plot node does not
|
* @param isNew <code>true</code>, if the user object of the plot node does not
|
||||||
* have the curve user object in its curve list, <code>false</code> otherwise.
|
* have the curve user object in its curve list, <code>false</code> otherwise.
|
||||||
|
* @return curve node.
|
||||||
*/
|
*/
|
||||||
public CommonTreeNode addCurveToPlot(CommonTreeNode plotNode, Object curve, boolean isNew) {
|
public CommonTreeNode addCurveToPlot(CommonTreeNode plotNode, Object curve, boolean isNew) {
|
||||||
return addCurveToPlot(plotNode, curve, -1, isNew);
|
return addCurveToPlot(plotNode, curve, -1, isNew);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1497,6 +1496,7 @@ public class TrickQPActionController {
|
|||||||
* an instance of {@link ProductPlot}.
|
* an instance of {@link ProductPlot}.
|
||||||
* @param isNew <code>true</code> if the plot user object needs adding to the
|
* @param isNew <code>true</code> if the plot user object needs adding to the
|
||||||
* plot list of the page user object, <code>false</code> otherwise.
|
* plot list of the page user object, <code>false</code> otherwise.
|
||||||
|
* @return top plot node
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public CommonTreeNode addPlotToPage(CommonTreeNode pageNode, Object plot, boolean isNew) {
|
public CommonTreeNode addPlotToPage(CommonTreeNode pageNode, Object plot, boolean isNew) {
|
||||||
@ -1522,9 +1522,11 @@ public class TrickQPActionController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper method for adding a new Page.
|
* Helper method for adding a new Page.
|
||||||
|
* @param page the page node
|
||||||
|
* @return top page node
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("rawtypes")
|
@SuppressWarnings("rawtypes")
|
||||||
public CommonTreeNode addPageToPlots(ProductPage page) {
|
public CommonTreeNode addPageToPlots(ProductPage page) {
|
||||||
CommonTreeNode pageNode = null;
|
CommonTreeNode pageNode = null;
|
||||||
if (page == null) {
|
if (page == null) {
|
||||||
pageNode = new CommonTreeNode(new ProductPage(), CommonTreeNode.PAGE_NODE);
|
pageNode = new CommonTreeNode(new ProductPage(), CommonTreeNode.PAGE_NODE);
|
||||||
@ -1532,28 +1534,27 @@ public class TrickQPActionController {
|
|||||||
pageNode = new CommonTreeNode(page, CommonTreeNode.PAGE_NODE);
|
pageNode = new CommonTreeNode(page, CommonTreeNode.PAGE_NODE);
|
||||||
|
|
||||||
// plot list
|
// plot list
|
||||||
List plotList = page.getPlotList();
|
List plotList = page.getPlotList();
|
||||||
if (plotList != null) {
|
if (plotList != null) {
|
||||||
for (int j = 0; j < plotList.size(); j++) {
|
for (int j = 0; j < plotList.size(); j++) {
|
||||||
ProductPlot plot = (ProductPlot) plotList.get(j);
|
ProductPlot plot = (ProductPlot) plotList.get(j);
|
||||||
addPlotToPage(pageNode, plot, false);
|
addPlotToPage(pageNode, plot, false);
|
||||||
|
|
||||||
// TODO: axis, yaxis, zaxis
|
// TODO: axis, yaxis, zaxis
|
||||||
/***
|
/***
|
||||||
* DANNY addPlotToPage will add the curves List curveList =
|
* DANNY addPlotToPage will add the curves List curveList =
|
||||||
* plot.getCurveList(); if (curveList != null) { for (int k
|
* plot.getCurveList(); if (curveList != null) { for (int k
|
||||||
* = 0; k < curveList.size(); k++) { ProductCurve curve =
|
* = 0; k < curveList.size(); k++) { ProductCurve curve =
|
||||||
* (ProductCurve)curveList.get(k); CommonTreeNode curveNode
|
* (ProductCurve)curveList.get(k); CommonTreeNode curveNode
|
||||||
* = addCurveToPlot (plotNode, curve, false); } }
|
* = addCurveToPlot (plotNode, curve, false); } }
|
||||||
***/
|
***/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
application.productTree.addNode(application.plotsNode, pageNode, true);
|
application.productTree.addNode(application.plotsNode, pageNode, true);
|
||||||
return pageNode;
|
return pageNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper method for adding a new var to a table column.
|
* Helper method for adding a new var to a table column.
|
||||||
*/
|
*/
|
||||||
@ -1575,6 +1576,7 @@ public class TrickQPActionController {
|
|||||||
* The valid range would be [0, total child count of this table].
|
* The valid range would be [0, total child count of this table].
|
||||||
* @param isNew <code>true</code> if the column user object needs adding to the
|
* @param isNew <code>true</code> if the column user object needs adding to the
|
||||||
* column list of the table user object, <code>false</code> otherwise.
|
* column list of the table user object, <code>false</code> otherwise.
|
||||||
|
* @return top column node
|
||||||
*/
|
*/
|
||||||
public CommonTreeNode addColumnToTable(CommonTreeNode tableNode, Object column, int idx, boolean isNew) {
|
public CommonTreeNode addColumnToTable(CommonTreeNode tableNode, Object column, int idx, boolean isNew) {
|
||||||
CommonTreeNode columnNode = null;
|
CommonTreeNode columnNode = null;
|
||||||
@ -1585,11 +1587,11 @@ public class TrickQPActionController {
|
|||||||
}
|
}
|
||||||
application.productTree.addNode(tableNode, columnNode, idx, true);
|
application.productTree.addNode(tableNode, columnNode, idx, true);
|
||||||
if (isNew) {
|
if (isNew) {
|
||||||
if (idx == -1) {
|
if (idx == -1) {
|
||||||
((ProductTable)tableNode.getUserObject()).addColumn((ProductColumn)columnNode.getUserObject());
|
((ProductTable)tableNode.getUserObject()).addColumn((ProductColumn)columnNode.getUserObject());
|
||||||
} else {
|
} else {
|
||||||
((ProductTable)tableNode.getUserObject()).addColumn((ProductColumn)columnNode.getUserObject(), idx);
|
((ProductTable)tableNode.getUserObject()).addColumn((ProductColumn)columnNode.getUserObject(), idx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ProductColumn productColumn = (ProductColumn)columnNode.getUserObject();
|
ProductColumn productColumn = (ProductColumn)columnNode.getUserObject();
|
||||||
@ -1608,9 +1610,10 @@ public class TrickQPActionController {
|
|||||||
* an instance of {@link ProductColumn}.
|
* an instance of {@link ProductColumn}.
|
||||||
* @param isNew <code>true</code> if the column user object needs adding to the
|
* @param isNew <code>true</code> if the column user object needs adding to the
|
||||||
* column list of the table user object, <code>false</code> otherwise.
|
* column list of the table user object, <code>false</code> otherwise.
|
||||||
|
* @return top column node
|
||||||
*/
|
*/
|
||||||
public CommonTreeNode addColumnToTable(CommonTreeNode tableNode, Object column, boolean isNew) {
|
public CommonTreeNode addColumnToTable(CommonTreeNode tableNode, Object column, boolean isNew) {
|
||||||
return addColumnToTable(tableNode, column, -1, isNew);
|
return addColumnToTable(tableNode, column, -1, isNew);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1636,7 +1639,7 @@ public class TrickQPActionController {
|
|||||||
if (program == null) {
|
if (program == null) {
|
||||||
programNode = new CommonTreeNode(new ProductExternalFunction(), CommonTreeNode.PROGRAM_NODE);
|
programNode = new CommonTreeNode(new ProductExternalFunction(), CommonTreeNode.PROGRAM_NODE);
|
||||||
} else {
|
} else {
|
||||||
programNode = new CommonTreeNode(program, CommonTreeNode.PROGRAM_NODE);
|
programNode = new CommonTreeNode(program, CommonTreeNode.PROGRAM_NODE);
|
||||||
}
|
}
|
||||||
application.productTree.addNode(application.programsNode, programNode, true);
|
application.productTree.addNode(application.programsNode, programNode, true);
|
||||||
application.productTree.addNode(programNode, new CommonTreeNode("Input", CommonTreeNode.INPUT_NODE), true);
|
application.productTree.addNode(programNode, new CommonTreeNode("Input", CommonTreeNode.INPUT_NODE), true);
|
||||||
@ -1648,9 +1651,9 @@ public class TrickQPActionController {
|
|||||||
* Helper method for adding a var for program input
|
* Helper method for adding a var for program input
|
||||||
*/
|
*/
|
||||||
private void addVarToInput(ProductVar var, boolean isNew) {
|
private void addVarToInput(ProductVar var, boolean isNew) {
|
||||||
// As only one program is supported, input node is the 1st child of 1st Programs child
|
// As only one program is supported, input node is the 1st child of 1st Programs child
|
||||||
CommonTreeNode inputNode = (CommonTreeNode)(((CommonTreeNode)application.programsNode.getChildAt(0)).getChildAt(0));
|
CommonTreeNode inputNode = (CommonTreeNode)(((CommonTreeNode)application.programsNode.getChildAt(0)).getChildAt(0));
|
||||||
CommonTreeNode varNode = new CommonTreeNode(var, CommonTreeNode.INPUT_VAR_NODE);
|
CommonTreeNode varNode = new CommonTreeNode(var, CommonTreeNode.INPUT_VAR_NODE);
|
||||||
application.productTree.addNode(inputNode, varNode, true);
|
application.productTree.addNode(inputNode, varNode, true);
|
||||||
if (isNew) {
|
if (isNew) {
|
||||||
ProductExternalFunction program = (ProductExternalFunction)((CommonTreeNode)application.programsNode.getChildAt(0)).getUserObject();
|
ProductExternalFunction program = (ProductExternalFunction)((CommonTreeNode)application.programsNode.getChildAt(0)).getUserObject();
|
||||||
@ -1662,9 +1665,9 @@ public class TrickQPActionController {
|
|||||||
* Helper method for adding a var for program output
|
* Helper method for adding a var for program output
|
||||||
*/
|
*/
|
||||||
private void addVarToOutput(ProductMeasurement var, boolean isNew) {
|
private void addVarToOutput(ProductMeasurement var, boolean isNew) {
|
||||||
// As only one program is supported, output node is the 2st child of 1st Programs child
|
// As only one program is supported, output node is the 2st child of 1st Programs child
|
||||||
CommonTreeNode outputNode = (CommonTreeNode)(((CommonTreeNode)application.programsNode.getChildAt(0)).getChildAt(1));
|
CommonTreeNode outputNode = (CommonTreeNode)(((CommonTreeNode)application.programsNode.getChildAt(0)).getChildAt(1));
|
||||||
CommonTreeNode varNode = new CommonTreeNode(var, CommonTreeNode.OUTPUT_VAR_NODE);
|
CommonTreeNode varNode = new CommonTreeNode(var, CommonTreeNode.OUTPUT_VAR_NODE);
|
||||||
application.productTree.addNode(outputNode, varNode, true);
|
application.productTree.addNode(outputNode, varNode, true);
|
||||||
if (isNew) {
|
if (isNew) {
|
||||||
ProductExternalFunction program = (ProductExternalFunction)((CommonTreeNode)application.programsNode.getChildAt(0)).getUserObject();
|
ProductExternalFunction program = (ProductExternalFunction)((CommonTreeNode)application.programsNode.getChildAt(0)).getUserObject();
|
||||||
@ -1673,8 +1676,8 @@ public class TrickQPActionController {
|
|||||||
|
|
||||||
// also need to add this newly generated output var to var list
|
// also need to add this newly generated output var to var list
|
||||||
LogVar newOutVar = new LogVar(var.getName());
|
LogVar newOutVar = new LogVar(var.getName());
|
||||||
newOutVar.setUnits("--");
|
newOutVar.setUnits("--");
|
||||||
application.varList.addData(newOutVar);
|
application.varList.addData(newOutVar);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user