Getting Started with Endeca LatitudeFull description
MATLAB
We are currently in a world of technology where everyone has a camera and wants to take photos of people or places. All of them want to enhance their photos and will eventually end up with Adobe Photoshop.
Ubuntu Manual
Alloy UI with Life ferra y – Pa rt 1 By Mohib Ma M ansuri
A b o ut A ut uthor hor Mohib Mansuri Liferay | Magento | Drupal
Over 3+ years of hands hand s on experience in Liferay Portal and theme development, and Open Source technologies like Drupal, Magento, and Joomla.
Successfully executed 7+ trainings on Liferay technology.
Creating and using his own initiative
Very good expertise on creating cre ating a responsive respons ive theme
Alloy Allo y UI with Lifer Liferay ay – Part 1 1
Ta T a b le of of C o nt nte e nt nts s I.
Installatio Instal lation n o f Allo Alloy y UI ....... .............. ............... ............... .............. .............. .............. ............... ............... .......3
II.
Sample Sam ple W eb App for A uto Comp Complet lete e ....... .............. ............... ............... .............. .............. ........... ....5
III.
Alloy Allo y UI wit with h Life Liferay ray ............. .................... .............. .............. .............. ............... ............... .............. ............ .....7 Theme The me .................................... ..................................... ............. 7 Layout Layo utss .......................................... ..................................... ...... 8 Portl Po rtlet et .............................. ..................................... ................... 9
IV.
Sample Alloy UI Portlet in Liferay ................................................ 10
V.
Componen Comp onents ts of Allo Alloy y UI ............. ..................... ............... .............. .............. .............. ............... ............. ..... 11 Forms related components ............................................................... 11 Image related components ............................................................... 17 Audio-Vi Aud io-Vide deo o rel related ated compone components nts..... .......... .......... .......... ........... ...... ...... ........... .......... .......... .......... .......... ..... 20 Webpage Web page and Layout Layout related related componen components ts ..... .......... ........... ...... ...... ........... .......... .......... .......... .......... ..... 21
2
Alloy UI with Liferay – Part 1
Installation of Alloy UI AlloyUI is the UI framework fra mework for Liferay Portal, and a nd covers 3 main areas a reas of the front-end stack: HTM HTML, L, CSS, JavaScript. Download library of Alloy UI using below link http://cdn.alloyui.com/downloa http://cdn.alloyui. com/downloads/alloy-1.7.0.zip ds/alloy-1.7.0.zip Or https://github.com/liferay https://githu b.com/liferay/alloy-ui/archive /alloy-ui/archive/master.zip /master.zip After download, download , unzip alloy-1.7 alloy -1.7.0.zip .0.zip or alloy-ui-master. alloy- ui-master.zip zip into your web application source code. And And add Alloy UI UI javascript and css files into your HTML page. Ja va sc ri p t fil fi l e <script src=" alloy-1.7.0/build/aui/aui.js" type="text/javascript">
This javascript java script that allows allo ws you to load all alloyUI a lloyUI component`s javascript java script files into HTML page.
Alloy Allo y UI with Lifer Liferay ay – Part 1 3
C SS f ile
This CSS file that allows a llows you to load all a ll alloyUI component`s componen t`s CSS files into HTML page. If you don’t want to download d ownload than first load the seed file into your HTML source code. Copy and paste below script in your HTML page. <script src="http://cdn.alloyui.com/1.7.0/aui/aui-min.js">
This is a small sma ll JavaScript JavaScrip t that allows you to load any a ny AlloyUI component compone nt like javascripts, javascripts, css and images on your page.
Let's create an AUI instance and do some simple stuff, like auto complete textbox with appropriate values. Then let's run auto complete co mplete textbox!
4
Alloy UI with Liferay – Part 1
Sa mp le We b A p p fo r A ut uto o C o mp le te Initialize Init ialize AlloyUI and load a module, e.g., Auto Auto Complete. Write below code cod e in your HTML page pa ge <script type="text/javascript" charset="utf-8"> AUI().use('aui-autocomplete', function(A) { var states = [ ['AL', 'Alabama', 'The Heart of Dixie'], ['CA', 'California', 'The Golden State'], ['DE', 'Delaware', 'The First State'], ['DC', 'District of Columbia', "The Nation's Capital"], ]; window.AC = new A.AutoComplete( { dataSource: states, schema: { resultFields: ['key', 'name', 'description'] }, matchKey: 'name', delimChar: ',', contentBox: '#myAutoComplete' } ); AC.render(); });
Alloy Allo y UI with Lifer Liferay ay – Part 1 5
O u t p u t o f “A “ A u t o C o m p le le t e ” c o m p o n e n t .
Figure 1 :
Output of “Auto Complete” component.
This component is used to provide provi de suggestions suggestion s while users type into the field.
6
Alloy UI with Liferay – Part 1
A ll llo o y UI UI wit w ith h Lifer ifera ay AlloyUI is a UI framework that helps you build b uild dynamic dyna mic and flexible flex ible web applicationss in liferay. It is a JavaScript library, a CSS framework, application framework, a set of HTML HTM L techniq technique ue and a nd a taglib library that controls patterns patterns from the best libraries to allow developers acro a cross ss multi-skilled teams to deliver rich and dynamic applications like portlets, themes and layouts. Alloy UI is an In-Built library libra ry of liferay, All AlloyUI component componen t like javascripts,, css and images are pre-loaded in liferay portal javascripts portal.. Here we display how use AlloyUI with Theme, Layout and Portlet
Theme In liferay theme, theme, when we use to define any JavaScript globally, than we define it in main.js file of theme. For e.g.: AUI().use( 'aui-viewport' );
It is used to provide a cross-browser technique of adapting web design to display size size..
Alloy Allo y UI with Lifer Liferay ay – Part 1 7
Viewport allows you to modify mod ify your CSS for fo r the four most frequently f requently used page widths: 960px, 720px, 480px, and 320px for desktops, tablets, tablets, smart phones and mobile phones. phones. When you write above code cod e in main.js file f ile and deploy theme, the me, it adds add s a few classes to the HTML element depending on the width of the window. >
Based on these classes, you may create selectors which match some devices only.
Layouts
In Liferay, Liferay, Layout is used to set position and create drag zone for portlet in page. Alloy UI allow us to define width for particu pa rticular lar column in percentage (%) value. value. For e.g.:
Here “aui-w20” “aui-w20” is used to set 20% width of column. It will automatically automatically create CSS for each column.
8
Alloy UI with Liferay – Part 1
Portlet In liferay portlet, Alloy UI is used to create professional user interface. It contains custom form ta ta gs. Like text box, lable, radio rad io button etc. Alloy UI provides a graphic g raphic user interface interfa ce method for constructing constructin g forms, form validations, pagination pagination,, tool tip, tree view etc. In Alloy UI, Liferay has custom customized ized form element elementss into Java Server Pages Standard Tag Ta g Library (JSTL) (JSTL) tags. The form elements start with aui, like in the following piece of code. cod e. " e nctyp
These aui tags are defined d efined in liferayli feray-aui.tld. aui.tld. They are interpreted by classes clas ses in the com.liferay. com.lif eray.ttaglib. aglib.aui aui package. packa ge. For using AlloyUI in liferay portlet, we need to define Taglib for aui in jsp page <%@ taglib u ri ri="http://alloy.liferay.com ="http://alloy.liferay.com/tld/a /tld/a ui" prefix="aui"%>
Paste this line in your jsp. Now you can use aui tags in your jsps. Here the button tag and button is shown with the syntax of if it. ' type="button" value="re move " />
Alloy Allo y UI with Lifer Liferay ay – Part 1 9
Sample Alloy UI Portlet in Liferay Here we create a simple liferay portlet, which contains AlloyUI form. Step1: Create simple simple jsp portlet in liferay Step2: Edit view.jsp of portlet and write below code in jsp page <%@ taglib u ri ri="http://alloy.liferay.com ="http://alloy.liferay.com/tld/a /tld/a ui" prefix="aui"%>
Step3: Deploy portlet and check output.
Figure 2 :
10
Output of simple AlloyUI form portlet
Alloy UI with Liferay – Part 1
C o mp mpo o ne nent nts s o f All Allo y UI Alloy UI provides us different differe nt components to create awesome awes ome website. All componentss are defined in various categories component categories like Form, Images, Audio Video, Webpage W ebpage and layout, Diagrams etc.
Forms related compon comp onents ents Fo rm Build e r
Form Builder provides a graphic user interface method for constructing forms with Textbox, Textarea, Checkbox, Button, Button, Select, Radio Rad io Buttons, File Upload and Fiel Fieldset. dset.
Figure 3 :
Example of Form Builder Alloy Allo y UI with Lifer Liferay ay – Part 1 11
Fo rm V a l i d a t o r
Form Validator allows us to create validation valida tion for form entries.
Figure 4 :
Example of Form validator
Form valitador component provide javascript to validate a ll form elements elements in portlet and display d isplay each element with with error message with label in red color text.
12
Alloy UI with Liferay – Part 1
A u t o C o m p le t e
Auto Complete component co mponent is used to provide provid e suggestions while users type into the field.
Figure 5 :
Example of of “Auto Complete” component.
Bu t t o n It It e m
Button Item provides an Button a n iconic buttons for constructing graphical interface for website.
Figure 6 :
Example for Button Item with various iconic buttons.
Alloy Allo y UI with Lifer Liferay ay – Part 1 13
Cha r Co unter
Char Counter Counter allows us to count characters from textbox and limits the amount of text in a field. With new instance of Char Counter using these two elements elements and setting the maximum length to any a ny number.
Figure 7 :
Example of Char Counter with single textbox.
D a t e Pi c k e r
Create a dynamic datepicker d atepicker that allows users to select the date da te with a calendar.
Figure 8 : 14
Example of Datepicker with calendar view.
Alloy UI with Liferay – Part 1
Te xt b o x Lis List t
Textbox list li st allows us to displays displ ays user`s choices choic es to them as a graphic list. The input field should be automatically automatica lly updated with the first result as the user types, automatically automatically selecting the section of the text the user has not typed yet. You can define a more definite schema schema and add the matchKey choice to choose the key or numeric numeric index on the schema to match the result against.
Figure 9 :
Example of Textbox List with dummy data.
Alloy Allo y UI with Lifer Liferay ay – Part 1 15
Tooltip
It gives users related information or content, such as help text, images or video. You can set the content of a tooltip with the title attribute attrib ute of a HTML element.
Figure 10 :
Example of Tooltip.
A c e Ed Ed i t o r
Ace Editor allows allo ws us to use embeddable embedd able code cod e editor that matches the features of native editors. It is a simple HTML element Editor. The editor can also be set to load with code already alread y written. written.
Figure 11 : 16
Example of Ace Editor
Alloy UI with Liferay – Part 1
Image related re lated components components
Carousel
Carousel provides an interactive way of cycling images through elements. It Carousel is simple image scroll with navigation.
Figure 12 :
Example of Carousel
Alloy Allo y UI with Lifer Liferay ay – Part 1 17
I m a g e V ie ie w e r
Image Viewer allows Image allows users to view and a nd navigate throughout throughout a collection of images. Parameters Parameters can add a dd into Image Viewer to change element such as image captions, image positioning, positioning, and a nd when images within the viewer are a re loaded. It is also use to declaring what elements are to be used to caption, navigation arrows, close button, button, and even the loader, which image being displayed. When user will click on image thumbnail, it will open large la rge image in popup.
Figure 13 : 18
Example Example of Image Viewer
Alloy UI with Liferay – Part 1
I m a g e C ro p p e r
Image Cropper provides a draggable or resizable cropper widget to crop image sizes. You can prevent Image Cropper from moving, you can turn t urn of Cropper resizing resizing and you can also maintain a continuo continuous us aspect ratio for Image Cropper. But liferay liferay does not provide library for Ima Ima ge Cropper, Cropper, We need to add bellow script in our project. <script <script s rc="http://cdn.alloyui.co m/1.7.0/aui/au /1.7.0/aui/au i-min.js">
Figure 14 :
Example of Image Cropper
(Note: Image Cropper is not totaly feasible with liferay UI)
Alloy Allo y UI with Lifer Liferay ay – Part 1 19
A udio-Video related compon comp onents ents
Audio
Audio Component Componen t allows us to create an interactive intera ctive audio player pl ayer in HTML5 HTM L5 with contingency contingency for old browsers. (Note: (Note: Audio Component is not totaly feasible feasi ble with liferay)
Video
Video Component allows allo ws us to create an a n interactive HTML5 HT ML5 video player with contingency Flash Flas h video player. pla yer. You can specify sp ecify the Video's Video' s width and height by passing values. values. You can also a lso load a poster image in the Video player before the user begins playing the video.
Figure 15 : 20
Example of Video component
Alloy UI with Liferay – Part 1
Webpage and Layout related re lated components components
D a t a Ta b l e
Data Table provides the user with a technique of organizing or ganizing,, displaying, d isplaying, and editing ed iting tables tables of information. Table cells can also be edited ed ited when permitted permit ted in the columns object.
Figure 16 :
Example of Data Table
Alloy Allo y UI with Lifer Liferay ay – Part 1 21
D ia i a g ra m Bu Bu ili l d e r
Diagram Builder allows us to drag-drop Diagram dra g-drop diagram elements, elements, build new tasks, draw connectors from node to node. We should also populate our new Diagram Diagr am fields with a Diagr Diagram am field passing it a name, type, and x y location. But liferay liferay does not provide library for Diagram Diagram Builder, We need to add ad d bellow script in our project. <script src="http://cdn.alloyui.com/1.7.0/aui/aui-min.js">
Figure 17 :
Example of Diagram Builder
(Note: (Note: Diagram Diag ram Builder Builder is not not totaly totaly feasible f easible with liferay lif eray UI) 22
Alloy UI with Liferay – Part 1
Dialog
Dialog allows us to displays content in a dialog window that can be dragged or accessible as a model. You can align the component on the the center of your screen. You can even change the width and height of the dialog d ialog box. You can also als o turn off the facility to drag or resize your dialog. d ialog. Another thing is that you can also a lso add butt buttons ons to your dialog component. component.
Figure 18 :
Example of Dialog Component
Alloy Allo y UI with Lifer Liferay ay – Part 1 23
I/ O
I/O allows you to make asynchronous HTTP (Ajax) requests. You can specify the type type of the requ request est for e.g., json, xml, text, javascript.
Figure 19 :
Example of I/O
N e st e d Lis ist t
Nested List gives gives the user the facility to interact interact with a list element. element. You Yo u can set a placeholder that will will indicate as you drag your element element where it will be dropped. droppe d.
Figure 20 : 24
Example Example of Nested List
Alloy UI with Liferay – Part 1
Node
Node allows for commu communication nication with with the DOM. DO M. It provides a set of techniques techniq ues that assists in DOM manipulation. Simple DOM communication comm unication is possible without the node component, with A.one, A.all, and such commands being supplied in the YUI base code. However, more complex actions which would be quite difficult with that code alone are made much simpler simpler with the node component. Node allows you to interact with with the DOM in all sorts s orts of ways that would would usually be quite quite complex. You can get the margi margin n or padding padd ing on a certain element,, change an element's ID, element ID, center an element in a predecessor container, get or set an feature of an element, or many other usefu usefull things.
Figure 21 :
Example of Node component
Alloy Allo y UI with Lifer Liferay ay – Part 1 25
Paginator
Paginator provides a set of controls to navigate through through paged data. da ta. There are many configuration options that can be passed pas sed into the Paginator. You can also change what is displayed in the different links of the Paginator.
Figure 22 :
Example of paination
Pro g re ss Ba r
Progress Bar allows users to view loading Progress loa ding progress progress in real time. You Yo u can see what Progress Bar looks like lik e when it loads loa ds larger la rger content. You can set an Asynchronous Queue which will step s tep through 100 iterations and a nd set Progress Progr ess Bar value on each iteration. This can give you an idea of what loading will look like in real world usage.
Figure 23 :
26
Example of Progress Bar
Alloy UI with Liferay – Part 1
Po rt a l La La y o u t
Portal Layout enables a layout la yout with with draggable drag gable or droppable functionality. You can set another anothe r HTML container to receive dropped dro pped Portal Porta l Layout object. Portal Layout can now drag and drop d rop content nodes onto one another and inside the separate DIV. DIV. Liferay Layout is also based upon Portal Layout.
Figure 24 :
Example of Portal Layout
Alloy Allo y UI with Lifer Liferay ay – Part 1 27
Pro p e rt y Lis ist t
Property List allows users to view and change properties from JavaScript Property JavaScript objects. You can set an object's editor choice containing a new constructor. constructor. This option creates crea tes a checkbox checkbo x input inside the object ob ject which can be toggled on/off within Property List.
Figure 25 :
28
Example Example of Property Property List L ist
Alloy UI with Liferay – Part 1
Rating
Rating allows users users to set rating ra tingss for content, blog, wiki etc. you can pass the size option a whole number number for how many options you want rating to have. You can also a lso define Rating choices from HTML HTML radio inputs, enabling control over individual title for each input. Ratting can be defined as a thum thumb b rating and star rating.
Figure 26 :
Example Example of Rating
Alloy Allo y UI with Lifer Liferay ay – Part 1 29
Sc h e d u le le r
Scheduler allows user to access scheduler widget with built-in calendar. calenda r. You can add ad d other views to your views option o ption with the Scheduler Sche duler View constructors. constru ctors. This will permits you to view your events in different formats. You can also als o view Scheduler to start on.
Figure 27 :
30
Example of Scheduler
Alloy UI with Liferay – Part 1
Viewport
Viewport allows us to create cre ate a cross-browser cross -browser method of o f adapting ada pting web design to display size. Viewport allows you to modify your your CSS for the four most normally normally used page widths: 960px, 720px, 480px, and a nd 320px, 960 for desktops and lapt laptops, ops, 720 for tablets, 480 for smart phones, and 320 for mobile phones. It is very useful to create Responsive Design.