Title: Modular User Interfaces with Visualforce Components
1Modular User Interfaces with Visualforce
Components
Track Tour de Force Mastering the Force.com
Platform
- Andrew Waite, salesforce.com
2Safe Harbor Statement
Safe harbor statement under the Private
Securities Litigation Reform Act of 1995 This
presentation may contain forward-looking
statements including but not limited to
statements concerning the potential market for
our existing service offerings and future
offerings. All of our forward looking statements
involve risks, uncertainties and assumptions. If
any such risks or uncertainties materialize or if
any of the assumptions proves incorrect, our
results could differ materially from the results
expressed or implied by the forward-looking
statements we make. The risks and uncertainties
referred to above include - but are not limited
to - risks associated with possible fluctuations
in our operating results and cash flows, rate of
growth and anticipated revenue run rate, errors,
interruptions or delays in our service or our Web
hosting, our new business model, our history of
operating losses, the possibility that we will
not remain profitable, breach of our security
measures, the emerging market in which we
operate, our relatively limited operating
history, our ability to hire, retain and motivate
our employees and manage our growth, competition,
our ability to continue to release and gain
customer acceptance of new and improved versions
of our service, customer and partner acceptance
of the AppExchange, successful customer
deployment and utilization of our services,
unanticipated changes in our effective tax rate,
fluctuations in the number of shares outstanding,
the price of such shares, foreign currency
exchange rates and interest rates. Further
information on these and other factors that could
affect our financial results is included in the
reports on Forms 10-K, 10-Q and 8-K and in other
filings we make with the Securities and Exchange
Commission from time to time. These documents are
available on the SEC Filings section of the
Investor Information section of our website at
www.salesforce.com/investor. Salesforce.com, inc.
assumes no obligation and does not intend to
update these forward-looking statements, except
as required by law.
3Agenda
- Introduction to Visualforce
- Anatomy of a custom component
- Simple Input Components
- Controllers for Components
- Delegation with ComponentBody
- Design Considerations
- Key Take-aways
- Q A
4Introduction to Visualforce
Model
SObjects
Apex Classes
View
Components
Pages
Controller
Standard
Custom (Apex)
5Visualforce Pages
View
Pages
- Canvas or design surface similar to standard
Web development model - Composed with components and HTML
- Reference any CSS, Flex, AJAX or other Web
technology - Name referenced, i.e. /apex/myPage
- Composed on the server, not the client
- Multiple means of editing
- In-place, Development Mode
- Force.com IDE (Eclipse)
- Setup
- SOAP API
6Visualforce Components
View
Components
- Create Standard UI elements, such as detail areas
and related lists, with a single tag - Attribute data binding
- Special UI elements, such as tab panels and
repeat (iterators) - Built in AJAX functionality supporting partial
page refresh - 68 standard components
ltapexinputField value!contact.salutatio
n/gt
7Why custom components? A. Once and only once for
UI
8Custom Components - Smart Includes
- Markup Based Approach
- HTML, Javascript, CSS, etc.
- Leverage Standard/Custom components
- AJAX components
- Iteration
- Flash
- Includes with attributes
9One Component?
10Demo chelloWorld
11Components of Custom Components
- apexcomponent
- Analagous to apexpage, defines the component
- Basic attributes
- controller, extensions
- apexattribute
- Defines an attribute that can be specified by the
consumer - Basic attributes
- name, type, required, description, assignTo
- apexcomponentBody
- Allows for consumer delegation
- Supports concept of default
12Anatomy of a Simple Custom Component
Consumer Page
Component Definition
13Self-documenting
14Understanding Pass-through Binding
Consumer Page
Component Definition
15Demo cinputSlider
16Visualforce Controllers
Controller
- Controllers contain the logic and data references
a page uses - Separates presentation from logic
- Created in Apex code providing full access to
Apex functionality (API, Web services, etc) - Pages interact with controllers through
components - data/action binding - Maintain state across page interactions
17Apex Controllers for Components
Controller
- Expose Capabilities of Apex
- SOQL/SOSL
- DML Operations
- Send Email
- Callouts
- Complex Algorithms
- Introduce Apex to Visualforce Email Templates
ltapexcomponent controllerMyController/gt
18Demo crssFeed
19Delegation to Component Consumer
- apexcomponentBody
- apexvariable
20Demos chelloWorld, crssFeed
21Design Considerations
- Optimize for the recommended use pattern
- Avoid SOQL/DML operations if component is
expected to be used within iterations - Consider Apex and Standard Controller page
environments - Compensate for Side-effects
- Expose a rerender pass through argument for
actions invoking DML operations - Use standard components for CSS/Javascript
- apexstyleSheet, apexincludeScript avoid
duplication - Naming Conventions
- Refer to standard component names and their
attributes for guidance.
22Manage. Share. Build. Apply what youve learned
- Custom Components are easy to
- create using simple markup
- maintain through reuse/single source
- use with self-documenting, strongly typed
attributes - Simplify complex interactions
- Simple interface to leverage
- Scoring algorithms
- Callouts
- SOQL Statements
- Enable wider audience
23Session FeedbackLet us know how were doing and
enter to win an iPod nano!
- Please score the session from 5 to 1
(5excellent,1needs improvement) in the
following categories - Overall rating of the session
- Quality of content
- Strength of presentation delivery
- Relevance of the session to your organization
Additionally, please fill in the name of each
speaker score them on overall delivery.
We strive to improve, thank you for filling out
our survey.
24QUESTION ANSWER SESSION
Andrew Waite
salesforce.com
Director, Product Management