Search in sources :

Example 11 with ImageHyperlink

use of org.eclipse.ui.forms.widgets.ImageHyperlink in project netxms by netxms.

the class ConditionEditor method initialize.

/**
 * Initialize editor
 */
public void initialize(ColumnFilter initialFilter) {
    GridLayout layout = new GridLayout();
    layout.numColumns = 4;
    setLayout(layout);
    logicalOperation = new Label(this, SWT.NONE);
    GridData gd = new GridData();
    gd.horizontalAlignment = SWT.CENTER;
    gd.widthHint = 30;
    logicalOperation.setLayoutData(gd);
    operation = new Combo(this, SWT.READ_ONLY);
    toolkit.adapt(operation);
    for (String s : getOperations()) operation.add(s);
    operation.select(0);
    operation.addSelectionListener(new SelectionListener() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            operationSelectionChanged(operation.getSelectionIndex());
        }

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
            widgetSelected(e);
        }
    });
    createContent(this, initialFilter);
    ImageHyperlink link = new ImageHyperlink(this, SWT.NONE);
    link.setImage(SharedIcons.IMG_DELETE_OBJECT);
    link.addHyperlinkListener(new HyperlinkAdapter() {

        @Override
        public void linkActivated(HyperlinkEvent e) {
            ConditionEditor.this.dispose();
            deleteHandler.run();
        }
    });
    layout(true, true);
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) HyperlinkEvent(org.eclipse.ui.forms.events.HyperlinkEvent) ImageHyperlink(org.eclipse.ui.forms.widgets.ImageHyperlink) Label(org.eclipse.swt.widgets.Label) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) Combo(org.eclipse.swt.widgets.Combo) SelectionListener(org.eclipse.swt.events.SelectionListener) HyperlinkAdapter(org.eclipse.ui.forms.events.HyperlinkAdapter)

Example 12 with ImageHyperlink

use of org.eclipse.ui.forms.widgets.ImageHyperlink in project netxms by netxms.

the class ObjectConditionEditor method createContent.

/* (non-Javadoc)
	 * @see org.netxms.ui.eclipse.logviewer.widgets.ConditionEditor#createContent(org.eclipse.swt.widgets.Composite)
	 */
@Override
protected void createContent(Composite parent, ColumnFilter initialFilter) {
    Composite group = new Composite(this, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    layout.horizontalSpacing = WidgetHelper.INNER_SPACING;
    layout.numColumns = 2;
    group.setLayout(layout);
    GridData gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    group.setLayoutData(gd);
    objectName = new CLabel(group, SWT.NONE);
    toolkit.adapt(objectName);
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    gd.verticalAlignment = SWT.TOP;
    objectName.setLayoutData(gd);
    objectName.setText(EMPTY_SELECTION_TEXT);
    final ImageHyperlink selectionLink = toolkit.createImageHyperlink(group, SWT.NONE);
    selectionLink.setImage(SharedIcons.IMG_FIND);
    selectionLink.addHyperlinkListener(new HyperlinkAdapter() {

        @Override
        public void linkActivated(HyperlinkEvent e) {
            selectObject();
        }
    });
    if (initialFilter != null) {
        switch(initialFilter.getType()) {
            case EQUALS:
                setSelectedOperation(initialFilter.isNegated() ? 1 : 0);
                objectId = initialFilter.getNumericValue();
                break;
            case CHILDOF:
                setSelectedOperation(initialFilter.isNegated() ? 3 : 2);
                objectId = initialFilter.getNumericValue();
                break;
            default:
                break;
        }
        if (objectId != 0) {
            AbstractObject object = ConsoleSharedData.getSession().findObjectById(objectId);
            if (object != null) {
                objectName.setText(object.getObjectName());
                objectName.setImage(labelProvider.getImage(object));
            } else {
                // $NON-NLS-1$ //$NON-NLS-2$
                objectName.setText("[" + objectId + "]");
            }
        }
    }
}
Also used : CLabel(org.eclipse.swt.custom.CLabel) GridLayout(org.eclipse.swt.layout.GridLayout) HyperlinkEvent(org.eclipse.ui.forms.events.HyperlinkEvent) Composite(org.eclipse.swt.widgets.Composite) ImageHyperlink(org.eclipse.ui.forms.widgets.ImageHyperlink) AbstractObject(org.netxms.client.objects.AbstractObject) GridData(org.eclipse.swt.layout.GridData) HyperlinkAdapter(org.eclipse.ui.forms.events.HyperlinkAdapter)

Example 13 with ImageHyperlink

use of org.eclipse.ui.forms.widgets.ImageHyperlink in project netxms by netxms.

the class UserConditionEditor method createContent.

/* (non-Javadoc)
	 * @see org.netxms.ui.eclipse.logviewer.widgets.ConditionEditor#createContent(org.eclipse.swt.widgets.Composite)
	 */
@Override
protected void createContent(Composite parent, ColumnFilter initialFilter) {
    Composite group = new Composite(this, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    layout.horizontalSpacing = WidgetHelper.INNER_SPACING;
    layout.numColumns = 2;
    group.setLayout(layout);
    GridData gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    group.setLayoutData(gd);
    objectName = new CLabel(group, SWT.NONE);
    toolkit.adapt(objectName);
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    gd.verticalAlignment = SWT.TOP;
    objectName.setLayoutData(gd);
    objectName.setText(EMPTY_SELECTION_TEXT);
    final ImageHyperlink selectionLink = toolkit.createImageHyperlink(group, SWT.NONE);
    selectionLink.setImage(SharedIcons.IMG_FIND);
    selectionLink.addHyperlinkListener(new HyperlinkAdapter() {

        @Override
        public void linkActivated(HyperlinkEvent e) {
            selectUser();
        }
    });
}
Also used : CLabel(org.eclipse.swt.custom.CLabel) GridLayout(org.eclipse.swt.layout.GridLayout) HyperlinkEvent(org.eclipse.ui.forms.events.HyperlinkEvent) Composite(org.eclipse.swt.widgets.Composite) ImageHyperlink(org.eclipse.ui.forms.widgets.ImageHyperlink) GridData(org.eclipse.swt.layout.GridData) HyperlinkAdapter(org.eclipse.ui.forms.events.HyperlinkAdapter)

Example 14 with ImageHyperlink

use of org.eclipse.ui.forms.widgets.ImageHyperlink in project netxms by netxms.

the class VPNSubnets method createNetworkList.

/**
 * Creates network list
 *
 * @param dialogArea
 * @param viewList viewer to be created and added to view
 * @param data elements that should be added as a content of this viewer
 */
private void createNetworkList(Composite dialogArea, String title, TableViewer viewList, final List<InetAddressEx> data) {
    Group clientArea = new Group(dialogArea, SWT.NONE);
    clientArea.setText(title);
    GridLayout layout = new GridLayout();
    layout.numColumns = 2;
    GridData gd = new GridData();
    clientArea.setLayout(layout);
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    gd.verticalAlignment = SWT.FILL;
    gd.grabExcessVerticalSpace = true;
    clientArea.setLayoutData(gd);
    viewList = new TableViewer(clientArea, 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 = 100;
    viewList.getTable().setLayoutData(gd);
    viewList.getTable().setSortDirection(SWT.UP);
    viewList.setContentProvider(new ArrayContentProvider());
    viewList.setComparator(new SubnetComparator());
    viewList.setInput(data.toArray());
    final TableViewer list = viewList;
    final ImageHyperlink linkAdd = new ImageHyperlink(clientArea, SWT.NONE);
    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) {
            addTargetAddressListElement(list, data);
        }
    });
    final ImageHyperlink linkRemove = new ImageHyperlink(clientArea, SWT.NONE);
    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) {
            removeTargetAddressListElements(list, data);
        }
    });
}
Also used : Group(org.eclipse.swt.widgets.Group) GridLayout(org.eclipse.swt.layout.GridLayout) HyperlinkEvent(org.eclipse.ui.forms.events.HyperlinkEvent) ImageHyperlink(org.eclipse.ui.forms.widgets.ImageHyperlink) SubnetComparator(org.netxms.ui.eclipse.objectmanager.propertypages.helpers.SubnetComparator) GridData(org.eclipse.swt.layout.GridData) ArrayContentProvider(org.eclipse.jface.viewers.ArrayContentProvider) TableViewer(org.eclipse.jface.viewers.TableViewer) HyperlinkAdapter(org.eclipse.ui.forms.events.HyperlinkAdapter)

Example 15 with ImageHyperlink

use of org.eclipse.ui.forms.widgets.ImageHyperlink in project netxms by netxms.

the class ReportExecutionForm method createResultsSection.

/**
 * Create "Results" section's content
 *
 * @param parent
 *            parent composite
 */
private void createResultsSection(Composite parent) {
    GridLayout layout = new GridLayout();
    parent.setLayout(layout);
    final String[] names = { "Execution Time", "Started by", "Status" };
    final int[] widths = { 180, 140, 100 };
    resultList = new SortableTableViewer(parent, names, widths, 0, SWT.DOWN, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI);
    GridData gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.verticalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    gd.grabExcessVerticalSpace = true;
    resultList.getControl().setLayoutData(gd);
    resultList.setContentProvider(new ArrayContentProvider());
    resultList.setLabelProvider(new ReportResultLabelProvider());
    WidgetHelper.restoreTableViewerSettings(resultList, Activator.getDefault().getDialogSettings(), "ReportExecutionForm.ResultList");
    resultList.getControl().addDisposeListener(new DisposeListener() {

        @Override
        public void widgetDisposed(DisposeEvent e) {
            WidgetHelper.saveTableViewerSettings(resultList, Activator.getDefault().getDialogSettings(), "ReportExecutionForm.ResultList");
        }
    });
    ImageHyperlink link = toolkit.createImageHyperlink(parent, SWT.WRAP);
    link.setImage(SharedIcons.IMG_EXECUTE);
    link.setText("Execute Report");
    link.addHyperlinkListener(new HyperlinkAdapter() {

        @Override
        public void linkActivated(HyperlinkEvent e) {
            executeReport();
        }
    });
    createResultsContextMenu();
    resultList.addSelectionChangedListener(new ISelectionChangedListener() {

        @Override
        public void selectionChanged(SelectionChangedEvent event) {
            IStructuredSelection selection = (IStructuredSelection) resultList.getSelection();
            actionDeleteResult.setEnabled(selection.size() > 0);
            actionRenderPDF.setEnabled(selection.size() == 1);
            actionRenderXLS.setEnabled(selection.size() == 1);
        }
    });
}
Also used : DisposeListener(org.eclipse.swt.events.DisposeListener) HyperlinkEvent(org.eclipse.ui.forms.events.HyperlinkEvent) ImageHyperlink(org.eclipse.ui.forms.widgets.ImageHyperlink) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) SortableTableViewer(org.netxms.ui.eclipse.widgets.SortableTableViewer) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) DisposeEvent(org.eclipse.swt.events.DisposeEvent) ReportResultLabelProvider(org.netxms.ui.eclipse.reporter.widgets.helpers.ReportResultLabelProvider) GridLayout(org.eclipse.swt.layout.GridLayout) GridData(org.eclipse.swt.layout.GridData) ArrayContentProvider(org.eclipse.jface.viewers.ArrayContentProvider) HyperlinkAdapter(org.eclipse.ui.forms.events.HyperlinkAdapter)

Aggregations

ImageHyperlink (org.eclipse.ui.forms.widgets.ImageHyperlink)50 HyperlinkEvent (org.eclipse.ui.forms.events.HyperlinkEvent)46 HyperlinkAdapter (org.eclipse.ui.forms.events.HyperlinkAdapter)45 GridLayout (org.eclipse.swt.layout.GridLayout)37 Composite (org.eclipse.swt.widgets.Composite)35 GridData (org.eclipse.swt.layout.GridData)34 ArrayContentProvider (org.eclipse.jface.viewers.ArrayContentProvider)19 TableViewer (org.eclipse.jface.viewers.TableViewer)17 Section (org.eclipse.ui.forms.widgets.Section)16 TableWrapData (org.eclipse.ui.forms.widgets.TableWrapData)16 ExpandableComposite (org.eclipse.ui.forms.widgets.ExpandableComposite)8 CLabel (org.eclipse.swt.custom.CLabel)7 List (java.util.List)5 Image (org.eclipse.swt.graphics.Image)5 ISelectionChangedListener (org.eclipse.jface.viewers.ISelectionChangedListener)4 Control (org.eclipse.swt.widgets.Control)4 Label (org.eclipse.swt.widgets.Label)4 ArrayList (java.util.ArrayList)3 ILabelProvider (org.eclipse.jface.viewers.ILabelProvider)3 DisposeEvent (org.eclipse.swt.events.DisposeEvent)3