Skip to content
This repository has been archived by the owner on Jul 14, 2021. It is now read-only.

Commit

Permalink
Merge pull request #282 from dnorgaard-usgs/master
Browse files Browse the repository at this point in the history
Add option to hide stale channels in Data Chooser (#274)
  • Loading branch information
Diana Norgaard authored Sep 6, 2019
2 parents e19cc68 + 3b2a31b commit 8b8157f
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
## Version 2.8.12 - TBD
* Add option to hide stale channels in Data Chooser (#274)
* Add color-blind friendly spectrum option for spectrogram (#275)
* Fix start time precision in Seisan file export (#280)
* Fix wrong year in wave panel for Dec 31
Expand Down
Binary file modified docs/Swarm User Guide.docx
Binary file not shown.
Binary file modified docs/swarm_v2.pdf
Binary file not shown.
5 changes: 5 additions & 0 deletions src/main/java/gov/usgs/volcanoes/swarm/OptionsDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public class OptionsDialog extends SwarmModalDialog {
private JTextField pVelocity;
private JTextField velocityRatio;
private JCheckBox useLargeCursor;
private JCheckBox hideStaleChannel;

private JCheckBox tzInstrument;
private JRadioButton tzLocal;
Expand Down Expand Up @@ -74,6 +75,7 @@ private void createFields() {
pVelocity = new JTextField();
velocityRatio = new JTextField();
useLargeCursor = new JCheckBox("Large Helicorder Cursor");
hideStaleChannel = new JCheckBox("Hide stale channels");
tzInstrument = new JCheckBox("Use instrument time zone if available");
tzLocal = new JRadioButton("Use local machine time zone:");
tzSpecific = new JRadioButton("Use specific time zone:");
Expand Down Expand Up @@ -176,6 +178,7 @@ public void actionPerformed(ActionEvent e) {
});
builder.appendSeparator("Other");
builder.append(useLargeCursor, 7);
builder.append(hideStaleChannel, 7);
builder.nextLine();

dialogPanel = builder.getPanel();
Expand All @@ -201,6 +204,7 @@ public void doEnables() {
*/
public void setCurrentValues() {
useLargeCursor.setSelected(swarmConfig.useLargeCursor);
hideStaleChannel.setSelected(swarmConfig.hideStaleChannel);
durationA.setText(Double.toString(swarmConfig.durationA));
durationB.setText(Double.toString(swarmConfig.durationB));
durationEnabled.setSelected(swarmConfig.durationEnabled);
Expand Down Expand Up @@ -263,6 +267,7 @@ public boolean allowOk() {
*/
public void wasOk() {
swarmConfig.useLargeCursor = useLargeCursor.isSelected();
swarmConfig.hideStaleChannel = hideStaleChannel.isSelected();
swarmConfig.durationEnabled = durationEnabled.isSelected();
swarmConfig.durationA = Double.parseDouble(durationA.getText().trim());
swarmConfig.durationB = Double.parseDouble(durationB.getText().trim());
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/gov/usgs/volcanoes/swarm/SwarmConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ public class SwarmConfig {
public String lastPath;

public boolean useLargeCursor;
public boolean hideStaleChannel;

public boolean durationEnabled;
public double durationA;
public double durationB;
Expand Down Expand Up @@ -346,6 +348,7 @@ public void parseConfig(final ConfigFile config) {
useLocalTimeZone = StringUtils.stringToBoolean(config.getString("useLocalTimeZone"), true);

useLargeCursor = StringUtils.stringToBoolean(config.getString("useLargeCursor"), false);
hideStaleChannel = StringUtils.stringToBoolean(config.getString("hideStaleChannel"), false);

span = StringUtils.stringToInt(config.getString("span"), 24);
timeChunk = StringUtils.stringToInt(config.getString("timeChunk"), 30);
Expand Down Expand Up @@ -533,6 +536,7 @@ public ConfigFile toConfigFile() {

config.put("windowMaximized", Boolean.toString(windowMaximized));
config.put("useLargeCursor", Boolean.toString(useLargeCursor));
config.put("hideStaleChannel", Boolean.toString(hideStaleChannel));

config.put("span", Integer.toString(span));
config.put("timeChunk", Integer.toString(timeChunk));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1269,7 +1269,11 @@ public Component getTreeCellRendererComponent(JTree tree, Object value, boolean
if (md != null && md.source instanceof WwsSource) {
setToolTipText(node.getToolTip());
if (value instanceof ChannelNode && ((ChannelNode) value).isStale()) {
setForeground(Color.GRAY);
if (SwarmConfig.getInstance().hideStaleChannel) {
setVisible(false);
} else {
setForeground(Color.GRAY);
}
}
}

Expand Down

0 comments on commit 8b8157f

Please sign in to comment.