code: private List<String> getGroupsList(VerticalLayout parent, boolean importCase) {
  
          List<String> res = new ArrayList<String>();
  
          if (m_groupID != null) {
              try {
                  res.add(m_cms.readGroup(m_groupID).getName());
              } catch (CmsException e) {
                  LOG.error("Unable to read group", e);
              }
              return res;
          }
  
          if (m_groupEditable) {
              CmsEditableGroup editableGroup = importCase ? m_importGroupsGroup : m_exportGroupsGroup;
              for (I_CmsEditableGroupRow row : editableGroup.getRows()) {
                  String groupName = ((CmsPrincipalSelect)row.getComponent()).getValue();
                  if (!CmsStringUtil.isEmptyOrWhitespaceOnly(groupName)) {
                      res.add(groupName);
                  }
              }
          } else {
              TextField comp = (TextField)parent.getComponent(0);
              res.add(comp.getValue());
          }
          return res;
      }
docs: Gets selected groups in List.<p>
  
  @param parent layout
  @param importCase boolean
  @return List of group names