@Override public String getStyle(Table source, Object itemId, Object propertyId) { if (propertyId == null && source.getContainerProperty(itemId, "severityId") != null) { Integer severity = (Integer) source.getContainerProperty(itemId, "severityId").getValue(); Property<?> prop = source.getContainerProperty(itemId, "acknowledged"); Boolean acknowledged = false; if (prop != null) { acknowledged = (Boolean) prop.getValue(); } return renderer.getStyle(severity, acknowledged.booleanValue()); } else if ("severity".equals(propertyId)) { return "bright"; } return null; }
public Set<Integer> getSelectedIds(Table source) { if (m_selectAll) { Set<Integer> selected = new TreeSet<Integer>(); for (Object eachItemId : source.getItemIds()) { Property<Integer> property = source.getContainerProperty(eachItemId, m_valueProperty); if (property == null) continue; selected.add(property.getValue()); } //remove unselected selected.removeAll(m_notSelectedCheckboxes); return selected; } return Collections.unmodifiableSet(m_selectedCheckboxes); }
tablet.addGeneratedColumn("itemStatus", new ColumnGenerator() { @Override public Object generateCell(Table source, Object itemId, Object columnId) { Label label = new Label("" + source.getContainerProperty(itemId, columnId).getValue()); label.setContentMode(ContentMode.HTML); label.setSizeUndefined(); return label; } });
@Override public Object generateCell(Table source, Object itemId, Object columnId) { Property<String> property = source.getContainerProperty(itemId, columnId); if (property == null || property.getValue() == null) { return null; } else { return property.getValue(); } } }
@Override public Object generateCell(Table source, Object itemId, Object columnId) { Property<OnmsSeverity> property = source.getContainerProperty(itemId, columnId); if (property == null || property.getValue() == null) { return null; } else { OnmsSeverity severity = property.getValue(); String label = severity.getLabel(); label = label.toLowerCase(); label = new String(label.substring(0, 1)).toUpperCase() + label.substring(1); return new Label(" " + escapeHtml(label), Label.CONTENT_XML); } }
@Override public void buttonClick(ClickEvent event) { Integer nodeId = nodeIdProperty.getValue(); String nodeLabel = (String)source.getContainerProperty(itemId, m_nodeLabelProperty).getValue(); VertexRef vertexRef = new DefaultVertexRef("nodes", String.valueOf(nodeId), nodeLabel); fireVertexUpdatedEvent(vertexRef); } });
@Override public Object generateCell(Table source, Object itemId, Object columnId) { Property<?> property = source.getContainerProperty(itemId, columnId); if (property == null || property.getValue() == null) { return null; } else { return InetAddressUtils.str((InetAddress)property.getValue()); } } }
@Override public Object generateCell(Table source, Object itemId, Object columnId) { Property<OnmsIpInterface> property = source.getContainerProperty(itemId, columnId); if (property == null || property.getValue() == null) { return null; } else { return property.getValue().getIpAddressAsString(); } } }
@Override public Object generateCell(Table source, Object itemId, Object columnId) { Property<OnmsServiceType> property = source.getContainerProperty(itemId, columnId); if (property == null || property.getValue() == null) { return null; } else { return property.getValue().getName(); } } }
@Override public Object generateCell(final Table source, final Object itemId, Object columnId) { final Property<Integer> idProperty = source.getContainerProperty(itemId, idPropertyName); final Property<String> labelProperty = source.getContainerProperty(itemId, labelPropertyName); Object cellValue = columnGenerator.generateCell(source, itemId, columnId); if (cellValue == null) { return null; } else { if (idProperty.getValue() == null) { return cellValue; } else { Button button = new Button(cellValue.toString()); button.setStyleName(BaseTheme.BUTTON_LINK); button.setDescription(idProperty.getValue().toString()); button.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { Integer applicationId = idProperty.getValue(); String applicationName = labelProperty.getValue(); ApplicationVertex vertex = new ApplicationVertex(applicationId.toString(), applicationName); fireVertexUpdatedEvent(vertex); } }); return button; } } } }
@Override public Object generateCell(final Table source, final Object itemId, Object columnId) { final Property<Integer> idProperty = source.getContainerProperty(itemId, idPropertyName); final Property<String> labelProperty = source.getContainerProperty(itemId, labelPropertyName); Object cellValue = columnGenerator.generateCell(source, itemId, columnId); if (cellValue == null) { return null; } else { if (idProperty.getValue() == null) { return cellValue; } else { Button button = new Button(cellValue.toString()); button.setStyleName(BaseTheme.BUTTON_LINK); button.setDescription(idProperty.getValue().toString()); button.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { Integer applicationId = idProperty.getValue(); String applicationName = labelProperty.getValue(); ApplicationVertex vertex = new ApplicationVertex(applicationId.toString(), applicationName); fireVertexUpdatedEvent(vertex); } }); return button; } } } }
@Override public Object generateCell(Table source, Object itemId, Object columnId) { Property property = source.getContainerProperty(itemId, columnId); if (property == null || property.getValue() == null) { return null; } String formattedValue; if(property.getType().equals(Instant.class)){ formattedValue = timeformatService.format((Instant) property.getValue(), UserTimeZoneExtractor.extractUserTimeZoneIdOrNull()); } else if(property.getType().equals(Date.class)){ formattedValue = timeformatService.format((Date) property.getValue(), UserTimeZoneExtractor.extractUserTimeZoneIdOrNull()); } else { formattedValue = property.toString(); } return formattedValue; } }
@Override public Object generateCell(Table source, Object itemId, Object columnId) { final Property<Integer> property = source.getContainerProperty(itemId, m_valueProperty); if (property.getValue() == null) { return null;
@Override public Object generateCell(final Table source, final Object itemId, Object columnId) { final Property<Integer> nodeIdProperty = source.getContainerProperty(itemId, m_nodeIdProperty); Object cellValue = m_generator.generateCell(source, itemId, columnId); if (cellValue == null) { return null; } else { if (nodeIdProperty.getValue() == null) { return cellValue; } else { Button button = new Button(cellValue.toString()); button.setStyleName(BaseTheme.BUTTON_LINK); button.setDescription(nodeIdProperty.getValue().toString()); button.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { Integer nodeId = nodeIdProperty.getValue(); String nodeLabel = (String)source.getContainerProperty(itemId, m_nodeLabelProperty).getValue(); VertexRef vertexRef = new DefaultVertexRef("nodes", String.valueOf(nodeId), nodeLabel); fireVertexUpdatedEvent(vertexRef); } }); return button; } } } }
@Override public Object generateCell(final Table source, Object itemId, Object columnId) { if (source == null) return null; // no source Property<Integer> alarmIdProperty = source.getContainerProperty(itemId, alarmIdPropertyName); final Integer alarmId = alarmIdProperty.getValue(); if (alarmId == null) return null; // no value