flamingo: bringing the ribbon component to swing · under the hood > visual consistency across...

51
Flamingo: Bringing the Ribbon Component to Swing Kirill Grouchnikov Amdocs

Upload: others

Post on 11-Aug-2020

4 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Flamingo: Bringing the Ribbon Component to Swing · Under the hood > Visual consistency across LAFs > org.jvnet.flamingo.common.ui.BasicCommandButtonUI.paint ButtonBackground > Key

Flamingo: Bringing the Ribbon Component to SwingKirill GrouchnikovAmdocs

Page 2: Flamingo: Bringing the Ribbon Component to Swing · Under the hood > Visual consistency across LAFs > org.jvnet.flamingo.common.ui.BasicCommandButtonUI.paint ButtonBackground > Key

2

Agenda> What is a ribbon?> Swing ribbon implementation> Swing ribbon structure

Basic terminology Command buttons Ribbon bands Ribbon tasks Miscellaneous

> Where to next?

Page 3: Flamingo: Bringing the Ribbon Component to Swing · Under the hood > Visual consistency across LAFs > org.jvnet.flamingo.common.ui.BasicCommandButtonUI.paint ButtonBackground > Key

What is a ribbon?

3

Page 4: Flamingo: Bringing the Ribbon Component to Swing · Under the hood > Visual consistency across LAFs > org.jvnet.flamingo.common.ui.BasicCommandButtonUI.paint ButtonBackground > Key

4

Ribbon demo

Page 5: Flamingo: Bringing the Ribbon Component to Swing · Under the hood > Visual consistency across LAFs > org.jvnet.flamingo.common.ui.BasicCommandButtonUI.paint ButtonBackground > Key

5

http://blogs.msdn.com/jensenh

Page 6: Flamingo: Bringing the Ribbon Component to Swing · Under the hood > Visual consistency across LAFs > org.jvnet.flamingo.common.ui.BasicCommandButtonUI.paint ButtonBackground > Key

Ribbon availability

6

> Available for WinForms, Win32, WPF, Silverlight> Third-party vendors

> Microsoft – WPF 3.5, Windows 7 (scenic ribbon)

Page 7: Flamingo: Bringing the Ribbon Component to Swing · Under the hood > Visual consistency across LAFs > org.jvnet.flamingo.common.ui.BasicCommandButtonUI.paint ButtonBackground > Key

Ribbon for Swing applications

7

Metal

A03

Looks Plastic XP

Nimbus

Page 8: Flamingo: Bringing the Ribbon Component to Swing · Under the hood > Visual consistency across LAFs > org.jvnet.flamingo.common.ui.BasicCommandButtonUI.paint ButtonBackground > Key

Ribbon for Swing applications

8

Office Blue 2007

AutumnRaven Graphite

NebulaCreme

Office Silver 2007

Page 9: Flamingo: Bringing the Ribbon Component to Swing · Under the hood > Visual consistency across LAFs > org.jvnet.flamingo.common.ui.BasicCommandButtonUI.paint ButtonBackground > Key

Ribbon for Swing applications

9

Black Moon

Sky Metallic

Mauve MetallicBlue Moon

Orange Metallic

Blue Ice

Page 10: Flamingo: Bringing the Ribbon Component to Swing · Under the hood > Visual consistency across LAFs > org.jvnet.flamingo.common.ui.BasicCommandButtonUI.paint ButtonBackground > Key

Ribbon for Swing applications

10

http://flamingo.dev.java.net

Page 11: Flamingo: Bringing the Ribbon Component to Swing · Under the hood > Visual consistency across LAFs > org.jvnet.flamingo.common.ui.BasicCommandButtonUI.paint ButtonBackground > Key

Basic ribbon terminology

11

Application menu button

Taskbar panel Contextual ribbon task Help button

Ribbon gallery

Contextual ribbon task groupRibbon task

Ribbon band Ribbon band expand button

Page 12: Flamingo: Bringing the Ribbon Component to Swing · Under the hood > Visual consistency across LAFs > org.jvnet.flamingo.common.ui.BasicCommandButtonUI.paint ButtonBackground > Key

Basic hierarchy> Ribbon

Contains tasks Containing bands

> JRibbon RibbonTask

AbstractRibbonBand

12

Ribbon task

Ribbon band

Page 13: Flamingo: Bringing the Ribbon Component to Swing · Under the hood > Visual consistency across LAFs > org.jvnet.flamingo.common.ui.BasicCommandButtonUI.paint ButtonBackground > Key

Basic building block

13

Command buttons

Page 14: Flamingo: Bringing the Ribbon Component to Swing · Under the hood > Visual consistency across LAFs > org.jvnet.flamingo.common.ui.BasicCommandButtonUI.paint ButtonBackground > Key

Command buttons> AbstractCommandButton

JCommandButton JCommandToggleButton

14

Page 15: Flamingo: Bringing the Ribbon Component to Swing · Under the hood > Visual consistency across LAFs > org.jvnet.flamingo.common.ui.BasicCommandButtonUI.paint ButtonBackground > Key

15

Command buttons demo

Page 16: Flamingo: Bringing the Ribbon Component to Swing · Under the hood > Visual consistency across LAFs > org.jvnet.flamingo.common.ui.BasicCommandButtonUI.paint ButtonBackground > Key

Display state

AbstractCommandButton.setDisplayState(CommandButtonDisplayState)

16

BIG TILE MEDIUM

SMALL

Page 17: Flamingo: Bringing the Ribbon Component to Swing · Under the hood > Visual consistency across LAFs > org.jvnet.flamingo.common.ui.BasicCommandButtonUI.paint ButtonBackground > Key

Action and popup areas

17

JCommandButton.setCommandButtonKind(CommandButtonKind)

ACTION_ONLY POPUP_ONLYACTION_AND_POPUP_MAIN_ACTION

ACTION_AND_POPUP_MAIN_POPUP

ActionButtonModel AbstractCommandButton.getActionModel()PopupButtonModel JCommandButton.getPopupModel()

Page 18: Flamingo: Bringing the Ribbon Component to Swing · Under the hood > Visual consistency across LAFs > org.jvnet.flamingo.common.ui.BasicCommandButtonUI.paint ButtonBackground > Key

Simple popups

18

JCommandButton.setPopupCallback(PopupPanelCallback)JCommandButton button = ...;button.setPopupCallback(new PopupPanelCallback() {

public JPopupPanel getPopupPanel(JCommandButton commandButton) {

JCommandPopupMenu menu = new JCommandPopupMenu();

menu.addMenuButton(...);menu.addMenuSeparator();...return menu;

}});

Page 19: Flamingo: Bringing the Ribbon Component to Swing · Under the hood > Visual consistency across LAFs > org.jvnet.flamingo.common.ui.BasicCommandButtonUI.paint ButtonBackground > Key

Command button strips

JCommandButtonStrip

19

HORIZONTAL VERTICAL

Page 20: Flamingo: Bringing the Ribbon Component to Swing · Under the hood > Visual consistency across LAFs > org.jvnet.flamingo.common.ui.BasicCommandButtonUI.paint ButtonBackground > Key

Command button panels

JCommandButtonPanel

20

ROW_FILL COLUMN_FILL

Page 21: Flamingo: Bringing the Ribbon Component to Swing · Under the hood > Visual consistency across LAFs > org.jvnet.flamingo.common.ui.BasicCommandButtonUI.paint ButtonBackground > Key

Rich popups

21

JCommandButton button = ...;button.setPopupCallback(new PopupPanelCallback() {

public JPopupPanel getPopupPanel(JCommandButton commandButton) {

JCommandButtonPanel panel = new JCommandButtonPanel(...);

panel.addButtonGroup(...);panel.addButtonToGroup(...);...JCommandPopupMenu menu =

new JCommandPopupMenu(panel,maxColumns, maxRows);

...return menu;

}});

Page 22: Flamingo: Bringing the Ribbon Component to Swing · Under the hood > Visual consistency across LAFs > org.jvnet.flamingo.common.ui.BasicCommandButtonUI.paint ButtonBackground > Key

22

Bands / tasks demo

Page 23: Flamingo: Bringing the Ribbon Component to Swing · Under the hood > Visual consistency across LAFs > org.jvnet.flamingo.common.ui.BasicCommandButtonUI.paint ButtonBackground > Key

Ribbon bands

> AbstractRibbonBand JRibbonBand JFlowRibbonBand

23

Ribbon band Ribbon band Flow ribbon band Ribbon band

Page 24: Flamingo: Bringing the Ribbon Component to Swing · Under the hood > Visual consistency across LAFs > org.jvnet.flamingo.common.ui.BasicCommandButtonUI.paint ButtonBackground > Key

Flow ribbon bandsJFlowRibbonBand

Adding content:addFlowComponent(JComponent)

24

Two row flowing content

Three row flowing content

Collapsed

Page 25: Flamingo: Bringing the Ribbon Component to Swing · Under the hood > Visual consistency across LAFs > org.jvnet.flamingo.common.ui.BasicCommandButtonUI.paint ButtonBackground > Key

Regular ribbon bandsJRibbonBand

Can host:> command buttons> wrapped core / 3rd party components> ribbon galleries

25

Page 26: Flamingo: Bringing the Ribbon Component to Swing · Under the hood > Visual consistency across LAFs > org.jvnet.flamingo.common.ui.BasicCommandButtonUI.paint ButtonBackground > Key

Hosting command buttons

26

JRibbonBand clipboardBand = new JRibbonBand(“Clipboard”, ...);

JCommandButton pasteButton = new JCommandButton(“Paste”, pasteIcon);

pasteButton.setCommandButtonKind(CommandButtonKind.ACTION_AND_POPUP_MAIN_ACTION);

pasteButton.setPopupCallback(...);clipboardBand.addCommandButton(pasteButton,

RibbonElementPriority.TOP);

...

clipboardBand.addCommandButton(cutButton,RibbonElementPriority.MEDIUM);

Page 27: Flamingo: Bringing the Ribbon Component to Swing · Under the hood > Visual consistency across LAFs > org.jvnet.flamingo.common.ui.BasicCommandButtonUI.paint ButtonBackground > Key

Hosting core and 3rd party controls

27

Simple wrapping Wrapping with icon and caption

Wrapped components spanning multiple rows

Page 28: Flamingo: Bringing the Ribbon Component to Swing · Under the hood > Visual consistency across LAFs > org.jvnet.flamingo.common.ui.BasicCommandButtonUI.paint ButtonBackground > Key

Ribbon galleries

28

Expanded gallery shown in a popup

Expanded gallery scrolled down

Hosted gallery scrolled down

Hosted gallery

Page 29: Flamingo: Bringing the Ribbon Component to Swing · Under the hood > Visual consistency across LAFs > org.jvnet.flamingo.common.ui.BasicCommandButtonUI.paint ButtonBackground > Key

Groups in ribbon bands

29

Two unnamed groups with

command buttons

Three unnamed groups with

command buttons

Two named groups with wrapped core

components

Page 30: Flamingo: Bringing the Ribbon Component to Swing · Under the hood > Visual consistency across LAFs > org.jvnet.flamingo.common.ui.BasicCommandButtonUI.paint ButtonBackground > Key

Ribbon tasks

30

new RibbonTask(title,AbstractRibbonBand... bands)

JRibbon.addTask(RibbonTask)

Ribbon task Ribbon task Ribbon taskRibbon task Ribbon task

Page 31: Flamingo: Bringing the Ribbon Component to Swing · Under the hood > Visual consistency across LAFs > org.jvnet.flamingo.common.ui.BasicCommandButtonUI.paint ButtonBackground > Key

Contextual task groups

31

Contextual ribbon task

Contextual ribbon task group Contextual ribbon task group

Selected contextual ribbon task

Page 32: Flamingo: Bringing the Ribbon Component to Swing · Under the hood > Visual consistency across LAFs > org.jvnet.flamingo.common.ui.BasicCommandButtonUI.paint ButtonBackground > Key

32

Menu button / taskbar demo

Page 33: Flamingo: Bringing the Ribbon Component to Swing · Under the hood > Visual consistency across LAFs > org.jvnet.flamingo.common.ui.BasicCommandButtonUI.paint ButtonBackground > Key

Application menu button

33

Application menu button

Page 34: Flamingo: Bringing the Ribbon Component to Swing · Under the hood > Visual consistency across LAFs > org.jvnet.flamingo.common.ui.BasicCommandButtonUI.paint ButtonBackground > Key

Application menu

34

Primary menu group

Secondarymenu group

FooterJRibbon.setApplicationMenu(RibbonApplicationMenu)

Page 35: Flamingo: Bringing the Ribbon Component to Swing · Under the hood > Visual consistency across LAFs > org.jvnet.flamingo.common.ui.BasicCommandButtonUI.paint ButtonBackground > Key

Taskbar panel

35

Taskbar panel

JRibbon.addTaskbarComponent(Component)

Page 36: Flamingo: Bringing the Ribbon Component to Swing · Under the hood > Visual consistency across LAFs > org.jvnet.flamingo.common.ui.BasicCommandButtonUI.paint ButtonBackground > Key

36

Tooltips / key tips demo

Page 37: Flamingo: Bringing the Ribbon Component to Swing · Under the hood > Visual consistency across LAFs > org.jvnet.flamingo.common.ui.BasicCommandButtonUI.paint ButtonBackground > Key

Rich tooltips

37

Tooltip for the action area

Tooltip for the popup area

Displayed below the ribbon

Page 38: Flamingo: Bringing the Ribbon Component to Swing · Under the hood > Visual consistency across LAFs > org.jvnet.flamingo.common.ui.BasicCommandButtonUI.paint ButtonBackground > Key

Rich tooltips

38

Tooltip for wrapped core component

Multiple paragraphs

Tooltip for taskbar component Displayed below

the taskbar

Page 39: Flamingo: Bringing the Ribbon Component to Swing · Under the hood > Visual consistency across LAFs > org.jvnet.flamingo.common.ui.BasicCommandButtonUI.paint ButtonBackground > Key

Rich tooltips

39

Tooltip for application menu

button

Footer section and images

Page 40: Flamingo: Bringing the Ribbon Component to Swing · Under the hood > Visual consistency across LAFs > org.jvnet.flamingo.common.ui.BasicCommandButtonUI.paint ButtonBackground > Key

Key tips

40

Press Alt or F10 for the top chain

Showing key tips of the

selected task

Showing key tips of the selected

button

P V

Esc Esc

Page 41: Flamingo: Bringing the Ribbon Component to Swing · Under the hood > Visual consistency across LAFs > org.jvnet.flamingo.common.ui.BasicCommandButtonUI.paint ButtonBackground > Key

41

Resizing / minimized

demo

Page 42: Flamingo: Bringing the Ribbon Component to Swing · Under the hood > Visual consistency across LAFs > org.jvnet.flamingo.common.ui.BasicCommandButtonUI.paint ButtonBackground > Key

Ribbon resizing

42

Page 43: Flamingo: Bringing the Ribbon Component to Swing · Under the hood > Visual consistency across LAFs > org.jvnet.flamingo.common.ui.BasicCommandButtonUI.paint ButtonBackground > Key

Ribbon resizing, collapsing and scrolling

43

Expanding the collapsed ribbon

band

Scrolling tasks Scrolling bands

Page 44: Flamingo: Bringing the Ribbon Component to Swing · Under the hood > Visual consistency across LAFs > org.jvnet.flamingo.common.ui.BasicCommandButtonUI.paint ButtonBackground > Key

Minimized mode

44

JRibbon.setMinimized(true)User double-clicking a task buttonUser pressing Ctrl+F1

User clicking a task button

Page 45: Flamingo: Bringing the Ribbon Component to Swing · Under the hood > Visual consistency across LAFs > org.jvnet.flamingo.common.ui.BasicCommandButtonUI.paint ButtonBackground > Key

Big features recap> Ribbon regular and flow bands> Ribbon galleries> Ribbon tasks and contextual task groups> Application menu button and taskbar panel> Resizing, collapsing and scrolling> Rich tooltips and key tips> Minimized mode

45

Page 46: Flamingo: Bringing the Ribbon Component to Swing · Under the hood > Visual consistency across LAFs > org.jvnet.flamingo.common.ui.BasicCommandButtonUI.paint ButtonBackground > Key

Under the hood> Visual consistency across LAFs

> org.jvnet.flamingo.common.ui.BasicCommandButtonUI.paintButtonBackground

> Key tips> org.jvnet.flamingo.ribbon.JRibbonFrame.KeyTipLayer

> Placing content in the title pane> org.jvnet.substance.flamingo.ribbon.ui.SubstanceRibbonF

rameTitlePane> More in the code…

46

Page 47: Flamingo: Bringing the Ribbon Component to Swing · Under the hood > Visual consistency across LAFs > org.jvnet.flamingo.common.ui.BasicCommandButtonUI.paint ButtonBackground > Key

What is missing - small> Hosting small buttons in galleries> Resizing popup panels> Navigating with keyboard (arrows, tabs)> Dragging controls to the taskbar panel> Hosting taskbar panel below the ribbon

47

Page 48: Flamingo: Bringing the Ribbon Component to Swing · Under the hood > Visual consistency across LAFs > org.jvnet.flamingo.common.ui.BasicCommandButtonUI.paint ButtonBackground > Key

What is missing - medium> Right-to-left support> High DPI support

48

Page 49: Flamingo: Bringing the Ribbon Component to Swing · Under the hood > Visual consistency across LAFs > org.jvnet.flamingo.common.ui.BasicCommandButtonUI.paint ButtonBackground > Key

Potentially useful> XML-driven ribbon content> SWT version> World domination

49

Page 50: Flamingo: Bringing the Ribbon Component to Swing · Under the hood > Visual consistency across LAFs > org.jvnet.flamingo.common.ui.BasicCommandButtonUI.paint ButtonBackground > Key

Try it now!

50

http://flamingo.dev.java.net

Page 51: Flamingo: Bringing the Ribbon Component to Swing · Under the hood > Visual consistency across LAFs > org.jvnet.flamingo.common.ui.BasicCommandButtonUI.paint ButtonBackground > Key

51

Kirill [email protected]

http://flamingo.dev.java.nethttp://www.pushing-pixels.org