本文整理汇总了Java中java.beans.PropertyChangeEvent.getOldValue方法的典型用法代码示例。如果您正苦于以下问题:Java PropertyChangeEvent.getOldValue方法的具体用法?Java PropertyChangeEvent.getOldValue怎么用?Java PropertyChangeEvent.getOldValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.beans.PropertyChangeEvent
的用法示例。
在下文中一共展示了PropertyChangeEvent.getOldValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testXmlContentPropertyChangeEventRemove
import java.beans.PropertyChangeEvent; //导入方法依赖的package包/类
public void testXmlContentPropertyChangeEventRemove() throws Exception {
setUp();
mDoc = Util.getResourceAsDocument("resources/testXmlContentEvent.xml");
mModel = Util.loadModel(mDoc);
mModel.addComponentListener(listener);
mModel.addPropertyChangeListener(plistener);
A a = mModel.getRootComponent().getChild(A.class);
assertEquals(0, a.getChildren().size());
Util.setDocumentContentTo(mDoc, "resources/testXmlContentEvent_1.xml");
mModel.sync();
listener.assertEvent(EventType.VALUE_CHANGED, a);
PropertyChangeEvent event = plistener.getEvent("nondomain", a);
List<Element> now = (List<Element>) event.getNewValue();
List<Element> old = (List<Element>) event.getOldValue();
assertEquals(0, now.size());
assertEquals(1, old.size());
assertEquals("101", old.get(0).getXmlFragmentText());
plistener.assertNoEvent(DocumentComponent.TEXT_CONTENT_PROPERTY);
}
示例2: propertyChange
import java.beans.PropertyChangeEvent; //导入方法依赖的package包/类
/**
* Invoked when a property changes. We are only interested in when the
* Document changes to reset the DocumentListener.
*/
public void propertyChange(PropertyChangeEvent e) {
if (e.getSource() == getEditor() && e.getPropertyName().equals(
"document")) {
Document oldDoc = (Document) e.getOldValue();
Document newDoc = (Document) e.getNewValue();
// Reset the DocumentListener
oldDoc.removeDocumentListener(this);
newDoc.addDocumentListener(this);
// Recreate the TreeModel.
treeModel = new ElementTreeModel(newDoc);
tree.setModel(treeModel);
}
}
示例3: vetoableChange
import java.beans.PropertyChangeEvent; //导入方法依赖的package包/类
public void vetoableChange(PropertyChangeEvent evt)
throws PropertyVetoException {
// if (evt.getSource() != attachedEnv) {
// return;
// }
// System.err.println("Got vetoable change: " + evt + " oldvalue=" + evt.getOldValue() + " newvalue=" + evt.getNewValue());
if (PropertyEnv.PROP_STATE.equals(evt.getPropertyName())) {
wantNextChange = ((evt.getNewValue() != getPropertyEnv().getState()) &&
(getPropertyEnv().getState() != null)) &&
((evt.getNewValue() != PropertyEnv.STATE_NEEDS_VALIDATION) ||
((evt.getNewValue() == PropertyEnv.STATE_NEEDS_VALIDATION) &&
(evt.getOldValue() == PropertyEnv.STATE_VALID)));
}
if (!inReplaceInner && (remotevEnvListener != null)) {
remotevEnvListener.vetoableChange(evt);
}
}
示例4: propertyChange
import java.beans.PropertyChangeEvent; //导入方法依赖的package包/类
public void propertyChange(PropertyChangeEvent evt) {
if (evt.getSource() instanceof PropertyEnv) {
firePropertyChange(PropertyPanel.PROP_STATE, evt.getOldValue(), evt.getNewValue());
}
if (evt.getSource() instanceof PropertyModel) {
if ((evt.getOldValue() == null) && (evt.getNewValue() == null)) {
//the old hack of firing a null-null change to get the
//infrastructure to dump everything and start from scratch
hardReset();
} else {
//Just notify the displayer that the value may have changed,
//no need for anything radical
reset();
}
}
}
示例5: assertEvent
import java.beans.PropertyChangeEvent; //导入方法依赖的package包/类
public void assertEvent(String propertyName, Object old, Object now) {
for (PropertyChangeEvent e : events) {
if (propertyName.equals(e.getPropertyName())) {
if (old != null && ! old.equals(e.getOldValue()) ||
old == null && e.getOldValue() != null) {
continue;
}
if (now != null && ! now.equals(e.getNewValue()) ||
now == null && e.getNewValue() != null) {
continue;
}
return; //matched
}
}
assertTrue("Expect property change event on "+propertyName+" with "+old+" and "+now, false);
}
示例6: propertyChange
import java.beans.PropertyChangeEvent; //导入方法依赖的package包/类
public void propertyChange(PropertyChangeEvent e) {
String prop = e.getPropertyName();
if(prop == JFileChooser.DIRECTORY_CHANGED_PROPERTY ||
prop == JFileChooser.FILE_VIEW_CHANGED_PROPERTY ||
prop == JFileChooser.FILE_FILTER_CHANGED_PROPERTY ||
prop == JFileChooser.FILE_HIDING_CHANGED_PROPERTY ||
prop == JFileChooser.FILE_SELECTION_MODE_CHANGED_PROPERTY) {
validateFileCache();
} else if ("UI".equals(prop)) {
Object old = e.getOldValue();
if (old instanceof BasicFileChooserUI) {
BasicFileChooserUI ui = (BasicFileChooserUI) old;
BasicDirectoryModel model = ui.getModel();
if (model != null) {
model.invalidateFileCache();
}
}
} else if ("JFileChooserDialogIsClosingProperty".equals(prop)) {
invalidateFileCache();
}
}
示例7: propertyChange
import java.beans.PropertyChangeEvent; //导入方法依赖的package包/类
public void propertyChange(PropertyChangeEvent event) {
String changeName = event.getPropertyName();
if ("componentOrientation" == changeName) {
InputMap inputMap = getInputMap(
JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
SwingUtilities.replaceUIInputMap(table,
JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT,
inputMap);
JTableHeader header = table.getTableHeader();
if (header != null) {
header.setComponentOrientation(
(ComponentOrientation)event.getNewValue());
}
} else if ("dropLocation" == changeName) {
JTable.DropLocation oldValue = (JTable.DropLocation)event.getOldValue();
repaintDropLocation(oldValue);
repaintDropLocation(table.getDropLocation());
} else if ("Table.isFileList" == changeName) {
isFileList = Boolean.TRUE.equals(table.getClientProperty("Table.isFileList"));
table.revalidate();
table.repaint();
if (isFileList) {
table.getSelectionModel().addListSelectionListener(getHandler());
} else {
table.getSelectionModel().removeListSelectionListener(getHandler());
timer = null;
}
} else if ("selectionModel" == changeName) {
if (isFileList) {
ListSelectionModel old = (ListSelectionModel)event.getOldValue();
old.removeListSelectionListener(getHandler());
table.getSelectionModel().addListSelectionListener(getHandler());
}
}
}
示例8: propertyChange
import java.beans.PropertyChangeEvent; //导入方法依赖的package包/类
public void propertyChange(PropertyChangeEvent evt) {
String s = evt.getPropertyName();
if (s!=null && (s.equals("parent") || s.equals("ancestor"))) {
JComponent component = (JComponent)evt.getSource();
if (evt.getNewValue() != null) {
if (component == firstInvisibleAncestor) {
addListeners(component, false);
if (firstInvisibleAncestor == null) {
fireAncestorAdded(root, AncestorEvent.ANCESTOR_ADDED,
component, component.getParent());
}
}
} else {
boolean needsNotify = firstInvisibleAncestor == null;
Container oldParent = (Container)evt.getOldValue();
removeListeners(oldParent);
firstInvisibleAncestor = component;
if (needsNotify) {
fireAncestorRemoved(root, AncestorEvent.ANCESTOR_REMOVED,
component, oldParent);
}
}
}
}
示例9: propertyChange
import java.beans.PropertyChangeEvent; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public void propertyChange(PropertyChangeEvent event) {
if (SynthLookAndFeel.shouldUpdateStyle(event)) {
updateStyle((JTree)event.getSource());
}
if ("dropLocation" == event.getPropertyName()) {
JTree.DropLocation oldValue = (JTree.DropLocation)event.getOldValue();
repaintDropLocation(oldValue);
repaintDropLocation(tree.getDropLocation());
}
}
示例10: propertyChange
import java.beans.PropertyChangeEvent; //导入方法依赖的package包/类
@Override
public void propertyChange(PropertyChangeEvent evt) {
String propertyName = evt.getPropertyName();
if (propertyName.length() <= rl || !propertyName.startsWith(r)) {
// not a listener in this root
return ;
}
PropertyChangeEvent delegateEvt = new PropertyChangeEvent(
DelegatingProperties.this,
evt.getPropertyName().substring(rl),
evt.getOldValue(),
evt.getNewValue());
delegateEvt.setPropagationId(evt.getPropagationId());
delegate.propertyChange(delegateEvt);
}
示例11: propertyChange
import java.beans.PropertyChangeEvent; //导入方法依赖的package包/类
@Override
public void propertyChange(final PropertyChangeEvent state_change_event) {
final ApplicationState new_state = (ApplicationState) state_change_event.getNewValue();
final ApplicationState old_state = (ApplicationState) state_change_event.getOldValue();
counters.get(old_state).decrement();
counters.get(new_state).increment();
}
示例12: propertyChange
import java.beans.PropertyChangeEvent; //导入方法依赖的package包/类
@Override
public void propertyChange(PropertyChangeEvent evt) {
if (DataObject.PROP_PRIMARY_FILE.equals(evt.getPropertyName())) {
final FileObject newFile = (FileObject) evt.getNewValue();
final FileObject oldFile = (FileObject) evt.getOldValue();
handleMainClassMoved(oldFile, newFile);
} else if (this.mainClassPropName.equals(evt.getPropertyName())) {
//Go out of the ProjectManager.MUTEX, see #118722
RP.post(MainClassUpdater.this::addFileChangeListener);
}
}
示例13: propertyChange
import java.beans.PropertyChangeEvent; //导入方法依赖的package包/类
/**
* Handle REARRANGE_WORKERS property change events.
*
* @param event The {@code PropertyChangeEvent}.
*/
@Override
public void propertyChange(PropertyChangeEvent event) {
logger.finest("Property change REARRANGE_WORKERS fired.");
requestRearrange();
// Check for goods party!
if (event != null
&& event.getOldValue() instanceof GoodsType) {
GoodsType goodsType = (GoodsType)event.getOldValue();
int left = colony.getGoodsCount(goodsType);
for (AIGoods aig : getExportGoods()) {
boolean remove = false;
if (aig.isDisposed()) {
remove = true;
} else if (aig.getGoods() == null) {
aig.changeTransport(null);
remove = true;
} else if (aig.getGoodsType() == goodsType) {
if (left > 0) {
aig.getGoods().setAmount(left);
} else {
aig.changeTransport(null);
remove = true;
}
}
if (remove) {
removeExportGoods(aig);
break;
}
}
}
}
示例14: fireAccessoryChanged
import java.beans.PropertyChangeEvent; //导入方法依赖的package包/类
private void fireAccessoryChanged(PropertyChangeEvent e) {
if(getAccessoryPanel() != null) {
JComponent oldAcc = (JComponent) e.getOldValue();
JComponent newAcc = (JComponent) e.getNewValue();
JComponent accessoryPanel = getAccessoryPanel();
if(oldAcc != null) {
accessoryPanel.remove(oldAcc);
}
if (oldAcc != null && newAcc == null) {
accessoryPanel.remove(topToolbar);
topComboWrapper.add(topToolbar, BorderLayout.EAST);
topCombo.setBorder(BorderFactory.createEmptyBorder(6, 0, 10, 0));
topCombo.revalidate();
}
if(newAcc != null) {
getAccessoryPanel().add(newAcc, BorderLayout.CENTER);
}
if (oldAcc == null && newAcc != null) {
topComboWrapper.remove(topToolbar);
topCombo.setBorder(BorderFactory.createEmptyBorder(4, 0, 8, 0));
accessoryPanel.add(topToolbar, BorderLayout.NORTH);
}
}
}
示例15: propertyChange
import java.beans.PropertyChangeEvent; //导入方法依赖的package包/类
@Override
public void propertyChange(@NonNull final PropertyChangeEvent evt) {
if (OpenProjects.PROPERTY_OPEN_PROJECTS.equals(evt.getPropertyName())) {
final Object oldValue = evt.getOldValue();
final Object newValue = evt.getNewValue();
if (oldValue instanceof Project[] && newValue instanceof Project[]) {
checkBrokenProjects((Project[])oldValue, (Project[]) newValue);
}
}
}