Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions quickfix/logviewer/CustomFilterDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ class OperatorComboBox extends JComboBox {
this.addItem( "<=" );
this.addItem( ">");
this.addItem( ">=" );
this.addItem( "contains" );
}
}

Expand All @@ -89,7 +90,7 @@ class FilterPanel extends JPanel implements ChangeListener {
add( checkBox );
comboBox.setPreferredSize( new Dimension(200, 25) );
add( comboBox );
operatorComboBox.setPreferredSize( new Dimension(50, 25) );
operatorComboBox.setPreferredSize( new Dimension(90, 25) );
add( operatorComboBox );
textField.setPreferredSize( new Dimension(250, 25) );
add( textField );
Expand Down Expand Up @@ -213,7 +214,9 @@ public static int convertOperator( String stringOperator ) {
return FieldFilter.GREATER_THAN;
if( stringOperator.equals(">=") )
return FieldFilter.GREATER_THAN_OR_EQUAL;
return FieldFilter.EQUAL;
if( stringOperator.equals("contains") )
return FieldFilter.CONTAINS;
return FieldFilter.CONTAINS;
}

public ArrayList getFilter() {
Expand Down
3 changes: 2 additions & 1 deletion quickfix/logviewer/FieldFilter.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ public class FieldFilter {
public final static int LESS_THAN_OR_EQUAL = 3;
public final static int GREATER_THAN = 4;
public final static int GREATER_THAN_OR_EQUAL = 5;

public final static int CONTAINS = 6;

private StringField field = null;
private int operator = 0;

Expand Down
9 changes: 7 additions & 2 deletions quickfix/logviewer/MessagesTableModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ else if( dataDictionary.isTrailerField(tag) )
else
message.getField( field );

int operator = fieldFilter.getOperator();
int compareResults = 0;
String value1 = field.getValue();
String value2 = fieldFilter.getValue();
Expand Down Expand Up @@ -301,15 +302,19 @@ else if( dataDictionary.isTrailerField(tag) )
if( value1Name != null )
compareResults = value1Name.toUpperCase().compareTo(value2.toUpperCase());
}

int operator = fieldFilter.getOperator();

if ( operator == FieldFilter.CONTAINS ) {
compareResults = value1.indexOf(value2);
}

switch( operator ) {
case FieldFilter.EQUAL: if( !(compareResults == 0)) addMessage = false; break;
case FieldFilter.NOT_EQUAL: if( !(compareResults != 0) ) addMessage = false; break;
case FieldFilter.LESS_THAN: if( !(compareResults < 0)) addMessage = false; break;
case FieldFilter.LESS_THAN_OR_EQUAL: if( !(compareResults <= 0) ) addMessage = false; break;
case FieldFilter.GREATER_THAN: if( !(compareResults > 0) ) addMessage = false; break;
case FieldFilter.GREATER_THAN_OR_EQUAL: if( !(compareResults >= 0)) addMessage = false; break;
case FieldFilter.CONTAINS: if(compareResults == -1) addMessage = false; break;
}
} catch (FieldNotFound e) {
addMessage = false;
Expand Down