private void updateModel() { if (currentSelectedHost != null) { errataCountModel.setGuid(currentSelectedHost.getId()); errataCountModel.setEntity(currentSelectedHost); errataCountModel.runQuery(currentSelectedHost.getId()); } }
@Override protected void onBind() { super.onBind(); getView().getTotalSecurity().setCommand(errataCountModel.getShowSecurityCommand()); getView().getTotalBugFix().setCommand(errataCountModel.getShowBugsCommand()); getView().getTotalEnhancement().setCommand(errataCountModel.getShowEnhancementsCommand()); }
/* (non-Javadoc) * @see org.ovirt.engine.ui.common.presenter.AbstractSubTabPresenter#initializeHandlers() */ @Override public void initializeHandlers() { super.initializeHandlers(); registerHandler( getView() .getTotalSecurity() .addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { getView().getTotalSecurity().getCommand().execute(); } })); registerHandler( getView() .getTotalBugFix() .addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { getView().getTotalBugFix().getCommand().execute(); } })); registerHandler( getView() .getTotalEnhancement() .addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { getView().getTotalEnhancement().getCommand().execute(); } })); // Handle the counts changing -> simple view update. // errataCountModel.addErrataCountsChangeListener( new IEventListener<EventArgs>() { @Override public void eventRaised(Event<? extends EventArgs> ev, Object sender, EventArgs args) { // bus published message that the counts changed. update view. ErrataCounts counts = errataCountModel.getErrataCounts(); getView().showCounts(counts); } }); // Handle the count model getting a query error -> simple view update. // errataCountModel.addPropertyChangeListener( new IEventListener<PropertyChangedEventArgs>() { @Override public void eventRaised( Event<? extends PropertyChangedEventArgs> ev, Object sender, PropertyChangedEventArgs args) { if ("Message".equals(args.propertyName)) { // $NON-NLS-1$ if (errataCountModel.getMessage() != null && !errataCountModel.getMessage().isEmpty()) { // bus published message that an error occurred communicating with Katello. Show the // alert panel. getView().showErrorMessage(SafeHtmlUtils.fromString(errataCountModel.getMessage())); } } else if (PropertyChangedEventArgs.PROGRESS.equals(args.propertyName)) { if (errataCountModel.getProgress() != null) { getView().showProgress(); } } } }); }