//TODO: make data listen to this so that we don't need this call
private boolean updateAddressFilter(String filter)
	{
		String[] pieces = filter.split("/");
		if(pieces.length != 2)
		{
			searchTextField.setBackground(Color.RED);
			return false;
		}
		InetAddress new_filter_address;
		InetAddress new_filter_mask;
		boolean new_filter_enabled = !(pieces[1].equals("0"));
		try {
			new_filter_address = InetAddress.getByName(pieces[0]);
			// compute the subnet mask address
			byte[] byte_mask = new byte[4];
			int slash = Integer.parseInt(pieces[1]);
			// compute the mask address 
			// there is probably a way easier way to do this
			for (int j=0; slash-- > 0; j++) {
				if (j<8)  byte_mask[0] += Math.pow(2,j);
				if (j<16) byte_mask[1] += Math.pow(2,j-8);
				if (j<24) byte_mask[2] += Math.pow(2,j-16);
				if (j<32) byte_mask[3] += Math.pow(2,j-24);
			}
			new_filter_mask = InetAddress.getByAddress(byte_mask);
		}
		catch (Exception e) {
			searchTextField.setBackground(Color.RED);
			return false;
		}
		ip_filter_enabled = new_filter_enabled;
		filter_address = new_filter_address;
		filter_mask = new_filter_mask;
		fireExpressionChangedEvent();
		//TODO: make data listen to this so that we don't need this call
		data.setFilterPredicate(this);
		System.out.println("Updating filter succeeded!");
		searchTextField.setBackground(Color.WHITE);
		return true;
	}
filter_mask = new_filter_mask;
fireExpressionChangedEvent();
//TODO: make data listen to this so that we don't need this call
data.setFilterPredicate(this);
System.out.println("Updating filter succeeded!");
new_filter_mask = InetAddress.getByAddress(byte_mask);
}
catch (Exception e) {
searchTextField.setBackground(Color.RED);
return false;
}
ip_filter_enabled = new_filter_enabled;
filter_address = new_filter_address;
filter_mask = new_filter_mask;
fireExpressionChangedEvent();
//TODO: make data listen to this so that we don't need this call
data.setFilterPredicate(this);
System.out.println("Updating filter succeeded!");
searchTextField.setBackground(Color.WHITE);
return true;
}
byte[] byte_mask = new byte[4];
int slash = Integer.parseInt(pieces[1]);
// compute the mask address
// there is probably a way easier way to do this
for (int j=0; slash-- > 0; j++) {
if (j<8) byte_mask[0] += Math.pow(2,j);
if (j<16) byte_mask[1] += Math.pow(2,j-8);
if (j<24) byte_mask[2] += Math.pow(2,j-16);
if (j<32) byte_mask[3] += Math.pow(2,j-24);
}
new_filter_mask = InetAddress.getByAddress(byte_mask);
}
catch (Exception e) {
searchTextField.setBackground(Color.RED);
return false;
}
ip_filter_enabled = new_filter_enabled;
filter_address = new_filter_address;
filter_mask = new_filter_mask;
fireExpressionChangedEvent();
//TODO: make data listen to this so that we don't need this call
data.setFilterPredicate(this);
System.out.println("Updating filter succeeded!");
searchTextField.setBackground(Color.WHITE);
return true;
}