SICS Device Status Gadget_135856370 - Gumtree/gumtree GitHub Wiki
Created by Tony Lam, last modified on Dec 09, 2009
SICS device status gadget is a generic component for displaying dynamic components from the hipadabase tree.
The layout of the gadget is follow:
To add devices for status monitoring programmatically, try:
This gadget is also designed to be run with dashboard, so devices can be set via single string:
To enable icon support, you need to supply "DeviceStatusGadget.SHOW_ICON" to the style, and set ILabelProvider to the gadget.
Unit support is enabled by supplying "DeviceStatusGadget.SHOW_UNIT" to the style.
You can also add a separator in between by adding empyt URI, for example:
Above will add a separator between motors phi and chi.
You can create a fixed gadget for monitoring a set of predefined devices by subclassing this status widget:
Image:attachments/135856370/136019975.png
To include icons:
Image:attachments/135856370/136019976.png
This gadget can be used as custom SWT component, or embedded into the dashboard:
Image:attachments/135856370/136019977.png
Style is set to 4 for showing unit.
| icon (optional) | device label | current value | unit (optional) |
| icon (optional) | device label | current value | unit (optional) |
| ... |
gadget.getDeviceURIList().add(<URI>)
// Use comma separated uri string gadget.setDeviceURIs("sics://hdb/sample/phi, sics://hdb/sample/chi")
// Use comma separated uri string gadget.setDeviceURIs("sics://hdb/sample/phi, , sics://hdb/sample/chi")
public class WombatMotorStatusGadget extends DeviceStatusGadget {
public WombatMotorStatusGadget(Composite parent, int style) {
super(parent, SHOW_UNIT);
setDeviceURIs("sics://hdb/sample/phi, sics://hdb/sample/chi");
}
}
To include icons:
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Composite;
import org.gumtree.gumnix.sics.ui.widget.DeviceStatusGadget;
import au.gov.ansto.bragg.nbi.ui.internal.InternalImage;
public class ReactorSourceGadget extends DeviceStatusGadget {
private static URI URI_POWER = URI.create("sics://hdb/instrument/source/power");
private static URI URI_CNS_IN = URI.create("sics://hdb/instrument/source/cns_inlet_temp");
private static URI URI_CNS_OUT = URI.create("sics://hdb/instrument/source/cns_outlet_temp");
public ReactorSourceGadget(Composite parent, int style) {
super(parent, SHOW_ICON | SHOW_UNIT);
getDeviceURIList().add(URI_POWER);
getDeviceURIList().add(URI_CNS_IN);
getDeviceURIList().add(URI_CNS_OUT);
setLabelProvider(new LabelProvider() {
public Image getImage(Object element) {
URI uri = (URI) element;
if (uri.equals(URI_POWER)) {
return InternalImage.POWER_16.getImage();
} else if (uri.equals(URI_CNS_IN)) {
return InternalImage.INLET_16.getImage();
} else if (uri.equals(URI_CNS_OUT)) {
return InternalImage.OUTLET_16.getImage();
}
return null;
}
public String getText(Object element) {
URI uri = (URI) element;
if (uri.equals(URI_POWER)) {
return "Power";
} else if (uri.equals(URI_CNS_IN)) {
return "CNS In";
} else if (uri.equals(URI_CNS_OUT)) {
return "CNS Out";
}
return "";
}
});
}
}
<dashboard title="Wombat Control" layoutConstraints="flowx">
<widget classname="org.gumtree.gumnix.sics.ui.widget.DeviceStatusGadget" title="Status" style="4">
<parameters>
<deviceURIs>
sics://hdb/sample/translate_x,
sics://hdb/sample/rotate
</deviceURIs>
</parameters>
</widget>
</dashboard>
Style is set to 4 for showing unit.
Image:images/icons/bullet_blue.gif
(image/png)
Image:images/icons/bullet_blue.gif
(image/png)
Image:images/icons/bullet_blue.gif
(image/png)
(image/png)Image:images/icons/bullet_blue.gif
(image/png)Image:images/icons/bullet_blue.gif
(image/png)
Document generated by Confluence on Apr 01, 2015 00:11