FilterTable: how to get generateFilter() to see OptionsGroup

I’m upgrading FilteringTable from 0.5.3 to 0.8.6. I’ve implemented a FilterGenerator. The Model Offering ID should be a custom OptionsGroupPopup, called like this:

@Override
	public AbstractField getCustomFilterComponent( Object propertyId ) {
		if ( LinePlanItem.MODEL_OFFERING_ID.equals( propertyId ) ) {
			Collections.sort( moidList );
			OptionGroupPopup popup = 
					new OptionGroupPopup( propertyId, moidList );

			return popup;
		}

		return null;
	}

When we get back to the generateFilter() method, I’m expecting a value with comma separated terms, but I get a Boolean (false).

@Override
	public Filter generateFilter( Object propertyId, Object value ) {
        // value = false
		String values[] = value.toString().split( "," );
		Filter filters[] = new Filter[values.length]
;

		if ( ...
			
		} else if ( LinePlanItem.PRODUCT_CATEGORY_ID.equals( propertyId ) ) {
			for ( int index = 0; index < values.length; index++ ) {
				filters[index]
 =
						new SimpleStringFilter(
								LinePlanItem.PRODUCT_CATEGORY_NAME,
								values[index]
.trim(), true, false );
			}
			return new Or( filters );
			
		} else if ( LinePlanItem.MODEL_OFFERING_ID.equals( propertyId ) ) {
			for ( int index = 0; index < values.length; index++ ) {
				filters[index]
 =
						new SimpleStringFilter(
								LinePlanItem.MODEL_OFFERING_ID,
								values[index]
.trim(), true, false );
			}
		}

		return null;

Any idea how I can get the values of the checked options?

I assume the OptionGroupPopup is a custom component / field? Check what it’s getValue() returns - if it’s based on PopupButton I think the value will be boolean by default. In that case you should override the getValue() of OptionGroupPopup to return the correctly-typed value.

Thanks. I changed the getValue() method in OptionGroupPopup to be a String, but then I get an exception FilterTable when it tried to paint the component. There is a method called paintContent() that at some point executes c.paint(target) (“c” is a Component). When we finally get down to Button, it tried to get the Boolean value of getValue(), which I’ve overridden to return a String. So my filter needs a string value but the Button needs a Boolean. Here’s part of the Stack Trace:

SEVERE: Terminal error:
java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Boolean
	at com.vaadin.ui.Button.booleanValue(Button.java:286)
	at com.vaadin.ui.Button.paintContent(Button.java:168)
	at org.vaadin.hene.popupbutton.PopupButton.paintContent(PopupButton.java:69)
	at com.vaadin.ui.AbstractComponent.paint(AbstractComponent.java:781)
	at com.catalystitservices.nike.dpt.ui.ExtendedFilterTable.paintContent(ExtendedFilterTable.java:128)

I guess I’m missing something important.

I’m hoping someone can help me with this. I really want to upgrade to FilteringTable 0.8 and I’ve spent a lot of time updating my code. I’m hoping I can get past this issue. Thanks for anything you can do.