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);
}
}
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);
}
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);
}
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);
}
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);
}
Aggregations