[Date Prev][Date Next][Index][Thread]
[SGT Mail Archive]
[SGT Main Page]
Back button for Zoom - one solution
*************************************************
Message from the sgt mail list.
*************************************************
An implementation of the solution is as follows:
Define a zoom history buffer:
private Domain[] zoomHistory;
Define backward and forward buttons with listeners.
Define a zoom listener:
class ZoomL implements PropertyChangeListener {
public void propertyChange(PropertyChangeEvent pce) {
addZoomHistory();
}
}
}
Populate the zoom buffer accordingly:
private void addZoomHistory() {
Domain zoomElement = graph.getRange();
// Is the zoom history buffer full ?
if (currentZoomPtr == (MAX_ZOOM_HISTORY - 1)) {
// Drop the first element in the buffer.
for (int i=1; i < MAX_ZOOM_HISTORY; i++) {
zoomHistory[i-1] = zoomHistory[i];
}
// Add the current zoom element to the end of the buffer.
zoomHistory[MAX_ZOOM_HISTORY - 1] = zoomElement;
}
else {
currentZoomPtr++;
zoomHistory[currentZoomPtr] = zoomElement;
maxZoomPtr = currentZoomPtr;
}
backZoom.setEnabled(true);
forwardZoom.setEnabled(false);
}
ubk
> -----Original Message-----
> From: K. B. Udaya [mailto:ubk@kogalur-shear.com]
> Sent: Saturday, March 25, 2006 11:25 AM
> To: sgt@noaa.gov
> Subject: Back button for Zoom
>
>
> *************************************************
> Message from the sgt mail list.
> *************************************************
>
> Has anyone implemented a "back" button for zoom functionality that would
> allow the user to restore the previous state of a screen after a
> zoom? This
> is in contrast to sgt.swing.JPlotLayout.resetZoom() that restores the
> original plot with all the data being displayed.
>
> I suppose I'll have to get the shovel out and start digging into
> the source
> code again ...
>
> ubk
>
> K. B. Udaya, Ph.D.
> Kogalur Shear Corporation
> ubk@kogalur-shear.com
>
>
>
> *************************************************
> To remove yourself from this mailing list,
> send mail to <epic-majordomo@noaa.gov> with
> "unsubscribe sgt" in the message body.
> ==========
*************************************************
To remove yourself from this mailing list,
send mail to <epic-majordomo@noaa.gov> with
"unsubscribe sgt" in the message body.
==========
Privacy Notice,
External Links Disclaimer.