use of org.netxms.ui.eclipse.objectbrowser.widgets.ObjectSelector in project netxms by netxms.
the class AvailabilityChart method createContents.
/* (non-Javadoc)
* @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
*/
@Override
protected Control createContents(Composite parent) {
config = (AvailabilityChartConfig) getElement().getAdapter(AvailabilityChartConfig.class);
Composite dialogArea = new Composite(parent, SWT.NONE);
GridLayout layout = new GridLayout();
dialogArea.setLayout(layout);
objectSelector = new ObjectSelector(dialogArea, SWT.NONE, false);
objectSelector.setLabel(Messages.get().AvailabilityChart_Object);
objectSelector.setObjectClass(ServiceContainer.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().AvailabilityChart_Title);
title.setText(config.getTitle());
gd = new GridData();
gd.horizontalAlignment = SWT.FILL;
gd.grabExcessHorizontalSpace = true;
title.setLayoutData(gd);
checkShowTitle = new Button(dialogArea, SWT.CHECK);
checkShowTitle.setText(Messages.get().AvailabilityChart_ShowTitle);
checkShowTitle.setSelection(config.isShowTitle());
checkShowLegend = new Button(dialogArea, SWT.CHECK);
checkShowLegend.setText(Messages.get().AvailabilityChart_ShowLegend);
checkShowLegend.setSelection(config.isShowLegend());
checkShow3D = new Button(dialogArea, SWT.CHECK);
checkShow3D.setText(Messages.get().AvailabilityChart_3DView);
checkShow3D.setSelection(config.isShowIn3D());
checkTranslucent = new Button(dialogArea, SWT.CHECK);
checkTranslucent.setText(Messages.get().AvailabilityChart_Translucent);
checkTranslucent.setSelection(config.isTranslucent());
return dialogArea;
}
use of org.netxms.ui.eclipse.objectbrowser.widgets.ObjectSelector in project netxms by netxms.
the class GeneralTable method createContents.
/* (non-Javadoc)
* @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
*/
@Override
protected Control createContents(Composite parent) {
Composite dialogArea = (Composite) super.createContents(parent);
dci = editor.getObjectAsTable();
final NXCSession session = (NXCSession) ConsoleSharedData.getSession();
owner = session.findObjectById(dci.getNodeId());
if (owner instanceof Cluster) {
cluster = (Cluster) owner;
} else if (owner instanceof AbstractNode) {
for (AbstractObject o : owner.getParentsAsArray()) {
if (o instanceof Cluster) {
cluster = (Cluster) o;
break;
}
}
}
GridLayout layout = new GridLayout();
layout.verticalSpacing = WidgetHelper.OUTER_SPACING;
layout.marginWidth = 0;
layout.marginHeight = 0;
layout.numColumns = 2;
dialogArea.setLayout(layout);
/**
* description area *
*/
Group groupDescription = new Group(dialogArea, SWT.NONE);
groupDescription.setText(Messages.get().GeneralTable_Description);
FillLayout descriptionLayout = new FillLayout();
descriptionLayout.marginWidth = WidgetHelper.OUTER_SPACING;
descriptionLayout.marginHeight = WidgetHelper.OUTER_SPACING;
groupDescription.setLayout(descriptionLayout);
description = new Text(groupDescription, SWT.BORDER);
description.setTextLimit(255);
description.setText(dci.getDescription());
GridData gd = new GridData();
gd.grabExcessHorizontalSpace = true;
gd.horizontalAlignment = SWT.FILL;
gd.horizontalSpan = 2;
groupDescription.setLayoutData(gd);
/**
* data area *
*/
Group groupData = new Group(dialogArea, SWT.NONE);
groupData.setText(Messages.get().GeneralTable_Data);
FormLayout dataLayout = new FormLayout();
dataLayout.marginHeight = WidgetHelper.OUTER_SPACING;
dataLayout.marginWidth = WidgetHelper.OUTER_SPACING;
groupData.setLayout(dataLayout);
gd = new GridData();
gd.grabExcessHorizontalSpace = true;
gd.horizontalAlignment = SWT.FILL;
gd.horizontalSpan = 2;
groupData.setLayoutData(gd);
parameter = new LabeledText(groupData, SWT.NONE);
parameter.setLabel(Messages.get().GeneralTable_Parameter);
parameter.getTextControl().setTextLimit(255);
parameter.setText(dci.getName());
selectButton = new Button(groupData, SWT.PUSH);
selectButton.setText(Messages.get().GeneralTable_Select);
selectButton.addSelectionListener(new SelectionListener() {
@Override
public void widgetDefaultSelected(SelectionEvent e) {
widgetSelected(e);
}
@Override
public void widgetSelected(SelectionEvent e) {
selectParameter();
}
});
FormData fd = new FormData();
fd.left = new FormAttachment(0, 0);
fd.top = new FormAttachment(0, 0);
fd.right = new FormAttachment(selectButton, -WidgetHelper.INNER_SPACING, SWT.LEFT);
parameter.setLayoutData(fd);
fd = new FormData();
fd.right = new FormAttachment(100, 0);
fd.bottom = new FormAttachment(parameter, 0, SWT.BOTTOM);
fd.width = WidgetHelper.BUTTON_WIDTH_HINT;
selectButton.setLayoutData(fd);
fd = new FormData();
fd.left = new FormAttachment(0, 0);
fd.top = new FormAttachment(parameter, WidgetHelper.OUTER_SPACING, SWT.BOTTOM);
fd.right = new FormAttachment(50, -WidgetHelper.OUTER_SPACING / 2);
origin = WidgetHelper.createLabeledCombo(groupData, SWT.READ_ONLY, Messages.get().GeneralTable_Origin, fd);
origin.add(Messages.get().General_SourceInternal);
origin.add(Messages.get().General_SourceAgent);
origin.add(Messages.get().General_SourceSNMP);
origin.add(Messages.get().General_SourceCPSNMP);
origin.add(Messages.get().General_SourcePush);
origin.add(Messages.get().General_WinPerf);
origin.add(Messages.get().General_SMCLP);
origin.add(Messages.get().General_Script);
origin.add(Messages.get().General_SourceSSH);
origin.add(Messages.get().General_SourceMQTT);
origin.select(dci.getOrigin());
origin.addSelectionListener(new SelectionListener() {
@Override
public void widgetDefaultSelected(SelectionEvent e) {
widgetSelected(e);
}
@Override
public void widgetSelected(SelectionEvent e) {
onOriginChange();
}
});
checkUseCustomSnmpPort = new Button(groupData, SWT.CHECK);
checkUseCustomSnmpPort.setText(Messages.get().GeneralTable_UseCustomSNMPPort);
checkUseCustomSnmpPort.setSelection(dci.getSnmpPort() != 0);
checkUseCustomSnmpPort.addSelectionListener(new SelectionListener() {
@Override
public void widgetSelected(SelectionEvent e) {
customSnmpPort.setEnabled(checkUseCustomSnmpPort.getSelection());
}
@Override
public void widgetDefaultSelected(SelectionEvent e) {
widgetSelected(e);
}
});
fd = new FormData();
fd.left = new FormAttachment(origin.getParent(), WidgetHelper.OUTER_SPACING, SWT.RIGHT);
fd.right = new FormAttachment(100, 0);
fd.top = new FormAttachment(parameter, WidgetHelper.OUTER_SPACING, SWT.BOTTOM);
checkUseCustomSnmpPort.setLayoutData(fd);
checkUseCustomSnmpPort.setEnabled(dci.getOrigin() == DataCollectionObject.SNMP);
customSnmpPort = new Spinner(groupData, SWT.BORDER);
customSnmpPort.setMinimum(1);
customSnmpPort.setMaximum(65535);
if ((dci.getOrigin() == DataCollectionItem.SNMP) && (dci.getSnmpPort() != 0)) {
customSnmpPort.setEnabled(true);
customSnmpPort.setSelection(dci.getSnmpPort());
} else {
customSnmpPort.setEnabled(false);
}
fd = new FormData();
fd.left = new FormAttachment(origin.getParent(), WidgetHelper.OUTER_SPACING, SWT.RIGHT);
fd.right = new FormAttachment(100, 0);
fd.top = new FormAttachment(checkUseCustomSnmpPort, WidgetHelper.OUTER_SPACING, SWT.BOTTOM);
customSnmpPort.setLayoutData(fd);
sourceNode = new ObjectSelector(groupData, SWT.NONE, true);
sourceNode.setLabel(Messages.get().GeneralTable_ProxyNode);
sourceNode.setObjectClass(Node.class);
sourceNode.setObjectId(dci.getSourceNode());
sourceNode.setEnabled(dci.getOrigin() != DataCollectionObject.PUSH);
sourceNode.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
editor.setSourceNode(sourceNode.getObjectId());
}
});
fd = new FormData();
fd.top = new FormAttachment(origin.getParent(), WidgetHelper.OUTER_SPACING, SWT.BOTTOM);
fd.right = new FormAttachment(100, 0);
agentCacheMode = WidgetHelper.createLabeledCombo(groupData, SWT.READ_ONLY, Messages.get().GeneralTable_AgentCacheMode, fd);
agentCacheMode.add(Messages.get().GeneralTable_Default);
agentCacheMode.add(Messages.get().GeneralTable_On);
agentCacheMode.add(Messages.get().GeneralTable_Off);
agentCacheMode.select(dci.getCacheMode().getValue());
agentCacheMode.setEnabled((dci.getOrigin() == DataCollectionItem.AGENT) || (dci.getOrigin() == DataCollectionItem.SNMP));
fd = new FormData();
fd.left = new FormAttachment(0, 0);
fd.top = new FormAttachment(origin.getParent(), WidgetHelper.OUTER_SPACING, SWT.BOTTOM);
fd.right = new FormAttachment(agentCacheMode.getParent(), -WidgetHelper.OUTER_SPACING, SWT.LEFT);
sourceNode.setLayoutData(fd);
/**
* polling area *
*/
Group groupPolling = new Group(dialogArea, SWT.NONE);
groupPolling.setText(Messages.get().GeneralTable_Polling);
FormLayout pollingLayout = new FormLayout();
pollingLayout.marginHeight = WidgetHelper.OUTER_SPACING;
pollingLayout.marginWidth = WidgetHelper.OUTER_SPACING;
groupPolling.setLayout(pollingLayout);
gd = new GridData();
gd.grabExcessHorizontalSpace = true;
gd.horizontalAlignment = SWT.FILL;
gd.verticalAlignment = SWT.FILL;
groupPolling.setLayoutData(gd);
fd = new FormData();
fd.left = new FormAttachment(0, 0);
fd.right = new FormAttachment(50, -WidgetHelper.OUTER_SPACING / 2);
fd.top = new FormAttachment(0, 0);
schedulingMode = WidgetHelper.createLabeledCombo(groupPolling, SWT.READ_ONLY, Messages.get().GeneralTable_PollingMode, fd);
schedulingMode.add(Messages.get().General_FixedIntervalsDefault);
schedulingMode.add(Messages.get().General_FixedIntervalsCustom);
schedulingMode.add(Messages.get().General_CustomSchedule);
schedulingMode.select(dci.isUseAdvancedSchedule() ? 2 : ((dci.getPollingInterval() > 0) ? 1 : 0));
schedulingMode.setEnabled(dci.getOrigin() != DataCollectionObject.PUSH);
schedulingMode.addSelectionListener(new SelectionListener() {
@Override
public void widgetDefaultSelected(SelectionEvent e) {
widgetSelected(e);
}
@Override
public void widgetSelected(SelectionEvent e) {
pollingInterval.setEnabled(schedulingMode.getSelectionIndex() == 1);
}
});
pollingInterval = new LabeledSpinner(groupPolling, SWT.NONE);
pollingInterval.setLabel(Messages.get().General_PollingInterval);
pollingInterval.setRange(1, 99999);
pollingInterval.setSelection((dci.getPollingInterval() > 0) ? dci.getPollingInterval() : ConsoleSharedData.getSession().getDefaultDciPollingInterval());
pollingInterval.setEnabled(!dci.isUseAdvancedSchedule() && (dci.getPollingInterval() > 0) && (dci.getOrigin() != DataCollectionItem.PUSH));
fd = new FormData();
fd.left = new FormAttachment(50, WidgetHelper.OUTER_SPACING / 2);
fd.right = new FormAttachment(100, 0);
fd.top = new FormAttachment(0, 0);
pollingInterval.setLayoutData(fd);
fd = new FormData();
fd.left = new FormAttachment(0, 0);
fd.right = new FormAttachment(100, 0);
fd.top = new FormAttachment(schedulingMode.getParent(), WidgetHelper.OUTER_SPACING, SWT.BOTTOM);
clusterResource = WidgetHelper.createLabeledCombo(groupPolling, SWT.READ_ONLY, Messages.get().GeneralTable_ClRes, fd);
if (cluster != null) {
clusterResourceMap = new HashMap<Integer, Long>();
clusterResourceMap.put(0, 0L);
clusterResource.add(Messages.get().GeneralTable_None);
if (dci.getResourceId() == 0)
clusterResource.select(0);
int index = 1;
for (ClusterResource r : cluster.getResources()) {
clusterResource.add(r.getName());
clusterResourceMap.put(index, r.getId());
if (dci.getResourceId() == r.getId())
clusterResource.select(index);
index++;
}
} else {
clusterResource.add(Messages.get().GeneralTable_None);
clusterResource.select(0);
clusterResource.setEnabled(false);
}
/**
* status *
*/
Group groupStatus = new Group(dialogArea, SWT.NONE);
groupStatus.setText(Messages.get().GeneralTable_Status);
gd = new GridData();
gd.horizontalAlignment = SWT.FILL;
gd.verticalAlignment = SWT.FILL;
groupStatus.setLayoutData(gd);
RowLayout statusLayout = new RowLayout();
statusLayout.type = SWT.VERTICAL;
groupStatus.setLayout(statusLayout);
statusActive = new Button(groupStatus, SWT.RADIO);
statusActive.setText(Messages.get().GeneralTable_Active);
statusActive.setSelection(dci.getStatus() == DataCollectionObject.ACTIVE);
statusDisabled = new Button(groupStatus, SWT.RADIO);
statusDisabled.setText(Messages.get().GeneralTable_Disabled);
statusDisabled.setSelection(dci.getStatus() == DataCollectionObject.DISABLED);
statusUnsupported = new Button(groupStatus, SWT.RADIO);
statusUnsupported.setText(Messages.get().GeneralTable_NotSupported);
statusUnsupported.setSelection(dci.getStatus() == DataCollectionObject.NOT_SUPPORTED);
/**
* storage *
*/
Group groupStorage = new Group(dialogArea, SWT.NONE);
groupStorage.setText(Messages.get().GeneralTable_Storage);
gd = new GridData();
gd.horizontalAlignment = SWT.FILL;
gd.verticalAlignment = SWT.FILL;
gd.horizontalSpan = 2;
groupStorage.setLayoutData(gd);
GridLayout storageLayout = new GridLayout();
storageLayout.numColumns = 2;
storageLayout.horizontalSpacing = WidgetHelper.OUTER_SPACING;
groupStorage.setLayout(storageLayout);
gd = new GridData();
gd.grabExcessHorizontalSpace = true;
gd.horizontalAlignment = SWT.FILL;
retentionMode = WidgetHelper.createLabeledCombo(groupStorage, SWT.READ_ONLY, Messages.get().GeneralTable_RetentionMode, gd);
retentionMode.add(Messages.get().GeneralTable_UseDefaultRetention);
retentionMode.add(Messages.get().GeneralTable_UseCustomRetention);
retentionMode.add(Messages.get().GeneralTable_NoStorage);
retentionMode.select(((dci.getFlags() & DataCollectionObject.DCF_NO_STORAGE) != 0) ? 2 : ((dci.getRetentionTime() > 0) ? 1 : 0));
retentionMode.addSelectionListener(new SelectionListener() {
@Override
public void widgetDefaultSelected(SelectionEvent e) {
widgetSelected(e);
}
@Override
public void widgetSelected(SelectionEvent e) {
int mode = retentionMode.getSelectionIndex();
retentionTime.setEnabled(mode == 1);
}
});
retentionTime = new LabeledSpinner(groupStorage, SWT.NONE);
retentionTime.setLabel(Messages.get().GeneralTable_RetentionTime);
retentionTime.setRange(1, 99999);
retentionTime.setSelection((dci.getRetentionTime() > 0) ? dci.getRetentionTime() : ConsoleSharedData.getSession().getDefaultDciRetentionTime());
retentionTime.setEnabled(((dci.getFlags() & DataCollectionObject.DCF_NO_STORAGE) == 0) && (dci.getRetentionTime() > 0));
gd = new GridData();
gd.horizontalAlignment = SWT.FILL;
gd.grabExcessHorizontalSpace = true;
retentionTime.setLayoutData(gd);
return dialogArea;
}
use of org.netxms.ui.eclipse.objectbrowser.widgets.ObjectSelector in project netxms by netxms.
the class ICMP 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);
icmpProxy = new ObjectSelector(dialogArea, SWT.NONE, true);
icmpProxy.setLabel(Messages.get().Communication_Proxy);
icmpProxy.setObjectId(node.getIcmpProxyId());
icmpProxy.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
return dialogArea;
}
use of org.netxms.ui.eclipse.objectbrowser.widgets.ObjectSelector in project netxms by netxms.
the class ObjectPolling 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 = (PollingTarget) getElement().getAdapter(PollingTarget.class);
GridLayout layout = new GridLayout();
layout.verticalSpacing = WidgetHelper.DIALOG_SPACING;
layout.marginWidth = 0;
layout.marginHeight = 0;
dialogArea.setLayout(layout);
GridData gd = new GridData();
/* poller node */
if (object.containPollerNode()) {
Group servicePollGroup = new Group(dialogArea, SWT.NONE);
servicePollGroup.setText(Messages.get().NodePolling_GroupNetSrv);
layout = new GridLayout();
layout.horizontalSpacing = WidgetHelper.DIALOG_SPACING;
layout.numColumns = 2;
servicePollGroup.setLayout(layout);
gd = new GridData();
gd.horizontalAlignment = SWT.FILL;
gd.grabExcessHorizontalSpace = true;
servicePollGroup.setLayoutData(gd);
pollerNode = new ObjectSelector(servicePollGroup, SWT.NONE, true);
pollerNode.setLabel(Messages.get().NodePolling_PollerNode);
pollerNode.setObjectClass(AbstractNode.class);
pollerNode.setEmptySelectionName(Messages.get().NodePolling_EmptySelectionServer);
pollerNode.setObjectId(object.getPollerNodeId());
gd = new GridData();
gd.horizontalAlignment = SWT.FILL;
gd.grabExcessHorizontalSpace = true;
pollerNode.setLayoutData(gd);
Label label = new Label(servicePollGroup, SWT.WRAP);
label.setText(Messages.get().NodePolling_PollerNodeDescription);
gd = new GridData();
gd.widthHint = 250;
label.setLayoutData(gd);
}
/* poll count */
if (object instanceof AbstractNode) {
pollCount = new LabeledSpinner(dialogArea, SWT.NONE);
pollCount.setLabel("Required poll count for status change");
pollCount.setSelection(((AbstractNode) object).getRequredPollCount());
}
/* options */
Group optionsGroup = new Group(dialogArea, SWT.NONE);
optionsGroup.setText(Messages.get().NodePolling_GroupOptions);
layout = new GridLayout();
layout.verticalSpacing = WidgetHelper.DIALOG_SPACING;
optionsGroup.setLayout(layout);
gd = new GridData();
gd.horizontalAlignment = SWT.FILL;
gd.grabExcessHorizontalSpace = true;
optionsGroup.setLayoutData(gd);
if (object.containAgent())
addFlag(optionsGroup, AbstractNode.NF_DISABLE_NXCP, Messages.get().NodePolling_OptDisableAgent);
if (object.containInterfaces()) {
addFlag(optionsGroup, AbstractNode.NF_DISABLE_SNMP, Messages.get().NodePolling_OptDisableSNMP);
addFlag(optionsGroup, AbstractNode.NF_DISABLE_ICMP, Messages.get().NodePolling_OptDisableICMP);
}
addFlag(optionsGroup, AbstractNode.DCF_DISABLE_STATUS_POLL, Messages.get().NodePolling_OptDisableStatusPoll);
addFlag(optionsGroup, AbstractNode.DCF_DISABLE_CONF_POLL, Messages.get().NodePolling_OptDisableConfigPoll);
if (object.containInterfaces()) {
addFlag(optionsGroup, AbstractNode.NF_DISABLE_ROUTE_POLL, Messages.get().NodePolling_OptDisableRTPoll);
addFlag(optionsGroup, AbstractNode.NF_DISABLE_TOPOLOGY_POLL, Messages.get().NodePolling_OptDisableTopoPoll);
addFlag(optionsGroup, AbstractNode.NF_DISABLE_DISCOVERY_POLL, Messages.get().NodePolling_OptDisableDiscoveryPoll);
}
addFlag(optionsGroup, AbstractNode.DCF_DISABLE_DATA_COLLECT, Messages.get().NodePolling_OptDisableDataCollection);
/* use ifXTable */
if (object.containInterfaces()) {
Group ifXTableGroup = new Group(dialogArea, SWT.NONE);
ifXTableGroup.setText(Messages.get().NodePolling_GroupIfXTable);
layout = new GridLayout();
layout.horizontalSpacing = WidgetHelper.DIALOG_SPACING;
layout.numColumns = 3;
layout.makeColumnsEqualWidth = true;
ifXTableGroup.setLayout(layout);
gd = new GridData();
gd.horizontalAlignment = SWT.FILL;
gd.grabExcessHorizontalSpace = true;
ifXTableGroup.setLayoutData(gd);
radioIfXTableDefault = new Button(ifXTableGroup, SWT.RADIO);
radioIfXTableDefault.setText(Messages.get().NodePolling_Default);
radioIfXTableDefault.setSelection(object.getIfXTablePolicy() == AbstractNode.IFXTABLE_DEFAULT);
radioIfXTableEnable = new Button(ifXTableGroup, SWT.RADIO);
radioIfXTableEnable.setText(Messages.get().NodePolling_Enable);
radioIfXTableEnable.setSelection(object.getIfXTablePolicy() == AbstractNode.IFXTABLE_ENABLED);
radioIfXTableDisable = new Button(ifXTableGroup, SWT.RADIO);
radioIfXTableDisable.setText(Messages.get().NodePolling_Disable);
radioIfXTableDisable.setSelection(object.getIfXTablePolicy() == AbstractNode.IFXTABLE_DISABLED);
}
/* agent cache */
if (object.containAgent()) {
Group agentCacheGroup = new Group(dialogArea, SWT.NONE);
agentCacheGroup.setText(Messages.get().NodePolling_AgentCacheMode);
layout = new GridLayout();
layout.horizontalSpacing = WidgetHelper.DIALOG_SPACING;
layout.numColumns = 3;
layout.makeColumnsEqualWidth = true;
agentCacheGroup.setLayout(layout);
gd = new GridData();
gd.horizontalAlignment = SWT.FILL;
gd.grabExcessHorizontalSpace = true;
agentCacheGroup.setLayoutData(gd);
radioAgentCacheDefault = new Button(agentCacheGroup, SWT.RADIO);
radioAgentCacheDefault.setText(Messages.get().NodePolling_Default);
radioAgentCacheDefault.setSelection(object.getAgentCacheMode() == AgentCacheMode.DEFAULT);
radioAgentCacheOn = new Button(agentCacheGroup, SWT.RADIO);
radioAgentCacheOn.setText(Messages.get().NodePolling_On);
radioAgentCacheOn.setSelection(object.getAgentCacheMode() == AgentCacheMode.ON);
radioAgentCacheOff = new Button(agentCacheGroup, SWT.RADIO);
radioAgentCacheOff.setText(Messages.get().NodePolling_Off);
radioAgentCacheOff.setSelection(object.getAgentCacheMode() == AgentCacheMode.OFF);
}
return dialogArea;
}
use of org.netxms.ui.eclipse.objectbrowser.widgets.ObjectSelector in project netxms by netxms.
the class Agent 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);
FormLayout dialogLayout = new FormLayout();
dialogLayout.marginWidth = 0;
dialogLayout.marginHeight = 0;
dialogLayout.spacing = WidgetHelper.DIALOG_SPACING;
dialogArea.setLayout(dialogLayout);
agentPort = new LabeledText(dialogArea, SWT.NONE);
agentPort.setLabel(Messages.get().Communication_TCPPort);
agentPort.setText(Integer.toString(node.getAgentPort()));
FormData fd = new FormData();
fd.left = new FormAttachment(0, 0);
fd.top = new FormAttachment(0, 0);
agentPort.setLayoutData(fd);
agentProxy = new ObjectSelector(dialogArea, SWT.NONE, true);
agentProxy.setLabel(Messages.get().Communication_Proxy);
agentProxy.setObjectId(node.getAgentProxyId());
fd = new FormData();
fd.left = new FormAttachment(agentPort, 0, SWT.RIGHT);
fd.right = new FormAttachment(100, 0);
fd.top = new FormAttachment(0, 0);
agentProxy.setLayoutData(fd);
agentForceEncryption = new Button(dialogArea, SWT.CHECK);
agentForceEncryption.setText(Messages.get().Communication_ForceEncryption);
agentForceEncryption.setSelection((node.getFlags() & AbstractNode.NF_FORCE_ENCRYPTION) != 0);
fd = new FormData();
fd.left = new FormAttachment(0, 0);
fd.top = new FormAttachment(agentPort, 0, SWT.BOTTOM);
agentForceEncryption.setLayoutData(fd);
fd = new FormData();
fd.left = new FormAttachment(0, 0);
fd.top = new FormAttachment(agentForceEncryption, 0, SWT.BOTTOM);
agentAuthMethod = WidgetHelper.createLabeledCombo(dialogArea, SWT.BORDER | SWT.READ_ONLY, Messages.get().Communication_AuthMethod, fd);
agentAuthMethod.add(Messages.get().Communication_AuthNone);
agentAuthMethod.add(Messages.get().Communication_AuthPlain);
agentAuthMethod.add(Messages.get().Communication_AuthMD5);
agentAuthMethod.add(Messages.get().Communication_AuthSHA1);
agentAuthMethod.select(node.getAgentAuthMethod());
agentAuthMethod.addSelectionListener(new SelectionListener() {
@Override
public void widgetDefaultSelected(SelectionEvent e) {
widgetSelected(e);
}
@Override
public void widgetSelected(SelectionEvent e) {
agentSharedSecret.getTextControl().setEnabled(agentAuthMethod.getSelectionIndex() != AbstractNode.AGENT_AUTH_NONE);
}
});
agentSharedSecret = new LabeledText(dialogArea, SWT.NONE);
agentSharedSecret.setLabel(Messages.get().Communication_SharedSecret);
agentSharedSecret.setText(node.getAgentSharedSecret());
fd = new FormData();
fd.left = new FormAttachment(agentAuthMethod.getParent(), 0, SWT.RIGHT);
fd.right = new FormAttachment(100, 0);
fd.top = new FormAttachment(agentForceEncryption, 0, SWT.BOTTOM);
agentSharedSecret.setLayoutData(fd);
agentSharedSecret.getTextControl().setEnabled(node.getAgentAuthMethod() != AbstractNode.AGENT_AUTH_NONE);
/* agent compression */
Group agentCompressionGroup = new Group(dialogArea, SWT.NONE);
agentCompressionGroup.setText("Protocol compression mode");
GridLayout layout = new GridLayout();
layout.horizontalSpacing = WidgetHelper.DIALOG_SPACING;
layout.numColumns = 3;
layout.makeColumnsEqualWidth = true;
agentCompressionGroup.setLayout(layout);
fd = new FormData();
fd.left = new FormAttachment(0, 0);
fd.right = new FormAttachment(100, 0);
fd.top = new FormAttachment(agentSharedSecret, 0, SWT.BOTTOM);
agentCompressionGroup.setLayoutData(fd);
radioAgentCompressionDefault = new Button(agentCompressionGroup, SWT.RADIO);
radioAgentCompressionDefault.setText("Default");
radioAgentCompressionDefault.setSelection(node.getAgentCompressionMode() == AgentCompressionMode.DEFAULT);
radioAgentCompressionEnabled = new Button(agentCompressionGroup, SWT.RADIO);
radioAgentCompressionEnabled.setText("Enabled");
radioAgentCompressionEnabled.setSelection(node.getAgentCompressionMode() == AgentCompressionMode.ENABLED);
radioAgentCompressionDisabled = new Button(agentCompressionGroup, SWT.RADIO);
radioAgentCompressionDisabled.setText("Disabled");
radioAgentCompressionDisabled.setSelection(node.getAgentCompressionMode() == AgentCompressionMode.DISABLED);
return dialogArea;
}
Aggregations