Search in sources :

Example 11 with Icon

use of org.gwtbootstrap3.client.ui.Icon 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)

Example 12 with Icon

use of org.gwtbootstrap3.client.ui.Icon 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 13 with Icon

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

the class BS3IconTypeGlyphRenderer method render.

@Override
public IsElement render(final BS3IconTypeGlyph glyph, final double width, final double height) {
    final WidgetElementRendererView view = viewInstanceSupplier.get();
    final Icon icon = new Icon(glyph.getIconType());
    return view.setWidget(icon);
}
Also used : Icon(org.gwtbootstrap3.client.ui.Icon) WidgetElementRendererView(org.kie.workbench.common.stunner.core.client.components.views.WidgetElementRendererView)

Example 14 with Icon

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

the class AbstractToolbarItem method show.

public void show(final Toolbar<S> toolbar, final S session, final AbstractToolbarCommand<S, ?> command, final Command clickHandler) {
    // Initialize the command with the current session.
    command.initialize(toolbar, session);
    final IconType icon = command.getIcon();
    final String caption = command.getCaption();
    if (icon != null) {
        view.setIcon(command.getIcon());
        view.setIconRotate(command.getIconRotate());
    } else {
        view.setCaption(caption);
    }
    view.setTooltip(command.getTooltip());
    view.setClickHandler(clickHandler);
}
Also used : IconType(org.gwtbootstrap3.client.ui.constants.IconType)

Example 15 with Icon

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

the class NotificationWidgetViewImpl method initEdit.

private void initEdit() {
    AbstractCell<NotificationRow> buttonCell = new AbstractCell<NotificationRow>(ClickEvent.getType().getName()) {

        @Override
        public void render(Context context, NotificationRow value, SafeHtmlBuilder sb) {
            Button button = new Button();
            button.setSize(ButtonSize.SMALL);
            button.add(new Icon(IconType.EDIT));
            sb.append(SafeHtmlUtils.fromTrustedString(button.toString()));
        }

        @Override
        public void onBrowserEvent(Context context, Element parent, NotificationRow value, NativeEvent event, ValueUpdater<NotificationRow> valueUpdater) {
            if (!readOnly) {
                addOrEdit(value);
            }
        }
    };
    Column<NotificationRow, NotificationRow> editColumn = new Column<NotificationRow, NotificationRow>(buttonCell) {

        @Override
        public NotificationRow getValue(NotificationRow object) {
            return object;
        }
    };
    editColumn.setSortable(false);
    table.addColumn(editColumn, StunnerFormsClientFieldsConstants.CONSTANTS.Edit());
    table.setColumnWidth(editColumn, 50, Style.Unit.PX);
}
Also used : Button(org.gwtbootstrap3.client.ui.Button) ValueUpdater(com.google.gwt.cell.client.ValueUpdater) Column(com.google.gwt.user.cellview.client.Column) HTMLButtonElement(elemental2.dom.HTMLButtonElement) Element(com.google.gwt.dom.client.Element) NotificationRow(org.kie.workbench.common.stunner.bpmn.client.forms.fields.model.NotificationRow) AbstractCell(com.google.gwt.cell.client.AbstractCell) Icon(org.gwtbootstrap3.client.ui.Icon) SafeHtmlBuilder(com.google.gwt.safehtml.shared.SafeHtmlBuilder) NativeEvent(com.google.gwt.dom.client.NativeEvent)

Aggregations

Icon (org.gwtbootstrap3.client.ui.Icon)8 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)4 Widget (com.google.gwt.user.client.ui.Widget)4 Button (org.gwtbootstrap3.client.ui.Button)4 AbstractCell (com.google.gwt.cell.client.AbstractCell)3 ValueUpdater (com.google.gwt.cell.client.ValueUpdater)3 GWT (com.google.gwt.core.client.GWT)3 Element (com.google.gwt.dom.client.Element)3 NativeEvent (com.google.gwt.dom.client.NativeEvent)3 EventBus (com.google.gwt.event.shared.EventBus)3 SafeHtmlBuilder (com.google.gwt.safehtml.shared.SafeHtmlBuilder)3 Column (com.google.gwt.user.cellview.client.Column)3 DOM (com.google.gwt.user.client.DOM)3 Window (com.google.gwt.user.client.Window)3 FlexTable (com.google.gwt.user.client.ui.FlexTable)3 FlexCellFormatter (com.google.gwt.user.client.ui.FlexTable.FlexCellFormatter)3 HTML (com.google.gwt.user.client.ui.HTML)3 HasHorizontalAlignment (com.google.gwt.user.client.ui.HasHorizontalAlignment)3 HasVerticalAlignment (com.google.gwt.user.client.ui.HasVerticalAlignment)3 HorizontalPanel (com.google.gwt.user.client.ui.HorizontalPanel)3