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