本文整理汇总了Java中java.beans.VetoableChangeSupport.fireVetoableChange方法的典型用法代码示例。如果您正苦于以下问题:Java VetoableChangeSupport.fireVetoableChange方法的具体用法?Java VetoableChangeSupport.fireVetoableChange怎么用?Java VetoableChangeSupport.fireVetoableChange使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.beans.VetoableChangeSupport
的用法示例。
在下文中一共展示了VetoableChangeSupport.fireVetoableChange方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import java.beans.VetoableChangeSupport; //导入方法依赖的package包/类
public static void main(String[] args) {
CheckListener first = new CheckListener(false);
CheckListener second = new CheckListener(true);
CheckListener third = new CheckListener(false);
VetoableChangeSupport vcs = new VetoableChangeSupport(Test6630275.class);
vcs.addVetoableChangeListener(first);
vcs.addVetoableChangeListener(PROPERTY, first);
vcs.addVetoableChangeListener(PROPERTY, second);
vcs.addVetoableChangeListener(PROPERTY, third);
try {
vcs.fireVetoableChange(PROPERTY, true, false);
} catch (PropertyVetoException exception) {
first.validate();
second.validate();
third.validate();
return; // expected exception
}
throw new Error("exception should be thrown");
}
示例2: main
import java.beans.VetoableChangeSupport; //导入方法依赖的package包/类
public static void main(String[] args) {
CheckListener first = new CheckListener();
VetoListener second = new VetoListener();
CheckListener third = new CheckListener();
VetoableChangeSupport vcs = new VetoableChangeSupport(Test4425885.class);
vcs.addVetoableChangeListener(PROPERTY, first);
vcs.addVetoableChangeListener(PROPERTY, second);
vcs.addVetoableChangeListener(PROPERTY, third);
try {
vcs.fireVetoableChange(PROPERTY, 0, 1);
} catch (PropertyVetoException exception) {
if (first.odd)
throw new Error("no undo for the first listener", exception);
if (third.odd)
throw new Error("no undo for the third listener", exception);
return; // expected exception
}
throw new Error("exception should be thrown");
}
示例3: testFireVetoableChangeStringbooleanboolean_listener_Property_invalid
import java.beans.VetoableChangeSupport; //导入方法依赖的package包/类
public void testFireVetoableChangeStringbooleanboolean_listener_Property_invalid()
throws PropertyVetoException {
MockSource source = new MockSource();
VetoableChangeSupport support = new VetoableChangeSupport(source);
VetoableChangeListener proxy = EventHandler.create(
VetoableChangeListener.class, source, "label", "source.text");
support.addVetoableChangeListener("label", proxy);
String newText = "new Text value";
source.setText(newText);
support.fireVetoableChange("text", true, false);
assertEquals("label.default", source.getLabel());
support.fireVetoableChange("label_invalid", true, false);
assertEquals("label.default", source.getLabel());
support.fireVetoableChange("label", true, false);
assertEquals(newText, source.getLabel());
}
示例4: testFireVetoableChangeStringbooleanboolean_twoListeners
import java.beans.VetoableChangeSupport; //导入方法依赖的package包/类
public void testFireVetoableChangeStringbooleanboolean_twoListeners()
throws PropertyVetoException {
MockSource source = new MockSource();
VetoableChangeSupport support = new VetoableChangeSupport(source);
VetoableChangeListener proxy = EventHandler.create(
VetoableChangeListener.class, source, "setText");
VetoableChangeListener proxy2 = EventHandler.create(
VetoableChangeListener.class, source, "increaseTop");
support.addVetoableChangeListener(proxy);
support.addVetoableChangeListener(proxy2);
support.fireVetoableChange("label", true, false);
assertEquals("called", source.getText());
assertEquals(1, source.getTop());
}
示例5: main
import java.beans.VetoableChangeSupport; //导入方法依赖的package包/类
public static void main(String[] args) throws PropertyVetoException {
TestEquals one = new TestEquals(1);
TestEquals two = new TestEquals(2);
Object source = TestEquals.class;
VetoableChangeSupport vcs = new VetoableChangeSupport(source);
vcs.addVetoableChangeListener(PROPERTY, one);
vcs.addVetoableChangeListener(PROPERTY, two);
PropertyChangeEvent event = new PropertyChangeEvent(source, PROPERTY, one, two);
vcs.fireVetoableChange(event);
test(one, two, 1); // only one check
vcs.fireVetoableChange(PROPERTY, one, two);
test(one, two, 2); // because it invokes fireVetoableChange(PropertyChangeEvent)
}
示例6: fireVetoableChange
import java.beans.VetoableChangeSupport; //导入方法依赖的package包/类
/**
* Support for reporting changes for constrained boolean properties. This method can be called
* before a constrained property will be changed and it will send the appropriate
* PropertyChangeEvent to any registered VetoableChangeListeners.
*
* @param propertyName the property whose value has changed
* @param oldValue the property's previous value
* @param newValue the property's new value
* @throws PropertyVetoException if a constrained property change is rejected
*/
protected final void fireVetoableChange(String propertyName,
boolean oldValue,
boolean newValue)
throws PropertyVetoException {
VetoableChangeSupport aVetoSupport = this.vetoSupport;
if (aVetoSupport == null) {
return;
}
aVetoSupport.fireVetoableChange(propertyName, oldValue, newValue);
}
示例7: fireVetoableChange
import java.beans.VetoableChangeSupport; //导入方法依赖的package包/类
/**
* Support for reporting changes for constrained Object properties. This method can be called
* before a constrained property will be changed and it will send the appropriate
* PropertyChangeEvent to any registered VetoableChangeListeners.
*
* @param propertyName the property whose value has changed
* @param oldValue the property's previous value
* @param newValue the property's new value
* @throws PropertyVetoException if a constrained property change is rejected
*/
protected final void fireVetoableChange(String propertyName,
Object oldValue,
Object newValue)
throws PropertyVetoException {
VetoableChangeSupport aVetoSupport = this.vetoSupport;
if (aVetoSupport == null) {
return;
}
aVetoSupport.fireVetoableChange(propertyName, oldValue, newValue);
}
示例8: testFireVetoableChangeStringbooleanboolean_listener_null
import java.beans.VetoableChangeSupport; //导入方法依赖的package包/类
public void testFireVetoableChangeStringbooleanboolean_listener_null()
throws PropertyVetoException {
MockSource source = new MockSource();
VetoableChangeSupport support = new VetoableChangeSupport(source);
support.addVetoableChangeListener(null);
support.fireVetoableChange("label", true, false);
}
示例9: testFireVetoableChangeStringObjectObject_SameValue_null
import java.beans.VetoableChangeSupport; //导入方法依赖的package包/类
public void testFireVetoableChangeStringObjectObject_SameValue_null()
throws PropertyVetoException {
MockSource source = new MockSource();
VetoableChangeSupport support = new VetoableChangeSupport(source);
VetoableChangeListener proxy = EventHandler.create(
VetoableChangeListener.class, source, "setText");
support.addVetoableChangeListener(proxy);
support.fireVetoableChange("label", null, null);
assertEquals("called", source.getText());
}
示例10: testFireVetoableChangeStringbooleanboolean_listener_null_property
import java.beans.VetoableChangeSupport; //导入方法依赖的package包/类
public void testFireVetoableChangeStringbooleanboolean_listener_null_property()
throws PropertyVetoException {
MockSource source = new MockSource();
VetoableChangeSupport support = new VetoableChangeSupport(source);
EventHandler.create(VetoableChangeListener.class, source, "setText");
support.addVetoableChangeListener("label", null);
support.fireVetoableChange("label", true, false);
}
示例11: testFireVetoableChangeStringintint_property_null
import java.beans.VetoableChangeSupport; //导入方法依赖的package包/类
public void testFireVetoableChangeStringintint_property_null()
throws PropertyVetoException {
MockSource source = new MockSource();
VetoableChangeSupport support = new VetoableChangeSupport(source);
VetoableChangeListener proxy = EventHandler.create(
VetoableChangeListener.class, source, "setText");
support.addVetoableChangeListener(proxy);
support.fireVetoableChange(null, 1, 2);
assertEquals("called", source.getText());
}
示例12: testFireVetoableChangeStringbooleanboolean_Property_null
import java.beans.VetoableChangeSupport; //导入方法依赖的package包/类
public void testFireVetoableChangeStringbooleanboolean_Property_null()
throws PropertyVetoException {
MockSource source = new MockSource();
VetoableChangeSupport support = new VetoableChangeSupport(source);
VetoableChangeListener proxy = EventHandler.create(
VetoableChangeListener.class, source, "label", "source.text");
support.addVetoableChangeListener(proxy);
support.fireVetoableChange(null, true, false);
assertEquals(source.getText(), source.getLabel());
}
示例13: testFireVetoableChangeStringintint
import java.beans.VetoableChangeSupport; //导入方法依赖的package包/类
public void testFireVetoableChangeStringintint()
throws PropertyVetoException {
MockSource source = new MockSource();
VetoableChangeSupport support = new VetoableChangeSupport(source);
VetoableChangeListener proxy = EventHandler.create(
VetoableChangeListener.class, source, "setText");
support.addVetoableChangeListener(proxy);
support.fireVetoableChange("label", 1, 2);
assertEquals("called", source.getText());
}
示例14: testFireVetoableChangeStringintint_listener_SameValue
import java.beans.VetoableChangeSupport; //导入方法依赖的package包/类
public void testFireVetoableChangeStringintint_listener_SameValue()
throws PropertyVetoException {
MockSource source = new MockSource();
VetoableChangeSupport support = new VetoableChangeSupport(source);
VetoableChangeListener proxy = EventHandler.create(
VetoableChangeListener.class, source, "setText");
support.addVetoableChangeListener("label", proxy);
support.fireVetoableChange("label", 1, 1);
assertEquals("text.default", source.getText());
}
示例15: testFireVetoableChangePropertyChangeEvent_listener_null
import java.beans.VetoableChangeSupport; //导入方法依赖的package包/类
public void testFireVetoableChangePropertyChangeEvent_listener_null()
throws PropertyVetoException {
MockSource source = new MockSource();
VetoableChangeSupport support = new VetoableChangeSupport(source);
support.addVetoableChangeListener(null);
PropertyChangeEvent event = new PropertyChangeEvent(source, "label",
"Label: old", "Label: new");
support.fireVetoableChange(event);
}