List of usage examples for com.vaadin.ui FormLayout setSpacing
@Override public void setSpacing(boolean spacing)
From source file:org.opennms.features.topology.app.internal.ui.info.NodeInfoPanelItemProvider.java
License:Open Source License
private Component createComponent(AbstractVertex ref) { Preconditions.checkState(ref.getNodeID() != null, "no Node ID defined."); OnmsNode node = nodeDao.get(ref.getNodeID()); FormLayout formLayout = new FormLayout(); formLayout.setSpacing(false); formLayout.setMargin(false);/*from www. j av a 2 s . c o m*/ formLayout.addComponent(createLabel("Node ID", "" + node.getId())); final HorizontalLayout nodeButtonLayout = new HorizontalLayout(); Button nodeButton = createButton(node.getLabel(), null, null, event -> new NodeInfoWindow(ref.getNodeID()).open()); nodeButton.setStyleName(BaseTheme.BUTTON_LINK); nodeButtonLayout.addComponent(nodeButton); nodeButtonLayout.setCaption("Node Label"); formLayout.addComponent(nodeButtonLayout); if (!Strings.isNullOrEmpty(node.getSysObjectId())) { formLayout.addComponent(createLabel("Enterprise OID", node.getSysObjectId())); } return formLayout; }
From source file:org.opennms.features.topology.plugins.topo.bsm.info.BusinessServiceEdgeInfoPanelItem.java
License:Open Source License
@Override protected Component getComponent(EdgeRef ref, GraphContainer container) { FormLayout formLayout = new FormLayout(); formLayout.setMargin(false);//from www. j a va2 s . c om formLayout.setSpacing(false); final BusinessServiceEdge businessServiceEdge = ((BusinessServiceEdge) ref); formLayout.addComponent( createLabel("Map Function", describeMapFunction(businessServiceEdge.getMapFunction()))); formLayout.addComponent(createLabel("Weight", Float.toString(businessServiceEdge.getWeight()))); return formLayout; }
From source file:org.opennms.features.topology.plugins.topo.bsm.info.BusinessServiceEdgeInfoPanelItemProvider.java
License:Open Source License
private Component createComponent(BusinessServiceEdge ref) { FormLayout formLayout = new FormLayout(); formLayout.setMargin(false);/*from w w w. ja v a2 s. c om*/ formLayout.setSpacing(false); formLayout.addComponent(createLabel("Map Function", describeMapFunction(ref.getMapFunction()))); formLayout.addComponent(createLabel("Weight", Float.toString(ref.getWeight()))); return formLayout; }
From source file:org.opennms.features.topology.plugins.topo.bsm.info.BusinessServiceEdgeStatusInfoPanelItem.java
License:Open Source License
@Override protected Component getComponent(EdgeRef ref, GraphContainer container) { FormLayout formLayout = new FormLayout(); formLayout.setMargin(false);//w w w . j a v a2 s . c o m formLayout.setSpacing(false); formLayout.addStyleName("severity"); final BusinessServiceEdge businessServiceEdge = ((BusinessServiceEdge) ref); final BusinessServiceStateMachine stateMachine = SimulationAwareStateMachineFactory .createStateMachine(businessServiceManager, container.getCriteria()); final Status outgoingStatus = BusinessServicesStatusProvider.getStatus(stateMachine, businessServiceEdge); final Status incomingStatus = BusinessServicesStatusProvider.getStatus(stateMachine, ((AbstractBusinessServiceVertex) businessServiceEdge.getTarget().getVertex())); formLayout.addComponent(createStatusLabel("Outgoing Severity", outgoingStatus)); formLayout.addComponent(createStatusLabel("Incoming Severity", incomingStatus)); return formLayout; }
From source file:org.opennms.features.topology.plugins.topo.bsm.info.BusinessServiceEdgeStatusInfoPanelItemProvider.java
License:Open Source License
private Component createComponent(BusinessServiceEdge ref, GraphContainer container) { FormLayout formLayout = new FormLayout(); formLayout.setMargin(false);/* w ww . ja v a 2s. co m*/ formLayout.setSpacing(false); formLayout.addStyleName("severity"); final BusinessServiceStateMachine stateMachine = SimulationAwareStateMachineFactory .createStateMachine(businessServiceManager, container.getCriteria()); final Status outgoingStatus = BusinessServicesStatusProvider.getStatus(stateMachine, ref); final Status incomingStatus = BusinessServicesStatusProvider.getStatus(stateMachine, ((AbstractBusinessServiceVertex) ref.getTarget().getVertex())); formLayout.addComponent(createStatusLabel("Outgoing Severity", outgoingStatus)); formLayout.addComponent(createStatusLabel("Incoming Severity", incomingStatus)); return formLayout; }
From source file:org.opennms.features.topology.plugins.topo.bsm.info.BusinessServiceVertexAttributesInfoPanelItem.java
License:Open Source License
@Override protected Component getComponent(VertexRef ref, GraphContainer container) { final FormLayout formLayout = new FormLayout(); formLayout.setSpacing(false); formLayout.setMargin(false);/* w w w.j a v a 2 s . c om*/ final BusinessService businessService = this.businessServiceManager .getBusinessServiceById(((BusinessServiceVertex) ref).getServiceId()); for (Map.Entry<String, String> e : businessService.getAttributes().entrySet()) { formLayout.addComponent(createLabel(e.getKey(), e.getValue())); } return formLayout; }
From source file:org.opennms.features.topology.plugins.topo.bsm.info.BusinessServiceVertexAttributesInfoPanelItemProvider.java
License:Open Source License
private Component createComponent(VertexRef ref) { final FormLayout formLayout = new FormLayout(); formLayout.setSpacing(false); formLayout.setMargin(false);// w ww . j ava2s .c o m final BusinessService businessService = businessServiceManager .getBusinessServiceById(((BusinessServiceVertex) ref).getServiceId()); for (Map.Entry<String, String> e : businessService.getAttributes().entrySet()) { formLayout.addComponent(createLabel(e.getKey(), e.getValue())); } return formLayout; }
From source file:org.opennms.features.topology.plugins.topo.bsm.info.BusinessServiceVertexInfoPanelItem.java
License:Open Source License
@Override protected Component getComponent(VertexRef ref, GraphContainer container) { final FormLayout formLayout = new FormLayout(); formLayout.setSpacing(false); formLayout.setMargin(false);/* w w w . ja va 2 s . c om*/ ((AbstractBusinessServiceVertex) 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 // Threshold is not very transparent, we add an Explain Button in these cases public 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, container.getCriteria()) .explain(businessService, (Threshold) businessService.getReduceFunction())); UI.getCurrent().addWindow(explainWindow); }); explainButton.setStyleName(BaseTheme.BUTTON_LINK); formLayout.addComponent(explainButton); 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; }
From source file:org.opennms.features.topology.plugins.topo.bsm.info.BusinessServiceVertexInfoPanelItemProvider.java
License:Open Source License
private Component createComponent(AbstractBusinessServiceVertex ref, GraphContainer graphContainer) { final FormLayout formLayout = new FormLayout(); formLayout.setSpacing(false); formLayout.setMargin(false);/*w w w .j a va 2 s . c om*/ 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 // Threshold is not very transparent, we add an Explain Button in these cases public 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; }
From source file:org.opennms.features.topology.plugins.topo.bsm.info.BusinessServiceVertexStatusInfoPanelItem.java
License:Open Source License
@Override protected Component getComponent(VertexRef ref, GraphContainer container) { final BusinessServiceVertex vertex = (BusinessServiceVertex) ref; final FormLayout rootLayout = new FormLayout(); rootLayout.setSizeFull();// ww w. j a v a 2s. c o m rootLayout.setSpacing(false); rootLayout.setMargin(false); rootLayout.addStyleName("severity"); final BusinessServiceStateMachine stateMachine = SimulationAwareStateMachineFactory .createStateMachine(businessServiceManager, container.getCriteria()); final Status overallStatus = BusinessServicesStatusProvider.getStatus(stateMachine, vertex); rootLayout.addComponent(createStatusLabel("Overall", overallStatus)); rootLayout.addComponent(new Label()); final BusinessServiceGraph graph = stateMachine.getGraph(); final BusinessService businessService = businessServiceManager .getBusinessServiceById(vertex.getServiceId()); final Set<GraphVertex> impactingVertices = getImpactingVertices(stateMachine, graph, businessService); for (final Edge edge : businessService.getEdges()) { // Get the topology vertex for the child to determine the display label final Vertex childVertex = businessServicesTopologyProvider .getVertex(edge.accept(new EdgeVisitor<VertexRef>() { @Override public VertexRef visit(final IpServiceEdge edge) { return new IpServiceVertex(edge.getIpService(), 0); } @Override public VertexRef visit(final ReductionKeyEdge edge) { return new ReductionKeyVertex(edge.getReductionKey(), 0); } @Override public VertexRef visit(final ChildEdge edge) { return new BusinessServiceVertex(edge.getChild(), 0); } })); final Status edgeStatus = stateMachine.getOperationalStatus(edge); rootLayout.addComponent(createStatusLabel(childVertex.getLabel(), edgeStatus, String.format( "%s × %d <i class=\"pull-right glyphicon %s\"></i>", edgeStatus.getLabel(), edge.getWeight(), impactingVertices.contains(graph.getVertexByEdgeId(edge.getId())) ? "glyphicon-flash" : ""))); } return rootLayout; }