use of org.concord.energy3d.agents.ResultList in project energy3d by concord-consortium.
the class MainFrame method getHelpMenu.
private JMenu getHelpMenu() {
if (helpMenu == null) {
helpMenu = new JMenu("Help");
helpMenu.addMenuListener(new MenuListener() {
@Override
public void menuCanceled(final MenuEvent e) {
}
@Override
public void menuDeselected(final MenuEvent e) {
}
@Override
public void menuSelected(final MenuEvent e) {
}
});
// User data and models
final JMenu userHistoryMenu = new JMenu("View My History");
helpMenu.add(userHistoryMenu);
helpMenu.addSeparator();
final JMenu userEventsMenu = new JMenu("Events");
userHistoryMenu.add(userEventsMenu);
JMenuItem mi = new JMenuItem("Event String");
mi.addActionListener(new ActionListener() {
@Override
public void actionPerformed(final ActionEvent e) {
new EventString().showGui();
}
});
userEventsMenu.add(mi);
mi = new JMenuItem("Event Time Series");
mi.addActionListener(new ActionListener() {
@Override
public void actionPerformed(final ActionEvent e) {
new EventTimeSeries().showGui();
}
});
userEventsMenu.add(mi);
mi = new JMenuItem("Event Frequency");
mi.addActionListener(new ActionListener() {
@Override
public void actionPerformed(final ActionEvent e) {
new EventFrequency().showGui();
}
});
userEventsMenu.add(mi);
final JMenu userResultsMenu = new JMenu("Results");
userHistoryMenu.add(userResultsMenu);
mi = new JMenuItem("Analysis Results");
mi.addActionListener(new ActionListener() {
@Override
public void actionPerformed(final ActionEvent e) {
new ResultList().showGui();
}
});
userResultsMenu.add(mi);
if (!Config.isMac()) {
helpMenu.add(getPreferencesMenuItem());
}
helpMenu.add(getRecoveryMenuItem());
// the automatic updater can fail sometimes. This provides an independent check.
final JMenuItem miUpdate = new JMenuItem("Check Update...");
helpMenu.add(miUpdate);
miUpdate.setEnabled(!Config.isWebStart() && !Config.isEclipse());
miUpdate.addActionListener(new ActionListener() {
@Override
public void actionPerformed(final ActionEvent e) {
File jarFile = null;
try {
jarFile = new File(MainApplication.class.getProtectionDomain().getCodeSource().getLocation().toURI().getPath());
} catch (final URISyntaxException e1) {
e1.printStackTrace();
JOptionPane.showMessageDialog(instance, e1.getMessage(), "URL Error (local energy3d.jar)", JOptionPane.ERROR_MESSAGE);
return;
}
if (!jarFile.toString().endsWith("energy3d.jar")) {
return;
}
final long localLastModified = jarFile.lastModified();
new SwingWorker<Void, Void>() {
URLConnection connection = null;
String msg = null;
long remoteLastModified;
@Override
protected Void doInBackground() throws Exception {
try {
connection = new URL("http://energy.concord.org/energy3d/update/energy3d.jar").openConnection();
remoteLastModified = connection.getLastModified();
} catch (final Exception e1) {
e1.printStackTrace();
msg = e1.getMessage();
}
return null;
}
@Override
protected void done() {
if (connection == null) {
JOptionPane.showMessageDialog(instance, msg, "URL Error (remote energy3d.jar)", JOptionPane.ERROR_MESSAGE);
} else {
if (remoteLastModified <= localLastModified) {
JOptionPane.showMessageDialog(instance, "Your software is up to date.", "Update Status", JOptionPane.INFORMATION_MESSAGE);
} else {
JOptionPane.showMessageDialog(instance, "<html>Your software is out of date. But for some reason, it cannot update itself.<br>Please go to http://energy3d.concord.org to download and reinstall the latest version.</html>", "Update Status", JOptionPane.INFORMATION_MESSAGE);
Util.openBrowser("http://energy3d.concord.org");
}
}
}
}.execute();
}
});
helpMenu.addSeparator();
// Energy3D web pages
mi = new JMenuItem("Visit Virtual Solar Grid...");
mi.addActionListener(new ActionListener() {
@Override
public void actionPerformed(final ActionEvent e) {
Util.openBrowser("http://energy.concord.org/energy3d/vsg/syw.html");
}
});
helpMenu.add(mi);
mi = new JMenuItem("View Building Examples...");
mi.addActionListener(new ActionListener() {
@Override
public void actionPerformed(final ActionEvent e) {
Util.openBrowser("http://energy.concord.org/energy3d/styles.html");
}
});
helpMenu.add(mi);
mi = new JMenuItem("View User Work...");
mi.addActionListener(new ActionListener() {
@Override
public void actionPerformed(final ActionEvent e) {
Util.openBrowser("http://energy.concord.org/energy3d/models.html");
}
});
helpMenu.add(mi);
helpMenu.addSeparator();
mi = new JMenuItem("Visit User Forum...");
mi.addActionListener(new ActionListener() {
@Override
public void actionPerformed(final ActionEvent e) {
Util.openBrowser("https://energy.concord.org/energy3d/forum/");
}
});
helpMenu.add(mi);
mi = new JMenuItem("Visit Home Page...");
mi.addActionListener(new ActionListener() {
@Override
public void actionPerformed(final ActionEvent e) {
Util.openBrowser("http://energy3d.concord.org");
}
});
helpMenu.add(mi);
mi = new JMenuItem("Contact Us...");
mi.addActionListener(new ActionListener() {
@Override
public void actionPerformed(final ActionEvent e) {
Util.openBrowser("http://energy.concord.org/energy3d/contact.html");
}
});
helpMenu.add(mi);
if (!Config.isMac()) {
helpMenu.add(getAboutMenuItem());
}
}
return helpMenu;
}
Aggregations