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