public void propertyChange(PropertyChangeEvent e) { String prop = e.getPropertyName(); if (prop == JFileChooser.SELECTED_FILE_CHANGED_PROPERTY) { if (isShowing()) { loadImage((File) e.getNewValue()); repaint(); } } }
public void propertyChange(PropertyChangeEvent e) { String propertyName = e.getPropertyName(); if (e.getPropertyName().equals(Action.NAME)) { String text = (String) e.getNewValue(); menuItem.setText(text); } else if (propertyName.equals("enabled")) { // System.out.println("Debug:TextViewer: ActionChangedListener enabled"); Boolean enabledState = (Boolean) e.getNewValue(); menuItem.setEnabled(enabledState.booleanValue()); } }
// // Implement PropertyChangeListener interface // @Override public void propertyChange(PropertyChangeEvent evt) { if (evt.getNewValue() instanceof Font) { if (updateFont) { Font newFont = (Font) evt.getNewValue(); setFont(newFont); lastDigits = 0; setPreferredWidth(); } else { repaint(); } } }
/** * The animation changed. Handle the change. * * @param evt The event */ private void handleAnimationPropertyChange(PropertyChangeEvent evt) { // System.err.println ("Handlechange:" +evt.getPropertyName()); if (evt.getPropertyName().equals(Animation.ANI_VALUE)) { debug("handleAnimationPropertyChange value :" + evt.getPropertyName()); Real eventValue = (Real) evt.getNewValue(); // if there's nothing to do, return; if ((eventValue == null) || eventValue.isMissing()) { return; } /** The Animation associated with this widget */ DateTime time = null; try { time = new DateTime(eventValue); } catch (VisADException ve) {; } final DateTime theDateTime = time; final int theIndex = ((anime != null) ? anime.getCurrent() : -1); SwingUtilities.invokeLater( new Runnable() { public void run() { boolean oldValue = ignoreTimesCbxEvents; try { ignoreTimesCbxEvents = true; // synchronized (timesCbxMutex) { xcnt++; timesCbx.setSelectedItem(theDateTime); // } if ((boxPanel != null) && (theIndex >= 0)) { boxPanel.setOnIndex(theIndex); } timesCbx.repaint(); } finally { ignoreTimesCbxEvents = oldValue; } } }); shareValue(); } else if (evt.getPropertyName().equals(Animation.ANI_SET)) { if (ignoreAnimationSetChange) { return; } updateIndicatorInner((Set) evt.getNewValue(), true); } }
// Called on EDT public void propertyChange(PropertyChangeEvent ev) { String prop = ev.getPropertyName(); if (prop == JConsoleContext.CONNECTION_STATE_PROPERTY) { ConnectionState newState = (ConnectionState) ev.getNewValue(); switch (newState) { case DISCONNECTED: synchronized (this) { long time = System.currentTimeMillis(); times.add(time); for (Sequence seq : seqs) { seq.add(Long.MIN_VALUE); } } break; } } }
public void propertyChange(PropertyChangeEvent e) { String strPropName = e.getPropertyName(); if (strPropName.equals(WGlobal.USER_CHANGE)) { String strName = (String) e.getNewValue(); String strAccount = null; VDetailArea objDetailArea = m_adminIF.getDetailArea1(); if (objDetailArea != null) strAccount = objDetailArea.getItemValue("itype"); if (strAccount == null) strAccount = ""; strAccount = strAccount.trim(); String strDir = getPathDir() + strName; if (this instanceof DisplayTemplate) { if (strAccount.equals(Global.IMGIF)) strDir = strDir + ".img"; else if (strAccount.equals(Global.WALKUPIF)) strDir = strDir + ".walkup"; } String strPath = FileUtil.openPath(strDir); boolean bDefaultFile = false; if (strPath == null) { strPath = FileUtil.openPath(getDefaultFile(strAccount)); bDefaultFile = true; } clear(this); layoutUIComponents(strPath, bDefaultFile); } else if (strPropName.indexOf(WGlobal.IMGDIR) >= 0) { String strName = (String) e.getNewValue(); StringTokenizer strTokenizer = new StringTokenizer(strPropName); String strInterface = null; boolean bDefaultFile = false; if (strTokenizer.hasMoreTokens()) strTokenizer.nextToken(); if (strTokenizer.hasMoreTokens()) strInterface = strTokenizer.nextToken(); if (strInterface == null) strInterface = ""; strInterface = strInterface.trim(); String strDir = getPathDir() + strName; if (this instanceof DisplayTemplate) { if (strInterface.equals(WGlobal.IMGDIR)) strDir = strDir + ".img"; else if (strInterface.equals(WGlobal.WALKUPDIR)) strDir = strDir + ".walkup"; } String strPath = FileUtil.openPath(strDir); if (strPath == null) { String strAccount = Global.WALKUPIF; if (strInterface.equals(WGlobal.IMGDIR)) strAccount = Global.IMGIF; else if (strInterface.equals(WGlobal.WALKUPDIR)) strAccount = Global.WALKUPIF; strPath = FileUtil.openPath(getDefaultFile(strAccount)); bDefaultFile = true; } clear(this); layoutUIComponents(strPath, bDefaultFile); } else if (strPropName.indexOf(WGlobal.SAVEUSER_NOERROR) >= 0) { Object objValue = e.getNewValue(); String strName = ""; if (objValue instanceof String) strName = (String) objValue; else if (objValue instanceof WItem) strName = ((WItem) objValue).getText(); VDetailArea objDetail = m_adminIF.getDetailArea1(); String strAccount = null; if (objDetail != null) strAccount = objDetail.getItemValue("itype"); if (strAccount == null) strAccount = ""; strAccount = strAccount.trim(); String strDir = getPathDir() + strName; if (this instanceof DisplayTemplate) { if (strAccount.equals(Global.IMGIF)) strDir = strDir + ".img"; else if (strAccount.equals(Global.WALKUPIF)) strDir = strDir + ".walkup"; } TextFieldValues objTxf = getTxfValues(); writeFile(strName, strDir, objTxf.getTxfLabel(), objTxf.getTxfValue()); } else if (strPropName.indexOf(WGlobal.DELETE_USER) >= 0) { clear(this); String strPath = FileUtil.openPath(getDefaultFile("")); layoutUIComponents(strPath, true); } }