@Override
public void propertyChange(PropertyChangeEvent evt) {
if (Container.PROPERTY_CHILDREN.equals(evt.getPropertyName())){
if (evt.getNewValue() != null)
// new child
addChild(createChild(evt.getNewValue()), ((IndexedPropertyChangeEvent)evt).getIndex());
else {
// remove child
EditPart part = (EditPart) getViewer().getEditPartRegistry()
.get(evt.getOldValue());
if (part != null) {
removeChild(part);
}
}
refreshVisuals();
} else {
super.propertyChange(evt);
}
}
java类java.beans.IndexedPropertyChangeEvent的实例源码
TitaniumContainerTreeEditPart.java 文件源码
项目:ForgedUI-Eclipse
阅读 15
收藏 0
点赞 0
评论 0
MReport.java 文件源码
项目:PDFReporter-Studio
阅读 27
收藏 0
点赞 0
评论 0
/**
* Handle the change of the position of a band
*
* @param evt the event that changed the band position
*/
private void handleChangeOrder(PropertyChangeEvent evt) {
if (evt instanceof IndexedPropertyChangeEvent && evt.getNewValue() instanceof Integer) {
JRDesignSection source = (JRDesignSection) evt.getSource();
int newInd = ((IndexedPropertyChangeEvent) evt).getIndex();
JRBand b = source.getBandsList().get(newInd);
MBand mb = null;
for (INode n : getChildren()) {
if (n.getValue() == b) {
mb = (MBand) n;
break;
}
}
if (mb != null) {
newInd = getChildren().indexOf(mb) + (newInd - (Integer) evt.getOldValue());
getChildren().remove(mb);
getChildren().add(newInd, mb);
}
}
}
SelectedPlugin.java 文件源码
项目:WS-Attacker
阅读 17
收藏 0
点赞 0
评论 0
private void handleReplacedOption( int index, IndexedPropertyChangeEvent ipce )
{
// single change
try
{
optionPanel.remove( index );
AbstractOption option = (AbstractOption) ipce.getNewValue();
LOG.debug( "Created Option " + option.getName() );
OptionGUI optionGUI = createOption( option );
optionPanel.add( optionGUI, index );
}
catch ( Exception e )
{
LOG.warn( e );
}
}
ContainedListTest.java 文件源码
项目:modelgen
阅读 15
收藏 0
点赞 0
评论 0
@Test
public void testAdd() throws Exception {
Parent parent = new Parent();
Child child = new Child();
parent.children().getChangeSupport()
.addPropertyChangeListener(new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
assertTrue(evt instanceof IndexedPropertyChangeEvent);
IndexedPropertyChangeEvent iEvt = (IndexedPropertyChangeEvent) evt;
assertEquals(0, iEvt.getIndex());
assertNull(iEvt.getOldValue());
assertSame(child, iEvt.getNewValue());
assertSame(parent, child.getParent());
throw new RuntimeException("All is well!");
}
});
try {
parent.children().add(child);
fail("Property change listener not notified");
} catch (RuntimeException e) {
assertEquals("All is well!", e.getMessage());
}
}
ContainedListTest.java 文件源码
项目:modelgen
阅读 18
收藏 0
点赞 0
评论 0
@Test
public void testClear() {
Parent parent = new Parent();
Child child = new Child();
parent.children().add(child);
parent.children().getChangeSupport()
.addPropertyChangeListener(new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
assertTrue(evt instanceof IndexedPropertyChangeEvent);
IndexedPropertyChangeEvent iEvt = (IndexedPropertyChangeEvent) evt;
assertEquals(-1, iEvt.getIndex());
assertNull(iEvt.getNewValue());
assertNull(iEvt.getOldValue());
throw new RuntimeException("All is well!");
}
});
try {
parent.children().clear();
fail("Property change listener not notified");
} catch (RuntimeException e) {
assertEquals("All is well!", e.getMessage());
assertEquals(0, parent.children().size());
}
}
SimpleListCommentsFragment.java 文件源码
项目:CoolTechnologies
阅读 17
收藏 0
点赞 0
评论 0
@Override
public void propertyChange(PropertyChangeEvent event) {
if (mViewHolder == null) {
return;
}
switch (event.getPropertyName()) {
case "comments":
if (!(event instanceof IndexedPropertyChangeEvent)) {
throw new UnsupportedOperationException();
}
IndexedPropertyChangeEvent indexedEvent = (IndexedPropertyChangeEvent) event;
CommentView.Holder commentVH = mViewHolder.mComments[indexedEvent.getIndex()];
Object newValue = indexedEvent.getNewValue();
commentVH.updateData((Comment) newValue);
commentVH.mRootView.setVisibility(newValue != null ? View.VISIBLE : View.GONE);
break;
default:
throw new IllegalArgumentException(
"Unknow PropertyName:" + event.getPropertyName());
}
}
Test4353056.java 文件源码
项目:jdk8u-jdk
阅读 22
收藏 0
点赞 0
评论 0
public void propertyChange(PropertyChangeEvent event) {
Object value = event.getNewValue();
if (value.equals(event.getOldValue())) {
throw new Error("new value is equal to old one");
}
if (!this.name.equals(event.getPropertyName())) {
throw new Error("unexpected property name");
} else if (this.name.equals(COLOR)) {
if (!value.equals(this.color)) {
throw new Error("unexpected object value");
}
} else if (this.name.equals(BOOLEAN)) {
if (!value.equals(Boolean.valueOf(this.flag))) {
throw new Error("unexpected boolean value");
}
} else if (this.name.equals(INTEGER)) {
if (!value.equals(Integer.valueOf(this.value))) {
throw new Error("unexpected integer value");
}
} else {
throw new Error("unexpected property name");
}
if (event instanceof IndexedPropertyChangeEvent) {
IndexedPropertyChangeEvent ipce = (IndexedPropertyChangeEvent) event;
if (this.index != ipce.getIndex()) {
throw new Error("unexpected property index");
}
} else {
throw new Error("unexpected event type");
}
System.out.println(this.name + " at " + this.index + " is " + value);
this.name = null;
this.index = -1;
}
Test4353056.java 文件源码
项目:openjdk-jdk10
阅读 19
收藏 0
点赞 0
评论 0
public void propertyChange(PropertyChangeEvent event) {
Object value = event.getNewValue();
if (value.equals(event.getOldValue())) {
throw new Error("new value is equal to old one");
}
if (!this.name.equals(event.getPropertyName())) {
throw new Error("unexpected property name");
} else if (this.name.equals(COLOR)) {
if (!value.equals(this.color)) {
throw new Error("unexpected object value");
}
} else if (this.name.equals(BOOLEAN)) {
if (!value.equals(Boolean.valueOf(this.flag))) {
throw new Error("unexpected boolean value");
}
} else if (this.name.equals(INTEGER)) {
if (!value.equals(Integer.valueOf(this.value))) {
throw new Error("unexpected integer value");
}
} else {
throw new Error("unexpected property name");
}
if (event instanceof IndexedPropertyChangeEvent) {
IndexedPropertyChangeEvent ipce = (IndexedPropertyChangeEvent) event;
if (this.index != ipce.getIndex()) {
throw new Error("unexpected property index");
}
} else {
throw new Error("unexpected event type");
}
System.out.println(this.name + " at " + this.index + " is " + value);
this.name = null;
this.index = -1;
}
Test4353056.java 文件源码
项目:openjdk9
阅读 20
收藏 0
点赞 0
评论 0
public void propertyChange(PropertyChangeEvent event) {
Object value = event.getNewValue();
if (value.equals(event.getOldValue())) {
throw new Error("new value is equal to old one");
}
if (!this.name.equals(event.getPropertyName())) {
throw new Error("unexpected property name");
} else if (this.name.equals(COLOR)) {
if (!value.equals(this.color)) {
throw new Error("unexpected object value");
}
} else if (this.name.equals(BOOLEAN)) {
if (!value.equals(Boolean.valueOf(this.flag))) {
throw new Error("unexpected boolean value");
}
} else if (this.name.equals(INTEGER)) {
if (!value.equals(Integer.valueOf(this.value))) {
throw new Error("unexpected integer value");
}
} else {
throw new Error("unexpected property name");
}
if (event instanceof IndexedPropertyChangeEvent) {
IndexedPropertyChangeEvent ipce = (IndexedPropertyChangeEvent) event;
if (this.index != ipce.getIndex()) {
throw new Error("unexpected property index");
}
} else {
throw new Error("unexpected event type");
}
System.out.println(this.name + " at " + this.index + " is " + value);
this.name = null;
this.index = -1;
}
Test4353056.java 文件源码
项目:jdk8u_jdk
阅读 21
收藏 0
点赞 0
评论 0
public void propertyChange(PropertyChangeEvent event) {
Object value = event.getNewValue();
if (value.equals(event.getOldValue())) {
throw new Error("new value is equal to old one");
}
if (!this.name.equals(event.getPropertyName())) {
throw new Error("unexpected property name");
} else if (this.name.equals(COLOR)) {
if (!value.equals(this.color)) {
throw new Error("unexpected object value");
}
} else if (this.name.equals(BOOLEAN)) {
if (!value.equals(Boolean.valueOf(this.flag))) {
throw new Error("unexpected boolean value");
}
} else if (this.name.equals(INTEGER)) {
if (!value.equals(Integer.valueOf(this.value))) {
throw new Error("unexpected integer value");
}
} else {
throw new Error("unexpected property name");
}
if (event instanceof IndexedPropertyChangeEvent) {
IndexedPropertyChangeEvent ipce = (IndexedPropertyChangeEvent) event;
if (this.index != ipce.getIndex()) {
throw new Error("unexpected property index");
}
} else {
throw new Error("unexpected event type");
}
System.out.println(this.name + " at " + this.index + " is " + value);
this.name = null;
this.index = -1;
}
Test4353056.java 文件源码
项目:lookaside_java-1.8.0-openjdk
阅读 21
收藏 0
点赞 0
评论 0
public void propertyChange(PropertyChangeEvent event) {
Object value = event.getNewValue();
if (value.equals(event.getOldValue())) {
throw new Error("new value is equal to old one");
}
if (!this.name.equals(event.getPropertyName())) {
throw new Error("unexpected property name");
} else if (this.name.equals(COLOR)) {
if (!value.equals(this.color)) {
throw new Error("unexpected object value");
}
} else if (this.name.equals(BOOLEAN)) {
if (!value.equals(Boolean.valueOf(this.flag))) {
throw new Error("unexpected boolean value");
}
} else if (this.name.equals(INTEGER)) {
if (!value.equals(Integer.valueOf(this.value))) {
throw new Error("unexpected integer value");
}
} else {
throw new Error("unexpected property name");
}
if (event instanceof IndexedPropertyChangeEvent) {
IndexedPropertyChangeEvent ipce = (IndexedPropertyChangeEvent) event;
if (this.index != ipce.getIndex()) {
throw new Error("unexpected property index");
}
} else {
throw new Error("unexpected event type");
}
System.out.println(this.name + " at " + this.index + " is " + value);
this.name = null;
this.index = -1;
}
APropertyChangeSupported.java 文件源码
项目:invesdwin-util
阅读 14
收藏 0
点赞 0
评论 0
/**
* This is the same as in the original java beans implementation with the exception that changes from null to null
* are not reported as property change events!
*
* @see java.beans.PropertyChangeSupport#fireIndexedPropertyChange(java.lang.String, int, java.lang.Object,
* java.lang.Object)
*/
public void fireIndexedPropertyChange(final String propertyName, final int index, final Object oldValue,
final Object newValue) {
final PropertyChangeSupport ref = lazyGetPropertyChangeSupport(false);
if (ref != null && (!Objects.equalsProperty(oldValue, newValue)
|| !equalsPropertyChangeListeners(oldValue, newValue))) {
final IndexedPropertyChangeEvent event = new IndexedPropertyChangeEvent(this, propertyName, oldValue,
newValue, index);
fireEvent(ref, propertyName, event);
}
}
SelectedPlugin.java 文件源码
项目:WS-Attacker
阅读 19
收藏 0
点赞 0
评论 0
@Override
public void propertyChange( PropertyChangeEvent pce )
{
String propertyName = pce.getPropertyName();
if ( SelectedPluginController.PROP_SELECTEDPLUGIN.equals( propertyName ) )
{
List<AbstractOption> newOptions = ( (AbstractPlugin) pce.getNewValue() ).getPluginOptions().getOptions();
removeAndUnbindAllComponents();
handleMultipleNewOptions( 0, Collections.<AbstractOption> emptyList(), newOptions );
adjustingOptionPanelSize();
handleOptionContainerChangeListener( pce );
}
else if ( pce instanceof IndexedPropertyChangeEvent
&& PluginOptionContainer.PROP_OPTIONS.equals( pce.getPropertyName() ) )
{
IndexedPropertyChangeEvent ipce = (IndexedPropertyChangeEvent) pce;
int index = ipce.getIndex();
if ( ipce.getNewValue() instanceof List )
{
// multiple changes
List<AbstractOption> oldValue = (List<AbstractOption>) ipce.getOldValue();
List<AbstractOption> newValue = (List<AbstractOption>) ipce.getNewValue();
handleMultipleNewOptions( index, oldValue, newValue );
}
else if ( ipce.getNewValue() instanceof AbstractOption )
{
handleReplacedOption( index, ipce );
}
}
}
Test4353056.java 文件源码
项目:infobip-open-jdk-8
阅读 20
收藏 0
点赞 0
评论 0
public void propertyChange(PropertyChangeEvent event) {
Object value = event.getNewValue();
if (value.equals(event.getOldValue())) {
throw new Error("new value is equal to old one");
}
if (!this.name.equals(event.getPropertyName())) {
throw new Error("unexpected property name");
} else if (this.name.equals(COLOR)) {
if (!value.equals(this.color)) {
throw new Error("unexpected object value");
}
} else if (this.name.equals(BOOLEAN)) {
if (!value.equals(Boolean.valueOf(this.flag))) {
throw new Error("unexpected boolean value");
}
} else if (this.name.equals(INTEGER)) {
if (!value.equals(Integer.valueOf(this.value))) {
throw new Error("unexpected integer value");
}
} else {
throw new Error("unexpected property name");
}
if (event instanceof IndexedPropertyChangeEvent) {
IndexedPropertyChangeEvent ipce = (IndexedPropertyChangeEvent) event;
if (this.index != ipce.getIndex()) {
throw new Error("unexpected property index");
}
} else {
throw new Error("unexpected event type");
}
System.out.println(this.name + " at " + this.index + " is " + value);
this.name = null;
this.index = -1;
}
Test4353056.java 文件源码
项目:jdk8u-dev-jdk
阅读 22
收藏 0
点赞 0
评论 0
public void propertyChange(PropertyChangeEvent event) {
Object value = event.getNewValue();
if (value.equals(event.getOldValue())) {
throw new Error("new value is equal to old one");
}
if (!this.name.equals(event.getPropertyName())) {
throw new Error("unexpected property name");
} else if (this.name.equals(COLOR)) {
if (!value.equals(this.color)) {
throw new Error("unexpected object value");
}
} else if (this.name.equals(BOOLEAN)) {
if (!value.equals(Boolean.valueOf(this.flag))) {
throw new Error("unexpected boolean value");
}
} else if (this.name.equals(INTEGER)) {
if (!value.equals(Integer.valueOf(this.value))) {
throw new Error("unexpected integer value");
}
} else {
throw new Error("unexpected property name");
}
if (event instanceof IndexedPropertyChangeEvent) {
IndexedPropertyChangeEvent ipce = (IndexedPropertyChangeEvent) event;
if (this.index != ipce.getIndex()) {
throw new Error("unexpected property index");
}
} else {
throw new Error("unexpected event type");
}
System.out.println(this.name + " at " + this.index + " is " + value);
this.name = null;
this.index = -1;
}
ContainedListTest.java 文件源码
项目:modelgen
阅读 20
收藏 0
点赞 0
评论 0
@Test
public void testRemove() throws Exception {
Parent parent = new Parent();
Child child = new Child();
parent.children().add(child);
parent.children().getChangeSupport()
.addPropertyChangeListener(new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
assertTrue(evt instanceof IndexedPropertyChangeEvent);
IndexedPropertyChangeEvent iEvt = (IndexedPropertyChangeEvent) evt;
assertEquals(0, iEvt.getIndex());
assertNull(iEvt.getNewValue());
assertSame(child, iEvt.getOldValue());
assertSame(null, child.getParent());
throw new RuntimeException("All is well!");
}
});
try {
parent.children().remove(child);
fail("Property change listener not notified");
} catch (RuntimeException e) {
assertEquals("All is well!", e.getMessage());
assertEquals(0, parent.children().size());
}
}
ContainedListTest.java 文件源码
项目:modelgen
阅读 20
收藏 0
点赞 0
评论 0
@Test
public void testRemove0() throws Exception {
Parent parent = new Parent();
Child child = new Child();
parent.children().add(child);
parent.children().getChangeSupport()
.addPropertyChangeListener(new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
assertTrue(evt instanceof IndexedPropertyChangeEvent);
IndexedPropertyChangeEvent iEvt = (IndexedPropertyChangeEvent) evt;
assertEquals(0, iEvt.getIndex());
assertNull(iEvt.getNewValue());
assertSame(child, iEvt.getOldValue());
assertSame(null, child.getParent());
throw new RuntimeException("All is well!");
}
});
try {
parent.children().remove(0);
fail("Property change listener not notified");
} catch (RuntimeException e) {
assertEquals("All is well!", e.getMessage());
assertEquals(0, parent.children().size());
}
}
ContainedListTest.java 文件源码
项目:modelgen
阅读 18
收藏 0
点赞 0
评论 0
@Test
public void testRemoveAll() {
Parent parent = new Parent();
Child child = new Child();
parent.children().add(child);
List<Object> removes = new ArrayList<Object>();
removes.add(child);
removes.add("decoy");
parent.children().getChangeSupport()
.addPropertyChangeListener(new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
assertTrue(evt instanceof IndexedPropertyChangeEvent);
IndexedPropertyChangeEvent iEvt = (IndexedPropertyChangeEvent) evt;
assertEquals(-1, iEvt.getIndex());
assertNull(iEvt.getNewValue());
assertNull(iEvt.getOldValue());
throw new RuntimeException("All is well!");
}
});
try {
parent.children().removeAll(removes);
fail("Property change listener not notified");
} catch (RuntimeException e) {
assertEquals("All is well!", e.getMessage());
assertEquals(0, parent.children().size());
}
}
ContainedListTest.java 文件源码
项目:modelgen
阅读 17
收藏 0
点赞 0
评论 0
@Test
public void testRetainAll() {
Parent parent = new Parent();
Child child = new Child();
parent.children().add(child);
List<Object> retainables = new ArrayList<Object>();
retainables.add(child);
retainables.add("decoy");
parent.children().getChangeSupport()
.addPropertyChangeListener(new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
assertTrue(evt instanceof IndexedPropertyChangeEvent);
IndexedPropertyChangeEvent iEvt = (IndexedPropertyChangeEvent) evt;
assertEquals(-1, iEvt.getIndex());
assertNull(iEvt.getNewValue());
assertNull(iEvt.getOldValue());
throw new RuntimeException("All is well!");
}
});
try {
boolean changed = parent.children().retainAll(retainables); // nop
assertFalse(changed);
retainables.remove(child);
parent.children().retainAll(retainables); // child is removed =
// event!
fail("Property change listener not notified");
} catch (RuntimeException e) {
assertEquals("All is well!", e.getMessage());
assertEquals(0, parent.children().size());
}
}
ContainedListTest.java 文件源码
项目:modelgen
阅读 14
收藏 0
点赞 0
评论 0
@Test
public void testSet() {
Parent parent = new Parent();
Child child1 = new Child(), child2 = new Child(), child3 = new Child();
parent.children().add(child1);
parent.children().add(child2);
parent.children().getChangeSupport()
.addPropertyChangeListener(new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
assertTrue(evt instanceof IndexedPropertyChangeEvent);
IndexedPropertyChangeEvent iEvt = (IndexedPropertyChangeEvent) evt;
assertEquals(1, iEvt.getIndex());
assertEquals(child3, iEvt.getNewValue());
assertEquals(child2, iEvt.getOldValue());
throw new RuntimeException("All is well!");
}
});
try {
parent.children().set(1, child3);
fail("Property change listener not notified");
} catch (RuntimeException e) {
assertEquals("All is well!", e.getMessage());
assertEquals(2, parent.children().size());
assertEquals(child1, parent.children().get(0));
assertEquals(child3, parent.children().get(1));
assertSame(parent, child3.getParent());
}
}
NotifyingListIteratorTest.java 文件源码
项目:modelgen
阅读 14
收藏 0
点赞 0
评论 0
@Test
public void testSet() {
pcs.addPropertyChangeListener(new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
assertTrue(evt instanceof IndexedPropertyChangeEvent);
IndexedPropertyChangeEvent iEvt = (IndexedPropertyChangeEvent) evt;
assertEquals(1, iEvt.getIndex());
assertEquals("b", iEvt.getOldValue());
assertEquals("B", iEvt.getNewValue());
throw new RuntimeException("OK");
}
});
assertEquals("a", iter.next());
assertEquals("b", iter.next());
try {
iter.set("B");
fail("Property change event not triggered");
} catch (Exception e) {
assertEquals("OK", e.getMessage());
assertEquals(4, backEnd.size());
assertEquals("B", backEnd.get(1));
}
assertEquals("c", iter.next());
assertEquals("d", iter.next());
assertFalse(iter.hasNext());
}
NotifyingListIteratorTest.java 文件源码
项目:modelgen
阅读 18
收藏 0
点赞 0
评论 0
@Test
public void testAdd() {
pcs.addPropertyChangeListener(new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
assertTrue(evt instanceof IndexedPropertyChangeEvent);
IndexedPropertyChangeEvent iEvt = (IndexedPropertyChangeEvent) evt;
assertEquals(2, iEvt.getIndex());
assertNull(iEvt.getOldValue());
assertEquals("b+0.5", iEvt.getNewValue());
throw new RuntimeException("OK");
}
});
assertEquals("a", iter.next());
assertEquals("b", iter.next());
try {
iter.add("b+0.5");
fail("Property change event not triggered");
} catch (Exception e) {
assertEquals("OK", e.getMessage());
assertEquals(5, backEnd.size());
assertEquals("b+0.5", backEnd.get(2));
}
assertEquals("c", iter.next());
assertEquals("d", iter.next());
assertFalse(iter.hasNext());
}
NotifyingIteratorTest.java 文件源码
项目:modelgen
阅读 15
收藏 0
点赞 0
评论 0
@Test
public void testRemove() {
pcs.addPropertyChangeListener(new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
assertTrue(evt instanceof IndexedPropertyChangeEvent);
IndexedPropertyChangeEvent iEvt = (IndexedPropertyChangeEvent) evt;
assertEquals(1, iEvt.getIndex());
assertNull(iEvt.getNewValue());
assertEquals("b", iEvt.getOldValue());
throw new RuntimeException("OK");
}
});
assertEquals("a", iter.next());
assertEquals("b", iter.next());
try {
iter.remove();
fail("Property change event not triggered");
} catch (Exception e) {
assertEquals("OK", e.getMessage());
assertEquals(3, backEnd.size());
assertEquals("c", backEnd.get(1));
}
assertEquals("c", iter.next());
assertEquals("d", iter.next());
assertFalse(iter.hasNext());
}
Test4353056.java 文件源码
项目:jdk7-jdk
阅读 21
收藏 0
点赞 0
评论 0
public void propertyChange(PropertyChangeEvent event) {
Object value = event.getNewValue();
if (value.equals(event.getOldValue())) {
throw new Error("new value is equal to old one");
}
if (!this.name.equals(event.getPropertyName())) {
throw new Error("unexpected property name");
} else if (this.name.equals(COLOR)) {
if (!value.equals(this.color)) {
throw new Error("unexpected object value");
}
} else if (this.name.equals(BOOLEAN)) {
if (!value.equals(Boolean.valueOf(this.flag))) {
throw new Error("unexpected boolean value");
}
} else if (this.name.equals(INTEGER)) {
if (!value.equals(Integer.valueOf(this.value))) {
throw new Error("unexpected integer value");
}
} else {
throw new Error("unexpected property name");
}
if (event instanceof IndexedPropertyChangeEvent) {
IndexedPropertyChangeEvent ipce = (IndexedPropertyChangeEvent) event;
if (this.index != ipce.getIndex()) {
throw new Error("unexpected property index");
}
} else {
throw new Error("unexpected event type");
}
System.out.println(this.name + " at " + this.index + " is " + value);
this.name = null;
this.index = -1;
}
Test4353056.java 文件源码
项目:openjdk-source-code-learn
阅读 19
收藏 0
点赞 0
评论 0
public void propertyChange(PropertyChangeEvent event) {
Object value = event.getNewValue();
if (value.equals(event.getOldValue())) {
throw new Error("new value is equal to old one");
}
if (!this.name.equals(event.getPropertyName())) {
throw new Error("unexpected property name");
} else if (this.name.equals(COLOR)) {
if (!value.equals(this.color)) {
throw new Error("unexpected object value");
}
} else if (this.name.equals(BOOLEAN)) {
if (!value.equals(Boolean.valueOf(this.flag))) {
throw new Error("unexpected boolean value");
}
} else if (this.name.equals(INTEGER)) {
if (!value.equals(Integer.valueOf(this.value))) {
throw new Error("unexpected integer value");
}
} else {
throw new Error("unexpected property name");
}
if (event instanceof IndexedPropertyChangeEvent) {
IndexedPropertyChangeEvent ipce = (IndexedPropertyChangeEvent) event;
if (this.index != ipce.getIndex()) {
throw new Error("unexpected property index");
}
} else {
throw new Error("unexpected event type");
}
System.out.println(this.name + " at " + this.index + " is " + value);
this.name = null;
this.index = -1;
}
Test4353056.java 文件源码
项目:OLD-OpenJDK8
阅读 21
收藏 0
点赞 0
评论 0
public void propertyChange(PropertyChangeEvent event) {
Object value = event.getNewValue();
if (value.equals(event.getOldValue())) {
throw new Error("new value is equal to old one");
}
if (!this.name.equals(event.getPropertyName())) {
throw new Error("unexpected property name");
} else if (this.name.equals(COLOR)) {
if (!value.equals(this.color)) {
throw new Error("unexpected object value");
}
} else if (this.name.equals(BOOLEAN)) {
if (!value.equals(Boolean.valueOf(this.flag))) {
throw new Error("unexpected boolean value");
}
} else if (this.name.equals(INTEGER)) {
if (!value.equals(Integer.valueOf(this.value))) {
throw new Error("unexpected integer value");
}
} else {
throw new Error("unexpected property name");
}
if (event instanceof IndexedPropertyChangeEvent) {
IndexedPropertyChangeEvent ipce = (IndexedPropertyChangeEvent) event;
if (this.index != ipce.getIndex()) {
throw new Error("unexpected property index");
}
} else {
throw new Error("unexpected event type");
}
System.out.println(this.name + " at " + this.index + " is " + value);
this.name = null;
this.index = -1;
}
PropertyChangeSupportTest.java 文件源码
项目:cn1
阅读 27
收藏 0
点赞 0
评论 0
public void testFireIndexedPropertyChange() {
final Object src = new Object();
PropertyChangeSupport pcs = new PropertyChangeSupport(src);
pcs.addPropertyChangeListener(new PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent evt) {
assertEquals(src, evt.getSource());
assertEquals(0, ((IndexedPropertyChangeEvent)evt).getIndex());
assertEquals("one", evt.getOldValue());
assertEquals("two", evt.getNewValue());
}
});
pcs.fireIndexedPropertyChange("foo", 0, "one", "two");
}
Test4353056.java 文件源码
项目:JAVA_UNIT
阅读 24
收藏 0
点赞 0
评论 0
public void propertyChange(PropertyChangeEvent event) {
Object value = event.getNewValue();
if (value.equals(event.getOldValue())) {
throw new Error("new value is equal to old one");
}
if (!this.name.equals(event.getPropertyName())) {
throw new Error("unexpected property name");
} else if (this.name.equals(COLOR)) {
if (!value.equals(this.color)) {
throw new Error("unexpected object value");
}
} else if (this.name.equals(BOOLEAN)) {
if (!value.equals(Boolean.valueOf(this.flag))) {
throw new Error("unexpected boolean value");
}
} else if (this.name.equals(INTEGER)) {
if (!value.equals(Integer.valueOf(this.value))) {
throw new Error("unexpected integer value");
}
} else {
throw new Error("unexpected property name");
}
if (event instanceof IndexedPropertyChangeEvent) {
IndexedPropertyChangeEvent ipce = (IndexedPropertyChangeEvent) event;
if (this.index != ipce.getIndex()) {
throw new Error("unexpected property index");
}
} else {
throw new Error("unexpected event type");
}
System.out.println(this.name + " at " + this.index + " is " + value);
this.name = null;
this.index = -1;
}
Test4353056.java 文件源码
项目:openjdk-jdk7u-jdk
阅读 27
收藏 0
点赞 0
评论 0
public void propertyChange(PropertyChangeEvent event) {
Object value = event.getNewValue();
if (value.equals(event.getOldValue())) {
throw new Error("new value is equal to old one");
}
if (!this.name.equals(event.getPropertyName())) {
throw new Error("unexpected property name");
} else if (this.name.equals(COLOR)) {
if (!value.equals(this.color)) {
throw new Error("unexpected object value");
}
} else if (this.name.equals(BOOLEAN)) {
if (!value.equals(Boolean.valueOf(this.flag))) {
throw new Error("unexpected boolean value");
}
} else if (this.name.equals(INTEGER)) {
if (!value.equals(Integer.valueOf(this.value))) {
throw new Error("unexpected integer value");
}
} else {
throw new Error("unexpected property name");
}
if (event instanceof IndexedPropertyChangeEvent) {
IndexedPropertyChangeEvent ipce = (IndexedPropertyChangeEvent) event;
if (this.index != ipce.getIndex()) {
throw new Error("unexpected property index");
}
} else {
throw new Error("unexpected event type");
}
System.out.println(this.name + " at " + this.index + " is " + value);
this.name = null;
this.index = -1;
}
PropertyChangeSupportTest.java 文件源码
项目:freeVM
阅读 20
收藏 0
点赞 0
评论 0
public void testFireIndexedPropertyChange() {
final Object src = new Object();
PropertyChangeSupport pcs = new PropertyChangeSupport(src);
pcs.addPropertyChangeListener(new PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent evt) {
assertEquals(src, evt.getSource());
assertEquals(0, ((IndexedPropertyChangeEvent)evt).getIndex());
assertEquals("one", evt.getOldValue());
assertEquals("two", evt.getNewValue());
}
});
pcs.fireIndexedPropertyChange("foo", 0, "one", "two");
}