use of org.eclipse.ui.forms.widgets.ImageHyperlink in project netxms by netxms.
the class DateFieldEditor method createContent.
/* (non-Javadoc)
* @see org.netxms.ui.eclipse.reporter.widgets.FieldEditor#createContent(org.eclipse.swt.widgets.Composite)
*/
@Override
protected Control createContent(Composite parent) {
final ImageCache imageCache = new ImageCache(this);
final Composite content = new Composite(parent, SWT.NONE);
GridLayout layout = new GridLayout();
layout.numColumns = 4;
layout.marginHeight = 0;
layout.marginWidth = 0;
layout.horizontalSpacing = WidgetHelper.INNER_SPACING;
layout.makeColumnsEqualWidth = true;
content.setLayout(layout);
Calendar dateTime = Calendar.getInstance();
try {
dateTime.setTime(new Date(Long.parseLong(parameter.getDefaultValue()) * 1000));
} catch (NumberFormatException e) {
dateTime.setTime(new Date());
}
final String[] dateElementNames = { Messages.get().DateFieldEditor_Year, Messages.get().DateFieldEditor_Month, Messages.get().DateFieldEditor_Day };
dateElements = new Combo[dateElementNames.length];
for (int idx = 0; idx < dateElementNames.length; idx++) {
Combo cb = WidgetHelper.createLabeledCombo(content, SWT.BORDER, dateElementNames[idx], WidgetHelper.DEFAULT_LAYOUT_DATA);
cb.setText(getDateTimeText(idx, dateTime));
// $NON-NLS-1$
cb.add("current");
// $NON-NLS-1$
cb.add("previous");
// $NON-NLS-1$
cb.add("next");
dateElements[idx] = cb;
}
final ImageHyperlink link = toolkit.createImageHyperlink(content, SWT.NONE);
// $NON-NLS-1$
link.setImage(imageCache.add(Activator.getImageDescriptor("icons/calendar.png")));
link.setToolTipText(Messages.get().DateFieldEditor_Calendar);
link.addHyperlinkListener(new HyperlinkAdapter() {
@Override
public void linkActivated(HyperlinkEvent e) {
createPopupCalendar(link);
}
});
GridData gd = new GridData();
gd.verticalAlignment = SWT.BOTTOM;
gd.horizontalAlignment = SWT.LEFT;
link.setLayoutData(gd);
return content;
}
use of org.eclipse.ui.forms.widgets.ImageHyperlink in project netxms by netxms.
the class EventFieldEditor method createContent.
/* (non-Javadoc)
* @see org.netxms.ui.eclipse.reporter.widgets.FieldEditor#createContent(org.eclipse.swt.widgets.Composite)
*/
@Override
protected Control createContent(Composite parent) {
Composite content = toolkit.createComposite(parent, SWT.BORDER);
GridLayout layout = new GridLayout();
layout.numColumns = 3;
layout.horizontalSpacing = WidgetHelper.OUTER_SPACING;
layout.marginHeight = 0;
layout.marginWidth = 0;
content.setLayout(layout);
text = new CLabel(content, SWT.NONE);
toolkit.adapt(text);
GridData gd = new GridData();
gd.horizontalAlignment = SWT.FILL;
gd.grabExcessHorizontalSpace = true;
gd.verticalAlignment = SWT.TOP;
text.setLayoutData(gd);
text.setText(EMPTY_SELECTION_TEXT);
final ImageHyperlink selectionLink = toolkit.createImageHyperlink(content, SWT.NONE);
selectionLink.setImage(SharedIcons.IMG_FIND);
selectionLink.setToolTipText(Messages.get().EventFieldEditor_SelectEvent);
selectionLink.addHyperlinkListener(new HyperlinkAdapter() {
@Override
public void linkActivated(HyperlinkEvent e) {
selectEvent();
}
});
final ImageHyperlink clearLink = toolkit.createImageHyperlink(content, SWT.NONE);
clearLink.setImage(SharedIcons.IMG_CLEAR);
clearLink.setToolTipText(Messages.get().EventFieldEditor_ClearSelection);
clearLink.addHyperlinkListener(new HyperlinkAdapter() {
@Override
public void linkActivated(HyperlinkEvent e) {
eventCode = 0;
text.setText(EMPTY_SELECTION_TEXT);
text.setImage(null);
}
});
return content;
}
use of org.eclipse.ui.forms.widgets.ImageHyperlink in project netxms by netxms.
the class SnmpCredentials method createSnmpCommunitySection.
/**
* Create "SNMP Communities" section
*/
private void createSnmpCommunitySection() {
Section section = toolkit.createSection(form.getBody(), Section.DESCRIPTION | Section.TITLE_BAR);
section.setText(Messages.get().SnmpConfigurator_SectionCommunities);
section.setDescription(Messages.get().SnmpConfigurator_SectionCommunitiesDescr);
TableWrapData td = new TableWrapData();
td.align = TableWrapData.FILL;
td.grabHorizontal = true;
section.setLayoutData(td);
Composite clientArea = toolkit.createComposite(section);
GridLayout layout = new GridLayout();
layout.numColumns = 2;
clientArea.setLayout(layout);
section.setClient(clientArea);
snmpCommunityList = new TableViewer(clientArea, SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION);
toolkit.adapt(snmpCommunityList.getTable());
GridData gd = new GridData();
gd.horizontalAlignment = SWT.FILL;
gd.grabExcessHorizontalSpace = true;
gd.verticalAlignment = SWT.FILL;
gd.grabExcessVerticalSpace = true;
gd.verticalSpan = 2;
gd.heightHint = 150;
snmpCommunityList.getTable().setLayoutData(gd);
snmpCommunityList.getTable().setSortDirection(SWT.UP);
snmpCommunityList.setContentProvider(new ArrayContentProvider());
snmpCommunityList.setComparator(new StringComparator());
final ImageHyperlink linkAdd = toolkit.createImageHyperlink(clientArea, SWT.NONE);
linkAdd.setText(Messages.get().SnmpConfigurator_Add);
linkAdd.setImage(SharedIcons.IMG_ADD_OBJECT);
gd = new GridData();
gd.verticalAlignment = SWT.TOP;
linkAdd.setLayoutData(gd);
linkAdd.addHyperlinkListener(new HyperlinkAdapter() {
@Override
public void linkActivated(HyperlinkEvent e) {
addCommunity();
}
});
final ImageHyperlink linkRemove = toolkit.createImageHyperlink(clientArea, SWT.NONE);
linkRemove.setText(Messages.get().SnmpConfigurator_Remove);
linkRemove.setImage(SharedIcons.IMG_DELETE_OBJECT);
gd = new GridData();
gd.verticalAlignment = SWT.TOP;
linkRemove.setLayoutData(gd);
linkRemove.addHyperlinkListener(new HyperlinkAdapter() {
@Override
public void linkActivated(HyperlinkEvent e) {
removeCommunity();
}
});
}
use of org.eclipse.ui.forms.widgets.ImageHyperlink in project netxms by netxms.
the class ExportFileBuilder method createScriptSection.
/**
* Create "Scripts" section
*/
private void createScriptSection() {
Section section = toolkit.createSection(form.getBody(), Section.TITLE_BAR);
section.setText("Scripts");
TableWrapData td = new TableWrapData();
td.align = TableWrapData.FILL;
td.grabHorizontal = true;
section.setLayoutData(td);
Composite clientArea = toolkit.createComposite(section);
GridLayout layout = new GridLayout();
layout.numColumns = 2;
clientArea.setLayout(layout);
section.setClient(clientArea);
scriptViewer = new TableViewer(clientArea, SWT.FULL_SELECTION | SWT.MULTI | SWT.BORDER);
toolkit.adapt(ruleViewer.getTable());
GridData gd = new GridData();
gd.horizontalAlignment = SWT.FILL;
gd.grabExcessHorizontalSpace = true;
gd.verticalAlignment = SWT.FILL;
gd.grabExcessVerticalSpace = true;
gd.heightHint = 200;
gd.verticalSpan = 2;
scriptViewer.getTable().setLayoutData(gd);
scriptViewer.setContentProvider(new ArrayContentProvider());
scriptViewer.setLabelProvider(new ScriptLabelProvider());
scriptViewer.setComparator(new ScriptComparator());
scriptViewer.getTable().setSortDirection(SWT.UP);
final ImageHyperlink linkAdd = toolkit.createImageHyperlink(clientArea, SWT.NONE);
linkAdd.setText(Messages.get().ExportFileBuilder_Add);
linkAdd.setImage(SharedIcons.IMG_ADD_OBJECT);
gd = new GridData();
gd.verticalAlignment = SWT.TOP;
linkAdd.setLayoutData(gd);
linkAdd.addHyperlinkListener(new HyperlinkAdapter() {
@Override
public void linkActivated(HyperlinkEvent e) {
addScripts();
}
});
final ImageHyperlink linkRemove = toolkit.createImageHyperlink(clientArea, SWT.NONE);
linkRemove.setText(Messages.get().ExportFileBuilder_Remove);
linkRemove.setImage(SharedIcons.IMG_DELETE_OBJECT);
gd = new GridData();
gd.verticalAlignment = SWT.TOP;
linkRemove.setLayoutData(gd);
linkRemove.addHyperlinkListener(new HyperlinkAdapter() {
@Override
public void linkActivated(HyperlinkEvent e) {
removeObjects(scriptViewer, scripts);
}
});
}
use of org.eclipse.ui.forms.widgets.ImageHyperlink in project netxms by netxms.
the class ExportFileBuilder method createRuleSection.
/**
* Create "Rules" section
*/
private void createRuleSection() {
Section section = toolkit.createSection(form.getBody(), Section.TITLE_BAR);
section.setText(Messages.get().ExportFileBuilder_SectionRules);
TableWrapData td = new TableWrapData();
td.align = TableWrapData.FILL;
td.grabHorizontal = true;
section.setLayoutData(td);
Composite clientArea = toolkit.createComposite(section);
GridLayout layout = new GridLayout();
layout.numColumns = 2;
clientArea.setLayout(layout);
section.setClient(clientArea);
ruleViewer = new TableViewer(clientArea, SWT.FULL_SELECTION | SWT.MULTI | SWT.BORDER);
ruleViewer.getTable().setLinesVisible(true);
ruleViewer.getTable().setHeaderVisible(true);
TableColumn column = new TableColumn(ruleViewer.getTable(), SWT.LEFT);
column.setText("Rule #");
column.setWidth(60);
column = new TableColumn(ruleViewer.getTable(), SWT.LEFT);
column.setText("Rule Name");
column.setWidth(250);
toolkit.adapt(ruleViewer.getTable());
GridData gd = new GridData();
gd.horizontalAlignment = SWT.FILL;
gd.grabExcessHorizontalSpace = true;
gd.verticalAlignment = SWT.FILL;
gd.grabExcessVerticalSpace = true;
gd.heightHint = 200;
gd.verticalSpan = 2;
ruleViewer.getTable().setLayoutData(gd);
ruleViewer.setContentProvider(new ArrayContentProvider());
ruleViewer.setLabelProvider(new RuleLabelProvider());
ruleViewer.setComparator(new RuleComparator());
ruleViewer.getTable().setSortDirection(SWT.UP);
final ImageHyperlink linkAdd = toolkit.createImageHyperlink(clientArea, SWT.NONE);
linkAdd.setText(Messages.get().ExportFileBuilder_Add);
linkAdd.setImage(SharedIcons.IMG_ADD_OBJECT);
gd = new GridData();
gd.verticalAlignment = SWT.TOP;
linkAdd.setLayoutData(gd);
linkAdd.addHyperlinkListener(new HyperlinkAdapter() {
@Override
public void linkActivated(HyperlinkEvent e) {
if (rulesCache == null) {
new ConsoleJob(Messages.get().ExportFileBuilder_EPPLoadJobName, ExportFileBuilder.this, Activator.PLUGIN_ID, null) {
@Override
protected void runInternal(IProgressMonitor monitor) throws Exception {
rulesCache = session.getEventProcessingPolicy().getRules();
runInUIThread(new Runnable() {
@Override
public void run() {
addRules();
}
});
}
@Override
protected String getErrorMessage() {
return Messages.get().ExportFileBuilder_EPPLoadJobError;
}
}.start();
} else {
addRules();
}
}
});
final ImageHyperlink linkRemove = toolkit.createImageHyperlink(clientArea, SWT.NONE);
linkRemove.setText(Messages.get().ExportFileBuilder_Remove);
linkRemove.setImage(SharedIcons.IMG_DELETE_OBJECT);
gd = new GridData();
gd.verticalAlignment = SWT.TOP;
linkRemove.setLayoutData(gd);
linkRemove.addHyperlinkListener(new HyperlinkAdapter() {
@Override
public void linkActivated(HyperlinkEvent e) {
removeObjects(ruleViewer, rules);
}
});
}
Aggregations