Fixes to TD display

Prevent overflow
Fix the width of settings pane when there are no tabs
fix slightly translucent pop up menu
This commit is contained in:
Jamie Mac 2025-03-17 20:31:23 +00:00
parent 426c71848a
commit ff81abaf59
5 changed files with 109 additions and 61 deletions

View File

@ -16,7 +16,7 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<javafx.version>21</javafx.version>
<javafx.version>23</javafx.version>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<!-- Tethys version control -->

View File

@ -177,7 +177,12 @@ public class ClickControlPane2 extends PamBorderPane implements TDSettingsPane {
*/
private PamBorderPane extraSymbolPane;
private ToggleSwitch freqSwitch;
private ToggleSwitch freqSwitch;
/**
* Indicates whether min or max pane is changing to stop overlfow
*/
private volatile boolean minMxPaneChange = false;
public ClickControlPane2(ClickPlotInfoFX clickPlotInfo) {
@ -210,7 +215,7 @@ public class ClickControlPane2 extends PamBorderPane implements TDSettingsPane {
scrollPane2.setHbarPolicy(ScrollBarPolicy.NEVER);
scrollPane2.getStyleClass().clear();
symbolTab.setContent(scrollPane2);
Tab dataView=new Tab("Data");
dataView.setContent(dataSelectHolder);
dataView.getStyleClass().add("tab-square");
@ -226,11 +231,11 @@ public class ClickControlPane2 extends PamBorderPane implements TDSettingsPane {
enablePane();
setFreqType();
setParams();
dataSelectPane.addSettingsListener(()->{
//dynamic settings pane so have to repaint whenever a control is selected.
getParams();
/**
* If there are raw amplitude or frequency panes that have a buffer of painted units then
* these have to be cleared for the data selector
@ -238,7 +243,7 @@ public class ClickControlPane2 extends PamBorderPane implements TDSettingsPane {
clickPlotInfo.getClickRawPlotManager().clear();
clickPlotInfo.getClickFFTPlotManager().clear();
clickPlotInfo.getTDGraph().repaint(50);
});
@ -253,7 +258,7 @@ public class ClickControlPane2 extends PamBorderPane implements TDSettingsPane {
* @return the data select pane.
*/
private DynamicSettingsPane<Boolean> createDataSelectPane(){
// System.out.println("DATA SELECTOR: " + clickPlotInfo.getClickDataSelector());
// System.out.println("DATA SELECTOR: " + clickPlotInfo.getClickDataSelector());
return clickPlotInfo.getClickDataSelector().getDialogPaneFX();
}
@ -294,7 +299,7 @@ public class ClickControlPane2 extends PamBorderPane implements TDSettingsPane {
clickSizePane = this.createClickSizePane(); //pane for selecting the size of clicks.
//
/**Frequency Pane**/
freqThresholdPane = createFreqThresholdPane(); //pane for spectrogram showing clicks
freqColourPane = createFreqColorPane(); //pane for setting colour limits if clicks shown as spectrogram
@ -315,12 +320,12 @@ public class ClickControlPane2 extends PamBorderPane implements TDSettingsPane {
Label freqTitle = new Label("Freq. Colour");
PamGuiManagerFX.titleFont2style(freqTitle);
PamVBox vBox = new PamVBox();
vBox.setSpacing(5);
vBox.getChildren().addAll(freqTitle, hBox );
freqPane.setTop(vBox);
symbolOptionsPane.getMainPane().setCenter(extraSymbolPane = new PamBorderPane());
symbolOptionsPane.getMainPane().setMaxWidth(PREF_WIDTH);
@ -361,14 +366,14 @@ public class ClickControlPane2 extends PamBorderPane implements TDSettingsPane {
setFreqPaneType(FREQ_PANE_THRESHOLD);
extraSymbolPane.setCenter(freqPane);
setFreqPaneType(freqSwitch.isSelected() ? FREQ_PANE_COLOUR : FREQ_PANE_THRESHOLD);
symbolOptionsPane.getVBoxHolder().setDisable(freqSwitch.isSelected());
}
else {
extraSymbolPane.setCenter(clickSizePane);
}
// //the colour choice
// int colourChoice = ((ClickSymbolOptions) clickPlotInfo.getClickSymbolChooser().getSymbolChooser().getSymbolOptions()).colourChoice;
//
@ -473,32 +478,39 @@ public class ClickControlPane2 extends PamBorderPane implements TDSettingsPane {
});
minMaxWidthPane.setPrefSpinnerWidth(80);
Label newLabelWidth = new Label();
// newLabelWidth.setGraphic(PamGlyphDude.createPamGlyph(FontAwesomeIcon.ARROWS_H,
// PamGuiManagerFX.iconSize));
// newLabelWidth.setGraphic(PamGlyphDude.createPamGlyph(FontAwesomeIcon.ARROWS_H,
// PamGuiManagerFX.iconSize));
newLabelWidth.setGraphic(PamGlyphDude.createPamIcon("mdi2a-arrow-left-right-bold", PamGuiManagerFX.iconSize));
newLabelWidth.setPrefWidth(20);
minMaxWidthPane.getChildren().add(0, newLabelWidth);
//height pane
minMaxHeightPane = new DualControlField<Double>("", "" , "", 2, 100, 1);
minMxPaneChange = false;
minMaxHeightPane.addChangeListener((obsval, oldval, newval)->{
newSettings();
//do not allow the min ti be larger than the max.
if (minMaxHeightPane.getSpinner().getValue()>=minMaxHeightPane.getSpinner2().getValue()) {
minMaxHeightPane.getSpinner().getValueFactory().setValue(minMaxHeightPane.getSpinner2().getValue()-1.0);
return;
}
if (!minMxPaneChange == false) {
minMxPaneChange = true;
//do not allow the min ti be larger than the max.
if (minMaxHeightPane.getSpinner().getValue()>=minMaxHeightPane.getSpinner2().getValue()) {
if (minMaxHeightPane.getSpinner2().getValue()<=minMaxHeightPane.getSpinner().getValue()) {
minMaxHeightPane.getSpinner2().getValueFactory().setValue(minMaxHeightPane.getSpinner().getValue()+1.0);
minMaxHeightPane.getSpinner().getValueFactory().setValue(minMaxHeightPane.getSpinner2().getValue()-1.0);
return;
}
if (minMaxHeightPane.getSpinner2().getValue()<=minMaxHeightPane.getSpinner().getValue()) {
minMaxHeightPane.getSpinner2().getValueFactory().setValue(minMaxHeightPane.getSpinner().getValue()+1.0);
}
minMxPaneChange=false;
}
});
minMaxHeightPane.setPrefSpinnerWidth(80);
Label newLabelHeight = new Label();
// newLabelHeight.setGraphic(PamGlyphDude.createPamGlyph(FontAwesomeIcon.ARROWS_V,
// PamGuiManagerFX.iconSize));
// newLabelHeight.setGraphic(PamGlyphDude.createPamGlyph(FontAwesomeIcon.ARROWS_V,
// PamGuiManagerFX.iconSize));
newLabelHeight.setGraphic(PamGlyphDude.createPamIcon("mdi2a-arrow-up-down-bold", PamGuiManagerFX.iconSize));
newLabelHeight.setPrefWidth(20);
minMaxHeightPane.getChildren().add(0, newLabelHeight);
@ -596,7 +608,7 @@ public class ClickControlPane2 extends PamBorderPane implements TDSettingsPane {
spectroControlPane.getColorBox().valueProperty().addListener((obsval, oldval, newval)->{
newSettings();
});
//need to do this so that text of colourbar is not squished when in a scrollpane
spectroControlPane.setMinHeight(85);
@ -623,7 +635,7 @@ public class ClickControlPane2 extends PamBorderPane implements TDSettingsPane {
fftSpinnerHop.setEditable(true);
fftSpinnerHop.getStyleClass().add(Spinner.STYLE_CLASS_SPLIT_ARROWS_HORIZONTAL);
fftSpinnerHop.getValueFactory().valueProperty().addListener((obs, before, after)->{
if (after==0) fftSpinnerHop.getValueFactory().setValue(before==0 ? 32 : before);
newSettings(100);
});
@ -715,10 +727,10 @@ public class ClickControlPane2 extends PamBorderPane implements TDSettingsPane {
clickPlotInfo.getClickDisplayParams().freqAmplitudeRange = clickPlotInfo.getClickDisplayParams().getDefaultFreqAmpRange();
};
// if (clickPlotInfo.getClickDisplayParams().freqAmplitudeLimits==null) {
// //can happen with old .psfx save files.
clickPlotInfo.getClickDisplayParams().freqAmplitudeLimits =clickPlotInfo.getClickDisplayParams().getDefaultFreqAmpLimits();
// }
// if (clickPlotInfo.getClickDisplayParams().freqAmplitudeLimits==null) {
// //can happen with old .psfx save files.
clickPlotInfo.getClickDisplayParams().freqAmplitudeLimits =clickPlotInfo.getClickDisplayParams().getDefaultFreqAmpLimits();
// }
this.spectroControlPane.setAmplitudeRange(clickPlotInfo.getClickDisplayParams().freqAmplitudeRange,
clickPlotInfo.getClickDisplayParams().freqAmplitudeLimits);
@ -776,9 +788,9 @@ public class ClickControlPane2 extends PamBorderPane implements TDSettingsPane {
clickPlotInfo.getClickDisplayParams().freqAmplitudeLimits[0] = spectroControlPane.getColourSlider().getMin();
clickPlotInfo.getClickDisplayParams().freqAmplitudeLimits[1] = spectroControlPane.getColourSlider().getMax();
clickPlotInfo.getClickDisplayParams().thresholdFFT = !freqSwitch.isSelected();
clickPlotInfo.getClickDisplayParams().fftHop = this.fftSpinnerHop.getValue().intValue();
clickPlotInfo.getClickDisplayParams().fftLength = this.fftSpinnerLength.getValue().intValue();
clickPlotInfo.getClickDisplayParams().colourMap = this.spectroControlPane.getColourArrayType();
@ -839,14 +851,14 @@ public class ClickControlPane2 extends PamBorderPane implements TDSettingsPane {
* Notify the click pane of an update that may change controls
*/
public void notifyUpdate() {
//called whenever the y axis data type changes.
//17/09/2021- this was causing the spectrogram to reset back to normal lines every time
//a module dialog was closed.
//setFreqType();
this.enablePane();
//in case there has been a global medium update.
}

View File

@ -31,6 +31,7 @@ import dataPlotsFX.overlaymark.TDOverlayAdapter;
import dataPlotsFX.scroller.TDAcousticScroller;
import dataPlotsFX.sound.SoundOutputManager;
import javafx.application.Platform;
import javafx.beans.property.SimpleStringProperty;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.geometry.Insets;
@ -190,6 +191,9 @@ public class TDDisplayFX extends PamBorderPane {
*/
private PamSplitPane splitPaneHolder;
private SimpleStringProperty mousePosStringProperty = new SimpleStringProperty();
/**
* Constructor for the main JavaFX display.
* @param tdControl - the TDControlFX.
@ -271,6 +275,7 @@ public class TDDisplayFX extends PamBorderPane {
timeStamp=new Label();
mousePositionData = new Label();
mousePositionData.textProperty().bind(this.mousePosStringProperty);
//layout the main pane
layoutTDMainPane(tdParametersFX.orientation);
@ -287,8 +292,8 @@ public class TDDisplayFX extends PamBorderPane {
//layout the graphs within the main panel
layoutTDGraphs(tdParametersFX.orientation);
//need to set the divder positon after the graphs as this doesn;t work if set before.
splitPaneHolder.setDividerPosition(0, 0.95);
//need to set the divider position after the graphs as this doesn't work if set before.
splitPaneHolder.setDividerPosition(0, 0.85);
intilized=true;
}
@ -427,7 +432,7 @@ public class TDDisplayFX extends PamBorderPane {
}
//Set background so that same as the axis colour-fills in box on corner between x and y axis.
timeAxisHolder.getStyleClass().add("pane");
//timeAxisHolder.getStyleClass().add("pane");
//layout the graphs within the main panel
layoutTDGraphs(tdParametersFX.orientation);
@ -1334,7 +1339,7 @@ public class TDDisplayFX extends PamBorderPane {
/**
* @return the mousePositionData
*/
public Label getMousePositionData() {
private Label getMousePositionLabel() {
return mousePositionData;
}
@ -1351,4 +1356,13 @@ public class TDDisplayFX extends PamBorderPane {
});
}
/**
* Simple string property for mouse position in time axis.
* @return the position text property.
*/
public SimpleStringProperty mousePosTextProperty() {
return this.mousePosStringProperty;
}
}

View File

@ -23,6 +23,7 @@ import pamViewFX.fxNodes.PamBorderPane;
import pamViewFX.fxNodes.PamButton;
import pamViewFX.fxNodes.PamGridPane;
import pamViewFX.fxNodes.PamScrollPane;
import pamViewFX.fxNodes.PamVBox;
import pamViewFX.fxNodes.hidingPane.HidingPane;
import pamViewFX.fxNodes.pamAxis.PamAxisFX;
import pamViewFX.fxNodes.pamAxis.PamAxisPane2;
@ -69,6 +70,8 @@ import javafx.scene.control.MenuItem;
import javafx.scene.control.ScrollPane.ScrollBarPolicy;
import javafx.scene.control.Tooltip;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.Priority;
import javafx.scene.layout.Region;
import javafx.scene.paint.Color;
import javafx.scene.paint.Paint;
import javafx.scene.text.Text;
@ -124,7 +127,7 @@ public class TDGraphFX extends PamBorderPane {
* The layered pane contains all the plot panels but also any overlayed nodes,
* e.g buttons to open hiding dialogs.
*/
private PamHiddenSidePane stackPane;
private PamHiddenSidePane mainStackPane;
/**
* List of unique available units for plotting. We may have multiple types of
@ -318,10 +321,10 @@ public class TDGraphFX extends PamBorderPane {
* Create a stack pane to hold everything- means we can add overlay controls and
* buttons Note: icons are set later in setOverlayColour(LIGHT_TD_DISPLAY);
*/
stackPane = new PamHiddenSidePane(null, null, scrollPane, dataSettingsScrollPane);
mainStackPane = new PamHiddenSidePane(null, null, scrollPane, dataSettingsScrollPane);
// stackPane.setMinHidePaneHeight(300);
stackPane.getChildren().add(plotPanels);
mainStackPane.getChildren().add(plotPanels);
plotPanels.toBack(); // need to send to back so hiding panes are not behind in the stack....
// //test
@ -352,7 +355,7 @@ public class TDGraphFX extends PamBorderPane {
// add plots to center of main pane
this.setCenter(stackPane);
this.setCenter(mainStackPane);
// layout axis.
layoutTDGraph(tdDisplay.getTDParams().orientation);
@ -452,8 +455,8 @@ public class TDGraphFX extends PamBorderPane {
setOverlayColour(LIGHT_TD_DISPLAY);
break;
}
stackPane.getLeftHidingPane().getShowButton().setGraphic(chevronRight);
stackPane.getRightHidingPane().getShowButton().setGraphic(settingsRight);
mainStackPane.getLeftHidingPane().getShowButton().setGraphic(chevronRight);
mainStackPane.getRightHidingPane().getShowButton().setGraphic(settingsRight);
}
// /**
@ -610,16 +613,22 @@ public class TDGraphFX extends PamBorderPane {
dataSettingsScrollPane.setContent(dataSettingsTabs);
}
else {
PamBorderPane settingsHolder = new PamBorderPane();
PamVBox settingsHolder = new PamVBox();
Label label = new Label(settingsPane.getShowingName());
label.setTextAlignment(TextAlignment.CENTER);
PamBorderPane.setAlignment(label, Pos.CENTER);
settingsHolder.setTop(label);
settingsHolder.setCenter(settingsPane.getPane());
settingsHolder.setPadding(new Insets(0,0,0,30));
settingsHolder.setAlignment(Pos.TOP_CENTER);
settingsHolder.getChildren().add(label);
settingsHolder.getChildren().add(settingsPane.getPane());
settingsHolder.setMinWidth(settingsPane.getPane().getPrefWidth());
PamVBox.setVgrow(settingsPane.getPane(), Priority.ALWAYS);
settingsHolder.setPadding(new Insets(0,0,0,35));
dataSettingsScrollPane.setContent(settingsHolder);
mainStackPane.getRightHidingPane().setPrefSize(settingsPane.getPane().getPrefWidth()+35,Region.USE_PREF_SIZE);
}
}
@ -1457,7 +1466,7 @@ public class TDGraphFX extends PamBorderPane {
}
public boolean mouseExited(MouseEvent event) {
tdDisplay.getMousePositionData().setText(null);
tdDisplay.mousePosTextProperty().set(null);
return false;
}
@ -1511,18 +1520,29 @@ public class TDGraphFX extends PamBorderPane {
// }
private void sayMousePosition(MouseEvent event) {
//System.out.println("Say mouse text: ");
PamCoordinate screenPos = new Coordinate3d(event.getX(), event.getY());
PamCoordinate dataPos = graphProjector.getDataPosition(screenPos);
if (dataPos==null) return;
String str = String.format("Mouse %s %s ", PamCalendar.formatDate((long) dataPos.getCoordinate(0)),
PamCalendar.formatTime((long) dataPos.getCoordinate(0), true));
// if (currentScaleInfo != null) {
// str += String.format(", %s %3.1f %s ", currentScaleInfo.getDataType(),
// dataPos.getCoordinate(1), currentScaleInfo.unit);
// }
// String fmt = String.format(", %s %%s", graphAxis.)
str += String.format(", %3.2f %s ", graphAxis.getDataValue(event.getY()), graphAxis.getLabel());
tdDisplay.getMousePositionData().setText(str);
System.out.println("Say mouse text: go 2! " + str);
tdDisplay.mousePosTextProperty().set(str);
System.out.println("Say mouse text: go 3 ! " + str);
}
}
@ -1710,7 +1730,7 @@ public class TDGraphFX extends PamBorderPane {
* @return hiding pane which contains nodes for changing settings
*/
public HidingPane getAxisPane() {
return stackPane.getLeftHidingPane();
return mainStackPane.getLeftHidingPane();
}
/**
@ -1720,7 +1740,7 @@ public class TDGraphFX extends PamBorderPane {
* @return hiding pane which contains nodes for changing settings
*/
public HidingPane getSettingsPane() {
return stackPane.getRightHidingPane();
return mainStackPane.getRightHidingPane();
}
/*********** Viewer Mode Functions **************/
@ -1786,8 +1806,8 @@ public class TDGraphFX extends PamBorderPane {
}
//Finally save whether the hiding panels are open or not.
graphParameters.showHidePaneLeft = stackPane.getLeftHidingPane().isShowing();
graphParameters.showHidePaneRight = stackPane.getRightHidingPane().isShowing();
graphParameters.showHidePaneLeft = mainStackPane.getLeftHidingPane().isShowing();
graphParameters.showHidePaneRight = mainStackPane.getRightHidingPane().isShowing();
}
@ -1875,8 +1895,8 @@ public class TDGraphFX extends PamBorderPane {
//Open hide panes if needed.
//Finally save whether the hiding panels are open or not.
stackPane.getLeftHidingPane().showHidePane(graphParameters.showHidePaneLeft);
stackPane.getRightHidingPane().showHidePane(graphParameters.showHidePaneRight);
mainStackPane.getLeftHidingPane().showHidePane(graphParameters.showHidePaneLeft);
mainStackPane.getRightHidingPane().showHidePane(graphParameters.showHidePaneRight);
}
@ -2081,7 +2101,7 @@ public class TDGraphFX extends PamBorderPane {
// " "+ PamCalendar.formatDateTime((long) resultBack.getCoordinate(0)));
});
stackPane.getChildren().add(buttonTest);
mainStackPane.getChildren().add(buttonTest);
// Test
}

View File

@ -71,6 +71,8 @@ public class OverlayGroupDisplay extends PamBorderPane {
* Constructor for the group detection display.
*/
public OverlayGroupDisplay() {
this.setStyle("-fx-background-color: -fx-background;");
//create two displays, one for super detections and the other for the
//sub detections.
detectionsPane= new DetectionGroupDisplay();