How to save any website by depth in JavaFX 2.0? - web

I am working on a JavaFX 2.0 application and i want to save a website and it's content by depth, but i do not know how to do this. For example if i want depth 0, it will save the first html page. If the depth is 1 i will save the first html page of the website and all the Subpages of it with their content! I do not know how to do this.
I have this project as homework. I am student!
Anyone can help me out here? I will be very greatfull.
Thanks a lot!

I'm not sure that JavaFX has some special API for this task. The main idea of javaFX may be defined as "tool for builing really cool GUI", but not like "some special tool for some specific tasks on web". Maybe WebView component can help you with your task (as its purpose is working with web). If not - you should work with javaFX on this task just the same way you'll walk with some other framework on it: write your own parser for HTML pages (read a website as a string, parse it for finding all html tags... and so on... XPath can help you there), or find some already existing libraries and use them in your application.
So, javaFX can help you in this project as a framework for building GUI, but business logic must be done by some other frameworks.

Related

Vaadin - SVG Generator, any alternative?

I have been working with Vaadin charts during this week and I found a problem that I cannot solve. I need to send several charts to a PDF generation (using iTextpdf) and I could do it using SVGGenerator. The main problem is I cannot use this solution because the final laptop doesn't allow any installation, and Phantomjs is required for SVG Generator (no add-on can be installed neither). I tried to find a different solution to convert the chart content into file or buffer that I can manage, but I think I have been reading so much posts and I am not able to distinguish the solution.
So, I will try to clarify basic questions first:
a) Is it possible to manage SVG Generator without any installation in the laptop?
b) If not, is there a different way to convert a chart into an object which class could be managed to insert it into a PDF?
I can assure you I tried to read all documentation in this forum and official Vaadin forum related to this topic but I couldn't find any solution. I don't want to seem lazy, I only want to avoid spending more time and clarify the maining pre-conditions to solve this issue.
thanks in advance for your time and help.
Kind regards,
David.
You can take a screenshot of your chart and append it to pdf:
Screenshot screenshot = new Screenshot();
screenshot.setTargetComponent(myTargetComponent);
myChartLayout.addComponent(screenshot);
//when complete
screenshot.addScreenshotListener(new ScreenshotListener() {
public void screenshotComplete(ScreenshotImage image) {
//do something
}
});
//take screenshot
screenshot.takeScreenshot();
You will not be able to render a Vaadin Chart without a web browser engine of some kind. That's what PhantomJS provides. If you have a full-blown web browser at your disposal, though, you can grab the SVG markup manually from there; it's just a bit more difficult to automate. This works in Chrome:
Open your Charts app in the browser
Open the JavaScript console (Ctrl/Cmd + Shift + J)
Type something like this: copy(document.getElementsByTagName('svg')[0].outerHTML)
Paste the contents of your clipboard to a new text file and save it as an SVG.
You don't need to install phantomjs, just bundle its binary along with your web application (Reference). I did the same thing with my Amazon AWS deployment and it works just fine.

Orchard Projection Isotope

I'm trying create an affiliate directory on my Orchard site. The directory is populated by running a query on my custom Content Type. The directory needs to be sortable and searchable. I've set up a basic jsfiddle here that is a basic functioning version of what I'm attempting to do, but it's just in html: http://orchard1.pha.jhu.edu/affiliates-beta-2
Or you can view the jsfiddle here: http://jsfiddle.net/tgelles/AMZf8/
Has anyone discovered a way to best use isotope on an Orchard Projection? I've downloaded the Projection Layout module, but I have no idea how to use that/where to inject the specific isotope code. I've also created alternate template files for the Projection's Summary display, but I don't know how to best inject the isotope plugin into that razor file.
Any help would be appreciated.
The best way would be creating a shape, but You could easily edit the query template and inject the js through a custom view for that projection(url,type, etc)
Check in your Queries.
There was a video which helped me understand better how they work: http://www.youtube.com/watch?v=Ka55wTTXZg8
Hope it helps.

Richfaces and chart

One big piece missing on richfaces is a chart support. In my case what I need is a simple bar chart, with no interactivity to put into a jsf (richfaces 3) page, into a javaEE 6 web-application that must run only with opensource libraries
Anyone can give me some options?
thanks in advance!
note: I'm thinking on jfreechart, obviously, but what I need is something skinnable fast, with no pain
you could have a look on JSFlot .People say it works well with richfaces.
The JSFlot JSF chart library builds on top of the JavaScript Open
Source Project Flotr (a javascript plotting library based on the
Prototype Javascript Framework) to create stunning interactive charts
purely using JavaScript. The JSFlot charting library is simple to
install, easy to configure and easy to use in your custom application.
All of the applications dependencies (purely JavaScript related) are
included in the Jar file.
The goal of the JSFlot project is to support all the main features of
Flotr (Flotr has its own project page set up at
http://code.google.com/p/flotr/), while remaining easy and simple to
install and use.
We used JQPlot for charting in our project. Pluggable, Interactive and look good. Check them out:
JQPlot Bar Charts

How does layout engine work?

I am REALLY curious how a web page is parsed into a DOM tree, then how the tree is rendered in a web browser. Namely,how does layout engine work?
I guess whether reading source code of a simple web browser (Webkit is too hard for me now.
) is a feasible choice? Thanks
Parsing a web page into a DOM tree isn't terribly difficult to understand since (well-formed) HTML is already in a tree structure. So I don't think there's much to it except when you want to also annotate things like CSS, conditional code, and scripts into your tree.
Layout and rendering is a much more challenging problem to work out. If you're not ready to dive directly in the code, you can read their docs:
WebKit Layout and Rendering
You can also go to this link which has a great explanation and review of the concerned question.
http://www.html5rocks.com/en/tutorials/internals/howbrowserswork/
The page linked to by #binariedMe is good for understanding the narrative of when a browser parses html and then applies layout rules. If you want to get a more solid mental model of those rules, you should read http://book.mixu.net/css/

Displaying Maya Mesh XML in browser

I have a Mesh file (XML format) created in Maya.
I would like to display it in the browser with some additional options for the user, like rotating an zooming in and out.
What should be the best and easy method to do so?
(SilverLight, HTML5/JS/Canvas, Flesh)
I would really like to try HTML5/Canvas - is there any libraries that know how to do it?
Thanks.
I would really like to try
HTML5/Canvas - is there any libraries
that know how to do it?
You can visit this site learningwebgl
There are a lot of lessons and demos. On the right side there is a list of frameworks.
But you need browser support for webgl...
If you are willing to export your file in Collada/DAE format (which is basically XML), there are some online WebGL framework demos that show that a DAE file can be displayed the way you wish.
The frameworks that I've seen this for are GLGE and SpiderGL.
(WebGL is the 3D version of HTML5/Canvas.)
you can export your maya scene with http://www.inka3d.com and then manipulate it with javascript

Resources