Java 类java.beans.IndexedPropertyChangeEvent 实例源码

项目:ForgedUI-Eclipse    文件:TitaniumContainerTreeEditPart.java   
@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);
    }
}
项目:PDFReporter-Studio    文件:MReport.java   
/**
 * 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);
        }
    }
}
项目:WS-Attacker    文件:SelectedPlugin.java   
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 );
    }
}
项目:modelgen    文件:ContainedListTest.java   
@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());
    }
}
项目:modelgen    文件:ContainedListTest.java   
@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());
    }
}
项目:CoolTechnologies    文件:SimpleListCommentsFragment.java   
@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());
    }
}
项目:jdk8u-jdk    文件:Test4353056.java   
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;
}
项目:openjdk-jdk10    文件:Test4353056.java   
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;
}
项目:openjdk9    文件:Test4353056.java   
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;
}
项目:jdk8u_jdk    文件:Test4353056.java   
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;
}
项目:lookaside_java-1.8.0-openjdk    文件:Test4353056.java   
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;
}
项目:invesdwin-util    文件:APropertyChangeSupported.java   
/**
 * 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);
    }
}
项目:WS-Attacker    文件:SelectedPlugin.java   
@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 );
        }
    }
}
项目:infobip-open-jdk-8    文件:Test4353056.java   
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;
}
项目:jdk8u-dev-jdk    文件:Test4353056.java   
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;
}
项目:modelgen    文件:ContainedListTest.java   
@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());
    }
}
项目:modelgen    文件:ContainedListTest.java   
@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());
    }
}
项目:modelgen    文件:ContainedListTest.java   
@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());
    }
}
项目:modelgen    文件:ContainedListTest.java   
@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());
    }
}
项目:modelgen    文件:ContainedListTest.java   
@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());
    }
}
项目:modelgen    文件:NotifyingListIteratorTest.java   
@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());
}
项目:modelgen    文件:NotifyingListIteratorTest.java   
@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());
}
项目:modelgen    文件:NotifyingIteratorTest.java   
@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());
}
项目:jdk7-jdk    文件:Test4353056.java   
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;
}
项目:openjdk-source-code-learn    文件:Test4353056.java   
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;
}
项目:OLD-OpenJDK8    文件:Test4353056.java   
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;
}
项目:cn1    文件:PropertyChangeSupportTest.java   
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");
}
项目:JAVA_UNIT    文件:Test4353056.java   
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;
}
项目:openjdk-jdk7u-jdk    文件:Test4353056.java   
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;
}
项目:freeVM    文件:PropertyChangeSupportTest.java   
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");
}
项目:freeVM    文件:PropertyChangeSupportTest.java   
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");
}
项目:openjdk-icedtea7    文件:Test4353056.java   
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;
}
项目:metasfresh    文件:DelayedPropertyChangeSupport.java   
public void fireIndexedPropertyChange(final String propertyName, final int index, final Object oldValue, final Object newValue)
{
    final IndexedPropertyChangeEvent event = new IndexedPropertyChangeEvent(source, propertyName, oldValue, newValue, index);
    firePropertyChange(event);
}
项目:metasfresh    文件:DelayedPropertyChangeSupport.java   
public void fireIndexedPropertyChange(final String propertyName, final int index, final int oldValue, final int newValue)
{
    final IndexedPropertyChangeEvent event = new IndexedPropertyChangeEvent(source, propertyName, oldValue, newValue, index);
    firePropertyChange(event);
}
项目:metasfresh    文件:DelayedPropertyChangeSupport.java   
public void fireIndexedPropertyChange(final String propertyName, final int index, final boolean oldValue, final boolean newValue)
{
    final IndexedPropertyChangeEvent event = new IndexedPropertyChangeEvent(source, propertyName, oldValue, newValue, index);
    firePropertyChange(event);
}
项目:Environment    文件:ExplorerNodeChildren.java   
private void addIndexedPropertyChange(String name, int index, Object oldValue, Object newValue){
    synchronized (eventsLock) {
        IndexedPropertyChangeEvent evt = new IndexedPropertyChangeEvent(this, name, oldValue, newValue, index);
        events.push(evt);
    }
}