private Component buildMyFavorite() {
    VerticalLayout layout = new VerticalLayout();
    layout.setWidth("100%");
    layout.setHeight(null);
    layout.setSpacing(true);

    vfMyFavorite = new ViewerForm("", false);
    vfMyFavorite.getFieldset().addStyleName("fieldset-3-5");
    vfMyFavorite.getFieldset().addStyleName("fieldset-0");
    vfMyFavorite.addComboBox(termResource.getTerm("Create In"), "createIn", false);
    vfMyFavorite.addTextField(termResource.getTerm("New Folder"), "newFolder", false);
    layout.addComponent(vfMyFavorite);

    HorizontalLayout hl = new HorizontalLayout();
    hl.setWidth("100%");
    hl.setHeight(null);

    Commandbar commandbar = new Commandbar();
    commandbar.setSizeUndefined();

    Button btnSave = new Button(termResource.getTerm("Save"));
    btnSave.setIcon(FontAwesome.SAVE);
    Button btnClose = new Button(termResource.getTerm("Close"));
    btnClose.setIcon(FontAwesome.TIMES);

    commandbar.addCommand(btnSave, COMMAND.SAVE_MY_FAVORITE);
    commandbar.addCommand(btnClose, COMMAND.CLOSE_MY_FAVORITE);

    commandbar.addCommandExecuteListener(
        new CommandEvent.ExecuteListener() {
          @Override
          public void execute(ExecuteEvent event) {
            perform(event.getInstruction());
          }
        });
    hl.addComponent(commandbar);
    hl.setComponentAlignment(commandbar, Alignment.MIDDLE_CENTER);
    layout.addComponent(hl);

    return layout;
  }
  private void saveMyFavorite() {
    Item item = vfMyFavorite.getForm().getValues();
    String createId = (String) item.getItemProperty("createIn").getValue();
    String newForder = (String) item.getItemProperty("newFolder").getValue();

    if (FieldUtil.isNotEmpty(createId) && FieldUtil.isNotEmpty(newForder)) {
      Dialog dialog =
          new Dialog(
              Dialog.MODE.VALIDATE,
              messageResource.getMessage(
                  "501014",
                  locale,
                  termResource.getTerm("Create In"),
                  termResource.getTerm("New Folder")));
      return;
    }
    String category;
    if (createId != null) {
      category = createId;
    } else {
      category = newForder;
    }

    List<Item> selection = gridFilter.getGrid().getSelection();
    Item i = selection.get(0);
    String candidateUuid = (String) i.getItemProperty("candidateUuid").getValue();
    Candidate candidate = candidateService.get(candidateUuid);
    CandFavorite candFavorite = new CandFavorite();
    candFavorite.setCandidate(candidate);
    candFavorite.setCategory(category);
    candFavorite.setManager(currentUser);

    try {
      candFavoriteService.save(candFavorite);
    } catch (DuplicateConflictException d) {
      LOGGER.debug("DuplicateConflictException: ", d);
      Dialog dialog = new Dialog(Dialog.MODE.VALIDATE, d.getLocalizedMessage(locale));
      return;
    } catch (ConstraintConflictException c) {
      LOGGER.debug("ConstraintConflictException: ", c);
      Dialog dialog =
          new Dialog(Dialog.MODE.VALIDATE, ViolationUtils.getViolation(c.getViolations(), locale));
      return;
    } catch (OperationFailureException o) {
      LOGGER.error("Exception: ", o);
      Messagebox.hint(messageResource.getMessage("200001"));
      return;
    }
    // success
    Messagebox.info(messageResource.getMessage("100025"));
    closeMyFavorite();
    refresh();
  }
  private void popMyFavorite(String instruction) {
    List<Item> selection = grid.getSelection();

    if (selection.size() != 1) {
      Messagebox.hint(messageResource.getMessage("100004"));
      return;
    }

    String name = selection.get(0).getItemProperty("name").getValue().toString();

    windowMyFavorite.setCaption(name + "-" + termResource.getTerm("To My Favorite"));
    // reset combobox
    List<String> categories =
        candFavoriteService.findUniqueCategoryByManager(this.currentUser.getUuid());
    ComboBox cbCreateIn = (ComboBox) vfMyFavorite.getForm().getField("createIn");
    cbCreateIn.removeAllItems();
    for (String cbItem : categories) {
      cbCreateIn.addItem(cbItem);
    }

    vfMyFavorite.getForm().clear();
    windowMyFavorite.open();
  }