public boolean isBound() { return ( this.getBinding() != null && !"".equals( this.getBinding() ) ); }
@Override public String asString() { if ( isBound() ) { return this.getBinding(); } if ( this.value == null ) { return "null"; } return Integer.toString( this.value ); }
public WorkItemIntegerParameterWidget( PortableIntegerParameterDefinition ppd, IBindingProvider bindingProvider, boolean isReadOnly ) { super( ppd, bindingProvider ); this.parameterName.setText( ppd.getName() ); this.parameterEditor.setEnabled( !isReadOnly ); //Setup widget to select a literal value if ( ppd.getValue() != null ) { this.parameterEditor.setText( Integer.toString( ppd.getValue() ) ); } //Setup widget to use bindings Set<String> bindings = bindingProvider.getBindings( ppd.getClassName() ); if ( bindings.size() > 0 ) { lstAvailableBindings.clear(); lstAvailableBindings.addItem( CommonConstants.INSTANCE.Choose() ); lstAvailableBindings.setEnabled( true && !isReadOnly ); lstAvailableBindings.setVisible( true ); int selectedIndex = 0; for ( String binding : bindings ) { lstAvailableBindings.addItem( binding ); if ( binding.equals( ppd.getBinding() ) ) { selectedIndex = lstAvailableBindings.getItemCount() - 1; } } lstAvailableBindings.setSelectedIndex( selectedIndex ); parameterEditor.setEnabled( selectedIndex == 0 && !isReadOnly ); } }
mp3.getValue() ); assertEquals( "$i", mp3.getBinding() );
clone = new PortableIntegerParameterDefinition(); clone.setName( ppd.getName() ); ( (PortableIntegerParameterDefinition) clone ).setBinding( ( (PortableIntegerParameterDefinition) ppd ).getBinding() ); ( (PortableIntegerParameterDefinition) clone ).setValue( ( (PortableIntegerParameterDefinition) ppd ).getValue() ); return clone;