Example usage for com.google.gwt.user.client.ui HTMLPanel HTMLPanel

List of usage examples for com.google.gwt.user.client.ui HTMLPanel HTMLPanel

Introduction

In this page you can find the example usage for com.google.gwt.user.client.ui HTMLPanel HTMLPanel.

Prototype

private HTMLPanel(Element elem) 

Source Link

Document

Construct a new HTMLPanel with the specified element.

Usage

From source file:org.ednovo.gooru.client.mvp.search.SearchUiUtil.java

License:Open Source License

public static void renderSourceMetadata(FlowPanel flowPanel, String data, String suffix, int wrapLength) {
    if (suffix != null || StringUtil.hasValidString(data)) {
        if (wrapLength > 0) {
            data = StringUtil.truncateText(data, wrapLength);
        }//  ww  w.  j  a v  a2s .  com
        if (suffix != null) {
            data += suffix;
        }
        HTMLPanel label = new HTMLPanel(data);
        label.setStyleName(CssTokens.FLOAT_LEFT);
        renderMetaData(flowPanel, label);
    }
}

From source file:org.ednovo.gooru.client.mvp.shelf.collection.CollectionShareTabVc.java

License:Open Source License

/**
 * Class constructor , set collection object and collection shorten url
 * /*  w w  w.  j  a v a2s  .  com*/
 * @param collection
 *            instance of {@link CollectionDo}
 */
public CollectionShareTabVc(CollectionDo collection) {
    this.collection = collection;
    initWidget(uiBinder.createAndBindUi(this));
    shareViaText = new HTMLPanel("");
    visibilityText.setText(GL0842);
    visibilityOptiontext.setText(GL0843);
    shareCollectiontext.setText(GL0545.toUpperCase());
    shareViaText.getElement().setInnerHTML(GL0638);
    //GL0638
    socialShareLinksView = new SocialShareLinksView();
    this.setData(collection);

    if (collection.getSharing().equalsIgnoreCase("private")) {
        shareLinkFloPanel.addStyleName(ShelfCBundle.INSTANCE.css().inActiveClass());
        socialShareLinksView.getshareLinkTxtBox()
                .addStyleName(ShelfCBundle.INSTANCE.css().shareLinkBoxDisabled());
    }

    rbPublic = new HTMLPanel("");
    rbShareable = new HTMLPanel("");
    rbPrivate = new HTMLPanel("");
    rbPublicPanel = new HTMLPanel("");
    rbShareablePanel = new HTMLPanel("");
    rbPrivatePanel = new HTMLPanel("");
    rbPublicPanel.add(rbPublic);
    rbPrivatePanel.add(rbPrivate);
    rbShareablePanel.add(rbShareable);
    rbPublicPanel.setStyleName(ShelfCBundle.INSTANCE.css().shareVisibilityRadioBtnStyle());
    rbPrivatePanel.setStyleName(ShelfCBundle.INSTANCE.css().shareVisibilityRadioBtnStyle());
    rbShareablePanel.setStyleName(ShelfCBundle.INSTANCE.css().shareVisibilityRadioBtnStyle());

    publicFocPanel = new FlowPanel();
    socialShareLinksView.getshareLinkTxtBox().setReadOnly(true);
    shareViewPublicUc = new ShareViewUc(GL0329, GL0330);
    shareViewPublicUc.setTitleDescriptionStyle(52, 44);
    publicFocPanel.add(shareViewPublicUc);
    publicFocPanel.add(rbPublicPanel);
    publicShareFloPanel.add(publicFocPanel);
    linkFocPanel = new FlowPanel();
    shareViewShareableUc = new ShareViewUc(GL0331, GL0332);
    shareViewShareableUc.setTitleDescriptionStyle(12, 44);
    linkFocPanel.add(shareViewShareableUc);
    linkFocPanel.add(rbShareablePanel);
    linkShareFloPanel.add(linkFocPanel);

    privateFocPanel = new FlowPanel();
    shareViewPrivateUc = new ShareViewUc(GL0333, GL0334);
    shareViewPrivateUc.setTitleDescriptionStyle(40, 44);
    privateFocPanel.add(shareViewPrivateUc);
    privateFocPanel.add(rbPrivatePanel);
    privateShareFloPanel.add(privateFocPanel);

    disableAllVisiblePanels();

    CollectionEditShareHandler handler = new CollectionEditShareHandler() {
        @Override
        public void updateShareType(String shareType) {
            //            collection.setSharing(shareType);
            updateCollectionItem(shareType);
        }
    };

    AppClientFactory.getEventBus().addHandler(CollectionEditShareEvent.TYPE, handler);

    if (collection.getSharing().equals("public")) {
        publicShareFloPanel.removeStyleName(ShelfCBundle.INSTANCE.css().inActiveClass());
        privateShareFloPanel.addStyleName(ShelfCBundle.INSTANCE.css().inActiveClass());
        linkShareFloPanel.addStyleName(ShelfCBundle.INSTANCE.css().inActiveClass());
        isSharable = true;
        selectPrivateResource("public");
    } else if (collection.getSharing().equals("private")) {
        privateShareFloPanel.removeStyleName(ShelfCBundle.INSTANCE.css().inActiveClass());
        publicShareFloPanel.addStyleName(ShelfCBundle.INSTANCE.css().inActiveClass());
        linkShareFloPanel.addStyleName(ShelfCBundle.INSTANCE.css().inActiveClass());
        isSharable = false;
        selectPrivateResource("private");
    } else {
        linkShareFloPanel.removeStyleName(ShelfCBundle.INSTANCE.css().inActiveClass());
        privateShareFloPanel.addStyleName(ShelfCBundle.INSTANCE.css().inActiveClass());
        publicShareFloPanel.addStyleName(ShelfCBundle.INSTANCE.css().inActiveClass());
        isSharable = true;
        selectPrivateResource("shareable");
    }

    setShareUrlGenerationAsyncCallback(new SimpleAsyncCallback<Map<String, String>>() {
        @Override
        public void onSuccess(Map<String, String> shortenUrl) {
            contentpanel.clear();
            setData(shortenUrl);
        }
    });

    setShareUrlWithGenerationAsyncCallback(new SimpleAsyncCallback<Map<String, String>>() {

        @Override
        public void onSuccess(Map<String, String> result) {
            if (result != null && result.containsKey("shortenUrl")) {
                socialShareLinksView.setEmbedBitlyLink(result.get("decodeRawUrl"));
            }
            rawUrl = result.get("rawUrl").toString();
        }
    });

    String params = "/#" + PlaceTokens.PREVIEW_PLAY + "&id=" + this.collection.getGooruOid();
    AppClientFactory.getInjector().getSearchService().getCollectionPlayDirectLink(params,
            new SimpleAsyncCallback<String>() {

                @Override
                public void onSuccess(String result) {
                }
            });

    if (AppClientFactory.getLoggedInUser().getConfirmStatus() == 1) {
        publicShareFloPanel.addClickHandler(new OnPublicClick());
    } else {
        publicShareFloPanel.addMouseOverHandler(new MouseOverHandler() {

            @Override
            public void onMouseOver(MouseOverEvent event) {
                toolTipPopupPanel.clear();
                toolTipPopupPanel.setWidget(new GlobalToolTip(CONFIRM_MESSAGE));
                toolTipPopupPanel.setStyleName("");
                toolTipPopupPanel.setPopupPosition(publicShareFloPanel.getElement().getAbsoluteLeft() + 105,
                        publicShareFloPanel.getElement().getAbsoluteTop() + 25);
                toolTipPopupPanel.show();
            }
        });

        publicShareFloPanel.addMouseOutHandler(new MouseOutHandler() {

            @Override
            public void onMouseOut(MouseOutEvent event) {
                toolTipPopupPanel.hide();
            }
        });
    }
    privateShareFloPanel.addClickHandler(new OnPrivateClick());
    linkShareFloPanel.addClickHandler(new OnLinkClick());
    loadingImageLabel.setVisible(true);
    mainShareContainer.setVisible(false);
    socialShareLinksViewContainer.add(socialShareLinksView);
    getUserType();
}

From source file:org.ednovo.gooru.client.mvp.shelf.collection.tab.resource.add.AddSearchResourceView.java

License:Open Source License

private void setData(SearchDo<ResourceSearchResultDo> result) {
    if (result.getSearchHits() == 0) {
        searchResultspanel.setVisible(false);
    } else {//from  w w w  .  j  av a2 s  .  c o m
        searchResultspanel.setVisible(true);
        totalResources.setText(StringUtil.generateMessage(GL0335, Integer.toString(result.getSearchHits())));
        final List<ResourceSearchResultDo> searchResults = result.getSearchResults();
        for (int i = 0; i < 4; i++) {
            final String thumbnailUrl = searchResults.get(i).getUrl();
            category = searchResults.get(i).getCategory();
            if (category != null) {
                if (category.equalsIgnoreCase("lesson") || category.equalsIgnoreCase("textbook")
                        || category.equalsIgnoreCase("handout")) {
                    category = category.replaceAll("lesson", "text").replaceAll("textbook", "text")
                            .replaceAll("handout", "text");
                }
                if (category.equalsIgnoreCase("slide")) {
                    category = category.replaceAll("slide", "image");
                }
                if (category.equalsIgnoreCase("exam") || category.equalsIgnoreCase("website")
                        || category.equalsIgnoreCase("challenge")) {
                    category = category.replaceAll("exam", "webpage").replaceAll("website", "webpage")
                            .replaceAll("challenge", "webpage");
                }
            }
            HTMLPanel thumbnailContainer = new HTMLPanel("");

            addResourceThumbnailContent = new HTMLPanel("");
            addResourceThumbnailContent
                    .setStyleName(CollectionEditResourceCBundle.INSTANCE.css().addResourceThumbnailContent());
            final Image resourceThumbnail = new Image();
            resourceThumbnail.setUrl(thumbnailUrl);
            resourceThumbnail.getElement().getStyle().setHeight(60, Unit.PX);
            resourceThumbnail.getElement().getStyle().setWidth(80, Unit.PX);

            addResourceSprite = new HTMLPanel("");
            addResourceSprite.addStyleName(UcCBundle.INSTANCE.css().resourceName());
            addResourceSprite.addStyleName(category.toLowerCase() + SMALL);
            addResourceImgDesc = new HTML();
            String resourceTitle = searchResults.get(i).getResourceTitle();
            if (resourceTitle.length() > 25) {
                resourceTitle = resourceTitle.substring(0, 24) + "...";
            }

            thumbnailContainer.add(resourceThumbnail);
            thumbnailContainer.add(addResourceSprite);
            thumbnailContainer.getElement().getStyle().setHeight(65, Unit.PX);

            addResourceImgDesc.setHTML(resourceTitle);
            addResourceImgDesc.setStyleName(CollectionEditResourceCBundle.INSTANCE.css().addResourceImgDesc());

            addResourceThumbnailContent.add(thumbnailContainer);
            addResourceThumbnailContent.add(addResourceImgDesc);
            suggestedResourcesPanel.add(addResourceThumbnailContent);

            resourceThumbnail.addErrorHandler(new ErrorHandler() {
                @Override
                public void onError(ErrorEvent event) {
                    resourceThumbnail.setUrl(DEFULT_IMAGE_PREFIX + category.toLowerCase() + PNG);
                }
            });
        }

        suggestedResourcesPanel.add(viewAllResourcesBtn);
        viewAllResourcesBtn.getElement().getStyle().setMarginLeft(-236, Unit.PX);
        viewAllResourcesBtn.getElement().getStyle().setPosition(Position.ABSOLUTE);
        viewAllResourcesBtn.getElement().getStyle().setMarginTop(33, Unit.PX);
    }
}

From source file:org.ednovo.gooru.client.mvp.shelf.list.FolderResource.java

License:Open Source License

@Override
public void onClick(ClickEvent event) {

    if (event.getSource().equals(L1titleFocPanel)) {
        L1titleFocPanel.setStyleName(res.css().shelfFolderL2TitleActive());
        int widgetCount = contentVerPanel.getWidgetCount();
        AppClientFactory//from w  w w  . j  av  a  2 s  . c  o m
                .fireEvent(new RefreshLevelFolderInShelfListEvent(collectionItemDo.getResource().getGooruOid(),
                        RefreshType.UPDATE, FOLDER_LEVEL, collectionItemDo.getItemSequence(), true));
        if (collectionItemDo.getResource().getResourceType().getName().equals("folder") && widgetCount == 0) {
            /*
             * wrapperFocPanel.setStyleName(res.css().
             * shelfContentWrapperPanelForFolders());
             * contentVerPanel.setStyleName
             * (res.css().shelfContentPanelForFolders());
             */
            String gooruOId = folderL2TitleLbl.getElement().getId();
            AppClientFactory.getInjector().getfolderService().getFolders(gooruOId,
                    new AsyncCallback<List<CollectionItemDo>>() {
                        @Override
                        public void onSuccess(List<CollectionItemDo> result) {
                            if (result.size() == 0) {
                                htmlPanel = new HTMLPanel(GL0989);
                                htmlPanel.getElement().getStyle().setTextAlign(TextAlign.CENTER);
                                htmlPanel.getElement().getStyle().setMarginLeft(19, Unit.PX);
                                htmlPanel.getElement().getStyle().setColor("#999999");
                                htmlPanel.getElement().setId(collectionItemDo.getResource().getGooruOid());
                                contentVerPanel.add(htmlPanel);
                            }
                            for (CollectionItemDo collectionFolderItems : result) {
                                addFolderItems(collectionFolderItems);
                            }
                        }

                        @Override
                        public void onFailure(Throwable caught) {
                        }
                    });
        }
        if (collectionItemDo.getResource().getResourceType().getName().equals("scollection")
                && widgetCount == 0) {
            AppClientFactory.getInjector().getResourceService().getCollection(
                    collectionItemDo.getResource().getGooruOid(), false, new AsyncCallback<CollectionDo>() {
                        @Override
                        public void onSuccess(CollectionDo result) {
                            setL2FoldersData(result);
                        }

                        @Override
                        public void onFailure(Throwable caught) {
                        }
                    });
        }
        if (collectionItemDo.getResource().getResourceType().getName().equalsIgnoreCase("folder")) {
            Map<String, String> params = new HashMap<String, String>();
            params.put("level", "2");
            params.put("folderid", folderL2TitleLbl.getElement().getId());
            String currentNameToken = AppClientFactory.getPlaceManager().getCurrentPlaceRequest()
                    .getNameToken();

            if (currentNameToken.equalsIgnoreCase(PlaceTokens.EDIT_FOLDERS)
                    || currentNameToken.equalsIgnoreCase(PlaceTokens.FOLDERS)
                    || currentNameToken.equalsIgnoreCase(PlaceTokens.SHELF)) {
                AppClientFactory.getPlaceManager().revealPlace(PlaceTokens.EDIT_FOLDERS, params, true);
            }
        }

        setOpen();
    } else if (event.getSource().equals(wrapperFocPanel)) {
        if (!getDropController().isDropActive()) {
            // Set default tabFlag in persistant store for Collection Edit
            Storage stockStore = Storage.getLocalStorageIfSupported();
            if (stockStore != null) {
                stockStore.setItem("tabKey", "resourceTab");
            }
            if (collectionItemDo.getResource().getResourceType().getName().equalsIgnoreCase("scollection")) {
                AppClientFactory.fireEvent(new RequestShelfEvent(collectionItemDo.getResource().getGooruOid()));
            }
        }
    }
}

From source file:org.ednovo.gooru.client.mvp.shelf.list.FolderResource.java

License:Open Source License

public void setL2FoldersData(CollectionDo collectionDo) {
    if (collectionDo.getCollectionItems().size() > 0) {
        for (CollectionItemDo collectionItem : collectionDo.getCollectionItems()) {
            addCollectionItem(collectionItem, false);
        }// w w  w  .j  a v  a2 s. co  m
    } else {
        if (collectionDo.getCollectionType().equals("folder")) {
            htmlPanel = new HTMLPanel(GL0989);
        } else if (collectionDo.getCollectionType().equals("collection")) {
            htmlPanel = new HTMLPanel(GL0854);
        }

        htmlPanel.getElement().getStyle().setTextAlign(TextAlign.CENTER);
        htmlPanel.getElement().getStyle().setMarginLeft(19, Unit.PX);
        htmlPanel.getElement().getStyle().setColor("#999999");
        htmlPanel.getElement().getStyle().setFontStyle(FontStyle.ITALIC);
        htmlPanel.getElement().setId(collectionDo.getGooruOid());
        contentVerPanel.add(htmlPanel);
    }
}

From source file:org.ednovo.gooru.client.mvp.shelf.list.ShelfCollection.java

License:Open Source License

public void setEmptyData() {
    htmlPanel = new HTMLPanel(GL0989);
    htmlPanel.getElement().getStyle().setTextAlign(TextAlign.CENTER);
    htmlPanel.getElement().getStyle().setMarginLeft(19, Unit.PX);
    htmlPanel.getElement().getStyle().setColor("#999999");
    htmlPanel.getElement().setId(collectionDo.getGooruOid());
    contentVerPanel.add(htmlPanel);/* ww w . j  ava 2s .c  o  m*/
}

From source file:org.ednovo.gooru.client.mvp.shelf.list.ShelfCollection.java

License:Open Source License

/**
 * Remove the collection item from the collection
 * //from  ww  w. j av  a  2  s  .co  m
 * @param collectionItemDo
 *            which is to be removed
 */
public void removeCollectionItem(FolderDo collectionItemDo) {
    this.collectionDo.getCollectionItems().remove(collectionItemDo);
    //this.collectionDo.getCollectionItems().remove(1);
    ShelfResource shelfResource = getShelfResource(collectionItemDo.getGooruOid());
    if (shelfResource != null) {
        contentVerPanel.remove(shelfResource);
    }
    if (collectionItemDo.getItemCount() == 0) {
        if (collectionDo.getType().equals("collection") || collectionDo.getType().equals("scollection")) {
            htmlPanel = new HTMLPanel(GL0854);
            htmlPanel.getElement().getStyle().setTextAlign(TextAlign.CENTER);
            htmlPanel.getElement().getStyle().setMarginLeft(19, Unit.PX);
            htmlPanel.getElement().getStyle().setColor("#999999");
            htmlPanel.getElement().getStyle().setFontStyle(FontStyle.ITALIC);
            htmlPanel.getElement().setId(collectionDo.getGooruOid());
            contentVerPanel.add(htmlPanel);
        }
    }
    /*if (collectionItemDo.getCollection().getCollectionItems().size() <= 0) {
       if (collectionDo.getType().equals("folder")) {
    htmlPanel = new HTMLPanel(GL0989);
    htmlPanel.getElement().getStyle().setTextAlign(TextAlign.CENTER);
    htmlPanel.getElement().getStyle().setMarginLeft(19, Unit.PX);
    htmlPanel.getElement().getStyle().setColor("#999999");
    htmlPanel.getElement().setId(collectionDo.getGooruOid());
    contentVerPanel.add(htmlPanel);
       } else if (collectionDo.getType().equals("collection") || collectionDo.getType().equals("scollection") ) {
    htmlPanel = new HTMLPanel(GL0854);
    htmlPanel.getElement().getStyle().setTextAlign(TextAlign.CENTER);
    htmlPanel.getElement().getStyle().setMarginLeft(19, Unit.PX);
    htmlPanel.getElement().getStyle().setColor("#999999");
    htmlPanel.getElement().getStyle().setFontStyle(FontStyle.ITALIC);
    htmlPanel.getElement().setId(collectionDo.getGooruOid());
    contentVerPanel.add(htmlPanel);
       }
    }*/
}

From source file:org.ednovo.gooru.client.mvp.shelf.list.ShelfCollection.java

License:Open Source License

public void setAllResources(List<FolderDo> folderDo) {
    contentVerPanel.clear();//from  w w w .j a  va2  s  . c  om
    if (folderDo.size() > 0) {
        for (FolderDo folderItemDo : folderDo) {
            addCollectionItem(folderItemDo, false);
        }
    } else {
        contentVerPanel.clear();
        htmlPanel = new HTMLPanel(GL0854);
        htmlPanel.getElement().getStyle().setTextAlign(TextAlign.CENTER);
        htmlPanel.getElement().getStyle().setMarginLeft(19, Unit.PX);
        htmlPanel.getElement().getStyle().setColor("#999999");
        htmlPanel.getElement().getStyle().setFontStyle(FontStyle.ITALIC);
        htmlPanel.getElement().setId(collectionDo.getGooruOid());
        contentVerPanel.add(htmlPanel);
    }
}

From source file:org.ednovo.gooru.client.mvp.shelf.list.ShelfFolderCollection.java

License:Open Source License

public void setData(CollectionDo collectionDo) {
    updateData(collectionDo);//w  w w  . jav a  2  s .  c  o  m
    if (this.collectionDo.getCollectionItems() == null) {
        this.collectionDo.setCollectionItems(new ArrayList<CollectionItemDo>());
    }
    if (collectionDo.getCollectionItems().size() > 0) {
        for (CollectionItemDo collectionItem : collectionDo.getCollectionItems()) {
            addCollectionItem(collectionItem, false);
        }
    } else {
        htmlPanel = new HTMLPanel(GL0854 + GL_SPL_EXCLAMATION + GL_SPL_EXCLAMATION + GL_SPL_EXCLAMATION
                + GL_SPL_EXCLAMATION + GL_SPL_EXCLAMATION);
        htmlPanel.getElement().getStyle().setTextAlign(TextAlign.CENTER);
        htmlPanel.getElement().getStyle().setMarginLeft(19, Unit.PX);
        htmlPanel.getElement().getStyle().setColor("#999999");
        htmlPanel.getElement().getStyle().setFontStyle(FontStyle.ITALIC);
        htmlPanel.getElement().setId(collectionDo.getGooruOid());
    }
}

From source file:org.ednovo.gooru.client.mvp.shelf.list.ShelfFolderCollection.java

License:Open Source License

/**
 * Remove the collection item from the collection
 * //  ww w  . j a v a 2 s  .  c  o  m
 * @param collectionItemDo
 *            which is to be removed
 */
public void removeCollectionItem(CollectionItemDo collectionItemDo) {

    this.collectionDo.getCollectionItems().remove(collectionItemDo);
    ShelfResource shelfResource = getShelfResource(collectionItemDo.getCollectionItemId());
    if (shelfResource != null) {
    }
    if (collectionItemDo.getCollection().getCollectionItems().size() <= 0) {
        htmlPanel = new HTMLPanel(GL0854);
        htmlPanel.getElement().getStyle().setTextAlign(TextAlign.CENTER);
        htmlPanel.getElement().getStyle().setMarginLeft(19, Unit.PX);
        htmlPanel.getElement().getStyle().setColor("#999999");
        htmlPanel.getElement().getStyle().setFontStyle(FontStyle.ITALIC);
        htmlPanel.getElement().setId(collectionDo.getGooruOid());
    }
}