voyent
Messages posted by: jmind  XML
Profile for jmind -> Messages posted by jmind [54] Go to Page: 1, 2, 3, 4 Next 
Author Message
Is there a way to know the real dimension of a component from code? With real i mean the actual dimension of the component, that could differ from the dimension declared in the attributes. For example, suppose i have a component like this: <ice:somecomponent width="50%" height="100%" />
is there a way to get the real size the component gets when it is rendered? I know how to that with prototype. How can i do that from java?
many thanks!
I want to set the value expression for an HtmlInputText and i found the method above (see title). Unfortunately i haven't found the documentation for this method (nor in j2ee docs not in icefaces docs). I was wondering what the first argument stands for.
Having created a ValueExpression this way:

Code:
ValueExpression exp = factory.createValueExpression(eLContext, "#{managedBean.someProperty}", <SomePropertyType>.class);

with factory being an instance of ExpressionFactory (obtained from Application) and eLContext the result of invoking getELContext() on an instance of FacesContext.

So, now i would like to do this (assuming inputText is an instance of com.icesoft.faces.component.ext.HtmlInputText):

Code:
inputText.setValueExpression("???", exp);


but what have i to replace to the question marks?

regards ;)

mark.collette wrote:
If you have no input fields in the same form as the inputFile component, it should have no side-effects to set submitOnUpload="postUpload" on the inputFile component. This will cause the page to refresh after the file upload. 


submitOnUpload="postUpload" worked for me. thanks
When i upload a file the page won't refresh. I have to manually refresh the page with the F5 button. If i set com.icesoft.faces.synchronousUpdate to false then the page is refreshed as desired, but i need to keep that param set to true because of the Network Connection Interrupted message which would pop up too often.

Any suggestion will be appreciated

regards

michelle2 wrote:

jmind wrote:

michelle2 wrote:

jmind wrote:

michelle2 wrote:

jmind wrote:

michelle2 wrote:
put a valuechangeListener in filesGroubRecordBean and get its index like this.

I'm assuming you have a situation where filesGroupRecordBean is contained in a list of fileGroupRecordBeans , GroupList in the session
then to get the index do this.


final int index = sessionBean.getGroupList().indexOf(this); 


there's a way to obtain the index without iterating twice (see indexOf) on the list?  


well you could pass the bean using propertyactionlistener if thats what your getting at, but this seems to be more flexiable.

And I don't see what you mean by iterating twice. indexOf is giving me an index relative to 0. 


i thought indexOf(), in order to find the index of the item we want, was going to iterate on the list. If that is not the case forget my previous question

this is confirmed by the docs of indexOf:

Returns the index of the first occurrence of the specified element in this list, or -1 if this list does not contain the element. More formally, returns the lowest index i such that (o==null ? get(i)==null : o.equals(get(i))), or -1 if there is no such index

the call to get(i) makes me think to an iteration. So, it looks like your code iterates over the list for each row in the dataTable. N square operation 


Still not following sorry


if I have a list of 3 serialized beans


0) groupbean001
1) groupbean002
2) groupbean003


and the value of "THIS" = groupbean002

i = 1 not 0




than the value of indexOF(groupbean002) = 1


Maybe internally its doing an iteraction , but I doubt thats the case.

 

if i'm on my jsp, and i'm using a dataTable, and i want to know which row index i'm reading (that is not possible with icefaces), i could add an giveMeObjectIndex() method to my object let's say, that is just a call to myList.indexOf(). But in that case it would mean iterating (under the covers) over the list once per row (each time indexOf is called). I was thinking about that. But if you intend to call indexOf() only later then this problem does not apply.

Code:
 <ice:dataTable value="#{myList}" var="myVar">
     <ice:column>
         ... header ...
         <ice:outputText value="#{myVar.index}" /> <!-- index is a call to myList.indexOf(myVar) -->
     </ice:column>
 </ice:dataTable
 


in this case i think it wouldn't be a very efficient operation (i need to do something like that). Hope i cleared what i was trying to say. So I was asking if there's another way to get the row index without having to call indexOf for every row. 


first of all the reference to get(i) refers to java 2 get(Object) which is a direct reference within a keyed collection.

If you set up your list the way I explained and the way the icefaces tutorial states than you are not iterating twice over anything.

However it sounds like your usecase is quite different. You may want to look at using an icefaces rowSelector as that will track whatever row your on.

The usecase both icefaces and I are implying is such.

1) user is on a single row of a table.
2) user clicks an expand/contract button
3) upon clicking the button the expanded table is added at the current index.
4) no other indexes of any other rows are considered.


If you need every index between 0..n than you may not want to use the above techniques. 


ok, we are clear now :) i was thinking about my own case forgetting about the original post, hence the misunderstanding. I hope i didn't upset you. In any case here are my apologize and my thanks for the explanation :)

michelle2 wrote:

jmind wrote:

michelle2 wrote:

jmind wrote:

michelle2 wrote:
put a valuechangeListener in filesGroubRecordBean and get its index like this.

I'm assuming you have a situation where filesGroupRecordBean is contained in a list of fileGroupRecordBeans , GroupList in the session
then to get the index do this.


final int index = sessionBean.getGroupList().indexOf(this); 


there's a way to obtain the index without iterating twice (see indexOf) on the list?  


well you could pass the bean using propertyactionlistener if thats what your getting at, but this seems to be more flexiable.

And I don't see what you mean by iterating twice. indexOf is giving me an index relative to 0. 


i thought indexOf(), in order to find the index of the item we want, was going to iterate on the list. If that is not the case forget my previous question

this is confirmed by the docs of indexOf:

Returns the index of the first occurrence of the specified element in this list, or -1 if this list does not contain the element. More formally, returns the lowest index i such that (o==null ? get(i)==null : o.equals(get(i))), or -1 if there is no such index

the call to get(i) makes me think to an iteration. So, it looks like your code iterates over the list for each row in the dataTable. N square operation 


Still not following sorry


if I have a list of 3 serialized beans


0) groupbean001
1) groupbean002
2) groupbean003


and the value of "THIS" = groupbean002

i = 1 not 0




than the value of indexOF(groupbean002) = 1


Maybe internally its doing an iteraction , but I doubt thats the case.

 

if i'm on my jsp, and i'm using a dataTable, and i want to know which row index i'm reading (that is not possible with icefaces), i could add an giveMeObjectIndex() method to my object let's say, that is just a call to myList.indexOf(). But in that case it would mean iterating (under the covers) over the list once per row (each time indexOf is called). I was thinking about that. But if you intend to call indexOf() only later then this problem does not apply.

Code:
 <ice:dataTable value="#{myList}" var="myVar">
     <ice:column>
         ... header ...
         <ice:outputText value="#{myVar.index}" /> <!-- index is a call to myList.indexOf(myVar) -->
     </ice:column>
 </ice:dataTable
 


in this case i think it wouldn't be a very efficient operation (i need to do something like that). Hope i cleared what i was trying to say. So I was asking if there's another way to get the row index without having to call indexOf for every row.

michelle2 wrote:

jmind wrote:

michelle2 wrote:
put a valuechangeListener in filesGroubRecordBean and get its index like this.

I'm assuming you have a situation where filesGroupRecordBean is contained in a list of fileGroupRecordBeans , GroupList in the session
then to get the index do this.


final int index = sessionBean.getGroupList().indexOf(this); 


there's a way to obtain the index without iterating twice (see indexOf) on the list?  


well you could pass the bean using propertyactionlistener if thats what your getting at, but this seems to be more flexiable.

And I don't see what you mean by iterating twice. indexOf is giving me an index relative to 0. 


i thought indexOf(), in order to find the index of the item we want, was going to iterate on the list. If that is not the case forget my previous question

this is confirmed by the docs of indexOf:

Returns the index of the first occurrence of the specified element in this list, or -1 if this list does not contain the element. More formally, returns the lowest index i such that (o==null ? get(i)==null : o.equals(get(i))), or -1 if there is no such index

the call to get(i) makes me think to an iteration. So, it looks like your code iterates over the list for each row in the dataTable. N square operation

michelle2 wrote:
put a valuechangeListener in filesGroubRecordBean and get its index like this.

I'm assuming you have a situation where filesGroupRecordBean is contained in a list of fileGroupRecordBeans , GroupList in the session
then to get the index do this.


final int index = sessionBean.getGroupList().indexOf(this); 


there's a way to obtain the index without iterating twice (see indexOf) on the list?
i tried to pass an HashSet as the value to a dataTable and that caused an exception to be thrown. Why dataTable is not able to iterate over a Set?
why during DragEvent.DRAGGING the dragValue is always null? How can i know which item the user is dragging?
can I use the dataPaginator with panelSeries for example? Or any other custom UIData component?
many thanks! i'll work on that
from the site i didn't understand how it works. Can you post some sample code?

Thanks
i have loads of paginators on the same page with no problem. just give each one a unique id
 
Profile for jmind -> Messages posted by jmind [54] Go to Page: 1, 2, 3, 4 Next 
Go to:   
Powered by JForum 2.1.7ice © JForum Team