@Override public void onEvent(Event e) { Log.d( "nils", "In ADDNUMBER event targetListId: " + targetList.getId() + " e.getProvider: " + e.getProvider() + "type of event: " + e.getType().name()); if (e.getProvider().equals(targetList.getId())) { matchAndRecalculateMe(); refresh(); } else Log.d("nils", "event discarded - from wrong list"); }
public WF_Not_ClickableField_SumAndCountOfVariables( String header, String descriptionT, WF_Context myContext, String myTarget, String pattern, Type sumOrCount, boolean isVisible, String textColor, String bgColor) { super( header, descriptionT, myContext, LayoutInflater.from(myContext.getContext()) .inflate(R.layout.selection_field_normal_colored, null), isVisible); this.myContext = myContext; o = GlobalState.getInstance().getLogger(); targetList = myContext.getList(myTarget); myType = sumOrCount; myPattern = pattern; allMatchingVariables = new HashSet<Variable>(); TextView text = (TextView) getWidget().findViewById(R.id.editfieldtext); LinearLayout bg = (LinearLayout) getWidget().findViewById(R.id.background); if (bgColor != null) bg.setBackgroundColor(Color.parseColor(bgColor)); if (textColor != null) text.setTextColor(Color.parseColor(textColor)); if (targetList == null) { o.addRow(""); o.addRedText( "Couldn't create " + header + " since target list: " + myTarget + " does not exist"); Log.e( "parser", "couldn't create SumAndCountOfVariables - could not find target list " + myTarget); } else { for (Listable l : targetList.getList()) { Set<Variable> vars = l.getAssociatedVariables(); for (Variable v : vars) { if (v.getId().matches(myPattern)) allMatchingVariables.add(v); } } myContext.addEventListener(this, EventType.onRedraw); } }