notification
This commit is contained in:
parent
448c4d26b5
commit
9267d34d3a
4 changed files with 42 additions and 13 deletions
|
@ -25,6 +25,7 @@ import java.util.function.Consumer;
|
||||||
import java.util.function.Predicate;
|
import java.util.function.Predicate;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.BooleanUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
import org.eclipse.swt.graphics.Color;
|
import org.eclipse.swt.graphics.Color;
|
||||||
|
@ -33,6 +34,7 @@ import org.eclipse.swt.layout.GridData;
|
||||||
import org.eclipse.swt.layout.GridLayout;
|
import org.eclipse.swt.layout.GridLayout;
|
||||||
import org.eclipse.swt.widgets.Composite;
|
import org.eclipse.swt.widgets.Composite;
|
||||||
import org.eclipse.swt.widgets.Display;
|
import org.eclipse.swt.widgets.Display;
|
||||||
|
import org.eclipse.swt.widgets.Event;
|
||||||
import org.eclipse.swt.widgets.Table;
|
import org.eclipse.swt.widgets.Table;
|
||||||
import org.eclipse.swt.widgets.TableColumn;
|
import org.eclipse.swt.widgets.TableColumn;
|
||||||
import org.eclipse.swt.widgets.TableItem;
|
import org.eclipse.swt.widgets.TableItem;
|
||||||
|
@ -136,7 +138,7 @@ public final class ClientConnectionTable {
|
||||||
loadStatusFilter();
|
loadStatusFilter();
|
||||||
|
|
||||||
this.table = this.widgetFactory.tableLocalized(tableRoot, SWT.MULTI | SWT.V_SCROLL);
|
this.table = this.widgetFactory.tableLocalized(tableRoot, SWT.MULTI | SWT.V_SCROLL);
|
||||||
final GridLayout gridLayout = new GridLayout(3 + indicators.size(), true);
|
final GridLayout gridLayout = new GridLayout(3 + indicators.size(), false);
|
||||||
gridLayout.horizontalSpacing = 100;
|
gridLayout.horizontalSpacing = 100;
|
||||||
gridLayout.marginWidth = 100;
|
gridLayout.marginWidth = 100;
|
||||||
gridLayout.marginRight = 100;
|
gridLayout.marginRight = 100;
|
||||||
|
@ -147,6 +149,7 @@ public final class ClientConnectionTable {
|
||||||
this.table.setLinesVisible(true);
|
this.table.setLinesVisible(true);
|
||||||
|
|
||||||
this.table.addListener(SWT.Selection, event -> this.notifySelectionChange());
|
this.table.addListener(SWT.Selection, event -> this.notifySelectionChange());
|
||||||
|
this.table.addListener(SWT.MouseUp, this::notifyTableInfoClick);
|
||||||
|
|
||||||
this.widgetFactory.tableColumnLocalized(
|
this.widgetFactory.tableColumnLocalized(
|
||||||
this.table,
|
this.table,
|
||||||
|
@ -432,6 +435,10 @@ public final class ClientConnectionTable {
|
||||||
this.selectionListener.accept(this.getSelection());
|
this.selectionListener.accept(this.getSelection());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void notifyTableInfoClick(final Event event) {
|
||||||
|
// TODO if right click get selected item and show additional information (notification)
|
||||||
|
}
|
||||||
|
|
||||||
private final class UpdatableTableItem implements Comparable<UpdatableTableItem> {
|
private final class UpdatableTableItem implements Comparable<UpdatableTableItem> {
|
||||||
|
|
||||||
final Long connectionId;
|
final Long connectionId;
|
||||||
|
@ -445,14 +452,14 @@ public final class ClientConnectionTable {
|
||||||
this.connectionId = connectionId;
|
this.connectionId = connectionId;
|
||||||
}
|
}
|
||||||
|
|
||||||
void update(final TableItem tableItem, final boolean force) {
|
private void update(final TableItem tableItem, final boolean force) {
|
||||||
if (force || this.changed) {
|
if (force || this.changed) {
|
||||||
update(tableItem);
|
update(tableItem);
|
||||||
}
|
}
|
||||||
this.changed = false;
|
this.changed = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void update(final TableItem tableItem) {
|
private void update(final TableItem tableItem) {
|
||||||
if (ClientConnectionTable.this.statusFilter.contains(this.connectionData.clientConnection.status)) {
|
if (ClientConnectionTable.this.statusFilter.contains(this.connectionData.clientConnection.status)) {
|
||||||
tableItem.dispose();
|
tableItem.dispose();
|
||||||
return;
|
return;
|
||||||
|
@ -462,23 +469,35 @@ public final class ClientConnectionTable {
|
||||||
updateConnectionStatusColor(tableItem);
|
updateConnectionStatusColor(tableItem);
|
||||||
updateIndicatorValues(tableItem);
|
updateIndicatorValues(tableItem);
|
||||||
updateDuplicateColor(tableItem);
|
updateDuplicateColor(tableItem);
|
||||||
|
updateNotifications(tableItem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void updateData(final TableItem tableItem) {
|
private void updateNotifications(final TableItem tableItem) {
|
||||||
|
if (BooleanUtils.isTrue(this.connectionData.pendingNotification())) {
|
||||||
|
tableItem.setImage(0,
|
||||||
|
WidgetFactory.ImageIcon.NOTIFICATION.getImage(ClientConnectionTable.this.table.getDisplay()));
|
||||||
|
} else {
|
||||||
|
if (tableItem.getImage(0) != null) {
|
||||||
|
tableItem.setImage(0, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateData(final TableItem tableItem) {
|
||||||
tableItem.setText(0, getConnectionIdentifier());
|
tableItem.setText(0, getConnectionIdentifier());
|
||||||
tableItem.setText(1, getConnectionAddress());
|
tableItem.setText(1, getConnectionAddress());
|
||||||
tableItem.setText(2, getStatusName());
|
tableItem.setText(2, getStatusName());
|
||||||
}
|
}
|
||||||
|
|
||||||
void updateConnectionStatusColor(final TableItem tableItem) {
|
private void updateConnectionStatusColor(final TableItem tableItem) {
|
||||||
final Color statusColor = ClientConnectionTable.this.colorData.getStatusColor(this.connectionData);
|
final Color statusColor = ClientConnectionTable.this.colorData.getStatusColor(this.connectionData);
|
||||||
final Color statusTextColor = ClientConnectionTable.this.colorData.getStatusTextColor(statusColor);
|
final Color statusTextColor = ClientConnectionTable.this.colorData.getStatusTextColor(statusColor);
|
||||||
tableItem.setBackground(2, statusColor);
|
tableItem.setBackground(2, statusColor);
|
||||||
tableItem.setForeground(2, statusTextColor);
|
tableItem.setForeground(2, statusTextColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
void updateDuplicateColor(final TableItem tableItem) {
|
private void updateDuplicateColor(final TableItem tableItem) {
|
||||||
|
|
||||||
tableItem.setBackground(0, null);
|
tableItem.setBackground(0, null);
|
||||||
tableItem.setForeground(0, ClientConnectionTable.this.darkFontColor);
|
tableItem.setForeground(0, ClientConnectionTable.this.darkFontColor);
|
||||||
|
@ -494,14 +513,18 @@ public final class ClientConnectionTable {
|
||||||
if (list != null && list.size() > 1) {
|
if (list != null && list.size() > 1) {
|
||||||
tableItem.setBackground(0, ClientConnectionTable.this.colorData.color3);
|
tableItem.setBackground(0, ClientConnectionTable.this.colorData.color3);
|
||||||
tableItem.setForeground(0, ClientConnectionTable.this.lightFontColor);
|
tableItem.setForeground(0, ClientConnectionTable.this.lightFontColor);
|
||||||
|
tableItem.setImage(1,
|
||||||
|
WidgetFactory.ImageIcon.ADD.getImage(ClientConnectionTable.this.table.getDisplay()));
|
||||||
} else {
|
} else {
|
||||||
tableItem.setBackground(0, null);
|
tableItem.setBackground(0, null);
|
||||||
tableItem.setForeground(0, ClientConnectionTable.this.darkFontColor);
|
tableItem.setForeground(0, ClientConnectionTable.this.darkFontColor);
|
||||||
|
tableItem.setImage(0, null);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void updateIndicatorValues(final TableItem tableItem) {
|
private void updateIndicatorValues(final TableItem tableItem) {
|
||||||
if (this.connectionData == null || this.indicatorWeights == null) {
|
if (this.connectionData == null || this.indicatorWeights == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -120,7 +120,8 @@ public class WidgetFactory {
|
||||||
UNLOCK("unlock.png"),
|
UNLOCK("unlock.png"),
|
||||||
RESTRICTION("restriction.png"),
|
RESTRICTION("restriction.png"),
|
||||||
VISIBILITY("visibility.png"),
|
VISIBILITY("visibility.png"),
|
||||||
VISIBILITY_OFF("visibility_off.png");
|
VISIBILITY_OFF("visibility_off.png"),
|
||||||
|
NOTIFICATION("notification.png");
|
||||||
|
|
||||||
public String fileName;
|
public String fileName;
|
||||||
private ImageData image = null;
|
private ImageData image = null;
|
||||||
|
|
|
@ -576,12 +576,17 @@ sebserver.exam.indicator.list.empty=There is currently no indicator defined for
|
||||||
sebserver.exam.indicator.list.pleaseSelect=At first please select an indicator from the list
|
sebserver.exam.indicator.list.pleaseSelect=At first please select an indicator from the list
|
||||||
|
|
||||||
sebserver.exam.indicator.type.LAST_PING=Last Ping Time
|
sebserver.exam.indicator.type.LAST_PING=Last Ping Time
|
||||||
sebserver.exam.indicator.type.ERROR_COUNT=Errors
|
sebserver.exam.indicator.type.ERROR_COUNT=Error-Log Counter
|
||||||
sebserver.exam.indicator.type.WARN_COUNT=Warnings
|
sebserver.exam.indicator.type.WARN_COUNT=Warning-Log Counter
|
||||||
|
sebserver.exam.indicator.type.INFO_COUNT=Info-Log Counter
|
||||||
|
sebserver.exam.indicator.type.BATTERY_STATUS=Battery Status
|
||||||
|
sebserver.exam.indicator.type.WLAN_STATUS=WiFi Status
|
||||||
sebserver.exam.indicator.type.description.LAST_PING=This indicator shows the time in milliseconds since<br/> the last ping has been received from a SEB Client.<br/>This indicator can be used to track a SEB Client connection and indicate connection loss.<br/><br/>The value is in milliseconds.
|
sebserver.exam.indicator.type.description.LAST_PING=This indicator shows the time in milliseconds since<br/> the last ping has been received from a SEB Client.<br/>This indicator can be used to track a SEB Client connection and indicate connection loss.<br/><br/>The value is in milliseconds.
|
||||||
sebserver.exam.indicator.type.description.ERROR_COUNT=This indicator shows the number of error log messages that<br/> has been received from a SEB Client.<br/>This indicator can be used to track errors of connected SEB Clients<br/><br/>The value is natural numbers.
|
sebserver.exam.indicator.type.description.ERROR_COUNT=This indicator shows the number of error log messages that<br/> has been received from a SEB Client.<br/>This indicator can be used to track errors of connected SEB Clients<br/><br/>The value is a natural number.
|
||||||
sebserver.exam.indicator.type.description.WARN_COUNT=This indicator shows the number of warn log messages that<br/> has been received from a SEB Client.<br/>This indicator can be used to track warnings of connected SEB Clients<br/><br/>The value is natural numbers.
|
sebserver.exam.indicator.type.description.WARN_COUNT=This indicator shows the number of warn log messages that<br/> has been received from a SEB Client.<br/>This indicator can be used to track warnings of connected SEB Clients<br/><br/>The value is a natural number.
|
||||||
|
sebserver.exam.indicator.type.description.INFO_COUNT=This indicator shows the number of warn log messages that<br/> has been received from a SEB Client.<br/>This indicator can be used to track warnings of connected SEB Clients<br/><br/>The value is a natural number.
|
||||||
|
sebserver.exam.indicator.type.description.BATTERY_STATUS=This indicator shows the percentage of the battery load level of a SEB Client.
|
||||||
|
sebserver.exam.indicator.type.description.WLAN_STATUS=This indicator shows the percentage of the WiFi connection status of a SEB Client.
|
||||||
|
|
||||||
sebserver.exam.indicator.info.pleaseSelect=At first please select an indicator from the list
|
sebserver.exam.indicator.info.pleaseSelect=At first please select an indicator from the list
|
||||||
|
|
||||||
|
|
BIN
src/main/resources/static/images/notification.png
Normal file
BIN
src/main/resources/static/images/notification.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 182 B |
Loading…
Reference in a new issue