legendManager.setVisible(true);
}
boolean visible = legendManager.isVisible();
if(wasVisible != visible) {
XYAxis yAxis = plotView.getYAxis();
SpringLayout layout = (SpringLayout) plotView.getLayout();
if (getAxisOrientationSetting() == AxisOrientationSetting.X_AXIS_AS_TIME) {
if(visible) {
layout.putConstraint(SpringLayout.WEST, yAxis, 0, SpringLayout.EAST, legendManager);
} else {
layout.putConstraint(SpringLayout.WEST, yAxis, 0, SpringLayout.WEST, plotView);
}
} else {
/* Make room for axis labels, but only if they're non-empty */
if (yAxis.getComponentCount() > 0) {
layout.putConstraint(SpringLayout.WEST, yAxis, 2, SpringLayout.EAST, legendManager);
} else {
/* Otherwise, push up against the plot contents */
layout.putConstraint(SpringLayout.WEST, legendManager, 5, SpringLayout.WEST, plotView);
layout.putConstraint(SpringLayout.WEST, yAxis, 2, SpringLayout.EAST, legendManager);