use of org.netxms.ui.eclipse.objectbrowser.widgets.ObjectSelector in project netxms by netxms.
the class CreateNodeLinkDialog 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.OUTER_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().CreateNodeLinkDialog_Name);
nameField.getTextControl().setTextLimit(255);
GridData gd = new GridData();
gd.horizontalAlignment = SWT.FILL;
gd.grabExcessHorizontalSpace = true;
gd.widthHint = 300;
nameField.setLayoutData(gd);
nodeField = new ObjectSelector(dialogArea, SWT.NONE, false);
nodeField.setLabel(Messages.get().CreateNodeLinkDialog_Node);
nodeField.setObjectClass(Node.class);
gd = new GridData();
gd.horizontalAlignment = SWT.FILL;
gd.grabExcessHorizontalSpace = true;
nodeField.setLayoutData(gd);
return dialogArea;
}
use of org.netxms.ui.eclipse.objectbrowser.widgets.ObjectSelector in project netxms by netxms.
the class ScheduledTaskEditor method createDialogArea.
/* (non-Javadoc)
* @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
*/
@Override
protected Control createDialogArea(Composite parent) {
final Composite dialogArea = (Composite) super.createDialogArea(parent);
GridLayout layout = new GridLayout();
layout.marginHeight = WidgetHelper.DIALOG_HEIGHT_MARGIN;
layout.marginWidth = WidgetHelper.DIALOG_WIDTH_MARGIN;
dialogArea.setLayout(layout);
scheduleType = new Combo(dialogArea, SWT.READ_ONLY);
for (String type : scheduleTypeList) scheduleType.add(type);
int taskId = scheduleTypeList.indexOf(scheduledTask.getScheduledTaskId());
scheduleType.select(taskId == -1 ? 0 : taskId);
GridData gd = new GridData();
gd.horizontalAlignment = SWT.FILL;
gd.verticalAlignment = SWT.FILL;
gd.grabExcessHorizontalSpace = true;
gd.grabExcessVerticalSpace = true;
scheduleType.setLayoutData(gd);
selector = new ObjectSelector(dialogArea, SWT.NONE, true);
selector.setLabel("Select execution object");
selector.setObjectClass(AbstractObject.class);
gd = new GridData();
gd.horizontalAlignment = SWT.FILL;
gd.verticalAlignment = SWT.FILL;
gd.grabExcessHorizontalSpace = true;
gd.grabExcessVerticalSpace = true;
selector.setLayoutData(gd);
if (scheduledTask.getObjectId() != 0)
selector.setObjectId(scheduledTask.getObjectId());
textParameters = new LabeledText(dialogArea, SWT.NONE);
textParameters.setLabel("Parameters");
gd = new GridData();
gd.horizontalAlignment = SWT.FILL;
gd.verticalAlignment = SWT.FILL;
gd.grabExcessHorizontalSpace = true;
gd.grabExcessVerticalSpace = true;
textParameters.setLayoutData(gd);
textParameters.setText(scheduledTask.getParameters());
textComments = WidgetHelper.createLabeledText(dialogArea, SWT.MULTI | SWT.BORDER, SWT.DEFAULT, "Description", scheduledTask.getComments(), WidgetHelper.DEFAULT_LAYOUT_DATA);
textComments.setTextLimit(255);
gd = new GridData();
gd.horizontalSpan = 2;
gd.grabExcessHorizontalSpace = true;
gd.horizontalAlignment = SWT.FILL;
gd.heightHint = 100;
gd.verticalAlignment = SWT.FILL;
textComments.setLayoutData(gd);
if ((scheduledTask.getFlags() & ScheduledTask.SYSTEM) != 0) {
scheduleType.add(scheduledTask.getScheduledTaskId());
scheduleType.select(scheduleTypeList.size());
scheduleType.setEnabled(false);
selector.setEnabled(false);
textParameters.setEnabled(false);
}
scheduleSelector = new ScheduleSelector(dialogArea, SWT.NONE);
scheduleSelector.setSchedule(scheduledTask);
return dialogArea;
}
use of org.netxms.ui.eclipse.objectbrowser.widgets.ObjectSelector in project netxms by netxms.
the class DciSummaryTable method createContents.
/* (non-Javadoc)
* @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
*/
@Override
protected Control createContents(Composite parent) {
config = (DciSummaryTableConfig) getElement().getAdapter(DciSummaryTableConfig.class);
Composite dialogArea = new Composite(parent, SWT.NONE);
currSortingList = config.getSortingColumnList();
GridLayout layout = new GridLayout();
dialogArea.setLayout(layout);
objectSelector = new ObjectSelector(dialogArea, SWT.NONE, true);
objectSelector.setLabel(Messages.get().DciSummaryTable_BaseObject);
objectSelector.setObjectClass(AbstractObject.class);
objectSelector.setObjectId(config.getBaseObjectId());
GridData gd = new GridData();
gd.horizontalAlignment = SWT.FILL;
gd.grabExcessHorizontalSpace = true;
objectSelector.setLayoutData(gd);
tableSelector = new SummaryTableSelector(dialogArea, SWT.NONE, AbstractSelector.SHOW_CLEAR_BUTTON);
tableSelector.setLabel(Messages.get().DciSummaryTable_SummaryTable);
tableSelector.setTableId(config.getTableId());
gd = new GridData();
gd.horizontalAlignment = SWT.FILL;
gd.grabExcessHorizontalSpace = true;
tableSelector.setLayoutData(gd);
gd = new GridData();
gd.verticalAlignment = SWT.TOP;
gd.horizontalAlignment = SWT.FILL;
gd.grabExcessHorizontalSpace = true;
refreshInterval = WidgetHelper.createLabeledSpinner(dialogArea, SWT.BORDER, Messages.get().DciSummaryTable_RefreshInterval, 0, 10000, gd);
refreshInterval.setSelection(config.getRefreshInterval());
gd = new GridData();
gd.verticalAlignment = SWT.TOP;
gd.horizontalAlignment = SWT.FILL;
gd.grabExcessHorizontalSpace = true;
checkShowSortAndLimitFields = new Button(dialogArea, SWT.CHECK);
checkShowSortAndLimitFields.setText("Show top N nodes");
checkShowSortAndLimitFields.setSelection(config.isEnableSortingAndLineLimit());
checkShowSortAndLimitFields.setLayoutData(gd);
checkShowSortAndLimitFields.addSelectionListener(new SelectionListener() {
@Override
public void widgetSelected(SelectionEvent e) {
if (checkShowSortAndLimitFields.getSelection()) {
sortTables.setSelection(null);
buttonAdd.setEnabled(true);
numRowsShow.setEnabled(true);
} else {
buttonUp.setEnabled(false);
buttonDown.setEnabled(false);
buttonEdit.setEnabled(false);
buttonRemove.setEnabled(false);
buttonAdd.setEnabled(false);
numRowsShow.setEnabled(false);
}
}
@Override
public void widgetDefaultSelected(SelectionEvent e) {
}
});
Composite showTopNNodes = new Composite(dialogArea, SWT.BORDER);
layout = new GridLayout();
showTopNNodes.setLayout(layout);
gd = new GridData();
gd.verticalAlignment = SWT.TOP;
gd.horizontalAlignment = SWT.FILL;
gd.grabExcessHorizontalSpace = true;
numRowsShow = WidgetHelper.createLabeledSpinner(showTopNNodes, SWT.BORDER, "Number of lines to show", 0, 10000, gd);
numRowsShow.setSelection(config.getNumRowShown());
numRowsShow.setEnabled(config.isEnableSortingAndLineLimit());
Label label = new Label(showTopNNodes, SWT.NONE);
label.setText("Sort by columns");
final String[] columnNames = { "Name", "Sort order" };
final int[] columnWidths = { 320, 120 };
sortTables = new SortableTableViewer(showTopNNodes, columnNames, columnWidths, 0, 0, SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION);
gd = new GridData();
gd.horizontalAlignment = SWT.FILL;
gd.grabExcessHorizontalSpace = true;
gd.verticalAlignment = SWT.FILL;
gd.grabExcessVerticalSpace = true;
gd.verticalSpan = 2;
gd.heightHint = 150;
sortTables.getTable().setLayoutData(gd);
sortTables.setContentProvider(new ArrayContentProvider());
sortTables.setLabelProvider(new SortColumnTableLabelProvider());
sortTables.setInput(currSortingList);
sortTables.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent event) {
if (checkShowSortAndLimitFields.getSelection()) {
IStructuredSelection selection = (IStructuredSelection) event.getSelection();
int index = currSortingList.indexOf(selection.getFirstElement());
buttonUp.setEnabled((selection.size() == 1) && (index > 0));
buttonDown.setEnabled((selection.size() == 1) && (index >= 0) && (index < currSortingList.size() - 1));
buttonEdit.setEnabled(selection.size() == 1);
buttonRemove.setEnabled(selection.size() > 0);
} else {
buttonUp.setEnabled(false);
buttonDown.setEnabled(false);
buttonEdit.setEnabled(false);
buttonRemove.setEnabled(false);
}
}
});
sortTables.addDoubleClickListener(new IDoubleClickListener() {
@Override
public void doubleClick(DoubleClickEvent event) {
buttonEdit.notifyListeners(SWT.Selection, new Event());
}
});
Composite buttons = new Composite(showTopNNodes, SWT.NONE);
gd = new GridData();
gd.horizontalAlignment = SWT.FILL;
gd.grabExcessHorizontalSpace = true;
buttons.setLayoutData(gd);
RowLayout buttonLayout = new RowLayout();
buttonLayout.type = SWT.HORIZONTAL;
buttonLayout.pack = false;
buttonLayout.marginWidth = 0;
buttons.setLayout(buttonLayout);
buttonUp = new Button(buttons, SWT.PUSH);
buttonUp.setText("UP");
buttonUp.addSelectionListener(new SelectionListener() {
@Override
public void widgetDefaultSelected(SelectionEvent e) {
widgetSelected(e);
}
@Override
public void widgetSelected(SelectionEvent e) {
moveUp();
}
});
RowData rd = new RowData();
rd.width = WidgetHelper.BUTTON_WIDTH_HINT;
buttonUp.setLayoutData(rd);
buttonUp.setEnabled(false);
buttonDown = new Button(buttons, SWT.PUSH);
buttonDown.setText("Down");
buttonDown.addSelectionListener(new SelectionListener() {
@Override
public void widgetDefaultSelected(SelectionEvent e) {
widgetSelected(e);
}
@Override
public void widgetSelected(SelectionEvent e) {
moveDown();
}
});
rd = new RowData();
rd.width = WidgetHelper.BUTTON_WIDTH_HINT;
buttonDown.setLayoutData(rd);
buttonDown.setEnabled(false);
gd = new GridData();
gd.horizontalAlignment = SWT.RIGHT;
gd.verticalIndent = WidgetHelper.OUTER_SPACING - WidgetHelper.INNER_SPACING;
buttons.setLayoutData(gd);
buttonAdd = new Button(buttons, SWT.PUSH);
buttonAdd.setText("Add");
buttonAdd.addSelectionListener(new SelectionListener() {
@Override
public void widgetDefaultSelected(SelectionEvent e) {
widgetSelected(e);
}
@Override
public void widgetSelected(SelectionEvent e) {
add();
}
});
rd = new RowData();
rd.width = WidgetHelper.BUTTON_WIDTH_HINT;
buttonAdd.setLayoutData(rd);
buttonAdd.setEnabled(config.isEnableSortingAndLineLimit());
buttonEdit = new Button(buttons, SWT.PUSH);
buttonEdit.setText("Edit");
buttonEdit.addSelectionListener(new SelectionListener() {
@Override
public void widgetDefaultSelected(SelectionEvent e) {
widgetSelected(e);
}
@Override
public void widgetSelected(SelectionEvent e) {
edit();
}
});
rd = new RowData();
rd.width = WidgetHelper.BUTTON_WIDTH_HINT;
buttonEdit.setLayoutData(rd);
buttonEdit.setEnabled(false);
buttonRemove = new Button(buttons, SWT.PUSH);
buttonRemove.setText("Delete");
buttonRemove.addSelectionListener(new SelectionListener() {
@Override
public void widgetDefaultSelected(SelectionEvent e) {
widgetSelected(e);
}
@Override
public void widgetSelected(SelectionEvent e) {
remove();
}
});
rd = new RowData();
rd.width = WidgetHelper.BUTTON_WIDTH_HINT;
buttonRemove.setLayoutData(rd);
buttonRemove.setEnabled(false);
return dialogArea;
}
use of org.netxms.ui.eclipse.objectbrowser.widgets.ObjectSelector in project netxms by netxms.
the class GeoMap method createContents.
/* (non-Javadoc)
* @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
*/
@Override
protected Control createContents(Composite parent) {
config = (GeoMapConfig) getElement().getAdapter(GeoMapConfig.class);
Composite dialogArea = new Composite(parent, SWT.NONE);
GridLayout layout = new GridLayout();
layout.numColumns = 3;
dialogArea.setLayout(layout);
title = new LabeledText(dialogArea, SWT.NONE, SWT.BORDER | SWT.MULTI);
title.setLabel(Messages.get().GeoMap_Title);
title.setText(config.getTitle());
GridData gd = new GridData();
gd.horizontalAlignment = SWT.FILL;
gd.grabExcessHorizontalSpace = true;
gd.horizontalSpan = 3;
title.setLayoutData(gd);
latitude = new LabeledText(dialogArea, SWT.NONE);
latitude.setLabel(Messages.get().GeoMap_Latitude);
latitude.setText(GeoLocation.latitudeToString(config.getLatitude()));
gd = new GridData();
gd.horizontalAlignment = SWT.FILL;
gd.grabExcessHorizontalSpace = true;
latitude.setLayoutData(gd);
longitude = new LabeledText(dialogArea, SWT.NONE);
longitude.setLabel(Messages.get().GeoMap_Longitude);
longitude.setText(GeoLocation.longitudeToString(config.getLongitude()));
gd = new GridData();
gd.horizontalAlignment = SWT.FILL;
gd.grabExcessHorizontalSpace = true;
longitude.setLayoutData(gd);
zoom = WidgetHelper.createLabeledSpinner(dialogArea, SWT.BORDER, Messages.get().GeoMap_Zoom, 0, 18, WidgetHelper.DEFAULT_LAYOUT_DATA);
zoom.setSelection(config.getZoom());
objectSelector = new ObjectSelector(dialogArea, SWT.NONE, true);
objectSelector.setLabel(Messages.get().AlarmViewer_RootObject);
objectSelector.setObjectClass(AbstractObject.class);
objectSelector.setObjectId(config.getRootObjectId());
gd = new GridData();
gd.horizontalAlignment = SWT.FILL;
gd.grabExcessHorizontalSpace = true;
gd.horizontalSpan = 3;
objectSelector.setLayoutData(gd);
return dialogArea;
}
use of org.netxms.ui.eclipse.objectbrowser.widgets.ObjectSelector in project netxms by netxms.
the class AlarmViewer method createContents.
/* (non-Javadoc)
* @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
*/
@Override
protected Control createContents(Composite parent) {
config = (AlarmViewerConfig) getElement().getAdapter(AlarmViewerConfig.class);
Composite dialogArea = new Composite(parent, SWT.NONE);
GridLayout layout = new GridLayout();
dialogArea.setLayout(layout);
objectSelector = new ObjectSelector(dialogArea, SWT.NONE, true);
objectSelector.setLabel(Messages.get().AlarmViewer_RootObject);
objectSelector.setObjectClass(AbstractObject.class);
objectSelector.setObjectId(config.getObjectId());
GridData gd = new GridData();
gd.horizontalAlignment = SWT.FILL;
gd.grabExcessHorizontalSpace = true;
objectSelector.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);
Group severityGroup = new Group(dialogArea, SWT.NONE);
severityGroup.setText(Messages.get().AlarmViewer_SeverityFilter);
gd = new GridData();
gd.horizontalAlignment = SWT.FILL;
gd.grabExcessHorizontalSpace = true;
severityGroup.setLayoutData(gd);
layout = new GridLayout();
layout.numColumns = 5;
layout.makeColumnsEqualWidth = true;
severityGroup.setLayout(layout);
checkSeverity = new Button[5];
for (int severity = 4; severity >= 0; severity--) {
checkSeverity[severity] = new Button(severityGroup, SWT.CHECK);
checkSeverity[severity].setText(StatusDisplayInfo.getStatusText(severity));
checkSeverity[severity].setSelection((config.getSeverityFilter() & (1 << severity)) != 0);
}
return dialogArea;
}
Aggregations