Search in sources :

Example 1 with Tooltip

use of org.gwtbootstrap3.client.ui.Tooltip in project ovirt-engine by oVirt.

the class VmInterfaceListGroupItem method createCardPluggedStatusPanel.

private IsWidget createCardPluggedStatusPanel(boolean isPlugged) {
    Span linkStatusPanel = new Span();
    Span icon = new Span();
    icon.addStyleName(Styles.ICON_STACK);
    Italic plugItalic = new Italic();
    plugItalic.addStyleName(Styles.FONT_AWESOME_BASE);
    plugItalic.addStyleName(Styles.ICON_STACK_TOP);
    plugItalic.addStyleName(ROTATE_270);
    plugItalic.addStyleName(IconType.PLUG.getCssName());
    icon.add(plugItalic);
    if (!isPlugged) {
        Italic unplugged = new Italic();
        unplugged.addStyleName(Styles.FONT_AWESOME_BASE);
        unplugged.addStyleName(Styles.ICON_STACK_TOP);
        unplugged.addStyleName(DANGER);
        unplugged.addStyleName(IconType.BAN.getCssName());
        icon.add(unplugged);
    }
    linkStatusPanel.add(icon);
    linkStatusPanel.addStyleName(DOUBLE_SIZE);
    String tooltipText = isPlugged ? constants.pluggedNetworkInterface() : constants.unpluggedNetworkInterface();
    WidgetTooltip tooltip = new WidgetTooltip(linkStatusPanel);
    tooltip.setHtml(SafeHtmlUtils.fromString(tooltipText));
    return tooltip;
}
Also used : Italic(org.gwtbootstrap3.client.ui.html.Italic) Span(org.gwtbootstrap3.client.ui.html.Span) WidgetTooltip(org.ovirt.engine.ui.common.widget.tooltip.WidgetTooltip)

Example 2 with Tooltip

use of org.gwtbootstrap3.client.ui.Tooltip in project kie-wb-common by kiegroup.

the class BreadcrumbNavigator method createElement.

private void createElement(final int row, final FolderItem folderItem, final IconType iconType, final String style, final Command onClick) {
    final Boolean locked = (folderItem.getLockedBy() != null);
    final Boolean lockOwned = (locked && folderItem.getLockedBy().equals(user.getIdentifier()));
    final Boolean hasLockedItems = folderItem.hasLockedItems();
    int col = 0;
    final Icon icon = new Icon(iconType);
    icon.addStyleName(style);
    navigator.setWidget(row, col, icon);
    col++;
    if (locked) {
        final Icon lock = new Icon(IconType.LOCK);
        if (lockOwned) {
            lock.getElement().getStyle().setColor("#0083d0");
        }
        final Tooltip lockTooltip = new Tooltip(lock);
        lockTooltip.setTitle((lockOwned) ? ProjectExplorerConstants.INSTANCE.lockOwnedHint() : ProjectExplorerConstants.INSTANCE.lockHint() + " " + folderItem.getLockedBy());
        lockTooltip.setPlacement(Placement.TOP);
        lockTooltip.setShowDelayMs(1000);
        navigator.setWidget(row, col, lockTooltip);
    }
    final Anchor anchor = GWT.create(Anchor.class);
    anchor.setText(folderItem.getFileName().replaceAll(" ", "\u00a0"));
    anchor.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            onClick.execute();
        }
    });
    navigator.setWidget(row, ++col, anchor);
    final Div iconContainer = new Div();
    iconContainer.setPull(Pull.RIGHT);
    iconContainer.addStyleName(ProjectExplorerResources.INSTANCE.CSS().iconContainer());
    if (folderItem.canDoOperation(FolderItemOperation.COPY)) {
        final Icon copyContainer = new Icon(IconType.COPY);
        copyContainer.addClickHandler(new ClickHandler() {

            @Override
            public void onClick(ClickEvent event) {
                presenter.copyItem(folderItem);
            }
        });
        final Tooltip copyTooltip = new Tooltip(copyContainer, CommonConstants.INSTANCE.Copy());
        copyTooltip.setPlacement(Placement.TOP);
        copyTooltip.setShowDelayMs(1000);
        iconContainer.add(copyTooltip);
    }
    if (folderItem.canDoOperation(FolderItemOperation.RENAME)) {
        final Boolean disabledRename = (locked && !lockOwned) || hasLockedItems;
        final Widget renameContainer = getRenameIcon(disabledRename);
        renameContainer.addDomHandler(new ClickHandler() {

            @Override
            public void onClick(ClickEvent event) {
                if (!disabledRename) {
                    presenter.renameItem(folderItem);
                }
            }
        }, ClickEvent.getType());
        final Tooltip renameTooltip = new Tooltip(renameContainer, CommonConstants.INSTANCE.Rename());
        renameTooltip.setPlacement(Placement.TOP);
        renameTooltip.setShowDelayMs(1000);
        iconContainer.add(renameTooltip);
    }
    if (folderItem.canDoOperation(FolderItemOperation.DELETE)) {
        final Boolean disabledDelete = (locked && !lockOwned) || hasLockedItems;
        final Widget deleteContainer = getDeleteIcon(disabledDelete);
        deleteContainer.addDomHandler(new ClickHandler() {

            @Override
            public void onClick(ClickEvent event) {
                if (!disabledDelete) {
                    presenter.deleteItem(folderItem);
                }
            }
        }, ClickEvent.getType());
        final Tooltip deleteTooltip = new Tooltip(deleteContainer, CommonConstants.INSTANCE.Delete());
        deleteTooltip.setPlacement(Placement.TOP);
        deleteTooltip.setShowDelayMs(1000);
        iconContainer.add(deleteTooltip);
    }
    if (folderItem.getType().equals(FolderItemType.FOLDER) && folderItem.canDoOperation(FolderItemOperation.ARCHIVE)) {
        final Icon archiveContainer = new Icon(IconType.ARCHIVE);
        archiveContainer.addClickHandler(new ClickHandler() {

            @Override
            public void onClick(ClickEvent event) {
                presenter.uploadArchivedFolder(folderItem);
            }
        });
        final Tooltip archiveTooltip = new Tooltip(archiveContainer, CommonConstants.INSTANCE.Archive());
        archiveTooltip.setPlacement(Placement.TOP);
        archiveTooltip.setShowDelayMs(1000);
        iconContainer.add(archiveTooltip);
    }
    navigator.setWidget(row, ++col, iconContainer);
}
Also used : Div(org.gwtbootstrap3.client.ui.html.Div) Anchor(org.gwtbootstrap3.client.ui.Anchor) ClickHandler(com.google.gwt.event.dom.client.ClickHandler) Tooltip(org.gwtbootstrap3.client.ui.Tooltip) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) Widget(com.google.gwt.user.client.ui.Widget) Icon(org.gwtbootstrap3.client.ui.Icon)

Example 3 with Tooltip

use of org.gwtbootstrap3.client.ui.Tooltip in project ovirt-engine by oVirt.

the class DropdownActionButton method initDropdownButton.

private void initDropdownButton(IconType icon, boolean splitButton) {
    button = new Button();
    caretButton = new Button();
    caretButton.setDataToggle(Toggle.DROPDOWN);
    caretButton.setToggleCaret(true);
    if (splitButton) {
        caretButton.getElement().getStyle().setMarginLeft(0, Unit.PX);
        caretButton.getElement().getStyle().setLeft(-1, Unit.PX);
        textButton = button;
        toolTip = new WidgetTooltip(textButton);
        add(toolTip);
        add(caretButton);
    } else {
        textButton = caretButton;
        toolTip = new WidgetTooltip(textButton);
        add(toolTip);
    }
    if (icon != null) {
        textButton.setIcon(icon);
    }
}
Also used : Button(org.gwtbootstrap3.client.ui.Button) WidgetTooltip(org.ovirt.engine.ui.common.widget.tooltip.WidgetTooltip)

Aggregations

WidgetTooltip (org.ovirt.engine.ui.common.widget.tooltip.WidgetTooltip)2 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)1 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)1 Widget (com.google.gwt.user.client.ui.Widget)1 Anchor (org.gwtbootstrap3.client.ui.Anchor)1 Button (org.gwtbootstrap3.client.ui.Button)1 Icon (org.gwtbootstrap3.client.ui.Icon)1 Tooltip (org.gwtbootstrap3.client.ui.Tooltip)1 Div (org.gwtbootstrap3.client.ui.html.Div)1 Italic (org.gwtbootstrap3.client.ui.html.Italic)1 Span (org.gwtbootstrap3.client.ui.html.Span)1