Complete Download (Ebook) Learning ExtJS - Fourth Edition by Carlos Méndez ISBN 9781784394387, 1784394386 PDF All Chapters
Complete Download (Ebook) Learning ExtJS - Fourth Edition by Carlos Méndez ISBN 9781784394387, 1784394386 PDF All Chapters
com
https://ebooknice.com/product/learning-extjs-fourth-
edition-5151294
DOWLOAD EBOOK
https://ebooknice.com/product/react-18-design-patterns-and-best-
practices-fourth-edition-early-access-55132010
ebooknice.com
ebooknice.com
ebooknice.com
(Ebook) Simulation, Fourth Edition by Sheldon M. Ross ISBN
9780125980630, 0125980639
https://ebooknice.com/product/simulation-fourth-edition-981832
ebooknice.com
https://ebooknice.com/product/american-trade-politics-fourth-
edition-2202478
ebooknice.com
https://ebooknice.com/product/advanced-soil-mechanics-fourth-
edition-5143770
ebooknice.com
ebooknice.com
ebooknice.com
Learning Ext JS
Fourth Edition
Carlos A. Méndez
Crysfel Villa
Armando Gonzalez
BIRMINGHAM - MUMBAI
Learning Ext JS
Fourth Edition
All rights reserved. No part of this book may be reproduced, stored in a retrieval
system, or transmitted in any form or by any means, without the prior written
permission of the publisher, except in the case of brief quotations embedded in
critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy
of the information presented. However, the information contained in this book is
sold without warranty, either express or implied. Neither the authors, nor Packt
Publishing, and its dealers and distributors will be held liable for any damages
caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the
companies and products mentioned in this book by the appropriate use of capitals.
However, Packt Publishing cannot guarantee the accuracy of this information.
ISBN 978-1-78439-438-7
www.packtpub.com
Credits
Authors Copy Editors
Carlos A. Méndez Vikrant Phadke
Crysfel Villa Angad Singh
Armando Gonzalez Ameesha Smith-Green
Commissioning Editor
Ashwin Nair Indexer
Tejal Daruwale Soni
Acquisition Editor
Shaon Basu Production Coordinator
Manu Joseph
Technical Editor
Menza Mathew
About the Authors
Trying to explore creativity with a deep passion, Carlos has created many Ext JS
components and VB components for private companies and was also involved
in graphic design, such as illustrations and small animations used for interactive
presentations by some companies in México. He always has a passion for creating
and learning new things on the Web.
First of all, I would like to thank my mother and brother for their
support and help in realizing this project. Thanks to my best friend,
Nacir Garcia Junior, for his support and friendship over these last
years. Also, thanks to my father and uncles, whose challenges,
work pressures, and work and personal knowledge were passed on
through all these years in matters of design and business logic. These
have brought me where I am today. Without all you guys, I would
not have been able to accomplish many achievements and goals.
Thanks, everybody!
Crysfel Villa is a software engineer with more than 8 years of experience with
JavaScript. He started his career as a web developer working with HTML and basic
JavaScript in the late 1990s but then started focusing on server-side technologies,
such as PHP and Java J2EE.
Before he started working with the Ext JS library, he loved to work with MooTools,
but in late 2007, he started learning about an awesome new library that was
emerging as an open source project. At that time, version 2.0 of the Ext JS library had
just been released, and Crysfel started using this new library for medium-to-large
projects in the agency that he used to work for.
More recently, Crysfel has been getting into new technologies such as Angular JS
and React Native. If you want to find out more about his work, you can follow him
on Twitter (@crysfel) or download his open source projects from GitHub (crysfel).
Writing this book was very hard, especially when you are a busy
person and really like to get involved in exciting things. I want to
give special thanks to my wife, Hazel, who supported me in every
step of the process. Without her, this wouldn't have been possible.
She read all the scripts before I submitted them. She usually found
some mistakes or things to clarify. Her work on this project
is priceless.
In 2011, Olivier left a full-time job as a Delphi and PHP developer to concentrate on
his own company, HQF Development (http://hqf.fr). He currently runs a number
of websites, including http://krystallopolis.fr, http://artsgaleries.com,
http://www.battlesoop.fr, http://www.livrepizzas.fr, http://www.
papdevis.fr, and http://olivierpons.fr, which is his own web development
blog. He's currently learning Unity and building a game on his own. He works as a
consultant, teacher, and project manager and sometimes helps major companies as a
senior/highly skilled developer.
Juris Vecvanags started a career in the IT field in early 90s. At that time, he had
the chance to work with a broad range of technologies and share his knowledge with
Fortune 500 companies as well as private and government customers.
When it comes to web technologies, this invaluable experience serves as his ground
to be a trusted advisor and competent reviewer. When Juris is away from the office,
you can find him speaking at meetups in the San Francisco Bay Area, Chicago, and
New York. Among the topics he covers are Node.js, Ext JS, and Sencha Touch.
Did you know that Packt offers eBook versions of every book published, with PDF
and ePub files available? You can upgrade to the eBook version at www.PacktPub.
com and as a print book customer, you are entitled to a discount on the eBook copy.
Get in touch with us at service@packtpub.com for more details.
https://www2.packtpub.com/books/subscription/packtlib
Do you need instant solutions to your IT questions? PacktLib is Packt's online digital
book library. Here, you can search, access, and read Packt's entire library of books.
Why subscribe?
• Fully searchable across every book published by Packt
• Copy and paste, print, and bookmark content
• On demand and accessible via a web browser
[i]
Table of Contents
Configurations 40
Statics methods and properties 43
Explanation 45
The Singleton class 46
Aliases 47
Loading classes on demand 50
Enabling the loader 51
Working with the DOM 52
Getting elements 53
Query – how do we find them? 55
DOM manipulation – how do we change it? 57
Summary 59
Chapter 3: Components and Layouts 61
The component life cycle 61
The initialization phase 63
The rendering phase 66
The destruction phase 69
The life cycle in action 70
About containers 73
Types of containers 78
The viewport 78
The panel 79
Panels versus containers 80
The Window component 81
The layout system 82
The Border layout 82
The Fit layout 84
The Card layout 85
The Accordion layout 86
The Anchor layout 87
More layouts 89
Comments about using layouts 89
Summary 91
Chapter 4: It's All about the Data 93
Ajax 94
Passing parameters to an Ajax request 98
Setting timeout for Ajax request calls 99
[ ii ]
Table of Contents
Models 100
Mappings 103
Validators 105
Custom field types 108
Relationships 110
One-to-many associations 111
One-to-one associations 113
Working with the store 115
Adding new elements 116
Looping through the records/models in the store 118
Retrieving the records in the store 119
By index position 119
First and last records 119
By range 119
By ID 120
Removing records 120
Retrieving remote data 121
Ajax proxy 121
Readers 124
The XML reader 125
Sending data 127
Summary 132
Chapter 5: Buttons and Toolbars 133
Event-driven development 133
Creating a simple button 136
Setting icons on buttons 138
Icon alignment on buttons 140
Handling button events 141
Segmented buttons 142
Adding menus 144
Toolbars 148
Toolbar button groups 150
The breadcrumb bar 153
Handling selections in the breadcrumb bar 156
The main menu for our application 158
Summary 163
[ iii ]
Table of Contents
[ iv ]
Table of Contents
[v]
Table of Contents
[ vi ]
Table of Contents
[ vii ]
Preface
Over the past few years, Ext JS has become a popular and powerful JavaScript
framework for desktop application development. For an Ext JS developer, the
learning curve is not very easy/fast and I have seen cases where developers learning
this framework find it to be a slow process. While writing this book I was thinking
about the easiest and most comprehensible points so that you can understand the
basics, just as I would have liked to learn about the framework if I was in your place.
This book is intended for developers who have the desire to learn and begin using
this framework for their applications, and also for developers who have not started
using the current version. It is written as an easy-to-follow guide that will help you
understand the basics and fundamentals of the framework. If you have experience
with previous versions of the framework, this book may clear many of your doubts
about upgrading and how things happen in version 5.x.
This book covers all of the basic information you need to know to start development
with this nice and powerful framework.
Chapter 2, The Core Concepts, is about the framework's class system, and tells you how
to use object-oriented programming with Ext JS. Also, this chapter explains how to
extend classes, how to inherit properties, and the use of the Loader system in order
to define and require dependencies in a dynamic way.
[ ix ]
Preface
Chapter 3, Components and Layouts, explains how components work, how they are
created, their life cycle, and how to take advantage of all this. Here, you also learn
about types of containers and the layout system, which will help you create amazing
UIs with little effort.
Chapter 4, It's All about the Data, explains how the framework handles and
manipulates data to display information using data-aware widgets or components.
Chapter 5, Buttons and Toolbars, shows you how to make use of component events;
listen to events; (mainly) create buttons, toolbars, and menus; and set the most basic
configurations for these components.
Chapter 6, Doing It with Forms, talks about the form component, the available fields
that we can use in our forms, and how to collect and submit data.
Chapter 7, Give Me the Grid, covers the basics of the most popular component, the
Grid panel, in the framework, how to implement it, its column model, and custom
data renderers for displaying data. We also see how to listen to events in the Grid
panel and look at some plugins and features (specific capabilities) that can be
implemented in the grid.
Chapter 8, DataViews and Templates, explains how to make use of DataViews and
templates to create data-aware views, implement a nice organization of our data,
and set styles and custom logic for the representation of data.
Chapter 9, The Tree Panel, covers the use of the tree panel component and its
implementation. It also explains how to create stores and data for this component.
Chapter 10, Architecture, is one of the most important chapters in the book. It shows
how to create an application using the MVC and MVVM patterns. This is done in
order to create applications that can be scalable and easy to maintain. The MVVM
pattern, which is a powerful pattern for reducing code, is introduced in version 5.
Chapter 11, The Look and Feel, demonstrates how to create new themes inside the
framework and applications by giving our applications a new look and some color
changes (themes). Also, you learn how to create specific component-style UIs using
Compass and Sass.
Chapter 12, Responsive Configurations and Tablet Support, explains how we can use
touch screen themes and how to set responsive configurations in components in
order to make those components responsive-aware.
[x]
Preface
Chapter 13, From Drawing to Charting, talks about the basics of drawing and chart
creation. We see how to create charts by the use of the SVG/VML engines. This
chapter also explains how to add the Chart package to applications and the theme
engine introduced in version 5.
Chapter 14, Finishing the Application, covers how to prepare our application for
the production environment and deployment, covering the most essential parts for
final production.
Chapter 15, What's Next?, shows you where to get more feedback and resources such
as forums, other useful resources to get information tutorials from, and so on. This
chapter also gives a sneak peek into some useful plugins (commercial and free).
These browsers come in handy because they come with debugging tools for
easy development.
• Xampp: https://www.apachefriends.org/index.html
[ xi ]
Preface
Conventions
In this book, you will find a number of styles of text that distinguish between
different kinds of information. Here are some examples of these styles, and an
explanation of their meaning.
Code words in text are shown as follows: "Inside the app/view folder, we remove
all existing files (the initial skeleton), and proceed to create the initial view our
application will have."
[ xii ]
Preface
When we wish to draw your attention to a particular part of a code block, the
relevant lines or items are set in bold:
Ext.define('myApp.store.modulesTreeDs', {
extend: 'Ext.data.TreeStore',
requires: [
'myApp.model.modulesModel',
'Ext.data.proxy.Ajax'
],
constructor: function(cfg) {
var me = this;
cfg = cfg || {};
me.callParent([Ext.apply({
storeId: 'mymodulesTreeDs',
autoLoad: true,
model: 'myApp.model.modulesModel',
proxy: {
type: 'ajax',
url: 'serverside/data/menu_extended.json'
}
}, cfg)]);
}
}); Any command-line input or output is written as follows:
sencha -sdk /path/to/ext generate app myApp /path/to/myApp
[ xiii ]
Preface
New terms and important words are shown in bold. Words that you see on the
screen, in menus or dialog boxes for example, appear in the text like this: "Try to
write something in the Customer ID field and you will see that it is read-only."
Reader feedback
Feedback from our readers is always welcome. Let us know what you think about
this book—what you liked or may have disliked. Reader feedback is important for us
to develop titles that you really get the most out of.
Customer support
Now that you are the proud owner of a Packt book, we have a number of things to
help you to get the most from your purchase.
[ xiv ]
Preface
Errata
Although we have taken every care to ensure the accuracy of our content,
mistakes do happen. If you find a mistake in one of our books—maybe a mistake in
the text or the code—we would be grateful if you would report this to us. By doing
so, you can save other readers from frustration and help us improve subsequent
versions of this book. If you find any errata, please report them by visiting http://
www.packtpub.com/submit-errata, selecting your book, clicking on the errata
submission form link, and entering the details of your errata. Once your errata
are verified, your submission will be accepted and the errata will be uploaded on
our website, or added to any list of existing errata, under the Errata section of that
title. Any existing errata can be viewed by selecting your title from http://www.
packtpub.com/support.
Piracy
Piracy of copyright material on the Internet is an ongoing problem across all media.
At Packt, we take the protection of our copyright and licenses very seriously. If you
come across any illegal copies of our works, in any form, on the Internet, please
provide us with the location address or website name immediately so that we can
pursue a remedy.
We appreciate your help in protecting our authors, and our ability to bring you
valuable content.
Questions
You can contact us at questions@packtpub.com if you are having a problem with
any aspect of the book, and we will do our best to address it.
[ xv ]
An Introduction to Ext JS 5
When learning a new technology such as Ext JS, some developers face a hard time
to begin with, so this book will give you the best possible way to start to understand
this technology more than any other source. We have to go from the library
documentation to blogs and forums looking for answers, trying to figure out how the
library and all the components work together. Even though there are tutorials in the
official learning center, it would be great to have a guide to learn the library from the
basics to a more advanced level; this is the main goal of this book.
Ext JS is a state of the art framework to create Rich Internet Applications (RIAs).
The framework allows us to create cross-browser applications with a powerful set of
components and widgets. The idea behind the framework is to create user-friendly
applications in rapid development cycles, facilitate teamwork (MVC or MVVM), and
also have a long-term maintainability.
Ext JS is not just a library of widgets anymore; the brand new version is a framework
full of new exciting features for us to play with. Some of these features are the new
class system, the loader, the new application package, which defines a standard way
to code our applications, and much more awesome stuff.
The company behind the Ext JS library is Sencha Inc. They work on great products
that are based on web standards. Some of the most famous products that Sencha also
have are Sencha Touch and Sencha Architect.
In this chapter, we will cover the basic concepts of the framework of version 5.
You'll learn how to set up the library or SDK and create our first program, get to
know the available tools to write our code, and take a look at some of the new
features in Ext JS 5.
[1]
An Introduction to Ext JS 5
Ext JS is best suited for enterprise or intranet applications; it's a great tool to develop
an entire CRM or ERP software solution. One of the more appealing examples is the
Desktop sample (http://dev.sencha.com/ext/5.1.0/examples/desktop/index.
html). It really looks and feels like a native application running in the browser. In
some cases, this is an advantage because the users already know how to interact with
the components and we can improve the user experience.
Ext JS 5 came out with a great tool to create themes and templates in a very simple
way. The framework for creating themes is built on top of Compass and Sass, so
we can modify some variables and properties and in a few minutes we can have a
custom template for our Ext JS applications. If we want something more complex
or unique, we can modify the original template to suit our needs. This might be
more time-consuming depending on our experience with Compass and Sass.
Compass and Sass are extensions for CSS. We can use expressions, conditions,
variables, mixins, and many more awesome things to generate well-formatted CSS.
You can learn more about Compass on their website at http://compass-style.org/.
The new class system allows us to define classes incredibly easily. We can develop
our application using the object-oriented programming paradigm and take advantage
of the single and multiple inheritances. This is a great advantage because we can
implement any of the available patterns such as MVC, MVVM, Observable, or any
other. This will allow us to have a good code structure, which leads us to have easy
access for maintenance.
Another thing to keep in mind is the growing community around the library; there
are lots of people around the world that are working with Ext JS right now. You can
even join the meeting groups that have local reunions frequently to share knowledge
and experiences; I recommend you to look for a group in your city or create one.
[2]
Chapter 1
The new loader system is a great way to load our modules or classes on demand.
We can load only the modules and applications that the user needs just in time.
This functionality allows us to bootstrap our application faster by loading only
the minimal code for our application to work.
One more thing to keep in mind is the ability to prepare our code for deployment.
We can compress and obfuscate our code for a production environment using the
Sencha Cmd, a tool that we can run on our terminal to automatically analyze all the
dependencies of our code and create packages.
Documentation is very important and Ext JS has great documentation, which is very
descriptive with a lot of examples, videos, and sample code so that we can see it in
action right on the documentation pages, and we can also read the comments from
the community.
[3]
An Introduction to Ext JS 5
Downloading Ext JS
If you download Ext JS directly from http://www.sencha.com/products/download/,
this will be a 30-day trial version of Ext JS and you will also be required to enter some
personal information in order to get the trial. To obtain the GPL version, you can get
it from http://www.sencha.com/legal/GPL/. We can also use the available Content
Delivery Network (CDN), as shown in the following table, so that we don't need to
store the library on our own computer or server:
Theme Links
Classic • CSS file: http://cdn.sencha.com/ext/trial/5.1.1/
packages/ext-theme-classic/build/resources/ext-
theme-classic-all.css
• JavaScript file: http://cdn.sencha.com/ext/trial/5.1.1/
build/ext-all.js
Neptune • CSS file: http://cdn.sencha.com/ext/trial/5.1.1/
packages/ext-theme-neptune/build/resources/ext-
theme-neptune-all.css
• JavaScript file: http://cdn.sencha.com/ext/trial/5.1.1/
build/ext-all.js
• Theme JS Overrides: http://cdn.sencha.com/ext/
trial/5.1.1/packages/ext-theme-neptune/build/ext-
theme-neptune.js
Crisp • CSS file: http://cdn.sencha.com/ext/trial/5.1.1/
packages/ext-theme-crisp/build/resources/ext-theme-
crisp-all.css
• JavaScript file: http://cdn.sencha.com/ext/trial/5.1.1/
build/ext-all.js
• Theme JS Overrides: http://cdn.sencha.com/ext/
trial/5.1.1/packages/ext-theme-crisp/build/ext-
theme-crisp.js
[4]
Random documents with unrelated
content Scribd suggests to you:
Quand je voulais sortir du spectacle de ma misère et regarder le
monde, ce que j’en pouvais voir c’étaient des hurlements, des cris,
des larmes, des convulsions, la même comédie revenant
perpétuellement avec les mêmes acteurs; et il y a des gens, me
disais-je, qui étudient tout cela et se remettent à la tâche tous les
matins! Il n’y avait plus qu’un grand amour qui eût pu me tirer de là,
mais je regardais cela comme quelque chose qui n’est pas de ce
monde, et je regrettai amèrement tout le bonheur que j’avais rêvé.
Alors la mort m’apparut belle. Je l’ai toujours aimée; enfant, je la
désirais seulement pour la connaître, pour savoir qu’est-ce qu’il y a
dans le tombeau et quels songes a ce sommeil; je me souviens avoir
souvent gratté le vert-de-gris de vieux sous pour m’empoisonner,
essayé d’avaler des épingles, m’être approché de la lucarne d’un
grenier pour me jeter dans la rue... Quand je pense que presque
tous les enfants font de même, qu’ils cherchent à se suicider dans
leurs jeux, ne dois-je pas conclure que l’homme, quoi qu’il en dise,
aime la mort d’un amour dévorant? il lui donne tout ce qu’il crée, il
en sort et il y retourne, il ne fait qu’y songer tant qu’il vit, il en a le
germe dans le corps, le désir dans le cœur.
Il est si doux de se figurer qu’on n’est plus! il fait si calme dans
tous les cimetières! là, tout étendu et roulé dans le linceul et les bras
en croix sur la poitrine, les siècles passent sans plus vous éveiller
que le vent qui passe sur l’herbe. Que de fois j’ai contemplé, dans
les chapelles des cathédrales, ces longues statues de pierre
couchées sur les tombeaux! leur calme est si profond que la vie ici-
bas n’offre rien de pareil; ils ont, sur leur lèvre froide, comme un
sourire monté du fond du tombeau, on dirait qu’ils dorment, qu’ils
savourent la mort. N’avoir plus besoin de pleurer, ne plus sentir de
ces défaillances où il semble que tout se rompt, comme des
échafaudages pourris, c’est là le bonheur au-dessus de tous les
bonheurs, la joie sans lendemain, le rêve sans réveil. Et puis on va
peut-être dans un monde plus beau, par delà les étoiles, où l’on vit
de la vie de la lumière et des parfums; l’on est peut-être quelque
chose de l’odeur des roses et de la fraîcheur des prés! Oh! non, non,
j’aime mieux croire que l’on est bien mort tout à fait, que rien ne
sort du cercueil; et s’il faut encore sentir quelque chose, que ce soit
son propre néant, que la mort se repaisse d’elle-même et s’admire;
assez de vie juste pour sentir que l’on n’est plus.
Et je montais au haut des tours, je me penchais sur l’abîme,
j’attendais le vertige venir, j’avais une inconcevable envie de
m’élancer, de voler dans l’air, de me dissiper avec les vents; je
regardais la pointe des poignards, la gueule des pistolets, je les
appuyais sur mon front, je m’habituais au contact de leur froid et de
leur pointe; d’autres fois, je regardais les rouliers tournant à l’angle
des rues et l’énorme largeur des roues broyer la poussière sur le
pavé, je pensais que ma tête serait ainsi bien écrasée, pendant que
les chevaux iraient au pas. Mais je n’aurais pas voulu être enterré, la
bière m’épouvante; j’aimerais plutôt être déposé sur un lit de feuilles
sèches, au fond des bois, et que mon corps s’en allât petit à petit au
bec des oiseaux et aux pluies d’orage.
Un jour, à Paris, je me suis arrêté longtemps sur le Pont-Neuf;
c’était l’hiver, la Seine charriait, de gros glaçons ronds descendaient
lentement le courant et se fracassaient sous les arches, le fleuve
était verdâtre, j’ai songé à tous ceux qui étaient venus là pour en
finir. Combien de gens avaient passé à la place où je me tenais alors,
courant la tête levée à leurs amours ou à leurs affaires, et qui y
étaient revenus, un jour, marchant à petits pas, palpitant à
l’approche de mourir! ils se sont approchés du parapet, ils ont monté
dessus, ils ont sauté. Oh! que de misères ont fini là, que de
bonheurs y ont commencé! Quel tombeau froid et humide! comme il
s’élargit pour tous! comme il y en a dedans! ils sont là tous, au fond,
roulant lentement avec leurs faces crispées et leurs membres bleus,
chacun de ces flots glacés les emporte dans leur sommeil et les
traîne doucement à la mer.
Quelquefois les vieillards me regardaient avec envie, ils me
disaient que j’étais heureux d’être jeune, que c’était là le bel âge,
leurs yeux caves admiraient mon front blanc, ils se rappelaient leurs
amours et me les contaient; mais je me suis souvent demandé si,
dans leur temps, la vie était plus belle, et comme je ne voyais rien
en moi que l’on pût envier, j’étais jaloux de leurs regrets, parce qu’ils
cachaient des bonheurs que je n’avais pas eus. Et puis c’étaient des
faiblesses d’homme en enfance à faire pitié! je riais doucement et
pour presque rien comme les convalescents. Quelquefois je me
sentais pris de tendresse pour mon chien, et je l’embrassais avec
ardeur; ou bien j’allais dans une armoire revoir quelque vieil habit de
collège, et je songeais à la journée où je l’avais étrenné, aux lieux où
il avait été avec moi, et je me perdais en souvenirs sur tous mes
jours vécus. Car les souvenirs sont doux, tristes ou gais, n’importe!
et les plus tristes sont encore les plus délectables pour nous, ne
résument-ils pas l’infini? l’on épuise quelquefois des siècles à songer
à une certaine heure qui ne reviendra plus, qui a passé, qui est au
néant pour toujours, et que l’on rachèterait par tout l’avenir.
Mais ces souvenirs-là sont des flambeaux clairsemés dans une
grande salle obscure, ils brillent au milieu des ténèbres; il n’y a que
dans leur rayonnement que l’on y voit, ce qui est près d’eux
resplendit, tandis que tout le reste est plus noir, plus couvert
d’ombres et d’ennui.
Avant d’aller plus loin, il faut que je vous raconte ceci:
Je ne me rappelle plus bien l’année, c’était pendant une vacance,
je me suis réveillé de bonne humeur et j’ai regardé par la fenêtre. Le
jour venait, la lune toute blanche remontait dans le ciel; entre les
gorges des collines, des vapeurs grises et rosées fumaient
doucement et se perdaient dans l’air; les poules de la basse-cour
chantaient. J’ai entendu derrière la maison, dans le chemin qui
conduit aux champs, une charrette passer, dont les roues claquaient
dans les ornières, les faneurs allaient à l’ouvrage; il y avait de la
rosée sur la haie, le soleil brillait dessus, on sentait l’eau et l’herbe.
Je suis sorti et je m’en suis allé à X...; j’avais trois lieues à faire, je
me suis mis en route, seul, sans bâton, sans chien. J’ai d’abord
marché dans les sentiers qui serpentent entre les blés, j’ai passé
sous des pommiers, au bord des haies; je ne songeais à rien,
j’écoutais le bruit de mes pas, la cadence de mes mouvements me
berçait la pensée. J’étais libre, silencieux et calme, il faisait chaud;
de temps à autre je m’arrêtais, mes tempes battaient, le cri-cri
chantait dans les chaumes, et je me remettais à marcher. J’ai passé
dans un hameau où il n’y avait personne, les cours étaient
silencieuses, c’était, je crois, un dimanche; les vaches, assises dans
l’herbe, à l’ombre des arbres, ruminaient tranquillement, remuant
leurs oreilles pour chasser les moucherons. Je me souviens que j’ai
marché dans un chemin où un ruisseau coulait sur les cailloux, des
lézards verts et des insectes aux ailes d’or montaient lentement le
long des rebords de la route, qui était enfoncée et toute couverte
par le feuillage.
Puis je me suis trouvé sur un plateau, dans un champ fauché;
j’avais la mer devant moi, elle était toute bleue, le soleil répandait
dessus une profusion de perles lumineuses, des sillons de feu
s’étendaient sur les flots; entre le ciel azuré et la mer plus foncée
l’horizon rayonnait, flamboyait; la voûte commençait sur ma tête et
s’abaissait derrière les flots, qui remontaient vers elle, faisant comme
le cercle d’un infini invisible. Je me suis couché dans un sillon et j’ai
regardé le ciel, perdu dans la contemplation de sa beauté.
Le champ où j’étais était un champ de blé, j’entendais les cailles,
qui voltigeaient autour de moi et venaient s’abattre sur des mottes
de terre; la mer était douce, et murmurait plutôt comme un soupir
que comme une voix; le soleil lui-même semblait avoir son bruit, il
inondait tout, ses rayons me brûlaient les membres, la terre me
renvoyait sa chaleur, j’étais noyé dans sa lumière, je fermais les yeux
et je la voyais encore. L’odeur des vagues montait jusqu’à moi, avec
la senteur du varech et des plantes marines; quelquefois elles
paraissaient s’arrêter ou venaient mourir sans bruit sur le rivage
festonné d’écume, comme une lèvre dont le baiser ne sonne point.
Alors, dans le silence de deux vagues, pendant que l’Océan gonflé se
taisait, j’écoutais le chant des cailles un instant, puis le bruit des flots
recommençait, et après, celui des oiseaux.
Je suis descendu en courant au bord de la mer, à travers les
terrains éboulés que je sautais d’un pied sûr, je levais la tête avec
orgueil, je respirais fièrement la brise fraîche, qui séchait mes
cheveux en sueur; l’esprit de Dieu me remplissait, je me sentais le
cœur grand, j’adorais quelque chose d’un étrange mouvement,
j’aurais voulu m’absorber dans la lumière du soleil et me perdre dans
cette immensité d’azur, avec l’odeur qui s’élevait de la surface des
flots; et je fus pris alors d’une joie insensée, et je me mis à marcher
comme si tout le bonheur des cieux m’était entré dans l’âme.
Comme la falaise s’avançait en cet endroit-là, toute la côte disparut
et je ne vis plus rien que la mer: les lames montaient sur le galet
jusqu’à mes pieds, elles écumaient sur les rochers à fleur d’eau, les
battaient en cadence, les enlaçaient comme des bras liquides et des
nappes limpides, en retombant illuminées d’une couleur bleue; le
vent en soulevait les mousses autour de moi et ridait les flaques
d’eau restées dans le creux des pierres, les varechs pleuraient et se
berçaient, encore agités du mouvement de la vague qui les avait
quittés; de temps à autre une mouette passait avec de grands
battements d’ailes, et montait jusqu’au haut de la falaise. A mesure
que la mer se retirait, et que son bruit s’éloignait ainsi qu’un refrain
qui expire, le rivage s’avançait vers moi, laissant à découvert sur le
sable les sillons que la vague avait tracés. Et je compris alors tout le
bonheur de la création et toute la joie que Dieu y a placée pour
l’homme; la nature m’apparut belle comme une harmonie complète,
que l’extase seule doit entendre; quelque chose de tendre comme
un amour et de pur comme la prière s’éleva pour moi du fond de
l’horizon, s’abattit de la cime des rocs déchirés, du haut des cieux; il
se forma, du bruit de l’Océan, de la lumière du jour, quelque chose
d’exquis que je m’appropriai comme d’un domaine céleste, je m’y
sentis vivre heureux et grand, comme l’aigle qui regarde le soleil et
monte dans ses rayons.
Alors tout me sembla beau sur la terre, je n’y vis plus de disparate
ni de mauvais; j’aimai tout, jusqu’aux pierres qui me fatiguaient les
pieds, jusqu’aux rochers durs où j’appuyais les mains, jusqu’à cette
nature insensible que je supposais m’entendre et m’aimer, et je
songeai alors combien il était doux de chanter, le soir, à genoux, des
cantiques au pied d’une madone qui brille aux candélabres, et
d’aimer la Vierge Marie, qui apparaît aux marins, dans un coin du
ciel, tenant le doux Enfant Jésus dans ses bras.
Puis ce fut tout; bien vite je me rappelai que je vivais, je revins à
moi, je me mis en marche, sentant que la malédiction me reprenait,
que je rentrais dans l’humanité; la vie m’était revenue, comme aux
membres gelés, par le sentiment de la souffrance, et de même que
j’avais un inconcevable bonheur, je tombai dans un découragement
sans nom, et j’allai à X...
Je revins le soir chez nous, je repassai par les mêmes chemins, je
revis sur le sable la trace de mes pieds et dans l’herbe la place où je
m’étais couché, il me sembla que j’avais rêvé. Il y a des jours où l’on
a vécu deux existences, la seconde déjà n’est plus que le souvenir
de la première, et je m’arrêtais souvent dans mon chemin devant un
buisson, devant un arbre, au coin d’une route, comme si là, le matin,
il s’était passé quelque événement de ma vie.
Quand j’arrivai à la maison, il faisait presque nuit, on avait fermé
les portes, et les chiens se mirent à aboyer.
Marie s’arrêta ici, perdue sans doute dans l’émouvant souvenir par
lequel elle avait peur d’être vaincue, puis elle reprit en riant d’une
manière désespérée:
—Ah! la robe blanche! il y a longtemps qu’elle est usée! et
l’innocence avec elle! Où sont les autres maintenant? il y en a qui
sont mortes, d’autres qui sont mariées et ont des enfants; je n’en
vois plus aucune, je ne connais personne. Tous les jours de l’an
encore, je veux écrire à ma mère, mais je n’ose pas, et puis bah!
c’est bête, tous ces sentiments-là!
Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.
ebooknice.com