A Importância do JavaFX no Mercado Embedded

51
A importância do JavaFX para o mercado Embedded Bruno Borges Principal Product Manager Oracle Latin America

description

 

Transcript of A Importância do JavaFX no Mercado Embedded

Page 1: A Importância do JavaFX no Mercado Embedded

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13

A importância do JavaFX para o mercado Embedded

Bruno BorgesPrincipal Product ManagerOracle Latin America

Page 2: A Importância do JavaFX no Mercado Embedded

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13

Bruno Borges

Oracle Product ManagerDesenvolvedor, GamerEntusiasta em Java Embedded e JavaFXTwitter: @brunoborges

Page 3: A Importância do JavaFX no Mercado Embedded

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13

Page 4: A Importância do JavaFX no Mercado Embedded

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13

Uso de PCs na Indústria

Page 5: A Importância do JavaFX no Mercado Embedded

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13

Peças antigas, custo alto de manutenção

Page 6: A Importância do JavaFX no Mercado Embedded

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13

Raspberry.Pi – Custo de US$ 35,00

Page 7: A Importância do JavaFX no Mercado Embedded

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13

Mercado para Embarcados

Page 8: A Importância do JavaFX no Mercado Embedded

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13

Interfaces Touch Screen

Page 9: A Importância do JavaFX no Mercado Embedded

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13

FX

Page 10: A Importância do JavaFX no Mercado Embedded

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13

Page 11: A Importância do JavaFX no Mercado Embedded

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13

Page 12: A Importância do JavaFX no Mercado Embedded

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13

Page 13: A Importância do JavaFX no Mercado Embedded

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13

DEMOProjeto Ensemble

Page 14: A Importância do JavaFX no Mercado Embedded

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13

Page 15: A Importância do JavaFX no Mercado Embedded

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13

JavaFX 3D

Page 16: A Importância do JavaFX no Mercado Embedded

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13 17

Criando Formas e Materiais Primitivos

Page 17: A Importância do JavaFX no Mercado Embedded

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13

Colocando Textura em uma Esfera

18

Page 18: A Importância do JavaFX no Mercado Embedded

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13

Colocando Textura em uma Esfera

19

Page 19: A Importância do JavaFX no Mercado Embedded

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13

DEMOJavaFX 3D

Page 20: A Importância do JavaFX no Mercado Embedded

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13

Colocando Textura em uma Esfera

21

Page 21: A Importância do JavaFX no Mercado Embedded

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13

JavaFX é o

sucessor doJava Swing

Page 22: A Importância do JavaFX no Mercado Embedded

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13

Disponível para...

Windows, Linux, Mac OS XE em Preview...

ARM* Apple iOS* (usando RoboVM) Android* (prototipo)

Standalone para Java 6JavaFX 2.2 vem junto com JDK 7u6+Parte do ClassPath a partir do Java SE 8

Page 23: A Importância do JavaFX no Mercado Embedded

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13

Arquitetura

Prism – renderização Direct3D em Windows OpenGL em Linux/Mac/Embedded

Public API JavaFX API Scene Graph

Page 24: A Importância do JavaFX no Mercado Embedded

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13

OpenJFXJavaFX open sourced!

http://openjdk.java.net/projects/openjfx/

Page 25: A Importância do JavaFX no Mercado Embedded

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13

DEMOApp JavaFX escrita em Javascript

Page 26: A Importância do JavaFX no Mercado Embedded

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13

Criando sua primeira aplicação JavaFX

Page 27: A Importância do JavaFX no Mercado Embedded

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13

JavaFX Scene Builder 1.1 GAbit.ly/javafxdownload

Page 28: A Importância do JavaFX no Mercado Embedded

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13

Your First JavaFX App for RaspberryPi

Page 29: A Importância do JavaFX no Mercado Embedded

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 16

Scene Graph

Responsável pela UI Estrutura em Árvore Possui um nó raiz Vários nós branch e leaf

Page 30: A Importância do JavaFX no Mercado Embedded

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13

Scene Graph

Root Node – único sem um “parent”Branch Node – deriva de javafx.scene.Parent

Pode possuir outros nósLeaf Node – não possui filhos

Shapes, Images, Text, WebView, Media, Controls, Charts, etc...

Page 31: A Importância do JavaFX no Mercado Embedded

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13

Sua primeira aplicação JavaFX

public class MyApplication extends Application {

@Override public void start(Stage stage) throws Exception { URL fxml = getClass().getResource("MyApplication.fxml"); Parent root = FXMLLoader.load(fxml); Scene scene = new Scene(root); stage.setScene(scene); stage.setFullScreen(true); stage.show(); }

public static void main(String[] args) { launch(args); }

}

Page 32: A Importância do JavaFX no Mercado Embedded

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13

Properties no Swing

// Java Swingprivate static final String VALUE_PROPERTY = "value";private double value = 0;

public double getValue() { return value; }

public void setValue(double newValue) { double oldValue = value; value = newValue; firePropertyChange(VALUE_PROPERTY, oldValue, value);}

Page 33: A Importância do JavaFX no Mercado Embedded

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13

Properties no JavaFX

// JavaFXDoubleProperty value = new SimpleDoubleProperty(0);

public double getValue() { return value.get();}

public void setValue(double newValue){ value.set(newValue);}

public DoubleProperty valueProperty() { return value;}

Page 34: A Importância do JavaFX no Mercado Embedded

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13

Bindings

Binding unidirecional bind();

Binding bi-direcional bindBidirectional();

Page 35: A Importância do JavaFX no Mercado Embedded

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13

Bindings

IntegerProperty number1 = new SimpleIntegerProperty(1);IntegerProperty number2 = new SimpleIntegerProperty(2);DoubleProperty number3 = new SimpleDoubleProperty(0.5);

NumberBinding sum1 = number1.add(number2);NumberBinding result1 = number1 .add(number2) .multiply(number3);

NumberBinding sum2 = Bindings.add(number1, number2);NumberBinding result2 = Bindings .add(number1, multiply(number2, number3));

Page 36: A Importância do JavaFX no Mercado Embedded

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13

Limite de Velocidade

60 FPS

Page 37: A Importância do JavaFX no Mercado Embedded

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13

DEMOJavaFX com NetBeans 7.4

Page 38: A Importância do JavaFX no Mercado Embedded

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13

Suporte a Dispositivos Embedded

Page 39: A Importância do JavaFX no Mercado Embedded

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13

Raspberry Pi Configurationsfor JavaFX applications

CPU Overclock900~950MHz

Memory split128MB for video

Framebufferframebuffer_width=1280framebuffer_height=720

Page 40: A Importância do JavaFX no Mercado Embedded

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13

CPU Overclockfor JavaFX applications

$ cat /proc/cpuinfoProcessor : ARMv6-compatible processor rev 7 (v6l)BogoMIPS : 697.95…$ sudo raspi-config

bit.ly/raspioverclock

Page 41: A Importância do JavaFX no Mercado Embedded

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13

CPU Overclockfor JavaFX applications

$ cat /proc/cpuinfoProcessor : ARMv6-compatible processor rev 7 (v6l)BogoMIPS : 697.95…$ sudo raspi-config

Page 42: A Importância do JavaFX no Mercado Embedded

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13

CPU Overclockfor JavaFX applications

$ cat /proc/cpuinfoProcessor : ARMv6-compatible processor rev 7 (v6l)BogoMIPS : 697.95…$ sudo raspi-config

Page 43: A Importância do JavaFX no Mercado Embedded

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13

Memory Splitfor JavaFX applications

128mb best performance

64mb may work

$ sudo raspi-config

Page 44: A Importância do JavaFX no Mercado Embedded

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13

Memory Splitfor JavaFX applications

128mb best performance

64mb may work

$ sudo raspi-config

Page 45: A Importância do JavaFX no Mercado Embedded

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13

Video Framebufferfor JavaFX applications

Edit /boot/config.txt

Enable (uncomment) these options, with these values:

framebuffer_width=1280framebuffer_height=720

Page 46: A Importância do JavaFX no Mercado Embedded

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13

Exiting a JavaFX Application on Raspberry.Pi

Connect over SSH and kill the java process

$ killall -9 java

Enable the debug environment variable to enable control-C exit command

$ export JAVA_DEBUG=1$ java -cp Stopwatch.jar stopwatch.MainScreen

Page 47: A Importância do JavaFX no Mercado Embedded

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13

Final parameters for JavaFX on Raspy

Do not show virtual keyboard (optional)-Dcom.sun.javafx.isEmbedded=false

Send video to the framebuffer (required!)-Djavafx.platform=eglfb

Page 48: A Importância do JavaFX no Mercado Embedded

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13

Perguntas?

Page 49: A Importância do JavaFX no Mercado Embedded

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13

Obrigado!@brunoborges

Page 50: A Importância do JavaFX no Mercado Embedded

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13

The preceding is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract.It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, and timing of any features or functionality described for Oracle’s products remains at the sole discretion of Oracle.

Page 51: A Importância do JavaFX no Mercado Embedded

Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 13