Search in sources :

Example 11 with Anchor

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

the class MenuView method activateAnchorFromHref.

private void activateAnchorFromHref(String href) {
    Anchor anchor = anchorList.stream().filter(a -> {
        // $NON-NLS-1$
        String[] split = a.getHref().split("#");
        boolean result = false;
        if (split.length > 1) {
            result = href.startsWith(split[1]);
        }
        return result;
    }).findFirst().orElse(null);
    if (anchor != null) {
        anchor.getParent().addStyleName(Styles.ACTIVE);
    }
}
Also used : Anchor(org.gwtbootstrap3.client.ui.Anchor)

Example 12 with Anchor

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

the class MenuView method createSecondaryMenuItem.

private IsWidget createSecondaryMenuItem(String label, String href) {
    ListGroup listGroup = new ListGroup();
    ListGroupItem item = new ListGroupItem();
    listGroup.add(item);
    Anchor secondaryMenuItemAnchor = new Anchor(hashifyString(href));
    Span labelSpan = new Span();
    labelSpan.getElement().setInnerSafeHtml(SafeHtmlUtils.fromString(label));
    labelSpan.addStyleName(PatternflyStyles.LIST_GROUP_ITEM_VALUE);
    secondaryMenuItemAnchor.add(labelSpan);
    item.add(secondaryMenuItemAnchor);
    return listGroup;
}
Also used : Anchor(org.gwtbootstrap3.client.ui.Anchor) ListGroup(org.gwtbootstrap3.client.ui.ListGroup) ListGroupItem(org.gwtbootstrap3.client.ui.ListGroupItem) Span(org.gwtbootstrap3.client.ui.html.Span)

Example 13 with Anchor

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

the class MenuView method addPrimaryMenuItemContainer.

public int addPrimaryMenuItemContainer(int index, String label, String iconCssName) {
    ListGroupItem newMenuItem = new ListGroupItem();
    Anchor menuAnchor = new Anchor(JAVASCRIPT);
    if (index < 0) {
        index = 0;
    }
    Span iconSpan = new Span();
    if (iconCssName != null) {
        iconSpan.addStyleName(determineCssIconBase(iconCssName));
        iconSpan.addStyleName(iconCssName);
        newMenuItem.addStyleName(Styles.ACTIVE);
    }
    menuAnchor.add(iconSpan);
    Span labelSpan = new Span();
    labelSpan.setText(label);
    labelSpan.addStyleName(PatternflyStyles.LIST_GROUP_ITEM_VALUE);
    menuAnchor.add(labelSpan);
    newMenuItem.add(menuAnchor);
    createSecondaryMenuHeader(newMenuItem);
    newMenuItem.addStyleName(PatternflyStyles.SECONDARY_NAV_ITEM);
    if (index > menuListGroup.getWidgetCount()) {
        menuListGroup.add(newMenuItem);
    } else {
        menuListGroup.insert(newMenuItem, index);
    }
    return menuListGroup.getWidgetIndex(newMenuItem);
}
Also used : Anchor(org.gwtbootstrap3.client.ui.Anchor) ListGroupItem(org.gwtbootstrap3.client.ui.ListGroupItem) Span(org.gwtbootstrap3.client.ui.html.Span)

Example 14 with Anchor

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

the class AbstractMainWithDetailsTableView method setActiveTags.

public void setActiveTags(List<TagModel> tags) {
    resultList.clear();
    for (final TagModel tag : tags) {
        ListItem tagItem = new ListItem();
        Span label = new Span();
        label.addStyleName(Styles.LABEL);
        label.addStyleName(PatternflyConstants.PF_LABEL_INFO);
        label.setText(tag.getName().getEntity());
        Anchor deactivateAnchor = new Anchor();
        Span closeIconSpan = new Span();
        closeIconSpan.addStyleName(PatternflyIconType.PF_BASE.getCssName());
        closeIconSpan.addStyleName(PatternflyIconType.PF_CLOSE.getCssName());
        deactivateAnchor.add(closeIconSpan);
        deactivateAnchor.addClickHandler(new ClickHandler() {

            @Override
            public void onClick(ClickEvent event) {
                tag.setSelection(false);
            }
        });
        label.add(deactivateAnchor);
        tagItem.add(label);
        resultList.add(tagItem);
    }
    resultRow.setVisible(!tags.isEmpty());
}
Also used : Anchor(org.gwtbootstrap3.client.ui.Anchor) ClickHandler(com.google.gwt.event.dom.client.ClickHandler) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) ListItem(org.gwtbootstrap3.client.ui.ListItem) TagModel(org.ovirt.engine.ui.uicommonweb.models.tags.TagModel) Span(org.gwtbootstrap3.client.ui.html.Span)

Example 15 with Anchor

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

the class NotificationListWidget method setInternalRowData.

private void setInternalRowData(int start, List<? extends AuditLog> values) {
    // Compare the new values with the ones currently displayed, if no changes, don't refresh.
    if (values != null && !valuesEquals(values)) {
        rowCount = values.size();
        boolean collapsed = checkIfCollapsed();
        currentValues = values;
        content.clear();
        eventPanelHeading = new PanelHeader();
        Heading titleHeading = new Heading(HeadingSize.H4);
        titleHeading.addStyleName(PatternflyConstants.PF_PANEL_TITLE);
        titleAnchor = new Anchor(hashString(thisWidgetId));
        titleAnchor.setDataParent(hashString(parentWidgetId));
        titleAnchor.setDataTarget(hashString(thisWidgetId));
        titleAnchor.setDataToggle(this.toggle);
        titleAnchor.setText(this.title);
        titleAnchor.addClickHandler(e -> e.preventDefault());
        if (collapsed) {
            titleAnchor.addStyleName(PatternflyConstants.COLLAPSED);
        }
        titleHeading.add(titleAnchor);
        eventPanelHeading.add(titleHeading);
        content.add(eventPanelHeading);
        PanelCollapse eventCollapse = new PanelCollapse();
        eventCollapse.setId(thisWidgetId);
        eventPanelBody = new PanelBody();
        if (this.containerHeight > 0) {
            eventPanelBody.getElement().getStyle().setProperty(MAX_HEIGHT, containerHeight + Unit.PX.getType());
            eventPanelBody.getElement().getStyle().setOverflowY(Overflow.AUTO);
        }
        eventCollapse.add(eventPanelBody);
        if (collapsed) {
            eventCollapse.getElement().setAttribute(ARIA_EXPANDED, String.valueOf(false));
            eventCollapse.getElement().getStyle().setHeight(0, Unit.PX);
        } else {
            eventCollapse.getElement().setAttribute(ARIA_EXPANDED, String.valueOf(true));
            eventCollapse.addStyleName(Styles.IN);
        }
        content.add(eventCollapse);
        for (final AuditLog auditLog : values) {
            DrawerNotification notification = new DrawerNotification(auditLog);
            for (int i = 0; i < actionLabels.size(); i++) {
                final int index = i;
                ActionAnchorListItem listItem = new ActionAnchorListItem(actionLabels.get(index));
                listItem.addClickHandler(e -> auditLogActions.get(index).executeCommand(actionCommand.get(index), auditLog));
                notification.addActionButton(listItem);
            }
            eventPanelBody.add(notification);
        }
        if (clearAllActionLabel != null) {
            actionPanel = new FlowPanel();
            actionPanel.addStyleName(PatternflyConstants.PF_DRAWER_ACTION);
            eventCollapse.add(actionPanel);
            Button clearAllbutton = new Button(clearAllActionLabel);
            clearAllbutton.addStyleName(BTN_LINK);
            clearAllbutton.addStyleName(Styles.BTN_BLOCK);
            clearAllbutton.removeStyleName(BTN_DEFAULT);
            clearAllbutton.addClickHandler(event -> clearAllActionCallback.executeCommand(clearAllActionCommand, null));
            actionPanel.add(clearAllbutton);
            Button restoreAllbutton = new Button(restoreAllActionLabel);
            restoreAllbutton.addStyleName(BTN_LINK);
            restoreAllbutton.addStyleName(Styles.BTN_BLOCK);
            restoreAllbutton.removeStyleName(BTN_DEFAULT);
            restoreAllbutton.addClickHandler(event -> restoreAllActionCallback.executeCommand(restoreAllActionCommand, null));
            actionPanel.add(restoreAllbutton);
        }
    }
}
Also used : ActionAnchorListItem(org.ovirt.engine.ui.common.widget.action.ActionAnchorListItem) Heading(org.gwtbootstrap3.client.ui.Heading) Anchor(org.gwtbootstrap3.client.ui.Anchor) PanelHeader(org.gwtbootstrap3.client.ui.PanelHeader) Button(org.gwtbootstrap3.client.ui.Button) FlowPanel(com.google.gwt.user.client.ui.FlowPanel) PanelBody(org.gwtbootstrap3.client.ui.PanelBody) PanelCollapse(org.gwtbootstrap3.client.ui.PanelCollapse) AuditLog(org.ovirt.engine.core.common.businessentities.AuditLog)

Aggregations

Anchor (org.gwtbootstrap3.client.ui.Anchor)13 Span (org.gwtbootstrap3.client.ui.html.Span)5 ListGroupItem (org.gwtbootstrap3.client.ui.ListGroupItem)4 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)3 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)3 FlowPanel (com.google.gwt.user.client.ui.FlowPanel)3 Button (org.gwtbootstrap3.client.ui.Button)2 Heading (org.gwtbootstrap3.client.ui.Heading)2 IsWidget (com.google.gwt.user.client.ui.IsWidget)1 Widget (com.google.gwt.user.client.ui.Widget)1 Icon (org.gwtbootstrap3.client.ui.Icon)1 ListGroup (org.gwtbootstrap3.client.ui.ListGroup)1 ListItem (org.gwtbootstrap3.client.ui.ListItem)1 PanelBody (org.gwtbootstrap3.client.ui.PanelBody)1 PanelCollapse (org.gwtbootstrap3.client.ui.PanelCollapse)1 PanelHeader (org.gwtbootstrap3.client.ui.PanelHeader)1 Tooltip (org.gwtbootstrap3.client.ui.Tooltip)1 Div (org.gwtbootstrap3.client.ui.html.Div)1 Paragraph (org.gwtbootstrap3.client.ui.html.Paragraph)1 AuditLog (org.ovirt.engine.core.common.businessentities.AuditLog)1