Search in sources :

Example 76 with Button

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

the class FunctionPolicyUnitPanel method initWidget.

@Override
public void initWidget() {
    FlowPanel namePanel = getNamePanel(policyUnit);
    if (!used) {
        namePanel.setStyleName(style.unusedPolicyUnitStyle());
    } else {
        final Label weightLabel = createWeightLabel();
        final Button downButton = createDownButton(weightLabel);
        if (factor == 1) {
            downButton.setEnabled(false);
        }
        Button upButton = createUpButton(weightLabel, downButton);
        if (!locked || policyUnit.isEnabled()) {
            namePanel.insert(upButton, 0);
        }
        namePanel.insert(weightLabel, 0);
        if (!locked || policyUnit.isEnabled()) {
            namePanel.insert(downButton, 0);
        }
        namePanel.setStyleName(style.usedFilterPolicyUnitStyle());
    }
    if (!policyUnit.isEnabled()) {
        namePanel.getElement().getStyle().setOpacity(0.5);
    }
    setWidget(namePanel);
}
Also used : Button(org.gwtbootstrap3.client.ui.Button) FlowPanel(com.google.gwt.user.client.ui.FlowPanel) Label(com.google.gwt.user.client.ui.Label)

Example 77 with Button

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

Button (org.gwtbootstrap3.client.ui.Button)71 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)33 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)33 FormStylePopup (org.uberfire.ext.widgets.common.client.common.popups.FormStylePopup)14 SmallLabel (org.uberfire.ext.widgets.common.client.common.SmallLabel)12 HTML (com.google.gwt.user.client.ui.HTML)10 ListBox (org.gwtbootstrap3.client.ui.ListBox)10 ChangeEvent (com.google.gwt.event.dom.client.ChangeEvent)9 ChangeHandler (com.google.gwt.event.dom.client.ChangeHandler)9 InfoPopup (org.uberfire.ext.widgets.common.client.common.InfoPopup)9 HorizontalPanel (com.google.gwt.user.client.ui.HorizontalPanel)7 TextBox (org.gwtbootstrap3.client.ui.TextBox)6 MenuItem (org.uberfire.workbench.model.menu.MenuItem)6 IsWidget (com.google.gwt.user.client.ui.IsWidget)5 Widget (com.google.gwt.user.client.ui.Widget)5 AnchorListItem (org.gwtbootstrap3.client.ui.AnchorListItem)5 ButtonGroup (org.gwtbootstrap3.client.ui.ButtonGroup)5 FlexTable (com.google.gwt.user.client.ui.FlexTable)4 ApplicationScoped (javax.enterprise.context.ApplicationScoped)4 Inject (javax.inject.Inject)4