Hover cards display enhanced presence of a user in Sametime Connect buddy list. This article demonstrates the ease of using hover cards in your plug-ins.
Step1: Add following dependencies to the plug-in:
com.ibm.collaboration.realtime.people
com.ibm.collaboration.realtime.community
com.ibm.collaboration.realtime.core
Step2: Add following import statements in the java class:
import com.ibm.collaboration.realtime.people.PeopleService;
import com.ibm.collaboration.realtime.people.Person;
import com.ibm.collaboration.realtime.people.ui.HoverBusinessCard;
Step3: Create Person object for the user for which the hover card will be displayed using the People Service. For creating the person object we require user STID and community id. Community id can be retrieved using the CommunityServiceInternal object.
PeopleService peopleService = (PeopleService) ServiceHub.getService(PeopleService.SERVICE_TYPE);
Person person = peopleService.getPerson(<User STID>,<Community ID>,false);
Step4: Finally, to display hover card we need to create HoverBusinessCard instance as specified in the following snippet:
HoverBusinessCard hoverBusinessCard = new HoverBusinessCard(this.getShell(), <Person Object created in step3>,"");
hoverBusinessCard.show(this.getShell().getDisplay().getCursorLocation());