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 Component buildButtons() { HorizontalLayout hl = new HorizontalLayout(); hl.setSpacing(true); // Decision button menu = new ResumeReviewToDoListMenu(grid); menu.setMenuBarEnabled(false); menu.addCommandExecuteListener( new CommandEvent.ExecuteListener() { @Override public void execute(ExecuteEvent event) { perform(event.getInstruction()); } }); hl.addComponent(menu); // Review Profile commandbar = new Commandbar(); Button btnCheck = new Button(termResource.getTerm("Check Details")); btnCheck.setEnabled(false); btnCheck.setIcon(FontAwesome.EYE); Button btnMyFavorite = new Button(termResource.getTerm("To My Favorite")); btnMyFavorite.setEnabled(false); btnMyFavorite.setIcon(FontAwesome.STAR); Button btnCompare = new Button(termResource.getTerm("Add To Compare")); btnCompare.setIcon(FontAwesome.ADJUST); btnCompare.setEnabled(false); commandbar.addCommand(btnCheck, COMMAND.CHECK); commandbar.addCommand(btnMyFavorite, COMMAND.POP_MY_FAVORITE); commandbar.addCommand(btnCompare, COMMAND.COMPARE); commandbar.addCommandExecuteListener( new CommandEvent.ExecuteListener() { @Override public void execute(ExecuteEvent event) { perform(event.getInstruction()); } }); hl.addComponent(commandbar); return hl; }
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 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(); }
private Component buildGrid() { VerticalLayout layout = new VerticalLayout(); layout.setSpacing(true); grid.setSizeFull(); grid.setMultiSelect(true); grid.addContainerProperty( "candidateUuid", String.class, null, termResource.getTerm("UUID"), null, null); grid.setColumnCollapsed("candidateUuid", true); grid.addContainerProperty("candStageInterviewerUuid", String.class, null); grid.setColumnCollapsed("candStageInterviewerUuid", true); grid.addContainerProperty( "decision", CodeData.class, null, termResource.getTerm("Decision"), null, null); grid.addContainerProperty( "name", String.class, null, termResource.getTerm("IA-CANDIDATE"), null, null); grid.addContainerProperty( "requisition", String.class, null, termResource.getTerm("IA-REQUISITION"), null, null); grid.addContainerProperty( "location", String.class, null, termResource.getTerm("Location"), null, null); grid.addContainerProperty( "dueOn", Date.class, null, termResource.getTerm("Due On"), null, null); grid.addContainerProperty( "degree", CodeData.class, null, termResource.getTerm("Degree"), null, null); grid.addContainerProperty( "school", String.class, null, termResource.getTerm("School"), null, null); grid.addContainerProperty( "major", String.class, null, termResource.getTerm("Major"), null, null); grid.addContainerProperty( "totalWorkExp", BigDecimal.class, null, termResource.getTerm("Years Experience"), null, Table.ALIGN_RIGHT); grid.addContainerProperty( "lastJobTitle", String.class, null, termResource.getTerm("Last Job Title"), null, null); grid.addContainerProperty( "lastEmplyer", String.class, null, termResource.getTerm("Last Employer"), null, null); grid.addContainerProperty( "source", String.class, null, termResource.getTerm("Source"), null, null); grid.addContainerProperty( "completeOn", Date.class, null, termResource.getTerm("Complete On"), null, null); grid.addContainerProperty( "read", Label.class, null, termResource.getTerm("Read"), null, Table.ALIGN_CENTER); grid.setColumnWidth("read", 100); grid.addContainerProperty("candStageInterviewer", CandStageInterviewer.class, null); grid.setColumnCollapsed("candStageInterviewer", true); gridFilter.buildCondition(); grid.addValueChangeListener( new Property.ValueChangeListener() { public void valueChange(ValueChangeEvent event) { gridChange(event.getProperty().getValue()); } }); gridFilter.setWindowHeight("485px"); layout.addComponent(gridFilter); return layout; }
private void buildWindowMyFavorite() { windowMyFavorite = new WindowMTK(termResource.getTerm("My Favorite")); windowMyFavorite.setWidth("400px"); windowMyFavorite.setHeight("230px"); windowMyFavorite.setContent(buildMyFavorite()); }