Apple WebObjects 3.5 Instrukcja Użytkownika

Przeglądaj online lub pobierz Instrukcja Użytkownika dla Oprogramowanie Apple WebObjects 3.5. Apple WebObjects 3.5 User Manual Instrukcja obsługi

  • Pobierz
  • Dodaj do moich podręczników
  • Drukuj
  • Strona
    / 120
  • Spis treści
  • BOOKMARKI
  • Oceniono. / 5. Na podstawie oceny klientów

Podsumowanie treści

Strona 1 - WITH WEBOBJECTS

GETTING STARTED WITH WEBOBJECTS

Strona 2

Preface 10 Where to Go From Here After you have worked through the tutorials in this book, you should have a good working knowledge of WebObjects. Fo

Strona 3 - Contents

Chapter 3 Creating a WebObjects Database Application100your relationship, and the relationship’s name is dependent on the adaptor the wizard used. Ada

Strona 4

Refining Your Model1018. Click Connect.EOModeler automatically renames the relationship based on the name of the destination entity. For example, after

Strona 5 - Table of Contents

Chapter 3 Creating a WebObjects Database Application102At this point your model has all the relationships it needs. The Diagram View gives you an over

Strona 6 - Refining Your Model 97

Refining Your Model1033. Ensure that the delete rule is set to Cascade.If the wizard created relationships for you, the relationship’s delete rule shou

Strona 7

Chapter 3 Creating a WebObjects Database Application104Enterprise Objects Framework provides several mechanisms for generating and assigning unique va

Strona 8

Setting Up a Master-Detail Configuration105In the Movies application, the master-detail configuration is built around Movie’s movieRoles relationship. T

Strona 9 - About This Book

Chapter 3 Creating a WebObjects Database Application106An Add Display Group panel opens.3. In the Add Display Group panel, change the name to movieRol

Strona 10 - Where to Go From Here

Setting Up a Master-Detail Configuration107Notice that the “Has detail data source” box is checked. This means that movieRoleDisplayGroup gets its obje

Strona 11 - Chapter 1

Chapter 3 Creating a WebObjects Database Application1086. Check the “Fetches on load” box.When “Fetches on load” is selected, the display group fetche

Strona 12

Setting Up a Master-Detail Configuration1091. In the MovieDetails component window, add the bolded text Starring: beneath the Revenue line.2. Below the

Strona 13

Creating a Simple WebObjects Application Chapter 1

Strona 14 - Set project type here

Chapter 3 Creating a WebObjects Database Application110When you’re done, the repetition bindings should look like the following:Running MoviesBe sure

Strona 15 - GuestBook

Updating Objects in the Detail Display Group111Updating Objects in the Detail Display GroupIn this section, you’ll add the ability to insert, update,

Strona 16

Chapter 3 Creating a WebObjects Database Application112Managing a DisplayGroup’s SelectionRemember how clicking a movie title in the Main page selects

Strona 17 - Examining Your Project

Updating Objects in the Detail Display Group113Adding a FormNow lay out the user interface used to view and edit the selected MovieRole. When you’re d

Strona 18 - Launching WebObjects Builder

Chapter 3 Creating a WebObjects Database Application1142. Using the Display Group Options panel, assign talentDisplayGroup’s entity to Talent.Remember

Strona 19

Updating Objects in the Detail Display Group115Talent browser, the selection should refer to a single object. Consequently, you need to add two method

Strona 20 - Creating the Page’s Content

Chapter 3 Creating a WebObjects Database Application116Again because the browser uses a vector for its selections attribute, the setTalentSelection me

Strona 21 - Entering Static Text

Adding Behavior to Your Enterprise Objects1176. Copy the saveChanges method from the Main.java class and paste it into the MovieDetails.java class:pub

Strona 22 - Using the Inspector

Chapter 3 Creating a WebObjects Database Application1181. In EOModeler, inspect the Talent entity.2. In the Entity Inspector for Talent, type Talent i

Strona 23

Adding Behavior to Your Enterprise Objects119Adding Custom Behavior to TalentNow add the fullName method to Talent and bind it to the browser.1. Open

Strona 25 - Resizing the Form Elements

Chapter 3 Creating a WebObjects Database Application120Running MoviesBe sure that all your project’s files are saved (including your model file), and bu

Strona 26 - Enter rows and columns here

13 This chapter introduces you to the basic concepts and procedures of developing WebObjects applications. You’ll develop, in stages, a simple applic

Strona 27 - Binding Elements

Chapter 1 Creating a Simple WebObjects Application 14 Project Builder is an integrated software-development application. It contains a project browse

Strona 28 - String directly in the box

Creating a WebObjects Application Project 15 4. Click Browse.5. In the Save panel, navigate to the DocumentRoot /WebObjects directory. DocumentRoot

Strona 29 - Binding the Input Elements

Chapter 1 Creating a Simple WebObjects Application 16 9. For Available Assistance, choose None.If you are developing an application that accesses a d

Strona 30 - Implementing an Action Method

Examining Your Project 17 Examining Your Project Project Builder displays a browser showing the contents of your project. The first column lists sever

Strona 31

Chapter 1 Creating a Simple WebObjects Application 18 3. Select Classes in the first column of the browser. You’ll see three files listed in the second

Strona 32 - action method

Launching WebObjects Builder 19 2. Double-click Main.wo in the second column.The application WebObjects Builder launches and displays a window enti

Strona 33 - <HR> element)

Apple, NeXT, and the publishers have tried to make the information contained in this manual as accurate and reliable as possible, but assume no respo

Strona 34 - View Source File

Chapter 1 Creating a Simple WebObjects Application 20 This pop-up list allows you to switch between graphical editing mode and source editing mode. W

Strona 35 - Click here to build

Creating the Page’s Content 21 • Structures . Use these buttons to create paragraphs, lists, images, and other static HTML elements. This setting is

Strona 36

Chapter 1 Creating a Simple WebObjects Application 22 Using the Inspector You use the Inspector window to set properties of the elements in your comp

Strona 37 - Enhancing Your Application

Creating the Page’s Content23Each element has its own Inspector that allows you to set properties appropriate for the element. The Page Attributes Ins

Strona 38

Chapter 1 Creating a Simple WebObjects Application241. To display the dynamic form elements buttons in the toolbar, choose from the Elements pop-up

Strona 39 - Duplicating Your Project

Creating the Page’s Content25The window should now look like this:Resizing the Form ElementsThe text fields and text area are a bit small, so you’ll re

Strona 40 - PB.project.)

Chapter 1 Creating a Simple WebObjects Application261. Inspect the Name text field (that is, select the text field and open the Inspector window). 2. Ch

Strona 41 - Creating a Custom Guest Class

Binding Elements275. Inspect the multi-line text area. In Text Area Inspector, you can set various attributes corresponding to those of a <TEXTAREA

Strona 42

Chapter 1 Creating a Simple WebObjects Application28WebObjects Builder allows you to declare variables without having to edit your source file directly

Strona 43

Binding Elements29Binding the Input ElementsEach dynamic element contains several attributes. These attributes determine what happens when the element

Strona 44

Contents

Strona 45

Chapter 1 Creating a Simple WebObjects Application30The Inspector window comes to the front, displaying the bindings for the text area. The value attr

Strona 46 - Creating the Guest Object

Binding Elements313. From the “Page returned” pop-up menu, select null.The value returned by an action method represents the next page (component) to

Strona 47 - Main.java

Chapter 1 Creating a Simple WebObjects Application32Creating the Application’s OutputSo far, you have a way for the guest to enter information and a w

Strona 48 - Creating a Guest List

Creating the Application’s Output332. Choose from the Elements pop-up list to display the Structures buttons.3. Click to create a horizontal line

Strona 49 - Application, which is

Chapter 1 Creating a Simple WebObjects Application3410. Save your component. It should now look like this:In summary, when the user clicks the Submit

Strona 50

Building and Running Your Application35Building and Running Your Application1. Make Project Builder active. A quick way to do this from WebObjects Bui

Strona 51 - Adding a Second Component

Chapter 1 Creating a Simple WebObjects Application366. Click in the Launch panel to launch your application.The Launch Panel displays a series of me

Strona 52 - WOString

Enhancing Your ApplicationChapter 2

Strona 54 - Guest as its type

Duplicating Your Project39In the previous tutorial, you learned how to create a web component that has input and output elements and how to bind these

Strona 56 - Adding the Finishing Touches

Chapter 2 Enhancing Your Application404. Duplicate the GuestBook folder.On Windows NT, you can do this by selecting the folder, choosing Edit m Copy,

Strona 57 - Adding a Dynamic Hyperlink

Creating a Custom Guest Class41Creating a Custom Guest ClassIn the first chapter, you created individual variables to store a guest’s name, e-mail addr

Strona 58 - Main”, because you

Chapter 2 Enhancing Your Application42also a class, specifically a subclass of the class next.wo.Component (called WOComponent in WebScript or Objectiv

Strona 59 - Database Application

Creating a Custom Guest Class436. Double-click the row containing the value binding.This removes the binding for guestName you made previously and bin

Strona 60

Chapter 2 Enhancing Your Application446. Double-click the upper-left cell.You can now edit the contents of the cell. If you want to resume structure e

Strona 61

Creating a Custom Guest Class4511. Click in the component window, then press Tab.Pressing Tab when editing a table causes the contents of the next cel

Strona 62 - The Movies Application

Chapter 2 Enhancing Your Application46The table should now look like this:3. Save the Main component.Creating the Guest ObjectEarlier in this chapter,

Strona 63

Keeping Track of Multiple Guests474. Save Main.java.5. Build and run your application.The application should work similarly to the first chapter, excep

Strona 64

Chapter 2 Enhancing Your Application48Before doing this, it is important to understand the scope and life span of variables in WebObjects:• Component

Strona 65 - Designing the Main Page

Keeping Track of Multiple Guests49Note that there is one method already defined: Application, which is the constructor for the application object. The

Strona 66 - Specifying a Model File

v Table of Contents Contents iiiPreface 7 About WebObjects 9About This Book 9Where to Go From Here 10 Creating a Simple WebObjects Application 11 Cre

Strona 67 - Choosing an Adaptor

Chapter 2 Enhancing Your Application503. At the top of the Application class definition, enter this declaration:protected MutableVector allGuests;This

Strona 68

Adding a Second Component51Adding a Second ComponentIn this section, you’ll create a new component. Instead of Java, you’ll implement its code using W

Strona 69

Chapter 2 Enhancing Your Application5210. In the object browser, click application. There is an entry in the second column for the allGuests applicati

Strona 70

Using a Repetition53pageWithName is a standard WebObjects method (defined in the WebApplication class) that allows you to specify a new page to display

Strona 71 - Specifying Primary Keys

Chapter 2 Enhancing Your Application54You’ll bind the allGuests array to the WORepetition’s list attribute. This tells WebObjects to generate the elem

Strona 72 - Shift-click to select more

Using a Repetition5511. In the object browser, select application in the first column.12. In the second column, click allGuests and drag the cursor to

Strona 73

Chapter 2 Enhancing Your Application56By using the name currentGuest for the item attribute, you are taking advantage of the fact that the strings in

Strona 74 - Choosing an Entity

Adding the Finishing Touches574. Enter the following code before the return statement in clearGuestList:[[self application] clearGuests];This code cal

Strona 75 - Choosing a Layout

Chapter 2 Enhancing Your Application585. Select the pageName attribute, then double-click in the Binding column and type (including the quotes) "

Strona 76

Creating a WebObjectsDatabase ApplicationChapter 3

Strona 77

vi Adding the MovieDetails Page 92 Creating the MovieDetails Component 93Storing the Selected Movie 93Navigating from Main to MovieDetails 94Designin

Strona 79

61One of the most powerful features of WebObjects is its ability to provide access to databases. To do so, it uses a framework called the Enterprise O

Strona 80 - Examining the Variables

Chapter 3 Creating a WebObjects Database Application62The Movies ApplicationThe Movies application has two pages, each of which allows you to access i

Strona 81 - Examining the Bindings

The Movies Application63Enterprise Objects and the Movies DatabaseEnterprise Objects Framework manages the interaction between the database and object

Strona 82 - Bindings in the Query Part

Chapter 3 Creating a WebObjects Database Application64MOVIE_ROLE table having a MOVIE_ID column. In the MOVIE table, MOVIE_ID is a primary key, while

Strona 83 - Bindings in the Editing Part

Designing the Main Page65Designing the Main PageEvery WebObjects application has at least one component—usually named Main—that represents the first pa

Strona 84

Chapter 3 Creating a WebObjects Database Application665. Type Movies in the “File name” field.6. Click Save.7. In the New Project panel, click OK.This

Strona 85 - Refining Main.wo

Designing the Main Page67Choosing an AdaptorAn adaptor is a mechanism that connects your application to a particular database server. For each type of

Strona 86 - Specifying a Sort Order

Chapter 3 Creating a WebObjects Database Application683. Complete the login panel.Specify the connection information you provided when you created and

Strona 87

Designing the Main Page69A relationship is a link between two entities that’s based on attributes of the entities. For example, the Movie entity has a

Strona 89 - Setting a Number Format

Chapter 3 Creating a WebObjects Database Application703. Uncheck the “Ask about stored procedures” box.Checking this box causes the wizard to read sto

Strona 90 - Optional Exercise

Designing the Main Page71Choosing the Tables to Include1. In the wizard panel, select MOVIE, MOVIE_ROLE, and TALENT in the Tables browser.The wizard c

Strona 91

Chapter 3 Creating a WebObjects Database Application721. Select movieId as the primary key for the Movie entity.2. Click Next.3. Select both movieId a

Strona 92 - Adding the MovieDetails Page

Designing the Main Page73If foreign key definitions aren’t specified in your database server’s schema information (as with Microsoft Access), the wizard

Strona 93 - Storing the Selected Movie

Chapter 3 Creating a WebObjects Database Application742. Choose Cascade.This option specifies what to do when the source object (the Movie) is deleted.

Strona 94 - Add the hyperlink below

Designing the Main Page75Choosing a LayoutThe wizard provides several page layout options for formatting objects fetched from the database.1. Choose S

Strona 95 - Movie Details

Chapter 3 Creating a WebObjects Database Application76There are three parts to this page: the query part (at the top of the page), which contains field

Strona 96 - MovieSearch

Designing the Main Page77The order in which you add the attributes determines the order in which they appear on the page, so add them in the following

Strona 97 - Refining Your Model

Chapter 3 Creating a WebObjects Database Application78When the wizard finishes, your new project is displayed in Project Builder. The wizard has produc

Strona 98

Examining Your Project79Examining Your ProjectWhenever you create a new project, Project Builder populates the project with ready-made files and direct

Strona 100

Chapter 3 Creating a WebObjects Database Application80Examining the Variables1. Double-click Main.wo in Project Builder’s WebObjects Components catego

Strona 101 - Switches to Browser View

Examining Your Project81Also note the comment explaining how movieDisplayGroup is initialized. The Main.java class doesn’t have any code to create and

Strona 102 - This box should be checked

Chapter 3 Creating a WebObjects Database Application82Bindings in the Query PartIn the query part of the component, movieDisplayGroup.queryMatch.title

Strona 103

Examining Your Project831. Inspect the hyperlink.Its action attribute is bound to the action method selectObject.2. Look in the Main.java class to see

Strona 104

Chapter 3 Creating a WebObjects Database Application841. Inspect the middle image button.Its action attribute is bound to the action method saveChange

Strona 105

Refining Main.wo85group’s selected object. These changes happen only in memory—not in the database. To actually insert a new row in the database (or de

Strona 106 - WebObjects Builder assigns

Chapter 3 Creating a WebObjects Database Application86Specifying a Sort OrderYou can change your application to sort movies alphabetically without wri

Strona 107

Refining Main.wo87Specifying Default Values for New Enterprise ObjectsWhen new enterprise objects are created in your application, it’s common to assig

Strona 108 - Adding a Repetition

Chapter 3 Creating a WebObjects Database Application88The Movies application specifies default values for newly created Movie objects using the display

Strona 109 - Configuring a Repetition

Refining Main.wo89Setting a Number FormatIn addition to a dateformat attribute, text field elements also have a numberformat attribute.1. Inspect the re

Strona 110 - Running Movies

9 About WebObjects WebObjects is an object-oriented environment for developing and deploying World Wide Web applications. A WebObjects application ru

Strona 111

Chapter 3 Creating a WebObjects Database Application90Optional ExerciseYou can tidy up the user interface even further by putting the query part of th

Strona 112 - return null;

Refining Main.wo914. In the Table Inspector, choose Unspecified for the table width.The table resizes to just fit its contents. When you change the cell

Strona 113 - Adding a Talent Display Group

Chapter 3 Creating a WebObjects Database Application92Adding the MovieDetails PageThe MovieDetails page shows you the detailed information about a mov

Strona 114 - Configuring the Browser

Adding the MovieDetails Page93Creating the MovieDetails Component1. In Project Builder, choose File m New in Project.2. In the New File panel, click t

Strona 115

Chapter 3 Creating a WebObjects Database Application94Movie isn’t actually a class; it’s an entity. It’s listed in the combo box as a type along with

Strona 116 - Add the image buttons inside

Adding the MovieDetails Page958. In Project Builder, modify the showDetails action to look like the following: public Component showDetails(){ Movi

Strona 117

Chapter 3 Creating a WebObjects Database Application96This adds a new level 3 heading element around the string. The MovieDetails page will show the t

Strona 118 - Talent in the Class field

Refining Your Model97telling the application to open the MovieSearch page when the hyperlink is clicked.Running MoviesBe sure that all your project’s fi

Strona 119

Chapter 3 Creating a WebObjects Database Application98Project Builder opens your model file in EOModeler, launching EOModeler first if it isn’t already

Strona 120

Refining Your Model994. In the MovieRole entity, remove movieId and talentId as class properties.5. In the Talent entity, remove talentId as a class pr

Komentarze do niniejszej Instrukcji

Brak uwag