Search in sources :

Example 1 with ThemeResource

use of com.vaadin.server.ThemeResource in project vaadin-app-layout by appreciated.

the class DemoUI method setDrawerVariant.

private void setDrawerVariant(Behaviour variant) {
    holder.removeAllComponents();
    AppLayoutComponent drawer = AppLayout.getDefaultBuilder(variant).withTitle("App Layout").addToAppBar(new AppBarNotificationButton(notifications, true)).withViewNameInterceptor(new DefaultViewNameInterceptor()).withDefaultNavigationView(View1.class).withDesign(AppLayoutDesign.MATERIAL).add(new MenuHeader("Version 0.9.21", new ThemeResource("logo.png")), HEADER).addClickable("Set Behaviour HEADER", VaadinIcons.COG, clickEvent -> openModeSelector(variant), HEADER).add("Home", VaadinIcons.HOME, badge, new View1()).add(SubmenuBuilder.get("My Submenu", VaadinIcons.PLUS).add(SubmenuBuilder.get("My Submenu", VaadinIcons.PLUS).add("Charts3", VaadinIcons.SPLINE_CHART, View2.class).add("Contact3", VaadinIcons.CONNECT, View3.class).add("More3", VaadinIcons.COG, View4.class).build()).add("Contact1", VaadinIcons.CONNECT, View3.class).add("More1", VaadinIcons.COG, View4.class).build()).add(SubmenuBuilder.get("My Submenu", VaadinIcons.PLUS).add(SubmenuBuilder.get("My Submenu", VaadinIcons.PLUS).add("Charts4", VaadinIcons.SPLINE_CHART, View2.class).add("Contact4", VaadinIcons.CONNECT, View3.class).add("More4", VaadinIcons.COG, View4.class).build()).add("Contact2", VaadinIcons.CONNECT, View3.class).add("More2", VaadinIcons.COG, View4.class).build()).add("Menu", VaadinIcons.MENU, View5.class).add("Elements", VaadinIcons.LIST, ElementsView.class).addClickable("Set Behaviour FOOTER", VaadinIcons.COG, clickEvent -> openModeSelector(variant), FOOTER).build();
    drawer.addStyleName("left");
    holder.addComponent(drawer);
    if (getNavigator() != null) {
        getNavigator().navigateTo("");
    }
    reloadNotifications();
}
Also used : ThemeResource(com.vaadin.server.ThemeResource) FOOTER(com.github.appreciated.app.layout.builder.Section.FOOTER) SubmenuBuilder(com.github.appreciated.app.layout.builder.elements.builders.SubmenuBuilder) Behaviour(com.github.appreciated.app.layout.behaviour.Behaviour) VaadinRequest(com.vaadin.server.VaadinRequest) VaadinServlet(com.vaadin.server.VaadinServlet) Transport(com.vaadin.shared.ui.ui.Transport) VaadinIcons(com.vaadin.icons.VaadinIcons) DefaultViewNameInterceptor(com.github.appreciated.app.layout.interceptor.DefaultViewNameInterceptor) AppBarNotificationButton(com.github.appreciated.app.layout.component.button.AppBarNotificationButton) ValoTheme(com.vaadin.ui.themes.ValoTheme) MEDIUM(com.github.appreciated.app.layout.builder.entities.DefaultNotification.Priority.MEDIUM) AppLayoutDesign(com.github.appreciated.app.layout.builder.design.AppLayoutDesign) HEADER(com.github.appreciated.app.layout.builder.Section.HEADER) DefaultNotificationHolder(com.github.appreciated.app.layout.builder.entities.DefaultNotificationHolder) PushStateNavigation(com.vaadin.navigator.PushStateNavigation) DefaultNotification(com.github.appreciated.app.layout.builder.entities.DefaultNotification) WebServlet(javax.servlet.annotation.WebServlet) Consumer(java.util.function.Consumer) AppLayoutComponent(com.github.appreciated.app.layout.behaviour.AppLayoutComponent) com.vaadin.annotations(com.vaadin.annotations) MenuHeader(com.github.appreciated.app.layout.component.MenuHeader) DefaultBadgeHolder(com.github.appreciated.app.layout.builder.entities.DefaultBadgeHolder) AppLayout(com.github.appreciated.app.layout.AppLayout) View(com.vaadin.navigator.View) com.vaadin.ui(com.vaadin.ui) MenuHeader(com.github.appreciated.app.layout.component.MenuHeader) ThemeResource(com.vaadin.server.ThemeResource) DefaultViewNameInterceptor(com.github.appreciated.app.layout.interceptor.DefaultViewNameInterceptor) AppBarNotificationButton(com.github.appreciated.app.layout.component.button.AppBarNotificationButton) AppLayoutComponent(com.github.appreciated.app.layout.behaviour.AppLayoutComponent)

Example 2 with ThemeResource

use of com.vaadin.server.ThemeResource in project vaadin-app-layout by appreciated.

the class DemoUI method init.

// @Autowired
// SpringNavigator navigator;
public void init(VaadinRequest request) {
    DefaultNotificationHolder notifications = new DefaultNotificationHolder();
    DefaultBadgeHolder badge = new DefaultBadgeHolder();
    AppLayoutComponent layout = AppLayout.getCDIBuilder(Behaviour.LEFT_RESPONSIVE_HYBRID).withViewProvider(() -> viewProvider).withNavigationElementInfoProvider(new DefaultSpringNavigationElementInfoProvider()).withTitle("App Layout Basic Example").addToAppBar(new AppBarNotificationButton(notifications, true)).withDesign(AppLayoutDesign.MATERIAL).withNavigatorConsumer(navigator -> {
    /* Do something with it */
    }).add(new MenuHeader("Version 0.9.21", new ThemeResource("logo.png")), HEADER).add("Home", VaadinIcons.HOME, badge, View1.class).add(SubmenuBuilder.get("My Submenu", VaadinIcons.PLUS).add("Charts", VaadinIcons.SPLINE_CHART, View2.class).add("Contact", VaadinIcons.CONNECT, View3.class).add("More", VaadinIcons.COG, View4.class).build()).add("Menu", VaadinIcons.MENU, View5.class).add("Elements", VaadinIcons.LIST, View6.class).build();
    setContent(layout);
}
Also used : DefaultSpringNavigationElementInfoProvider(com.github.appreciated.app.layout.builder.providers.DefaultSpringNavigationElementInfoProvider) DefaultBadgeHolder(com.github.appreciated.app.layout.builder.entities.DefaultBadgeHolder) MenuHeader(com.github.appreciated.app.layout.component.MenuHeader) DefaultNotificationHolder(com.github.appreciated.app.layout.builder.entities.DefaultNotificationHolder) ThemeResource(com.vaadin.server.ThemeResource) AppBarNotificationButton(com.github.appreciated.app.layout.component.button.AppBarNotificationButton) AppLayoutComponent(com.github.appreciated.app.layout.behaviour.AppLayoutComponent)

Example 3 with ThemeResource

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

the class SummaryDashlet method getComponentSeverity.

/**
 * Returns the component showing the alarms and the trends by severity
 *
 * @return the {@link Component}
 */
private Component getComponentSeverity(int width) {
    VerticalLayout verticalLayout = new VerticalLayout();
    int overallSum = 0;
    int severitySum = 0;
    verticalLayout.addComponent(getLegend("Severity"));
    for (OnmsSeverity onmsSeverity : OnmsSeverity.values()) {
        HorizontalLayout horizontalLayout = new HorizontalLayout();
        horizontalLayout.setSpacing(true);
        horizontalLayout.addStyleName("summary");
        horizontalLayout.addStyleName(onmsSeverity.name().toLowerCase());
        int acknowledged = countBySeverity(true, m_timeslot, onmsSeverity);
        int notAcknowledged = countBySeverity(false, m_timeslot, onmsSeverity);
        Label labelSeverity = new Label(onmsSeverity.getLabel());
        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 += onmsSeverity.getId();
        overallSum += onmsSeverity.getId() * 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 severity");
    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 : OnmsSeverity(org.opennms.netmgt.model.OnmsSeverity) ThemeResource(com.vaadin.server.ThemeResource)

Example 4 with ThemeResource

use of com.vaadin.server.ThemeResource in project cia by Hack23.

the class AbstractView method addLogoToHeader.

/**
 * Adds the logo to header.
 *
 * @param topHeader
 *            the top header
 */
private static void addLogoToHeader(final HorizontalLayout topHeader) {
    final ThemeResource ciaLogoResource = new ThemeResource("cia-logo.png");
    final Image ciaLogoImage = new Image(null, ciaLogoResource);
    topHeader.addComponent(ciaLogoImage);
    ciaLogoImage.setWidth("60px");
    ciaLogoImage.setHeight("60px");
    topHeader.setComponentAlignment(ciaLogoImage, Alignment.MIDDLE_LEFT);
    topHeader.setExpandRatio(ciaLogoImage, ContentRatio.SMALL);
}
Also used : ThemeResource(com.vaadin.server.ThemeResource) Image(com.vaadin.ui.Image)

Example 5 with ThemeResource

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

the class NodeWindow method buttonClick.

@Override
public void buttonClick(ClickEvent event) {
    if (event.getButton() == btEdge) {
        if (prepareEdgeDock) {
            setPrepareEdgeDock(false);
            parent.addEdge(this);
        } else {
            parent.prepareAddingEdge(this);
            setPrepareEdgeDock(true);
            btEdge.setIcon(new ThemeResource("images/pixel.png"));
            btEdge.setCaption("Cancel");
        }
    } else if (event.getButton() == btClose) {
        parent.deleteNode(this);
    } else if (event.getButton() == btAdd) {
        ConstraintLayout c = new ConstraintLayout(parent, annoNames);
        c.setWidth("100%");
        c.setHeight("-1px");
        constraints.add(c);
        vLayout.addComponent(c);
        if (parent != null) {
            parent.updateQuery();
        }
    } else if (event.getButton() == btClear) {
        for (ConstraintLayout c : constraints) {
            vLayout.removeComponent(c);
        }
        constraints.clear();
        if (parent != null) {
            parent.updateQuery();
        }
    }
}
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