use of alma.acs.alarmsystem.generated.Location in project ACS by ACS-Community.
the class AlarmsView method createFMDWidgets.
private void createFMDWidgets() {
Listener updateFaultMemberDefault = new Listener() {
public void handleEvent(Event event) {
TreeItem tmp = _tree.getSelection()[0];
String tff = tmp.getParentItem().getParentItem().getText();
FaultMemberDefault fmdt = new FaultMemberDefault();
Location lt = new Location();
if (!_fmdLocBuildingText.getText().isEmpty())
lt.setBuilding(_fmdLocBuildingText.getText());
if (!_fmdLocFloorText.getText().isEmpty())
lt.setFloor(_fmdLocFloorText.getText());
if (!_fmdLocRoomText.getText().isEmpty())
lt.setRoom(_fmdLocRoomText.getText());
if (!_fmdLocMnemonicText.getText().isEmpty())
lt.setMnemonic(_fmdLocMnemonicText.getText());
if (!_fmdLocPositionText.getText().isEmpty())
lt.setPosition(_fmdLocPositionText.getText());
fmdt.setLocation(lt);
_fmdErrorMessageLabel.setText("");
try {
_alarmManager.setFaultMemberDefault(_alarmManager.getFaultFamily(tff), fmdt);
tmp.setText("Default Member");
//sortFaultFamilyList();
//selectElementFromTree(tff, "Default Member", null);
} catch (IllegalOperationException e) {
_fmdErrorMessageLabel.setText(e.getMessage());
} catch (NullPointerException e) {
_fmdErrorMessageLabel.setText(e.getMessage());
}
}
};
_FMDgroup = new Group(_compInitial, SWT.SHADOW_ETCHED_IN);
_FMDgroup.setText("Default Fault Member details");
GridData gd = new GridData();
gd.horizontalAlignment = SWT.FILL;
gd.grabExcessHorizontalSpace = true;
gd.verticalAlignment = SWT.FILL;
gd.grabExcessVerticalSpace = true;
_FMDgroup.setLayoutData(gd);
GridLayout gl = new GridLayout();
gl.numColumns = 2;
_FMDgroup.setLayout(gl);
_fmdLocGroup = new Group(_FMDgroup, SWT.SHADOW_ETCHED_IN);
_fmdLocGroup.setText("Location");
gl = new GridLayout();
gl.numColumns = 2;
gd = new GridData();
gd.horizontalAlignment = SWT.FILL;
gd.grabExcessHorizontalSpace = true;
gd.horizontalSpan = 2;
_fmdLocGroup.setLayout(gl);
_fmdLocGroup.setLayoutData(gd);
_fmdLocBuildingLabel = new Label(_fmdLocGroup, SWT.NONE);
_fmdLocBuildingLabel.setText("Building");
_fmdLocBuildingText = new Text(_fmdLocGroup, SWT.SINGLE | SWT.BORDER);
gd = new GridData();
gd.grabExcessHorizontalSpace = true;
gd.horizontalAlignment = SWT.FILL;
_fmdLocBuildingText.setLayoutData(gd);
_fmdLocBuildingText.addListener(SWT.Modify, updateFaultMemberDefault);
_fmdLocFloorLabel = new Label(_fmdLocGroup, SWT.NONE);
_fmdLocFloorLabel.setText("Floor");
_fmdLocFloorText = new Text(_fmdLocGroup, SWT.SINGLE | SWT.BORDER);
gd = new GridData();
gd.grabExcessHorizontalSpace = true;
gd.horizontalAlignment = SWT.FILL;
_fmdLocFloorText.setLayoutData(gd);
_fmdLocFloorText.addListener(SWT.Modify, updateFaultMemberDefault);
_fmdLocRoomLabel = new Label(_fmdLocGroup, SWT.NONE);
_fmdLocRoomLabel.setText("Room");
_fmdLocRoomText = new Text(_fmdLocGroup, SWT.SINGLE | SWT.BORDER);
gd = new GridData();
gd.grabExcessHorizontalSpace = true;
gd.horizontalAlignment = SWT.FILL;
_fmdLocRoomText.setLayoutData(gd);
_fmdLocRoomText.addListener(SWT.Modify, updateFaultMemberDefault);
_fmdLocMnemonicLabel = new Label(_fmdLocGroup, SWT.NONE);
_fmdLocMnemonicLabel.setText("Mnemonic");
_fmdLocMnemonicText = new Text(_fmdLocGroup, SWT.SINGLE | SWT.BORDER);
gd = new GridData();
gd.grabExcessHorizontalSpace = true;
gd.horizontalAlignment = SWT.FILL;
_fmdLocMnemonicText.setLayoutData(gd);
_fmdLocMnemonicText.addListener(SWT.Modify, updateFaultMemberDefault);
_fmdLocPositionLabel = new Label(_fmdLocGroup, SWT.NONE);
_fmdLocPositionLabel.setText("Position");
_fmdLocPositionText = new Text(_fmdLocGroup, SWT.SINGLE | SWT.BORDER);
gd = new GridData();
gd.grabExcessHorizontalSpace = true;
gd.horizontalAlignment = SWT.FILL;
_fmdLocPositionText.setLayoutData(gd);
_fmdLocPositionText.addListener(SWT.Modify, updateFaultMemberDefault);
_fmdErrorMessageLabel = new Label(_FMDgroup, SWT.NONE);
_fmdErrorMessageLabel.setText("");
_fmdErrorMessageLabel.setForeground(getViewSite().getShell().getDisplay().getSystemColor(SWT.COLOR_RED));
gd = new GridData();
gd.grabExcessHorizontalSpace = true;
gd.horizontalAlignment = SWT.FILL;
gd.horizontalSpan = 2;
_fmdErrorMessageLabel.setLayoutData(gd);
}
Aggregations