001/* 002 * $Id: ProfilerTimeHeightControl.java,v 1.3 2011/03/24 16:06:32 davep Exp $ 003 * 004 * This file is part of McIDAS-V 005 * 006 * Copyright 2007-2011 007 * Space Science and Engineering Center (SSEC) 008 * University of Wisconsin - Madison 009 * 1225 W. Dayton Street, Madison, WI 53706, USA 010 * https://www.ssec.wisc.edu/mcidas 011 * 012 * All Rights Reserved 013 * 014 * McIDAS-V is built on Unidata's IDV and SSEC's VisAD libraries, and 015 * some McIDAS-V source code is based on IDV and VisAD source code. 016 * 017 * McIDAS-V is free software; you can redistribute it and/or modify 018 * it under the terms of the GNU Lesser Public License as published by 019 * the Free Software Foundation; either version 3 of the License, or 020 * (at your option) any later version. 021 * 022 * McIDAS-V is distributed in the hope that it will be useful, 023 * but WITHOUT ANY WARRANTY; without even the implied warranty of 024 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 025 * GNU Lesser Public License for more details. 026 * 027 * You should have received a copy of the GNU Lesser Public License 028 * along with this program. If not, see http://www.gnu.org/licenses. 029 */ 030package edu.wisc.ssec.mcidasv.control; 031 032import java.rmi.RemoteException; 033 034import ucar.unidata.data.DataChoice; 035 036import visad.VisADException; 037 038/** 039 * Rather trivial extension to the IDV's {@link ucar.unidata.idv.control.ProfilerTimeHeightControl}. 040 * All this class does is {@literal "observe"} changes to its {@code isLatestOnLeft} 041 * field. These get persisted between sessions. 042 */ 043public class ProfilerTimeHeightControl 044 extends ucar.unidata.idv.control.ProfilerTimeHeightControl 045{ 046 /** Pref ID! */ 047 public static final String PREF_WIND_PROFILER_LATEST_LEFT = "mcidasv.control.latestleft"; 048 049 /** 050 * Default Constructor; does nothing. See init() for creation actions. 051 */ 052 public ProfilerTimeHeightControl() {} 053 054 /** 055 * Construct the {@link DisplayMaster}, {@link Displayable}, frame, and 056 * controls. Overridden in McIDAS-V so that we can force the value of 057 * {@code isLatestOnLeft} to its previous value (defaults to {@code false}). 058 * 059 * @param dataChoice {@link DataChoice} to use. 060 * 061 * @return boolean {@code true} if {@code dataChoice} is ok. 062 * 063 * @throws RemoteException Java RMI error 064 * @throws VisADException VisAD Error 065 */ 066 @Override public boolean init(DataChoice dataChoice) 067 throws VisADException, RemoteException 068 { 069 isLatestOnLeft = getIdv().getObjectStore().get(PREF_WIND_PROFILER_LATEST_LEFT, false); 070 return super.init(dataChoice); 071 } 072 073 /** 074 * Set whether latest data is displayed on the left or right 075 * side of the plot. Used by both {@literal "property"} and 076 * {@literal "XML"} persistence. 077 * 078 * @param yesorno {@code true} if latest data should appear on the left. 079 */ 080 @Override public void setLatestOnLeft(final boolean yesorno) { 081 isLatestOnLeft = yesorno; 082 getIdv().getObjectStore().put(PREF_WIND_PROFILER_LATEST_LEFT, yesorno); 083 } 084 085 /** 086 * Set the XAxis values. Overriden in McIDAS-V so that changes to the 087 * {@code isLatestOnLeft} field are captured. 088 * 089 * @throws VisADException Couldn't set the values 090 */ 091 @Override protected void setXAxisValues() throws VisADException { 092 setLatestOnLeft(isLatestOnLeft); 093 super.setXAxisValues(); 094 } 095}