List of usage examples for com.vaadin.event Action getIcon
public Resource getIcon()
From source file:org.opennms.features.vaadin.topology.TopologyComponent.java
License:Open Source License
@Override public void paintContent(PaintTarget target) throws PaintException { super.paintContent(target); target.addAttribute("scale", (Double) m_scale.getValue()); target.addAttribute("clientX", m_mapManager.getClientX()); target.addAttribute("clientY", m_mapManager.getClientY()); target.addAttribute("semanticZoomLevel", m_graphContainer.getSemanticZoomLevel()); Set<Action> actions = new HashSet<Action>(); m_actionMapper = new KeyMapper(); List<String> bgActionList = new ArrayList<String>(); for (Action.Handler handler : m_actionHandlers) { Action[] bgActions = handler.getActions(null, null); for (Action action : bgActions) { bgActionList.add(m_actionMapper.key(action)); actions.add(action);//from w w w.j a va 2 s . c o m } } target.addAttribute("backgroundActions", bgActionList.toArray()); target.startTag("graph"); for (Vertex group : getGraph().getVertices()) { if (!group.isLeaf()) { target.startTag("group"); target.addAttribute("key", group.getKey()); target.addAttribute("x", group.getX()); target.addAttribute("y", group.getY()); target.addAttribute("selected", group.isSelected()); target.addAttribute("iconUrl", group.getIconUrl()); target.addAttribute("semanticZoomLevel", group.getSemanticZoomLevel()); List<String> groupActionList = new ArrayList<String>(); for (Action.Handler handler : m_actionHandlers) { Action[] groupActions = handler.getActions(group.getItemId(), null); for (Action action : groupActions) { groupActionList.add(m_actionMapper.key(action)); actions.add(action); } } target.addAttribute("actionKeys", groupActionList.toArray()); target.endTag("group"); } } for (Vertex vert : getGraph().getVertices()) { if (vert.isLeaf()) { target.startTag("vertex"); target.addAttribute("id", vert.getKey()); target.addAttribute("x", vert.getX()); target.addAttribute("y", vert.getY()); target.addAttribute("selected", vert.isSelected()); target.addAttribute("iconUrl", vert.getIconUrl()); target.addAttribute("semanticZoomLevel", vert.getSemanticZoomLevel()); if (vert.getGroupId() != null) { target.addAttribute("groupKey", vert.getGroupKey()); } List<String> vertActionList = new ArrayList<String>(); for (Action.Handler handler : m_actionHandlers) { Action[] vertActions = handler.getActions(vert.getItemId(), null); for (Action action : vertActions) { vertActionList.add(m_actionMapper.key(action)); actions.add(action); } } target.addAttribute("actionKeys", vertActionList.toArray()); target.endTag("vertex"); } } for (Edge edge : getGraph().getEdges()) { target.startTag("edge"); target.addAttribute("key", edge.getKey()); target.addAttribute("source", edge.getSource().getKey()); target.addAttribute("target", edge.getTarget().getKey()); List<String> edgeActionList = new ArrayList<String>(); for (Action.Handler handler : m_actionHandlers) { Action[] vertActions = handler.getActions(edge.getItemId(), null); for (Action action : vertActions) { edgeActionList.add(m_actionMapper.key(action)); actions.add(action); } } target.addAttribute("actionKeys", edgeActionList.toArray()); target.endTag("edge"); } for (Vertex group : getGraph().getVertices()) { if (!group.isLeaf()) { if (group.getGroupId() != null) { target.startTag("groupParent"); target.addAttribute("key", group.getKey()); target.addAttribute("parentKey", group.getGroupKey()); target.endTag("groupParent"); } } } target.endTag("graph"); target.startTag("actions"); // send available actions for (Action action : actions) { target.startTag("action"); target.addAttribute("key", m_actionMapper.key(action)); if (action.getCaption() != null) { target.addAttribute("caption", action.getCaption()); } if (action.getIcon() != null) { target.addAttribute("icon", action.getIcon()); } target.endTag("action"); } target.endTag("actions"); }