Search in sources :

Example 1 with SensorCommon

use of org.netxms.ui.eclipse.objectmanager.widgets.SensorCommon in project netxms by netxms.

the class SensorProperties method createContents.

/* (non-Javadoc)
    * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
    */
@Override
protected Control createContents(Composite parent) {
    Composite dialogArea = new Composite(parent, SWT.NONE);
    sensor = (Sensor) getElement().getAdapter(Sensor.class);
    GridLayout layout = new GridLayout();
    layout.verticalSpacing = WidgetHelper.DIALOG_SPACING;
    layout.horizontalSpacing = WidgetHelper.DIALOG_SPACING;
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    dialogArea.setLayout(layout);
    commonData = new SensorCommon(dialogArea, SWT.NONE, null, sensor.getMacAddress().toString(), sensor.getDeviceClass(), sensor.getVendor(), sensor.getSerialNumber(), sensor.getDeviceAddress(), sensor.getMetaType(), sensor.getDescription(), sensor.getProxyId(), sensor.getCommProtocol());
    GridData gd = new GridData();
    gd.verticalAlignment = SWT.TOP;
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    commonData.setLayoutData(gd);
    return dialogArea;
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) GridData(org.eclipse.swt.layout.GridData) SensorCommon(org.netxms.ui.eclipse.objectmanager.widgets.SensorCommon)

Example 2 with SensorCommon

use of org.netxms.ui.eclipse.objectmanager.widgets.SensorCommon in project netxms by netxms.

the class CreateSensorWizard method performFinish.

@Override
public boolean performFinish() {
    cd.setName(first.getObjectName());
    cd.setCommProtocol(first.getCommMethod());
    SensorCommon commonData = first.getCommonData();
    cd.setMacAddress(commonData.getMacAddress());
    cd.setDeviceClass(commonData.getDeviceClass());
    cd.setVendor(commonData.getVendor());
    cd.setSerialNumber(commonData.getSerial());
    cd.setMetaType(commonData.getMetaType());
    cd.setDeviceAddress(commonData.getDeviceAddress());
    cd.setDescription(commonData.getDescription());
    cd.setSensorProxy(commonData.getProxyNode());
    if (cd.getCommProtocol() == Sensor.COMM_LORAWAN)
        cd.setXmlRegConfig(lora.getRegConfig());
    if (cd.getCommProtocol() == Sensor.COMM_LORAWAN)
        cd.setXmlConfig(lora.getConfig());
    return true;
}
Also used : SensorCommon(org.netxms.ui.eclipse.objectmanager.widgets.SensorCommon)

Example 3 with SensorCommon

use of org.netxms.ui.eclipse.objectmanager.widgets.SensorCommon in project netxms by netxms.

the class SensorGeneralPage method createControl.

/* (non-Javadoc)
    * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
    */
@Override
public void createControl(Composite parent) {
    container = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.verticalSpacing = WidgetHelper.DIALOG_SPACING;
    layout.horizontalSpacing = WidgetHelper.DIALOG_SPACING;
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    container.setLayout(layout);
    textObjectName = new LabeledText(container, SWT.NONE);
    textObjectName.setLabel(Messages.get().General_ObjectName);
    textObjectName.setText("");
    GridData gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    textObjectName.setLayoutData(gd);
    textObjectName.getTextControl().addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            getWizard().getContainer().updateButtons();
        }
    });
    comboCommMethod = (Combo) WidgetHelper.createLabeledCombo(container, SWT.BORDER | SWT.READ_ONLY, Messages.get().SensorWizard_General_CommMethod, WidgetHelper.DEFAULT_LAYOUT_DATA);
    comboCommMethod.setItems(Sensor.COMM_METHOD);
    comboCommMethod.select(0);
    gd = new GridData();
    gd.grabExcessHorizontalSpace = false;
    comboCommMethod.setLayoutData(gd);
    comboCommMethod.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            getWizard().getContainer().updateButtons();
        }
    });
    commonData = new SensorCommon(container, SWT.NONE, getWizard());
    gd = new GridData();
    gd.verticalAlignment = SWT.TOP;
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    commonData.setLayoutData(gd);
    setControl(container);
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) ModifyEvent(org.eclipse.swt.events.ModifyEvent) Composite(org.eclipse.swt.widgets.Composite) ModifyListener(org.eclipse.swt.events.ModifyListener) LabeledText(org.netxms.ui.eclipse.widgets.LabeledText) GridData(org.eclipse.swt.layout.GridData) SensorCommon(org.netxms.ui.eclipse.objectmanager.widgets.SensorCommon)

Aggregations

SensorCommon (org.netxms.ui.eclipse.objectmanager.widgets.SensorCommon)3 GridData (org.eclipse.swt.layout.GridData)2 GridLayout (org.eclipse.swt.layout.GridLayout)2 Composite (org.eclipse.swt.widgets.Composite)2 ModifyEvent (org.eclipse.swt.events.ModifyEvent)1 ModifyListener (org.eclipse.swt.events.ModifyListener)1 LabeledText (org.netxms.ui.eclipse.widgets.LabeledText)1