use of com.vaadin.ui.Component in project opennms by OpenNMS.
the class BlueprintIViewContribution method getView.
@Override
public Component getView(final VaadinApplicationContext vaadinApplicationContext, final WidgetContext widgetContext) {
// Get the component by asking the blueprint container to instantiate a prototype bean
final Component component = (Component) m_container.getComponentInstance(m_beanId);
final BundleContext bundleContext = (BundleContext) m_container.getComponentInstance("blueprintBundleContext");
final EventProxy eventProxy = vaadinApplicationContext.getEventProxy(bundleContext);
eventProxy.addPossibleEventConsumer(component);
injectEventProxy(component, eventProxy);
injectVaadinApplicationContext(component, vaadinApplicationContext);
return component;
}
use of com.vaadin.ui.Component in project opennms by OpenNMS.
the class BusinessServiceVertexInfoPanelItemProvider method createComponent.
private Component createComponent(AbstractBusinessServiceVertex ref, GraphContainer graphContainer) {
final FormLayout formLayout = new FormLayout();
formLayout.setSpacing(false);
formLayout.setMargin(false);
ref.accept(new BusinessServiceVertexVisitor<Void>() {
@Override
public Void visit(BusinessServiceVertex vertex) {
final BusinessService businessService = businessServiceManager.getBusinessServiceById(vertex.getServiceId());
formLayout.addComponent(createLabel("Reduce function", getReduceFunctionDescription(businessService.getReduceFunction())));
// Apply Reduce Function specific details
businessService.getReduceFunction().accept(new ReduceFunctionVisitor<Void>() {
@Override
public Void visit(HighestSeverity highestSeverity) {
return null;
}
@Override
public Void visit(HighestSeverityAbove highestSeverityAbove) {
return null;
}
@Override
public // Threshold is not very transparent, we add an Explain Button in these cases
Void visit(Threshold threshold) {
final Button explainButton = createButton("Explain", "Explain the Threshold function", FontAwesome.TABLE, (Button.ClickListener) event -> {
ThresholdExplanationWindow explainWindow = new ThresholdExplanationWindow(SimulationAwareStateMachineFactory.createSimulatedStateMachine(businessServiceManager, graphContainer.getCriteria()).explain(businessService, (Threshold) businessService.getReduceFunction()));
UI.getCurrent().addWindow(explainWindow);
});
explainButton.setStyleName(BaseTheme.BUTTON_LINK);
formLayout.addComponent(explainButton);
return null;
}
@Override
public Void visit(ExponentialPropagation exponentialPropagation) {
return null;
}
});
return null;
}
@Override
public Void visit(IpServiceVertex vertex) {
IpService ipService = businessServiceManager.getIpServiceById(vertex.getIpServiceId());
formLayout.addComponent(createLabel("Interface", ipService.getIpAddress()));
formLayout.addComponent(createLabel("Service", ipService.getServiceName()));
if (!ipService.getServiceName().equals(vertex.getLabel())) {
formLayout.addComponent(createLabel("Friendly Name", vertex.getLabel()));
}
return null;
}
@Override
public Void visit(ReductionKeyVertex vertex) {
formLayout.addComponent(createLabel("Reduction Key", vertex.getReductionKey()));
if (!vertex.getReductionKey().equals(vertex.getLabel())) {
formLayout.addComponent(createLabel("Friendly Name", vertex.getLabel()));
}
return null;
}
});
return formLayout;
}
use of com.vaadin.ui.Component in project Activiti by Activiti.
the class TaskPage method createDetailComponent.
protected Component createDetailComponent(String id) {
Task task = taskService.createTaskQuery().taskId(id).singleResult();
Component detailComponent = new TaskDetailPanel(task, TaskPage.this);
taskEventPanel.setTaskId(task.getId());
return detailComponent;
}
use of com.vaadin.ui.Component in project Activiti by Activiti.
the class ProcessInstanceDetailPanel method addTaskItem.
protected void addTaskItem(HistoricTaskInstance task, Table taskTable) {
Item item = taskTable.addItem(task.getId());
if (task.getEndTime() != null) {
item.getItemProperty("finished").setValue(new Embedded(null, Images.TASK_FINISHED_22));
} else {
item.getItemProperty("finished").setValue(new Embedded(null, Images.TASK_22));
}
item.getItemProperty("name").setValue(task.getName());
item.getItemProperty("priority").setValue(task.getPriority());
item.getItemProperty("startDate").setValue(new PrettyTimeLabel(task.getStartTime(), true));
item.getItemProperty("endDate").setValue(new PrettyTimeLabel(task.getEndTime(), true));
if (task.getDueDate() != null) {
Label dueDateLabel = new PrettyTimeLabel(task.getEndTime(), i18nManager.getMessage(Messages.TASK_NOT_FINISHED_YET), true);
item.getItemProperty("dueDate").setValue(dueDateLabel);
}
if (task.getAssignee() != null) {
Component taskAssigneeComponent = getTaskAssigneeComponent(task.getAssignee());
if (taskAssigneeComponent != null) {
item.getItemProperty("assignee").setValue(taskAssigneeComponent);
}
}
}
use of com.vaadin.ui.Component in project Activiti by Activiti.
the class ChartGenerator method generateChart.
public static ChartComponent generateChart(byte[] reportData) {
// Convert json to pojo
JsonNode jsonNode = convert(reportData);
// Title
JsonNode titleNode = jsonNode.get("title");
String title = null;
if (titleNode != null) {
title = titleNode.textValue();
}
ChartComponent chartComponent = new ChartComponent(title);
// Retrieve data sets
JsonNode datasetsNode = jsonNode.get("datasets");
// If no data was returned
if (datasetsNode.size() == 0) {
chartComponent.addChart(null, null, ExplorerApp.get().getI18nManager().getMessage(Messages.REPORTING_ERROR_NOT_ENOUGH_DATA));
return chartComponent;
}
if (datasetsNode != null && datasetsNode.isArray()) {
Iterator<JsonNode> dataIterator = datasetsNode.iterator();
while (dataIterator.hasNext()) {
JsonNode datasetNode = dataIterator.next();
JsonNode descriptionNode = datasetNode.get("description");
String description = null;
if (descriptionNode != null) {
description = descriptionNode.textValue();
}
JsonNode dataNode = datasetNode.get("data");
if (dataNode == null || dataNode.size() == 0) {
chartComponent.addChart(description, null, ExplorerApp.get().getI18nManager().getMessage(Messages.REPORTING_ERROR_NOT_ENOUGH_DATA));
} else {
String[] names = new String[dataNode.size()];
Number[] values = new Number[dataNode.size()];
int index = 0;
Iterator<String> fieldIterator = dataNode.fieldNames();
while (fieldIterator.hasNext()) {
String field = fieldIterator.next();
names[index] = field;
values[index] = dataNode.get(field).numberValue();
index++;
}
// Generate chart (or 'no data' message)
if (names.length > 0) {
Component chart = createChart(datasetNode, names, values);
chartComponent.addChart(description, chart, null);
} else {
chartComponent.addChart(description, null, ExplorerApp.get().getI18nManager().getMessage(Messages.REPORTING_ERROR_NOT_ENOUGH_DATA));
}
}
}
}
return chartComponent;
}
Aggregations