mirror of
https://github.com/PAMGuard/PAMGuard.git
synced 2024-10-29 23:30:44 +00:00
Updates to detection display in FX GUI
This commit is contained in:
parent
bf20889743
commit
d8cd536f26
@ -118,8 +118,17 @@ public class DetectionGroupDisplay extends PamBorderPane {
|
|||||||
/**
|
/**
|
||||||
* Hiding pane for the plot settings.
|
* Hiding pane for the plot settings.
|
||||||
*/
|
*/
|
||||||
private HidingPane hidingPane;
|
private HidingPane hidingPane;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Flag for how the deteciton plot is laid out.
|
||||||
|
*/
|
||||||
|
private int layoutType = DISPLAY_EXTENDED;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Toggle switch for showing the scroll pane.
|
||||||
|
*/
|
||||||
|
private PamToggleSwitch showScrollSwitch;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for the detection group display.
|
* Constructor for the detection group display.
|
||||||
@ -127,6 +136,7 @@ public class DetectionGroupDisplay extends PamBorderPane {
|
|||||||
public DetectionGroupDisplay() {
|
public DetectionGroupDisplay() {
|
||||||
//create hash map to map DDDataInfos to datablocks for quick access.
|
//create hash map to map DDDataInfos to datablocks for quick access.
|
||||||
dDataInfoHashMap = new HashMap<PamDataBlock, DDDataInfo>();
|
dDataInfoHashMap = new HashMap<PamDataBlock, DDDataInfo>();
|
||||||
|
this.layoutType = DISPLAY_EXTENDED;
|
||||||
createDetectionDisplay(DISPLAY_EXTENDED);
|
createDetectionDisplay(DISPLAY_EXTENDED);
|
||||||
this.setCenter(detectionDisplayHolder);
|
this.setCenter(detectionDisplayHolder);
|
||||||
}
|
}
|
||||||
@ -136,9 +146,11 @@ public class DetectionGroupDisplay extends PamBorderPane {
|
|||||||
* @param layoutType - the layout of the display - e.g. DetectionGroupDisplay.DISPLAY_COMPACT
|
* @param layoutType - the layout of the display - e.g. DetectionGroupDisplay.DISPLAY_COMPACT
|
||||||
*/
|
*/
|
||||||
public DetectionGroupDisplay(int layoutType) {
|
public DetectionGroupDisplay(int layoutType) {
|
||||||
|
this.layoutType = layoutType;
|
||||||
|
|
||||||
//create hash map to map DDDataInfos to datablocks for quick access.
|
//create hash map to map DDDataInfos to datablocks for quick access.
|
||||||
dDataInfoHashMap = new HashMap<PamDataBlock, DDDataInfo>();
|
dDataInfoHashMap = new HashMap<PamDataBlock, DDDataInfo>();
|
||||||
createDetectionDisplay(DISPLAY_COMPACT);
|
createDetectionDisplay(layoutType);
|
||||||
this.setCenter(detectionDisplayHolder);
|
this.setCenter(detectionDisplayHolder);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -241,7 +253,7 @@ public class DetectionGroupDisplay extends PamBorderPane {
|
|||||||
gridPane.add(new Label("Plot type"), 0, 0);
|
gridPane.add(new Label("Plot type"), 0, 0);
|
||||||
gridPane.add(detectionDisplay.getDataTypePane(), 1, 0);
|
gridPane.add(detectionDisplay.getDataTypePane(), 1, 0);
|
||||||
|
|
||||||
PamToggleSwitch showScrollSwitch = new PamToggleSwitch("Show scroll bar");
|
showScrollSwitch = new PamToggleSwitch("Show scroll bar");
|
||||||
showScrollSwitch.selectedProperty().addListener((obsVal, oldVal, newVal)->{
|
showScrollSwitch.selectedProperty().addListener((obsVal, oldVal, newVal)->{
|
||||||
//show or hide the scroll bar.
|
//show or hide the scroll bar.
|
||||||
this.setEnableScrollBar(newVal);
|
this.setEnableScrollBar(newVal);
|
||||||
@ -570,11 +582,23 @@ public class DetectionGroupDisplay extends PamBorderPane {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show the scroll bar which allows the user to chnage time limits.
|
* Show the scroll bar which allows the user to change time limits.
|
||||||
* @param enableScrollBarPane - true to enable the time scroll bar.
|
* @param enableScrollBarPane - true to enable the time scroll bar.
|
||||||
*/
|
*/
|
||||||
public void setEnableScrollBar(boolean enableScrollBarPane) {
|
public void setEnableScrollBar(boolean enableScrollBarPane) {
|
||||||
this.detectionDisplay.setEnableScrollBar(enableScrollBarPane);
|
if (this.layoutType==DISPLAY_COMPACT) {
|
||||||
|
showScrollSwitch.setSelected(enableScrollBarPane);
|
||||||
|
}
|
||||||
|
detectionDisplay.setEnableScrollBar(enableScrollBarPane);
|
||||||
|
detectionDisplay.setupScrollBar();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check whether the scroll bar is changing. The scroll bar allows the user to change time limits.
|
||||||
|
* @return true if the scroll bar pane is showing.
|
||||||
|
*/
|
||||||
|
public boolean isEnableScrollBar() {
|
||||||
|
return this.detectionDisplay.isEnableScrollBar();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -75,8 +75,10 @@ public class DetectionGroupDisplayFX extends DetectionGroupDisplay implements U
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void closeNode() {};
|
public void closeNode() {};
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DetectionPlotParams getDisplayParams() {
|
public DetectionPlotParams getDisplayParams() {
|
||||||
|
|
||||||
return this.detectionPlotParams;
|
return this.detectionPlotParams;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,6 +88,8 @@ public class DetectionGroupDisplayFX extends DetectionGroupDisplay implements U
|
|||||||
}
|
}
|
||||||
else detectionPlotParams.dataSource = null;
|
else detectionPlotParams.dataSource = null;
|
||||||
|
|
||||||
|
detectionPlotParams.showScrollBar = this.isEnableScrollBar();
|
||||||
|
|
||||||
if (this.internalFrame!=null) {
|
if (this.internalFrame!=null) {
|
||||||
//need to use the parent node because inside an internal pane.
|
//need to use the parent node because inside an internal pane.
|
||||||
detectionPlotParams.positionX=internalFrame.getInternalRegion().getLayoutX();
|
detectionPlotParams.positionX=internalFrame.getInternalRegion().getLayoutX();
|
||||||
@ -189,6 +193,10 @@ public class DetectionGroupDisplayFX extends DetectionGroupDisplay implements U
|
|||||||
// System.out.println("LOAD DETECTION DISPLAY DATA SOURCE: " + settings.tabName);
|
// System.out.println("LOAD DETECTION DISPLAY DATA SOURCE: " + settings.tabName);
|
||||||
|
|
||||||
this.detectionPlotParams = settings.clone();
|
this.detectionPlotParams = settings.clone();
|
||||||
|
|
||||||
|
|
||||||
|
this.setEnableScrollBar(detectionPlotParams.showScrollBar);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -213,10 +221,9 @@ public class DetectionGroupDisplayFX extends DetectionGroupDisplay implements U
|
|||||||
/**
|
/**
|
||||||
* The extra stuff here is to make sure that the plot types for a specific detection are saved. So for example
|
* The extra stuff here is to make sure that the plot types for a specific detection are saved. So for example
|
||||||
* if viewing click spectrum then the spectrum plot is selected whenever 1) PAMGuard is opened again or 2) switching from
|
* if viewing click spectrum then the spectrum plot is selected whenever 1) PAMGuard is opened again or 2) switching from
|
||||||
* one type of detection ot another e.g. whistle to click, then the click does nto revert to shwoing a waveform instead
|
* one type of detection to another e.g. whistle to click, then the click does not revert to showing a waveform instead
|
||||||
* of spectrum.
|
* of spectrum.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (currentDetection!=null) {
|
if (currentDetection!=null) {
|
||||||
//save the current selected detection plot for the particular type of data unit.
|
//save the current selected detection plot for the particular type of data unit.
|
||||||
String detectionPlotName = this.getDetectionDisplay().getCurrentDataInfo().getCurrentDetectionPlot().getName();
|
String detectionPlotName = this.getDetectionDisplay().getCurrentDataInfo().getCurrentDetectionPlot().getName();
|
||||||
|
@ -26,8 +26,12 @@ public class DetectionPlotParams extends UserDisplayNodeParams implements Clonea
|
|||||||
* The data source for the detection plot.
|
* The data source for the detection plot.
|
||||||
*/
|
*/
|
||||||
public String dataSource = null;
|
public String dataSource = null;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* True to show the scroll bar.
|
||||||
|
*/
|
||||||
|
public boolean showScrollBar = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Saves which data axis is used for which data block. The key is the data block long name and the
|
* Saves which data axis is used for which data block. The key is the data block long name and the
|
||||||
* result is the name of the plot e.g. waveform. In this way users can set how they want the data plots to display
|
* result is the name of the plot e.g. waveform. In this way users can set how they want the data plots to display
|
||||||
|
@ -107,6 +107,7 @@ public class DDDataPane2 extends PamBorderPane {
|
|||||||
detectionPlotDisplay.setMinHidePaneHeight(ddDataInfo.getCurrentDetectionPlot().getSettingsPane().getMinHeight());
|
detectionPlotDisplay.setMinHidePaneHeight(ddDataInfo.getCurrentDetectionPlot().getSettingsPane().getMinHeight());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//don't want the hide button if there's no settings pane.
|
//don't want the hide button if there's no settings pane.
|
||||||
//detectionPlotDisplay.setEnableSettingsButton(ddDataInfo.getCurrentDetectionPlot().getSettingsPane()!=null);
|
//detectionPlotDisplay.setEnableSettingsButton(ddDataInfo.getCurrentDetectionPlot().getSettingsPane()!=null);
|
||||||
|
|
||||||
|
@ -355,16 +355,17 @@ public class DetectionPlotDisplay extends PamBorderPane {
|
|||||||
* the current data unit.
|
* the current data unit.
|
||||||
*/
|
*/
|
||||||
public void setupScrollBar(PamDataUnit newDataUnit){
|
public void setupScrollBar(PamDataUnit newDataUnit){
|
||||||
|
|
||||||
|
if (currentDataInfo!=null) {
|
||||||
|
//important we put this here as it allows the plot to set up the scroll bar pane.
|
||||||
|
this.currentDataInfo.setupAxis(detectionPlotProjector, newDataUnit);
|
||||||
|
}
|
||||||
|
|
||||||
//setup the scroll bar (or not)
|
//setup the scroll bar (or not)
|
||||||
if (enableScrollBar && this.detectionPlotProjector.enableScrollBar && newDataUnit!=null) {
|
if (enableScrollBar && this.detectionPlotProjector.enableScrollBar && newDataUnit!=null) {
|
||||||
|
|
||||||
this.setTop(scrollBarPane);
|
this.setTop(scrollBarPane);
|
||||||
|
|
||||||
if (currentDataInfo!=null) {
|
|
||||||
//important we put this here as it allows the plot to set up the scroll bar pane.
|
|
||||||
this.currentDataInfo.setupAxis(detectionPlotProjector, newDataUnit);
|
|
||||||
}
|
|
||||||
|
|
||||||
//System.out.println("Set min and max limits for scroll bar: " + detectionPlotProjector.getMinScrollLimit() + " " + detectionPlotProjector.getMaxScrollLimit());
|
//System.out.println("Set min and max limits for scroll bar: " + detectionPlotProjector.getMinScrollLimit() + " " + detectionPlotProjector.getMaxScrollLimit());
|
||||||
scrollBarPane.setMinVal(detectionPlotProjector.getMinScrollLimit());
|
scrollBarPane.setMinVal(detectionPlotProjector.getMinScrollLimit());
|
||||||
scrollBarPane.setMaxVal(detectionPlotProjector.getMaxScrollLimit());
|
scrollBarPane.setMaxVal(detectionPlotProjector.getMaxScrollLimit());
|
||||||
@ -384,6 +385,9 @@ public class DetectionPlotDisplay extends PamBorderPane {
|
|||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
//need this to ensure the axis change when scroll bar is not longer displayed.
|
||||||
|
detectionPlotProjector.setAxisMinMax(detectionPlotProjector.getMinScrollLimit(),
|
||||||
|
detectionPlotProjector.getMaxScrollLimit(), detectionPlotProjector.getScrollAxis());
|
||||||
this.setTop(null);
|
this.setTop(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -409,19 +413,25 @@ public class DetectionPlotDisplay extends PamBorderPane {
|
|||||||
private void drawDataUnit(PamDataUnit newDataUnit) {
|
private void drawDataUnit(PamDataUnit newDataUnit) {
|
||||||
//Debug.out.println("DetectionPlotDisplay DrawDataUnit: " +newDataUnit);
|
//Debug.out.println("DetectionPlotDisplay DrawDataUnit: " +newDataUnit);
|
||||||
if (currentDataInfo!=null){
|
if (currentDataInfo!=null){
|
||||||
|
|
||||||
//sometimes the axis just need a little push to make sure the pane and axis object bindings have been updated
|
//sometimes the axis just need a little push to make sure the pane and axis object bindings have been updated
|
||||||
for (int i=0; i<Side.values().length; i++) {
|
for (int i=0; i<Side.values().length; i++) {
|
||||||
dDPlotPane.getAxisPane(Side.values()[i]).layout();
|
dDPlotPane.getAxisPane(Side.values()[i]).layout();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
System.out.println("Axis Width: " + dDPlotPane.getAxisPane(Side.BOTTOM).getWidth() + " canvas width " + dDPlotPane.getPlotCanvas().getWidth());
|
||||||
|
|
||||||
|
|
||||||
currentDataInfo.drawData(dDPlotPane.getPlotCanvas().getGraphicsContext2D(),
|
currentDataInfo.drawData(dDPlotPane.getPlotCanvas().getGraphicsContext2D(),
|
||||||
new Rectangle(0,0,dDPlotPane.getPlotCanvas().getWidth(),dDPlotPane.getPlotCanvas().getHeight()),
|
new Rectangle(0,0,dDPlotPane.getPlotCanvas().getWidth(),dDPlotPane.getPlotCanvas().getHeight()),
|
||||||
this.detectionPlotProjector, newDataUnit);
|
this.detectionPlotProjector, newDataUnit);
|
||||||
}
|
}
|
||||||
if (reDrawScroll) {
|
if (reDrawScroll) {
|
||||||
setupScrollBar( newDataUnit);
|
setupScrollBar(newDataUnit);
|
||||||
reDrawScroll=false;
|
reDrawScroll=false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//dDPlotPane.repaintAxis();
|
//dDPlotPane.repaintAxis();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -554,6 +564,7 @@ public class DetectionPlotDisplay extends PamBorderPane {
|
|||||||
*/
|
*/
|
||||||
public void setEnableScrollBar(boolean enableScrollBarPane) {
|
public void setEnableScrollBar(boolean enableScrollBarPane) {
|
||||||
enableScrollBar=enableScrollBarPane;
|
enableScrollBar=enableScrollBarPane;
|
||||||
|
this.detectionPlotProjector.enableScrollBar = enableScrollBarPane;
|
||||||
setupScrollBar();
|
setupScrollBar();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,14 +57,14 @@ public class TabSelectionPane extends SettingsPane<PamGuiTabFX> {
|
|||||||
tabChoice=new ComboBox<String>();
|
tabChoice=new ComboBox<String>();
|
||||||
tabChoice.setMinWidth(100);
|
tabChoice.setMinWidth(100);
|
||||||
PamHBox.setHgrow(tabChoice, Priority.ALWAYS); //make sure choice nox is big enough
|
PamHBox.setHgrow(tabChoice, Priority.ALWAYS); //make sure choice nox is big enough
|
||||||
tabChoice.setEditable(true);
|
tabChoice.setEditable(false);
|
||||||
|
|
||||||
//listener for adding tabs
|
//listener for adding tabs
|
||||||
addButton=new PamButton();
|
addButton=new PamButton();
|
||||||
// addButton.setGraphic(PamGlyphDude.createPamGlyph(FontAwesomeIcon.PLUS, Color.WHITE, PamGuiManagerFX.iconSize));
|
// addButton.setGraphic(PamGlyphDude.createPamGlyph(FontAwesomeIcon.PLUS, Color.WHITE, PamGuiManagerFX.iconSize));
|
||||||
addButton.setGraphic(PamGlyphDude.createPamIcon("mdi2p-plus", Color.WHITE, PamGuiManagerFX.iconSize));
|
addButton.setGraphic(PamGlyphDude.createPamIcon("mdi2p-plus", Color.WHITE, PamGuiManagerFX.iconSize));
|
||||||
addButton.setOnAction((action)->{
|
addButton.setOnAction((action)->{
|
||||||
pamGuiFX.addPamTab(new TabInfo("New Display " +(pamGuiFX.getTabs().size()+1)), null, true);
|
pamGuiFX.addPamTab(new TabInfo("Display " +(pamGuiFX.getTabs().size()+1)), null, true);
|
||||||
populateChoiceBox();
|
populateChoiceBox();
|
||||||
//select the tab which has just been added.
|
//select the tab which has just been added.
|
||||||
tabChoice.getSelectionModel().selectLast();
|
tabChoice.getSelectionModel().selectLast();
|
||||||
|
@ -21,22 +21,22 @@ import pamViewFX.fxNodes.pamAxis.PamAxisPane2;
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class PlotPane extends PamBorderPane {
|
public class PlotPane extends PamBorderPane {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The x axis which sits at the top of the plot
|
* The x axis which sits at the top of the plot
|
||||||
*/
|
*/
|
||||||
private PamAxisFX xAxisTop;
|
private PamAxisFX xAxisTop;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The x axis which sits at the bottom of the plot
|
* The x axis which sits at the bottom of the plot
|
||||||
*/
|
*/
|
||||||
private PamAxisFX xAxisBottom;
|
private PamAxisFX xAxisBottom;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The y Axis which sits to the left of the plot
|
* The y Axis which sits to the left of the plot
|
||||||
*/
|
*/
|
||||||
private PamAxisFX yAxisLeft;
|
private PamAxisFX yAxisLeft;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*The y axis which sits to right of the plot
|
*The y axis which sits to right of the plot
|
||||||
*/
|
*/
|
||||||
@ -88,7 +88,7 @@ public class PlotPane extends PamBorderPane {
|
|||||||
* Convenience variable, an array with all axis in order, top, right, bottom, left.
|
* Convenience variable, an array with all axis in order, top, right, bottom, left.
|
||||||
*/
|
*/
|
||||||
private PamAxisFX[] axisArray;
|
private PamAxisFX[] axisArray;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convenience variable, an array with all axis in order, top, right, bottom, left.
|
* Convenience variable, an array with all axis in order, top, right, bottom, left.
|
||||||
*/
|
*/
|
||||||
@ -98,7 +98,7 @@ public class PlotPane extends PamBorderPane {
|
|||||||
* The holder pane for stuff
|
* The holder pane for stuff
|
||||||
*/
|
*/
|
||||||
private PamBorderPane holderPane;
|
private PamBorderPane holderPane;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Overlaid pane on canvas which can be used to add hiding panes to the plot.
|
* Overlaid pane on canvas which can be used to add hiding panes to the plot.
|
||||||
*/
|
*/
|
||||||
@ -111,23 +111,33 @@ public class PlotPane extends PamBorderPane {
|
|||||||
private double bottomBorder;
|
private double bottomBorder;
|
||||||
|
|
||||||
private double leftBorder;
|
private double leftBorder;
|
||||||
//
|
//
|
||||||
// public static final int BOTTOMAXIS = 0;
|
// public static final int BOTTOMAXIS = 0;
|
||||||
// public static final int BOTTOMAXIS = 1;
|
// public static final int BOTTOMAXIS = 1;
|
||||||
// public static final int BOTTOMAXIS = 2;
|
// public static final int BOTTOMAXIS = 2;
|
||||||
// public static final int BOTTOMAXIS = 3;
|
// public static final int BOTTOMAXIS = 3;
|
||||||
//
|
//
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a default plot with an bottom x axis and left y axis.
|
* Constructs a default plot with an bottom x axis and left y axis.
|
||||||
*/
|
*/
|
||||||
public PlotPane(){
|
public PlotPane(){
|
||||||
this.setCenter(createPlot(false));
|
this.setCenter(createPlot(false));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private PamBorderPane createPlot(boolean sidePanes){
|
private PamBorderPane createPlot(boolean sidePanes){
|
||||||
|
|
||||||
|
//create the panes to hold the axis;
|
||||||
|
//create the plot pane.
|
||||||
|
canvasHolder=new PamBorderPane();
|
||||||
|
canvasHolder.setMaxWidth(4000);
|
||||||
|
canvasHolder.setMaxHeight(4000);
|
||||||
|
|
||||||
|
canvas = new Canvas(50, 50);
|
||||||
|
canvas.heightProperty().bind(canvasHolder.heightProperty());
|
||||||
|
canvas.widthProperty().bind(canvasHolder.widthProperty());
|
||||||
|
|
||||||
//create the x axis for the display.
|
//create the x axis for the display.
|
||||||
xAxisTop = new PamAxisFX(0, 1, 0, 1, 0, 10, PamAxisFX.ABOVE_LEFT, null, PamAxis.LABEL_NEAR_CENTRE, null);
|
xAxisTop = new PamAxisFX(0, 1, 0, 1, 0, 10, PamAxisFX.ABOVE_LEFT, null, PamAxis.LABEL_NEAR_CENTRE, null);
|
||||||
xAxisTop.setCrampLabels(true);
|
xAxisTop.setCrampLabels(true);
|
||||||
@ -145,67 +155,53 @@ public class PlotPane extends PamBorderPane {
|
|||||||
yAxisLeftPane=new PamAxisPane2(yAxisLeft, Side.LEFT);
|
yAxisLeftPane=new PamAxisPane2(yAxisLeft, Side.LEFT);
|
||||||
//yAxisLeftPane.setOrientation(Orientation.VERTICAL);
|
//yAxisLeftPane.setOrientation(Orientation.VERTICAL);
|
||||||
|
|
||||||
|
|
||||||
yAxisRight = new PamAxisFX(0, 1, 0, 1, 0, 10, PamAxisFX.BELOW_RIGHT, "Graph Y Units", PamAxisFX.LABEL_NEAR_CENTRE, "%4d");
|
yAxisRight = new PamAxisFX(0, 1, 0, 1, 0, 10, PamAxisFX.BELOW_RIGHT, "Graph Y Units", PamAxisFX.LABEL_NEAR_CENTRE, "%4d");
|
||||||
yAxisRight.setCrampLabels(true);
|
yAxisRight.setCrampLabels(true);
|
||||||
yAxisRightPane=new PamAxisPane2(yAxisRight, Side.RIGHT);
|
yAxisRightPane=new PamAxisPane2(yAxisRight, Side.RIGHT);
|
||||||
//yAxisRightPane.setOrientation(Orientation.VERTICAL);
|
//yAxisRightPane.setOrientation(Orientation.VERTICAL)
|
||||||
|
|
||||||
|
//allow hiding panes to be added
|
||||||
//create the panes to hold the axis;
|
hiddenSidePane=new PamHiddenSidePane();
|
||||||
|
hiddenSidePane.getChildren().add(canvas);
|
||||||
//create the plot pane.
|
hiddenSidePane.toFront();
|
||||||
canvasHolder=new PamBorderPane();
|
|
||||||
canvasHolder.setMaxWidth(4000);
|
|
||||||
canvasHolder.setMaxHeight(4000);
|
|
||||||
|
|
||||||
canvas = new Canvas(50, 50);
|
|
||||||
canvas.heightProperty().bind(canvasHolder.heightProperty());
|
|
||||||
canvas.widthProperty().bind(canvasHolder.widthProperty());
|
|
||||||
|
|
||||||
|
|
||||||
//allow hiding panes to be added
|
|
||||||
hiddenSidePane=new PamHiddenSidePane();
|
|
||||||
hiddenSidePane.getChildren().add(canvas);
|
|
||||||
hiddenSidePane.toFront();
|
|
||||||
|
|
||||||
|
|
||||||
canvasHolder.setCenter(hiddenSidePane);
|
|
||||||
canvasHolder.setMinHeight(0);
|
|
||||||
canvasHolder.setMinWidth(0);
|
|
||||||
//canvasHolder.getStyleClass().add("pane-plot");
|
|
||||||
|
|
||||||
//now add all axis together
|
canvasHolder.setCenter(hiddenSidePane);
|
||||||
holderPane=new PamBorderPane();
|
canvasHolder.setMinHeight(10);
|
||||||
|
canvasHolder.setMinWidth(10);
|
||||||
//now need to add some corner sections to the top and bottom axis as borderpane is being used
|
//canvasHolder.getStyleClass().add("pane-plot");
|
||||||
topHolder=createHorzHolder(xAxisTopPane);
|
|
||||||
bottomHolder=createHorzHolder(xAxisBottomPane);
|
|
||||||
|
|
||||||
setAxisVisible(true, true, true, true);
|
//now add all axis together
|
||||||
|
holderPane=new PamBorderPane();
|
||||||
|
|
||||||
|
//now need to add some corner sections to the top and bottom axis as borderpane is being used
|
||||||
// topHolder.toFront();
|
topHolder=createHorzHolder(xAxisTopPane);
|
||||||
//yAxisRightPane.toFront();
|
bottomHolder=createHorzHolder(xAxisBottomPane);
|
||||||
// yAxisLeftPane.toFront();
|
|
||||||
// bottomHolder.toFront();
|
setAxisVisible(true, true, true, true);
|
||||||
|
|
||||||
axisArray=new PamAxisFX[4];
|
|
||||||
axisArray[0]=xAxisTop;
|
// topHolder.toFront();
|
||||||
axisArray[1]=yAxisRight;
|
//yAxisRightPane.toFront();
|
||||||
axisArray[2]=xAxisBottom;
|
// yAxisLeftPane.toFront();
|
||||||
axisArray[3]=yAxisLeft;
|
// bottomHolder.toFront();
|
||||||
|
|
||||||
axisPanes=new PamAxisPane2[4];
|
axisArray=new PamAxisFX[4];
|
||||||
axisPanes[0]=xAxisTopPane;
|
axisArray[0]=xAxisTop;
|
||||||
axisPanes[1]=yAxisRightPane;
|
axisArray[1]=yAxisRight;
|
||||||
axisPanes[2]=xAxisBottomPane;
|
axisArray[2]=xAxisBottom;
|
||||||
axisPanes[3]=yAxisLeftPane;
|
axisArray[3]=yAxisLeft;
|
||||||
|
|
||||||
return holderPane;
|
axisPanes=new PamAxisPane2[4];
|
||||||
|
axisPanes[0]=xAxisTopPane;
|
||||||
|
axisPanes[1]=yAxisRightPane;
|
||||||
|
axisPanes[2]=xAxisBottomPane;
|
||||||
|
axisPanes[3]=yAxisLeftPane;
|
||||||
|
|
||||||
|
return holderPane;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set a hiding pane within the plot area
|
* Set a hiding pane within the plot area
|
||||||
* @param pane - the pane whihc is hidden
|
* @param pane - the pane whihc is hidden
|
||||||
@ -231,7 +227,7 @@ public class PlotPane extends PamBorderPane {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get one of the hiding panes within the plot area
|
* Get one of the hiding panes within the plot area
|
||||||
* @param side - the location of the pna eon the plot (left or right)
|
* @param side - the location of the pna eon the plot (left or right)
|
||||||
@ -258,7 +254,7 @@ public class PlotPane extends PamBorderPane {
|
|||||||
*/
|
*/
|
||||||
private PamHBox createHorzHolder(PamAxisPane2 axisPane){
|
private PamHBox createHorzHolder(PamAxisPane2 axisPane){
|
||||||
PamHBox horzHolder=new PamHBox();
|
PamHBox horzHolder=new PamHBox();
|
||||||
|
|
||||||
Pane leftPane=new Pane();
|
Pane leftPane=new Pane();
|
||||||
//need both min and pref to make binding work properly;
|
//need both min and pref to make binding work properly;
|
||||||
leftPane.prefWidthProperty().bind(yAxisLeftPane.widthProperty());
|
leftPane.prefWidthProperty().bind(yAxisLeftPane.widthProperty());
|
||||||
@ -267,26 +263,26 @@ public class PlotPane extends PamBorderPane {
|
|||||||
Pane rightPane=new Pane();
|
Pane rightPane=new Pane();
|
||||||
rightPane.prefWidthProperty().bind(yAxisRightPane.widthProperty());
|
rightPane.prefWidthProperty().bind(yAxisRightPane.widthProperty());
|
||||||
rightPane.minWidthProperty().bind(yAxisRightPane.widthProperty());
|
rightPane.minWidthProperty().bind(yAxisRightPane.widthProperty());
|
||||||
|
|
||||||
horzHolder.getChildren().addAll(leftPane, axisPane, rightPane);
|
horzHolder.getChildren().addAll(leftPane, axisPane);
|
||||||
//axisPane.toFront(); this changes the order of children in a PamHBox.
|
//axisPane.toFront(); this changes the order of children in a PamHBox.
|
||||||
HBox.setHgrow(axisPane, Priority.ALWAYS);
|
HBox.setHgrow(axisPane, Priority.ALWAYS);
|
||||||
|
|
||||||
//horzHolder.getStyleClass().add("pane");
|
//horzHolder.getStyleClass().add("pane");
|
||||||
|
|
||||||
return horzHolder;
|
return horzHolder;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// public void repaintAxis() {
|
|
||||||
// xAxisTopPane.repaint();
|
|
||||||
// xAxisBottomPane.repaint();
|
|
||||||
// yAxisRightPane.repaint();
|
|
||||||
// yAxisLeftPane.repaint();
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
// public void repaintAxis() {
|
||||||
|
// xAxisTopPane.repaint();
|
||||||
|
// xAxisBottomPane.repaint();
|
||||||
|
// yAxisRightPane.repaint();
|
||||||
|
// yAxisLeftPane.repaint();
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the canvas- this is where the plotting takes place.
|
* Get the canvas- this is where the plotting takes place.
|
||||||
* @return the plot canvas.
|
* @return the plot canvas.
|
||||||
@ -294,8 +290,8 @@ public class PlotPane extends PamBorderPane {
|
|||||||
public Canvas getPlotCanvas() {
|
public Canvas getPlotCanvas() {
|
||||||
return canvas;
|
return canvas;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get an axis of the plot pane.
|
* Get an axis of the plot pane.
|
||||||
* @param side the axis to get.
|
* @param side the axis to get.
|
||||||
@ -314,10 +310,10 @@ public class PlotPane extends PamBorderPane {
|
|||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get an axis pane. The axis pane is the node which displays a PamAxisFX.
|
* Get an axis pane. The axis pane is the node which displays a PamAxisFX.
|
||||||
* @param side the axis pane to get.
|
* @param side the axis pane to get.
|
||||||
@ -337,7 +333,7 @@ public class PlotPane extends PamBorderPane {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get all the axis of the plot pane.
|
* Get all the axis of the plot pane.
|
||||||
* @return a list of axis in the order: TOP, RIGHT, BOTTOM, LEFT.
|
* @return a list of axis in the order: TOP, RIGHT, BOTTOM, LEFT.
|
||||||
@ -345,7 +341,7 @@ public class PlotPane extends PamBorderPane {
|
|||||||
public PamAxisFX[] getAllAxis() {
|
public PamAxisFX[] getAllAxis() {
|
||||||
return axisArray;
|
return axisArray;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get an axis pane
|
* Get an axis pane
|
||||||
* @param side the axis to get.
|
* @param side the axis to get.
|
||||||
@ -353,14 +349,14 @@ public class PlotPane extends PamBorderPane {
|
|||||||
public PamAxisPane2[] getAllAxisPanes() {
|
public PamAxisPane2[] getAllAxisPanes() {
|
||||||
return axisPanes;
|
return axisPanes;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setEmptyBorders(double top, double right, double bottom, double left) {
|
public void setEmptyBorders(double top, double right, double bottom, double left) {
|
||||||
this.topBorder = top;
|
this.topBorder = top;
|
||||||
this.rightBorder = right;
|
this.rightBorder = right;
|
||||||
this.bottomBorder = bottom;
|
this.bottomBorder = bottom;
|
||||||
this.leftBorder = left;
|
this.leftBorder = left;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set which axis are visible.
|
* Set which axis are visible.
|
||||||
* @param top true to show the top axis
|
* @param top true to show the top axis
|
||||||
@ -370,9 +366,9 @@ public class PlotPane extends PamBorderPane {
|
|||||||
*/
|
*/
|
||||||
public void setAxisVisible(boolean top, boolean right, boolean bottom,
|
public void setAxisVisible(boolean top, boolean right, boolean bottom,
|
||||||
boolean left) {
|
boolean left) {
|
||||||
|
|
||||||
//holderPane.getChildren().clear();
|
//holderPane.getChildren().clear();
|
||||||
|
|
||||||
//HACK- 05/08/2016 have to do this because there is a bug in switching children postions in a border pane.
|
//HACK- 05/08/2016 have to do this because there is a bug in switching children postions in a border pane.
|
||||||
//casues a duplicate childrne error.
|
//casues a duplicate childrne error.
|
||||||
holderPane.setRight(null);
|
holderPane.setRight(null);
|
||||||
@ -381,41 +377,41 @@ public class PlotPane extends PamBorderPane {
|
|||||||
holderPane.setBottom(null);
|
holderPane.setBottom(null);
|
||||||
holderPane.getChildren().clear();
|
holderPane.getChildren().clear();
|
||||||
//end of HACK.
|
//end of HACK.
|
||||||
|
|
||||||
|
|
||||||
if (top) {
|
if (top) {
|
||||||
holderPane.setTop(topHolder) ;
|
holderPane.setTop(topHolder) ;
|
||||||
}
|
}
|
||||||
else if (topBorder > 0) {
|
else if (topBorder > 0) {
|
||||||
// holderPane.setTopSpace(topBorder);
|
// holderPane.setTopSpace(topBorder);
|
||||||
}
|
}
|
||||||
if (bottom) {
|
if (bottom) {
|
||||||
holderPane.setBottom(bottomHolder);
|
holderPane.setBottom(bottomHolder);
|
||||||
}
|
}
|
||||||
else if (bottomBorder > 0) {
|
else if (bottomBorder > 0) {
|
||||||
// holderPane.setBottomSpace(bottomBorder);
|
// holderPane.setBottomSpace(bottomBorder);
|
||||||
}
|
}
|
||||||
if (right) {
|
if (right) {
|
||||||
holderPane.setRight(yAxisRightPane) ;
|
holderPane.setRight(yAxisRightPane) ;
|
||||||
}
|
}
|
||||||
else if (rightBorder > 0){
|
else if (rightBorder > 0){
|
||||||
// holderPane.setRightSpace(rightBorder);
|
// holderPane.setRightSpace(rightBorder);
|
||||||
}
|
}
|
||||||
if (left) {
|
if (left) {
|
||||||
holderPane.setLeft(yAxisLeftPane) ;
|
holderPane.setLeft(yAxisLeftPane) ;
|
||||||
}
|
}
|
||||||
else if (leftBorder > 0) {
|
else if (leftBorder > 0) {
|
||||||
// holderPane.setLeftSpace(leftBorder);
|
// holderPane.setLeftSpace(leftBorder);
|
||||||
}
|
}
|
||||||
holderPane.setCenter(canvasHolder);
|
holderPane.setCenter(canvasHolder);
|
||||||
//bottomHolder.toBack();
|
//bottomHolder.toBack();
|
||||||
|
|
||||||
// this.xAxisTopPane.setVisible(top);
|
// this.xAxisTopPane.setVisible(top);
|
||||||
// this.xAxisBottomPane.setVisible(bottom);
|
// this.xAxisBottomPane.setVisible(bottom);
|
||||||
// this.yAxisRightPane.setVisible(right);
|
// this.yAxisRightPane.setVisible(right);
|
||||||
// this.yAxisLeftPane.setVisible(left);
|
// this.yAxisLeftPane.setVisible(left);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the minimium height of the right and left hide pane. Set -1 for there to be no minimum height.
|
* Set the minimium height of the right and left hide pane. Set -1 for there to be no minimum height.
|
||||||
* If the hide pane goes below the minimum height it pops out of its holder.
|
* If the hide pane goes below the minimum height it pops out of its holder.
|
||||||
@ -456,12 +452,12 @@ public class PlotPane extends PamBorderPane {
|
|||||||
public PamAxisFX getyAxisRight() {
|
public PamAxisFX getyAxisRight() {
|
||||||
return yAxisRight;
|
return yAxisRight;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user