Search in sources :

Example 1 with DciSelector

use of org.netxms.ui.eclipse.datacollection.widgets.DciSelector in project netxms by netxms.

the class TableDataSource method createContents.

/* (non-Javadoc)
	 * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
	 */
@Override
protected Control createContents(Composite parent) {
    config = (TableComparisonChartConfig) getElement().getAdapter(TableComparisonChartConfig.class);
    Composite dialogArea = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.numColumns = 1;
    layout.makeColumnsEqualWidth = true;
    dialogArea.setLayout(layout);
    dci = new DciSelector(dialogArea, SWT.NONE, false);
    dci.setLabel(Messages.get().TableDataSource_Object);
    dci.setDciId(config.getNodeId(), config.getDciId());
    dci.setDcObjectType(DataCollectionObject.DCO_TYPE_TABLE);
    GridData gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    dci.setLayoutData(gd);
    instanceColumn = new LabeledText(dialogArea, SWT.NONE);
    instanceColumn.setLabel(Messages.get().TableDataSource_InstanceColumn);
    instanceColumn.setText(config.getInstanceColumn());
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    instanceColumn.setLayoutData(gd);
    dataColumn = new LabeledText(dialogArea, SWT.NONE);
    dataColumn.setLabel(Messages.get().TableDataSource_DataColumn);
    dataColumn.setText(config.getDataColumn());
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    dataColumn.setLayoutData(gd);
    checkIgnoreZeroValues = new Button(dialogArea, SWT.CHECK);
    checkIgnoreZeroValues.setText(Messages.get().TableDataSource_IgnoreZero);
    checkIgnoreZeroValues.setSelection(config.isIgnoreZeroValues());
    checkSortOnDataColumn = new Button(dialogArea, SWT.CHECK);
    checkSortOnDataColumn.setText("&Sort table on data column");
    checkSortOnDataColumn.setSelection(config.isSortOnDataColumn());
    checkSortDescending = new Button(dialogArea, SWT.CHECK);
    checkSortDescending.setText("Sort &descending");
    checkSortDescending.setSelection(config.isSortDescending());
    return dialogArea;
}
Also used : DciSelector(org.netxms.ui.eclipse.datacollection.widgets.DciSelector) GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) LabeledText(org.netxms.ui.eclipse.widgets.LabeledText) Button(org.eclipse.swt.widgets.Button) GridData(org.eclipse.swt.layout.GridData)

Example 2 with DciSelector

use of org.netxms.ui.eclipse.datacollection.widgets.DciSelector in project netxms by netxms.

the class TableValue method createContents.

/* (non-Javadoc)
	 * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
	 */
@Override
protected Control createContents(Composite parent) {
    config = (TableValueConfig) getElement().getAdapter(TableValueConfig.class);
    Composite dialogArea = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    dialogArea.setLayout(layout);
    dciSelector = new DciSelector(dialogArea, SWT.NONE, true);
    dciSelector.setLabel(Messages.get().TableValue_Table);
    dciSelector.setDcObjectType(DataCollectionObject.DCO_TYPE_TABLE);
    dciSelector.setDciId(config.getObjectId(), config.getDciId());
    GridData gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    dciSelector.setLayoutData(gd);
    title = new LabeledText(dialogArea, SWT.NONE);
    title.setLabel(Messages.get().AlarmViewer_Title);
    title.setText(config.getTitle());
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    title.setLayoutData(gd);
    gd = new GridData();
    gd.verticalAlignment = SWT.TOP;
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    refreshRate = WidgetHelper.createLabeledSpinner(dialogArea, SWT.BORDER, Messages.get().AbstractChart_RefreshInterval, 1, 10000, gd);
    refreshRate.setSelection(config.getRefreshRate());
    return dialogArea;
}
Also used : DciSelector(org.netxms.ui.eclipse.datacollection.widgets.DciSelector) GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) LabeledText(org.netxms.ui.eclipse.widgets.LabeledText) GridData(org.eclipse.swt.layout.GridData)

Example 3 with DciSelector

use of org.netxms.ui.eclipse.datacollection.widgets.DciSelector in project netxms by netxms.

the class DataSourceEditDlg method createDialogArea.

/* (non-Javadoc)
	 * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
	 */
@Override
protected Control createDialogArea(Composite parent) {
    Composite dialogArea = (Composite) super.createDialogArea(parent);
    GridLayout layout = new GridLayout();
    layout.marginHeight = WidgetHelper.DIALOG_HEIGHT_MARGIN;
    layout.marginWidth = WidgetHelper.DIALOG_WIDTH_MARGIN;
    layout.numColumns = 2;
    dialogArea.setLayout(layout);
    dciSelector = new DciSelector(dialogArea, SWT.NONE, false);
    dciSelector.setLabel(Messages.get().DataSourceEditDlg_DCI);
    dciSelector.setDciId(dci.getNodeId(), dci.dciId);
    dciSelector.setDcObjectType(dci.type);
    GridData gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    gd.widthHint = 400;
    gd.horizontalSpan = 2;
    dciSelector.setLayoutData(gd);
    name = new LabeledText(dialogArea, SWT.NONE);
    name.setLabel(Messages.get().DataSourceEditDlg_Name);
    name.setText(dci.name);
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    gd.horizontalSpan = 2;
    name.setLayoutData(gd);
    formatString = new LabeledText(dialogArea, SWT.NONE);
    formatString.setLabel(Messages.get().DataSourceEditDlg_FormatString);
    formatString.setText(dci.formatString);
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    gd.horizontalSpan = 2;
    formatString.setLayoutData(gd);
    if (dci.type == SingleDciConfig.TABLE) {
        Group tableGroup = new Group(dialogArea, SWT.NONE);
        tableGroup.setText(Messages.get().DataSourceEditDlg_TableCell);
        gd = new GridData();
        gd.horizontalAlignment = SWT.FILL;
        gd.grabExcessHorizontalSpace = true;
        gd.horizontalSpan = 2;
        tableGroup.setLayoutData(gd);
        layout = new GridLayout();
        tableGroup.setLayout(layout);
        dataColumn = new LabeledText(tableGroup, SWT.NONE);
        dataColumn.setLabel(Messages.get().DataSourceEditDlg_DataColumn);
        dataColumn.setText(dci.getColumn());
        gd = new GridData();
        gd.horizontalAlignment = SWT.FILL;
        gd.grabExcessHorizontalSpace = true;
        dataColumn.setLayoutData(gd);
        instance = new LabeledText(tableGroup, SWT.NONE);
        instance.setLabel(Messages.get().DataSourceEditDlg_Instance);
        instance.setText(dci.getInstance());
        gd = new GridData();
        gd.horizontalAlignment = SWT.FILL;
        gd.grabExcessHorizontalSpace = true;
        instance.setLayoutData(gd);
    }
    return dialogArea;
}
Also used : DciSelector(org.netxms.ui.eclipse.datacollection.widgets.DciSelector) Group(org.eclipse.swt.widgets.Group) GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) LabeledText(org.netxms.ui.eclipse.widgets.LabeledText) GridData(org.eclipse.swt.layout.GridData)

Example 4 with DciSelector

use of org.netxms.ui.eclipse.datacollection.widgets.DciSelector in project netxms by netxms.

the class GeneralDCIImagePropertyPage method createContents.

@Override
protected Control createContents(Composite parent) {
    container = (NetworkMapDCIImage) getElement().getAdapter(NetworkMapDCIImage.class);
    config = container.getImageOptions();
    SingleDciConfig dciConf = config.getDci();
    Composite dialogArea = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.numColumns = 1;
    layout.makeColumnsEqualWidth = true;
    dialogArea.setLayout(layout);
    dci = new DciSelector(dialogArea, SWT.NONE, false);
    dci.setLabel(Messages.get().GeneralDCIImagePropertyPage_DataSource);
    if (dciConf != null) {
        dci.setDciId(dciConf.getNodeId(), dciConf.getDciId());
        dci.setDciObjectType(dciConf.getType());
    }
    GridData gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    dci.setLayoutData(gd);
    instanceColumn = new LabeledText(dialogArea, SWT.NONE);
    instanceColumn.setLabel(Messages.get().GeneralDCIImagePropertyPage_Column);
    if (dciConf != null)
        instanceColumn.setText(dciConf.getColumn());
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    instanceColumn.setLayoutData(gd);
    dataColumn = new LabeledText(dialogArea, SWT.NONE);
    dataColumn.setLabel(Messages.get().GeneralDCIImagePropertyPage_Instance);
    if (dciConf != null)
        dataColumn.setText(dciConf.getInstance());
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    dataColumn.setLayoutData(gd);
    image = new ImageSelector(dialogArea, SWT.NONE);
    image.setLabel(Messages.get().GeneralDCIImagePropertyPage_DefaultImage);
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    image.setLayoutData(gd);
    try {
        selectedImage = config.getDefaultImage();
        image.setImageGuid(selectedImage, true);
    } catch (Exception e) {
    }
    return dialogArea;
}
Also used : DciSelector(org.netxms.ui.eclipse.datacollection.widgets.DciSelector) GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) LabeledText(org.netxms.ui.eclipse.widgets.LabeledText) GridData(org.eclipse.swt.layout.GridData) ImageSelector(org.netxms.ui.eclipse.imagelibrary.widgets.ImageSelector) SingleDciConfig(org.netxms.client.maps.configs.SingleDciConfig)

Example 5 with DciSelector

use of org.netxms.ui.eclipse.datacollection.widgets.DciSelector in project netxms by netxms.

the class DataSourceEditDlg method createDialogArea.

/* (non-Javadoc)
	 * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
	 */
@Override
protected Control createDialogArea(Composite parent) {
    Composite dialogArea = (Composite) super.createDialogArea(parent);
    GridLayout layout = new GridLayout();
    layout.marginHeight = WidgetHelper.DIALOG_HEIGHT_MARGIN;
    layout.marginWidth = WidgetHelper.DIALOG_WIDTH_MARGIN;
    layout.numColumns = 2;
    dialogArea.setLayout(layout);
    GridData gd = new GridData();
    if (!graphIsTemplate) {
        dciSelector = new DciSelector(dialogArea, SWT.NONE, false);
        dciSelector.setLabel(Messages.get().DataSourceEditDlg_DCI);
        dciSelector.setDciId(dci.nodeId, dci.dciId);
        dciSelector.setDcObjectType(dci.type);
        gd.horizontalAlignment = SWT.FILL;
        gd.grabExcessHorizontalSpace = true;
        gd.widthHint = 400;
        gd.horizontalSpan = 2;
        dciSelector.setLayoutData(gd);
    }
    name = new LabeledText(dialogArea, SWT.NONE);
    name.setLabel(Messages.get().DataSourceEditDlg_DispName);
    name.setText(dci.name);
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    gd.horizontalSpan = 2;
    name.setLayoutData(gd);
    displayFormat = new LabeledText(dialogArea, SWT.NONE);
    displayFormat.setLabel(Messages.get().DataSourceEditDlg_DisplayFormat);
    displayFormat.setText(dci.displayFormat);
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    gd.horizontalSpan = 2;
    displayFormat.setLayoutData(gd);
    if (graphIsTemplate) {
        dciName = new LabeledText(dialogArea, SWT.NONE);
        dciName.setLabel("DCI Name");
        dciName.setText(dci.dciName);
        gd = new GridData();
        gd.horizontalAlignment = SWT.FILL;
        gd.grabExcessHorizontalSpace = true;
        gd.horizontalSpan = 2;
        dciName.setLayoutData(gd);
        dciDescription = new LabeledText(dialogArea, SWT.NONE);
        dciDescription.setLabel("DCI Description");
        dciDescription.setText(dci.dciDescription);
        gd = new GridData();
        gd.horizontalAlignment = SWT.FILL;
        gd.grabExcessHorizontalSpace = true;
        gd.horizontalSpan = 2;
        dciDescription.setLayoutData(gd);
    }
    if (dci.type == ChartDciConfig.TABLE) {
        Group tableGroup = new Group(dialogArea, SWT.NONE);
        tableGroup.setText(Messages.get().DataSourceEditDlg_TableCell);
        gd = new GridData();
        gd.horizontalAlignment = SWT.FILL;
        gd.grabExcessHorizontalSpace = true;
        gd.horizontalSpan = 2;
        tableGroup.setLayoutData(gd);
        layout = new GridLayout();
        tableGroup.setLayout(layout);
        dataColumn = new LabeledText(tableGroup, SWT.NONE);
        dataColumn.setLabel(Messages.get().DataSourceEditDlg_DataColumn);
        dataColumn.setText(dci.column);
        gd = new GridData();
        gd.horizontalAlignment = SWT.FILL;
        gd.grabExcessHorizontalSpace = true;
        dataColumn.setLayoutData(gd);
        instance = new LabeledText(tableGroup, SWT.NONE);
        instance.setLabel(Messages.get().DataSourceEditDlg_Instance);
        instance.setText(dci.instance);
        gd = new GridData();
        gd.horizontalAlignment = SWT.FILL;
        gd.grabExcessHorizontalSpace = true;
        instance.setLayoutData(gd);
    }
    /**
     * Display type **
     */
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.verticalAlignment = SWT.TOP;
    displayType = WidgetHelper.createLabeledCombo(dialogArea, SWT.READ_ONLY | SWT.BORDER, "Display type", gd);
    displayType.add("Default");
    displayType.add("Line");
    displayType.add("Area");
    displayType.select(dci.getDisplayType());
    /**
     * Options group **
     */
    Group optionsGroup = new Group(dialogArea, SWT.NONE);
    optionsGroup.setText(Messages.get().DataSourceEditDlg_Options);
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    gd.verticalAlignment = SWT.TOP;
    gd.verticalSpan = 2;
    optionsGroup.setLayoutData(gd);
    layout = new GridLayout();
    optionsGroup.setLayout(layout);
    checkShowThresholds = new Button(optionsGroup, SWT.CHECK);
    checkShowThresholds.setText(Messages.get().DataSourceEditDlg_ShowThresholds);
    checkShowThresholds.setSelection(dci.showThresholds);
    checkInvertValues = new Button(optionsGroup, SWT.CHECK);
    checkInvertValues.setText(Messages.get().DataSourceEditDlg_InvertValues);
    checkInvertValues.setSelection(dci.invertValues);
    if (graphIsTemplate) {
        checkMultipeMatch = new Button(optionsGroup, SWT.CHECK);
        checkMultipeMatch.setText("Multiple match");
        checkMultipeMatch.setSelection(dci.multiMatch);
    }
    /**
     * Color group **
     */
    Group colorGroup = new Group(dialogArea, SWT.NONE);
    colorGroup.setText(Messages.get().DataSourceEditDlg_Color);
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    gd.verticalAlignment = SWT.FILL;
    colorGroup.setLayoutData(gd);
    layout = new GridLayout();
    layout.numColumns = 2;
    colorGroup.setLayout(layout);
    colorAuto = new Button(colorGroup, SWT.RADIO);
    colorAuto.setText(Messages.get().DataSourceEditDlg_AutoColor);
    colorAuto.setSelection(dci.color.equalsIgnoreCase(ChartDciConfig.UNSET_COLOR));
    gd = new GridData();
    gd.horizontalSpan = 2;
    colorAuto.setLayoutData(gd);
    colorAuto.addSelectionListener(new SelectionListener() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            colorSelector.setEnabled(false);
        }

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
            widgetSelected(e);
        }
    });
    colorCustom = new Button(colorGroup, SWT.RADIO);
    colorCustom.setText(Messages.get().DataSourceEditDlg_CustomColor);
    colorCustom.setSelection(!dci.color.equalsIgnoreCase(ChartDciConfig.UNSET_COLOR));
    colorCustom.addSelectionListener(new SelectionListener() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            colorSelector.setEnabled(true);
        }

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
            widgetSelected(e);
        }
    });
    colorSelector = new ColorSelector(colorGroup);
    colorSelector.setColorValue(ColorConverter.rgbFromInt(dci.getColorAsInt()));
    gd = new GridData();
    gd.horizontalAlignment = SWT.LEFT;
    gd.grabExcessHorizontalSpace = true;
    colorSelector.getButton().setLayoutData(gd);
    colorSelector.setEnabled(!dci.color.equalsIgnoreCase(ChartDciConfig.UNSET_COLOR));
    return dialogArea;
}
Also used : DciSelector(org.netxms.ui.eclipse.datacollection.widgets.DciSelector) Group(org.eclipse.swt.widgets.Group) GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) LabeledText(org.netxms.ui.eclipse.widgets.LabeledText) Button(org.eclipse.swt.widgets.Button) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) ColorSelector(org.eclipse.jface.preference.ColorSelector) SelectionListener(org.eclipse.swt.events.SelectionListener)

Aggregations

GridData (org.eclipse.swt.layout.GridData)5 GridLayout (org.eclipse.swt.layout.GridLayout)5 Composite (org.eclipse.swt.widgets.Composite)5 DciSelector (org.netxms.ui.eclipse.datacollection.widgets.DciSelector)5 LabeledText (org.netxms.ui.eclipse.widgets.LabeledText)5 Button (org.eclipse.swt.widgets.Button)2 Group (org.eclipse.swt.widgets.Group)2 ColorSelector (org.eclipse.jface.preference.ColorSelector)1 SelectionEvent (org.eclipse.swt.events.SelectionEvent)1 SelectionListener (org.eclipse.swt.events.SelectionListener)1 SingleDciConfig (org.netxms.client.maps.configs.SingleDciConfig)1 ImageSelector (org.netxms.ui.eclipse.imagelibrary.widgets.ImageSelector)1