Openlaszlo Component Reuse Design

Source: Internet
Author: User

The basic library of openlaszlo has many basic UI controls. Button, combox, etc. During project development, many basic components cannot meet the requirements. Because of the complicated UI design, complicated controls need to be designed by themselves. Controls must be customized.

 

The basic design of Laszlo component customization is as follows.

 

1. The style can be used to process the style of the control. Such as font, color, and image.

<Class name = "mtext" extends = "text"> <br/> <attribute name = "fontstyle" style = "textfontstyle" mce_style = "textfontstyle" inherit = "true "/> <br/> <attribute name = "fgcolor" style = "textfontcolor" mce_style = "textfontcolor" inherit = "true"/> <br/> ...... <br/> </class> <br/> CSS: <br/> mtext {<br/> textfontstyle: "plain"; <br/> textfontcolor: "#000"; <br/>}

 

2. interfaces or methods that can be rewritten are available. For example, a table component. Sorting rules are different in different scenarios. Therefore, the component of the base class should have a sorting method that can implement the rewrite operation.

 

... <Br/> <! --- @ Override --> <br/> <method name = "setsort" ARGs = "clo: gridcolumn, ASC: boolean "> <br/> // do your things <br/> </method>

 

3. The layout can be customized. For example, the button on the toolbar control. You can use CSS for customization. Then the button component automatically adapts to the width.

Toolbar {<br/> toolbarclassitems: "sendtoolbarbutton, canceltoolbarbutton" <br/>}

 

 

In the init method of toolbar, You can initialize and layout the button component customized by CSS.

 

 

4. In the new project, you can use the basic control and extend it after inheritance. Then follow the original CSS customization method.

 

For more instances, You can provide more detailed examples in the future.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.