Search in sources :

Example 16 with Button

use of org.eclipse.swt.widgets.Button in project cogtool by cogtool.

the class WebCrawlImportDialog method buildSameURLGroup.

public void buildSameURLGroup() {
    sameURLGroup = new Group(comp, SWT.SHADOW_NONE);
    sameURLGroup.setText(SAME_URL_GROUP);
    sameURLGroup.setLayout(new FormLayout());
    pruneCrawlOnSame = new Button(sameURLGroup, SWT.RADIO);
    pruneCrawlOnSame.setText(SAME_URL_PRUNE_LABEL);
    pruneCrawlOnSame.setSelection(true);
    pruneCrawlOnSame.setEnabled(false);
    replacePageOnSame = new Button(sameURLGroup, SWT.RADIO);
    replacePageOnSame.setText(SAME_URL_REPLACE_LABEL);
    replacePageOnSame.setEnabled(false);
}
Also used : FormLayout(org.eclipse.swt.layout.FormLayout) Group(org.eclipse.swt.widgets.Group) Button(org.eclipse.swt.widgets.Button)

Example 17 with Button

use of org.eclipse.swt.widgets.Button in project cogtool by cogtool.

the class WebCrawlImportDialog method buildThirdGroup.

public void buildThirdGroup() {
    typeHTMLGroup3 = new Group(useSelectionGroup, SWT.SHADOW_NONE);
    typeHTMLGroup3.setText("Starting URL #3");
    typeHTMLGroup3.setLayout(new FormLayout());
    urlText3 = new TextWithEnableFix(typeHTMLGroup3, SWT.BORDER | SWT.SINGLE);
    urlText3.setText("http://");
    urlText3.addTraverseListener(new TraverseListener() {

        public void keyTraversed(TraverseEvent e) {
            if (e.detail == SWT.TRAVERSE_TAB_PREVIOUS) {
                e.detail = SWT.TRAVERSE_NONE;
                questionMarkButtonDomain2.forceFocus();
            }
        }
    });
    plusButton3 = makeToolBarButton(typeHTMLGroup3, addGroupListener, questionImages.PLUS_IMAGE);
    minusButton3 = makeToolBarButton(typeHTMLGroup3, minusGroupListener3, questionImages.MINUS_IMAGE);
    maximumDepthToCrawlLabel3 = new Label(typeHTMLGroup3, SWT.NONE);
    maximumDepthToCrawlLabel3.setText("Maximum Depth To Crawl: ");
    questionMarkButtonDepth3 = makeToolBarButton(typeHTMLGroup3, depthListener, questionImages.QUESTION_SHADOW);
    maxDepthCombo3 = new ComboWithEnableFix(typeHTMLGroup3, SWT.DROP_DOWN | SWT.READ_ONLY);
    maxDepthCombo3.add("Unlimited");
    for (int i = 0; i < 100; i++) {
        maxDepthCombo3.add("" + i);
    }
    maxDepthCombo3.select(2);
    maxDepthCombo3.setVisibleItemCount(21);
    useHTML7 = new Button(typeHTMLGroup3, SWT.RADIO);
    useHTML7.addSelectionListener(domainListener);
    useHTML7.setSelection(true);
    useHTML8 = new Button(typeHTMLGroup3, SWT.RADIO);
    useHTML8.addSelectionListener(domainListener);
    useHTML9 = new Button(typeHTMLGroup3, SWT.RADIO);
    useHTML9.addSelectionListener(domainListener);
    urlPath7 = new Label(typeHTMLGroup3, SWT.NONE);
    urlPath7.setText("Unrestricted");
    urlPath8 = new Label(typeHTMLGroup3, SWT.NONE);
    urlPath8.setText("http://host_name/");
    urlPath9 = new Label(typeHTMLGroup3, SWT.NONE);
    urlPath9.setText("http://host_name/path");
    urlPath9b = new Label(typeHTMLGroup3, SWT.NONE);
    urlPath9b.setText("path");
    urlPath9b.setFont(URL_PATH_FONT);
    urlPath9b.setVisible(false);
    maxDepthCombo3.addSelectionListener(comboListener);
    restrictDomainLabel3 = new Label(typeHTMLGroup3, SWT.NONE);
    restrictDomainLabel3.setText("Restrict Domain: ");
    questionMarkButtonDomain3 = makeToolBarButton(typeHTMLGroup3, domainHelpListener, questionImages.QUESTION_SHADOW);
    urlText3.addFocusListener(new TextFocusListener(urlText3, urlPath8, urlPath9, useHTML7, useHTML8, useHTML9, 3));
}
Also used : FormLayout(org.eclipse.swt.layout.FormLayout) Group(org.eclipse.swt.widgets.Group) TraverseEvent(org.eclipse.swt.events.TraverseEvent) TraverseListener(org.eclipse.swt.events.TraverseListener) Button(org.eclipse.swt.widgets.Button) TextWithEnableFix(edu.cmu.cs.hcii.cogtool.util.TextWithEnableFix) Label(org.eclipse.swt.widgets.Label) ComboWithEnableFix(edu.cmu.cs.hcii.cogtool.util.ComboWithEnableFix) Point(org.eclipse.swt.graphics.Point)

Example 18 with Button

use of org.eclipse.swt.widgets.Button in project cogtool by cogtool.

the class Keypad method makeNumbers.

/**
     * Creates and lays out the buttons for the keypad's number pad.
     *
     * @author Paul Rubritz (ptr@andrew.cmu.edu)
     */
protected void makeNumbers() {
    GridLayout grid = new GridLayout();
    grid.numColumns = 3;
    GridData gridKeysOption = new GridData();
    gridKeysOption.horizontalIndent = (keypadType == FULL_KEYPAD) ? 60 : 0;
    gridKeysOption.verticalAlignment = SWT.TOP;
    Composite numbers = new Composite(dialog, SWT.NONE);
    numbers.setLayoutData(gridKeysOption);
    numbers.setLayout(grid);
    Button keypadButton;
    for (int i = 0; i < numberKeys.length; i++) {
        gridKeysOption = new GridData();
        if (i < numberKeys.length - 1) {
            gridKeysOption.widthHint = 50;
        } else if (keypadType == NUMPAD_ONLY) {
            gridKeysOption.widthHint = 160;
            gridKeysOption.horizontalSpan = 3;
        } else {
            break;
        }
        gridKeysOption.heightHint = 50;
        keypadButton = makeButton(numbers, numberKeys[i], gridKeysOption);
        //       (see IntegerEntry)
        if ((keypadType == NUMPAD_ONLY) && numberKeys[i].equals("-")) {
            keypadButton.setBackground(getDisabledColor());
            keypadButton.setEnabled(false);
        }
    }
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) Button(org.eclipse.swt.widgets.Button) GridData(org.eclipse.swt.layout.GridData) Point(org.eclipse.swt.graphics.Point)

Example 19 with Button

use of org.eclipse.swt.widgets.Button in project cogtool by cogtool.

the class Keypad method makeButton.

protected Button makeButton(Composite parent, String buttonLabel, GridData gridKeysOption, SelectionListener listener) {
    Button keypadButton = new Button(parent, SWT.PUSH);
    keypadButton.setText(buttonLabel);
    keypadButton.setFont(FontUtils.DEFAULT_FONT);
    keypadButton.setLayoutData(gridKeysOption);
    keypadButton.addSelectionListener(listener);
    return keypadButton;
}
Also used : Button(org.eclipse.swt.widgets.Button)

Example 20 with Button

use of org.eclipse.swt.widgets.Button in project cogtool by cogtool.

the class StoppableProgressBar method addBelowBar.

@Override
protected void addBelowBar() {
    super.addBelowBar();
    // box, tying it to the given pausable "process" object.
    if (stopListener != null) {
        stopButton = new Button(shell, SWT.PUSH);
        stopButton.setText(STOP_LABEL);
        stopButton.addSelectionListener(new SelectionAdapter() {

            @Override
            public void widgetSelected(SelectionEvent evt) {
                stopListener.stop();
                stopButton.setEnabled(false);
            }
        });
        FormData data = new FormData();
        // Replace positioning for cancelButton if present
        if (cancelButton != null) {
            data.left = new FormAttachment(50, 3);
            data.top = new FormAttachment(bar, 5, SWT.BOTTOM);
            cancelButton.setLayoutData(data);
            data = new FormData();
            data.right = new FormAttachment(50, -3);
            data.top = new FormAttachment(bar, 5, SWT.BOTTOM);
        } else {
            data.left = new FormAttachment(bar, 0, SWT.CENTER);
            data.top = new FormAttachment(bar, 5, SWT.BOTTOM);
        }
        stopButton.setLayoutData(data);
    }
}
Also used : FormData(org.eclipse.swt.layout.FormData) Button(org.eclipse.swt.widgets.Button) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) SelectionEvent(org.eclipse.swt.events.SelectionEvent) FormAttachment(org.eclipse.swt.layout.FormAttachment)

Aggregations

Button (org.eclipse.swt.widgets.Button)3370 SelectionEvent (org.eclipse.swt.events.SelectionEvent)1988 GridData (org.eclipse.swt.layout.GridData)1806 Composite (org.eclipse.swt.widgets.Composite)1782 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)1651 GridLayout (org.eclipse.swt.layout.GridLayout)1580 Label (org.eclipse.swt.widgets.Label)1570 Text (org.eclipse.swt.widgets.Text)1100 Group (org.eclipse.swt.widgets.Group)806 ModifyListener (org.eclipse.swt.events.ModifyListener)618 ModifyEvent (org.eclipse.swt.events.ModifyEvent)606 FormAttachment (org.eclipse.swt.layout.FormAttachment)556 FormData (org.eclipse.swt.layout.FormData)556 Shell (org.eclipse.swt.widgets.Shell)524 FormLayout (org.eclipse.swt.layout.FormLayout)499 Event (org.eclipse.swt.widgets.Event)499 SelectionListener (org.eclipse.swt.events.SelectionListener)492 Listener (org.eclipse.swt.widgets.Listener)474 Display (org.eclipse.swt.widgets.Display)424 ShellEvent (org.eclipse.swt.events.ShellEvent)350