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);
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;
}
use of org.netxms.ui.eclipse.widgets.LabeledText in project netxms by netxms.
the class EditGroupBoxDialog 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.marginWidth = WidgetHelper.DIALOG_WIDTH_MARGIN;
layout.marginHeight = WidgetHelper.DIALOG_HEIGHT_MARGIN;
layout.verticalSpacing = WidgetHelper.OUTER_SPACING;
dialogArea.setLayout(layout);
/* title */
textTitle = new LabeledText(dialogArea, SWT.NONE);
textTitle.setLabel(Messages.get().AddGroupBoxDialog_Title);
textTitle.setText(groupBox.getTitle());
GridData gd = new GridData();
gd.horizontalAlignment = SWT.FILL;
gd.grabExcessHorizontalSpace = true;
gd.widthHint = 300;
textTitle.setLayoutData(gd);
/* width and height */
Composite attrArea = new Composite(dialogArea, SWT.NONE);
layout = new GridLayout();
layout.numColumns = 3;
layout.marginWidth = 0;
layout.marginHeight = 0;
layout.horizontalSpacing = WidgetHelper.OUTER_SPACING;
attrArea.setLayout(layout);
gd = new GridData();
gd.horizontalAlignment = SWT.FILL;
gd.grabExcessHorizontalSpace = true;
attrArea.setLayoutData(gd);
WidgetFactory factory = new WidgetFactory() {
@Override
public Control createControl(Composite parent, int style) {
Spinner spinner = new Spinner(parent, style | SWT.BORDER);
spinner.setMinimum(20);
spinner.setMaximum(4096);
return spinner;
}
};
spinnerWidth = (Spinner) WidgetHelper.createLabeledControl(attrArea, SWT.NONE, factory, Messages.get().AddGroupBoxDialog_Width, WidgetHelper.DEFAULT_LAYOUT_DATA);
spinnerWidth.setSelection(groupBox.getWidth());
spinnerHeight = (Spinner) WidgetHelper.createLabeledControl(attrArea, SWT.NONE, factory, Messages.get().AddGroupBoxDialog_Height, WidgetHelper.DEFAULT_LAYOUT_DATA);
spinnerHeight.setSelection(groupBox.getHeight());
colorSelector = WidgetHelper.createLabeledColorSelector(attrArea, Messages.get().AddGroupBoxDialog_Color, WidgetHelper.DEFAULT_LAYOUT_DATA);
colorSelector.setColorValue(DEFAULT_COLOR);
return dialogArea;
}
use of org.netxms.ui.eclipse.widgets.LabeledText 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;
}
use of org.netxms.ui.eclipse.widgets.LabeledText in project netxms by netxms.
the class MapBackground 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);
final IPreferenceStore ps = Activator.getDefault().getPreferenceStore();
// $NON-NLS-1$
disableGeolocationBackground = ps.getBoolean("DISABLE_GEOLOCATION_BACKGROUND");
object = (NetworkMap) getElement().getAdapter(NetworkMap.class);
GridLayout layout = new GridLayout();
layout.verticalSpacing = WidgetHelper.OUTER_SPACING;
layout.marginWidth = 0;
layout.marginHeight = 0;
layout.numColumns = 1;
dialogArea.setLayout(layout);
Group typeGroup = new Group(dialogArea, SWT.NONE);
typeGroup.setText(Messages.get().MapBackground_BkgndType);
GridData gd = new GridData();
gd.grabExcessHorizontalSpace = true;
gd.horizontalAlignment = SWT.FILL;
typeGroup.setLayoutData(gd);
layout = new GridLayout();
typeGroup.setLayout(layout);
final SelectionListener listener = new SelectionListener() {
@Override
public void widgetSelected(SelectionEvent e) {
enableControls(radioTypeImage.getSelection(), disableGeolocationBackground ? false : radioTypeGeoMap.getSelection());
}
@Override
public void widgetDefaultSelected(SelectionEvent e) {
widgetSelected(e);
}
};
radioTypeNone = new Button(typeGroup, SWT.RADIO);
radioTypeNone.setText(Messages.get().MapBackground_None);
radioTypeNone.setSelection(object.getBackground().equals(NXCommon.EMPTY_GUID));
radioTypeNone.addSelectionListener(listener);
radioTypeImage = new Button(typeGroup, SWT.RADIO);
radioTypeImage.setText(Messages.get().MapBackground_Image);
radioTypeImage.setSelection(!object.getBackground().equals(NXCommon.EMPTY_GUID) && !object.getBackground().equals(NetworkMap.GEOMAP_BACKGROUND));
radioTypeImage.addSelectionListener(listener);
if (!disableGeolocationBackground) {
radioTypeGeoMap = new Button(typeGroup, SWT.RADIO);
radioTypeGeoMap.setText(Messages.get().MapBackground_GeoMap);
radioTypeGeoMap.setSelection(object.getBackground().equals(NetworkMap.GEOMAP_BACKGROUND));
radioTypeGeoMap.addSelectionListener(listener);
} else {
if (object.getBackground().equals(NetworkMap.GEOMAP_BACKGROUND))
radioTypeNone.setSelection(true);
}
image = new ImageSelector(dialogArea, SWT.NONE);
image.setLabel(Messages.get().MapBackground_BkgndImage);
if (radioTypeImage.getSelection())
image.setImageGuid(object.getBackground(), true);
gd = new GridData();
gd.grabExcessHorizontalSpace = true;
gd.horizontalAlignment = SWT.FILL;
image.setLayoutData(gd);
if (!disableGeolocationBackground) {
Group geomapGroup = new Group(dialogArea, SWT.NONE);
geomapGroup.setText(Messages.get().MapBackground_GroupGeoMap);
gd = new GridData();
gd.grabExcessHorizontalSpace = true;
gd.horizontalAlignment = SWT.FILL;
geomapGroup.setLayoutData(gd);
layout = new GridLayout();
geomapGroup.setLayout(layout);
GeoLocation gl = object.getBackgroundLocation();
latitude = new LabeledText(geomapGroup, SWT.NONE);
latitude.setLabel(Messages.get().MapBackground_Lat);
latitude.setText(gl.getLatitudeAsString());
gd = new GridData();
gd.grabExcessHorizontalSpace = true;
gd.horizontalAlignment = SWT.FILL;
latitude.setLayoutData(gd);
longitude = new LabeledText(geomapGroup, SWT.NONE);
longitude.setLabel(Messages.get().MapBackground_Lon);
longitude.setText(gl.getLongitudeAsString());
gd = new GridData();
gd.grabExcessHorizontalSpace = true;
gd.horizontalAlignment = SWT.FILL;
longitude.setLayoutData(gd);
Composite zoomGroup = new Composite(geomapGroup, SWT.NONE);
layout = new GridLayout();
layout.numColumns = 2;
layout.horizontalSpacing = WidgetHelper.OUTER_SPACING;
layout.marginHeight = 0;
layout.marginWidth = 0;
layout.marginTop = WidgetHelper.OUTER_SPACING;
zoomGroup.setLayout(layout);
gd = new GridData();
gd.horizontalAlignment = SWT.FILL;
gd.grabExcessHorizontalSpace = true;
zoomGroup.setLayoutData(gd);
zoomLabel = new Label(zoomGroup, SWT.NONE);
zoomLabel.setText(Messages.get().MapBackground_ZoomLevel);
gd = new GridData();
gd.horizontalAlignment = SWT.LEFT;
gd.horizontalSpan = 2;
zoomLabel.setLayoutData(gd);
zoomScale = new Scale(zoomGroup, SWT.HORIZONTAL);
zoomScale.setMinimum(1);
zoomScale.setMaximum(18);
zoomScale.setSelection(object.getBackgroundZoom());
gd = new GridData();
gd.horizontalAlignment = SWT.FILL;
gd.grabExcessHorizontalSpace = true;
zoomScale.setLayoutData(gd);
zoomScale.addSelectionListener(new SelectionListener() {
@Override
public void widgetSelected(SelectionEvent e) {
zoomSpinner.setSelection(zoomScale.getSelection());
}
@Override
public void widgetDefaultSelected(SelectionEvent e) {
widgetSelected(e);
}
});
zoomSpinner = new Spinner(zoomGroup, SWT.BORDER);
zoomSpinner.setMinimum(1);
zoomSpinner.setMaximum(18);
zoomSpinner.setSelection(object.getBackgroundZoom());
zoomSpinner.addSelectionListener(new SelectionListener() {
@Override
public void widgetSelected(SelectionEvent e) {
zoomScale.setSelection(zoomSpinner.getSelection());
}
@Override
public void widgetDefaultSelected(SelectionEvent e) {
widgetSelected(e);
}
});
}
Composite colorArea = new Composite(dialogArea, SWT.NONE);
layout = new GridLayout();
layout.numColumns = 2;
layout.horizontalSpacing = WidgetHelper.OUTER_SPACING;
layout.marginWidth = 0;
colorArea.setLayout(layout);
gd = new GridData();
gd.horizontalAlignment = SWT.FILL;
gd.grabExcessHorizontalSpace = true;
colorArea.setLayoutData(gd);
Label label = new Label(colorArea, SWT.NONE);
label.setText(Messages.get().MapBackground_BkgndColor);
backgroundColor = new ColorSelector(colorArea);
backgroundColor.setColorValue(ColorConverter.rgbFromInt(object.getBackgroundColor()));
enableControls(radioTypeImage.getSelection(), disableGeolocationBackground ? false : radioTypeGeoMap.getSelection());
return dialogArea;
}
use of org.netxms.ui.eclipse.widgets.LabeledText in project netxms by netxms.
the class ObjectFinder method createPartControl.
/* (non-Javadoc)
* @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
*/
@Override
public void createPartControl(Composite parent) {
session = ConsoleSharedData.getSession();
GridLayout layout = new GridLayout();
layout.marginWidth = 0;
layout.marginHeight = 0;
parent.setLayout(layout);
Composite conditionGroup = new Composite(parent, SWT.NONE);
conditionGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
layout = new GridLayout();
layout.numColumns = session.isZoningEnabled() ? 3 : 2;
conditionGroup.setLayout(layout);
/**
* Full text search **
*/
Composite fullTextSearchGroup = new Composite(conditionGroup, SWT.NONE);
fullTextSearchGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
layout = new GridLayout();
fullTextSearchGroup.setLayout(layout);
text = new LabeledText(fullTextSearchGroup, SWT.NONE);
text.setLabel("Search string");
text.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
TraverseListener traverseListener = new TraverseListener() {
@Override
public void keyTraversed(TraverseEvent e) {
if (e.detail == SWT.TRAVERSE_RETURN)
startSearch();
}
};
text.addTraverseListener(traverseListener);
Group searchModeGroup = new Group(fullTextSearchGroup, SWT.NONE);
searchModeGroup.setText("Search mode");
layout = new GridLayout();
searchModeGroup.setLayout(layout);
radioPlainText = new Button(searchModeGroup, SWT.RADIO);
radioPlainText.setText("&Normal");
radioPlainText.setSelection(true);
radioPattern = new Button(searchModeGroup, SWT.RADIO);
radioPattern.setText("&Pattern (* = any string, ? = any character)");
radioRegularExpression = new Button(searchModeGroup, SWT.RADIO);
radioRegularExpression.setText("&Regular expression");
/**
* Class filter **
*/
Composite classFilterGroup = new Composite(conditionGroup, SWT.NONE);
GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
gd.verticalSpan = 2;
classFilterGroup.setLayoutData(gd);
layout = new GridLayout();
classFilterGroup.setLayout(layout);
Label classFilterTitle = new Label(classFilterGroup, SWT.NONE);
classFilterTitle.setText("Class filter");
classList = CheckboxTableViewer.newCheckList(classFilterGroup, SWT.BORDER | SWT.CHECK);
classList.setContentProvider(new ArrayContentProvider());
classList.setInput(OBJECT_CLASSES);
classList.setAllChecked(true);
gd = new GridData(SWT.FILL, SWT.FILL, true, true);
gd.heightHint = 100;
classList.getTable().setLayoutData(gd);
Composite classListButtons = new Composite(classFilterGroup, SWT.NONE);
RowLayout rlayout = new RowLayout();
rlayout.marginLeft = 0;
classListButtons.setLayout(rlayout);
Button selectAll = new Button(classListButtons, SWT.PUSH);
selectAll.setText("Select &all");
RowData rd = new RowData();
rd.width = WidgetHelper.BUTTON_WIDTH_HINT;
selectAll.setLayoutData(rd);
selectAll.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
classList.setAllChecked(true);
}
});
Button clearAll = new Button(classListButtons, SWT.PUSH);
clearAll.setText("&Clear all");
rd = new RowData();
rd.width = WidgetHelper.BUTTON_WIDTH_HINT;
clearAll.setLayoutData(rd);
clearAll.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
classList.setAllChecked(false);
}
});
/**
* Zone filter **
*/
if (session.isZoningEnabled()) {
Composite zoneFilterGroup = new Composite(conditionGroup, SWT.NONE);
gd = new GridData(SWT.FILL, SWT.FILL, true, true);
gd.verticalSpan = 2;
zoneFilterGroup.setLayoutData(gd);
layout = new GridLayout();
zoneFilterGroup.setLayout(layout);
Label zoneFilterTitle = new Label(zoneFilterGroup, SWT.NONE);
zoneFilterTitle.setText("Zone filter");
zoneList = CheckboxTableViewer.newCheckList(zoneFilterGroup, SWT.BORDER | SWT.CHECK);
zoneList.setContentProvider(new ArrayContentProvider());
List<Zone> zones = session.getAllZones();
zoneList.setLabelProvider(new WorkbenchLabelProvider());
zoneList.setInput(zones);
zoneList.setAllChecked(true);
gd = new GridData(SWT.FILL, SWT.FILL, true, true);
gd.heightHint = 100;
zoneList.getTable().setLayoutData(gd);
Composite zoneListButtons = new Composite(zoneFilterGroup, SWT.NONE);
rlayout = new RowLayout();
rlayout.marginLeft = 0;
zoneListButtons.setLayout(rlayout);
selectAll = new Button(zoneListButtons, SWT.PUSH);
selectAll.setText("Select &all");
rd = new RowData();
rd.width = WidgetHelper.BUTTON_WIDTH_HINT;
selectAll.setLayoutData(rd);
selectAll.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
zoneList.setAllChecked(true);
}
});
clearAll = new Button(zoneListButtons, SWT.PUSH);
clearAll.setText("&Clear all");
rd = new RowData();
rd.width = WidgetHelper.BUTTON_WIDTH_HINT;
clearAll.setLayoutData(rd);
clearAll.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
zoneList.setAllChecked(false);
}
});
}
/**
* IP filter **
*/
Group ipFilterGroup = new Group(conditionGroup, SWT.NONE);
ipFilterGroup.setText("IP Range");
ipFilterGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
layout = new GridLayout();
layout.numColumns = 3;
ipFilterGroup.setLayout(layout);
ipRangeStart = new Text(ipFilterGroup, SWT.BORDER);
ipRangeStart.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
ipRangeStart.addTraverseListener(traverseListener);
new Label(ipFilterGroup, SWT.NONE).setText(" - ");
ipRangeEnd = new Text(ipFilterGroup, SWT.BORDER);
ipRangeEnd.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
ipRangeEnd.addTraverseListener(traverseListener);
/**
* Search button **
*/
Button searchButton = new Button(conditionGroup, SWT.PUSH);
searchButton.setText("&Search");
gd = new GridData(SWT.LEFT, SWT.BOTTOM, true, false);
gd.widthHint = WidgetHelper.BUTTON_WIDTH_HINT;
searchButton.setLayoutData(gd);
searchButton.addSelectionListener(new SelectionListener() {
@Override
public void widgetSelected(SelectionEvent e) {
startSearch();
}
@Override
public void widgetDefaultSelected(SelectionEvent e) {
widgetSelected(e);
}
});
final String[] names = { "ID", "Class", "Name", "IP Address", "Parent", "Zone" };
final int[] widths = { 90, 120, 300, 250, 300, 200 };
results = new SortableTableViewer(parent, names, widths, 0, SWT.UP, SWT.MULTI | SWT.FULL_SELECTION);
if (!ConsoleSharedData.getSession().isZoningEnabled())
results.removeColumnById(COL_ZONE);
results.setContentProvider(new ArrayContentProvider());
results.setLabelProvider(new ObjectSearchResultLabelProvider());
results.setComparator(new ObjectSearchResultComparator());
results.getTable().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
final IDialogSettings settings = Activator.getDefault().getDialogSettings();
WidgetHelper.restoreTableViewerSettings(results, settings, "ResultTable");
results.getTable().addDisposeListener(new DisposeListener() {
@Override
public void widgetDisposed(DisposeEvent e) {
WidgetHelper.saveTableViewerSettings(results, settings, "ResultTable");
}
});
getSite().setSelectionProvider(results);
createResultsContextMenu();
activateContext();
createActions();
contributeToActionBars();
}
Aggregations