Search in sources :

Example 6 with Location

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);
}
Also used : Group(org.eclipse.swt.widgets.Group) SelectionListener(org.eclipse.swt.events.SelectionListener) Listener(org.eclipse.swt.widgets.Listener) TreeItem(org.eclipse.swt.widgets.TreeItem) Label(org.eclipse.swt.widgets.Label) Text(org.eclipse.swt.widgets.Text) IllegalOperationException(cl.utfsm.acs.acg.core.IllegalOperationException) FaultMemberDefault(alma.acs.alarmsystem.generated.FaultMemberDefault) GridLayout(org.eclipse.swt.layout.GridLayout) GridData(org.eclipse.swt.layout.GridData) Event(org.eclipse.swt.widgets.Event) SelectionEvent(org.eclipse.swt.events.SelectionEvent) Location(alma.acs.alarmsystem.generated.Location)

Aggregations

Location (alma.acs.alarmsystem.generated.Location)6 FaultMember (alma.acs.alarmsystem.generated.FaultMember)5 Contact (alma.acs.alarmsystem.generated.Contact)4 FaultCode (alma.acs.alarmsystem.generated.FaultCode)4 FaultFamily (alma.acs.alarmsystem.generated.FaultFamily)4 FaultMemberDefault (alma.acs.alarmsystem.generated.FaultMemberDefault)4 Alarm (cern.laser.business.data.Alarm)3 IllegalOperationException (cl.utfsm.acs.acg.core.IllegalOperationException)2 SelectionEvent (org.eclipse.swt.events.SelectionEvent)2 SelectionListener (org.eclipse.swt.events.SelectionListener)2 GridData (org.eclipse.swt.layout.GridData)2 GridLayout (org.eclipse.swt.layout.GridLayout)2 Event (org.eclipse.swt.widgets.Event)2 Group (org.eclipse.swt.widgets.Group)2 Label (org.eclipse.swt.widgets.Label)2 Listener (org.eclipse.swt.widgets.Listener)2 Text (org.eclipse.swt.widgets.Text)2 TreeItem (org.eclipse.swt.widgets.TreeItem)2