DOOM Case Study Wedgi l Wedgi Wordbench Editing
DOOM Case Study: Wedgi l Wedgi: Wordbench: Editing with a Graphical Interface ä see http: //www. cs. duke. edu/~ola/courses/cps 108/code/java/wedgi/ ä towards a source browser? (see sniff+ www. takefive. co. at) l Load files/URLs (other sources) into a framework that lets you edit the source, cut/copy/paste, etc. [what’s the etc. ? ] ä how might the user interact with the program? ä What are the requirements? What are the use-cases? Use-case ä textual, narrative description of the processes in a system ä how the user interacts with the system (how components of the system interact with each other) l Duke CPS 108 26. 1
Wedgi: DOOM stage 1 l l Get a working prototype up and running ä work on requirements/specifications, prioritize project components, develop use-cases ä choose core classes and responsibilities/relationships ä write core stubs/headers, both behavior and state ä get prototype up and running Load files/URLs (both initially? ) navigate among sources ä Readers for sources ä Card. Layout for navigation ä Mediator, GUI, Wedgi. Text, other classes? ä How does cut/copy/paste work? Duke CPS 108 26. 2
Multiple Wedgi. Text objects l l How can we cycle between several documents loaded into Wedgi? ä What operations might we perform on a document? ä How are documents tracked internally? Card. Layout ä in theory facilitates “tabbed” layout, select among several displays • not all are actually shown (as should be in tabbed layout), in JDK 1. 2 there is a tabbed layout ä Objects added to container with Card. Layout must be associated with a name • next, previous, first, last, and named object • What is name of first? What is name of next? Who tracks the names? Duke CPS 108 26. 3
Alternatives to Card. Layout for Wedgi l Keep a vector/hashtable of Wedgi. Texts associated with a name ä how is view changed when user selects another Wedgi. Text ä why doesn’t this work? my. Wedge = selected. Wedgi; validate(); ä What can we do instead to get at the idea of swapping the displayed view for another? What are the issues? • What’s the state and who’s the parent l How will save work, what about remove (for Wedgi. Texts) ä alternatives to maps of name -> Wedgi. Text? ä What is a Wedgi. Text? Compared to what? Duke CPS 108 26. 4
Data. Transfer l Transferring objects and stuff between widgets in an application, between Java applications, between Java and other applications ä application-specific clipboard, System clipboard ä package objects and stuff up in some way that facilitates transfer • transfer in what format, out in another, e. g. , HTML text l Cut and Paste ä put/get a Transferable (interface) to/from clipboard set. Contents(Transferable, Owner), get. Contents(Owner) ä Transferable supports at least one Data. Flavor ä Data. Flavors are built on MIME types Duke CPS 108 26. 5
Data. Transfer and Data. Flavors For more information see Core Java Vol. II and online AWT supplemental info l l l MIME: Multipurpose Internet Mail Extensions ä facilitate reading/writing attachments ä can be used to facilitate MIME-aware Java app transfers Data. Flavors ä Java and other non-Java program: transfer text ä Same java program: any object ä MIME-aware inter-java transfer: text-encoded/MIME data Tranferable: returns string, stream or other source Cut and Paste Data. Flavors[] flavors = trans. get. Transfer. Data. Flavors(); Data. Flavor gif. F = new Data. Flavor(“image/gif”, “GIF bitmap”); if (trans. is. Data. Flavor. Supported(gif. F))… Object o = trans. get. Transfer. Data(some. Flavor. Object); Duke CPS 108 26. 6
- Slides: 6