Professional Documents
Culture Documents
Layoutskin 140304115443 Phpapp02
Layoutskin 140304115443 Phpapp02
Oracle A-Team
Layout Managers
Flowing
Isolated components not supposed to stretch
Where do I start?
Start with a stretchable outer frame
Inside this frame, have flowing islands, e.g., scrollable areas
Stretchable UI example
Poetry of
Wisdom
af:panelStretchLayout
af:panelSplitter
af:panelGroupLayout
af:panelDashboard
Flow vs Stretch
Poetry of
Wisdom
panelStretchLayout
YES
YES
panelSplitter
YES
YES
panelGroupLayout
(scroll, vertical)
YES
NO
panelGroupLayout
(default, horizontal)
NO
NO
panelFormLayout
NO
NO
panelBorderLayout
NO
NO
panelDashboard
YES
YES
(inside a grid; see also
panelBox)
panelTabbed
YES
YES
(stretchChildren=first)
Poetry of
Wisdom
panelGroupLayout=vertical
panelGroupLayout=scroll
Deconstructing Facebook
panelGroupLayout=vertical
panelGrouLayout=horizontal
panelStretchLayout
Page Templates
Page Templates
Layout
Template is referenced, not compiled: easy to change at design time and run time
Behavior
Code review
public
public class
class YourBeanClass{
YourBeanClass{ []
[]
</af:pageTemplate>
</af:pageTemplate>
public
public String
String getTemplateURI(){
getTemplateURI(){
//Add
//Add your
your dynamic
dynamic code
code here
here
return
return /yourPageTemplate.jspx;
/yourPageTemplate.jspx;
}} []
[]
TIP: viewId attribute can never be null; always use a fallback EL:
viewId=#{empty bean.template ? /defaultTemplate.jspx : beanTemplate}
}}
UI RENDERING
ADF Ajax Page Lifecycle
ADF Binding
Expr. Language
ADF DataControl
bindings Object
Ajax Render
Kit
EJB 3.0
Web Service
BPEL
UI Component
Client
RDBMS
About Skins
A skin is a style sheet based on the CSS 3.0 syntax that is
specified in one place for an entire application
Developers can change the styles, icons, properties, and text of
an ADF Faces component using skinning
Skins use CSS to define the layout of ADF Faces and Trinidad
components
Do not operate on HTML elements
Use component selectors
About Skins
Any changes to the skin is picked up at runtime
No change to code is needed
With custom skins, the component's default css styles like color,
font, background-images, images , default text strings and
component properties can be changed
Each component has skinning 'hooks'
Also known as keys or selectors
Define what pieces of a component you can skin
Skin Examples
Skin Examples
CSS Rules
CSS rules are applied to elements, attributes
or ID selectors as property-value pairs
Selector{attribute:value; attribute2:value}
h1{color:red; background:yellow}
Element selectors
Markup identifers like table, h1, h2, h3, button etc
Class selectors
.someClassName{color:red}
<p class="someClassName" >
h1.someClassName{color:red}
CSS Rules
ID selectors
#SomeId {color:red}
<p id="SomeId">
Can only be used once per document because it is a unique
identifier
Attribute selectors
h1 [class] references all <h1> elements that have a "class"
attribute
h1 [class = "value"] references all <h1> elements that have a
"class" attribute with exact the iven vaue
Allows to reference attributes with partial value matches as
well
Source: http://www.w3.org/TR/REC-CSS2/selector.html
Input components
listboxes
Choices
richTextEditor
Shuttle
contentStyle applied to
each list in a shuttle
InlineStyle
Styles the root DOM element
Can use EL for context specific
CSS
Artefacts
A skin consists of the following artifacts:
A CSS file that defines the actual look of the components
A configuration file trinidad-skins.xml - that lists all skins
available for this application
trinidad-skins.xml has to be located in your applications
WEB-INF directory
An entry in the ADF Faces configuration file trinidad
-config.xml
Any other resources need to create the actual look of the
componets - additional CSS files, Images
Configuration in trinidad-config.xml
Static name
<trinidad-config
xmlns="http://myfaces.apache.org/trinidad/config">
<skin-family>custom_de</skin-family>
</trinidad-config>
Expression
<trinidad-config
xmlns="http://myfaces.apache.org/trinidad/config">
<skin-family>
#{facesContext.viewRoot.locale.language =='de' ?'custom_de' :
</skin-family>
</trinidad-config>
'custom_en'}
<family>
Configures an application to use a particular family of skins
<extends>
Extends an existing skin
<render-kit-id>
Determines render kit to use for the skin
org.apache.myfaces.trinidad.desktop
org.apache.myfaces.trinidad.pda
<style-sheet-name>
Fully qualified path to the custom CSS file
<bundle-name>
Not needed if no custom resource bundle exists
trinidad-skins.xml Example
<?xml version="1.0" encoding="ISO-8859-1"?>
<skins xmlns="http://myfaces.apache.org/trinidad/skin">
<skin>
<id>blafplus-rich-extended.desktop</id>
<family>blafplus-rich-extended</family>
<render-kit-id>org.apache.myfaces.trinidad.desktop
</render-kit-id>
<style-sheet-name>
skins/blafplus-rich-extended.css
</style-sheet-name>
<extends>blafplus-rich.desktop</extends>
<bundle-name>AdcsResourceBundle</bundle-name>
</skin>
</skins>
af|document{
-tr-rule-ref:selector(".DarkBackground:alias");
}
af|panelTabbed::body {
-tr-rule-ref:selector(".MediumBackground:alias");
}
Inhibit Inheritance
-tr-inhibit
inhibits styles from a base skin
-tr-inhibit:all
-tr-inhibit:background-color
-tr-inhibit:
af|document::splash-screen-content{
-tr-inhibit:background-image;
-tr-inhibit:background-repeat;
border:transparent;
background-color:transparent;
}
Skinning Keys
Skin Selector
A skin key is used to style a component or components in an
application, not a particular instance
A skin key usually starts with af|, contains the name of the
component, the piece of the component to skin, via a pseudoelement
::label
::content
::read-only
A skin key might look like styleclass, but ends with :alias
skin keys can only be used in a Skinning CSS file
Skin key cannot be used in a component's styleClass attribute
":"
Refers to a CSS element of an ADF Faces or Trinidad component
"::"
Refers to a part of the component
af|inputText::content
Mixing styles
af|panelHeader af|inputText:content
Refers to the content part of a textfield in a panelHeader
:lang or :locale
:rtl pseudo-class to create a style or icon definition when the
browser is in a right-to-left language
:alias skinning keys
Relative
No protocol and no leading "/"
.AFErrroIcon:alias {content: url(images/err-logo.gif)};
Context relative
Resolved relative to the web application context root
Starts with a single "/"
.AFErrroIcon:alias {content: url(/images/err-logo.gif)};
Relative to server
Allows to reference resources that are not part of the application
deployment
URL starts with "//"
.AFErrroIcon:alias {content: url(//<folder>/images/err-logo.gif)};
af|tree::expanded-icon
{
content: url(/skins/mycompany/skin_images/expand.gif);
width:16px;
height:16px;
}
af|tree::collapsed-icon
{
content: url(/skins/mycompany/collapse.gif);
width:16px;
height:16px;
}
Syntax Help
Image selection
Code Completion
E.g. type "af|inputr" then press
ctrl+Enter
Code Folding
Collapses CSS style definitions
Mouse-over code info
Syntax Help
Classes
Elements
ID
Use to navigate and
uncomment entries
Error Margin
E.g. syntax error
Theme
Provide a consistent look and feel
across multiple components for a
portion of a page
A component that sets a theme,
exposes that theme to its children
components
Common usage for themes is in a
page template where certain areas
have a distinct look
af:document
af:decorativeBox
af:panelStretchLayout
af:panelGroupLayout
Theme
<af:document theme="dark">
<af:panelTabbed>...</af:panelTabbed>
</af:document>
dark
medium
light
none (default)
Theme
Enabling themes in web.xml
<context-param>
<param-name>
oracle.adf.view.rich.tonalstyles.ENABLED
</param-name>
<param-value>false</param-value>
</context-param>
Skin selectors
af|panelBox, af|panelBox::header-start, af|panelBox::header-center, af|
panelBox::header-end,af|panelBox::content,af|panelBox::icon-style, af|
panelBox::disclosure-link,
Alias
.AFPanelBoxHeaderCoreDefault:alias
.AFPanelBoxContentCoreDefault:alias
.AFPanelBoxHeaderCoreLight:alias
.AFPanelBoxContentCoreLight:alias
more ...
<af:panelBox
icon="/skins/images/guy.gif"
text="PanelBox Skinned">
<f:facet name="toolbar"/>
</af:panelBox>
<af:panelBox
icon="/skins/images/guy.gif"
text="PanelBox Instance Skinned"
styleClass="panelBoxInstanceClass">
<f:facet name="toolbar"/>
</af:panelBox>
<af:panelBox
icon="/skins/images/guy.gif"
text="PanelBox - Skinned">
<f:facet name="toolbar"/>
</af:panelBox>
Contextual Skins
Instance specific skins that are based on the
page the component is in
Components that are added on a template
may need to be skinned based on the context
they are in
Use styleClass property on component
Reference class property by EL
Use Template parameters if componen part of a template
Contextual Skins
Example: references the current view ID for instance specific
skinning of a PanelBox that is part of a template
<af:panelBox styleClass="#{attrs.viewIdString}">
template
<attribute>
panelBox
<attribute-name>viewIdString</attribute-name>
<attribute-class>java.lang.String</attribute-class>
<default-value>"NONE"</default-value>
<required> true</required>
page3
page2
page1
</attribute>
panelBox
panelBox
panelBox
<f:attribute name="viewIdString" value="#{bean.viewId}"/>
CSS:
page1 af|panelBox::header-center:core:default
{background-image: url(/skins/images/ccont_p_blue_header_bg.png);}
af|panelBox::header-center:core:default
{background-image: url(/skins/images/ccont_p_header_bg.png);}
From ...
To ...
<div id="j_id__ctru1">
...
</div>
Skin CSS
Skin Deployment
<trinidad-config xmlns="http://myfaces.apache.org/trinidad/config">
<skin-family>#{sessionScope.skinFamily}</skin-family>
</trinidad-config>
SelectOneChoice
<af:selectOneChoice id="skinSelector"
label="Select Skin"
value="#{sessionScope.skinFamily}">
<f:selectItems value="#{skinChooserHandler.SkinChoices}"/>
</af:selectOneChoice>
Product Demonstration
Skin Debugging
Firebug
Use within FireFox
Inspect and edit HTML
View and Visualize CSS
Instantly change CSS definitions
Exploring the DOM tree
Execute JavaScript
https://addons.mozilla.org/firefox/1843/