/** * From the "animationInfo" set of animation properties, set all these values into all the * Animation objects held as memeber data. * * @param transfer AnimationInfo to get properties from */ public void setProperties(AnimationInfo transfer) { setBoxPanelVisible(transfer.getBoxesVisible()); animationInfo.set(transfer); setSharing(animationInfo.shared); if (animationInfo.getAnimationGroup() != null) { setShareGroup(animationInfo.getAnimationGroup()); } if (propertiesDialog != null) { propertiesDialog.setInfo(animationInfo); } try { if (anime != null) { anime.setAnimationInfo(animationInfo); DisplayMaster displayMaster = anime.getDisplayMaster(); if (displayMaster != null) { displayMaster.dataChange(); } else { if (getAnimationSetInfo().getActive()) { anime.setSet(getAnimationSetInfo().makeTimeSet(null)); } else { anime.setSet(getAnimationSetInfo().getBaseTimes()); } } } } catch (Exception exp) { LogUtil.logException("Error setting properties", exp); } updateRunButton(); checkAutoUpdate(); }
/** * Contruct a new AnimationWidget. * * @param parentf the parent JFrame * @param anim a ucar.visad.display.Animation object to manage * @param info Default values for the AnimationInfo */ public AnimationWidget(JFrame parentf, Animation anim, AnimationInfo info) { // Initialize sharing to true super("AnimationWidget", true); timesCbx = new JComboBox() { public String getToolTipText(MouseEvent event) { if (boxPanel != null) { return boxPanel.getToolTipText(); } return " "; } }; timesCbx.setToolTipText(""); timesCbxMutex = timesCbx.getTreeLock(); timesCbx.setFont(new Font("Dialog", Font.PLAIN, 9)); timesCbx.setLightWeightPopupEnabled(false); // set to non-visible until items are added timesCbx.setVisible(false); timesCbx.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { if (!ignoreTimesCbxEvents && (anime != null)) { debug("got timesCbx event"); setTimeFromUser((Real) timesCbx.getSelectedItem()); if (boxPanel != null) { boxPanel.setOnIndex(timesCbx.getSelectedIndex()); } } } }); animationInfo = new AnimationInfo(); if (anim != null) { setAnimation(anim); } if (anime != null) { animationInfo.set(anime.getAnimationInfo()); } if (info != null) { setProperties(info); animationInfo.setRunning(info.getRunning()); } boxPanel = new AnimationBoxPanel(this); if (timesArray != null) { updateBoxPanel(timesArray); } }
/** * Sets the <CODE>ucar.visad.display.Animation</CODE> controlled by this widget. Removes any other * <CODE>ucar.visad.display.Animation</CODE> from the control of this widget. * * @param newAnimation ucar.visad.display.Animation to control */ public void setAnimation(Animation newAnimation) { if (newAnimation == null) { throw new NullPointerException("Animation can't be null"); } removeAnimationListener(); anime = newAnimation; animationInfo.set(anime.getAnimationInfo()); updateIndicator(anime.getSet()); animationListener = new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { handleAnimationPropertyChange(evt); } }; anime.addPropertyChangeListener(animationListener); }