/** @param collectionItemDo */ @UiConstructor public ResourceFrameBreakerView(final CollectionItemDo collectionItemDo, boolean isGoogleFile) { initWidget(uiBinder.createAndBindUi(this)); PlayerBundle.INSTANCE.getPlayerStyle().ensureInjected(); this.collectionItemDo = collectionItemDo; if (!isGoogleFile) { setLabelsAndIds(); supportTip.setStyleName(PlayerBundle.INSTANCE.getPlayerStyle().supportTip()); supportTip.setText(i18n.GL1453()); supportTip.getElement().setId("lblSupportTip"); supportTip.getElement().setAttribute("alt", i18n.GL1453()); supportTip.getElement().setAttribute("title", i18n.GL1453()); btnResourceLink.addStyleName(PlayerBundle.INSTANCE.getPlayerStyle().btnResourceLink()); } else { btnResourceLink.removeFromParent(); } imgFieldTrip.setUrl(collectionItemDo.getResource().getThumbnailUrl()); if (collectionItemDo.getResource().getResourceFormat() != null) { defaultResourceCategory = collectionItemDo.getResource().getResourceFormat().getDisplayName(); } if (defaultResourceCategory != null) { if (defaultResourceCategory.equalsIgnoreCase("Lesson") || defaultResourceCategory.equalsIgnoreCase("Textbook") || defaultResourceCategory.equalsIgnoreCase("Handout")) { defaultResourceCategory = defaultResourceCategory .replaceAll("Lesson", "Text") .replaceAll("Textbook", "Text") .replaceAll("Handout", "Text") .replaceAll("lesson", "Text") .replaceAll("textbook", "Text") .replaceAll("handout", "Text"); } if (defaultResourceCategory.equalsIgnoreCase("Slide")) { defaultResourceCategory = defaultResourceCategory.replaceAll("Slide", "Image").replaceAll("slide", "Image"); } if (defaultResourceCategory.equalsIgnoreCase("Exam") || defaultResourceCategory.equalsIgnoreCase("Challenge") || defaultResourceCategory.equalsIgnoreCase("Website")) { defaultResourceCategory = defaultResourceCategory .replaceAll("Exam", "Webpage") .replaceAll("Challenge", "Webpage") .replaceAll("exam", "Webpage") .replaceAll("challenge", "Webpage"); } } imgFieldTrip.addErrorHandler( new ErrorHandler() { @Override public void onError(ErrorEvent event) { imgFieldTrip.setUrl(DEFULT_IMAGE_PREFIX + defaultResourceCategory.toLowerCase() + PNG); } }); if (collectionItemDo.getResource().getResourceFormat() != null) { resourceCategory.addStyleName( getResourceTypeImage( collectionItemDo.getResource().getResourceFormat().getDisplayName())); } }
/* * Default constructor */ public ResourceFrameBreakerView() { initWidget(uiBinder.createAndBindUi(this)); PlayerBundle.INSTANCE.getPlayerStyle().ensureInjected(); setLabelsAndIds(); }