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