With tens of millions of clients continuously downloading binaries from our repositories, we decided to offer an OSS client that natively supports these downloads. In this talk, we will share the main challenges in developing a highly-concurrent, resumable, async download library on top of Apache HTTP client. We will cover other libraries we tested and why we decided to reinvent the wheel. We will see important pitfalls we came across when working with HTTP and how using the right combination of techniques can improve performance by an order of magnitude. We will also see why your initial assumptions may completely change when faced with other players on the network. Consider yourself forewarned: lots of HTTP internals, NIO and concurrency ahead!
2. ABOUT ME
JCP, Java Champions, Was JCP EC, won the 2014 Duke’s choice
and 11th annual JCP adopt 2013 awards, Hacker, Speaks Java,
Architect, international speaker, IoT Geek, Author.
@_tamanm
about.me/mohamedtaman
3. ANNOUNCEMENT
Get it from :
https://www.packtpub.com/web-
development/javafx-essentials
Or
http://www.amazon.com/JavaFX-
Essentials-Mohamed-
Taman/dp/1784398020
5. WE NEED
A next-generation Graphical User Interface (GUI) toolkit.
As a platform that makes it easy to rapidly build high-
performance Java client-side applications.
6. WE NEED
A GUI toolkit with underlying engines take advantage of
modern GPUs through hardware accelerated graphics,
while providing well-designed programming interfaces, thus
enabling developers to combine graphics, animation, and
UI controls.
9. JAVA FX?
• An API included in Java SE 8
For UI development
• The successor of Java Swing
10. WHY JAVA FX?
• Rich Internet Application that Cross platform:
• Windows, Mac & Linux, Solaris, Arm, Mobile.
• Familiar: 100% Java APIs with millions Library
• Easy to Develop even for Beginner
• Drag and Drop Application
• Only use Java Language Programming
• GUI Development with Cross Platform
11. WHY JAVAFX ?
Productivity
– Rapid Application Development using Tooling (Netbeans and
SceneBuilder)
– Testing and…
– We are coding only in Java
User Interface
12. WHY JAVAFX ?
User Interface
Capability
– Layouts built using WYSIWYG
– Control Set (Basic and Advanced)
– Eventing (e.g. Value Change Listeners, Thread State Listeners)
– CSS styling
13. WHY JAVAFX ?
FXML
VIEWS
Screen Building using Scene Builder which
generates FXML
– Layout Containers
– Place Controls
– Associate Events
– Style
Map to a Controller Class
FXML
Generates
Controller
Associate
14. JAVA PIONEERED RICH CLIENT APPLICATIONS
But developers had to learn multiple technologies
17. MINIMUM STANDARD TOOLS FOR
EASY DEVELOPMENT
NETBEANS, ECLIPSE, ORACLE JDeveloper
JDK 7 or 8
JDK 7 -> Java FX 2.2 (Separated Installer)
JDK 8 -> JAVA FX 8 Included in Installer
Scene Builder 2.0
Gloun Scene Builder 8.0
18. COMPONENT IN JAVA FX
Containers
– Accordion, Anchor Pane, Stack Pane, Tab Pane, HBox, and VBox
Controls
– Buttons, Choice Box, Combo Box, ImageView, WebView,
TextField, TextArea, Label…
Shapes
– Rectangle, Circle, Arc, Ellipse, Line, Polygon, Text, Cubic Curve
Charts
– Area Chart, Bar Chart, Scatter Chart, Pie Chart, Bubble Chart
19. SCENE BUILDER, FXML, AND
CONTROLLER
Scene Builder
– Drag and Drop Application for Layout GUI
FXML
– Script layout GUI that generated from Scene Builder
Controller
– In Order FXML be dynamic content need Controller to
control components
21. HOW TO START?
You can start with learn in Java FX Sample Demo using
Ensemble8 for JDK 8.
Read my book, JavaFX essentials (Packt 2015) by Mohamed
Taman.
An Amazing book, JavaFX 8: Introduction by Example, Second
Edition,Carl Dea, Mark Heckler, Gerrit Grunwald, José Pereda, and
Sean M. Phillips (Apress, 2014. ISBN: 978-1-4302-6460-6)
Oracle website: http://docs.oracle.com/javase/8/javase-
clienttechnologies.htm
24. JAVAFX ON MOBILE
Based on the official support from Oracle Corporation for JavaFX, a
number of people inside the JavaFX community are working to port
JavaFX to make it run on as many devices and platforms as
possible (desktop, mobile, and embedded) and different operating
systems, with the same codebase.
They have successfully created SDKs that allow us to develop
JavaFX applications as native applications to run on Android or
iOS-based devices in one bundle (JVM plus application)
25. JAVAFX ON MOBILE
JavaFX applications on iOS using the port from RoboVM
(http://www.robovm.org/) and on Android using the port from JavaFXPorts
(http://javafxports.org/).
For interoperability with Android native API the FXActivity class, is the
bridge between JavaFX and the Dalvik runtime.
26. JAVAFX ON MOBILE
Now a single plugin called jfxmobile-
plugin allows us to build applications for
three platforms desktop, Android, and
iOS from the same codebase.
30. JAVAFX ON THE RASPBERRY PI
Very closely related to the IoT
world, the Raspberry Pi is a credit
card-sized microcomputer
designed by the Raspberry Pi
Foundation for experimentation and
education.
31. JAVAFX ON THE RASPBERRY PI
What you should know about the Raspberry Pi is that it is nothing
but a small computer. Small power requirements, small physical
size, small memory, and most importantly a low-cost device.
Everything about it is small, but it is still just a computer and it
uses Linux.
32. JAVAFX ON THE RASPBERRY PI
Java was made for IoT from the first day of its invention.
Java was created with a clear vision in mind: to control small
devices such as television set-top boxes.
With the explosion of IoT, Java returns to its roots.
33. JAVAFX ON THE RASPBERRY PI
You may think that JavaFX, a platform for rich-client development, would
miss the IoT party—but it is not so! According to the JavaFX Overview
page on the Oracle Technology Network:
– "It is designed to provide a lightweight, hardware-accelerated Java UI
platform"
This statement holds the key to graphically rich-and-powerful JavaFX:
hardware acceleration and; luckily, the Raspberry Pi comes with a
powerful GPU.
37. JAVAFX WITH ARDUINO
Arduino is an open source
electronics tool based on a simple
programmable microcontroller
board that can be programmed
using a free open source IDE.
38. JAVAFX WITH ARDUINO
Alone or attached to a computer, it creates interactive devices
that can sense by taking inputs from a variety of switches or
sensors and can act by controlling a variety of lights, motors, and
other outputs physical devices.
39. JAVAFX WITH ARDUINO
Arduino runs standalone or can communicate with software
running on your computer (Java, JavaFX, Python, and so on)
and the boards can be assembled by hand or purchased
preassembled.
40. JAVAFX WITH ARDUINO (DEMO)
A desktop application using JavaFX along with an Arduino board
in order to monitor data coming from a real world temperature
sensor and report it on a chart,
How HOT blooded you really are!
43. JAVAFX WITH ARDUINO (THREADING)
The main use of Platform.runLater() is placing the task
of filling the series data with the incoming Arduino input
in the JavaFX thread.
Also it gives the required time to the Scene graph to
render the chart, skipping values if they are added too
fast.
45. TOUCHLESS JAVAFX APPS
Every day we notice the rise of
input interfaces that are less
mouse-centric and more in favor of
touchless input.
Gestures are one of the ways
humans can communicate with
machines naturally these days.
46. TOUCHLESS JAVAFX APPS
There are several devices on the market that actually allow us to interact with computers
using just some parts of our body: many games for the Xbox, the Microsoft game
console, use the Kinect controller to recognize the user's body movements.
The myoelectric armband detects movements in your muscles and translates them into
gestures so that you can interact with your computer.
Leap Motion controller recognizes users' hands and fingers and translate the
movements and gestures to the computer.
47. TOUCHLESS JAVAFX APPS (LEAP MOTION)
Here is a very tiny device with 13 mm
height, 30 mm width, 76 mm depth, and a
weight of 45 grams (final dimensions: 0.5" x
1.2" x 3").
With the Leap Motion software running on
your computer, just plug the controller into
the USB on your Mac or PC and you are
ready to go (without any external power
source).