Search in sources :

Example 1 with BubbleTextBox

use of com.biglybt.ui.swt.components.BubbleTextBox in project BiglyBT by BiglySoftware.

the class FilesView method initComposite.

/* (non-Javadoc)
	 * @see com.biglybt.ui.swt.views.table.impl.TableViewTab#initComposite(org.eclipse.swt.widgets.Composite)
	 */
@Override
public Composite initComposite(Composite composite) {
    Composite parent = new Composite(composite, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.marginHeight = layout.marginWidth = 0;
    parent.setLayout(layout);
    Layout compositeLayout = composite.getLayout();
    if (compositeLayout instanceof GridLayout) {
        parent.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    } else if (compositeLayout instanceof FormLayout) {
        parent.setLayoutData(Utils.getFilledFormData());
    }
    Composite cTop = new Composite(parent, SWT.NONE);
    cTop.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
    cTop.setLayout(new FormLayout());
    // hide dnd
    btnShowDND = new Button(cTop, SWT.CHECK);
    Messages.setLanguageText(btnShowDND, "FilesView.hide.dnd");
    btnShowDND.addSelectionListener(new SelectionListener() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            COConfigurationManager.setParameter("FilesView.hide.dnd", !hide_dnd_files);
        }

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
        }
    });
    hide_dnd_files = COConfigurationManager.getBooleanParameter("FilesView.hide.dnd");
    btnShowDND.setSelection(hide_dnd_files);
    // tree view
    btnTreeView = new Button(cTop, SWT.CHECK);
    Messages.setLanguageText(btnTreeView, "OpenTorrentWindow.tree.view");
    btnTreeView.addSelectionListener(new SelectionListener() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            tree_view = btnTreeView.getSelection();
            COConfigurationManager.setParameter("FilesView.use.tree", tree_view);
            force_refresh = true;
            tableRefresh();
        }

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
        }
    });
    tree_view = COConfigurationManager.getBooleanParameter("FilesView.use.tree");
    btnTreeView.setSelection(tree_view);
    // dunno why but doesnt draw on Linux with double-buffering
    lblHeader = new BufferedLabel(cTop, SWT.CENTER | (Constants.isLinux ? 0 : SWT.DOUBLE_BUFFERED));
    BubbleTextBox bubbleTextBox = new BubbleTextBox(cTop, SWT.BORDER | SWT.SEARCH | SWT.ICON_SEARCH | SWT.ICON_CANCEL | SWT.SINGLE);
    bubbleTextBox.getTextWidget().setMessage(MessageText.getString("TorrentDetailsView.filter"));
    FormData fd = Utils.getFilledFormData();
    fd.left = null;
    bubbleTextBox.getParent().setLayoutData(fd);
    fd = new FormData();
    fd.top = new FormAttachment(bubbleTextBox.getParent(), 10, SWT.CENTER);
    fd.left = new FormAttachment(0, 0);
    btnShowDND.setLayoutData(fd);
    fd = new FormData();
    fd.top = new FormAttachment(bubbleTextBox.getParent(), 10, SWT.CENTER);
    fd.left = new FormAttachment(btnShowDND, 10);
    btnTreeView.setLayoutData(fd);
    fd = new FormData();
    fd.top = new FormAttachment(bubbleTextBox.getParent(), 10, SWT.CENTER);
    fd.left = new FormAttachment(btnTreeView, 10);
    fd.right = new FormAttachment(bubbleTextBox.getParent(), -10);
    lblHeader.setLayoutData(fd);
    tv.enableFilterCheck(bubbleTextBox.getTextWidget(), this, true);
    Composite tableParent = new Composite(parent, SWT.NONE);
    tableParent.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    GridLayout gridLayout = new GridLayout();
    gridLayout.horizontalSpacing = gridLayout.verticalSpacing = 0;
    gridLayout.marginHeight = gridLayout.marginWidth = 0;
    tableParent.setLayout(gridLayout);
    parent.setTabList(new Control[] { tableParent, cTop });
    return tableParent;
}
Also used : BufferedLabel(com.biglybt.ui.swt.components.BufferedLabel) SelectionEvent(org.eclipse.swt.events.SelectionEvent) SelectionListener(org.eclipse.swt.events.SelectionListener) BubbleTextBox(com.biglybt.ui.swt.components.BubbleTextBox)

Aggregations

BubbleTextBox (com.biglybt.ui.swt.components.BubbleTextBox)1 BufferedLabel (com.biglybt.ui.swt.components.BufferedLabel)1 SelectionEvent (org.eclipse.swt.events.SelectionEvent)1 SelectionListener (org.eclipse.swt.events.SelectionListener)1