use of org.concord.energy3d.util.ClipImage in project energy3d by concord-consortium.
the class EventTimeSeries method showGui.
public void showGui() {
final JDialog dialog = new JDialog(MainFrame.getInstance(), "Time Series of Events", true);
dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
final JPanel contentPane = new JPanel(new BorderLayout());
dialog.setContentPane(contentPane);
final JMenuBar menuBar = new JMenuBar();
dialog.setJMenuBar(menuBar);
final JMenu menu = new JMenu("Export");
menuBar.add(menu);
final JMenuItem mi = new JMenuItem("Copy Image");
mi.addActionListener(new ActionListener() {
@Override
public void actionPerformed(final ActionEvent e) {
new ClipImage().copyImageToClipboard(EventTimeSeries.this);
}
});
menu.add(mi);
final JPanel panel = new JPanel(new BorderLayout());
panel.setBorder(BorderFactory.createEtchedBorder());
contentPane.add(panel, BorderLayout.CENTER);
panel.add(this, BorderLayout.CENTER);
final JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
contentPane.add(buttonPanel, BorderLayout.SOUTH);
final JButton button = new JButton("Close");
button.addActionListener(new ActionListener() {
@Override
public void actionPerformed(final ActionEvent e) {
dialog.dispose();
}
});
buttonPanel.add(button);
dialog.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(final WindowEvent e) {
dialog.dispose();
}
});
dialog.pack();
dialog.setLocationRelativeTo(MainFrame.getInstance());
dialog.setVisible(true);
}
use of org.concord.energy3d.util.ClipImage in project energy3d by concord-consortium.
the class AnnualEnvironmentalTemperature method showDialog.
public void showDialog() {
final JDialog dialog = new JDialog(MainFrame.getInstance(), "Annual Environmental Temperature", true);
dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
final JPanel contentPane = new JPanel(new BorderLayout());
dialog.setContentPane(contentPane);
final JMenuBar menuBar = new JMenuBar();
dialog.setJMenuBar(menuBar);
final JCheckBoxMenuItem cbmiAirTemperature = new JCheckBoxMenuItem("Air Temperature");
Util.selectSilently(cbmiAirTemperature, !hideData.get(lowestAirTemperature));
final JCheckBoxMenuItem[] cbmiGroundTemperature = new JCheckBoxMenuItem[depth.length];
for (int i = 0; i < depth.length; i++) {
cbmiGroundTemperature[i] = new JCheckBoxMenuItem("Ground Temperature (" + depth[i] + "m)");
Util.selectSilently(cbmiGroundTemperature[i], !hideData.get(lowestGroundTemperature[i]));
}
final JCheckBoxMenuItem cbmiShowAverage = new JCheckBoxMenuItem("Show Average");
Util.selectSilently(cbmiShowAverage, showAverage);
final JMenu menuView = new JMenu("View");
menuBar.add(menuView);
menuView.addMenuListener(new MenuListener() {
@Override
public void menuSelected(final MenuEvent e) {
Util.selectSilently(cbmiAirTemperature, !hideData.get(lowestAirTemperature));
for (int i = 0; i < depth.length; i++) {
Util.selectSilently(cbmiGroundTemperature[i], !hideData.get(lowestGroundTemperature[i]));
}
Util.selectSilently(cbmiShowAverage, showAverage);
}
@Override
public void menuDeselected(final MenuEvent e) {
}
@Override
public void menuCanceled(final MenuEvent e) {
}
});
cbmiAirTemperature.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(final ItemEvent e) {
final JCheckBoxMenuItem source = (JCheckBoxMenuItem) e.getSource();
hideData.put(lowestAirTemperature, !source.isSelected());
AnnualEnvironmentalTemperature.this.repaint();
}
});
menuView.add(cbmiAirTemperature);
for (int i = 0; i < depth.length; i++) {
final int i2 = i;
cbmiGroundTemperature[i].addItemListener(new ItemListener() {
@Override
public void itemStateChanged(final ItemEvent e) {
final JCheckBoxMenuItem source = (JCheckBoxMenuItem) e.getSource();
hideData.put(lowestGroundTemperature[i2], !source.isSelected());
AnnualEnvironmentalTemperature.this.repaint();
}
});
menuView.add(cbmiGroundTemperature[i]);
}
menuView.addSeparator();
cbmiShowAverage.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(final ItemEvent e) {
final JCheckBoxMenuItem source = (JCheckBoxMenuItem) e.getSource();
showAverage = source.isSelected();
AnnualEnvironmentalTemperature.this.repaint();
}
});
menuView.add(cbmiShowAverage);
final JMenu menuExport = new JMenu("Export");
menuBar.add(menuExport);
final JMenuItem mi = new JMenuItem("Copy Image");
mi.addActionListener(new ActionListener() {
@Override
public void actionPerformed(final ActionEvent e) {
new ClipImage().copyImageToClipboard(AnnualEnvironmentalTemperature.this);
}
});
menuExport.add(mi);
final JPanel panel = new JPanel(new BorderLayout());
panel.setBorder(BorderFactory.createEtchedBorder());
contentPane.add(panel, BorderLayout.CENTER);
panel.add(this, BorderLayout.CENTER);
final JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
contentPane.add(buttonPanel, BorderLayout.SOUTH);
final JButton button = new JButton("Close");
button.addActionListener(new ActionListener() {
@Override
public void actionPerformed(final ActionEvent e) {
dialog.dispose();
}
});
buttonPanel.add(button);
dialog.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(final WindowEvent e) {
dialog.dispose();
}
});
dialog.pack();
dialog.setLocationRelativeTo(MainFrame.getInstance());
dialog.setVisible(true);
TimeSeriesLogger.getInstance().logAnalysis(this);
final HashMap<String, Object> attributes = new HashMap<String, Object>();
attributes.put("Location", Scene.getInstance().getCity());
MainApplication.addEvent(new OperationEvent(Scene.getURL(), System.currentTimeMillis(), getClass().getSimpleName(), attributes));
}
use of org.concord.energy3d.util.ClipImage in project energy3d by concord-consortium.
the class DailyEnvironmentalTemperature method showDialog.
public void showDialog() {
final JDialog dialog = new JDialog(MainFrame.getInstance(), "Daily Environmental Temperature", true);
dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
final JPanel contentPane = new JPanel(new BorderLayout());
dialog.setContentPane(contentPane);
final JMenuBar menuBar = new JMenuBar();
dialog.setJMenuBar(menuBar);
final JCheckBoxMenuItem[] cbmiGroundTemperature = new JCheckBoxMenuItem[depth.length];
for (int i = 0; i < depth.length; i++) {
cbmiGroundTemperature[i] = new JCheckBoxMenuItem(i == 0 ? "Air Temperature" : "Ground Temperature (" + depth[i] + "m)");
Util.selectSilently(cbmiGroundTemperature[i], !hideData.get(groundTemperature[i]));
}
final JMenu menuView = new JMenu("View");
menuBar.add(menuView);
menuView.addMenuListener(new MenuListener() {
@Override
public void menuSelected(final MenuEvent e) {
for (int i = 0; i < depth.length; i++) {
Util.selectSilently(cbmiGroundTemperature[i], !hideData.get(groundTemperature[i]));
}
}
@Override
public void menuDeselected(final MenuEvent e) {
}
@Override
public void menuCanceled(final MenuEvent e) {
}
});
for (int i = 0; i < depth.length; i++) {
final int i2 = i;
cbmiGroundTemperature[i].addItemListener(new ItemListener() {
@Override
public void itemStateChanged(final ItemEvent e) {
final JCheckBoxMenuItem source = (JCheckBoxMenuItem) e.getSource();
hideData.put(groundTemperature[i2], !source.isSelected());
DailyEnvironmentalTemperature.this.repaint();
}
});
menuView.add(cbmiGroundTemperature[i]);
}
final JMenu menuExport = new JMenu("Export");
menuBar.add(menuExport);
final JMenuItem mi = new JMenuItem("Copy Image");
mi.addActionListener(new ActionListener() {
@Override
public void actionPerformed(final ActionEvent e) {
new ClipImage().copyImageToClipboard(DailyEnvironmentalTemperature.this);
}
});
menuExport.add(mi);
final JPanel panel = new JPanel(new BorderLayout());
panel.setBorder(BorderFactory.createEtchedBorder());
contentPane.add(panel, BorderLayout.CENTER);
panel.add(this, BorderLayout.CENTER);
final JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
contentPane.add(buttonPanel, BorderLayout.SOUTH);
final JButton button = new JButton("Close");
button.addActionListener(new ActionListener() {
@Override
public void actionPerformed(final ActionEvent e) {
dialog.dispose();
}
});
buttonPanel.add(button);
dialog.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(final WindowEvent e) {
dialog.dispose();
}
});
dialog.pack();
dialog.setLocationRelativeTo(MainFrame.getInstance());
dialog.setVisible(true);
TimeSeriesLogger.getInstance().logAnalysis(this);
final HashMap<String, Object> attributes = new HashMap<String, Object>();
attributes.put("Location", Scene.getInstance().getCity());
attributes.put("Date", Scene.getInstance().getDate().toString());
MainApplication.addEvent(new OperationEvent(Scene.getURL(), System.currentTimeMillis(), getClass().getSimpleName(), attributes));
}
use of org.concord.energy3d.util.ClipImage in project energy3d by concord-consortium.
the class ResultList method showGui.
public void showGui() {
if (events.isEmpty()) {
JOptionPane.showMessageDialog(MainFrame.getInstance(), "No previous results were found.", "No Result", JOptionPane.INFORMATION_MESSAGE);
return;
}
final JDialog dialog = new JDialog(MainFrame.getInstance(), "List of Results", true);
dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
final JPanel contentPane = new JPanel(new BorderLayout());
dialog.setContentPane(contentPane);
final JMenuBar menuBar = new JMenuBar();
dialog.setJMenuBar(menuBar);
final JMenu menu = new JMenu("Export");
menuBar.add(menu);
final JMenuItem mi = new JMenuItem("Copy Image");
mi.addActionListener(new ActionListener() {
@Override
public void actionPerformed(final ActionEvent e) {
if (graph != null) {
new ClipImage().copyImageToClipboard(graph);
}
}
});
menu.add(mi);
graphContainer = new JPanel(new BorderLayout());
graphContainer.setBorder(BorderFactory.createEtchedBorder());
contentPane.add(graphContainer, BorderLayout.CENTER);
if (graph != null) {
graph.setPreferredSize(new Dimension(600, 400));
graph.setBackground(Color.WHITE);
graphContainer.add(graph, BorderLayout.CENTER);
}
final DefaultListModel<String> listModel = new DefaultListModel<String>();
for (final AnalysisEvent e : events) {
listModel.addElement(e.getName() + " (" + EnergyPanel.ONE_DECIMAL.format(0.001 * (System.currentTimeMillis() - e.getTimestamp())) + " s ago)");
}
final JList<String> list = new JList<String>(listModel);
list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
list.addListSelectionListener(new ListSelectionListener() {
@Override
public void valueChanged(final ListSelectionEvent e) {
if (graph != null) {
graphContainer.remove(graph);
}
final int i = list.getSelectedIndex();
final AnalysisEvent a = events.get(i);
setGraph(a);
fileLabel.setText("File: " + Util.getFileName(a.getFile().getPath()));
graphContainer.add(graph, BorderLayout.CENTER);
graphContainer.validate();
final Map<String, List<Double>> r = a.getResults();
graph.clearData();
final Map<String, List<Double>> d = graph.getData();
for (final String x : r.keySet()) {
d.put(x, new ArrayList<Double>(r.get(x)));
}
graph.repaint();
}
});
final JScrollPane scrollPane = new JScrollPane(list);
scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
graphContainer.add(scrollPane, BorderLayout.WEST);
final JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
contentPane.add(buttonPanel, BorderLayout.SOUTH);
fileLabel = new JLabel();
buttonPanel.add(fileLabel);
final JButton button = new JButton("Close");
button.addActionListener(new ActionListener() {
@Override
public void actionPerformed(final ActionEvent e) {
dialog.dispose();
}
});
buttonPanel.add(button);
dialog.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(final WindowEvent e) {
dialog.dispose();
}
});
dialog.pack();
dialog.setLocationRelativeTo(MainFrame.getInstance());
dialog.setVisible(true);
}
use of org.concord.energy3d.util.ClipImage in project energy3d by concord-consortium.
the class EventFrequency method showGui.
public void showGui() {
final JDialog dialog = new JDialog(MainFrame.getInstance(), "Event Count", true);
dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
final JPanel contentPane = new JPanel(new BorderLayout());
dialog.setContentPane(contentPane);
final JMenuBar menuBar = new JMenuBar();
dialog.setJMenuBar(menuBar);
final JMenu menu = new JMenu("Export");
menuBar.add(menu);
final JMenuItem mi = new JMenuItem("Copy Image");
mi.addActionListener(new ActionListener() {
@Override
public void actionPerformed(final ActionEvent e) {
new ClipImage().copyImageToClipboard(EventFrequency.this);
}
});
menu.add(mi);
final JPanel panel = new JPanel(new BorderLayout());
panel.setBorder(BorderFactory.createEtchedBorder());
contentPane.add(panel, BorderLayout.CENTER);
panel.add(this, BorderLayout.CENTER);
final JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
contentPane.add(buttonPanel, BorderLayout.SOUTH);
final JButton button = new JButton("Close");
button.addActionListener(new ActionListener() {
@Override
public void actionPerformed(final ActionEvent e) {
dialog.dispose();
}
});
buttonPanel.add(button);
dialog.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(final WindowEvent e) {
dialog.dispose();
}
});
dialog.pack();
dialog.setLocationRelativeTo(MainFrame.getInstance());
dialog.setVisible(true);
}
Aggregations