We're trying to put 3 tables in the same page with some kind of synchronized pagination. Because of the "paginator" property in ace:datatable is individual for each table, we're using some commandLinks to implement the functionality of moving forward and backward.
We've tried with de "page" property in the tables, linked all of them to a property in the backing-bean that is incremented or decremented with the commandLink's action method. But this "page" property only works when "paginator" property is set to true. And because we don't want to show paginator itself (with numbered pages, an buttons and everything else), we can't use this property.
We've tried too with the "first" property of the ace:datatable, and again binding this property to the backing-bean. But it doesn't do anything: when we change this property's value, the tables remain in the same position of the list that populates them.
We're populating the table with a personalized ArrayList (where is a class that matches a table in the database). And only got the thing work when enabling paginator in the tables and used "page" property.
And we've used a Datamodel object too, but with no positive results.
So, what does "first" property of ace:datatable serving for? (Please, don't tell me the API definition of this property, I've read it many times ;) ). One colleague says that he made it work when he used an ice:datatable, instead of the ACE one.
Does anyone know a better solution to implement this scenario (3 datatables with the same pagination, so when yo click to "move forward", all of them move to the same position)?
Thanks in advance.
Update: I've received response through the IceSoft forum. nils.lundquist says:
The cause of this issue appears to have been some legacy pagination code in the library that the ace:dataTable was forked from. It isn't recognizable as part of our features, so I've corrected the issue and, assuming testing goes well, the fix will appear in our coming release (beta also).
Note that first still won't have an effect when component controlled pagination is enabled, and I've adjusted the TLD to reflect this. First will now actually work when pagination is disabled.
Referring to iceFaces 3.1.0 beta02, releasing this week.
If anyone knows a better way to solve this case (3 dataTables with pagination linked) any help will be apreciated.
TIA.
Solved with the upgrade to IceFaces 3.1.0
Related
So the issue is that I'm getting a runtime error about checkboxes generated inside a file tree needing to be inside a form element. Thing is, it is inside a form element but the form element is wrapped around the tree like so:
<t:Form t:id="form>
<t:Tree t:id="tree" model="model" node="node">
<p:label>
${node.label}
<t:Checkbox value="checkboxNode.selected" />
</p:label>
</t:Tree>
</t:Form>
The root level of nodes generate the checkboxes without issue. However, when I select the plus to expand the tree branch it throws the error for the branch checkboxes. This goes away if I refresh the page and it remembers which branches are expanded. If I go to expand more, then it throws the error again. The same thing happens if I minimize a branch and then expand it again.
I suspect this has to do with how expanding the tree generates its fields using an AJAX call and it not being able to detect the form wrapped on the outside. Two possible work around I've thought of are:
Default the nodes as expanded and disable the minimizing functionality. I lose out on one of the interaction and organization advantages of a file tree doing this though.
Put a form inside the label. This creates a lot of unnecessary extra forms though and I'm not quite sure how to consolidate this into the end goal of creating a list of groups to send emails out to based on the selected labels.
Anyone here have any insight about a better work around for this issue or maybe a way to tell the generated checkboxes to recognize the outer form without needing to reload the page?
Ended up using a different route. The issue I ran into with the checkboxes that was a deal breaker was I couldn't think of a way to tell the booleans on the server side to update based on the client side's checkboxes.
The reason for that was that the booleans were generated based on need instead of being a fixed set on the Java side of the page. Tried a work around by linking unique IDs to the booleans on the server side, but even then I could not determine a way to associate those IDs to the checkboxes on the client side.
So instead I went with eventlinks, which can take a context. I just passed in the generated tree node IDs as a context, which could search for the node in the eventlink and be added to a "selected" list on the server.
As JavaDoc for the Tree component states:
Tree is not a form control component...
Have a look at the source code of AjaxFormLoop and the way it handles AJAX form updates, I believe you need to build a custom component for your needs.
I'm rather unexperienced in GWT, and I have large codebase with working project in this technology. My task refers to assigning id's to html elements witch will be used in automatic testing. We can't use some dynamically assigned id's because in automatic test we have to specify exact values of id's. My way for now was to use method ensureDebug(id), written by hand in code for specific elements.
I think that doing it this way mean that code will be more spaghetti-like, with mixed ensureDebug(id) methods usages there and here. I was thinking if there is any way of doing it that will be more manageable and cleaner than current. Is is maybe possible to use AOP? (I have never used AOP, so I don't know if it is any good idea, or possible in GWT) Or maybe other way than using ensureDebug?
You also can set the IDs for HTML elements like
element.setId("myId");
But this is as much spaghetti like as your approach adding the IDs in the code.
Another possibility would be to use an UiBinder and set the id there. With this approach you have all your ui elements of one view, which should have an id, at one place. With bootstrap for example it would look like this:
<b:TextBox ui:field="searchTextBox" b:id="search-text-box"/>
Like this you can access the field in your view-class via searchTextBox and the id search-text-boxis added to the HTML element (which you could also use for styling etc.)
We have faced same issue for our project while adding test automation. As per my knowledge unfortunately GWT doesn't support anything like AOP yet. So we have to follow any of the spaghetti-like approach only from one mentioned above by #mxlse or the one you are already following.
Based on my experience I can recommend you to create separate constant/property at client or server end. Use this file to save all your id's which you can share latter on with test team as well.
I could do with some help once again...
We built our own forms in XPages. Forms are defined by a user in Notes, and they are used through XPages/web. We added several managed beans to get more grip on the data used by the page and controls that are on it. The whole thing is heavily nested, the form control can be used more than once on a page, repeat controls are used as well, and now I need to partially refresh a panel.
Some of the code:
<xp:panel id="ccAnyForm">
<xp:this.dataContexts>
<xp:dataContext var="formulaire">
<xp:this.value><![CDATA[#{javascript:compositeData.formName || compositeData.dataSource.getItemValueString("Formulaire")}]]></xp:this.value>
</xp:dataContext>
<xp:dataContext var="formdata">
<xp:this.value><![CDATA[#{javascript:PageData.getForm(formulaire, compositeData.dataSource)}]]></xp:this.value>
</xp:dataContext>
</xp:this.dataContexts>
<xp:panel id="aFormulaire${javascript:compositeData.name}">
<xe:switchFacet id="switchFacet1">
<xe:this.selectedFacet><![CDATA[#{javascript:formdata.isTabbed()? "tabbed": "flat"}]]></xe:this.selectedFacet>
PageData is a Java bean, and I lose formdata when doing a partial refresh. If I set partial execution mode in the EventHandler (data validation is disabled), I get the error that says formdata not found on the last line of the snippet. If I clear partial execution mode, I get nothing at all: no error, no Java error, no SSJS error, nothing.
It must be my lack of understanding the life-cycle of objects and variables, for I prbably have to use ValueBindings or so, but I don't know how.
Help...
I've seen dataContexts recalculate as null, particularly when dependent on other dataContexts. I think in Apply Request Values phase. When I had that I changed the code to only calculate in Render Response phase.
However, I don't think that work for you, because the Switch control will need the value before Render Response, and there's no easy way to get hold of which other phase is running.
The approach I'd take is to have a property in your bean (e.g. showTabbed) that holds which Switch facet to show. Call a bean method to set that property on page load. Then in your partial refresh, call the method again, checking whether the Formulaire field has changed to determine whether or not to call setShowTabbed(boolean) again. That will minimise the number of calls even more and should prevent the problem.
I have restricted some pages like admin pages from not getting visible in search results.Using the below code
map.put("group.1_group.1_property","**jcr:content/cq:template**");
map.put("group.1_group.1_property.1_value","**/apps/MyApp/templates/SampleTemplate**");
map.put("group.1_group.1_property.and","true");
map.put("group.1_group.1_property.operation","unequals");
final Query finalQuery = builder.createQuery(PredicateGroup.create(map),
session);
which means it is template specific search filtration,means that Im telling the query builder not to display those pages having the above specified template .However the drawback is that, in future if we want to restrict more pages, those pages also must be mapped to the above template. So instead of specifying the template in the map, can we put any other property in the map, so that search restriction is not template specific.
Thanks,
Balaji
What other properties do your pages have available (specifically, the admin pages)? For example, if you have a specific property that you add to your admin pages, or other pages that you could sort on, that could work. On one site I worked on, we had a property we put into certain content items called hideInNav. So along those lines, this is how I would do it:
map.put("group.1_group.1_property","jcr:content/hideInNav");
map.put("group.1_group.1_property.1_value","/content/somepath/you/want");
map.put("group.1_group.1_property.and","true");
map.put("group.1_group.1_property.operation","unequals");
I hope that helps to make sense of it. Am I understanding it correctly? If not, please clarify and I'll try to help more.
---------------EDIT-----------------------
If you don't have a custom property, but you know the path these pages are located, and maybe a default property they all have in common (like a jcr:title), you could try doing that instead. Like this:
map.put(1_group.0_path","/content/yoursite");
map.put(2_group.0_type","cq:Page");
map.put(3_group.fulltext","test text");
map.put(3_group.fulltext.relPath","jcr:content/#jcr:title");
You can see how this would run on a local query debugger when you have CQ running:
http://localhost:4502/libs/cq/search/content/querydebug.html?_charset_=UTF-8&query=http%3A%2F%2Flocalhost%3A4502%2Fcontent%2Fsalesportal%2Fen%2Fmobile%2Fresources.assets.get.json%3Fp.limit%3D7%0D%0A1_group.0_path%3D%2Fcontent%2Fyoursite%0D%0A2_group.0_type%3Dcq%3APage%0D%0A3_group.fulltext%3Dtest+text%0D%0A3_group.fulltext.relPath%3Djcr%3Acontent%2F%40jcr%3Atitle
Hopefully that's more helpful.
EDIT #2
This is a summary of both my answers, and will hopefully answer your last comment as well.
In order to more fully answer your question (since you're still not quite getting what you want), I dug a little deeper to find the information you need. Just as a reference, any time you're doing XPath querying, this is a great tool to look at: JCR Query Usecases - jboss
Anyway, you said that you were getting results that didn't include items that were missing the 'hideInNav' property. Here is how you can get those results, specifically:
map.put("1_group.0_path","/content/yoursite");
map.put("2_group.0_type","cq:Page");
map.put("3_group.1_property","jcr:content/hideInNav");
map.put("3_group.1_property.1_value","not");
map.put("3_group.1_property.operation","not");
This way, you're searching in the path you want, getting the type of result you want (cq:Page, if that is what you're actually looking for), and you're getting the results that DO NOT HAVE the property 'hideInNav'.
I am writing some UI persistence methods for an application. I'm trying to expand to a JXTable with a fixed set of N columns in the table model.
How can I get and set the following information for column #k in the JXTable, where k is the column number in table model order? It's not as easy as it sounds, or at least I'm missing some tricky bit of information.
column width
column visibility
column order
TableColumnModelExt.getColumns() includes this crazy note, which I'm having trouble parsing:
java.util.List<javax.swing.table.TableColumn> getColumns(boolean includeHidden)
Returns a List of contained TableColumns. Includes or excludes invisible columns, depending on whether the includeHidden is true or false, respectively. If false, an Iterator over the List is equivalent to the Enumeration returned by getColumns().
NOTE: the order of columns in the List depends on whether or not the invisible columns are included, in the former case it's the insertion order in the latter it's the current order of the visible columns.
Also, I know how to use JTable.convertColumnIndexToView(), but it returns -1 for hidden columns, and leaves no information about which order the hidden column would go if it were made visible again. JXTable knows this information because you can restore column visibility, and it puts the column where it was before it was hidden.
If I understand you correctly, you are after the view column index a hidden column would have if made visible again. That's not directly supported.
For saving/restoring purposes, there's a class XProperties (not officially supported, but working smoothly) doing so in the context of AppFramework which might give you an idea of how to do it.
Edit
To get a TableColumn by modelIndex, get all columns, loop and compare the modelIndex. Some pseudo-code in a pseudo method getColumnFor(modelIndex):
List allColumns = table.getColumns(true);
forEach {
if (column.getModelIndex() == modelIndex) {
return column;
}
return null;
Consider using the Swing Application Framework (JSR-296)
Although this project is now dead AFAIK, I think it's a better starting point than implementing this feature from scratch. (It's Open Source.)
If you're building your application on top of the NetBeans Platform (which I highly recommend), then have a look at my blog on how to use these two frameworks together:
http://puces-blog.blogspot.com/2009/04/netbeans-platform-meets-swing.html
Note: There is also the Better Swing Application Framework
The Better Swing Application Framework is a fork of the original Swing Application Framework (appframework) reference implementation of JSR 296. Since August 2009, the original Swing Application Framework project has been on hold, and therefore this fork was created to carry on the work until the original project resumes.
I don't know much about this, but it might be even a better starting point.