JSR377 What's up and what's next Andres Almiray - @aalmiray Canoo - - PowerPoint PPT Presentation

jsr377 what s up and what s next
SMART_READER_LITE
LIVE PREVIEW

JSR377 What's up and what's next Andres Almiray - @aalmiray Canoo - - PowerPoint PPT Presentation

JSR377 What's up and what's next Andres Almiray - @aalmiray Canoo Engineering AG #JSR377 - @aalmiray PREVIOUS ATTEMPTS JSR 193 Client Side Container JSR 296 Swing Application Framework JSR 295 Beans Binding JSR 296 had the


slide-1
SLIDE 1

JSR377 What's up and what's next

Andres Almiray - @aalmiray Canoo Engineering AG

slide-2
SLIDE 2

#JSR377 - @aalmiray

slide-3
SLIDE 3

#JSR377 - @aalmiray

PREVIOUS ATTEMPTS

JSR 193 – Client Side Container JSR 296 – Swing Application Framework JSR 295 – Beans Binding JSR 296 had the following goals: application life cycle localized resources (and injection) persisted session state loosely coupled actions targeted only Swing for obvious reasons

slide-4
SLIDE 4

#JSR377 - @aalmiray

WHICH UI TOOLKIT?

slide-5
SLIDE 5

#JSR377 - @aalmiray

https://en.wikipedia.org/wiki/File:Raspberry_Pi_2_Model_B_v1.1_top_new_%28bg_cut_out%29.jpg

slide-6
SLIDE 6

#JSR377 - @aalmiray

WHAT’S OUT THERE

Eclipse 4 Platform, NetBeans Griffon, Basilisk, Gluon Particle, DataFX, JacpFX, MvvmFX, JVx, JRebirth, and more ...

slide-7
SLIDE 7

#JSR377 - @aalmiray

COMMON FEATURES

Many of the listed frameworks offer the following capabilities implemented in different ways:

dependency injection event system centralized error management extension points via plugins application life cycle localized resources (and injection) persisted session state loosely coupled actions

slide-8
SLIDE 8

#JSR377 - @aalmiray

TARGET ENVIRONMENT

All of the listed frameworks support the Desktop as target environment. Only a few can be used in an Embedded environment (where Java SE is supported). Embedded Java UI applications can be built as applications that target the Desktop; even share their codebase.

slide-9
SLIDE 9

#JSR377 - @aalmiray

GOALS

Target Desktop and Embedded environments Support several toolkits Be an standalone JSR, i.e, no need to include it in the JDK Leverage existing JSRs: JSR 330 – Dependency Injection JSR 365 – Event bus (from CDI 2.0 ?)

slide-10
SLIDE 10

#JSR377 - @aalmiray

CORE FEATURES

dependency injection event system centralized error management extension points via plugins application life cycle localized resources (and injection) configuration loosely coupled actions MVC artifacts

slide-11
SLIDE 11

#JSR377 - @aalmiray

OUT OF SCOPE V1

Buildtime: test support deployment Runtime: persisted session state artifact introspection API UI toolkit updates

slide-12
SLIDE 12

#JSR377 - @aalmiray

API

slide-13
SLIDE 13

#JSR377 - @aalmiray

Application Phases

package ¡javax.application; ¡ public ¡enum ¡ApplicationPhase ¡{ ¡ ¡ ¡ ¡ ¡INITIALIZE, ¡ ¡ ¡ ¡ ¡STARTUP, ¡ ¡ ¡ ¡ ¡READY, ¡ ¡ ¡ ¡ ¡MAIN, ¡ ¡ ¡ ¡ ¡SHUTDOWN ¡ }

slide-14
SLIDE 14

#JSR377 - @aalmiray

Application Lifecycle

package ¡javax.application; ¡ public ¡interface ¡Application ¡{ ¡ ¡ ¡ ¡ ¡void ¡initialize(); ¡ ¡ ¡ ¡ ¡void ¡startup(); ¡ ¡ ¡ ¡ ¡void ¡ready(); ¡ ¡ ¡ ¡ ¡ExitState ¡shutdown(); ¡ ¡ ¡ ¡ ¡boolean ¡canShutdown(); ¡ ¡ ¡ ¡ ¡void ¡addShutdownHandler(@Nonnull ¡ShutdownHandler ¡handler); ¡ ¡ ¡ ¡ ¡void ¡removeShutdownHandler(@Nonnull ¡ShutdownHandler ¡handler); ¡ }

slide-15
SLIDE 15

#JSR377 - @aalmiray

Application Lifecycle

package ¡javax.application; ¡ public ¡interface ¡ExitState ¡{ ¡ ¡ ¡ ¡ ¡int ¡exitCode(); ¡ ¡ ¡ ¡ ¡boolean ¡canShutdown(); ¡ } package ¡javax.application; ¡ public ¡interface ¡ShutdownHandler ¡{ ¡ ¡ ¡ ¡ ¡boolean ¡canShutdown(Application ¡application); ¡ ¡ ¡ ¡ ¡void ¡onShutdown(Application ¡application); ¡ }

slide-16
SLIDE 16

#JSR377 - @aalmiray

Application Properties

package ¡javax.application; ¡ public ¡interface ¡Application ¡{ ¡ ¡ ¡ ¡ ¡Configuration ¡getConfiguration(); ¡ ¡ ¡ ¡ ¡ApplicationPhase ¡getPhase(); ¡ ¡ ¡ ¡ ¡Locale ¡getLocale(); ¡ ¡ ¡ ¡ ¡String[] ¡getStartupArguments(); ¡ ¡ ¡ ¡ ¡. ¡. ¡. ¡ }

slide-17
SLIDE 17

#JSR377 - @aalmiray

UI Threading

Toolkit ¡ ¡| ¡isUIThread ¡| ¡runSync ¡| ¡RunAsync ¡ Swing ¡ ¡ ¡ ¡| ¡yes ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡| ¡yes ¡ ¡ ¡ ¡ ¡| ¡yes ¡ JavaFX ¡ ¡ ¡| ¡yes ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡| ¡no ¡ ¡ ¡ ¡ ¡ ¡| ¡yes ¡ SWT ¡ ¡ ¡ ¡ ¡ ¡| ¡yes ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡| ¡yes ¡ ¡ ¡ ¡ ¡| ¡yes ¡ Pivot ¡ ¡ ¡ ¡| ¡yes ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡| ¡yes ¡ ¡ ¡ ¡ ¡| ¡yes ¡ Lanterna ¡| ¡yes ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡| ¡yes ¡ ¡ ¡ ¡ ¡| ¡no

slide-18
SLIDE 18

#JSR377 - @aalmiray

UI Threading

package ¡javax.application; ¡ public ¡interface ¡ThreadingHandler ¡{ ¡ ¡ ¡ ¡ ¡boolean ¡isUIThread(); ¡ ¡ ¡ ¡ ¡void ¡runInsideUIAsync(Runnable ¡runnable); ¡ ¡ ¡ ¡ ¡void ¡runInsideUISync(Runnable ¡runnable); ¡ ¡ ¡ ¡ ¡<R> ¡R ¡runInsideUISync(Callable<R> ¡callable); ¡ ¡ ¡ ¡ ¡void ¡runOutsideUI(Runnable ¡runnable); ¡ }

slide-19
SLIDE 19

#JSR377 - @aalmiray

Internationalization

package ¡javax.application; ¡ public ¡interface ¡MessageSource ¡{ ¡ ¡ ¡ ¡ ¡String ¡getMessage(String ¡key) ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡throws ¡NoSuchMessageException; ¡ ¡ ¡ ¡ ¡String ¡getMessage(String ¡key, ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡String ¡defaultValue); ¡ }

Combined ¡arguments: ¡ ¡ (Object[] ¡/ ¡List), ¡ Locale

slide-20
SLIDE 20

#JSR377 - @aalmiray

Resource Injection (1)

package ¡javax.application; ¡ @Retention(RetentionPolicy.RUNTIME) ¡ @Target({ElementType.FIELD, ¡ElementType.METHOD}) ¡ public ¡@interface ¡InjectedResource ¡{ ¡ ¡ ¡ ¡ ¡String ¡key() ¡default ¡""; ¡ ¡ ¡ ¡ ¡String[] ¡args() ¡default ¡{}; ¡ ¡ ¡ ¡ ¡String ¡defaultValue() ¡default ¡""; ¡ ¡ ¡ ¡ ¡String ¡format() ¡default ¡""; ¡ }

slide-21
SLIDE 21

#JSR377 - @aalmiray

Resource Injection (2)

import ¡javax.application.InjectedResource; ¡ import ¡javafx.scene.paint.LinearGradient; ¡ public ¡class ¡SomeBean ¡{ ¡ ¡ ¡ ¡ ¡@InjectedResource ¡ ¡ ¡ ¡ ¡private ¡LinearGradient ¡gradient; ¡ }

slide-22
SLIDE 22

#JSR377 - @aalmiray

Resources

Desktop|Embedded Application API https://jcp.org/en/jsr/detail?id=377 https://github.com/jsr377/ http://jsr377.github.io/site/

slide-23
SLIDE 23

Thank you!

Andres Almiray - @aalmiray Canoo Engineering AG