-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* This release adds two significant features including the addition o…
…f energy calculations and a new data table filter feature * Energy calculation feature is based on Mayeda, K., and Walter, W. R. (1996), with updates made for CCT * Converted the energy calculation algorithm to MKS units * Utilized a numerically derived term for the k constant, analytical form derivation in progress * Reformulated the p-Wave contribution from a constant of 7%, as in Mayeda, K., and Walter, W. R. (1996), to a derived formula using the MDAC paramaterization based on Walter and Taylor, 2001 * Implementation of energy calculation feature includes the addition of new data columns containing calculation results * Added total energy calculation values to be displayed in the area directly above spectral plots * Renamed plot FIT as Mw_coda * Added a data filter feature that allows users to filter the results displayed in a data table by event id, station etc. * Updated data tables to show a filter icon in the column headers, which will open the filter dialog * Included auto-completion and search of filter terms within the filter dialog feature
- Loading branch information
Showing
46 changed files
with
17,923 additions
and
16,304 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
80 changes: 80 additions & 0 deletions
80
.../src/main/java/gov/llnl/gnem/apps/coda/calibration/gui/controllers/AutoCompleteCombo.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
/* | ||
* Copyright (c) 2021, Lawrence Livermore National Security, LLC. Produced at the Lawrence Livermore National Laboratory | ||
* CODE-743439. | ||
* All rights reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the “Licensee”); you may not use this file except in compliance with the License. You may obtain a copy of the License at: | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and limitations under the license. | ||
* | ||
* This work was performed under the auspices of the U.S. Department of Energy | ||
* by Lawrence Livermore National Laboratory under Contract DE-AC52-07NA27344. | ||
*/ | ||
package gov.llnl.gnem.apps.coda.calibration.gui.controllers; | ||
|
||
import org.apache.commons.lang3.StringUtils; | ||
|
||
import javafx.collections.ObservableList; | ||
import javafx.scene.control.ComboBox; | ||
import javafx.scene.control.TextField; | ||
import javafx.scene.input.KeyEvent; | ||
import javafx.scene.input.MouseButton; | ||
|
||
public class AutoCompleteCombo<T> extends ComboBox<T> { | ||
|
||
private ObservableList<T> originalItems; | ||
|
||
public AutoCompleteCombo(ObservableList<T> items) { | ||
this.originalItems = items; | ||
this.setEditable(true); | ||
this.getEditor().setOnKeyTyped(e -> handle(e)); | ||
this.getEditor().setOnMouseClicked(event -> { | ||
if (event.getButton().equals(MouseButton.PRIMARY) && (event.getClickCount() == 2)) { | ||
return; | ||
} | ||
this.show(); | ||
}); | ||
this.setItems(originalItems); | ||
}; | ||
|
||
public void setOriginalItems(ObservableList<T> items) { | ||
originalItems = items; | ||
} | ||
|
||
private void handle(KeyEvent event) { | ||
TextField field = this.getEditor(); | ||
if (field == null) { | ||
return; | ||
} | ||
|
||
final String text = field.getText(); | ||
ObservableList<T> filtered = filteredItems(text); | ||
|
||
if (this.getSelectionModel().getSelectedItem() != null) { | ||
this.getSelectionModel().clearSelection(); | ||
field.setText(text.trim()); | ||
field.end(); | ||
} | ||
|
||
this.setItems(filtered); | ||
this.show(); | ||
} | ||
|
||
private ObservableList<T> filteredItems(String text) { | ||
if (StringUtils.isBlank(text)) { | ||
return originalItems; | ||
} | ||
ObservableList<T> dropDownItems = originalItems; | ||
if (!originalItems.isEmpty()) { | ||
dropDownItems = originalItems.filtered(data -> { | ||
if (data != null && !StringUtils.isBlank(data.toString())) { | ||
return data.toString().toLowerCase().contains(text.toLowerCase()); | ||
} | ||
return false; | ||
}); | ||
} | ||
|
||
return dropDownItems; | ||
} | ||
} |
Oops, something went wrong.