mirror of
https://github.com/nasa/trick.git
synced 2024-12-18 20:57:55 +00:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
c7e5ab1139
@ -19,4 +19,10 @@ wiki page includes instructions to install Trick.
|
||||
The full [User's Guide](https://github.com/nasa/Trick/wiki/Users-Guide) is in
|
||||
the wiki pages.
|
||||
|
||||
### Tutorial
|
||||
|
||||
The Trick tutorial explaining how to start using Trick can be found in the docs directory.
|
||||
|
||||
### License
|
||||
|
||||
Trick is released under the NASA Open Source Agreement Version 1.3 [license](LICENSE).
|
||||
|
@ -2,8 +2,11 @@
|
||||
|
||||
# trick_dp that determines trick_home based on execution location of this script.
|
||||
|
||||
use FindBin qw($Bin);
|
||||
use lib "$Bin/pm" ;
|
||||
use File::Basename ;
|
||||
use Cwd 'abs_path';
|
||||
use gte ;
|
||||
|
||||
if ( ! exists $ENV{TRICK_HOME} ) {
|
||||
$trick_bin = dirname(abs_path($0)) ;
|
||||
@ -12,6 +15,9 @@ if ( ! exists $ENV{TRICK_HOME} ) {
|
||||
# set TRICK_HOME based on the value of trick_home
|
||||
$ENV{TRICK_HOME} = $trick_home ;
|
||||
}
|
||||
$host_cpu = gte("TRICK_HOST_CPU") ;
|
||||
chomp($host_cpu) ;
|
||||
$ENV{TRICK_HOST_CPU} = $host_cpu ;
|
||||
|
||||
if ( $^O eq "darwin" ) {
|
||||
$command = "java -classpath $ENV{TRICK_HOME}/bin/java/dist/*:$ENV{TRICK_HOME}/bin/java/lib/*:$ENV{TRICK_HOME}/bin/java/lib/ \\
|
||||
|
@ -1,3 +1,3 @@
|
||||
current_version = "13.6.dev"
|
||||
current_version = "15.0.dev"
|
||||
thread_version = "1.1"
|
||||
service_issues = ""
|
||||
|
@ -98,6 +98,7 @@ public abstract class DataProductsApplication extends TrickApplication {
|
||||
protected static String TEMP_DP_FILE = "/tmp/DP_" + System.getenv("USER") + ".xml";
|
||||
protected static String TEMP_SESSION_FILE = "/tmp/Session_" + System.getenv("USER") + ".xml";
|
||||
|
||||
protected boolean fermiExists ;
|
||||
|
||||
//========================================
|
||||
// Private Data
|
||||
@ -110,6 +111,7 @@ public abstract class DataProductsApplication extends TrickApplication {
|
||||
// Options are: "Plot", "Table".
|
||||
private String displayMode;
|
||||
|
||||
|
||||
//========================================
|
||||
// Constructors
|
||||
//========================================
|
||||
@ -122,28 +124,28 @@ public abstract class DataProductsApplication extends TrickApplication {
|
||||
* Sets the preferred presentation.
|
||||
*/
|
||||
public void setPreferredPresentation(String pt) {
|
||||
preferredPresentation = pt;
|
||||
preferredPresentation = pt;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the preferred presentation.
|
||||
*/
|
||||
public String getPreferredPresentation() {
|
||||
return preferredPresentation;
|
||||
return preferredPresentation;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets preferred display mode.
|
||||
*/
|
||||
public void setDisplayMode(String md) {
|
||||
displayMode = md;
|
||||
displayMode = md;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets preferred display mode.
|
||||
*/
|
||||
public String getDisplayMode() {
|
||||
return displayMode;
|
||||
return displayMode;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -239,7 +241,11 @@ public abstract class DataProductsApplication extends TrickApplication {
|
||||
} else {
|
||||
gnuplotButton.setIcon(resourceMap.getIcon("gnuplot.off.icon"));
|
||||
if (gnuplotRadioButton.isSelected()) {
|
||||
fermiRadioButton.setSelected(true);
|
||||
if ( fermiExists ) {
|
||||
fermiRadioButton.setSelected(true);
|
||||
} else {
|
||||
javaRadioButton.setSelected(true);
|
||||
}
|
||||
}
|
||||
getAction("selectGnuplotTerminal").setEnabled(false);
|
||||
}
|
||||
@ -360,15 +366,26 @@ public abstract class DataProductsApplication extends TrickApplication {
|
||||
|
||||
fermiRadioButton = new JRadioButtonMenuItem();
|
||||
fermiRadioButton.setAction(getAction("selectFermi"));
|
||||
fermiRadioButton.setSelected(true);
|
||||
|
||||
javaRadioButton = new JRadioButtonMenuItem(getAction("selectJavaPlot"));
|
||||
|
||||
String fermi_exe = UIUtils.getTrickHome() + "/trick_source/data_products/DPX/APPS/FXPLOT/object_" + UIUtils.getTrickHostCPU() + "/fxplot" ;
|
||||
File f = new File(fermi_exe) ;
|
||||
fermiExists = f.exists() ;
|
||||
|
||||
if ( fermiExists ) {
|
||||
fermiRadioButton.setSelected(true);
|
||||
} else {
|
||||
javaRadioButton.setSelected(true);
|
||||
}
|
||||
|
||||
gnuplotRadioButton = new JRadioButtonMenuItem();
|
||||
gnuplotRadioButton.setAction(getAction("selectGnuplot"));
|
||||
|
||||
radioButtonGroup = new ButtonGroup();
|
||||
radioButtonGroup.add(fermiRadioButton);
|
||||
if ( fermiExists ) {
|
||||
radioButtonGroup.add(fermiRadioButton);
|
||||
}
|
||||
radioButtonGroup.add(javaRadioButton);
|
||||
radioButtonGroup.add(gnuplotRadioButton);
|
||||
|
||||
@ -388,7 +405,7 @@ public abstract class DataProductsApplication extends TrickApplication {
|
||||
* @return a {@link JComponent} as the main panel.
|
||||
*/
|
||||
@Override
|
||||
protected JComponent createMainPanel() {
|
||||
protected JComponent createMainPanel() {
|
||||
|
||||
JXMultiSplitPane msp = new JXMultiSplitPane();
|
||||
|
||||
@ -557,13 +574,13 @@ public abstract class DataProductsApplication extends TrickApplication {
|
||||
* @param sessionFile The session used for plotting.
|
||||
*/
|
||||
public void launchPlotProgram(String sessionFile) {
|
||||
if (fermiRadioButton.isSelected()) {
|
||||
plotCommand = resourceMap.getString("fxplot.command");
|
||||
} else if (javaRadioButton.isSelected()) {
|
||||
plotCommand = resourceMap.getString("jxplot.command");
|
||||
} else if (gnuplotRadioButton.isSelected()) {
|
||||
plotCommand = resourceMap.getString("gxplot.command");
|
||||
}
|
||||
if (fermiRadioButton.isSelected()) {
|
||||
plotCommand = resourceMap.getString("fxplot.command");
|
||||
} else if (javaRadioButton.isSelected()) {
|
||||
plotCommand = resourceMap.getString("jxplot.command");
|
||||
} else if (gnuplotRadioButton.isSelected()) {
|
||||
plotCommand = resourceMap.getString("gxplot.command");
|
||||
}
|
||||
|
||||
plotCommand = UIUtils.getTrickBin() + File.separator + plotCommand;
|
||||
(new LaunchPlotProcessTask(plotCommand, sessionFile)).execute();
|
||||
@ -575,15 +592,15 @@ public abstract class DataProductsApplication extends TrickApplication {
|
||||
* @param command The operating system program and arguments.
|
||||
*/
|
||||
public void launchPlotProcess(String... command) throws Exception{
|
||||
if (command == null || command.length < 0) {
|
||||
printStatusMessage("No plotting command specified!\n");
|
||||
return;
|
||||
}
|
||||
if (command == null || command.length < 0) {
|
||||
printStatusMessage("No plotting command specified!\n");
|
||||
return;
|
||||
}
|
||||
if (plotDevice.equals(Session.DEVICE_OPTIONS[Session.FILE_DEVICE])) {
|
||||
printStatusMessage("Generating postscript file(s) ...\n");
|
||||
printStatusMessage("Generating postscript file(s) ...\n");
|
||||
} else {
|
||||
printStatusMessage("===>>>Launching " + command[0] + "<<<===\n");
|
||||
}
|
||||
}
|
||||
ProcessBuilder pb = new ProcessBuilder(command);
|
||||
|
||||
captureProcessMessage(pb.start());
|
||||
@ -629,7 +646,7 @@ public abstract class DataProductsApplication extends TrickApplication {
|
||||
|
||||
|
||||
private class LaunchPlotProcessTask extends SwingWorker<Void, Void> {
|
||||
private String[] processCommand;
|
||||
private String[] processCommand;
|
||||
public LaunchPlotProcessTask(String... command) {
|
||||
this.processCommand = command;
|
||||
}
|
||||
@ -637,10 +654,10 @@ public abstract class DataProductsApplication extends TrickApplication {
|
||||
@Override
|
||||
public Void doInBackground() {
|
||||
try {
|
||||
launchPlotProcess(processCommand);
|
||||
} catch (Exception e) {
|
||||
printStatusMessage("Error launching plotting process!\n");
|
||||
}
|
||||
launchPlotProcess(processCommand);
|
||||
} catch (Exception e) {
|
||||
printStatusMessage("Error launching plotting process!\n");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -74,7 +74,7 @@ public class TrickDPApplication extends DataProductsApplication {
|
||||
//========================================
|
||||
// Public data
|
||||
//========================================
|
||||
public FileTreePanel simRunTree;
|
||||
public FileTreePanel simRunTree;
|
||||
public FileTreePanel simDPTree;
|
||||
public ListPanel runList;
|
||||
public ListPanel dpList;
|
||||
@ -116,7 +116,7 @@ public class TrickDPApplication extends DataProductsApplication {
|
||||
//========================================
|
||||
@Action
|
||||
public void newSession() {
|
||||
actionController.handleNewSession();
|
||||
actionController.handleNewSession();
|
||||
}
|
||||
|
||||
@Action
|
||||
@ -136,44 +136,44 @@ public class TrickDPApplication extends DataProductsApplication {
|
||||
|
||||
@Action
|
||||
public void singlePlot() {
|
||||
setPreferredPresentation(Session.PRESENTATION_OPTIONS[Session.SIMPLE_PRESENTATION]);
|
||||
setDisplayMode(Session.MODE_OPTIONS[Session.PLOT_MODE]);
|
||||
actionController.handleSinglePlot();
|
||||
setPreferredPresentation(Session.PRESENTATION_OPTIONS[Session.SIMPLE_PRESENTATION]);
|
||||
setDisplayMode(Session.MODE_OPTIONS[Session.PLOT_MODE]);
|
||||
actionController.handleSinglePlot();
|
||||
}
|
||||
|
||||
@Action
|
||||
public void comparisonPlot() {
|
||||
setPreferredPresentation(Session.PRESENTATION_OPTIONS[Session.COMPARISON_PRESENTATION]);
|
||||
setDisplayMode(Session.MODE_OPTIONS[Session.PLOT_MODE]);
|
||||
actionController.handleComparisonPlot();
|
||||
setPreferredPresentation(Session.PRESENTATION_OPTIONS[Session.COMPARISON_PRESENTATION]);
|
||||
setDisplayMode(Session.MODE_OPTIONS[Session.PLOT_MODE]);
|
||||
actionController.handleComparisonPlot();
|
||||
}
|
||||
|
||||
@Action
|
||||
public void errorPlot() {
|
||||
setPreferredPresentation(Session.PRESENTATION_OPTIONS[Session.DELTA_PRESENTATION]);
|
||||
setDisplayMode(Session.MODE_OPTIONS[Session.PLOT_MODE]);
|
||||
actionController.handleErrorPlot();
|
||||
setPreferredPresentation(Session.PRESENTATION_OPTIONS[Session.DELTA_PRESENTATION]);
|
||||
setDisplayMode(Session.MODE_OPTIONS[Session.PLOT_MODE]);
|
||||
actionController.handleErrorPlot();
|
||||
}
|
||||
|
||||
@Action
|
||||
public void contrastPlot() {
|
||||
setPreferredPresentation(Session.PRESENTATION_OPTIONS[Session.CONTRAST_PRESENTATION]);
|
||||
setDisplayMode(Session.MODE_OPTIONS[Session.PLOT_MODE]);
|
||||
actionController.handleContrastPlot();
|
||||
setPreferredPresentation(Session.PRESENTATION_OPTIONS[Session.CONTRAST_PRESENTATION]);
|
||||
setDisplayMode(Session.MODE_OPTIONS[Session.PLOT_MODE]);
|
||||
actionController.handleContrastPlot();
|
||||
}
|
||||
|
||||
@Action
|
||||
public void tabularData() {
|
||||
setPreferredPresentation(Session.PRESENTATION_OPTIONS[Session.SIMPLE_PRESENTATION]);
|
||||
setDisplayMode(Session.MODE_OPTIONS[Session.TABLE_MODE]);
|
||||
actionController.handleTabularData();
|
||||
setPreferredPresentation(Session.PRESENTATION_OPTIONS[Session.SIMPLE_PRESENTATION]);
|
||||
setDisplayMode(Session.MODE_OPTIONS[Session.TABLE_MODE]);
|
||||
actionController.handleTabularData();
|
||||
}
|
||||
|
||||
@Action
|
||||
public void tabularErrorData() {
|
||||
setPreferredPresentation(Session.PRESENTATION_OPTIONS[Session.DELTA_PRESENTATION]);
|
||||
setDisplayMode(Session.MODE_OPTIONS[Session.TABLE_MODE]);
|
||||
actionController.handleTabularErrorData();
|
||||
setPreferredPresentation(Session.PRESENTATION_OPTIONS[Session.DELTA_PRESENTATION]);
|
||||
setDisplayMode(Session.MODE_OPTIONS[Session.TABLE_MODE]);
|
||||
actionController.handleTabularErrorData();
|
||||
}
|
||||
|
||||
// user selected Import Sim Dir from Sims/Runs menu
|
||||
@ -216,20 +216,20 @@ public class TrickDPApplication extends DataProductsApplication {
|
||||
|
||||
@Action
|
||||
public void createPDF() {
|
||||
if (fileDevice == null) {
|
||||
fileDevice = new File(UIUtils.getTrickUserHome());
|
||||
}
|
||||
PDFBooklet.showDialog(getMainFrame(), "Create PDF", fileDevice);
|
||||
if (fileDevice == null) {
|
||||
fileDevice = new File(UIUtils.getTrickUserHome());
|
||||
}
|
||||
PDFBooklet.showDialog(getMainFrame(), "Create PDF", fileDevice);
|
||||
}
|
||||
|
||||
@Action
|
||||
public void addRuns() {
|
||||
actionController.handleAddRuns();
|
||||
actionController.handleAddRuns();
|
||||
|
||||
// Need to modify trick_qp as well when runs are added, so
|
||||
// registering the remote call. Every time need to
|
||||
// register a new one as the other application could
|
||||
// be no longer exist.
|
||||
// Need to modify trick_qp as well when runs are added, so
|
||||
// registering the remote call. Every time need to
|
||||
// register a new one as the other application could
|
||||
// be no longer exist.
|
||||
try {
|
||||
registerQPRemoteCall();
|
||||
} catch (RemoteException re) {
|
||||
@ -243,31 +243,31 @@ public class TrickDPApplication extends DataProductsApplication {
|
||||
// if trick_qp is not up, remote call won't be created successfully
|
||||
// and then there is no need to update trick_qp.
|
||||
if (qpRemoteCall != null) {
|
||||
if (runList.getAllData() != null) {
|
||||
Object[] allRuns = runList.getAllData();
|
||||
int len = allRuns.length;
|
||||
if (len > 0) {
|
||||
final String[] dirList = new String[len];
|
||||
for (int i = 0; i < len; i ++) {
|
||||
if (allRuns[i] instanceof SessionRun) {
|
||||
dirList[i] = ((SessionRun)allRuns[i]).getDir();
|
||||
}
|
||||
}
|
||||
try {
|
||||
// parsing the String array instead of an array of SessionRun
|
||||
// so that we don't have to worry about the SessionRun objects serialization.
|
||||
qpRemoteCall.updateRunList(dirList);
|
||||
} catch (RemoteException re) {
|
||||
if (runList.getAllData() != null) {
|
||||
Object[] allRuns = runList.getAllData();
|
||||
int len = allRuns.length;
|
||||
if (len > 0) {
|
||||
final String[] dirList = new String[len];
|
||||
for (int i = 0; i < len; i ++) {
|
||||
if (allRuns[i] instanceof SessionRun) {
|
||||
dirList[i] = ((SessionRun)allRuns[i]).getDir();
|
||||
}
|
||||
}
|
||||
try {
|
||||
// parsing the String array instead of an array of SessionRun
|
||||
// so that we don't have to worry about the SessionRun objects serialization.
|
||||
qpRemoteCall.updateRunList(dirList);
|
||||
} catch (RemoteException re) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Action
|
||||
public void readDPList() {
|
||||
actionController.handleReadDPList();
|
||||
actionController.handleReadDPList();
|
||||
}
|
||||
|
||||
@Action
|
||||
@ -347,39 +347,39 @@ public class TrickDPApplication extends DataProductsApplication {
|
||||
// Filter from Data Product menu
|
||||
@Action
|
||||
public void filterDP() {
|
||||
actionController.handleFilterDP();
|
||||
actionController.handleFilterDP();
|
||||
}
|
||||
|
||||
@Action
|
||||
public void runSim() {
|
||||
String simExe = "./S_main_" + UIUtils.getTrickHostCPU() + ".exe";
|
||||
for (String eachItem : simRunTree.getSelectedItems()) {
|
||||
File eachItemFile = new File(eachItem);
|
||||
File simFilePath = eachItemFile.getParentFile();
|
||||
// find out the SIM_ directory for the RUN
|
||||
while (!simFilePath.getName().startsWith("SIM_")) {
|
||||
simFilePath = simFilePath.getParentFile();
|
||||
}
|
||||
String simExeArg = eachItem+System.getProperty("file.separator")+"input.py";
|
||||
ProcessBuilder pb = new ProcessBuilder(simExe, simExeArg);
|
||||
pb.directory(simFilePath);
|
||||
printStatusMessage("cd " + simFilePath.getPath() + "\n");
|
||||
printStatusMessage(simExe + " " + simExeArg + "\n");
|
||||
Process process = null;
|
||||
try {
|
||||
String simExe = "./S_main_" + UIUtils.getTrickHostCPU() + ".exe";
|
||||
for (String eachItem : simRunTree.getSelectedItems()) {
|
||||
File eachItemFile = new File(eachItem);
|
||||
File simFilePath = eachItemFile.getParentFile();
|
||||
// find out the SIM_ directory for the RUN
|
||||
while (!simFilePath.getName().startsWith("SIM_")) {
|
||||
simFilePath = simFilePath.getParentFile();
|
||||
}
|
||||
String simExeArg = eachItem+System.getProperty("file.separator")+"input.py";
|
||||
ProcessBuilder pb = new ProcessBuilder(simExe, simExeArg);
|
||||
pb.directory(simFilePath);
|
||||
printStatusMessage("cd " + simFilePath.getPath() + "\n");
|
||||
printStatusMessage(simExe + " " + simExeArg + "\n");
|
||||
Process process = null;
|
||||
try {
|
||||
process = pb.start();
|
||||
} catch (IOException e) {
|
||||
printStatusMessage(e.getMessage() + "\n");
|
||||
}
|
||||
if (process != null) {
|
||||
captureProcessMessage(process);
|
||||
}
|
||||
}
|
||||
if (process != null) {
|
||||
captureProcessMessage(process);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Action
|
||||
public void refreshSelected() {
|
||||
actionController.handleRefreshSelected();
|
||||
actionController.handleRefreshSelected();
|
||||
}
|
||||
|
||||
@Action
|
||||
@ -418,9 +418,9 @@ public class TrickDPApplication extends DataProductsApplication {
|
||||
* Helper method for registering the remote call to call functions in trick_qp.
|
||||
*/
|
||||
private void registerQPRemoteCall() throws RemoteException, MalformedURLException, NotBoundException {
|
||||
// TODO: may need to change to register by hostname and port number.
|
||||
// Here "localhost" is hard-coded and the default port 1099 is implied.
|
||||
Registry registry = LocateRegistry.getRegistry();
|
||||
// TODO: may need to change to register by hostname and port number.
|
||||
// Here "localhost" is hard-coded and the default port 1099 is implied.
|
||||
Registry registry = LocateRegistry.getRegistry();
|
||||
qpRemoteCall = (QPRemoteCallInterface) registry.lookup("server.QPRemoteCallInterface");
|
||||
}
|
||||
|
||||
@ -433,25 +433,25 @@ public class TrickDPApplication extends DataProductsApplication {
|
||||
*/
|
||||
@Override
|
||||
protected void ready() {
|
||||
super.ready();
|
||||
// TODO: may need to support different port instead of the default one
|
||||
// Create the registry in case any other application needs to
|
||||
// make the remote call to this application. Be sure to create
|
||||
// a different registry from trick_qp.
|
||||
try {
|
||||
LocateRegistry.createRegistry(1099);
|
||||
} catch (RemoteException re) {
|
||||
// registry already exists, do nothing
|
||||
}
|
||||
super.ready();
|
||||
// TODO: may need to support different port instead of the default one
|
||||
// Create the registry in case any other application needs to
|
||||
// make the remote call to this application. Be sure to create
|
||||
// a different registry from trick_qp.
|
||||
try {
|
||||
LocateRegistry.createRegistry(1099);
|
||||
} catch (RemoteException re) {
|
||||
// registry already exists, do nothing
|
||||
}
|
||||
|
||||
try {
|
||||
try {
|
||||
dpRemoteCall = new DPRemoteCallInterfaceImpl();
|
||||
Naming.rebind("server.DPRemoteCallInterface", dpRemoteCall);
|
||||
} catch (RemoteException re) {
|
||||
} catch (RemoteException re) {
|
||||
|
||||
} catch (MalformedURLException me) {
|
||||
} catch (MalformedURLException me) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -462,7 +462,7 @@ public class TrickDPApplication extends DataProductsApplication {
|
||||
*/
|
||||
@Override
|
||||
protected void initialize(String[] args) {
|
||||
super.initialize(args);
|
||||
super.initialize(args);
|
||||
initProperties();
|
||||
}
|
||||
|
||||
@ -490,15 +490,15 @@ public class TrickDPApplication extends DataProductsApplication {
|
||||
* Required by {@link DataProductsApplication}.
|
||||
*/
|
||||
@Override
|
||||
protected void createActionController() {
|
||||
actionController = new TrickDPActionController();
|
||||
protected void createActionController() {
|
||||
actionController = new TrickDPActionController();
|
||||
}
|
||||
|
||||
/**
|
||||
* Required by {@link DataProductsApplication}.
|
||||
*/
|
||||
@Override
|
||||
protected JComponent createLeftTop() {
|
||||
protected JComponent createLeftTop() {
|
||||
TrickFileFilter simRunFileFilter = new TrickFileFilter(TrickFileFilter.SIM_RUN);
|
||||
|
||||
String simDirList = trickProperties.getProperty("TRICK_DP_SIM_DIRS");
|
||||
@ -526,8 +526,8 @@ public class TrickDPApplication extends DataProductsApplication {
|
||||
}
|
||||
|
||||
} else {
|
||||
// after app properties initialization, simDirList should never be null
|
||||
// leave else here just in case!
|
||||
// after app properties initialization, simDirList should never be null
|
||||
// leave else here just in case!
|
||||
File dir = new File(UIUtils.getTrickUserHome());
|
||||
simRunTree = new SimRunTree(dir, simRunFileFilter, 4);
|
||||
}
|
||||
@ -556,8 +556,8 @@ public class TrickDPApplication extends DataProductsApplication {
|
||||
* Helper method for expanding the node at frist row of a tree.
|
||||
*/
|
||||
private void expandFirstNodeOfTree(FileTreePanel treePanel) {
|
||||
treePanel.getTree().expandRow(0);
|
||||
treePanel.scrollToTreeTop();
|
||||
treePanel.getTree().expandRow(0);
|
||||
treePanel.scrollToTreeTop();
|
||||
}
|
||||
|
||||
|
||||
@ -565,7 +565,7 @@ public class TrickDPApplication extends DataProductsApplication {
|
||||
* Required by {@link DataProductsApplication}.
|
||||
*/
|
||||
@Override
|
||||
protected JComponent createLeftMiddle() {
|
||||
protected JComponent createLeftMiddle() {
|
||||
runList = new ListPanel();
|
||||
runList.setType(DataPanel.RUN_LIST);
|
||||
simRunTree.addObserver(runList);
|
||||
@ -590,7 +590,7 @@ public class TrickDPApplication extends DataProductsApplication {
|
||||
* Required by {@link DataProductsApplication}.
|
||||
*/
|
||||
@Override
|
||||
protected JComponent createRightTop() {
|
||||
protected JComponent createRightTop() {
|
||||
File dir = new File(UIUtils.getTrickUserHome());
|
||||
TrickFileFilter simDPFileFilter = new TrickFileFilter(TrickFileFilter.SIM_DP);
|
||||
simDPTree = new SimDPTree(dir, simDPFileFilter, 4);
|
||||
@ -619,7 +619,7 @@ public class TrickDPApplication extends DataProductsApplication {
|
||||
* Required by {@link DataProductsApplication}.
|
||||
*/
|
||||
@Override
|
||||
protected JComponent createRightMiddle() {
|
||||
protected JComponent createRightMiddle() {
|
||||
dpList = new ListPanel();
|
||||
dpList.setType(DataPanel.DP_LIST);
|
||||
simDPTree.addObserver(dpList);
|
||||
@ -640,7 +640,7 @@ public class TrickDPApplication extends DataProductsApplication {
|
||||
* Required by {@link DataProductsApplication}.
|
||||
*/
|
||||
@Override
|
||||
protected JComponent createBottom() {
|
||||
protected JComponent createBottom() {
|
||||
JComponent Bottom = getCommonBottom();
|
||||
Bottom.setPreferredSize(new Dimension(800, 150));
|
||||
|
||||
@ -747,9 +747,9 @@ public class TrickDPApplication extends DataProductsApplication {
|
||||
toolBar.setFloatable(false);
|
||||
for (String actionName : toolbarActionNames) {
|
||||
if (actionName.equals("---")) {
|
||||
toolBar.addSeparator();
|
||||
toolBar.addSeparator();
|
||||
} else if (actionName.equals("toggleGnuplot")) {
|
||||
toolBar.add(gnuplotButton);
|
||||
toolBar.add(gnuplotButton);
|
||||
} else {
|
||||
toolBar.add(createButton(actionName, false));
|
||||
}
|
||||
@ -763,8 +763,8 @@ public class TrickDPApplication extends DataProductsApplication {
|
||||
* Helper method for creating Settings menu.
|
||||
*/
|
||||
private JMenu createSettingsMenu() {
|
||||
JMenu settingsMenu = new JMenu();
|
||||
settingsMenu.setName("settingsMenu");
|
||||
JMenu settingsMenu = new JMenu();
|
||||
settingsMenu.setName("settingsMenu");
|
||||
|
||||
settingsMenu.add(new JLabel("Device"));
|
||||
|
||||
@ -772,7 +772,11 @@ public class TrickDPApplication extends DataProductsApplication {
|
||||
settingsMenu.addSeparator();
|
||||
|
||||
settingsMenu.add(new JLabel("Plot Utility"));
|
||||
addRadioButtonMenuItems(settingsMenu, new JRadioButtonMenuItem[]{fermiRadioButton, javaRadioButton, gnuplotRadioButton});
|
||||
if ( fermiExists ) {
|
||||
addRadioButtonMenuItems(settingsMenu, new JRadioButtonMenuItem[]{fermiRadioButton, javaRadioButton, gnuplotRadioButton});
|
||||
} else {
|
||||
addRadioButtonMenuItems(settingsMenu, new JRadioButtonMenuItem[]{javaRadioButton, gnuplotRadioButton});
|
||||
}
|
||||
|
||||
settingsMenu.addSeparator();
|
||||
|
||||
@ -781,7 +785,7 @@ public class TrickDPApplication extends DataProductsApplication {
|
||||
|
||||
settingsMenu.add(gnuplotTerminalMenu);
|
||||
gnuplotTerminalMenuItems = addRadioButtonMenuItems(gnuplotTerminalMenu, new String[]{"selectX11", "selectPSColor", "selectPSBW", "selectPNG", "selectEPS", "selectAQUA"});
|
||||
return settingsMenu;
|
||||
return settingsMenu;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -824,10 +828,10 @@ public class TrickDPApplication extends DataProductsApplication {
|
||||
String simDirs = addCurrentDir();
|
||||
|
||||
/*if (simDirs == null) {
|
||||
simDirs = UIUtils.getTrickUserHome();
|
||||
if (simDirs == null) {
|
||||
simDirs = "";
|
||||
}
|
||||
simDirs = UIUtils.getTrickUserHome();
|
||||
if (simDirs == null) {
|
||||
simDirs = "";
|
||||
}
|
||||
}*/
|
||||
|
||||
simDirs = appendDirsFromPropertyFile(simDirs);
|
||||
@ -842,8 +846,8 @@ public class TrickDPApplication extends DataProductsApplication {
|
||||
}
|
||||
|
||||
// the dir that is shown on the top and is always expanded when the gui is initially up.
|
||||
// this dir is either the current dir if it is in a SIM or has a SIM dir
|
||||
// or the TRICK_USER_HOME.
|
||||
// this dir is either the current dir if it is in a SIM or has a SIM dir
|
||||
// or the TRICK_USER_HOME.
|
||||
trickProperties.setProperty("TRICK_DP_SIM_DIRS", simDirs);
|
||||
}
|
||||
|
||||
@ -857,15 +861,15 @@ public class TrickDPApplication extends DataProductsApplication {
|
||||
|
||||
// if current dir is in a SIM dir, import its parent
|
||||
if ( currentDir.contains("/SIM") ) {
|
||||
try {
|
||||
simDirs = (new File("..")).getCanonicalPath();
|
||||
} catch (java.io.IOException ioe) {
|
||||
// shouldn't get here
|
||||
simDirs = currentDir.replaceAll("/SIM+\\S*", "");
|
||||
}
|
||||
try {
|
||||
simDirs = (new File("..")).getCanonicalPath();
|
||||
} catch (java.io.IOException ioe) {
|
||||
// shouldn't get here
|
||||
simDirs = currentDir.replaceAll("/SIM+\\S*", "");
|
||||
}
|
||||
} else {
|
||||
// Filter a list of returned files that are SIM directories
|
||||
// TODO: use TrickFileFilter
|
||||
// TODO: use TrickFileFilter
|
||||
FilenameFilter simFilter = new FilenameFilter() {
|
||||
public boolean accept(File path, String filename) {
|
||||
File myFullPath = new File(path + System.getProperty("file.separator") + filename);
|
||||
@ -900,15 +904,15 @@ public class TrickDPApplication extends DataProductsApplication {
|
||||
if (dpSimDirsProperty == null) {
|
||||
return simDirs;
|
||||
}
|
||||
String[] dpSimDirs = dpSimDirsProperty.split(",");
|
||||
String[] dpSimDirs = dpSimDirsProperty.split(",");
|
||||
|
||||
// if the property doesn't have any value for some reason,
|
||||
// return the original string
|
||||
if (dpSimDirs == null || dpSimDirs.length < 1) {
|
||||
return simDirs;
|
||||
}
|
||||
// if the property doesn't have any value for some reason,
|
||||
// return the original string
|
||||
if (dpSimDirs == null || dpSimDirs.length < 1) {
|
||||
return simDirs;
|
||||
}
|
||||
|
||||
Arrays.sort(dpSimDirs);
|
||||
Arrays.sort(dpSimDirs);
|
||||
|
||||
for (String eachDir : dpSimDirs) {
|
||||
if (eachDir == null || eachDir.isEmpty()) {
|
||||
@ -924,11 +928,11 @@ public class TrickDPApplication extends DataProductsApplication {
|
||||
}
|
||||
// Keep the first one as the first one as it will be expanded automatically at beginning
|
||||
if ( t1 == true && t2 == false ){
|
||||
if (!simDirs.isEmpty()) {
|
||||
simDirs = simDirs.concat("," + eachDir);
|
||||
} else {
|
||||
simDirs = eachDir;
|
||||
}
|
||||
if (!simDirs.isEmpty()) {
|
||||
simDirs = simDirs.concat("," + eachDir);
|
||||
} else {
|
||||
simDirs = eachDir;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -954,37 +958,37 @@ public class TrickDPApplication extends DataProductsApplication {
|
||||
/**
|
||||
* Sets the device for plotting.
|
||||
*
|
||||
* @param dc The name of the device.
|
||||
* @param dc The name of the device.
|
||||
*/
|
||||
public void setDevice(String dc) {
|
||||
if (dc.equalsIgnoreCase(Session.DEVICE_OPTIONS[Session.PRINTER_DEVICE])) {
|
||||
deviceMenuItems[Session.PRINTER_DEVICE].doClick();
|
||||
} else if (dc.equalsIgnoreCase(Session.DEVICE_OPTIONS[Session.FILE_DEVICE])) {
|
||||
deviceMenuItems[Session.FILE_DEVICE].doClick();
|
||||
} else {
|
||||
deviceMenuItems[Session.TERMINAL_DEVICE].doClick(); // default
|
||||
}
|
||||
if (dc.equalsIgnoreCase(Session.DEVICE_OPTIONS[Session.PRINTER_DEVICE])) {
|
||||
deviceMenuItems[Session.PRINTER_DEVICE].doClick();
|
||||
} else if (dc.equalsIgnoreCase(Session.DEVICE_OPTIONS[Session.FILE_DEVICE])) {
|
||||
deviceMenuItems[Session.FILE_DEVICE].doClick();
|
||||
} else {
|
||||
deviceMenuItems[Session.TERMINAL_DEVICE].doClick(); // default
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the Gnuplot terminal.
|
||||
*
|
||||
* @param gt The name of the Gnuplot terminal.
|
||||
* @param gt The name of the Gnuplot terminal.
|
||||
*/
|
||||
public void setGnuplotTerminal(String gt) {
|
||||
if (gt.equalsIgnoreCase(Session.GNUPLOT_TERMINAL_OPTIONS[Session.PS_COLOR_GNUPLOT_TERMINAL])) {
|
||||
gnuplotTerminalMenuItems[Session.PS_COLOR_GNUPLOT_TERMINAL].doClick();
|
||||
} else if (gt.equalsIgnoreCase(Session.GNUPLOT_TERMINAL_OPTIONS[Session.PS_BW_GNUPLOT_TERMINAL])) {
|
||||
gnuplotTerminalMenuItems[Session.PS_BW_GNUPLOT_TERMINAL].doClick();
|
||||
} else if (gt.equalsIgnoreCase(Session.GNUPLOT_TERMINAL_OPTIONS[Session.PNG_GNUPLOT_TERMINAL])) {
|
||||
gnuplotTerminalMenuItems[Session.PNG_GNUPLOT_TERMINAL].doClick();
|
||||
} else if (gt.equalsIgnoreCase(Session.GNUPLOT_TERMINAL_OPTIONS[Session.EPS_GNUPLOT_TERMINAL])) {
|
||||
gnuplotTerminalMenuItems[Session.EPS_GNUPLOT_TERMINAL].doClick();
|
||||
} else if (gt.equalsIgnoreCase(Session.GNUPLOT_TERMINAL_OPTIONS[Session.AQUA_GNUPLOT_TERMINAL])) {
|
||||
gnuplotTerminalMenuItems[Session.AQUA_GNUPLOT_TERMINAL].doClick();
|
||||
} else {
|
||||
gnuplotTerminalMenuItems[Session.X11_GNUPLOT_TERMINAL].doClick(); // default
|
||||
}
|
||||
if (gt.equalsIgnoreCase(Session.GNUPLOT_TERMINAL_OPTIONS[Session.PS_COLOR_GNUPLOT_TERMINAL])) {
|
||||
gnuplotTerminalMenuItems[Session.PS_COLOR_GNUPLOT_TERMINAL].doClick();
|
||||
} else if (gt.equalsIgnoreCase(Session.GNUPLOT_TERMINAL_OPTIONS[Session.PS_BW_GNUPLOT_TERMINAL])) {
|
||||
gnuplotTerminalMenuItems[Session.PS_BW_GNUPLOT_TERMINAL].doClick();
|
||||
} else if (gt.equalsIgnoreCase(Session.GNUPLOT_TERMINAL_OPTIONS[Session.PNG_GNUPLOT_TERMINAL])) {
|
||||
gnuplotTerminalMenuItems[Session.PNG_GNUPLOT_TERMINAL].doClick();
|
||||
} else if (gt.equalsIgnoreCase(Session.GNUPLOT_TERMINAL_OPTIONS[Session.EPS_GNUPLOT_TERMINAL])) {
|
||||
gnuplotTerminalMenuItems[Session.EPS_GNUPLOT_TERMINAL].doClick();
|
||||
} else if (gt.equalsIgnoreCase(Session.GNUPLOT_TERMINAL_OPTIONS[Session.AQUA_GNUPLOT_TERMINAL])) {
|
||||
gnuplotTerminalMenuItems[Session.AQUA_GNUPLOT_TERMINAL].doClick();
|
||||
} else {
|
||||
gnuplotTerminalMenuItems[Session.X11_GNUPLOT_TERMINAL].doClick(); // default
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1006,29 +1010,29 @@ public class TrickDPApplication extends DataProductsApplication {
|
||||
* @param e MouseEvent sent from system.
|
||||
*/
|
||||
@Override
|
||||
public void mouseClicked(MouseEvent e) {
|
||||
public void mouseClicked(MouseEvent e) {
|
||||
if (UIUtils.isRightMouseClick(e)) {
|
||||
if (e.getSource() == runList.getJList()) {
|
||||
if (runList.getSelectedFirstData() != null &&
|
||||
runList.getSelectedFirstData() instanceof SessionRun) {
|
||||
runToConfigure = (SessionRun)runList.getSelectedFirstData();
|
||||
}
|
||||
} else if (e.getSource() == dpList.getJList()) {
|
||||
int index = dpList.getJList().locationToIndex(e.getPoint());
|
||||
if (index > -1) {
|
||||
Object clickedObj = dpList.getJList().getModel().getElementAt(index);
|
||||
rightClickedDP = clickedObj.toString();
|
||||
} else {
|
||||
rightClickedDP = null;
|
||||
}
|
||||
} else if (e.getSource() == simDPTree.getTree()) {
|
||||
if (simDPTree.getRightClickedTreeUserObj() != null) {
|
||||
if (e.getSource() == runList.getJList()) {
|
||||
if (runList.getSelectedFirstData() != null &&
|
||||
runList.getSelectedFirstData() instanceof SessionRun) {
|
||||
runToConfigure = (SessionRun)runList.getSelectedFirstData();
|
||||
}
|
||||
} else if (e.getSource() == dpList.getJList()) {
|
||||
int index = dpList.getJList().locationToIndex(e.getPoint());
|
||||
if (index > -1) {
|
||||
Object clickedObj = dpList.getJList().getModel().getElementAt(index);
|
||||
rightClickedDP = clickedObj.toString();
|
||||
} else {
|
||||
rightClickedDP = null;
|
||||
}
|
||||
} else if (e.getSource() == simDPTree.getTree()) {
|
||||
if (simDPTree.getRightClickedTreeUserObj() != null) {
|
||||
rightClickedDP = simDPTree.getRightClickedTreeUserObj().getFile().getAbsolutePath();
|
||||
} else {
|
||||
rightClickedDP = null;
|
||||
}
|
||||
}
|
||||
// common behaviors are handled in ListPanel
|
||||
}
|
||||
// common behaviors are handled in ListPanel
|
||||
} else if (UIUtils.isDoubleClick(e)) {
|
||||
if (e.getSource() == dpList.getJList()) {
|
||||
dpList.removeSelectedData();
|
||||
|
Loading…
Reference in New Issue
Block a user