SlideShare una empresa de Scribd logo
1 de 14
Decorators
Which decorators are
 currently availabel? *




                          * qooxdoo 1.3
WTF are decorators?!?
• Used to style widgets
• all in qx.ui.decoration
 • Contains 16 Files
   •   1 init file

   •   1 interface

   •   1 mixin

   •   2 abstract classes

   •   11 class files
11 Decorators?
• Border drawing
 1.   Single
 2.   Double
 3.   Beveled
 4.   Uniform


• Background drawing
 5.   Background


• Image broders
 6.   Grid
 7.   HBox
 8.   VBox
Not that easy...
qx.ui.decoration


                                           Abstract
                                                                            GridDiv
     MBackgroundImage     Background


                                                                           {xor}       use   Grid


                                                                             css3.
                                                                          BorderImage
                        Double

                                                      AbstractBox   use            {xor}

                                 Single
                                                                            BoxDiv

                                 Beveled



                                 Uniform
                                                         HBox             VBox
Border Image Select
construct : function(baseImage, insets)
{
  this.base(arguments);

  if (qx.ui.decoration.css3.BorderImage.IS_SUPPORTED)
  {
    this.__impl = new qx.ui.decoration.css3.BorderImage();
    // ...
  }
  else
  {
    this.__impl = new qx.ui.decoration.GridDiv(baseImage);
  }
  // ...
},                                             GridDiv

members : {
   // forward each property and method        {xor}      use   Grid

}
                                                css3.
                                             BorderImage
Java? No, JavaScript!

qx.Class.define("qx.ui.decoration.Grid" {
  extend : qx.ui.decoration.css3.BorderImage.IS_SUPPORTED ?
    qx.ui.decoration.css3.BorderImage :
    qx.ui.decoration.GridDiv
});




           No need to forward methods and
                     properties!
Feature combination?
                Background   Single   Double   Beveled   Uniform   Grid   HBox   VBox

   Insets         ✔          ✔         ✔        ✔         ✔        ✔      ✔      ✔
Background
  Color           ✔*         ✔*        ✔*       ✔*        ✔*
 Background
   Image          ✔          ✔         ✔        ✔         ✔
Single Border                ✔                            ✔
  Double
  Border                               ✔
  Beveled
  Border
Grid Border
   Image                                                           ✔
HBox Border
   Image                                                                  ✔
VBox Border
   Image                                                                         ✔
 * Each implemented separately
What about new features?
 • Border Radius
 • multiple background images
 • gradients
 • box shadow
 • text rotation
 • transforms
All simple CSS styles

• Could be valid in all permutations
• 6 new features ➠ 6! new classes
• Some old features also simple CSS ➠ (6+x)!

• Way too much classes to code!
Idea


• Impement all feature as separate mixin
• dynamically merge mixins in a abstract
  baseclass
Compatible
Current Decoration.js
      "main" :
      {
         decorator: qx.ui.decoration.Uniform,
         style :
         {
           // ...
         }
      },


Add border radius
      "main" :
      {
         decorator: [qx.ui.decoration.MUniformBorder,
                     qx.ui.decoration.MBorderRadius],
         style :
         {
           // ...
         }
      },
How
Current decoration manager
   var clazz = entry.decorator;
   // ...
   return cache[value] = (new clazz).set(entry.style);


New decoration manager
  var clazz = entry.decorator;
  // ...
  if (clazz instanceof Array) {
    var name = "qx.ui.decoration." + clazz.join("");
    if (!qx.Class.getByName(name)) {                 *
      qx.Class.define(name, {
         extend : qx.ui.decoration.BaseFeature,
         include : clazz
      });
    }
    clazz = qx.Class.getByName(name);
  }
  return cache[value] = (new clazz).set(entry.style);
                                                  * should be a bit more intelligent
JavaScript FTW!

Más contenido relacionado

Similar a qooxdoo Decorators

Maintainable Frontend Development with BEM
Maintainable Frontend Development with BEMMaintainable Frontend Development with BEM
Maintainable Frontend Development with BEM
Varya Stepanova
 
Website trends 2012 presentation
Website trends 2012 presentationWebsite trends 2012 presentation
Website trends 2012 presentation
Fresh_Egg
 
用jQuery玩弄你的網頁1
用jQuery玩弄你的網頁1用jQuery玩弄你的網頁1
用jQuery玩弄你的網頁1
Mu Chun Wang
 

Similar a qooxdoo Decorators (20)

dojox.gfx : the foundation for your crossbrowser advanced visualization.
dojox.gfx : the foundation for your crossbrowser advanced visualization.dojox.gfx : the foundation for your crossbrowser advanced visualization.
dojox.gfx : the foundation for your crossbrowser advanced visualization.
 
What I discovered about layout vis CSS Grid
What I discovered about layout vis CSS GridWhat I discovered about layout vis CSS Grid
What I discovered about layout vis CSS Grid
 
Accelerated Stylesheets
Accelerated StylesheetsAccelerated Stylesheets
Accelerated Stylesheets
 
Maintainable Frontend Development with BEM
Maintainable Frontend Development with BEMMaintainable Frontend Development with BEM
Maintainable Frontend Development with BEM
 
Css 3
Css 3Css 3
Css 3
 
Css 3
Css 3Css 3
Css 3
 
CSS3: Ripe and Ready
CSS3: Ripe and ReadyCSS3: Ripe and Ready
CSS3: Ripe and Ready
 
CSS and CSS3
CSS and CSS3CSS and CSS3
CSS and CSS3
 
Stupid Canvas Tricks
Stupid Canvas TricksStupid Canvas Tricks
Stupid Canvas Tricks
 
Intro to CSS3
Intro to CSS3Intro to CSS3
Intro to CSS3
 
CSS3: Ripe and Ready to Respond
CSS3: Ripe and Ready to RespondCSS3: Ripe and Ready to Respond
CSS3: Ripe and Ready to Respond
 
Css 3 session1
Css 3 session1Css 3 session1
Css 3 session1
 
Simply Responsive CSS3
Simply Responsive CSS3Simply Responsive CSS3
Simply Responsive CSS3
 
Iagc2
Iagc2Iagc2
Iagc2
 
LESS CSS
LESS CSSLESS CSS
LESS CSS
 
Website trends 2012 presentation
Website trends 2012 presentationWebsite trends 2012 presentation
Website trends 2012 presentation
 
Start Using CSS Grid Layout Today - RuhrJS
Start Using CSS Grid Layout Today - RuhrJSStart Using CSS Grid Layout Today - RuhrJS
Start Using CSS Grid Layout Today - RuhrJS
 
用jQuery玩弄你的網頁1
用jQuery玩弄你的網頁1用jQuery玩弄你的網頁1
用jQuery玩弄你的網頁1
 
Frontend United: Start using CSS Grid Layout today!
Frontend United: Start using CSS Grid Layout today!Frontend United: Start using CSS Grid Layout today!
Frontend United: Start using CSS Grid Layout today!
 
Building performance auf der Developer Conference Hamburg
Building performance auf der Developer Conference HamburgBuilding performance auf der Developer Conference Hamburg
Building performance auf der Developer Conference Hamburg
 

Más de Martin Wittemann

Cross-Platform Mobile Apps
Cross-Platform Mobile AppsCross-Platform Mobile Apps
Cross-Platform Mobile Apps
Martin Wittemann
 
qooxdoo at VKSI-RIA-Comparison
qooxdoo at VKSI-RIA-Comparisonqooxdoo at VKSI-RIA-Comparison
qooxdoo at VKSI-RIA-Comparison
Martin Wittemann
 

Más de Martin Wittemann (8)

10 Jahre Webentwicklung - am Beispiel des Frameworks qooxdoo
10 Jahre Webentwicklung - am Beispiel des Frameworks qooxdoo10 Jahre Webentwicklung - am Beispiel des Frameworks qooxdoo
10 Jahre Webentwicklung - am Beispiel des Frameworks qooxdoo
 
Pointer events
Pointer eventsPointer events
Pointer events
 
qooxdoo 3.5
qooxdoo 3.5qooxdoo 3.5
qooxdoo 3.5
 
Cross-Platform Mobile Apps
Cross-Platform Mobile AppsCross-Platform Mobile Apps
Cross-Platform Mobile Apps
 
Qooxdoo at B::IT
Qooxdoo at B::ITQooxdoo at B::IT
Qooxdoo at B::IT
 
qooxdoo at VKSI-RIA-Comparison
qooxdoo at VKSI-RIA-Comparisonqooxdoo at VKSI-RIA-Comparison
qooxdoo at VKSI-RIA-Comparison
 
qooxdoo Form Management
qooxdoo Form Managementqooxdoo Form Management
qooxdoo Form Management
 
Data Binding in qooxdoo
Data Binding in qooxdooData Binding in qooxdoo
Data Binding in qooxdoo
 

Último

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 

Último (20)

GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 

qooxdoo Decorators

  • 2. Which decorators are currently availabel? * * qooxdoo 1.3
  • 3. WTF are decorators?!? • Used to style widgets • all in qx.ui.decoration • Contains 16 Files • 1 init file • 1 interface • 1 mixin • 2 abstract classes • 11 class files
  • 4. 11 Decorators? • Border drawing 1. Single 2. Double 3. Beveled 4. Uniform • Background drawing 5. Background • Image broders 6. Grid 7. HBox 8. VBox
  • 5. Not that easy... qx.ui.decoration Abstract GridDiv MBackgroundImage Background {xor} use Grid css3. BorderImage Double AbstractBox use {xor} Single BoxDiv Beveled Uniform HBox VBox
  • 6. Border Image Select construct : function(baseImage, insets) { this.base(arguments); if (qx.ui.decoration.css3.BorderImage.IS_SUPPORTED) { this.__impl = new qx.ui.decoration.css3.BorderImage(); // ... } else { this.__impl = new qx.ui.decoration.GridDiv(baseImage); } // ... }, GridDiv members : { // forward each property and method {xor} use Grid } css3. BorderImage
  • 7. Java? No, JavaScript! qx.Class.define("qx.ui.decoration.Grid" { extend : qx.ui.decoration.css3.BorderImage.IS_SUPPORTED ? qx.ui.decoration.css3.BorderImage : qx.ui.decoration.GridDiv }); No need to forward methods and properties!
  • 8. Feature combination? Background Single Double Beveled Uniform Grid HBox VBox Insets ✔ ✔ ✔ ✔ ✔ ✔ ✔ ✔ Background Color ✔* ✔* ✔* ✔* ✔* Background Image ✔ ✔ ✔ ✔ ✔ Single Border ✔ ✔ Double Border ✔ Beveled Border Grid Border Image ✔ HBox Border Image ✔ VBox Border Image ✔ * Each implemented separately
  • 9. What about new features? • Border Radius • multiple background images • gradients • box shadow • text rotation • transforms
  • 10. All simple CSS styles • Could be valid in all permutations • 6 new features ➠ 6! new classes • Some old features also simple CSS ➠ (6+x)! • Way too much classes to code!
  • 11. Idea • Impement all feature as separate mixin • dynamically merge mixins in a abstract baseclass
  • 12. Compatible Current Decoration.js "main" : { decorator: qx.ui.decoration.Uniform, style : { // ... } }, Add border radius "main" : { decorator: [qx.ui.decoration.MUniformBorder, qx.ui.decoration.MBorderRadius], style : { // ... } },
  • 13. How Current decoration manager var clazz = entry.decorator; // ... return cache[value] = (new clazz).set(entry.style); New decoration manager var clazz = entry.decorator; // ... if (clazz instanceof Array) { var name = "qx.ui.decoration." + clazz.join(""); if (!qx.Class.getByName(name)) { * qx.Class.define(name, { extend : qx.ui.decoration.BaseFeature, include : clazz }); } clazz = qx.Class.getByName(name); } return cache[value] = (new clazz).set(entry.style); * should be a bit more intelligent

Notas del editor

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n