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

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

Introduction

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

Prototype

protected HTML(Element element) 

Source Link

Document

This constructor may be used by subclasses to explicitly use an existing element.

Usage

From source file:com.cubusmail.client.widgets.AttachmentWidget.java

License:Open Source License

public AttachmentWidget(GWTAttachment attachment) {

    super();//  w w w  .  j av a 2  s . c  om
    this.attachment = attachment;

    FlowPanel panel = new FlowPanel();
    initWidget(panel);
    setStyleName("attachmentWidget");

    ShowContextMenuHandler menuHandler = new ShowContextMenuHandler();

    ImageHyperlink link = new ImageHyperlink(
            new Image(GWT.getHostPageBaseURL() + ImageProvider.IMAGE_PREFIX + ImageProvider.MSG_ATTACHMENT),
            attachment.getFileName());
    link.addLeftButtonHandler(menuHandler);
    link.addRightButtonHandler(menuHandler);
    panel.add(link);

    panel.add(new HTML(" (" + attachment.getSizeText() + ") "));
    // if ( attachment.isPreview() ) {
    // ToolTip tip = new ToolTip();
    // String url = ServiceProvider.getRetrieveImageServletUrl(
    // attachment.getMessageId(), attachment.getIndex(),
    // true );
    // tip.setHtml( "<img src=\"" + url + "\"/>" );
    // tip.setWidth( 300 );
    // tip.setHeight( 200 );
    // tip.applyTo( this.getElement() );
    // }
    ImageHyperlink downloadLink = new ImageHyperlink(
            new Image(GWT.getHostPageBaseURL() + ImageProvider.IMAGE_PREFIX + ImageProvider.MSG_DOWNLOAD));
    downloadLink.addLeftButtonHandler(new DownloadLeftButtonListener());
    panel.add(downloadLink);
    panel.add(new HTML("&nbsp;&nbsp;&nbsp; "));
}

From source file:com.cubusmail.gwtui.client.panels.AttachmentPanel.java

License:Open Source License

/**
 * @param title//from   ww w  . j av a  2s  . com
 */
public AttachmentPanel(GWTAttachment attachment) {

    super();

    FlowPanel panel = new FlowPanel();
    initWidget(panel);
    DOM.setStyleAttribute(panel.getElement(), "whiteSpace", "nowrap");
    DOM.setStyleAttribute(getElement(), "whiteSpace", "nowrap");

    ImageHyperlink link = new ImageHyperlink(
            new Image(GWT.getHostPageBaseURL() + ImageProvider.MSG_ATTACHMENT));
    link.addLeftButtonListener(new MainLinkLeftButtonListener());
    link.addRightButtonListener(new MainLinkRightButtonListener());
    panel.add(link);

    ImageHyperlink link2 = new ImageHyperlink();
    link2.setText(attachment.getFileName());
    link2.addLeftButtonListener(new MainLinkLeftButtonListener());
    link2.addRightButtonListener(new MainLinkRightButtonListener());
    panel.add(link2);

    panel.add(new HTML("&nbsp;(" + attachment.getSizeText() + ")&nbsp;"));
    if (attachment.isPreview()) {
        ToolTip tip = new ToolTip();
        String url = ServiceProvider.getRetrieveImageServletUrl(attachment.getMessageId(),
                attachment.getIndex(), true);
        tip.setHtml("<img src=\"" + url + "\"/>");
        tip.setWidth(300);
        tip.setHeight(200);
        tip.applyTo(this.getElement());
    }
    ImageHyperlink downloadLink = new ImageHyperlink(
            new Image(GWT.getHostPageBaseURL() + ImageProvider.MSG_DOWNLOAD));
    downloadLink.addLeftButtonListener(new DownloadLeftButtonListener());
    panel.add(downloadLink);
    panel.add(new HTML("&nbsp;&nbsp;&nbsp;"));

    this.downloadAttachmentAction = new DownloadAttachmentAction(attachment);
    this.viewAttachmentAction = new ViewAttachmentAction(attachment);

    this.contextMenu = new Menu();
    this.downloadItem = UIFactory.createMenuItem(this.downloadAttachmentAction);
    this.contextMenu.addItem(this.downloadItem);
    this.viewItem = UIFactory.createMenuItem(this.viewAttachmentAction);
    this.contextMenu.addItem(this.viewItem);
}

From source file:com.cubusmail.gwtui.client.panels.ComposeAttachmentPanel.java

License:Open Source License

/**
 * //from   www.j  a va 2s . c om
 */
public ComposeAttachmentPanel(GWTAttachment attachment, ComposeMessageWindow view) {

    FlowPanel panel = new FlowPanel();
    initWidget(panel);
    DOM.setStyleAttribute(panel.getElement(), "whiteSpace", "nowrap");
    DOM.setStyleAttribute(getElement(), "whiteSpace", "nowrap");

    ImageHyperlink link = new ImageHyperlink(
            new Image(GWT.getHostPageBaseURL() + ImageProvider.MSG_ATTACHMENT));
    link.addRightButtonListener(new MainLinkRightButtonListener());
    panel.add(link);

    ImageHyperlink link2 = new ImageHyperlink();
    link2.setText(attachment.getFileName());
    link2.addRightButtonListener(new MainLinkRightButtonListener());
    panel.add(link2);

    panel.add(new HTML("&nbsp;(" + attachment.getSizeText() + ",&nbsp;"));
    ImageHyperlink previewLink = new ImageHyperlink();
    previewLink.addLeftButtonListener(new RemoveLinkLeftButtonListener());
    previewLink.setText(TextProvider.get().common_remove_text());
    panel.add(previewLink);
    panel.add(new HTML(")&nbsp;&nbsp;&nbsp;&nbsp;"));

    this.removeAttachmentAction = new RemoveAttachmentAction(attachment, view);
    this.contextMenu = new Menu();
    this.removeItem = UIFactory.createMenuItem(this.removeAttachmentAction);
    this.contextMenu.addItem(this.removeItem);
}

From source file:com.cubusmail.gwtui.client.widgets.EmailAddressLink.java

License:Open Source License

public EmailAddressLink(GWTAddress address, boolean withSeparator) {

    super();/*from  www . j  a v a2  s .c  o m*/

    FlowPanel panel = new FlowPanel();
    initWidget(panel);
    DOM.setStyleAttribute(panel.getElement(), "whiteSpace", "nowrap");
    DOM.setStyleAttribute(getElement(), "whiteSpace", "nowrap");

    ImageHyperlink link = new ImageHyperlink();
    link.setText(address.getInternetAddress());

    AddContactFromEmailAddressAction addContactAction = new AddContactFromEmailAddressAction();
    addContactAction.setAddress(address);
    NewMessageToEmailAddressAction newMessageAction = new NewMessageToEmailAddressAction();
    newMessageAction.setAddress(address);

    this.contextMenu = new Menu();
    this.contextMenu.addItem(UIFactory.createMenuItem(addContactAction));
    this.contextMenu.addItem(UIFactory.createMenuItem(newMessageAction));

    MouseListenerAdapter listener = new MouseListenerAdapter() {

        @Override
        public void onMouseDown(Widget sender, int x, int y) {

            contextMenu.showAt(sender.getAbsoluteLeft() + x + 10, sender.getAbsoluteTop() + y);
        }
    };
    link.addLeftButtonListener(listener);
    link.addRightButtonListener(listener);

    panel.add(link);
    if (withSeparator) {
        panel.add(new HTML(",&nbsp;&nbsp;"));
    }
}

From source file:com.databasepreservation.visualization.client.common.lists.AsyncTableCell.java

public AsyncTableCell(Filter filter, boolean justActive, Facets facets, String summary, boolean selectable,
        boolean exportable, int initialPageSize, int pageSizeIncrement, O object) {
    super();//from   w ww  . j  a  va  2 s .c o  m

    this.initialPageSize = initialPageSize;
    this.pageSizeIncrement = pageSizeIncrement;
    this.object = object;

    if (summary == null) {
        summary = "summary" + Random.nextInt(1000);
    }

    this.filter = filter;
    this.justActive = justActive;
    this.facets = facets;
    this.selectable = selectable;

    display = new AccessibleCellTable<T>(getInitialPageSize(),
            (MyCellTableResources) GWT.create(MyCellTableResources.class), getKeyProvider(), summary);
    display.setKeyboardSelectionPolicy(KeyboardSelectionPolicy.DISABLED);
    display.setLoadingIndicator(new HTML(SafeHtmlUtils.fromSafeConstant(
            "<div class='spinner'><div class='double-bounce1'></div><div class='double-bounce2'></div></div>")));

    configure(display);

    this.dataProvider = new MyAsyncDataProvider<T>(display, new IndexResultDataProvider<T>() {

        @Override
        public void getData(Sublist sublist, ColumnSortList columnSortList,
                AsyncCallback<IndexResult<T>> callback) {
            AsyncTableCell.this.getData(sublist, columnSortList, callback);
        }
    }) {

        @Override
        protected void fireChangeEvent(IndexResult<T> result) {
            ValueChangeEvent.fire(AsyncTableCell.this, result);
        }
    };

    dataProvider.addDataDisplay(display);

    if (exportable) {
        // mimic PageSizePager
        exportButtons = new FlexTable();
        exportButtons.setCellPadding(0);
        exportButtons.setCellSpacing(0);

        exportVisibleButton = new Anchor("Export visible");
        exportVisibleButton.addClickHandler(new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
                AsyncTableCell.this.exportVisibleClickHandler();
            }
        });

        exportAllButton = new Anchor("Export all");
        exportAllButton.addClickHandler(new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
                AsyncTableCell.this.exportAllClickHandler();
            }
        });

        exportButtons.setWidget(0, 0, exportVisibleButton);
        exportButtons.setText(0, 1, " | ");
        exportButtons.setWidget(0, 2, exportAllButton);
    }

    resultsPager = new AccessibleSimplePager(AccessibleSimplePager.TextLocation.LEFT,
            (SimplePager.Resources) GWT.create(SimplePager.Resources.class), false, initialPageSize, false,
            false, (SimplePager.ImageButtonsConstants) GWT.create(SimplePager.ImageButtonsConstants.class));
    resultsPager.setDisplay(display);

    pageSizePager = new PageSizePager(getPageSizePagerIncrement());
    pageSizePager.setDisplay(display);

    createSelectAllPanel();

    displayScroll = new ScrollPanel(display);
    displayScrollWrapper = new SimplePanel(displayScroll);

    add(selectAllPanel);
    add(displayScrollWrapper);
    add(resultsPager);
    if (exportButtons != null) {
        add(exportButtons);
    }
    add(pageSizePager);

    selectionModel = new SingleSelectionModel<>(getKeyProvider());

    Handler<T> selectionEventManager = getSelectionEventManager();
    if (selectionEventManager != null) {
        display.setSelectionModel(selectionModel, selectionEventManager);
    } else {
        display.setSelectionModel(selectionModel);
    }

    columnSortHandler = new AsyncHandler(display);
    display.addColumnSortHandler(columnSortHandler);

    display.addLoadingStateChangeHandler(new LoadingStateChangeEvent.Handler() {
        @Override
        public void onLoadingStateChanged(LoadingStateChangeEvent event) {
            if (LoadingStateChangeEvent.LoadingState.LOADED.equals(event.getLoadingState())) {
                handleScrollChanges();
            }
        }
    });

    addStyleName("my-asyncdatagrid");
    resultsPager.addStyleName("my-asyncdatagrid-pager-results");
    pageSizePager.addStyleName("my-asyncdatagrid-pager-pagesize");
    displayScrollWrapper.addStyleName("my-asyncdatagrid-display-scroll-wrapper");
    display.addStyleName("my-asyncdatagrid-display");
    if (exportButtons != null) {
        exportButtons.addStyleName("my-asyncdatagrid-pager-pagesize");
        // exportVisibleButton.addStyleName("btn btn-export btn-export-visible");
        // exportAllButton.addStyleName("btn btn-export btn-export-all");
    }

    displayScroll.addScrollHandler(new ScrollHandler() {
        @Override
        public void onScroll(ScrollEvent event) {
            handleScrollChanges();
        }
    });

    addValueChangeHandler(new ValueChangeHandler<IndexResult<T>>() {
        @Override
        public void onValueChange(ValueChangeEvent<IndexResult<T>> event) {
            selected = new HashSet<T>();
            hideSelectAllPanel();
        }
    });

    Label emptyInfo = new Label(messages.noItemsToDisplay());
    display.setEmptyTableWidget(emptyInfo);
}

From source file:com.dawg6.web.dhcalc.client.MainPanel.java

License:Open Source License

protected void setNews(List<NewsItem> news) {
    newsPanel.clear();//from   w  ww .ja  v a 2 s  .  c o  m

    if (!news.isEmpty()) {
        newsPanel.setWidth("100%");
        CaptionPanel border = new CaptionPanel("News");
        border.setWidth("100%");
        newsPanel.add(border);

        VerticalPanel panel = new VerticalPanel();
        border.setContentWidget(panel);

        for (NewsItem n : news) {
            HorizontalPanel row = new HorizontalPanel();
            HTML label = new HTML(n.getText());
            label.addStyleName("boldText");
            row.add(label);
            panel.add(row);
        }
    }

}

From source file:com.dimdim.conference.ui.common.client.layout.DefaultCommonDialog.java

License:Open Source License

public static DefaultCommonDialog createDialog(String title, String message) {
    HTML html = new HTML(message);
    html.setStyleName("common-text");
    html.setWordWrap(true);//from  w w w . j av  a2s  . c  om

    DefaultCommonDialog dlg = new DefaultCommonDialog(title, html, "default-message");
    dlg.html = html;
    return dlg;
}

From source file:com.dimdim.conference.ui.common.client.layout.DefaultCommonDialog.java

License:Open Source License

public static void showMessage(String title, String message, String dialogName, PopupListener popupListener) {
    hideMessageBox();/*from  ww  w  .j  a v  a  2  s.c  om*/
    HTML html = new HTML(message);
    html.setStyleName("common-text");
    html.setWordWrap(true);
    dcd = new DefaultCommonDialog(title, html, dialogName);
    if (popupListener != null) {
        dcd.addPopupListener(popupListener);
    }
    dcd.drawDialog();
    dcd.addPopupListener(new PopupListener() {
        public void onPopupClosed(PopupPanel dialog, boolean autoClosed) {
            dcd = null;
        }
    });
    //      dcd = null;      
}

From source file:com.dimdim.conference.ui.common.client.tab.CommonTab.java

License:Open Source License

public Widget getSubtabsPanel() {
    if (this.subTabsPanel == null) {
        this.subTabsPanel = new HorizontalPanel();
        int size = this.subTabs.size();
        for (int i = 0; i < size; i++) {
            CommonSubTab subTab = (CommonSubTab) this.subTabs.elementAt(i);
            if (subTab.isTypeComment()) {
                subTab.addStyleName("common-text");
            } else {
                subTab.addStyleName("console-sub-tab-link");
            }//from  w ww.j  a  v  a 2  s.c om
            if (i > 0) {
                HTML seperator = new HTML("|");
                seperator.setStyleName("console-sub-tab-seperator");
                this.subTabsPanel.add(seperator);
            }

            this.subTabsPanel.add(subTab);
            if (subTab.getImage() != null) {
                this.subTabsPanel.add(subTab.getImage());
                this.subTabsPanel.setCellHorizontalAlignment(subTab, HorizontalPanel.ALIGN_RIGHT);
                this.subTabsPanel.setCellHorizontalAlignment(subTab.getImage(), HorizontalPanel.ALIGN_RIGHT);
            }
        }
        if (this.comment != null) {
            Label label = new Label(comment);
            label.setStyleName("common-text");
            this.subTabsPanel.add(label);
        }
        if (this.shareControlPanel != null) {
            this.subTabsPanel.add(this.shareControlPanel);
            this.subTabsPanel.setCellHorizontalAlignment(shareControlPanel, HorizontalPanel.ALIGN_RIGHT);
        }
    }
    return this.subTabsPanel;
}

From source file:com.dimdim.conference.ui.common.client.tab.CommonTabbedPage.java

License:Open Source License

protected void createPanels() {
    this.tabsPanel = new DockPanel();
    this.tabsPanel.setStyleName("dm-tab-bar");
    this.subTabsPanel = new DockPanel();
    this.subTabsPanel.setStyleName("dm-sub-tab-bar");
    this.contentPanel = new DockPanel();

    leftGroupTabs = new HorizontalPanel();
    tabsPanel.add(leftGroupTabs, DockPanel.WEST);
    tabsPanel.setCellVerticalAlignment(leftGroupTabs, VerticalPanel.ALIGN_BOTTOM);
    tabsPanel.setCellHorizontalAlignment(leftGroupTabs, HorizontalPanel.ALIGN_LEFT);

    leftGroupSubTabs = new HorizontalPanel();
    subTabsPanel.add(leftGroupSubTabs, DockPanel.WEST);
    subTabsPanel.setCellHorizontalAlignment(leftGroupSubTabs, HorizontalPanel.ALIGN_LEFT);
    subTabsPanel.setCellVerticalAlignment(leftGroupSubTabs, VerticalPanel.ALIGN_MIDDLE);

    leftGroupContentPanel = new VerticalPanel();
    leftGroupContentPanel.setStyleName("left-group-content-panel");
    contentPanel.add(leftGroupContentPanel, DockPanel.WEST);
    contentPanel.setCellHorizontalAlignment(leftGroupContentPanel, HorizontalPanel.ALIGN_CENTER);
    contentPanel.setCellVerticalAlignment(leftGroupContentPanel, VerticalPanel.ALIGN_TOP);

    poppedOutWorkspaceContent = new HorizontalPanel();
    poppedOutWorkspaceContent.add(new Label("."));

    leftTabGroup = new CommonTabGroup(this, name, CommonTabGroup.LEFT, leftGroupTabs, leftGroupSubTabs,
            leftGroupContentPanel, this.leftGroupContentWidth, this.leftGroupContentHeight);

    if (this.rightGroupName != null && this.rightGroupWidth != null) {
        this.rightGroupContentVisible = true;
        rightGroupTabs = new HorizontalPanel();
        rightGroupTabs.setWidth(rightGroupWidth);

        tabsPanel.add(rightGroupTabs, DockPanel.EAST);
        tabsPanel.setCellVerticalAlignment(rightGroupTabs, VerticalPanel.ALIGN_BOTTOM);
        tabsPanel.setCellHorizontalAlignment(rightGroupTabs, HorizontalPanel.ALIGN_RIGHT);

        rightGroupTabs.add(meetingClock);
        rightGroupTabs.setCellVerticalAlignment(meetingClock, VerticalPanel.ALIGN_BOTTOM);
        rightGroupTabs.setCellHorizontalAlignment(meetingClock, HorizontalPanel.ALIGN_RIGHT);

        rightGroupSubTabs = new HorizontalPanel();
        rightGroupSubTabs.setWidth(rightGroupWidth);
        subTabsPanel.add(rightGroupSubTabs, DockPanel.EAST);
        subTabsPanel.setCellHorizontalAlignment(rightGroupSubTabs, HorizontalPanel.ALIGN_RIGHT);
        subTabsPanel.setCellVerticalAlignment(rightGroupSubTabs, VerticalPanel.ALIGN_MIDDLE);

        rightGroupContentPanel = new VerticalPanel();
        rightGroupContentPanel.setWidth(rightGroupWidth);
        contentPanel.add(rightGroupContentPanel, DockPanel.EAST);
        contentPanel.setCellHorizontalAlignment(rightGroupContentPanel, HorizontalPanel.ALIGN_LEFT);
        contentPanel.setCellVerticalAlignment(rightGroupContentPanel, VerticalPanel.ALIGN_TOP);

        rightTabGroup = new CommonTabGroup(this, name, CommonTabGroup.RIGHT, rightGroupTabs, rightGroupSubTabs,
                rightGroupContentPanel, this.rightGroupContentWidth, this.rightGroupContentHeight);

        this.rightGroupHideControl = new Image("images/opentriangle.gif");//,15,15);
        this.rightGroupHideControl.addClickListener(this);
        this.rightGroupHideControl.setStyleName("hide-discuss-panel-button");
        rightTabGroup.setHideControl(this.rightGroupHideControl);
        rightTabGroup.setOpenControlListener(this);
    } else {/* w w  w .  ja v  a2s  . c  o  m*/
        //   Just to make sure that the subtabs panel expands horizontally.
        rightGroupSubTabs = new HorizontalPanel();
        rightGroupSubTabs.add(new HTML("&nbsp;"));
        subTabsPanel.add(rightGroupSubTabs, DockPanel.EAST);
        subTabsPanel.setCellHorizontalAlignment(rightGroupSubTabs, HorizontalPanel.ALIGN_RIGHT);
        subTabsPanel.setCellVerticalAlignment(rightGroupSubTabs, VerticalPanel.ALIGN_MIDDLE);
    }
    subTabsAndContentPanel = new DockPanel();
    subTabsAndContentPanel.setStyleName("dm-tab-content");
    subTabsAndContentPanel.add(subTabsPanel, DockPanel.NORTH);
    subTabsAndContentPanel.add(poppedOutWorkspaceContent, DockPanel.NORTH);
    this.poppedOutWorkspaceContent.setVisible(false);
    subTabsAndContentPanel.add(contentPanel, DockPanel.CENTER);
    roundedPanel = new RoundedPanel(subTabsAndContentPanel);

    tabbedPage.add(tabsPanel);
    tabbedPage.add(roundedPanel);
}