use of org.netxms.ui.eclipse.widgets.LabeledText 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;
}
use of org.netxms.ui.eclipse.widgets.LabeledText in project netxms by netxms.
the class Thresholds method createContents.
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
*/
@Override
protected Control createContents(Composite parent) {
// Initiate loading of event manager plugin if it was not loaded before
// $NON-NLS-1$
Platform.getAdapterManager().loadAdapter(new EventTemplate(0), "org.eclipse.ui.model.IWorkbenchAdapter");
Composite dialogArea = (Composite) super.createContents(parent);
dci = editor.getObjectAsItem();
thresholds = new ArrayList<Threshold>(dci.getThresholds().size());
for (Threshold t : dci.getThresholds()) thresholds.add(new Threshold(t));
GridLayout layout = new GridLayout();
layout.verticalSpacing = WidgetHelper.OUTER_SPACING;
layout.marginWidth = 0;
layout.marginHeight = 0;
dialogArea.setLayout(layout);
instance = new LabeledText(dialogArea, SWT.NONE);
instance.setLabel(Messages.get().Thresholds_Instance);
instance.setText(dci.getInstance());
GridData gd = new GridData();
gd.horizontalAlignment = SWT.FILL;
gd.grabExcessHorizontalSpace = true;
instance.setLayoutData(gd);
if (// DCI created by instance discovery
dci.getTemplateId() == dci.getNodeId())
instance.getTextControl().setEditable(false);
checkAllThresholds = new Button(dialogArea, SWT.CHECK);
checkAllThresholds.setText(Messages.get().Thresholds_ProcessAll);
checkAllThresholds.setSelection(dci.isProcessAllThresholds());
Composite thresholdArea = new Composite(dialogArea, SWT.NONE);
gd = new GridData();
gd.horizontalAlignment = SWT.FILL;
gd.grabExcessHorizontalSpace = true;
gd.verticalAlignment = SWT.FILL;
gd.grabExcessVerticalSpace = true;
gd.horizontalSpan = 2;
thresholdArea.setLayoutData(gd);
layout = new GridLayout();
layout.verticalSpacing = WidgetHelper.INNER_SPACING;
layout.marginWidth = 0;
layout.marginHeight = 0;
layout.numColumns = 2;
thresholdArea.setLayout(layout);
new Label(thresholdArea, SWT.NONE).setText(Messages.get().Thresholds_Thresholds);
thresholdList = new TableViewer(thresholdArea, SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL);
gd = new GridData();
gd.horizontalAlignment = SWT.FILL;
gd.grabExcessHorizontalSpace = true;
gd.verticalAlignment = SWT.FILL;
gd.grabExcessVerticalSpace = true;
gd.horizontalSpan = 2;
thresholdList.getControl().setLayoutData(gd);
setupThresholdList();
thresholdList.setInput(thresholds.toArray());
Composite leftButtons = new Composite(thresholdArea, SWT.NONE);
gd = new GridData();
gd.horizontalAlignment = SWT.LEFT;
leftButtons.setLayoutData(gd);
RowLayout buttonsLayout = new RowLayout(SWT.HORIZONTAL);
buttonsLayout.marginBottom = 0;
buttonsLayout.marginLeft = 0;
buttonsLayout.marginRight = 0;
buttonsLayout.marginTop = 0;
buttonsLayout.spacing = WidgetHelper.OUTER_SPACING;
buttonsLayout.fill = true;
buttonsLayout.pack = false;
leftButtons.setLayout(buttonsLayout);
upButton = new Button(leftButtons, SWT.PUSH);
upButton.setText(Messages.get().Thresholds_Up);
upButton.setEnabled(false);
upButton.addSelectionListener(new SelectionListener() {
@Override
public void widgetDefaultSelected(SelectionEvent e) {
widgetSelected(e);
}
@Override
public void widgetSelected(SelectionEvent e) {
moveUp();
}
});
downButton = new Button(leftButtons, SWT.PUSH);
downButton.setText(Messages.get().Thresholds_Down);
downButton.setEnabled(false);
downButton.addSelectionListener(new SelectionListener() {
@Override
public void widgetDefaultSelected(SelectionEvent e) {
widgetSelected(e);
}
@Override
public void widgetSelected(SelectionEvent e) {
moveDown();
}
});
Composite buttons = new Composite(thresholdArea, SWT.NONE);
gd = new GridData();
gd.horizontalAlignment = SWT.RIGHT;
buttons.setLayoutData(gd);
buttonsLayout = new RowLayout(SWT.HORIZONTAL);
buttonsLayout.marginBottom = 0;
buttonsLayout.marginLeft = 0;
buttonsLayout.marginRight = 0;
buttonsLayout.marginTop = 0;
buttonsLayout.spacing = WidgetHelper.OUTER_SPACING;
buttonsLayout.fill = true;
buttonsLayout.pack = false;
buttons.setLayout(buttonsLayout);
addButton = new Button(buttons, SWT.PUSH);
addButton.setText(Messages.get().Thresholds_Add);
RowData rd = new RowData();
rd.width = WidgetHelper.BUTTON_WIDTH_HINT;
addButton.setLayoutData(rd);
addButton.addSelectionListener(new SelectionListener() {
@Override
public void widgetDefaultSelected(SelectionEvent e) {
widgetSelected(e);
}
@Override
public void widgetSelected(SelectionEvent e) {
addThreshold();
}
});
duplicateButton = new Button(buttons, SWT.PUSH);
duplicateButton.setText("Duplicate");
rd = new RowData();
rd.width = WidgetHelper.BUTTON_WIDTH_HINT;
duplicateButton.setLayoutData(rd);
duplicateButton.setEnabled(false);
duplicateButton.addSelectionListener(new SelectionListener() {
@Override
public void widgetDefaultSelected(SelectionEvent e) {
widgetSelected(e);
}
@Override
public void widgetSelected(SelectionEvent e) {
duplicateThreshold();
}
});
modifyButton = new Button(buttons, SWT.PUSH);
modifyButton.setText(Messages.get().Thresholds_Edit);
rd = new RowData();
rd.width = WidgetHelper.BUTTON_WIDTH_HINT;
modifyButton.setLayoutData(rd);
modifyButton.setEnabled(false);
modifyButton.addSelectionListener(new SelectionListener() {
@Override
public void widgetDefaultSelected(SelectionEvent e) {
widgetSelected(e);
}
@Override
public void widgetSelected(SelectionEvent e) {
editThreshold();
}
});
deleteButton = new Button(buttons, SWT.PUSH);
deleteButton.setText(Messages.get().Thresholds_Delete);
rd = new RowData();
rd.width = WidgetHelper.BUTTON_WIDTH_HINT;
deleteButton.setLayoutData(rd);
deleteButton.setEnabled(false);
deleteButton.addSelectionListener(new SelectionListener() {
@Override
public void widgetDefaultSelected(SelectionEvent e) {
widgetSelected(e);
}
@Override
public void widgetSelected(SelectionEvent e) {
deleteThresholds();
}
});
/**
* Selection change listener for thresholds list **
*/
thresholdList.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent event) {
IStructuredSelection selection = (IStructuredSelection) event.getSelection();
int index = thresholds.indexOf(selection.getFirstElement());
upButton.setEnabled((selection.size() == 1) && (index > 0));
downButton.setEnabled((selection.size() == 1) && (index >= 0) && (index < thresholds.size() - 1));
modifyButton.setEnabled(selection.size() == 1);
deleteButton.setEnabled(selection.size() > 0);
duplicateButton.setEnabled(selection.size() > 0);
}
});
thresholdList.addDoubleClickListener(new IDoubleClickListener() {
@Override
public void doubleClick(DoubleClickEvent event) {
editThreshold();
}
});
return dialogArea;
}
use of org.netxms.ui.eclipse.widgets.LabeledText in project netxms by netxms.
the class Communication method createContents.
/* (non-Javadoc)
* @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
*/
@Override
protected Control createContents(Composite parent) {
node = (AbstractNode) getElement().getAdapter(AbstractNode.class);
Composite dialogArea = new Composite(parent, SWT.NONE);
GridLayout dialogLayout = new GridLayout();
dialogLayout.marginWidth = 0;
dialogLayout.marginHeight = 0;
dialogArea.setLayout(dialogLayout);
primaryName = new LabeledText(dialogArea, SWT.NONE);
primaryName.setLabel(Messages.get().Communication_PrimaryHostName);
primaryName.setText(node.getPrimaryName());
GridData gd = new GridData();
gd.horizontalAlignment = SWT.FILL;
gd.grabExcessHorizontalSpace = true;
primaryName.setLayoutData(gd);
primaryName.getTextControl().addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
primaryNameChanged = true;
}
});
agentIsRemote = new Button(dialogArea, SWT.CHECK);
agentIsRemote.setText(Messages.get().Communication_RemoteAgent);
agentIsRemote.setSelection((node.getFlags() & AbstractNode.NF_REMOTE_AGENT) != 0);
gd = new GridData();
gd.horizontalAlignment = SWT.FILL;
gd.grabExcessHorizontalSpace = true;
agentIsRemote.setLayoutData(gd);
return dialogArea;
}
use of org.netxms.ui.eclipse.widgets.LabeledText in project netxms by netxms.
the class Location 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);
object = (AbstractObject) getElement().getAdapter(AbstractObject.class);
GeoLocation gl = object.getGeolocation();
GridLayout layout = new GridLayout();
layout.verticalSpacing = WidgetHelper.OUTER_SPACING;
layout.marginWidth = 0;
layout.marginHeight = 0;
layout.numColumns = 2;
dialogArea.setLayout(layout);
Group typeGroup = new Group(dialogArea, SWT.NONE);
typeGroup.setText(Messages.get().Location_LocationType);
GridData gd = new GridData();
gd.verticalSpan = 2;
typeGroup.setLayoutData(gd);
layout = new GridLayout();
typeGroup.setLayout(layout);
radioTypeUndefined = new Button(typeGroup, SWT.RADIO);
radioTypeUndefined.setText(Messages.get().Location_Undefined);
radioTypeUndefined.setSelection(gl.getType() == GeoLocation.UNSET);
radioTypeManual = new Button(typeGroup, SWT.RADIO);
radioTypeManual.setText(Messages.get().Location_Manual);
radioTypeManual.setSelection(gl.getType() == GeoLocation.MANUAL);
radioTypeAuto = new Button(typeGroup, SWT.RADIO);
radioTypeAuto.setText(Messages.get().Location_Automatic);
radioTypeAuto.setSelection(gl.getType() == GeoLocation.GPS);
latitude = new LabeledText(dialogArea, SWT.NONE);
latitude.setLabel(Messages.get().Location_Latitude);
if (gl.getType() != GeoLocation.UNSET)
latitude.setText(gl.getLatitudeAsString());
gd = new GridData();
gd.grabExcessHorizontalSpace = true;
gd.horizontalAlignment = SWT.FILL;
latitude.setLayoutData(gd);
latitude.setEnabled(gl.getType() == GeoLocation.MANUAL);
longitude = new LabeledText(dialogArea, SWT.NONE);
longitude.setLabel(Messages.get().Location_Longitude);
if (gl.getType() != GeoLocation.UNSET)
longitude.setText(gl.getLongitudeAsString());
gd = new GridData();
gd.grabExcessHorizontalSpace = true;
gd.horizontalAlignment = SWT.FILL;
longitude.setLayoutData(gd);
longitude.setEnabled(gl.getType() == GeoLocation.MANUAL);
final SelectionListener listener = new SelectionListener() {
@Override
public void widgetSelected(SelectionEvent e) {
latitude.setEnabled(radioTypeManual.getSelection());
longitude.setEnabled(radioTypeManual.getSelection());
}
@Override
public void widgetDefaultSelected(SelectionEvent e) {
widgetSelected(e);
}
};
radioTypeUndefined.addSelectionListener(listener);
radioTypeManual.addSelectionListener(listener);
radioTypeAuto.addSelectionListener(listener);
country = new LabeledText(dialogArea, SWT.NONE);
country.setLabel(Messages.get().Location_Country);
country.setText(object.getPostalAddress().country);
country.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));
city = new LabeledText(dialogArea, SWT.NONE);
city.setLabel(Messages.get().Location_City);
city.setText(object.getPostalAddress().city);
city.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));
streetAddress = new LabeledText(dialogArea, SWT.NONE);
streetAddress.setLabel(Messages.get().Location_StreetAddress);
streetAddress.setText(object.getPostalAddress().streetAddress);
streetAddress.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));
postcode = new LabeledText(dialogArea, SWT.NONE);
postcode.setLabel(Messages.get().Location_Postcode);
postcode.setText(object.getPostalAddress().postcode);
postcode.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));
return dialogArea;
}
use of org.netxms.ui.eclipse.widgets.LabeledText in project netxms by netxms.
the class CreateMobileDeviceDialog 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.verticalSpacing = WidgetHelper.DIALOG_SPACING;
layout.marginHeight = WidgetHelper.DIALOG_HEIGHT_MARGIN;
layout.marginWidth = WidgetHelper.DIALOG_WIDTH_MARGIN;
dialogArea.setLayout(layout);
nameField = new LabeledText(dialogArea, SWT.NONE);
nameField.setLabel(Messages.get().CreateMobileDeviceDialog_Name);
nameField.getTextControl().setTextLimit(255);
GridData gd = new GridData();
gd.horizontalAlignment = SWT.FILL;
gd.grabExcessHorizontalSpace = true;
gd.widthHint = 300;
nameField.setLayoutData(gd);
deviceIdField = new LabeledText(dialogArea, SWT.NONE);
deviceIdField.setLabel(Messages.get().CreateMobileDeviceDialog_DeviceID);
deviceIdField.getTextControl().setTextLimit(64);
gd = new GridData();
gd.horizontalAlignment = SWT.FILL;
gd.grabExcessHorizontalSpace = true;
deviceIdField.setLayoutData(gd);
return dialogArea;
}
Aggregations