Search in sources :

Example 1 with ExpandAdapter

use of org.eclipse.swt.events.ExpandAdapter in project convertigo by convertigo.

the class ComponentExplorerComposite method initialize.

/**
 * This method initializes this
 */
protected void initialize() {
    setLayout(new GridLayout(3, true));
    GridData gridData;
    gridData = new GridData();
    gridData.horizontalAlignment = GridData.FILL;
    gridData.horizontalSpan = 3;
    gridData.grabExcessHorizontalSpace = true;
    gridData.verticalAlignment = GridData.BEGINNING;
    Composite searchComposite = new Composite(this, SWT.NONE);
    searchComposite.setLayoutData(gridData);
    searchComposite.setLayout(new GridLayout(3, false));
    CLabel searchLabel = new CLabel(searchComposite, SWT.NONE);
    searchLabel.setText("Search:");
    Text searchText = new Text(searchComposite, SWT.LEFT | SWT.BORDER | SWT.SINGLE);
    searchText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    searchText.setText("");
    searchText.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            search(searchText.getText());
        }
    });
    Button btnClear = new Button(searchComposite, SWT.NONE);
    btnClear.addSelectionListener(new SelectionListener() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            searchText.setText("");
            searchText.setFocus();
        }

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
            searchText.setText("");
            searchText.setFocus();
        }
    });
    btnClear.setText("Clear");
    gridData = new GridData();
    gridData.horizontalAlignment = SWT.FILL;
    gridData.grabExcessHorizontalSpace = true;
    gridData.horizontalSpan = 2;
    gridData.verticalAlignment = SWT.TOP;
    gridData.grabExcessVerticalSpace = true;
    scrolledComposite = new ScrolledComposite(this, SWT.V_SCROLL);
    scrolledComposite.setLayoutData(gridData);
    bar = new ExpandBar(scrolledComposite, SWT.NONE);
    bar.setSpacing(8);
    bar.addExpandListener(new ExpandAdapter() {

        @Override
        public void itemExpanded(ExpandEvent e) {
            refresh();
        }

        @Override
        public void itemCollapsed(ExpandEvent e) {
            refresh();
        }
    });
    scrolledComposite.setContent(bar);
    scrolledComposite.setExpandVertical(true);
    scrolledComposite.setExpandHorizontal(true);
    scrolledComposite.addControlListener(new ControlAdapter() {

        @Override
        public void controlResized(ControlEvent e) {
            refresh();
        }
    });
    helpBrowser = new C8oBrowser(this, SWT.MULTI | SWT.WRAP);
    helpBrowser.setUseExternalBrowser(true);
    gridData = new GridData();
    gridData.horizontalAlignment = GridData.FILL;
    gridData.verticalAlignment = GridData.FILL;
    gridData.grabExcessVerticalSpace = true;
    gridData.grabExcessHorizontalSpace = true;
    helpBrowser.setLayoutData(gridData);
    ComponentManager.refresh();
    getDisplay().asyncExec(() -> {
        search("");
    });
}
Also used : CLabel(org.eclipse.swt.custom.CLabel) ExpandBar(org.eclipse.swt.widgets.ExpandBar) Composite(org.eclipse.swt.widgets.Composite) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) ModifyListener(org.eclipse.swt.events.ModifyListener) ControlAdapter(org.eclipse.swt.events.ControlAdapter) C8oBrowser(com.twinsoft.convertigo.eclipse.swt.C8oBrowser) ExpandEvent(org.eclipse.swt.events.ExpandEvent) Text(org.eclipse.swt.widgets.Text) ExpandAdapter(org.eclipse.swt.events.ExpandAdapter) GridLayout(org.eclipse.swt.layout.GridLayout) ModifyEvent(org.eclipse.swt.events.ModifyEvent) Button(org.eclipse.swt.widgets.Button) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) ControlEvent(org.eclipse.swt.events.ControlEvent) SelectionListener(org.eclipse.swt.events.SelectionListener)

Example 2 with ExpandAdapter

use of org.eclipse.swt.events.ExpandAdapter in project convertigo by convertigo.

the class ComponentExplorerComposite method initialize.

/**
 * This method initializes this
 */
protected void initialize() {
    setLayout(new GridLayout(3, true));
    GridData gridData;
    gridData = new GridData();
    gridData.horizontalAlignment = GridData.FILL;
    gridData.horizontalSpan = 3;
    gridData.grabExcessHorizontalSpace = true;
    gridData.verticalAlignment = GridData.BEGINNING;
    Composite searchComposite = new Composite(this, SWT.NONE);
    searchComposite.setLayoutData(gridData);
    searchComposite.setLayout(new GridLayout(3, false));
    CLabel searchLabel = new CLabel(searchComposite, SWT.NONE);
    searchLabel.setText("Search:");
    Text searchText = new Text(searchComposite, SWT.LEFT | SWT.BORDER | SWT.SINGLE);
    searchText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    searchText.setText("");
    searchText.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            search(searchText.getText());
        }
    });
    Button btnClear = new Button(searchComposite, SWT.NONE);
    btnClear.addSelectionListener(new SelectionListener() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            searchText.setText("");
            searchText.setFocus();
        }

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
            searchText.setText("");
            searchText.setFocus();
        }
    });
    btnClear.setText("Clear");
    gridData = new GridData();
    gridData.horizontalAlignment = SWT.FILL;
    gridData.grabExcessHorizontalSpace = true;
    gridData.horizontalSpan = 2;
    gridData.verticalAlignment = SWT.TOP;
    gridData.grabExcessVerticalSpace = true;
    scrolledComposite = new ScrolledComposite(this, SWT.V_SCROLL);
    scrolledComposite.setLayoutData(gridData);
    bar = new ExpandBar(scrolledComposite, SWT.NONE);
    bar.setSpacing(8);
    bar.addExpandListener(new ExpandAdapter() {

        @Override
        public void itemExpanded(ExpandEvent e) {
            refresh();
        }

        @Override
        public void itemCollapsed(ExpandEvent e) {
            refresh();
        }
    });
    scrolledComposite.setContent(bar);
    scrolledComposite.setExpandVertical(true);
    scrolledComposite.setExpandHorizontal(true);
    scrolledComposite.addControlListener(new ControlAdapter() {

        @Override
        public void controlResized(ControlEvent e) {
            refresh();
        }
    });
    helpBrowser = new C8oBrowser(this, SWT.MULTI | SWT.WRAP);
    helpBrowser.setUseExternalBrowser(true);
    gridData = new GridData();
    gridData.horizontalAlignment = GridData.FILL;
    gridData.verticalAlignment = GridData.FILL;
    gridData.grabExcessVerticalSpace = true;
    gridData.grabExcessHorizontalSpace = true;
    helpBrowser.setLayoutData(gridData);
    ComponentManager.refresh();
    getDisplay().asyncExec(() -> {
        search("");
    });
}
Also used : CLabel(org.eclipse.swt.custom.CLabel) ExpandBar(org.eclipse.swt.widgets.ExpandBar) Composite(org.eclipse.swt.widgets.Composite) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) ModifyListener(org.eclipse.swt.events.ModifyListener) ControlAdapter(org.eclipse.swt.events.ControlAdapter) C8oBrowser(com.twinsoft.convertigo.eclipse.swt.C8oBrowser) ExpandEvent(org.eclipse.swt.events.ExpandEvent) Text(org.eclipse.swt.widgets.Text) ExpandAdapter(org.eclipse.swt.events.ExpandAdapter) GridLayout(org.eclipse.swt.layout.GridLayout) ModifyEvent(org.eclipse.swt.events.ModifyEvent) Button(org.eclipse.swt.widgets.Button) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) ControlEvent(org.eclipse.swt.events.ControlEvent) SelectionListener(org.eclipse.swt.events.SelectionListener)

Aggregations

C8oBrowser (com.twinsoft.convertigo.eclipse.swt.C8oBrowser)2 CLabel (org.eclipse.swt.custom.CLabel)2 ScrolledComposite (org.eclipse.swt.custom.ScrolledComposite)2 ControlAdapter (org.eclipse.swt.events.ControlAdapter)2 ControlEvent (org.eclipse.swt.events.ControlEvent)2 ExpandAdapter (org.eclipse.swt.events.ExpandAdapter)2 ExpandEvent (org.eclipse.swt.events.ExpandEvent)2 ModifyEvent (org.eclipse.swt.events.ModifyEvent)2 ModifyListener (org.eclipse.swt.events.ModifyListener)2 SelectionEvent (org.eclipse.swt.events.SelectionEvent)2 SelectionListener (org.eclipse.swt.events.SelectionListener)2 GridData (org.eclipse.swt.layout.GridData)2 GridLayout (org.eclipse.swt.layout.GridLayout)2 Button (org.eclipse.swt.widgets.Button)2 Composite (org.eclipse.swt.widgets.Composite)2 ExpandBar (org.eclipse.swt.widgets.ExpandBar)2 Text (org.eclipse.swt.widgets.Text)2