Merge "Issue #2387. Added system status refresh." into development
Former-commit-id:7109e994da
[formerly 3bb2756cd854c029d0656803efdcc686ccbae01f] Former-commit-id:deb003184f
This commit is contained in:
commit
8de2238748
4 changed files with 371 additions and 80 deletions
|
@ -0,0 +1,30 @@
|
|||
package com.raytheon.uf.viz.datadelivery.system;
|
||||
|
||||
/**
|
||||
* System status refresh notifier interface.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Nov 14, 2013 2387 skorolev Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author skorolev
|
||||
* @version 1.0
|
||||
*/
|
||||
public interface ISystemStatusListener {
|
||||
|
||||
/**
|
||||
* Refresh system status for Registers and Providers.
|
||||
*/
|
||||
void statusRefresh();
|
||||
|
||||
/**
|
||||
* Refresh time label for next refresh.
|
||||
*/
|
||||
void timeLabelRefresh();
|
||||
}
|
|
@ -20,11 +20,23 @@
|
|||
package com.raytheon.uf.viz.datadelivery.system;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.TimerTask;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.custom.CLabel;
|
||||
import org.eclipse.swt.custom.ScrolledComposite;
|
||||
import org.eclipse.swt.events.SelectionAdapter;
|
||||
import org.eclipse.swt.events.SelectionEvent;
|
||||
import org.eclipse.swt.graphics.Image;
|
||||
import org.eclipse.swt.layout.GridData;
|
||||
import org.eclipse.swt.layout.GridLayout;
|
||||
import org.eclipse.swt.widgets.Button;
|
||||
import org.eclipse.swt.widgets.Combo;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Control;
|
||||
import org.eclipse.swt.widgets.Group;
|
||||
import org.eclipse.swt.widgets.Label;
|
||||
|
||||
|
@ -36,6 +48,8 @@ import com.raytheon.uf.common.datadelivery.request.DataDeliveryConstants;
|
|||
import com.raytheon.uf.common.serialization.comm.RequestRouter;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.common.time.util.TimeUtil;
|
||||
import com.raytheon.uf.viz.core.VizApp;
|
||||
import com.raytheon.uf.viz.core.image.StatusImages;
|
||||
import com.raytheon.uf.viz.core.image.StatusImages.StatusImage;
|
||||
|
||||
|
@ -49,25 +63,44 @@ import com.raytheon.uf.viz.core.image.StatusImages.StatusImage;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Aug 07, 2013 2180 mpduff Initial creation
|
||||
* Nov 18, 2013 2387 skorolev Add status refreshing
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author mpduff
|
||||
* @version 1.0
|
||||
*/
|
||||
public class StatusComposite extends Composite {
|
||||
public class StatusComposite extends Composite implements ISystemStatusListener {
|
||||
private final IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(StatusComposite.class);
|
||||
|
||||
/** Provider Group */
|
||||
private Composite providerComp;
|
||||
private ScrolledComposite providerComp;
|
||||
|
||||
/** Registry Group */
|
||||
private Composite registryComp;
|
||||
private ScrolledComposite registryComp;
|
||||
|
||||
/** Status images */
|
||||
private StatusImages images;
|
||||
|
||||
/** Providers entry composite */
|
||||
private Composite providerEntryComp;
|
||||
|
||||
/** Registers entry composite */
|
||||
private Composite regEntryComp;
|
||||
|
||||
/** Label for time until refresh */
|
||||
private Label timeLbl;
|
||||
|
||||
/** The refresh timer */
|
||||
public ScheduledExecutorService timer;
|
||||
|
||||
/** Refresh period in minutes */
|
||||
public int refreshPeriod = 1;
|
||||
|
||||
/** Counts the seconds until the next refresh */
|
||||
private int secCount = 60;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
|
@ -78,6 +111,7 @@ public class StatusComposite extends Composite {
|
|||
*/
|
||||
public StatusComposite(Composite parent, int style) {
|
||||
super(parent, style);
|
||||
SystemRuleManager.getInstance().registerAsRefreshListener(this);
|
||||
init();
|
||||
}
|
||||
|
||||
|
@ -92,14 +126,38 @@ public class StatusComposite extends Composite {
|
|||
this.setLayout(gl);
|
||||
this.setLayoutData(gd);
|
||||
|
||||
// Legend
|
||||
gl = new GridLayout(4, false);
|
||||
gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
|
||||
final Group legendGrp = new Group(this, SWT.NONE);
|
||||
legendGrp.setText(" Legend ");
|
||||
legendGrp.setLayout(gl);
|
||||
legendGrp.setLayoutData(gd);
|
||||
|
||||
CLabel l1 = new CLabel(legendGrp, SWT.NONE);
|
||||
l1.setImage(images.getStatusImage(StatusImage.GREEN));
|
||||
l1.setText(DataDeliverySystemStatusDefinition.UP.getStatus() + " ");
|
||||
|
||||
CLabel l2 = new CLabel(legendGrp, SWT.NONE);
|
||||
l2.setImage(images.getStatusImage(StatusImage.YELLOW));
|
||||
l2.setText(DataDeliverySystemStatusDefinition.PROBLEM.getStatus()
|
||||
+ " ");
|
||||
|
||||
CLabel l3 = new CLabel(legendGrp, SWT.NONE);
|
||||
l3.setImage(images.getStatusImage(StatusImage.RED));
|
||||
l3.setText(DataDeliverySystemStatusDefinition.DOWN.getStatus() + " ");
|
||||
|
||||
CLabel l4 = new CLabel(legendGrp, SWT.NONE);
|
||||
l4.setImage(images.getStatusImage(StatusImage.UNKNOWN));
|
||||
l4.setText(DataDeliverySystemStatusDefinition.UNKNOWN.getStatus() + "");
|
||||
|
||||
gl = new GridLayout(2, true);
|
||||
gd = new GridData(SWT.FILL, SWT.FILL, true, true);
|
||||
gl.marginWidth = 0;
|
||||
|
||||
Composite sysComp = new Composite(this, SWT.NONE);
|
||||
sysComp.setLayout(gl);
|
||||
sysComp.setLayoutData(gd);
|
||||
|
||||
// Registry group
|
||||
gl = new GridLayout(1, false);
|
||||
gd = new GridData(SWT.FILL, SWT.FILL, true, true);
|
||||
Group registryGrp = new Group(sysComp, SWT.NONE);
|
||||
|
@ -107,12 +165,23 @@ public class StatusComposite extends Composite {
|
|||
registryGrp.setLayout(gl);
|
||||
registryGrp.setLayoutData(gd);
|
||||
|
||||
gl = new GridLayout(1, true);
|
||||
gl = new GridLayout(1, false);
|
||||
gd = new GridData(SWT.FILL, SWT.FILL, true, true);
|
||||
registryComp = new Composite(registryGrp, SWT.NONE);
|
||||
registryComp = new ScrolledComposite(registryGrp, SWT.V_SCROLL
|
||||
| SWT.BORDER);
|
||||
registryComp.setLayout(gl);
|
||||
registryComp.setLayoutData(gd);
|
||||
|
||||
gl = new GridLayout(1, false);
|
||||
gd = new GridData(SWT.FILL, SWT.FILL, true, true);
|
||||
regEntryComp = new Composite(registryComp, SWT.NONE);
|
||||
regEntryComp.setLayout(gl);
|
||||
regEntryComp.setLayoutData(gd);
|
||||
|
||||
registryComp.setContent(regEntryComp);
|
||||
registryComp.layout();
|
||||
|
||||
// Provider group
|
||||
gl = new GridLayout(1, false);
|
||||
gd = new GridData(SWT.FILL, SWT.FILL, true, true);
|
||||
Group providerGroup = new Group(sysComp, SWT.NONE);
|
||||
|
@ -120,44 +189,75 @@ public class StatusComposite extends Composite {
|
|||
providerGroup.setLayout(gl);
|
||||
providerGroup.setLayoutData(gd);
|
||||
|
||||
gl = new GridLayout(1, true);
|
||||
gl = new GridLayout(1, false);
|
||||
gd = new GridData(SWT.FILL, SWT.FILL, true, true);
|
||||
providerComp = new Composite(providerGroup, SWT.NONE);
|
||||
providerComp = new ScrolledComposite(providerGroup, SWT.V_SCROLL
|
||||
| SWT.BORDER);
|
||||
providerComp.setLayout(gl);
|
||||
providerComp.setLayoutData(gd);
|
||||
|
||||
// Legend
|
||||
gl = new GridLayout(8, false);
|
||||
gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
|
||||
Group legendGrp = new Group(this, SWT.NONE);
|
||||
legendGrp.setText(" Legend ");
|
||||
legendGrp.setLayout(gl);
|
||||
legendGrp.setLayoutData(gd);
|
||||
gl = new GridLayout(1, false);
|
||||
gd = new GridData(SWT.FILL, SWT.FILL, true, true);
|
||||
providerEntryComp = new Composite(providerComp, SWT.NONE);
|
||||
providerEntryComp.setLayout(gl);
|
||||
providerEntryComp.setLayoutData(gd);
|
||||
|
||||
Label l = new Label(legendGrp, SWT.NONE);
|
||||
l.setImage(images.getStatusImage(StatusImage.GREEN));
|
||||
providerComp.setContent(providerEntryComp);
|
||||
providerComp.layout();
|
||||
|
||||
Label l2 = new Label(legendGrp, SWT.NONE);
|
||||
l2.setText(DataDeliverySystemStatusDefinition.UP.getStatus() + " ");
|
||||
// Refresh group
|
||||
gl = new GridLayout(3, false);
|
||||
gd = new GridData(SWT.FILL, SWT.FILL, true, true);
|
||||
Composite refreshGrp = new Composite(this, SWT.NONE);
|
||||
refreshGrp.setLayout(gl);
|
||||
refreshGrp.setLayoutData(gd);
|
||||
|
||||
Label l3 = new Label(legendGrp, SWT.NONE);
|
||||
l3.setImage(images.getStatusImage(StatusImage.YELLOW));
|
||||
Label refPeriodLbl = new Label(refreshGrp, SWT.NONE);
|
||||
refPeriodLbl.setText("Refresh Period (Minutes):");
|
||||
|
||||
Label l4 = new Label(legendGrp, SWT.NONE);
|
||||
l4.setText(DataDeliverySystemStatusDefinition.PROBLEM.getStatus()
|
||||
+ " ");
|
||||
String[] periodsText = { "1", "2", "3", "4", "5", "6", "7", "8", "9",
|
||||
"10" };
|
||||
final Combo periodSelectionCbo = new Combo(refreshGrp, SWT.BORDER
|
||||
| SWT.READ_ONLY);
|
||||
periodSelectionCbo.setItems(periodsText);
|
||||
// Set default period
|
||||
periodSelectionCbo.select(0);
|
||||
GridData typeComboData = new GridData(GridData.FILL);
|
||||
typeComboData.widthHint = 70;
|
||||
periodSelectionCbo.setLayoutData(typeComboData);
|
||||
|
||||
Label l5 = new Label(legendGrp, SWT.NONE);
|
||||
l5.setImage(images.getStatusImage(StatusImage.RED));
|
||||
Button nextRefreshBtn = new Button(refreshGrp, SWT.NONE);
|
||||
nextRefreshBtn.setText("Refresh");
|
||||
nextRefreshBtn.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
statusRefresh();
|
||||
restartTimer();
|
||||
}
|
||||
});
|
||||
|
||||
Label l6 = new Label(legendGrp, SWT.NONE);
|
||||
l6.setText(DataDeliverySystemStatusDefinition.DOWN.getStatus() + " ");
|
||||
Label nextRefreshLbl = new Label(refreshGrp, SWT.NONE);
|
||||
nextRefreshLbl.setText("Next refresh:");
|
||||
final GridData ltData = new GridData(SWT.END, SWT.NONE, false, true);
|
||||
nextRefreshLbl.setLayoutData(ltData);
|
||||
|
||||
Label l7 = new Label(legendGrp, SWT.NONE);
|
||||
l7.setImage(images.getStatusImage(StatusImage.UNKNOWN));
|
||||
// Time before next refresh.
|
||||
timeLbl = new Label(refreshGrp, SWT.NONE);
|
||||
final GridData lcData = new GridData(SWT.BEGINNING, SWT.NONE, false,
|
||||
true);
|
||||
timeLbl.setLayoutData(lcData);
|
||||
timeLbl.setText("");
|
||||
refreshGrp.layout();
|
||||
|
||||
Label l8 = new Label(legendGrp, SWT.NONE);
|
||||
l8.setText(DataDeliverySystemStatusDefinition.UNKNOWN.getStatus() + "");
|
||||
periodSelectionCbo.addSelectionListener(new SelectionAdapter() {
|
||||
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
setRefreshPeriod(periodSelectionCbo.indexOf(periodSelectionCbo
|
||||
.getText()) + 1);
|
||||
statusRefresh();
|
||||
restartTimer();
|
||||
};
|
||||
});
|
||||
|
||||
populate();
|
||||
}
|
||||
|
@ -198,29 +298,13 @@ public class StatusComposite extends Composite {
|
|||
*/
|
||||
private void addProviders(List<DataDeliverySystemStatus> dataList) {
|
||||
for (DataDeliverySystemStatus status : dataList) {
|
||||
GridLayout gl = new GridLayout(2, false);
|
||||
GridData gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
|
||||
Composite entryComp = new Composite(providerComp, SWT.NONE);
|
||||
entryComp.setLayout(gl);
|
||||
entryComp.setLayoutData(gd);
|
||||
|
||||
Label l = new Label(entryComp, SWT.NONE);
|
||||
if (DataDeliverySystemStatusDefinition.UP.getStatus().equals(
|
||||
status.getStatus())) {
|
||||
l.setImage(images.getStatusImage(StatusImage.GREEN));
|
||||
} else if (DataDeliverySystemStatusDefinition.PROBLEM.getStatus()
|
||||
.equals(status.getStatus())) {
|
||||
l.setImage(images.getStatusImage(StatusImage.YELLOW));
|
||||
} else if (DataDeliverySystemStatusDefinition.DOWN.getStatus()
|
||||
.equals(status.getStatus())) {
|
||||
l.setImage(images.getStatusImage(StatusImage.RED));
|
||||
} else {
|
||||
l.setImage(images.getStatusImage(StatusImage.UNKNOWN));
|
||||
}
|
||||
|
||||
Label nameLbl = new Label(entryComp, SWT.NONE);
|
||||
nameLbl.setText(status.getKey().getName());
|
||||
CLabel l = new CLabel(providerEntryComp, SWT.NONE);
|
||||
l.setImage(getStatusImage(status));
|
||||
l.setText(status.getKey().getName());
|
||||
}
|
||||
providerEntryComp.setSize(providerEntryComp.computeSize(SWT.DEFAULT,
|
||||
SWT.DEFAULT));
|
||||
providerEntryComp.layout();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -231,28 +315,138 @@ public class StatusComposite extends Composite {
|
|||
*/
|
||||
private void addRegistries(List<DataDeliverySystemStatus> dataList) {
|
||||
for (DataDeliverySystemStatus status : dataList) {
|
||||
GridLayout gl = new GridLayout(2, false);
|
||||
GridData gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
|
||||
Composite entryComp = new Composite(registryComp, SWT.NONE);
|
||||
entryComp.setLayout(gl);
|
||||
entryComp.setLayoutData(gd);
|
||||
CLabel l = new CLabel(regEntryComp, SWT.NONE);
|
||||
l.setImage(getStatusImage(status));
|
||||
l.setText(status.getKey().getName());
|
||||
}
|
||||
regEntryComp
|
||||
.setSize(regEntryComp.computeSize(SWT.DEFAULT, SWT.DEFAULT));
|
||||
regEntryComp.layout();
|
||||
}
|
||||
|
||||
Label l = new Label(entryComp, SWT.NONE);
|
||||
if (DataDeliverySystemStatusDefinition.UP.getStatus().equals(
|
||||
status.getStatus())) {
|
||||
l.setImage(images.getStatusImage(StatusImage.GREEN));
|
||||
} else if (DataDeliverySystemStatusDefinition.PROBLEM.getStatus()
|
||||
.equals(status.getStatus())) {
|
||||
l.setImage(images.getStatusImage(StatusImage.YELLOW));
|
||||
} else if (DataDeliverySystemStatusDefinition.DOWN.getStatus()
|
||||
.equals(status.getStatus())) {
|
||||
l.setImage(images.getStatusImage(StatusImage.RED));
|
||||
} else {
|
||||
l.setImage(images.getStatusImage(StatusImage.UNKNOWN));
|
||||
/**
|
||||
* Get status image.
|
||||
*
|
||||
* @param status
|
||||
* @return
|
||||
*/
|
||||
private Image getStatusImage(DataDeliverySystemStatus status) {
|
||||
Image retValue = null;
|
||||
if (DataDeliverySystemStatusDefinition.UP.getStatus().equals(
|
||||
status.getStatus())) {
|
||||
retValue = images.getStatusImage(StatusImage.GREEN);
|
||||
} else if (DataDeliverySystemStatusDefinition.PROBLEM.getStatus()
|
||||
.equals(status.getStatus())) {
|
||||
retValue = images.getStatusImage(StatusImage.YELLOW);
|
||||
} else if (DataDeliverySystemStatusDefinition.DOWN.getStatus().equals(
|
||||
status.getStatus())) {
|
||||
retValue = images.getStatusImage(StatusImage.RED);
|
||||
} else {
|
||||
retValue = images.getStatusImage(StatusImage.UNKNOWN);
|
||||
}
|
||||
return retValue;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.datadelivery.system.ISystemStatusListener#statusRefresh
|
||||
* ()
|
||||
*/
|
||||
@Override
|
||||
public void statusRefresh() {
|
||||
for (Control control : providerEntryComp.getChildren()) {
|
||||
control.dispose();
|
||||
}
|
||||
for (Control control : regEntryComp.getChildren()) {
|
||||
control.dispose();
|
||||
}
|
||||
populate();
|
||||
registryComp.layout(true);
|
||||
providerComp.layout(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Refresh inner class
|
||||
*/
|
||||
private class RefreshTask extends TimerTask {
|
||||
@Override
|
||||
public void run() {
|
||||
secCount--;
|
||||
VizApp.runAsync(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
SystemRuleManager.getInstance().fireTimeChangeListener();
|
||||
}
|
||||
});
|
||||
if (secCount == 0) {
|
||||
VizApp.runAsync(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
secCount = refreshPeriod * TimeUtil.SECONDS_PER_MINUTE;
|
||||
SystemRuleManager.getInstance()
|
||||
.fireStatusChangeListener();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Label nameLbl = new Label(entryComp, SWT.NONE);
|
||||
nameLbl.setText(status.getKey().getName());
|
||||
/**
|
||||
* Create the refresh timer.
|
||||
*/
|
||||
public void createTimer() {
|
||||
long updateRate = TimeUtil.MILLIS_PER_SECOND;
|
||||
timer = Executors.newSingleThreadScheduledExecutor();
|
||||
timer.scheduleAtFixedRate(new RefreshTask(), 0, updateRate,
|
||||
TimeUnit.MILLISECONDS);
|
||||
}
|
||||
|
||||
/**
|
||||
* Restart refresh timer.
|
||||
*/
|
||||
protected void restartTimer() {
|
||||
timer.shutdownNow();
|
||||
secCount = refreshPeriod * TimeUtil.SECONDS_PER_MINUTE;
|
||||
createTimer();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Refresh period
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public int getRefreshPeriod() {
|
||||
return refreshPeriod;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Refresh period
|
||||
*
|
||||
* @param refreshPeriod
|
||||
*/
|
||||
public void setRefreshPeriod(int period) {
|
||||
this.refreshPeriod = period;
|
||||
}
|
||||
|
||||
/*
|
||||
* Refresh time label.
|
||||
*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.uf.viz.datadelivery.system.ISystemStatusListener#
|
||||
* timeLabelRefresh()
|
||||
*/
|
||||
@Override
|
||||
public void timeLabelRefresh() {
|
||||
if (timeLbl != null || !timeLbl.isDisposed()) {
|
||||
if (secCount < 120) {
|
||||
timeLbl.setText(secCount + " sec.");
|
||||
} else {
|
||||
timeLbl.setText((int) (secCount / 60) + 1 + " min.");
|
||||
}
|
||||
timeLbl.pack();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,6 +25,8 @@ import java.util.Set;
|
|||
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.custom.StackLayout;
|
||||
import org.eclipse.swt.events.DisposeEvent;
|
||||
import org.eclipse.swt.events.DisposeListener;
|
||||
import org.eclipse.swt.events.SelectionAdapter;
|
||||
import org.eclipse.swt.events.SelectionEvent;
|
||||
import org.eclipse.swt.layout.GridData;
|
||||
|
@ -63,6 +65,7 @@ import com.raytheon.viz.ui.presenter.IDisplay;
|
|||
* Jul 16, 2013 1655 mpduff Add system status tab.
|
||||
* Aug 08, 2013 2180 mpduff Redesigned UI.
|
||||
* Oct 03, 2013 2386 mpduff Implemented multiple data types for overlap rules
|
||||
* Nov 19, 2013 2387 skorolev Add timer for status refresh.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -194,6 +197,8 @@ public class SystemManagementDlg extends CaveSWTDialog implements IDisplay,
|
|||
comp.setLayoutData(gd);
|
||||
|
||||
gl = new GridLayout(1, false);
|
||||
gl.marginHeight = 0;
|
||||
gl.marginWidth = 0;
|
||||
gd = new GridData(SWT.FILL, SWT.FILL, true, true);
|
||||
gd.minimumWidth = 220;
|
||||
treeComp = new Composite(comp, SWT.BORDER);
|
||||
|
@ -202,12 +207,14 @@ public class SystemManagementDlg extends CaveSWTDialog implements IDisplay,
|
|||
|
||||
gl = new GridLayout(1, false);
|
||||
gd = new GridData(SWT.FILL, SWT.FILL, true, true);
|
||||
tree = new Tree(treeComp, SWT.BORDER);
|
||||
tree = new Tree(treeComp, SWT.NO_SCROLL);
|
||||
tree.setLayout(gl);
|
||||
tree.setLayoutData(gd);
|
||||
populateTree();
|
||||
|
||||
gl = new GridLayout(1, false);
|
||||
gl.marginHeight = 0;
|
||||
gl.marginWidth = 0;
|
||||
gd = new GridData(SWT.FILL, SWT.FILL, true, true);
|
||||
Composite c = new Composite(comp, SWT.BORDER);
|
||||
c.setLayout(gl);
|
||||
|
@ -221,6 +228,17 @@ public class SystemManagementDlg extends CaveSWTDialog implements IDisplay,
|
|||
|
||||
createComposites();
|
||||
createBottomButtons();
|
||||
|
||||
systemStatusComp.createTimer();
|
||||
|
||||
comp.addDisposeListener(new DisposeListener() {
|
||||
@Override
|
||||
public void widgetDisposed(DisposeEvent e) {
|
||||
systemStatusComp.timer.shutdown();
|
||||
SystemRuleManager.getInstance().deregisterAsRefreshListener(
|
||||
systemStatusComp);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -318,7 +336,7 @@ public class SystemManagementDlg extends CaveSWTDialog implements IDisplay,
|
|||
GridLayout gl = new GridLayout(1, false);
|
||||
GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
|
||||
|
||||
systemStatusComp = new StatusComposite(stackComp, SWT.BORDER);
|
||||
systemStatusComp = new StatusComposite(stackComp, SWT.NONE);
|
||||
systemStatusComp.setLayout(gl);
|
||||
systemStatusComp.setLayoutData(gd);
|
||||
compMap.put(
|
||||
|
@ -327,14 +345,14 @@ public class SystemManagementDlg extends CaveSWTDialog implements IDisplay,
|
|||
|
||||
gl = new GridLayout(1, false);
|
||||
gd = new GridData(SWT.FILL, SWT.FILL, true, true);
|
||||
bandwidthComp = new BandwidthComposite(stackComp, SWT.BORDER);
|
||||
bandwidthComp = new BandwidthComposite(stackComp, SWT.NONE);
|
||||
bandwidthComp.setLayout(gl);
|
||||
bandwidthComp.setLayoutData(gd);
|
||||
compMap.put(SystemManagementSettings.BANDWIDTH.getName(), bandwidthComp);
|
||||
|
||||
gl = new GridLayout(1, false);
|
||||
gd = new GridData(SWT.FILL, SWT.FILL, true, true);
|
||||
systemLatencyComp = new SystemLatencyComposite(stackComp, SWT.BORDER);
|
||||
systemLatencyComp = new SystemLatencyComposite(stackComp, SWT.NONE);
|
||||
systemLatencyComp.setLayout(gl);
|
||||
systemLatencyComp.setLayoutData(gd);
|
||||
compMap.put(SystemManagementSettings.LATENCY_RULES.getName(),
|
||||
|
@ -342,7 +360,7 @@ public class SystemManagementDlg extends CaveSWTDialog implements IDisplay,
|
|||
|
||||
gl = new GridLayout(1, false);
|
||||
gd = new GridData(SWT.FILL, SWT.FILL, true, true);
|
||||
systemPriorityComp = new SystemPriorityComposite(stackComp, SWT.BORDER);
|
||||
systemPriorityComp = new SystemPriorityComposite(stackComp, SWT.NONE);
|
||||
systemPriorityComp.setLayout(gl);
|
||||
systemPriorityComp.setLayoutData(gd);
|
||||
compMap.put(SystemManagementSettings.PRIORITY_RULES.getName(),
|
||||
|
@ -350,7 +368,7 @@ public class SystemManagementDlg extends CaveSWTDialog implements IDisplay,
|
|||
|
||||
gl = new GridLayout(1, false);
|
||||
gd = new GridData(SWT.FILL, SWT.FILL, true, true);
|
||||
passwdComp = new DataProviderPasswordComposite(stackComp, SWT.BORDER);
|
||||
passwdComp = new DataProviderPasswordComposite(stackComp, SWT.NONE);
|
||||
passwdComp.setLayout(gl);
|
||||
passwdComp.setLayoutData(gd);
|
||||
compMap.put(SystemManagementSettings.DATA_PROVIDER_PASSWORD.getName(),
|
||||
|
@ -393,7 +411,10 @@ public class SystemManagementDlg extends CaveSWTDialog implements IDisplay,
|
|||
@Override
|
||||
protected void disposed() {
|
||||
super.disposed();
|
||||
systemStatusComp.timer.shutdownNow();
|
||||
SystemRuleManager.getInstance().deregisterAsListener(this);
|
||||
SystemRuleManager.getInstance().deregisterAsRefreshListener(
|
||||
systemStatusComp);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -78,6 +78,7 @@ import com.raytheon.uf.viz.datadelivery.utils.TypeOperationItems;
|
|||
* Jun 04, 2013 223 mpduff Implement point data types.
|
||||
* Jul 11, 2013 2106 djohnson setAvailableBandwidth service now returns names of subscriptions.
|
||||
* Oct 03, 2013 2386 mpduff Add overlap rules.
|
||||
* Nov 19, 2013 2387 skorolev Add system status refresh listeners.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -141,6 +142,9 @@ public class SystemRuleManager {
|
|||
/** List of listeners */
|
||||
private final List<IRulesUpdateListener> listeners = new ArrayList<IRulesUpdateListener>();
|
||||
|
||||
/** List of system refresh listeners */
|
||||
private final List<ISystemStatusListener> refListeners = new ArrayList<ISystemStatusListener>();
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
|
@ -898,4 +902,46 @@ public class SystemRuleManager {
|
|||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Notify the listeners the system status change.
|
||||
*/
|
||||
public void fireStatusChangeListener() {
|
||||
for (ISystemStatusListener listener : refListeners) {
|
||||
listener.statusRefresh();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Notify the listeners the time change.
|
||||
*/
|
||||
public void fireTimeChangeListener() {
|
||||
for (ISystemStatusListener listener : refListeners) {
|
||||
listener.timeLabelRefresh();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Register as a listener for status refresh.
|
||||
*
|
||||
* @param listener
|
||||
*/
|
||||
public void registerAsRefreshListener(ISystemStatusListener listener) {
|
||||
if (!refListeners.contains(listener)) {
|
||||
refListeners.add(listener);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Unregister as a listener for status refresh.
|
||||
*
|
||||
* @param listener
|
||||
*/
|
||||
public void deregisterAsRefreshListener(ISystemStatusListener listener) {
|
||||
if (refListeners.contains(listener)) {
|
||||
refListeners.remove(listener);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue