Bug 445464 - ContentProposalAdapter proposals popup stays visible if Combo is used as a control
Summary: ContentProposalAdapter proposals popup stays visible if Combo is used as a co...
Status: ASSIGNED
Alias: None
Product: RAP
Classification: RT
Component: JFace (show other bugs)
Version: 2.3   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-09-30 05:24 EDT by sabrina dieroff CLA
Modified: 2014-10-08 04:55 EDT (History)
1 user (show)

See Also:


Attachments
Pictures (28.37 KB, application/pdf)
2014-09-30 05:24 EDT, sabrina dieroff CLA
no flags Details
DemoPreferencePage.java (3.73 KB, text/plain)
2014-10-06 05:33 EDT, sabrina dieroff CLA
no flags Details
Example (96.05 KB, image/jpeg)
2014-10-06 05:44 EDT, sabrina dieroff CLA
no flags Details
Example AutoSuggest (61.99 KB, application/pdf)
2014-10-08 04:55 EDT, sabrina dieroff CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description sabrina dieroff CLA 2014-09-30 05:24:40 EDT
Created attachment 247474 [details]
Pictures

RAP Version: 2.0 + 2.3 (two different applications)
Browser: Internet Explorer 10

Fields:
Combo cboManufacturer;
AutoCompleteField cboManufacturerAutoComplete;

In this case it’s possible to select the content from a list via mouse (no issue, no wrong display) or using the keyboard and entered it into a combo field. 

This creates either a new entry into the list or the content is found and taken over by the automatic text search (AutoCompleteField).

Afterwards the content will be saved.
The issue only happens if we take the keyboard.

See attached Pictures! 

The wrong display appears after a new entry via keyboard was created or selected from the list and saved. 

Even if the form will be changed the wrong window will be shown. 

Code examples:

1.	Create fields:
private void createFormControlsMould(Composite parent) {
cboManufacturer = AbstractTestRunFormPart.createCombo( result );
cboManufacturerAutoComplete = new AutoCompleteField( cboManufacturer, new ComboContentAdapter(), ModelProvider.getInstance().getTestRunMouldManufacturer() );
}

2.	Set data:
public void setData( Object dataObject ) {
   input = ( TestRun )dataObject;
cboManufacturer.setItems(        ModelProvider.getInstance().getTestRunMouldManufacturer() );
   cboManufacturer.setText( input.getMouldManufacturer() );
   cboManufacturerAutoComplete.setProposals( cboManufacturer.getItems() );
}

3.	Save:
public void save() {
    	String manufacturer = cboManufacturer.getText();
    	if( manufacturer != null ) {
      	this.input.setMouldManufacturer( manufacturer );
    	} else {
      	this.input.setMouldManufacturer( "" ); //$NON-NLS-1$
    	}
	}
Comment 1 Ivan Furnadjiev CLA 2014-09-30 05:42:54 EDT
Please create a complete self-running snippet (project) to reproduce the issue.
Comment 2 sabrina dieroff CLA 2014-10-06 05:33:05 EDT
Created attachment 247638 [details]
DemoPreferencePage.java
Comment 3 sabrina dieroff CLA 2014-10-06 05:34:05 EDT
Now we've right a complete self-running snippet within the RAP Workbench Demo.

We only have changed the class "DemoPreferencePage.java".

The adapted class is attached. 

To get the bug, select within the tool-bar: Window->Preferences.

Now select an entry from the list in the "ARBURG Test" field by Keyboard!
Afterwards push the button "setData". Now the selection within the Combo box is still on the Screen.
Comment 4 sabrina dieroff CLA 2014-10-06 05:44:25 EDT
Created attachment 247640 [details]
Example
Comment 5 sabrina dieroff CLA 2014-10-06 05:51:23 EDT

(In reply to Ivan Furnadjiev from comment #1)
> Please create a complete self-running snippet (project) to reproduce the
> issue.

the code snippet is now attached
Comment 6 Ivan Furnadjiev CLA 2014-10-06 06:00:58 EDT
Which RAP version are you using? Is it reproducible for you with external browser like Firefox or Chrome (browser used in the "example" is the internal Eclipse browser)? I can't reproduce it with Firefox 32.0.3, Chrome 37, IE11 and Opera 24 with RAP from master on Windows 7 x64 SP1.
Comment 7 sabrina dieroff CLA 2014-10-07 03:41:03 EDT
(In reply to Ivan Furnadjiev from comment #6)
> Which RAP version are you using? Is it reproducible for you with external
> browser like Firefox or Chrome (browser used in the "example" is the
> internal Eclipse browser)? I can't reproduce it with Firefox 32.0.3, Chrome
> 37, IE11 and Opera 24 with RAP from master on Windows 7 x64 SP1.


We are using RAP 2.3. We only have installed Eclipse Luna Service Release 1 (4.4.1) and the actual RAP Workbench Demo Project: "org.eclipse.rap.demo". 
The Browser doesn't matter. We get the bug with Firefox 32.0.3, IE10 and internal Eclipse browser. 
OS: Windows 7 x64 SP1 ( + Windows 7 32bit)

In our example (offical RAP Workbench Demo) we have nothing changed exept the class "DemoPreferencePage" in the package "org.eclipse.rap.demo.presentation". 

Procedure: 
Use the mouse to open the selection of fields. Now use the keyboard!
Select with the arrow keys, for example, "demoPresentation" and accept the selection with "Enter". 

Afterwards click with the mouse on the button "setData".

Important: If everything is done with the mouse, the bug does not happen. The error only occurs when the selection is done via keyboard and press enter.
Comment 8 Ivan Furnadjiev CLA 2014-10-07 03:46:05 EDT
Thanks for detailed steps to reproduce the issue. Now I can reproduce it with current RAP master.
Comment 9 Ivan Furnadjiev CLA 2014-10-07 03:58:13 EDT
Wait... this is not the Combo list which stays visible.... it is the AutoCompleteField (ContentProposalAdapter). You construct AutoCompleteField with Combo as a control??!!! ContentProposalAdapter is heavily rely on key events. What functionality you want to achive? Maybe the RAP DropDown widget (or incubator AutoSuggest) could be used instead.
Comment 10 Ivan Furnadjiev CLA 2014-10-07 04:25:17 EDT
BTW ... the auto complete list is triggered by cboTest.setText(cboTest.getText());. What is the purpose of this code?
Comment 11 sabrina dieroff CLA 2014-10-07 04:27:24 EDT
(In reply to Ivan Furnadjiev from comment #9)
> Wait... this is not the Combo list which stays visible.... it is the
> AutoCompleteField (ContentProposalAdapter). You construct AutoCompleteField
> with Combo as a control??!!! ContentProposalAdapter is heavily rely on key
> events. What functionality you want to achive? Maybe the RAP DropDown widget
> (or incubator AutoSuggest) could be used instead.

The box should contain two functionalities.
First combo functionality: unfolding a list, select the content with mouse or keyboard, takeover of the content of the field.
Second Autocomplete functionality: not open the list, direct input from the keyboard.
Comment 12 Ivan Furnadjiev CLA 2014-10-07 04:35:06 EDT
(In reply to comment #10)
> BTW ... the auto complete list is triggered by
> cboTest.setText(cboTest.getText());. What is the purpose of this code?
There is a modify listener attached to the combo in ContentProposalAdapter (line 1895), which auto activate the proposal list ( autoActivateString is null ).
Comment 13 sabrina dieroff CLA 2014-10-07 04:46:17 EDT
(In reply to Ivan Furnadjiev from comment #10)
> BTW ... the auto complete list is triggered by
> cboTest.setText(cboTest.getText());. What is the purpose of this code?

In the example, the point was "simplified" and ensures that the selected content is displayed and the field is not "empty".

In our application, a value is set from the data model at this point.
For example: cboTest.setText (input.getCoordinator ());
Comment 14 Ivan Furnadjiev CLA 2014-10-07 04:58:02 EDT
...but in this case the visible auto complete list is expected. You modify the text in the Combo and the list become visible, because of ContentProposalAdapter control modify listener.
Comment 15 Ivan Furnadjiev CLA 2014-10-07 05:04:31 EDT
If single sourcing with RCP is not important, you should give the DropDown widget (or incubator AutoSuggest) a try. In any case it will work better than ContentProposalAdapter (AutoCompleteField). As I already said, JFace ContentProposalAdapter relies on key events, which will trigger a lot of network traffic.
Comment 16 sabrina dieroff CLA 2014-10-08 04:54:33 EDT
We tried it with an AutoSuggest field.
Unfortunately, this does not provide the desired functionality of us.
We need the ability to open a list by dropDown (Combo).
Furthermore, the selected value is not taken by Enter key only by tab or mouse.
I have attached our expamle (code and ui).
Comment 17 sabrina dieroff CLA 2014-10-08 04:55:30 EDT
Created attachment 247710 [details]
Example AutoSuggest