Search in sources :

Example 6 with ThemeResource

use of com.vaadin.server.ThemeResource in project opennms by OpenNMS.

the class SummaryDashlet method getLegend.

private Component getLegend(String entity) {
    HorizontalLayout horizontalLayout = new HorizontalLayout();
    horizontalLayout.setSpacing(true);
    horizontalLayout.addStyleName("summary");
    horizontalLayout.addStyleName("global");
    Label labelx = new Label(entity);
    labelx.addStyleName("summary-font-legend");
    Image ackdImage = new Image(null, new ThemeResource("img/acknowledged.png"));
    ackdImage.setWidth(16, Sizeable.Unit.PIXELS);
    Image unackdImage = new Image(null, new ThemeResource("img/unacknowledged.png"));
    unackdImage.setWidth(16, Sizeable.Unit.PIXELS);
    Label dummyLabel = new Label();
    dummyLabel.setWidth(32, Sizeable.Unit.PIXELS);
    horizontalLayout.addComponent(labelx);
    horizontalLayout.addComponent(ackdImage);
    horizontalLayout.addComponent(unackdImage);
    horizontalLayout.addComponent(dummyLabel);
    horizontalLayout.setComponentAlignment(ackdImage, Alignment.TOP_RIGHT);
    horizontalLayout.setComponentAlignment(unackdImage, Alignment.TOP_RIGHT);
    horizontalLayout.setExpandRatio(labelx, 4.0f);
    horizontalLayout.setExpandRatio(ackdImage, 1.0f);
    horizontalLayout.setExpandRatio(unackdImage, 1.0f);
    horizontalLayout.setExpandRatio(dummyLabel, 1.0f);
    horizontalLayout.setWidth(375, Sizeable.Unit.PIXELS);
    return horizontalLayout;
}
Also used : ThemeResource(com.vaadin.server.ThemeResource)

Example 7 with ThemeResource

use of com.vaadin.server.ThemeResource in project opennms by OpenNMS.

the class CriteriaBuilderComponent method renderComponents.

/**
 * This method updates the criteria components.
 */
private void renderComponents() {
    m_criteriaLayout.removeAllComponents();
    boolean isFirst = true;
    boolean isLast;
    for (int i = 0; i < m_criteriaRestrictionComponents.size(); i++) {
        final CriteriaRestrictionComponent criteriaRestrictionComponent = m_criteriaRestrictionComponents.get(i);
        final int index = i;
        isLast = (i == m_criteriaRestrictionComponents.size() - 1);
        criteriaRestrictionComponent.getRightLayout().removeAllComponents();
        Button plusButton = new Button();
        plusButton.setStyleName("small");
        plusButton.setIcon(new ThemeResource("../runo/icons/16/document-add.png"));
        plusButton.setDescription("Add a new criteria entry");
        Button minusButton = new Button();
        minusButton.setStyleName("small");
        minusButton.setIcon(new ThemeResource("../runo/icons/16/document-delete.png"));
        minusButton.setDescription("Remove this criteria entry");
        Button upButton = new Button();
        upButton.setStyleName("small");
        upButton.setIcon(new ThemeResource("../runo/icons/16/arrow-up.png"));
        upButton.setDescription("Move this a criteria entry one position up");
        Button downButton = new Button();
        downButton.setStyleName("small");
        downButton.setIcon(new ThemeResource("../runo/icons/16/arrow-down.png"));
        downButton.setDescription("Move this a criteria entry one position down");
        criteriaRestrictionComponent.getRightLayout().addComponent(upButton);
        criteriaRestrictionComponent.getRightLayout().addComponent(downButton);
        criteriaRestrictionComponent.getRightLayout().addComponent(plusButton);
        criteriaRestrictionComponent.getRightLayout().addComponent(minusButton);
        if (m_criteriaRestrictionComponents.size() == 1) {
            minusButton.setEnabled(false);
            upButton.setEnabled(false);
            downButton.setEnabled(false);
        } else {
            if (isFirst) {
                upButton.setEnabled(false);
            }
            if (isLast) {
                downButton.setEnabled(false);
            }
        }
        upButton.addClickListener(new Button.ClickListener() {

            @Override
            public void buttonClick(Button.ClickEvent clickEvent) {
                Collections.swap(m_criteriaRestrictionComponents, index, index - 1);
                renderComponents();
            }
        });
        downButton.addClickListener(new Button.ClickListener() {

            @Override
            public void buttonClick(Button.ClickEvent clickEvent) {
                Collections.swap(m_criteriaRestrictionComponents, index, index + 1);
                renderComponents();
            }
        });
        minusButton.addClickListener(new Button.ClickListener() {

            public void buttonClick(Button.ClickEvent clickEvent) {
                m_criteriaRestrictionComponents.remove(criteriaRestrictionComponent);
                renderComponents();
            }
        });
        plusButton.addClickListener(new Button.ClickListener() {

            public void buttonClick(Button.ClickEvent clickEvent) {
                m_criteriaRestrictionComponents.add(index + 1, new CriteriaRestrictionComponent(m_criteriaBuilderHelper, "Limit(10)"));
                renderComponents();
            }
        });
        isFirst = false;
        m_criteriaLayout.addComponent(criteriaRestrictionComponent);
    }
}
Also used : Button(com.vaadin.ui.Button) ThemeResource(com.vaadin.server.ThemeResource)

Example 8 with ThemeResource

use of com.vaadin.server.ThemeResource in project opennms by OpenNMS.

the class SummaryDashlet method getComponentUei.

/**
 * Returns the component showing the alarms and the trends by severity
 *
 * @return the {@link Component}
 */
private Component getComponentUei(int width) {
    VerticalLayout verticalLayout = new VerticalLayout();
    int overallSum = 0;
    int severitySum = 0;
    verticalLayout.addComponent(getLegend("UEI"));
    String[] ueis = { "uei.opennms.org/nodes/nodeLostService", "uei.opennms.org/nodes/interfaceDown", "uei.opennms.org/nodes/nodeDown" };
    for (int i = 0; i < ueis.length; i++) {
        String uei = ueis[i];
        HorizontalLayout horizontalLayout = new HorizontalLayout();
        horizontalLayout.setSpacing(true);
        horizontalLayout.addStyleName("summary");
        if (i == 0) {
            horizontalLayout.addStyleName(OnmsSeverity.MINOR.name().toLowerCase());
        } else {
            if (i == 1) {
                horizontalLayout.addStyleName(OnmsSeverity.MINOR.name().toLowerCase());
            } else {
                horizontalLayout.addStyleName(OnmsSeverity.MAJOR.name().toLowerCase());
            }
        }
        int acknowledged = countByUei(true, m_timeslot, uei);
        int notAcknowledged = countByUei(false, m_timeslot, uei);
        Label labelSeverity = new Label(uei.replace("uei.opennms.org/nodes/", ""));
        labelSeverity.addStyleName("summary-font");
        Label labelAcknowledge = new Label(String.valueOf(acknowledged));
        labelAcknowledge.addStyleName("summary-font");
        Label labelNotAcknowledged = new Label(String.valueOf(notAcknowledged));
        labelNotAcknowledged.addStyleName("summary-font");
        horizontalLayout.addComponent(labelSeverity);
        horizontalLayout.addComponent(labelAcknowledge);
        horizontalLayout.addComponent(labelNotAcknowledged);
        int status = computeTrend(acknowledged, notAcknowledged);
        severitySum += i;
        overallSum += i * status;
        Image image = new Image(null, new ThemeResource("img/a" + status + ".png"));
        image.setWidth(width, Sizeable.Unit.PIXELS);
        horizontalLayout.addComponent(image);
        horizontalLayout.setExpandRatio(labelSeverity, 4.0f);
        horizontalLayout.setExpandRatio(labelAcknowledge, 1.0f);
        horizontalLayout.setExpandRatio(labelNotAcknowledged, 1.0f);
        horizontalLayout.setExpandRatio(image, 1.0f);
        horizontalLayout.setComponentAlignment(image, Alignment.TOP_CENTER);
        horizontalLayout.setWidth(375, Sizeable.Unit.PIXELS);
        verticalLayout.addComponent(horizontalLayout);
    }
    int globalTrend = (int) Math.max(0, Math.min(4, Math.round(((double) overallSum) / ((double) severitySum))));
    Image image = new Image(null, new ThemeResource("img/a" + globalTrend + ".png"));
    image.setWidth(width * 8f, Sizeable.Unit.PIXELS);
    VerticalLayout globalTrendLayout = new VerticalLayout();
    globalTrendLayout.setSpacing(true);
    globalTrendLayout.addStyleName("summary");
    globalTrendLayout.addStyleName("global");
    globalTrendLayout.setSizeFull();
    Label labelTitle = new Label("Alarms trend by UEI");
    labelTitle.addStyleName("summary-font");
    labelTitle.setSizeUndefined();
    Label labelTimeslot = new Label("(" + getHumanReadableFormat(m_timeslot) + ")");
    labelTimeslot.addStyleName("summary-font");
    labelTimeslot.setSizeUndefined();
    globalTrendLayout.addComponent(labelTitle);
    globalTrendLayout.addComponent(labelTimeslot);
    globalTrendLayout.addComponent(image);
    globalTrendLayout.setWidth(375, Sizeable.Unit.PIXELS);
    globalTrendLayout.setComponentAlignment(labelTitle, Alignment.MIDDLE_CENTER);
    globalTrendLayout.setComponentAlignment(labelTimeslot, Alignment.MIDDLE_CENTER);
    globalTrendLayout.setComponentAlignment(image, Alignment.MIDDLE_CENTER);
    globalTrendLayout.setExpandRatio(labelTitle, 1.0f);
    verticalLayout.addComponent(globalTrendLayout, 0);
    m_boosted = (globalTrend > 2);
    return verticalLayout;
}
Also used : ThemeResource(com.vaadin.server.ThemeResource)

Example 9 with ThemeResource

use of com.vaadin.server.ThemeResource in project ANNIS by korpling.

the class NodeWindow method setPrepareEdgeDock.

public void setPrepareEdgeDock(boolean prepare) {
    this.prepareEdgeDock = prepare;
    btClear.setVisible(!prepare);
    btClose.setVisible(!prepare);
    btAdd.setVisible(!prepare);
    btMove.setVisible(!prepare);
    if (prepare) {
        btEdge.setCaption("Dock");
        btEdge.setIcon(new ThemeResource("images/pixel.png"));
    } else {
        btEdge.setIcon(FontAwesome.EXTERNAL_LINK);
        btEdge.setCaption("Edge");
    }
}
Also used : ThemeResource(com.vaadin.server.ThemeResource)

Aggregations

ThemeResource (com.vaadin.server.ThemeResource)9 AppLayoutComponent (com.github.appreciated.app.layout.behaviour.AppLayoutComponent)2 DefaultBadgeHolder (com.github.appreciated.app.layout.builder.entities.DefaultBadgeHolder)2 DefaultNotificationHolder (com.github.appreciated.app.layout.builder.entities.DefaultNotificationHolder)2 MenuHeader (com.github.appreciated.app.layout.component.MenuHeader)2 AppBarNotificationButton (com.github.appreciated.app.layout.component.button.AppBarNotificationButton)2 AppLayout (com.github.appreciated.app.layout.AppLayout)1 Behaviour (com.github.appreciated.app.layout.behaviour.Behaviour)1 FOOTER (com.github.appreciated.app.layout.builder.Section.FOOTER)1 HEADER (com.github.appreciated.app.layout.builder.Section.HEADER)1 AppLayoutDesign (com.github.appreciated.app.layout.builder.design.AppLayoutDesign)1 SubmenuBuilder (com.github.appreciated.app.layout.builder.elements.builders.SubmenuBuilder)1 DefaultNotification (com.github.appreciated.app.layout.builder.entities.DefaultNotification)1 MEDIUM (com.github.appreciated.app.layout.builder.entities.DefaultNotification.Priority.MEDIUM)1 DefaultSpringNavigationElementInfoProvider (com.github.appreciated.app.layout.builder.providers.DefaultSpringNavigationElementInfoProvider)1 DefaultViewNameInterceptor (com.github.appreciated.app.layout.interceptor.DefaultViewNameInterceptor)1 com.vaadin.annotations (com.vaadin.annotations)1 VaadinIcons (com.vaadin.icons.VaadinIcons)1 PushStateNavigation (com.vaadin.navigator.PushStateNavigation)1 View (com.vaadin.navigator.View)1