How to merge cells (colspan) using jsf h:panelGrid? - jsf

Suppose I want display table:
+--------------------------------+
| | | |
----------------------------------
| | |
----------------------------------
| | |
----------------------------------
| | | |
----------------------------------
| | | |
+--------------------------------+
How can I do that with h:panelGrid?

You can't do this with the standard JSF implementation. In JSF 1.2 one would have used Tomahawk's <t:panelGroup colspan="2"> for this. Right now Tomahawk is not officially compatible with JSF 2.0, but I just gave it a try.
<html xmlns:t="http://myfaces.apache.org/tomahawk">
...
<t:panelGrid columns="3">
<t:panelGroup>row1cell1</t:panelGroup>
<t:panelGroup>row1cell2</t:panelGroup>
<t:panelGroup>row1cell3</t:panelGroup>
<t:panelGroup colspan="2">row2cell1-2</t:panelGroup>
<t:panelGroup>row2cell3</t:panelGroup>
<t:panelGroup>row3cell1</t:panelGroup>
<t:panelGroup colspan="2">row3cell2-3</t:panelGroup>
<t:panelGroup>row4cell1</t:panelGroup>
<t:panelGroup>row4cell2</t:panelGroup>
<t:panelGroup>row4cell3</t:panelGroup>
</t:panelGrid>
And it works. I don't guarantee that other Tomahawk components will work as well.

I don't think core JSF supports this, but some 3rd-party implementations might. Someone posted a solution to this using Tomahawk at the end of the post at the following URL:
http://www.coderanch.com/t/211242/JSF/java/colspan

Related

Asciidoctor - overflow on a large table

I create a documentation with asciidoctor and Maven.
I need to put a large table (more than page width), but I don't know how to put an equivalent to css overflow-x:auto for this table.
my.adoc:
Tables :
|===
10+|*usertable*
| id | hostname | ip | profile | username 5+|
10+|*tapplications*
| id | category | feature | app_license_type | app_long_desc | app_name | app_nam_exec | app_short_desc | id_feature | logo
10+|*licenseusertable*
| id | date_since_granted | display | feature_version | handler | server_host | server_port | id_feature | id_user |
|===
Thanks in advance
You would need to add some custom CSS to accomplish that.
You could supply your own stylesheet file, totally overriding the Asciidoctor styles, by adding -a stylesheet="mystyles.css" to your asciidoctor invocation.
Since you likely just want to add a style to the existing styles, you need to use a docinfo file. See: https://asciidoctor.org/docs/user-manual/#docinfo-file
Create a file called docinfo.html containing your styles. For example:
<style>
.scrollable {
overflow-x: auto;
}
</style>
Note the <style> tag: the docinfo.html file is an HTML file (which gets embedded into the <head> of the generated page), so you can also embed custom Javascript, meta tags, etc.
Then, in the document containing the table, add the following attribute definition immediately after the document's title:
:docinfo: shared
Also, since HTML tables don't support horizontal scrolling, you need to wrap your table in an open block (which translates to some <div> wrappers):
[.scrollable]
--
Tables :
|===
10+|*usertable*
| id | hostname | ip | profile | username 5+|
10+|*tapplications*
| id | category | feature | app_license_type | app_long_desc | app_name | app_nam_exec | app_short_desc | id_feature | logo
10+|*licenseusertable*
| id | date_since_granted | display | feature_version | handler | server_host | server_port | id_feature | id_user |
|===
--

Looking up a cross-reference but a range

I hope you can help me please.
How would I go about looking up data in the following cross-reference table?
I have the header row (i.e. 25) value and the column (mm) value and want to return the x/y value. i.e I have and item with (header row) X = 25 and (mm) Y= 0.48 item and want 1.6 to be returned.
+--------------+-------+---------+---------+---------+
| (mm) width | 10~20 | 20.1~30 | 30.1~40 | 40.1~50 |
+--------------+-------+---------+---------+---------+
| 0.20~0.45 | 1.3 | 1.8 | 2.1 | 3.5 |
| 0.46~0.60 | 1.4 | 1.6 | 1.8 | 2.3 |
| 0.61~0.70 | 1.5 | 1.7 | 1.6 | 2.1 |
| 0.71~0.80 | 0.7 | 1.1 | 2.2 | 3.1 |
+--------------+-------+---------+---------+---------+
Thanks a lot for your support.
Try,
=INDEX(B2:E5, MATCH(TEXT(H2, "0.00"), A2:A5), MATCH(TEXT(G2, "0"), B1:E1))
With your current set up:
=SUMPRODUCT((G2>=--LEFT(B1:E1,FIND("~",B1:E1)-1))*(G2<=--MID(B1:E1,FIND("~",B1:E1)+1,2))*(G3<=--MID(A2:A5,FIND("~",A2:A5)+1,3))*(G3>=--LEFT(A2:A5,FIND("~",A2:A5)-1)),B2:E5)
But if you modify the numbers a little to just include the minimums:
This simpler formula will work:
=INDEX(B2:E5,MATCH(G2,B1:E1),MATCH(G3,A2:A5))

Which dialect of Markdown does Hackage use to render READMEs?

Hackage has been able to display Markdown READMEs for a while.
But as one can see for example on the Hackage page for hpack, Hackage doesn't seem to support the same table syntax as GitHub.
Markdown:
#### <a name="flags"></a>Flags
| Hpack | Cabal | Default | Notes |
| --- | --- | --- | --- |
| `description` | `description` | | Optional |
| `manual` | `manual` | | Required (unlike Cabal) |
| `default` | `default` | | Required (unlike Cabal) |
Rendered on GitHub:
Rendered on Hackage:
So, I'm wondering:
Which Markdown dialect does Hackage support?
Is there a syntax for tables in that dialect?
Is there a syntax for tables in the subset of Markdown that is supported by both GitHub and Hackage?
A quick search through the source of Hackage shows that is uses cheapskate (by John MacFarlane, the author of Pandoc). Looking at the Cheapskate.Types you can see everything that is supported - and tables are not part of that.
Furthermore, it appears that Hackage has the raw HTML option for rendering set to False, thereby quashing any hope one may have had of putting in a simple HTML table (which I think should also work in GitHub).
I think the best alternative (supported by both Hackage and GitHub) is just to put your table in a code block. That way, it is at least monospace font (so columns can align). That means you enter something like
```
| Header1 | Header2 | Header2 |
+---------+---------+---------+
| Cell1 | Cell2 | Cell3 |
+---------+---------+---------+
```
And it will render as
| Header1 | Header2 | Header2 |
+---------+---------+---------+
| Cell1 | Cell2 | Cell3 |
+---------+---------+---------+

One to many row in datatable jsf?

How can I create datatable which displays record as the following:
| | SECOND |
| ONE | THIRD |
| | FORTH |
| | FIFTH |
e.g one to many. Can you help me?
There's no way to achieve it with Primefaces, AFAIK. You could use a subtable instead to do something like:
| ONE |
| SECOND | THIRD || FORTH || FIFTH |
Or even use a rowExpansion utility, which I usually use for most of my one to many cases.
If your requirement is to match exactly what you ask for, you could always go with a pure JSF implementation instead and try to style it using Primefaces CSS stylesheets.
Using subtable you can display 1 to N relation data like:
| ONE | SECOND |
| | THIRD |
| | FORTH |
| | FIFTH |
For that you need repeat ONE in each line, but display (rendered) it for first line only. See result using RichFaces

Text -> Diagram Tool [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I'm looking for an diagram tool for producing diagrams from text. I only really need sequence and state type diagrams for now, but I'm curious as to what people would recommend? I need something which is standalone, not a web based tool that works on Linux, OSX and Windows.
I'm not positive what you mean by "producing diagrams from text", but if you mean a tool where diagrams are specified by a text file, Graphviz is good. If you mean something that literally converts ascii art like
+--------+ +-------+ +-------+
| | --+ ditaa +--> | |
| Text | +-------+ |diagram|
|Document| |!magic!| | |
| {d}| | | | |
+---+----+ +-------+ +-------+
: ^
| Lots of work |
+-------------------------+
to a graphic:
You can try ditaa (that ascii art is from their website, so it's a good example of the input format it expects)
Look at PlantUML, LaTeX+MetaUML, sdedit, TextUML, yUML, ...
There is a plenty of quite good tools.
I recommend TextDiagram http://weidagang.github.com/text-diagram/. It creates UML sequence diagram from pure text.
Example input
object April Todd Monad
note left of April: Lunch is ready
April->Todd: Todd, what are you doing?
note right of Todd: Programming #_#
Todd->April: Well, I'm programming.
April->Monad: And you?
Monad->April: I'm reading book.
April->Monad: Good boy!
note right of Monad: Smile ^_^
produces:
+-------+ +-------+ +-------+
| April | | Todd | | Monad |
+-------+ +-------+ +-------+
-----------------\ | | |
| Lunch is ready |-| | |
------------------ | | |
| | |
| Todd, what are you doing? | |
|------------------------------>| |
| | ------------------\ |
| |-| Programming #_# | |
| | ------------------- |
| | |
| Well, I'm programming. | |
|<------------------------------| |
| | |
| And you? | |
|------------------------------------------------------>|
| | |
| | I'm reading book. |
|<------------------------------------------------------|
| | |
| Good boy! | |
|------------------------------------------------------>|
| | | ------------\
| | |-| Smile ^_^ |
| | | -------------
| | |
I'd recomment PlantUML. It is an excellent tools that lets you draw all kinds of UML diagrams from simple textual specification.
EventStudio supports generation of sequence diagrams and collaboration diagrams from text input.

Resources