Is there any Java library that supports hierarchical column?
For example (the first three row are columns) :
------------------------------------------------
2008 |
------------------------------------------------
January | February |
------------------------------------------------
Week1 | Week2 | Week3 | Week 1 | Week2 | Week3 |
------------------------------------------------
10 | 20 | 14 | 12 | 15 | 3 |
------------------------------------------------
May be a JXTree from SwingLab could approach what you are looking for.
Illustration here, from the Swingx project
http://avatar21.superihost.com/images/JXTableJXTreeTable.png
Infragistics WebGrid for JSF:
alt text http://www.infragistics.com/uploadedImages/Products/NetAdvantage_for_JSF/Features/WebGrid/Gallery/WebGrid_Hierarchical.png
Thanks for your answers. Actually I need it for my desktop-based application. Currently I'm evaluating SWT table, but seems it does not support hierarchical table column. Maybe I'll take a look at Swing JTable.
Or just follow this tutorial to use native JTable and JTree together:
java_sun_articles_treetable1
Estima Visual Java/SWING Components Library 4.0:
(source: eltima.com)
If you are looking for a JavaEE solution you might want to have a look at [fleXive], an open source (LGPL for the framework and GPL for the optional backend with visual editors).
Please feel free to ask any questions on the forums.
(source: flexive.org)
Related
I have following test case where i want pass '00:00:00.0' (date_suffix) for one example and one for not.
however using this approach it also append space in first example with no date_suffix
so it results something like this:
// I need to get rid of last space (after /17) for example 1.
example1. "1996/06/17 "
example2. "1996/06/17 00:00:00.0"
--
Then Some case:
| birthdate |
| 1996/06/17 <date_suffix> |
| 1987-11-08 <date_suffix> |
| 1998-07-20 <date_suffix> |
#example1
Examples:
| date_suffix |
| |
#example2
Examples:
| date_suffix |
| 00:00:00.0 |
What you want to do is not possible in Gherkin.
However it seems like you are testing a date parser or validation tool through some other component.
By adding the time stamp to the date, you're adding incidental details to your scenario. It is not immediately apparent what these test and maybe overlooked in the future.
Consider instead testing the parser/validator separately and directly.
Once you have confidence in the date parser works correctly, use for your current scenario a list of mixed dates, some with and some without suffix.
Use a trim function to eliminate all the spacese.
exemple = urString.trim();
I have a database with a table called Car. The car table looks like this:
+----+------+--------------+-----------+----------+------+
| Id | Name | Desccription | Make | Model | Year |
+----+------+--------------+-----------+----------+------+
| 1 | A | something1 | Ford | Explorer | 2010 |
| 2 | B | something2 | Nissan | Ultima | 2005 |
| 3 | C | something3 | Chevrolet | Malibu | 2012 |
+----+------+--------------+-----------+----------+------+
Different pages on my website want to display different information. Some pages only want to display the name, others wants to display the make and model, etc.
I have an api that the web calls to retrieve all this information. The api uses JPA and QueryDSL to communicate with the database and fetch information. I want to only fetch the information that I want for that particular page. I'm thinking about implementing some sort of builder patter to my repo to allow for me to only retrieve what I want but I'm not quite sure how to go about it.
For example, my home page only wants to display the Name of the car. So it'll call the HomeController and the controller will call the HomeService which will call the repository layer something like this:
carRepository.getCarById(1).withName().build();
Some other page that wants to display the make and model would make a repo call like this:
carRepository.getCarById(1).withMake().withModel.build();
What is the best way to implement something like this in Java/Jpa?
If I understand the question correctly, you want queries for different projections of your entities to be built dynamically.
In that case, dynamic entity graphs are what you want (see e.g. here: https://www.thoughts-on-java.org/jpa-21-entity-graph-part-2-define/). You start with an empty entity graph, and each call to one of your with() method simply adds a field to the graph.
The base query remains unchanged, you just need to set the fetch graph hint (javax.persistence.fetchgraph) upon calling build() (note that the samples in the above link use load graphs instead of fetch graphs; the subtle difference between the two is described here: What is the diffenece between FETCH and LOAD for Entity graph of JPA?)
I have a CSV datasource something like this:
User,Site,Requests
user01,www.facebook.com,54220
user01,plusone.google.com,2015
user01,www.twitter.com,33564
user01,www.linkedin.com,54220
user01,weibo.com,2015
user02,www.twitter.com,33564
user03,www.facebook.com,54220
user03,plusone.google.com,2015
user03,www.twitter.com,33564
In the report I want to display the first 3 rows (max) for each user, while the other rows will only contribute to the group total. How do I limit the report to only print 3 rows per group?
e.g
User Site Requests
user01 | www.facebook.com | 54220
plusone.google.com | 2015
www.twitter.com | 33564
| 146034
user02 | www.twitter.com | 33564
| 33564
user03 | www.facebook.com | 54220
user03 | plusone.google.com | 2015
user03 | www.twitter.com | 33564
| 89799
It is really just the line limiting I am struggling with, the rest is working just fine.
I found a way to do it, if anyone can come up with a more elegant answer I would be happy to see it, as this feels a bit hacky!
for each item in detail band:
<reportElement... isRemoveLineWhenBlank="true">
<printWhenExpression><![CDATA[$V{userGroup_COUNT} < 4]]></printWhenExpression>
</reportElement>
where userGroup is the field I am grouping by. I only seemed to need the isRemoveLineWhenBlank attribute for the first element.
you may consider to use subreport by querying the grouping fields in the main report and then passing the grouping fields as parameters into the subreport; the merits of this method is to avoid the report engine to actually looping through all un-required rows (although they are not shown) and spending unnecessary server-to-server or server-to-client bandwidth especially when the dataset returned is large
I'm interested in a way of outputting some objects to a table like way the objects. Concrete example would be something like:
-------------------------------------------
| Name | foo | bar |
-------------------------------------------
| asdas | dsfsd |1233.23 |
| adasdasd | fsdfs |3.23 |
| sdasjd | knsdfsd |13.23 |
| lkkkj | dsfsd |2343.23 |
-------------------------------------------
Or an ms office / open office excel file.(is there an api doc for this type of outputting data in specific editors? like how to define a table in OpenPffice)?
I'm asking this because I would like to know the best way doing this.
PS: there is no need to deserialise.
docx4j is a library for creating and manipulating .docx,pptx and excel files.
If you do not feel like using docx4java or it does not fit your needs you can try these
Apache Poi
Open Office API
The easiest is to export to a comma-separated values which you can open in Excel.
You can use the data-exporter library.
We have integration with several vendor for showing our product catalouge. Every-time, we have to customizing the view according to the provided templates by Vendor.
I have find following points after analyzing all the templates i.e. as follows:
Commonly, i have found out there are total 6 different type of blocks. Let's suppose A,B,C,D,E,F.
Vendor John templates contains A,C,E. And the layout of the template is
----------------------
| A |
----------------------
| C | E |
----------------------
Vendor Micheal templates contains B,D,E,F. And the layout of the template is
----------------------
| B | F |
----------------------
| D | E |
----------------------
Vendor Shane templates contains A,B,C,D,E,F. And the layout of the template is
----------------------
| B | F |
----------------------
| D | E |
----------------------
| A | C |
----------------------
Business logic for A,B,C,D,E,F is same in all the above case.
CSS, Image File and Html structure is different in all the above case.
I am trying to find out a generic solution where i can customize the view and prepare the presentation. Is there any framework in java who can help to solve my problem or any suggestion.
Apache tiles or Sitemesh might suit your needs. They're frameworks designed for "tiling" your view however you desire.
I have to suggest Symfony for this purpose.
A single project contains several apps on a single data model where each app can be viewed as a view for somebody, a vendor or an administrator.
Plus, you can store some reusable pieces of templates at the root and re-use them inside each app the way you want.
You dont have to switch to Symfony, you can use just a part of it, and keep your data model at it is today.
http://www.symfony-project.org/