private void condenseContacts() { // TODO: this is really not safe.. need to lock dairy as well? synchronized (localDairy.getContactMethods()) { final List<ContactMethod> emptyMethods = new LinkedList<ContactMethod>(); for (final ContactMethod method : localDairy.getContactMethods()) { if (method.getCmValue() == null || method.getCmValue().trim().length() == 0) { emptyMethods.add(method); } } localDairy.getContactMethods().removeAll(emptyMethods); } }
/** Initialize bindings (bind to model). */ private void initBindings() { // info panel txtID.bindToModel(localDairy, "companyId"); txtNAME.bindToModel(localDairy, "companyName"); txtPHONE.bindToModel(localDairy, "phoneNumber"); txtPUBLIC_DESCRIPTION.bindToModel(localDairy, "description"); txtPROFILE_IMAGE.bindToModel(localDairy, "profilePhoto"); txtMANAGER_NAME.bindToModel(localDairy, "managerName"); txtESTABLISHED_DATE.bindToModel(localDairy, "establishedDate"); txtMEMBER_COUNT.bindToModel(this, "memberCount"); // setMemberCount(localDairy.getMemberships().size()); // registration panel txtLEGAL_NAME.bindToModel(localDairy, "legalName"); txtREGISTRATION_NBR.bindToModel(localDairy, "registrationNumber"); txtNSSF_NUMBER.bindToModel(localDairy, "nssfNumber"); txtNHIF_NUMBER.bindToModel(localDairy, "nhifNumber"); txtFEDERAL_PIN.bindToModel(localDairy, "federalPin"); txtLIC_EFFECTIVE_DATE.bindToModel(localDairy, "licenseEffectiveDate"); txtLIC_EXPIRATION_DATE.bindToModel(localDairy, "licenseExpirationDate"); locationController.setInputModel(localDairy.getLocation()); contactsGroup.bindToModel(localDairy.getContactMethods()); // System.err.println("ADAPTER COUNT: " + localDairy.eAdapters().size()); // System.err.println("ADAPTERS : " + localDairy.eAdapters()); // localDairy.eAdapters().add(new Adapter() { // Notifier target; // @Override // public void notifyChanged(Notification notification) { // System.err.println( ">> NOTIFICATION: " + notification); // } // // @Override // public Notifier getTarget() { // System.err.println( ">> getTarget: " + target); // return target; // } // // @Override // public void setTarget(Notifier newTarget) { // System.err.println( ">> setTarget: " + newTarget); // target = newTarget; // } // // @Override // public boolean isAdapterForType(Object type) { // System.err.println( ">> IS_ADAPTER_FOR_CHECK: " + type); // return true; // } // // }); }