public void renderTo (final @Nonnull TextView textView, final @Nonnull Object ... args) { textView.setText(Html.fromHtml(taxon.as(HtmlRenderable).render(args))); } }
@Override public void run() { log.info("renderTaxon({})", taxon); taxon.as(TextViewRenderable).renderTo(tvTaxon); } });
public void renderTo (final @Nonnull View view, final @Nonnull Object ... args) { final TextView textView = (TextView)view.findViewById(R.id.text); textView.setText(Html.fromHtml(taxon.as(HtmlRenderable).render(args))); } }
public void run() { log.info("renderTaxon({})", taxon); taxon.as(TextViewRenderable).renderTo(tvTaxon, TaxonRenderingOptions.PRIMARY_AND_SCIENTIFIC_NAME); } });
@Nonnull public String render (final @Nonnull Object... args) { final StringBuilder builder = new StringBuilder(); observationItem.getObservable().as(Taxon).as(PlainTextRenderable).renderTo(builder); builder.append(renderArgs(args)); return builder.toString(); } }
@ThreadConfined(type=NOT_UI) protected void createPresentationModels (final @Nonnull Taxon taxon) { addPresentationModel(new TextPresentationModel(taxon.as(HtmlRenderable).render(HIERARCHY))); try { // FIXME: instead of tweaking h2, use a CSS addPresentationModel(new DocumentPresentationModel(taxon.as(Documentable).getFactSheet().get(DESCRIPTION).replaceAll(("h2>"), "h3>"))); } catch (AsException e) { addPresentationModel(new TextPresentationModel("No info")); // FIXME } catch (NotFoundException e) { addPresentationModel(new TextPresentationModel("No info")); // FIXME } } }
/******************************************************************************************************************* * * ******************************************************************************************************************/ @ThreadConfined(type=NOT_UI) protected void createPresentationModels (final @Nonnull Taxon taxon) throws NotFoundException { log.info("createPresentationModels({})", taxon); // stillImages.addAll(taxon.as(Documentable).getFactSheet().getMultiple(FOAF_IMAGE)); for (final Media stillImage : taxon.as(Documentable).getFactSheet().getMultiple(FOAF_IMAGE)) { addPresentationModel(stillImage.with(ID, replacedId(stillImage.get(ID))).as(Presentable).createPresentationModel()); } }
/******************************************************************************************************************* * * {@inheritDoc} * ******************************************************************************************************************/ public void deleteObservationItem (final @Nonnull ObservationItem observationItem) { ThreadAssertions.assertThread(UI); log.info("deleteObservationItem({})", observationItem); final Taxon taxon = observationItem.getObservable().as(Taxon); view.confirmToDeleteAnObservationItem(notificationWithFeedback().withCaption(_, "confirm") .withText(_, "confirmDeleteObservationItem", taxon.as(PlainTextRenderable).render()) .withFeedback(new UserNotificationWithFeedback.Feedback() { @Override public void onConfirm() { observationItem.getObservation().change().without(observationItem).apply(); view.notifyObservationItemDeleted(notification().withText(_, "itemDeleted")); } })); }