public void run() { log.info("lock({})", notification); progressDialog = ProgressDialog.show(getContext(), notification.getCaption(), notification.getText(), true, true, progressDialogCancelListener); } });
@Override public void onConfirm() { observationSet.clear(); view.notifyAllObservationsDeleted(notification().withText(_, "allObservationsErased")); } }));
public void run() { Toast.makeText(activity, notification.getText(), Toast.LENGTH_SHORT).show(); } });
public void run() { Toast.makeText(view.getContext(), notification.getText(), Toast.LENGTH_SHORT).show(); } });
/******************************************************************************************************************* * * ******************************************************************************************************************/ public void actionPerformed (final @Nonnull ActionEvent event) { log.info("actionPerformed({}) - media: {}", event, media); try { playController.play(media); } catch (Exception e) { log.warn("Can't play sound", e); view.notifyError(notification().withText(_, "playFailed")); } }
public void run() { log.info("lock({})", notification); progressDialog = ProgressDialog.show(getContext(), notification.getCaption(), notification.getText(), true); } });
public void run() { log.info("notifyNoData({})", notification); progressDialog.dismiss(); tvNoData.setText(notification.getText()); tvNoData.setVisibility(View.VISIBLE); llData.setVisibility(View.GONE); } });
/******************************************************************************************************************* * * {@inheritDoc} * ******************************************************************************************************************/ public void cancelNewObservation() { ThreadAssertions.assertThread(UI); log.info("cancelNewObservation()"); locationFinder.stop(); // we pre-started it view.notifyNewObservationCancelled(notification().withText(_, "addedNewObservationCancelled")); }
public void run() { log.info("lock({})", notification); if (progressDialog == null) { progressDialog = ProgressDialog.show(getContext(), notification.getCaption(), notification.getText(), true); } } });
/******************************************************************************************************************* * * {@inheritDoc} * ******************************************************************************************************************/ @Override public void initialize() { log.info("initialize()"); view.lock(notification().withText("Loading data...")); // TODO: use a bundle executor.execute(new Runnable() { @Override public void run() { final Finder<Ping> finder = dao.findPings().sort(BY_TIMESTAMP, DESCENDING); final SimpleComposite<Ping> composite = new DefaultSimpleComposite<Ping>(finder); view.populate(presentationModelFactory.createPresentationModel(new Object[]{ composite })); view.unlock(); } }); } }
/******************************************************************************************************************* * * {@inheritDoc} * ******************************************************************************************************************/ public boolean matches (final @Nullable Object item) { if (!(item instanceof UserNotification)) { return false; } notification = (UserNotification)item; final boolean b = Pattern.matches(caption, notification.getCaption()) && Pattern.matches(text, notification.getText()); if (!b) { d = String.format("%s (instead is %s)", d, item); } return b; }
public void propertyChange (final @Nonnull PropertyChangeEvent event) { log.info("downloadablePropertyChangeListener.propertyChange({})", event); if (WATCHED_PROPERTIES.contains(event.getPropertyName()) && (event.getOldValue() != event.getNewValue())) { controller.notifyStatusChanged(); if (event.getPropertyName().equals(PROP_STATUS)) { final Downloadable downloadable = (Downloadable)event.getSource(); switch ((Status)event.getNewValue()) { case DOWNLOADED: final double freeSpace = masterFileSystem.get().getExternalFileSystem().getFreeSpace() / MEGA; view.notifyCompletion(notification().withText(_, "downloadComplete", freeSpace)); downloadable.removePropertyChangeListener(downloadablePropertyChangeListener); break; case BROKEN: view.notifyError(notification().withText(_, "downloadFailed")); downloadable.removePropertyChangeListener(downloadablePropertyChangeListener); break; } } } } };
@Override public void onConfirm() { try { media.as(Removable).remove(); final double freeSpace = masterFileSystem.get().getExternalFileSystem().getFreeSpace() / MEGA; view.notifyCompletion(notification().withText(_, "deletionCompleted", freeSpace)); } catch (Exception e) { log.warn("Can't delete sound", e); view.notifyError(notification().withText(_, "deletionFailed")); } // Needed because at this point the PropertyChangeListener has been detached. // Maybe it would be better to keep the listener attached, implement a dispose() method that // detaches it at the end. controller.notifyStatusChanged(); } }));
view.lock(notification().withText(_, "preparingData")); view.renderTaxon(taxon);
@Override public void onConfirm() { observationItem.getObservation().change().without(observationItem).apply(); view.notifyObservationItemDeleted(notification().withText(_, "itemDeleted")); } }));
/******************************************************************************************************************* * * ******************************************************************************************************************/ protected void populateView() { log.info("populate() - presentation model: {}", presentationModel); try { if (presentationModel.as(Composite).findChildren().count() > 0) { view.populate(presentationModel); } else { view.notifyNoData(notification().withText(_, "noData")); } } catch (AsException e) { view.notifyNoData(notification().withText(_, "noData")); } view.unlock(); }
/******************************************************************************************************************* * * * ******************************************************************************************************************/ public void initialize() { log.info("initialize()"); view.lock(notification().withText(_, "preparingData")); view.showTaxonomyName(taxonomyFooterController.getTaxonomyDisplayName()); view.showTaxonomyLanguages(taxonomyFooterController.getTaxonLanguages()); executorService.submit(new Runnable() { @Override public void run() { populateView(); } }); }
/******************************************************************************************************************* * * {@inheritDoc} * ******************************************************************************************************************/ public void updateObservationDate (final @Nonnull Observation observation, final @Nonnull DateUpdater dateUpdater) { ThreadAssertions.assertThread(UI); final Date date = dateUpdater.update(observation.getDate()); observation.change().at(date).apply(); view.notifyObservationDateTimeUpdated(notification().withText(_, "observationDateTimeUpdated")); }
/******************************************************************************************************************* * * {@inheritDoc} * ******************************************************************************************************************/ public void commitNewObservation() { ThreadAssertions.assertThread(UI); log.info("commitNewObservation()"); final Observation.Builder builder = observationClipboard.getBuilder(); if (builder.getItemCount() > 0) { builder.build(); view.highlightLatestObservation(); view.notifyNewObservationCommitted(notification().withText(_, "addedNewObservation")); } observationClipboard.clear(); }