[Logo] Enterprise Client Community
  [Search] Search   [Recent Topics] Recent Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
Tooltips in Combobox do not Match Underlying Valid Value Items (Swing Client)  XML
Forum Index -> Development
Author Message
unger

Power User

Joined: 22/07/2008 05:19:28
Messages: 261
Offline

Hi,

I have some code that "shuffles" the tooltips of a combobox inside a grid. The tooltip that is shown doesn't match the underlying valid value item.


Code:
 package managedbeans;
 
 import java.io.Serializable;
 
 import org.eclnt.editor.annotations.CCGenClass;
 import org.eclnt.jsfserver.elements.impl.FIXGRIDItem;
 import org.eclnt.jsfserver.elements.impl.FIXGRIDListBinding;
 import org.eclnt.jsfserver.elements.util.ValidValuesBinding;
 import org.eclnt.jsfserver.pagebean.PageBean;
 
 @CCGenClass(expressionBase = "#{d.TestComboMBean}")
 public class TestComboMBean extends PageBean implements Serializable {
 
 	public class GridItem extends FIXGRIDItem implements java.io.Serializable {
 		ValidValuesBinding validValues = new ValidValuesBinding();
 
 		public void onRowSelect() {
 		}
 
 		public void onRowExecute() {
 		}
 
 		public void calcVV() {
 			long l = System.currentTimeMillis();
 			validValues.addValidValue("" + l + 12, "" + l + 12 + "                                        " + l + 12);
 			validValues.addValidValue("" + l + 1, "" + l + 1 + "                                        " + l + 1);
 			validValues.addValidValue("" + l + 2, "" + l + 2 + "                                        " + l + 2);
 		}
 
 		public ValidValuesBinding getValidValues() {
 			return validValues;
 		}
 	}
 
 	FIXGRIDListBinding<GridItem> m_grid = new FIXGRIDListBinding<GridItem>();
 
 	String m_selectedValue;
 
 	// ------------------------------------------------------------------------
 	// inner classes
 	// ------------------------------------------------------------------------
 
 	/* Listener to the user of the page bean. */
 	public interface IListener {
 	}
 
 	// ------------------------------------------------------------------------
 	// members
 	// ------------------------------------------------------------------------
 
 	private IListener m_listener;
 
 	// ------------------------------------------------------------------------
 	// constructors & initialization
 	// ------------------------------------------------------------------------
 
 	public TestComboMBean() {
 		for (int i = 0; i < 100; i++) {
 			GridItem gi = new GridItem();
 			m_grid.getItems().add(gi);
 		}
 
 		for (GridItem gi : m_grid.getItems()) {
 			gi.calcVV();
 		}
 	}
 
 	public String getPageName() {
 		return "/testCombo.jsp";
 	}
 
 	public String getRootExpressionUsedInPage() {
 		return "#{d.TestComboMBean}";
 	}
 
 	// ------------------------------------------------------------------------
 	// public usage
 	// ------------------------------------------------------------------------
 
 	/* Initialization of the bean. Add any parameter that is required within your scenario. */
 	public void prepare(IListener listener) {
 		m_listener = listener;
 	}
 
 	// ------------------------------------------------------------------------
 	// private usage
 	// ------------------------------------------------------------------------
 	public String getSelectedValue() {
 		return m_selectedValue;
 	}
 
 	public void setSelectedValue(String value) {
 		this.m_selectedValue = value;
 	}
 
 	public FIXGRIDListBinding<GridItem> getGrid() {
 		return m_grid;
 	}
 
 }
 




Code:
 <%@page contentType="text/html"%>
 <%@page pageEncoding="UTF-8"%>
 
 <%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
 <%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
 
 <%@taglib prefix="t" uri="/WEB-INF/eclnt"%>
 
 
 <!-- ========== CONTENT BEGIN ========== -->
 <f:view>
 <h:form>
 <f:subview id="testCombog_sv">
 <t:rowtitlebar id="g_1" />
 <t:rowheader id="g_2" />
 <t:rowbodypane id="g_3" >
 <t:row id="g_4" >
 <t:fixgrid id="g_5" objectbinding="#{d.TestComboMBean.grid}" width="120" >
 <t:gridcol id="g_6" text="Combo" width="100%" >
 <t:combobox id="g_7" drawoddevenrows="true" tooltip="12" validvaluesbinding=".{validValues}" width="100%" />
 </t:gridcol>
 </t:fixgrid>
 </t:row>
 </t:rowbodypane>
 <t:rowstatusbar id="g_8" />
 <t:pageaddons id="g_pa"/>
 </f:subview>
 </h:form>
 </f:view>
 <!-- ========== CONTENT END ========== -->
 


https://www.dropbox.com/s/nw0c48z9roc8afq/ShuffleTooltip.JPG?dl=0

https://www.dropbox.com/s/qehp7zqjnsnchbf/ShuffleTooltip2.JPG?dl=0

https://www.dropbox.com/s/rjh91bdv70jzwcl/ShuffleTooltip3.JPG?dl=0

How can I avoid this?

Regards,

Joachim

CaptainCasa

Power User
[Avatar]

Joined: 21/11/2007 12:23:06
Messages: 5518
Online

Hi,

the COMBOBOX has a TOOLTIP attribute (which you do not use).
The ValidValuesBinding has a comment-property - and the comment is shown in case there is a 2-line.display of value items.

Why should both be connected??? If you want the tooltip to show the comment, then just do it in your code! ;-)

Regards, Björn

PS: maybe you mean something different - then please re-invoke me...

Björn Müller, CaptainCasa GmbH
unger

Power User

Joined: 22/07/2008 05:19:28
Messages: 261
Offline

Hi Björn,

in our case the popup shows items with very long text information. When they do not fit in the popup's length the tooltip is shown automatically (without use of the tooltip attribute).

It is critical that any item is selected for display and not that one under the mouse pointer.

In case of items starting with the same text the user will pick the wrong item.

'|' marks the cut:

starting long text information|1
starting long text information|2 <= tootip shows "starting long text information1"
starting long text information|3


The user will pick the second item and gets the unwanted "starting long text information2" in the combo text field.

Regards,
Joachim
unger

Power User

Joined: 22/07/2008 05:19:28
Messages: 261
Offline

Hi Björn,

finally I found the cause: The attribute drawoddevenrows produces this bug in the tooltip logic.

Regards,
Joachim
[Thumb - withDrawOddEven.jpg]
 Filename withDrawOddEven.jpg [Disk] Download
 Description
 Filesize 48 Kbytes
 Downloaded:  5902 time(s)

[Thumb - withoutOddEven.jpg]
 Filename withoutOddEven.jpg [Disk] Download
 Description
 Filesize 49 Kbytes
 Downloaded:  5950 time(s)

 
Forum Index -> Development
Go to:   
Powered by JForum 2.1.6 © JForum Team