{
newGroup = newModel.addGroup( oldGroup.getName() );
for ( SignalElement oldElement : oldGroup.getElements() )
{
SignalElement element;
if ( oldElement.isDigitalSignal() )
{
int channelIdx = oldElement.getChannel().getIndex();
if ( channelIdx >= newChannelList.length )
{
// Not in the new data...
continue;
}
Channel newChannel = newChannelList[channelIdx];
seenChannelIdxs.add( Integer.valueOf( channelIdx ) );
element = createDigitalSignalElement( newChannel, newGroup );
element.setSignalAlignment( oldElement.getSignalAlignment() );
element.setSignalHeight( oldElement.getSignalHeight() );
}
else if ( oldElement.isAnalogSignal() )
{
element = createAnalogScopeElement( newGroup );
}
else if ( oldElement.isGroupSummary() )
{
element = createGroupSummaryElement( newGroup );
}
else
{
throw new RuntimeException( "Unknown/unhandled signal element: " + oldElement );
}
element.setColor( oldElement.getColor() );
element.setEnabled( oldElement.isEnabled() );
element.setHeight( oldElement.getHeight() );
element.setLabel( oldElement.getLabel() );
newModel.addSignalElement( newGroup, element );
}
}