/** * Trims the channels to the same number as the captured data, using the * channel information of the given data set as template. * * @param aLabels * the channel labels to merge, can be <code>null</code>. */ final void mergeChannelLabels( final List<String> aLabels ) { if ( aLabels == null ) { return; } int channelCount = Math.min( aLabels.size(), this.channels.length ); for ( int i = 0; i < channelCount; i++ ) { Channel channel = this.channels[i]; // Channels might be null, especially when importing projects from older // versions of the client... if ( channel != null ) { channel.setLabel( aLabels.get( i ) ); } } }
/** * Sets the channel label. * * @param aChannelIdx * the index of the channel to set the label for, >= 0 && < 32; * @param aLabel * the label to set, may be <code>null</code>. */ public void setChannelLabel( final int aChannelIdx, final String aLabel ) { if ( ( aChannelIdx < 0 ) || ( aChannelIdx > ( Ols.MAX_CHANNELS - 1 ) ) ) { throw new IllegalArgumentException( "Invalid channel index: " + aChannelIdx + "! Should be between 0 and " + Ols.MAX_CHANNELS ); } getAllChannels()[aChannelIdx].setLabel( aLabel ); }
/** * Sets all channel labels directly. * * @param aLabels * the array of labels to set, cannot be <code>null</code>. */ public void setChannelLabels( final String[] aLabels ) { if ( aLabels.length != Ols.MAX_CHANNELS ) { throw new IllegalArgumentException( "Invalid channel labels! Should have exact " + Ols.MAX_CHANNELS + " items!" ); } for ( int i = 0; i < aLabels.length; i++ ) { getAllChannels()[i].setLabel( aLabels[i] ); } }
/** * Returns the label of this signal element. * * @param aLabel * the label to set, may be <code>null</code>. */ public final void setLabel( final String aLabel ) { if ( this.channel != null ) { this.channel.setLabel( aLabel ); } else if ( this.group != null ) { if ( isAnalogSignal() ) { this.group.setAnalogSignalLabel( aLabel ); } else if ( isGroupSummary() ) { this.group.setGroupSummaryLabel( aLabel ); } else { this.group.setName( aLabel ); } } }