<<

32_094591 bindex.qxd10/21/042:55PMPage495 adding actions 10 JFace, action mechanism, 10 Acrobat Reader, 43 changes, accommodation, 33 resource-basedobjects, accessory accessing AbstractTreeViewer AbstractTextEditor AbstractDocument Abstract WindowToolkit (AWT) A wizard pageswith 207–210 , 164 157, lists, items, 164 157, combos, items, 490–493 drag-and-drop support, 225–229 data intable, 207 controls totoolbar, 472–473 Draw2D, connections, 216–221 using, 480–484 216–219, creating, 216–219 about, 396–397 wizard pages, 203 ToolItems, 180 text information, 296–297 TabIeItems, 69 operating systeminformation, 163–165 items inlists, 156–158 items incombos, 9 widgets, 4 1.1, version 4 1.0, version 4 impedance matching, 4 components, 4 architecture, 23 APIs, 4–5 3, about, addPages() 409–410 ,

COPYRIGHTED ,44MATERIAL 412 , 395 , dacddaigtcnqe,318–320 advanced drawing techniques, 141–143 adjacent sideofanothercontrollayouts, addPages adding filters uoaial asn Rs cis om,436–437 eclipseforms, URLs, automatically parsing attaching asyncExec 311–313 arcs drawing, 4 AWT, architecture, application 32 9, Application ProgramInterfaces(APIs), application modeldata 4 applets, 181 appending text, 13 AIX, ufrn,dul,320 double, buffering, 298–305 browsers, 8 Borland, 11 bmp files, 11 bitmap files, 193–194 bar menus, background color, B re,256–267 trees, 243–244 tables, 171 lists, 171 combos, oto oaohrcnrllyus 141–143 control toanotherlayouts, control positioninparentcompositelayouts, 141–143 adjacent sideofanothercontrollayouts, 479–480 creating, 486–489 contents, 15–16 SWT, 15–16 JFace, 15–16 creating, 139–141 395 , 74–75 , TableItem 226–228 , Index

Index 32_094591 bindex.qxd 10/21/04 2:55 PM Page 496

building

building dragStart(), 334 combos, 154–156 drop(), 338 lists and capturing item selections, 160–163 DropTargetListener, 336–337 skeleton application, 479–489 getting data, 348–349 tree up with MVC approach, 17–18 putting data on, 347–348 tree up with traditional approach, 16–17 using, 347–349 , 4, 20, 27 using , 331–347 button1,33 clipping, SWT, 318–319 button2,33 coding SWT program, 51–53 Button peer widget, 21 ColdFusion MX, 18 ButtonPeer, 20–21 Color, 28, 31 color, background, 226–228 ColorDialogs, 262–266 C column-wise sorting using sorters, 242–243 C++, 18 ColumnLayouts, 442–443 cancel processing with performCancel(), 396 combos Canvas, 4, 310 about, 153 capturing accessing items, 156–158, 163–165 events, 168–171 adding filters, 171 events with Draw2D, 473–474 adding items, 157, 164 item selections, 154–156 building and capturing item selections, 154–156 modification events, 183 building lists and capturing item selections, 160–163 CCombo class, 159 capturing events and getting selections, cell editors, setting, 239–242 168–171 centering control on another control, 143 CCombo class, 159 changes, accommodation, 43 creating domain-specific model objects, ,4 165–166 CheckboxTableViewer,45 creating ListViewer, 166–167 CheckboxTreeViewer,45 creating with sorted list, 158–159 children finding items, 156–157, 164 disposing of parent disposes, 32–33 getting items, 156, 163 laying out of composite, 121–122 lists, 154–159 resizing SashForm, 292–293 removing items, 157–158, 164–165 Choice,4 setting content provider and content, 167 clipboard setting items, 156, 163 about, 331 setting provider, 168 adding drag-and-drop support, 345–347 setting sorter, 172 bookmark organizer, 338–347 single and multi selection lists, 159 constructing UI, 339–343 with sorted list, 158–159 creating custom transfer type, 343–345 styles, 153–154 creating drag sources, 332–335 updating/refreshing viewer, 172–175 creating drop targets, 335–338 using, 154–159 dragAccept(), 338 using lists, 159–165 dragEnter(), 337 using ListViewers, 165–175 dragFinished(), 335 components, JFace, 10 dragLeave(), 338 composite dragOperationChanged(), 338 attaching control position in parent composite layouts, dragOver(), 338 139–141 dragSetData(), 335 children, laying out of composite, 121–122

496 32_094591 bindex.qxd 10/21/04 2:55 PM Page 497

DisposeListener Index Composite dialogs about, 32 about, 261–262 class, 98–103 ColorDialogs, 262–266 focus traversal, 99–102 creating, 272–274 layout, 99 DialogSettings, 403 styles, 98–99 DirectoryDialogs, 266–270 composite1, 34–36 file selection , 5 composite2,34 file selection dialog user interfaces, 6–7 configuring FileDialogs, 266–270 Eclipse, 48–50 FontDialogs, 262–266 IDEs, 49–51 IDialogSettings, 402 JBuilder, 50–51 InputDialogs, 384–385 connections, drawing diagrams with Draw2D, JFace, 10, 382–386 adding, 472–473 JFace wizards, 402–404 construct , 485 loading and saving dialog settings, 402–404 Container,4 MessageBoxes, 270–271 content assistance, providing, 418–422 MessageDialogs, 382–384 content provider ProgressMonitorDialogs, 385–386 about, 18 WizardDialog, 391–392, 401 setting, 238 DialogSettings, 402, 403 setting combos, 167 direct palettes, 322–323 setting trees, 254–255 DirectoryDialogs, 266–270 control position in parent composite layouts, Display, 28, 37 attaching, 139–141 displaying animation, 327–329 controller-related classes, 410–412 displays controllers accessing operating system information, 69 reuse, 43 asyncExec, 74–75 text editor creation with JFace Text, 409–412 event handling fundamentals, 67–71 controls event handling with displays, 69–71 adding to toolbar, 207 event model, 77–87 attaching to another, 141–143 events, listeners, and listener notification process, Controls,36 78–87 CoolBars, 210–212 multithreaded UI programming, 71–77 copying images, 314–316 multithreading with UI thread and non-UI threads, createControl, 400 71–77 custom editor, creation with JFace Text, 412–415 native event handling mechanism, 67–71 custom form controls, 432–440 SWT event handling, 68 customizing SWT time-consuming operation UI pattern, 74–77 eclipse forms, 431–432 syncExec, 75–76 TabItems, 297 thread-safe UI calls, 74–77 timerExec, 76–77 typed events and typed event listeners, 84–87 D untyped events and untyped event listeners, 81–84 data in table, adding, 225–229 use, 74–76 debugging dispose event,31 dispose, 30 dispose() method, 28–31 SWT, 27 disposed listener, 31 DefaultPartitioner, 410 DisposeListener, 34

497 32_094591 bindex.qxd 10/21/04 2:55 PM Page 498

disposing

disposing drop-down menus, 194 how to, 30 drop target, 331 if did not create, 31–32 of parent, 32–33 shell, 13–14 E when to, 30–31 Eclipse Forms Document, 409–410 about, 427–428 domain-specific model objects automatically parsing URLs, 436–437 combos, 165–166 basic form, 428–431 creating, 236–237 basic , 432–433 lists, 165–166 customizing, 431–432 double buffering, 320 ImageHyperlinks, 433–434 downloading SWT/JFace, 47–48 managing multiple hyperlinks with HyperlinkGroups, drag and drop 434–435 about, 331 render XML text, 437–438 adding, 345–347, 490–493 rendering normal text, 435–436 bookmark organizer, 338–347 using ColumnLayouts, 442–443 constructing UI, 339–343 using custom form controls, 432–440 creating custom transfer type, 343–345 using ExpandableComposites, 438–439 creating drag sources, 332–335 using form layout managers, 440–443 creating drop targets, 335–338 using FormTexts, 435–438 dragAccept(), 338 using Hyperlinks, 432–435 dragEnter(), 337 using sections, 439–440 dragFinished(), 335 using TableWrapLayout, 441–442 dragLeave(), 338 Eclipse platform, 8 dragOperationChanged(), 338 Embarcadero, 18 dragOver(), 338 embedding Microsoft Word OLE Document into SWT dragSetData(), 335 application, 447–454 dragStart(), 334 event handling drop(), 338 about, 68 getting data from clipboard, 348–349 accessing operating system information, 69 overview of methods in DropTargetListener, 336–337 asyncExec, 74–75 putting data on clipboard, 347–348 with displays, 69–71 using clipboard, 347–349 event model, 77–87 using drag and drop, 331–347 events, listeners, and listener notification process, drag source, 331 78–87 drawing fundamentals, 67–71 arcs, 311–313 listener, 4 graphics contexts, 307–321 listeners, 78–87 images, 314–316 model, 77–87 lines, arcs, shapes, 311–313 multithreaded UI programming, 71–77 shapes, 311–313 multithreading with UI thread and non-UI threads, text, 316–318 71–77 drawing diagrams with Draw2D native event handling mechanism, 67–71 about, 463–465 source, 4 adding connections, 472–473 SWT components, 299–301 capturing events, 473–474 SWT event handling, 68 creating simple UML diagrams, 465–472 SWT time-consuming operation UI pattern, 74–77 drawRectangle method, 29 syncExec, 75–76 thread-safe UI calls, 74–77

498 32_094591 bindex.qxd 10/21/04 2:55 PM Page 499

impedance matching Index timerExec, 76–77 typed events and typed event listeners, 84–87 G garbage collection mechanism, 28 untyped events and untyped event listeners, 81–84 gc, 28, 29 use, 74–76 getPageCount, 396 using displays, 68 getting items, 156, 163 wake, 77 Gosling, James, 7 ExpandableComposite, 438–439 graphics context, 308 F drawable object, 309 file chooser SWT, 308–309 Swing, 12 GridData, 128–133 SWT, 11–12 GridLayouts, 127–128 file selection dialog box, 5 groups, SWT, 287–290 file selection dialog user interfaces, 6–7 FileDialogs, 266–270 files H handling bitmap, 11 events, 195–196 identifying files for deployment, 61 events, trees, 249–250 packaging and signing files, 61–62 selections, tables, 229–230 filling shapes, 313–314 horizontal alignment layouts, 128–130 FillLayouts, 122–124 horizontal indentation layouts, 130 filters horizontal span layouts, 130–131 adding combos, 171 HP, 8 adding lists, 171 HP-UX, 13 adding tables, 243–244 HyperlinkGroups, 434–435 adding trees, 256–267 hyperlinks, Eclipse Forms, 432–435 filters, tables, 243–244 finalize method, 29 finding items, 156–157, 164 I flexibility IBM, 8 JFace, 14–18 identifying files for deployment, 61 SWT, 14–18 IDialogSettings, 402 focus traversal, 99–102 IDocument, 409–410 Font,28 IDocumentPartitioner, 410 FontData, 37, 38 IDocumentProvider, 412 FontDialogs, 262–266 Image,28 fonts ImageData, 322–324 FontRegistry, 36–38 ImageDescriptor,37 registries, 10 ImageHyperlinks, 433–434 foreground colors for cells in TabItem, 226–228 ImageRegistry, 37, 38–41 form layout managers, 440–443 images FormLayouts, 138–144 copying, 314–316 forms, Eclipse Forms, 428–431 handling, SWT, 321–329 FormTexts, 435–438 registries, 10 Fortran, 18 scaling, SWT, 327 FrontPage class, 400–401 SWT, 321–322 Fujitsu, 8 impedance matching, 4

499 32_094591 bindex.qxd 10/21/04 2:55 PM Page 500

implementation

implementation building tree up with MVC approach, 17–18 SWT, 27–28 building tree up with traditional approach, 16–17 table viewers, 489–490 components, 10 indexed palettes, 324 creating application model data, 15–16 inserting text, 181 dialogs and wizards, 10 installing SWT/JFace, 47–48 flexibility, 14–18 Intel, 18 image and font registries, 10 IPartitionTokenScanner, 410 maturity, 18 ISourceViewer, 411–412 mechanisms, 44–45 isPageCompleted, 401 model-view-controller (MVC) approach, 14 items, combos progress reporting for long-running operations, 10 about, 156, 163 traditional programming approach, 14 adding, 157, 164 viewers and editors, 10 setting, 156, 163 JFace dialogs ITextViewer, 410 about, 373 ITreeContentProvider,18 application Windows, 374–378 IWizard, 391 InputDialogs, 384–385 IWizardContainer, 391 JFace dialogs, 382–386 JFace windows, 373–382 MessageDialogs, 382–384 J multiple windows management with WindowManagers, jar,40 381–382 Java org.eclipse.jface.window.Window, 373–374 early programs, 4 ProgressMonitorDialogs, 385–386 garbage collection mechanism, 28 running time-consuming operations with application version 1.2, 5 windows, 378–381 Java Foundation classes (JFC), 5–8 JFace Text Java Language Specification (JLS), 29–30 AbstractDocument, 409–410 Java Native Interface (JNI), 19 AbstractTextEditor, 412 Java (UI) toolkits controller-related classes, 410–412 about, 3 controllers, 409–412 Abstract Window Toolkit (AWT), 3, 4–5 creating custom editor, 412–415 evolution of GUI frameworks, 3–10 DefaultPartitioner, 410 JFace, 10–18 Document, 409–410 Standard (SWT), 8–10 framework, 407–412 Swing, 5–8 IDocument, 409–410 Java Web Start, 60–66 IDocumentPartitioner, 410 java.awt.Button class, 19, 20 IDocumentProvider, 412 JavaSoft, 5 IPartitionTokenScanner, 410 javax.swing,6 ISourceViewer, 411–412 javax.swing.border,6 ITextViewer, TextViewer, 410 javax.swing.event,6 model-related classes, 409–410 javax.swing.plaf,6 models, 409–412 javax.swing.table,6 package organization, 407–408 javax.swing.text,6 providing content assistance, 418–422 javax.swing.tree,6 running editor, 423–424 javax.swing.undo,6 SourceViewer, 411–412 JFace SourceViewerConfiguration, 411–412 about, 3, 10 SWT/JFace Mechanisms, 45 action mechanism, 10 syntax highlighting, 415–418

500 32_094591 bindex.qxd 10/21/04 2:55 PM Page 501

lists Index TextEditor, 412 horizontal alignment and vertical alignment, 128–130 views, 409–412 horizontal indentation, 130 JFace viewers, 44–45 horizontal span and vertical span, 130–131 JFace windows introduction, 119–122 about, 373 laying out children of composite, 121–122 application Windows, 374–378 layout data objects, 121 InputDialogs, 384–385 object, 33 JFace dialogs, 382–386 RowData Objects, 126 JFace windows, 373–382 RowLayouts, 124–126 MessageDialogs, 382–384 sample GUI using GridLayouts, 133–138 multiple windows management with WindowManagers, setting, 120–122 381–382 size, 133 org.eclipse.jface.window.Window, 373–374 StackLayouts, 144–145 ProgressMonitorDialogs, 385–386 terminology, 119–120 running time-consuming operations, 378–381 LineBackgroundListeners, 190–191 JFace wizards lines about, 391–393 drawing, 311–313 accessing Wizard pages, 396–397 setting backgrounds, 187–188 adding wizard pages with addPages(), 395 LineStyleListeners, 188–190 cancel processing with performCancel(), 396 Linux, 13 creating Wizard Pages, 397–401 List, 4, 42 finish processing with performFinish(), 395–396 listener event, 4 loading and saving dialog settings, 402–404 lists running, 401 about, 153 accessing items in combos, 156–158 accessing items in lists, 163–165 L adding filters, 171 Label, 4 adding items, 157, 164 label provider building combos and capturing item selections, about, 18 154–156 setting, 238–239 building lists and capturing item selections, 160–163 setting combos, 168 capturing events and getting selections, 168–171 setting trees, 255 CCombo class, 159 LabelProvider,18 combo styles, 153–154 layouts combos, 159–165 about, 119 creating combos with sorted list, 158–159 attaching control position in parent composite, creating domain-specific model objects, 165–166 139–141 creating ListViewer, 166–167 attaching control to another control, 141–143 finding items, 156–157, 164 attaching to adjacent side of another control, 141–143 getting items, 156, 163 centering control on another control, 143 ListViewers, 165–175 children of composite, 121–122 removing items, 157–158, 164–165 composite, 99 setting content provider and content, 167 creating, 145–150 setting items, 156, 163 data objects, 121 setting label provider, 168 FillLayouts, 122–124 setting sorter, 172 FormLayouts, 138–144 single and multi selection lists, 159 grabbing excess space, 131–133 updating/refreshing viewer, 172–175 GridData Objects, 128–133 using, 159–165 GridLayouts, 127–128, 127–138 using combos, 154–159

501 32_094591 bindex.qxd 10/21/04 2:55 PM Page 502

ListViewer

ListViewer, 45, 165–175 model-view-controller (MVC) loading dialog settings, 402–404 about, 14, 41 low-level widgets, 28 architecture, 42–44 benefits, 43 controller, 42 M costs, 43 Mac OS X, 13 interaction, 42–43 Macromedia, 18 model, 42 managing multiple hyperlinks with HyperlinkGroups, view, 42 434–435 models maturity model-view-controller (MVC), 42 JFace, 18 text editor creation with JFace Text, 409–412 SWT, 18 Motif toolkit, 25–27 maximizing control in SashForm, 293–294 multiple-line text controls, 179–180 , 32, 34, 36 multiple views, MVC, 43 menu bar, 484 multithreaded UI programming, 71–77 MenuItems, 34, 196–198 MenuManagers, 219–220 menus N about, 193 native event handling mechanism, SWT, 67–71 accessing ToolItems, 203 navigation methods, SWT, 298 adding controls, 207 adding toolbars, 207–210 bar, 193–194 O creating actions, 216–219 Object Technology International (OTI), 8 creating CoolBar with CoolItems, 210–212 OLE automation, 545–561 creating menus with MenuManagers, 219–220 OLE container, 447–448 creating text editor, 199–202 OLE site, 448–449 creating toolbars with ToolBarManagers, 220–221 OleClientSite, 446 creating ToolItems, 204–207 OleControlSite, 446 drop-down, 194 OleFrame, 446 drop-down menus, 194 operating system information, accessing, 69 handling events, 195–196 operating system resources item management, 195 Swing, 29 pop-up, 194–195 SWT/JFace Mechanisms, 28–29 saving and loading CoolBar, 212–215 Oracle, 8 shared menus side effect, 34–36 org.eclipse.swt.custom,28 styles of ToolItems, 204 org.eclipse.swt.graphics,28 ToolBar styles, 202–203 org.eclipse.swt.widgets,28 using, 193–196 org.eclipse.swt.widgets.Button, 19, 23–25 using actions and ContributionManagers, 216–221 OS/2, 11 using CoolBars and CoolItems, 210–215 OS.SetWindowText,27 using MenuItems, 196–198 OS.XtSetValues,27 using ToolBars, 202–203 using ToolItems, 203–207 P MessageBoxes, 270–271 packages, Swing, 6 , 5 packaging and signing files, 61–62 Microsoft Word, 10 PaletteData, 322–324 model-related classes, text editor creation, 409–410 Panel, 4

502 32_094591 bindex.qxd 10/21/04 2:55 PM Page 503

SAP Index parentWidget, 33 public void,32 pasting text, 181 public void put,37 performCancel, 396 performFinish, 395–396 photo uploader program Q shell, 13–14 QNX, 13 Swing, 6 SWT, 9, 11 R platforms Rational Software, 18 Eclipse, 8 Red Hat, 8 SWT widget classes, 23 Region,28 pop-up menus, 194–195 Region object,32 portability, SWT, 13 removing items preparation, starting with SWT/JFace, 47–51 combos, 157–158, 164–165 Printer, 28 lists, 157–158, 164–165 Printers, 30 removing TabItems, 228–229 printing rendering about, 351 normal text, 435–436 basic, 355–366 XML text, 437–438 fundamentals, 351–353 ReservationWizard class, 396 image viewer application, 356 resizing SashForm’s children, 292–293 images, 360–362 resource management print preview, 362–366 SWT, 13 selecting target printer, 353–355 SWT/JFace, 28–41 setting page margins, 357–360 resources, disposing if you didn’t create it, 31–32 text printing and pagination, 366–371 rewriting temperature converter, 58–60 programming OLE in Windows RowData Objects, 126 about, 445 RowLayout, 124–127 activating OLE object, 450 RowLayouts, 124–126 creating OLE container, 447–448 running creating OLE site, 448–449 JFace Wizards, 401 deactivating OLE object, 451 SWT/JFace, 64–66 embedding Microsoft Word OLE Document into SWT SWT program, 53–54 application, 447–454 text editor, 423–424 executing common commands, 453–454 getting and setting property values, 459–460 invoking methods, 460–461 S listing OLE automation properties and methods, sample application 454–459 about, 477–478 OLE automation, 545–561 adding drag-and-drop support, 490–493 OleClientSite, OleControlSite, 446 building skeleton, 479–489 OleFrame, 446 construct toolbar, 485 saving changes, 452 creating actions, 480–484 programming SWT, 13–14 creating application window, 479–480 progress reporting for long-running operations, JFace, creating application window contents, 486–489 10 creating menu bar, 484 ProgressBars, 282–286 implementing table viewers, 489–490 property values, 459–460 sample GUI using GridLayouts, 133–138 public Font get,37 SAP, 8

503 32_094591 bindex.qxd 10/21/04 2:55 PM Page 504

sashes

sashes, 290–291 shell SashForm, 290–294 disposing of shell, 13–14 saving photo uploader program, 13–14 changes, OLE in Windows, 452 shell.dispose(),33 coolbars, 212–215 single-line text controls, 178–179 dialog settings, 402–404 single lists, 159 scales size layouts, 133 about, 277 sliders, 280–282 using ProgressBars, 282–286 Solaris 8, 13 using scales, 277–280 sorting table by column, 233–235 using sliders, 280–282 source event, 4 , 4 SourceViewer, 411–412 ScrollPane,4 SourceViewerConfiguration, 411–412 sections, Eclipse Forms, 439–440 space layouts, 131–133 selecting speed TabItems, 296–297 Swing, 12–13 trees, 257–259 SWT, 12–13 SelectionListener, 34, 39 StackLayouts, 144–145 setDates, 400 Standard Widget Toolkit (SWT) setErrorMessage, 400 about, 3, 8 setLabel method, 19–20 advantages, 10, 11–18 setText,19 APIs, 9 setting building tree up with MVC approach, 17–18 background and foreground colors for cells in building tree up with traditional approach, 16–17 TableItem, 226–228 creating application model data, 15–16 cell editors, Tables, 239–242 debugging, 27 content provider, 238 file chooser, 11–12 content provider, trees, 254–255 flexibility, 14–18 content provider and content, combos, 167 implementation, 27–28 items, combos, 156, 163 Java user interface (UI) toolkits, 8–10 items, lists, 156, 163 low-level widgets, 28 label provider, 238–239 maturity, 18 label provider, combos, 168 model-view-controller (MVC) approach, 14 label provider, trees, 255 portability, 13 layouts, 120–122 programming, 13–14 line backgrounds, text controls, 187–188 resource management, 13 text labels and image labels for cells in a TableItem, speed, 12–13 226 support for native window systems, 11–12 text styles with StyleRanges, 184–187 traditional programming approach, 14 setting sorter widgets, 9 combos, 172 Standard Widget Toolkit (SWT)/JFace mechanisms lists, 172 did not create, 31–32 trees, 256 disposing of parent disposes children, 32–33 SetWindowTextW,25 disposing of resources, 29–32 shapes implementation, 19–28 drawing, 311–313 Java Native Interface (JNI), 19 filling, 313–314 JFace and MVC, 44–45 shared menus side effect, 34–36 JFace Text, 45 JFace viewers, 44–45

504 32_094591 bindex.qxd 10/21/04 2:55 PM Page 505

Standard Widget Toolkit (SWT) widgets Index managing fonts, 36–41 filling shapes, 313–314 managing images with JFace, 36–41 getting graphics context, 308–309 model-view-controller (MVC) pattern, 41–44 image basics, 321–322 MVC architecture, 42–44 image dandling, 321–329 MVC benefits, 43 image scaling, 327 MVC controller, 42 ImageData and PaletteData, 322–324 MVC costs, 43 Indexed Palettes, 324 MVC interaction, 42–43 obtaining existing graphics context, 308 MVC model, 42 transparency and alpha blending, 325–327 MVC view, 42 using canvas, 310 operating system resource management rules, 29–36 XOR, 319 operating system resources, 28–29 Standard Widget Toolkit (SWT) program resource management with SWT/JFace, 28–41 coding, 51–53 shared menus side effect, 34–35 starting with SWT/JFace, 51–60 UI delegation, 44 Standard Widget Toolkit (SWT) widgets using FontRegistry, 36–38 buttons, 112–114 using ImageRegistry, 38–41 CLabel class, 116–117 When to dispose, 30–31 composite class, 98–103 Standard Widget Toolkit (SWT) components composite class focus traversal, 99–102 about, 287 composite class layout, 99 accessing and selecting TabItems, 296–297 composite class styles, 98–99 browsers, 298–305 constructor public widget, 90–93 customizing TabItems, 297 control class, 93–98 events, 299–301 control methods, 98 groups, 287–290 control size and location, 94–95 maximizing control in SashForm, 293–294 control styles, 93–96 navigation methods, 298 creating irregular-shaped shells, 108–110 resizing a SashForm’s children, 292–293 creating shells, 104–107 sashes, 290–291 dispose of widget, 92 sashes and SashForms, 290–294 event handling, 92–93 SashForms, 291–292 fonts and colors, 95 TabFolders and TabItems, 294–298 getting and setting application data, 93 usage, 294–296 label basics, 116–117 Web browser, 301–305 label styles, 115 Standard Widget Toolkit (SWT) graphics and image labels, 115–117 handling public display, 91–92 about, 307 public void, 92–93 advanced drawing techniques, 318–320 radio buttons, 113–115 clipping, 318–319 setting images, 110 creating graphics context instance on drawable object, setting title, 110 309 shell default button, 110–111 direct palettes, 322–323 shell events, 107–108 displaying animation, 327–329 shell states, 104 double buffering, 320 shell styles, 103 drawing and copying Images, 314–316 shells, 103–111 drawing lines, arcs, shapes, 311–313 SWT/JFace UI component hierarchy, 89–90 drawing text, 316–318 UI updating, 95–97 drawing with graphics contexts, 307–321 widget class, 90–93

505 32_094591 bindex.qxd 10/21/04 2:55 PM Page 506

starting with SWT/JFace

starting with SWT/JFace tables about, 47 adding data in table, 225–229 coding SWT program, 51–53 adding filter, 243–244 configure Eclipse, 48–50 column-wise sorting, 242–243 configure JBuilder, 50–51 creating, 223–224 configuring IDEs, 49–51 creating TableViewer, 237–238 downloading and installing SWT/JFace, 47–48 creating domain-Specific Model Objects, 236–237 identifying files for deployment, 61 creating TableItems, 225–226 Java Web Start, 60–66 defining Table columns, 224–225 packaging and signing files, 61–62 handling selections, 229–230 preparation, 47–51 removing TableItems, 228–229 rewriting temperature converter, 58–60 setting background and foreground colors for cells, running SWT program, 53–54 226–228 software deployment with Java Web Start, 60–66 setting cell editors, 239–242 SWT program, 51–60 setting text labels and image labels for cells, 226 temperature converter application, 55–57 setting content provider, 238 uploading and running, 64–66 setting Label Provider, 238–239 writing JNLP script, 63–64 sorting a table by column, 233–235 structured/viewer, 44 using TableEditors, 230–233 StyledTexts, 184–188 using Tables, 223–235 styles using TableViewers, 235–244 composite, 98–99 TableTreeViewer,45 ToolItems, 204 TableViewer, 45, 235–244 Sun Microsystems, 4, 5 TableWrapLayout, 441–442 sun.awt.windows.WButtonPeer, 21–22 temperature converter application, 55–57 support for native window systems, Standard Widget text Toolkit (SWT), 11–12 about, 177 Swing accessing Text Information, 180 about, 3, 5 appending, pasting, inserting text, 181 disadvantages, 7 capturing modification events, 183 file chooser, 12 controls, 178–180 file selection dialog user interfaces, 6–7 creating multiple-line text controls, 179–180 operating system resources, 29 creating single-line text controls, 178–179 packages, 6 drawing, 316–318 photo uploader program, 6 setting Line backgrounds, 187–188 speed, 12–13 setting text styles with StyleRanges, 184–187 Sybase, 8 StyleRanges, 184–187 syncExec, 75–76 styles, 177–178 syntax highlighting, text editor, 415–418 text basics, 178–180 text operations, 181–183 text selections, 183–184 T text styles, 177–178 TabFolders, 294–298 using LineBackgroundListeners, 190–191 TabItems using LineStyleListeners, 188–190 about, 40, 296–297 using LineStyleListeners and LineBackgroundListeners, background color for cells, 226–228 188–191 creating, 225–226 using StyledTexts, 184–188 Table, 32 using texts, 177–191 TableColumns, 224–225 verifying Input, 181–183 TableEditors, 230–233

506 32_094591 bindex.qxd 10/21/04 2:55 PM Page 507

trees Index text editor toolbars about, 199–202 accessing toolItems, 203 AbstractTextEditor, TextEditor, IDocumentProvider, 412 adding, 207–210 controller-Related classes, 410–412 adding controls to, 207 creating custom editor, 412–415 adding toolbar for text editor, 207–210 IDocument, AbstractDocument, Document, 409–410 bar menus, 193–194 IDocumentPartitioner, IPartitionTokenScanner, Default- construct toolbar, 485 Partitioner, 410 creating actions, 216–219 ISourceViewer, SourceViewer, SourceViewerConfigura- creating CoolBar with CoolItems, 210–212 tion, 411–412 creating menus with MenuManagers, 219–220 ITextViewer, TextViewer, 410 creating text Editor, 199–202 JFace Text Package Organization, 407–408 creating toolbars with ToolBarManagers, 220–221 model-related classes, 409–410 creating ToolItems, 204–207 models, views, and controllers in JFace Text Framework, drop-down menus, 194 409–412 handling events, 195–196 overview of JFace Text Framework, 407–412 menu item management, 195 providing content assistance, 418–422 pop-up menus, 194–195 running editor, 423–424 saving and loading display CoolBar, 212–215 syntax highlighting, 415–418 styles, 202–203 TextArea,4 styles of toolItems, 204 TextComponent,4 using, 202–203 TextEditor, 412 using actions and ContributionManagers, 216–221 TextField,4 using CoolBars and CoolItems, 210–215 texts, 177–191 using MenuItems, 196–198 TextViewer, 410 using menus, 193–196 threading using menus and menu items, 193–202 accessing operating system information, 69 using ToolItems, 203–207 asyncExec, 74–75 ToolItems, 204–207 event handling fundamentals, 67–71 traditional programming approach, SWT, 14 event handling with displays, 69–71 transparency and alpha blending, 325–327 event model, 77–87 tree, 32 events, listeners, and listener notification process, tree widget, 9 78–87 TreeEditors, 251–253 multithreaded UI programming, 71–77 TreeItem, 32 multithreading with UI thread and non-UI threads, TreeItems, 246–249 71–77 trees native event handling mechanism, 67–71 about, 245 SWT event handling, 68 adding filters, 256–267 SWT time-consuming operation UI pattern, 74–77 creating, 245–246 syncExec, 75–76 creating TreeViewer, 254 thread-safe UI calls, 74–77 getting selections, 257–259 timerExec, 76–77 handling events, 249–250 typed events and typed event listeners, 84–87 setting content provider, 254–255 untyped events and untyped event listeners, 81–84 setting label provider, 255 use, 74–76 setting sorter, 256 using displays, 68 using TreeEditors, 251–253 wake, 77 using TreeItems, 246–249 timerExec, 76–77 using trees, 245–253 ToolBarManagers, 220–221 using TreeViewer, 253–259

507 32_094591 bindex.qxd 10/21/04 2:55 PM Page 508

TreeViewer

TreeViewer, 45, 253–259 InputDialogs, 384–385 typed event listeners, 84–87 JFace dialogs, 382–386 typed events, 84–87 JFace windows, 373–382 MessageDialogs, 382–384 multiple windows management with WindowManagers, U 381–382 UI delegation, SWT/JFace Mechanisms, 44 org.eclipse.jface.window, 373–374 UML diagrams with Draw2D, creating, 465–472 ProgressMonitorDialogs, 385–386 UML modeling tool, 18 running time-consuming operations, 378–381 untyped event listeners, 81–84 Windows 98, 13 untyped events, 81–84 , 13 updating/refreshing viewer Windows ActiveX controls, 10 combos, 172–175 Windows CE, 13 lists, 172–175 Windows file chooser, 11 Upload button, 14 Windows ME, 13 uploading SWT/JFace, 64–66 Windows XP, 13 wizard container, 391 V wizard pages, 395 WizardDialog, 391–392, 401 verifying input, 181–183 WizardPage, 401 vertical alignment layouts, 128–130 wizards, JFace vertical span layouts, 130–131 about, 10, 391–393 Viewer, 44 accessing wizard pages, 396–397 viewers and editors, JFace, 10 adding wizard pages, 395 views, text editor creation, 409–412 cancel processing, 396 Visual C++, 11 creating, 393–397 creating wizard pages, 397–401 W finish processing, 395–396 wake,77 loading and saving dialog settings, 402–404 WebSphere Application Studio, 18 running, 401 WidgetDisposed,31 writing JNLP script, 63–64 widgets about, 28 AWT, 9 X XDE Professional, 18 low-level, 28 XOR, 319 Standard Widget Toolkit (SWT), 9 XtSetValues,27 widgetSelect method, 34 windows, JFace about, 373 application Windows, 374–378

508