desktop technology in mustang [email protected]

42
Desktop Technology in Mustang [email protected]

Upload: victoria-stone

Post on 12-Jan-2016

218 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Desktop Technology in Mustang ypshin@thinkfree.com

Desktop Technology in Mustang

[email protected]

Page 2: Desktop Technology in Mustang ypshin@thinkfree.com

Index

1. Mustang Milestone Releases2. Java 2D API in Mustang3. AWT Enhancements in Mustang4. I18N in Mustang5. Deployment in Mustang6. JFC/Swing in Mustang7. Mustang Other8. Dolphin

Page 3: Desktop Technology in Mustang ypshin@thinkfree.com

Milestone Releases

1.4.0 Merlin 2002/2/13

1.4.1 Hopper 2002/10/16

1.4.2 Mantis 2003/5/29

5.0 Tiger 2004/9/30

6 Mustang 2006/10

7 Dolphin 2008/H2

Page 4: Desktop Technology in Mustang ypshin@thinkfree.com

Mustang Milestone Releases

Beta1 2006/02/16

Beta2 2006/06/15

Release Candidate 2006/09

Final Release (FCS) 2006/10

Page 5: Desktop Technology in Mustang ypshin@thinkfree.com

Java 2D API in Mustang• Sub-pixel text, aka LCD text• LinearGradientPaint, RadialGradientPaint• Faster ImageIO image loading• Better small curve quality• More Mustang 2D features, not covered here• Improved OpenGL® pipeline performance• Linux fullscreen support• New Image I/O plugin: GIF writer• New applet animatio

Page 6: Desktop Technology in Mustang ypshin@thinkfree.com

Sub-Pixel Text

• Plain

• Antialiased

• Sub-pixel

Page 7: Desktop Technology in Mustang ypshin@thinkfree.com

Sub-Pixel Text: Details

http://today.java.net/pub/a/today/2005/07/26/lcdtext.html

Plain: Anti-Aliased:

Sub-Pixel:

Page 8: Desktop Technology in Mustang ypshin@thinkfree.com

Sub-Pixel Text: How-To

• In most cases, it will just work• Swing picks up desktop and font settings• Standard components will use same font rendering

properties as native applications• Custom components/rendering

• java.awt.RenderingHints.KEY_TEXT_ANTIALIASING• In settings where desktop properties do not exist

(e.g., Windows 2000)• -Dawt.useSystemAAFontSettings=lcd

Page 9: Desktop Technology in Mustang ypshin@thinkfree.com

New: MultipleGradientPaint

• Abstract for gradients with multiple colors• Superclass for gradients below

• CycleMethod for areas outside endpoints• NO_CYCLE: Extend color at endpoints outside

area• REFLECT: start-end, end-start• REPEAT: start-end, start-end

Page 10: Desktop Technology in Mustang ypshin@thinkfree.com

New: LinearGradientPaint

• Values from 0-1 determine where colors change• Colors for each of those values• Start and end points on Shape• CycleMethod

Page 11: Desktop Technology in Mustang ypshin@thinkfree.com

New: LinearGradientPaintPoint2D start = new Point2D.Float(0, 0);Point2D end = new Point2D.Float(getWidth(), 0);float[] dist = {0.0f, 0.2f, 1.0f};Color[] colors = {Color.RED, Color.WHITE, Color.BLUE};LinearGradientPaint p = new LinearGradientPaint(start, end, dist, colors);g2d.setPaint(p);g2d.fillRect(0, 0, getWidth(), getHeight());

Page 12: Desktop Technology in Mustang ypshin@thinkfree.com

New: RadialGradientPaintPoint2D center = new Point2D.Float(50, 50);float radius = 25;float[] dist = {0.0f, 0.2f, 1.0f};Color[] colors = {Color.RED, Color.WHITE, Color.BLUE};RadialGradientPaint p = new RadialGradientPaint(center, radius,dist, colors);

Page 13: Desktop Technology in Mustang ypshin@thinkfree.com

ImageIO Performance Improvements

http://weblogs.java.net/blog/campbell/archive/2006/01/

Page 14: Desktop Technology in Mustang ypshin@thinkfree.com

Better Curve Quality

Tiger

Mustang

Page 15: Desktop Technology in Mustang ypshin@thinkfree.com

AWT Enhancements in Mustang

• Major enhancements• Tray icon (Based on JDIC)• Splash screen• Desktop class (Based on JDIC)

• Other changes• Focus• Top levels• Text input• Modality enhancements and API

• Stability

Page 16: Desktop Technology in Mustang ypshin@thinkfree.com

Tray Icon : Usage

// Construct a TrayIconTrayIcon trayIcon = new TrayIcon(image, "Tray Demo",popup);

// Set the TrayIcon propertiestrayIcon.addActionListener(actionListener);

// add the tray iconSystemTray.getSystemTray().add(trayIcon);

Page 17: Desktop Technology in Mustang ypshin@thinkfree.com

Splash Screen

• Allows displaying a splash screen before the JVM software start• GIF, PNG and JPEG images supported• Transparency, translucency and

animation supported• Closed automatically on first top-level

window display

Page 18: Desktop Technology in Mustang ypshin@thinkfree.com

Splash Screen : Usage

• Display from command line java -splash:image.gif TheApp

• Display from MANIFEST.MF Splashscreen-Image: image.gif

• Painting SplashScreen splash = SplashScreen.getSplashScreen(); Graphics2D g = splash.createGraphics(); // your painting code here splash.update();

Page 19: Desktop Technology in Mustang ypshin@thinkfree.com

Desktop Classpackage java.awt;public class Desktop { static boolean isDesktopSupported(); static Desktop getDesktop(); boolean isSupported(Desktop.Action action); void open(File file); void edit(File file); void print(File file); void browse(Url url); void mail(); void mail(URI mailtoURI);}

Page 20: Desktop Technology in Mustang ypshin@thinkfree.com

I18N in Mustang

• Locale Sensitive Services SPI• ResourceBundle enhancements

• Flexible ResourceBundle loading and cache control

• Normalizer API• A new API set that conforms to the Unicode St

andard (Annex #15)• Japanese calendar support

Page 21: Desktop Technology in Mustang ypshin@thinkfree.com

Locale Sensitive Services SPI

• Provides SPIs for the java.text and java.util packages

• SPIs conform to the standard Java• Extension Mechanism• SPI Providers can

• Offer their own locale sensitive service implementations for locales that the JRE does not support

• Provide localized names for locales that the JRE currently does not provide

Page 22: Desktop Technology in Mustang ypshin@thinkfree.com

SPI Example// Date Format exampleDateFormat df = DateFormat.getDateInstance(PigLatinLocale);Date today = new Date();System.out.println(df.format(today));

// Locale name exampleString name = Locale.US.getDisplayName(PigLatinLocale);System.out.println(name);

Output:“Uesdaytay, Aymay 16, 2006”“Englishway (Unitedway Atesstay)”

Page 23: Desktop Technology in Mustang ypshin@thinkfree.com

Deployment in Mustang

• Deployment toolkit for browsers• JRE detection, JRE deployment, and JNLP

application launching from the browsers

• Unified download engine for Java Web Start and Java Plug-in software• Improve download and caching support• JAR indexing, HTTP compression, HTTP cache

control, offline support, flexible update policy, CD install,…

• Java technology cache viewer

Page 24: Desktop Technology in Mustang ypshin@thinkfree.com

Deployment in Mustang

• Improve user experience in Java Web Start and Java Plug-in software

• Improve user experience in JDK/JRE software installer• Improve security

• Certificate validation—OCSP and CRL• Password protected keystore• Save password option for login

Page 25: Desktop Technology in Mustang ypshin@thinkfree.com

Deployment in Mustang

• Improve desktop integration• ICO support• PNG support• Better Windows and GNOME shell integration

• Complete Firefox browser support• Automatic proxy detection with WPAD• Default Java technology on Linux• Direct execution of JAR files on Linux

Page 26: Desktop Technology in Mustang ypshin@thinkfree.com

JFC/Swing in Mustang• Enhanced and improved platform look and feels• SwingWorker• Layout enhancements

• Including GroupLayout—basis for Matisse• Drag and drop enhancements• True double buffering• Text printing• JTable sorting and filtering• Tabs as components

Page 27: Desktop Technology in Mustang ypshin@thinkfree.com

Enhanced and improved platform look and feels

GTK Glacier ThemeGTK Crux ThemeVista 6Vista 5.0

Page 28: Desktop Technology in Mustang ypshin@thinkfree.com

SwingWorker

• Makes it easy to offload work to separate thread

• Makes use of concurrency package• Generified• Supports partial results• Supports PropertyChangeListener

Page 29: Desktop Technology in Mustang ypshin@thinkfree.com

Drag and Drop Enhancements

• Drag no longer requires selection to be made first!

• Specifying The Drop Mode• Enum: USE_SELECTION (old behavior), ON, IN

SERT, ON_OR_INSERT…• Implemented on JTree, JList, Jtable and JTextC

omponent• Determining Legal Drop Location

Page 30: Desktop Technology in Mustang ypshin@thinkfree.com

Specifying The Drop Mode

// Install TransferHandlertable.setTransferHandler(new TreeTransferHandler());

// Configure how the table determines drop locations// and provides drag over feedback.table.setDropMode(DropMode.ON);

Page 31: Desktop Technology in Mustang ypshin@thinkfree.com

Determining Legal Drop Location

class TreeTransferHandler extends TransferHandler { // Called repeatedly during drag and drop. Passed in // object is queryable for dnd information. public boolean canImport(TransferSupport ts) { if (ts.isDrop() && ts.isDataFlavorSupported(FILE_F)) { JTree.DropLocation dropLocation =

(JTree.DropLocation)ts.getDropLocation(); // Get the path the mouse is over TreePath pathOver = dropLocation.getPath(); if (validPath(pathOver)) { // If the path the mouse is over is valid for the // specified files, return true. return true; } } return false; }}

Page 32: Desktop Technology in Mustang ypshin@thinkfree.com

Processing Dropclass TreeTransferHandler extends TransferHandler { // Called to accept the drop (or paste). public boolean importData(TransferSupport ts) { if (canImport(ts)) { JTree.DropLocation dropLocation = (JTree.DropLocation)ts.getDropLocation(); // Get the path the user dropped over TreePath pathOver = dropLocation.getPath(); // Extract the files from the Transferable List<File> files = getFiles(ts.getTransferable()); processDrop(files, pathOver); return true; } return false; }}

Page 33: Desktop Technology in Mustang ypshin@thinkfree.com

JTable Sorting and Filtering

• Add sorting to your JTable with one method call• setAutoCreateRowSorter(true)

• Ability to specify your own Comparators• Also supports secondary, tertiary sort columns• Can specify a filter to limit what is shown

• Regular expression, number and date implementations provided

Page 34: Desktop Technology in Mustang ypshin@thinkfree.com

JTable SortingTableRowSorter rowSorter = new TableRowSorter(model);

// Using a different ComparatorrowSorter.setComparator(0, new FileNameComparator());

// Sort the contents on the first columnrowSorter.setSortKeys(Arrays.asList(

new SortKey(0, SortOrder.ASCENDING)));// Install the RowSorter.// If you don't need to customize the RowSorter, use// JTable.setAutoCreateRowSorter(true);table.setRowSorter(rowSorter);

Page 35: Desktop Technology in Mustang ypshin@thinkfree.com

Mustang Other Interest

• JConsole plugin API• Class-path wildcards• Free disk-space API• Password prompting• javax.swing.GroupLayout• JAX-WS can do RESTful web services

Page 36: Desktop Technology in Mustang ypshin@thinkfree.com

Apache Derby in Mustang

• Derby: A small-footprint standards-based embedded relational database engine

• Will be co-bundled in Sun’s Mustang JDK• Will not be in the JRE (it’s too big)• Is not a required part of the Java SE 6

specification

• Will implement all the new JDBC 4.0 software features

http://db.apache.org/derby

Page 37: Desktop Technology in Mustang ypshin@thinkfree.com

Language Changes in Dolphin

• Property support• Language for getFoo()/setFoo() pattern

• Method References• addActionListener(reference updateList)

• Block Closures• Native XML Support

Page 38: Desktop Technology in Mustang ypshin@thinkfree.com

Dolphin Scripting Languages

• Turbo-charging scripting engines• ‘The Beanshell Scripting Language’ (JSR 2

74) • Bundling more scripting engines

Page 39: Desktop Technology in Mustang ypshin@thinkfree.com

Dolphin Modules

Page 40: Desktop Technology in Mustang ypshin@thinkfree.com

Dolphin Modules

super package org.foo.document { // super-package exports: export org.foo.pictures.MyImageInterface; export org.foo.text.*;

// super-package members: org.foo.pictures.MyImageInterface; org.foo.text.* org.foo.raw.data.*;}

Page 41: Desktop Technology in Mustang ypshin@thinkfree.com

Dolphin Swing Development

‘Beans Binding’ (JSR 295)TS-1594: Best Practices: Data Binding

‘Swing Application Framework’ (JSR 296)TS-3399: A Simple Framework for Swing...