@Override public SearchFilter getSearchFilter() { SearchFilter filter = new SearchFilter(); filter.setNewsQueueStatus(lstStatus.getValue()); if (chkMineOnly.getValue()) { filter.setCreatorUsername(AppContext.getContextUser().getUserId()); } else { filter.setCreatorUsername( lstCreator.getValue() == null ? null : lstCreator.getValue().getUserId()); String branch = lstBranch.getValue() == null ? null : lstBranch.getValue().getName(); filter.setBranch(branch); } filter.setStartDate(dateSelector.getStartDate()); filter.setEndDate(dateSelector.getEndDate()); return filter; }
@Inject StoriesView(Binder uiBinder) { initWidget(uiBinder.createAndBindUi(this)); bindSlot(StoriesPresenter.SLOT_CREATESTORY, panelCreateStory); lstStatus.setNullText("--Status--"); lstBranch.setNullText("--Branch--"); lstCreator.setNullText("--Staff--"); lstStatus.setItems( Arrays.asList( NewsQueueStatus.Draft, NewsQueueStatus.InProgress, NewsQueueStatus.Published, // NewsQueueStatus.Returned, NewsQueueStatus.Spiked)); chkMineOnly.addValueChangeHandler( new ValueChangeHandler<Boolean>() { @Override public void onValueChange(ValueChangeEvent<Boolean> event) { setMineOnly(event.getValue()); searchCallback.onComplete(null); } }); setMineOnly(true); aDateRange.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { AppManager.showPopUp( "Date Range", dateSelector, new OnOptionSelected() { @Override public void onSelect(String name) { if (name.equals("Clear")) { dateSelector.clearData(); } if (dateSelector.hasValue()) { aDateRange.addStyleName("orange"); alertOnSearchValueChange(true); } else { aDateRange.removeStyleName("orange"); } aDateRange.setTitle("" + dateSelector.getValueAsString()); searchCallback.onComplete(null); } }, "Done", "Clear"); } }); lstStatus.addValueChangeHandler( new ValueChangeHandler<NewsQueueStatus>() { @Override public void onValueChange(ValueChangeEvent<NewsQueueStatus> event) { searchCallback.onComplete(null); if (event.getValue() != null) { alertOnSearchValueChange(true); } } }); lstCreator.addValueChangeHandler( new ValueChangeHandler<UserDto>() { @Override public void onValueChange(ValueChangeEvent<UserDto> event) { searchCallback.onComplete(null); if (event.getValue() != null) { alertOnSearchValueChange(true); } } }); lstBranch.addValueChangeHandler( new ValueChangeHandler<Org>() { @Override public void onValueChange(ValueChangeEvent<Org> event) { searchCallback.onComplete(null); if (event.getValue() != null) { alertOnSearchValueChange(true); } } }); chkMineOnly.addValueChangeHandler( new ValueChangeHandler<Boolean>() { @Override public void onValueChange(ValueChangeEvent<Boolean> event) { setMineOnly(event.getValue()); } }); }
@Override public void setOrgs(List<Org> orgs) { lstBranch.setItems(orgs); }
@Override public void setUsers(List<UserDto> users) { lstCreator.setItems(users); }