Comments (9)
Hi @Buchx ,
There is no direct support for this Issue in HtmlFlow. But maybe you can work around it with:
-
Merge the arraylists in a single List with:
man.addAll(tir)
orIterable<SkemaLektion > res = () -> Stream.concat(man.stream(), tir.stream()).iterator();
. Then pass the resulting iterable to the viewtaskView.setPrintStream(out).write(res);
-
Instead of printing the week day value in a
th
, just print “Week Day” on theth
and then print the values "Mandag", "Tirsdag", etc intd
bellow. In that case maybe the typeSkemaLektion
should have a propertygetWeekDay()
which provides the data to thattd
: "Mandag", "Tirsdag", etc. Thus you can control inside the lambda if you have already printed the Week Day or not, like:
WeekDay last = {""};
…
skemaLektion -> {
if(last[0].equals(skemaLektion.getWeekDay())) return " "
last[0] = skemaLektion.getWeekDay();
return skemaLektion.getWeekDay().getText();
}
Hope this helps.
from htmlflow.
Hi, @fmcarvalho
Maybe a bit out of context, but do you know If I can merge thoose cells with the dates OR give it attributes so I can style it a bit more? Or should I just target it with CSS children?
Kind regards
from htmlflow.
In current version of HtmlFlow td
s are automatically created by trFromIterable()
method and there is no way to specify further attributes on those td
.s
On next version 2.0 of HtmlFlow which is in development branch and is being prepared for release this method trFromIterable()
is removed and you have a completely different approach which you can check at the unit test TestTable.java and it is like:
table.<List<Task>>binder((tbl, list) -> {
list.forEach(item -> {
tbl.tr()
.td().text(item.getTitle()).º()
.td().text(item.getDescription()).º()
.td().text(item.getPriority().toString());
});
});
In this way you can do whatever you want with each td
.
See the README.md of development branch for further details.
from htmlflow.
Brilliant! Looking forward to version 2.0!
Thank you for all the help!
from htmlflow.
@fmcarvalho
When will version 2.0 be released? Really eager to style my tds :)
So I can get it more looking like this:
Here is what I've made it to currently.
Source for above output.
public static void saveWeek(
String weekNum,
String header,
String footer,
String extrasFooter,
ArrayList<SkemaLektion> lektures) {
footer = footer.replaceAll("[\n]", "<br />");
header = header.replaceAll("[\n]", "<br />");
extrasFooter = extrasFooter.replaceAll("[\n]", "<br />");
HtmlView<Iterable<SkemaLektion>> taskView = new HtmlView<Iterable<SkemaLektion>>();
taskView
.head()
.title(weekNum)
.linkCss("https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css")
.scriptBlock()
.code("</script>\n<meta charset='UTF-8'>\n<script>");
HtmlBody<Iterable<SkemaLektion>> body = taskView
.body()
.classAttr("container");
// Set header text
body
.div()
.text(header);
HtmlTable<Iterable<SkemaLektion>> table = body
.heading(2, "Øvelsesliste for uge " + weekNum.replaceAll("[-]", " "))
.table().classAttr("table");
// Set footer text
body
.br()
.div()
.text(footer);
if (!extrasFooter.isEmpty()) {
body
.br()
.div()
.text(extrasFooter);
}
String[] last = {""};
HtmlTr<Iterable<SkemaLektion>> headerRow = table.tr();
headerRow.th().text("Uge " + weekNum.replaceAll("[-]", " ") + " - " + SkemaController.dp.getValue().getYear());
headerRow.th().text("Tid");
headerRow.th().text("Enhed");
headerRow.th().text("Fag");
headerRow.th().text("Lek Nr");
headerRow.th().text("Aktivitet");
headerRow.th().text("Leder");
headerRow.th().text("Påklædning");
headerRow.th().text("Sted");
table.trFromIterable(
skemaLektion -> {
if (last[0].equals(skemaLektion.getWeekDay())) return " ";
last[0] = skemaLektion.getWeekDay();
return "<div id='" + skemaLektion.getWeekDay().replaceAll("[\n]]","").substring(0, skemaLektion.getWeekDay().length() - 8) + "' style='white-space: pre-wrap;'>" + skemaLektion.getWeekDay() + "</div>";
},
skemaLektion -> skemaLektion.getLektid().getText(),
skemaLektion -> skemaLektion.getEnhedValue(),
skemaLektion -> skemaLektion.getFagValue(),
skemaLektion -> skemaLektion.getLekNummerValue(),
skemaLektion -> skemaLektion.getAktivitet().getText(),
skemaLektion -> skemaLektion.getAnsvar().getText(),
skemaLektion -> skemaLektion.getPaaklaedning().getText(),
(SkemaLektion skemaLektion2) -> skemaLektion2.getLokation().getText());
String fileName = "Uge_" + weekNum + "_" + SkemaController.dp.getValue().getYear() + ".html";
try {
PrintStream out = new PrintStream(new FileOutputStream(fileName), true, "UTF-8");
taskView.setPrintStream(out).write(lektures);
Desktop.getDesktop().browse(URI.create(fileName));
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
Maybe if you have time you could help me setting up the code for reaching an output similar to picture1?
from htmlflow.
When will version 2.0 be released? Really eager to style my tds :)
Maybe at the end of this week... In meanwhile you can clone this repository, checkout development
branch , open a console and run mvn clean install
and then add a reference to htmlflow-2.0-SNAPSHOT
in your project.
I can help you with any issue that you find. But I am overwhelmed and I have no time to translate your source code to current version 2.0 HtmlFlow. Try yourself and open an Issue if you have any doubt.
Thanks,
Miguel
from htmlflow.
Just to let you know that version 2.0 of HtmlFlow has been released right now.
Now we just have to wait for the synchronization process with Maven Central.
Note that now we are on xmlet oganization: http://repo1.maven.org/maven2/com/github/xmlet/ and
https://github.com/xmlet/
Thanks
from htmlflow.
@Buchx As you may be aware, I am the author and primary advocate for the HtmlFlow Java library. As part of my continuous endeavors, I am required to provide justification for this project to my university.
HtmlFlow serves as a versatile auxiliary tool utilized across various sectors, facilitating software development by streamlining tasks such as HTML reporting automation, web templating, and more.
If you have utilized HtmlFlow, I kindly request your testimony regarding my dedication to addressing issues, implementing new features, or otherwise aligning with your requirements and/or your company within the scope of a specific project, task, or work that utilized HtmlFlow during a certain timeframe.
Your testimony will play a crucial role in demonstrating my work to my university.
Please feel free to send your testimonial to my email address at ISEL: [email protected]
Thank you in advance for your attention and assistance.
from htmlflow.
@Buchx Even if you are not currently using HtmlFlow, I kindly request your acknowledgment that I was actively engaged in maintaining, tracking issues, or new features during the time of this issue. It is imperative for me to justify my efforts on HtmlFlow during the period of this issue to my university.
I would greatly appreciate it if you could once again provide your acknowledgment to my email address at ISEL: [email protected].
Thank you in advance for your attention and assistance.
from htmlflow.
Related Issues (20)
- View with dynamic and static attribute / Placement of dynamic() block HOT 6
- Inline SVG from string add to view HOT 2
- How to use For Loop / If condition / Map with HTML FLow? HOT 6
- Tags gets confused with text HOT 2
- setIndented(false) also removes new lines from text in views HOT 3
- Missing oncontextmenu and disable textarea whitespace HOT 6
- Typos in blog post HOT 2
- Documentation expansion HOT 2
- Gradle build warnings... HOT 5
- Groovy compilation errors ... HOT 4
- Security Scan Warning - JSOUP...? HOT 1
- Input attribute checked=false|true not compliant HOT 3
- Cannot have full dynamic page HOT 1
- Is there any idea code folding plugin recommendation? HOT 3
- slf4j-simple should not be declared as a dependecy HOT 2
- Multiple model with single template HOT 3
- option.attrSelected unexpected behavior HOT 7
- Enhance documentation with complete list of methods HOT 4
- Script tag, attribute type HOT 5
- Reflexion on template and java 21 features HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from htmlflow.