100% found this document useful (6 votes)
963 views

Instant download Learning ExtJS - Fourth Edition Carlos Méndez pdf all chapter

Learning

Uploaded by

ndeckbauri
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (6 votes)
963 views

Instant download Learning ExtJS - Fourth Edition Carlos Méndez pdf all chapter

Learning

Uploaded by

ndeckbauri
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 55

Experience Seamless Full Ebook Downloads for Every Genre at textbookfull.

com

Learning ExtJS - Fourth Edition Carlos Méndez

https://textbookfull.com/product/learning-extjs-fourth-
edition-carlos-mendez/

OR CLICK BUTTON

DOWNLOAD NOW

Explore and download more ebook at https://textbookfull.com


Recommended digital products (PDF, EPUB, MOBI) that
you can download immediately if you are interested.

College accounting : a contemporary approach Fourth


Edition M David Haddock

https://textbookfull.com/product/college-accounting-a-contemporary-
approach-fourth-edition-m-david-haddock/

textboxfull.com

Applied Machine Learning 1st Edition M. Gopal

https://textbookfull.com/product/applied-machine-learning-1st-edition-
m-gopal/

textboxfull.com

Data Mining Practical Machine Learning Tools and


Techniques Fourth Edition Ian H. Witten

https://textbookfull.com/product/data-mining-practical-machine-
learning-tools-and-techniques-fourth-edition-ian-h-witten/

textboxfull.com

Agent-Based Modeling of Social Conflict: From Mechanisms


to Complex Behavior 1st Edition Carlos M. Lemos (Auth.)

https://textbookfull.com/product/agent-based-modeling-of-social-
conflict-from-mechanisms-to-complex-behavior-1st-edition-carlos-m-
lemos-auth/
textboxfull.com
Learning Java Functional Programming 1st Edition Reese
Richard M

https://textbookfull.com/product/learning-java-functional-
programming-1st-edition-reese-richard-m/

textboxfull.com

Deep Learning Applications, Volume 2 M. Arif Wani

https://textbookfull.com/product/deep-learning-applications-
volume-2-m-arif-wani/

textboxfull.com

Learning Network Programming with Java 1st Edition Reese


Richard M

https://textbookfull.com/product/learning-network-programming-with-
java-1st-edition-reese-richard-m/

textboxfull.com

Functional Training 1st Edition Juan Carlos Santana

https://textbookfull.com/product/functional-training-1st-edition-juan-
carlos-santana/

textboxfull.com

Intelligent Computing Systems Carlos Brito-Loeza

https://textbookfull.com/product/intelligent-computing-systems-carlos-
brito-loeza/

textboxfull.com
Learning Ext JS
Fourth Edition

Create powerful web applications with the new and


improved Ext JS 5 library

Carlos A. Méndez
Crysfel Villa
Armando Gonzalez

BIRMINGHAM - MUMBAI
Learning Ext JS
Fourth Edition

Copyright © 2015 Packt Publishing

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.

First published: November 2008


Second edition: October 2010
Third edition: January 2013
Fourth edition: July 2015

Production reference: 1290715

Published by Packt Publishing Ltd.


Livery Place
35 Livery Street
Birmingham B3 2PB, UK.

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

Reviewers Project Coordinator


Davor Lozić Milton Dsouza
Olivier Pons
Juris Vecvanags Proofreader
Safis Editing

Commissioning Editor
Ashwin Nair Indexer
Tejal Daruwale Soni

Acquisition Editor
Shaon Basu Production Coordinator
Manu Joseph

Content Development Editor


Akashdeep Kundu Cover Work
Manu Joseph

Technical Editor
Menza Mathew
About the Authors

Carlos A. Méndez is a freelance developer and graphic designer living in México,


with expertise in web development since 2000 and Windows development since 1998.
He has also worked with Ext JS since version 2.x up to the present day. Since 1998,
he has developed and designed administrative applications for accounting, payroll,
inventory, human resource control, restaurants, hotels, and much more—applications
that are in production and up to date.

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.

He is the founder and development manager of the company


administrationonline.com, which is focused on administrative applications. Carlos
is involved in many projects around the world and also provides support and
maintenance to many Ext JS projects ranging from 2.x to 5.x.

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.

In early 2010, he started working as a freelancer. He began training teams on Ext JS


for private companies; writing a blog with tutorials, tips, and tricks; developing
custom components on Ext JS for his clients; and working on open source projects to
share his knowledge with the world.

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.

Thanks to my parents and brothers, who used to keep asking


me very often about the project and provided me with the moral
support to work and complete this dream. Also, I want to thank all
my closest friends for the moral support that they gave me. Special
thanks to my best friends, Carlos and Gina, who often pushed me to
continue working on this project.
About the Reviewers

Davor Lozić is a senior software engineer interested in many subjects,


especially computer security, algorithms, and data structures. He creates web
applications in CakePHP and Ext JS, and in his spare time, he reads books about
modern physics, graph databases like Neo4j, and related subjects. You can check out
his website at http://warriorkitty.com, where you can contact him. He likes cats
because cats are great! If you would like to talk about any aspect of technology,
or if you have great and funny pictures of cats, feel free to contact him.

Olivier Pons is a senior developer who has been building websites


since 1997. He's a teacher at the University of Sciences (IUT) of Aix-en-Provence,
France. In ISEN (Institut Supérieur de l'Électronique et du Numérique) and École
d'Ingénieurs des Mines de Gardanne, he teaches state-of-the-art web techniques,
such as the MVC fundamentals, Symfony, Wordpress, PHP, HTML, CSS, jQuery,
jQuery Mobile, Node.js, AngularJS, Apache, NoSQL, Linux basics, and advanced
VIM techniques. He has already done some technical reviews, including Packt
Publishing's Ext JS 4 First Look, jQuery Hotshots, jQuery Mobile Web Development
Essentials, Wordpress Complete, and jQuery 2.0 for Designers Beginner's Guide,
among others.

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.

Before moving to Silicon Valley, he owned a well-established web design start-up


in Europe. Juris is currently employed as a solutions architect at Sencha, where he
helps customers write better apps for both desktop and emerging mobile platforms.
He contributes to the Ext JS framework as well as dedicates his time to write custom
components and add new features.

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.

He is passionate about cutting-edge technologies and everything related


to JavaScript.
www.PacktPub.com

Support files, eBooks, discount offers, and more


For support files and downloads related to your book, please visit
www.PacktPub.com.

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.

At www.PacktPub.com, you can also read a collection of free technical articles,


sign up for a range of free newsletters and receive exclusive discounts and offers
on Packt books and eBooks.

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

Free access for Packt account holders


If you have an account with Packt at www.PacktPub.com, you can use this to access
PacktLib today and view 9 entirely free books. Simply use your login credentials for
immediate access.
Table of Contents
Preface ix
Chapter 1: An Introduction to Ext JS 5 1
Considering Ext JS for your next project 2
Getting started with Ext JS 3
Downloading Ext JS 4
Setting up and installing Ext JS 5 5
Sencha Cmd 5
Why so many files and folders? 6
Folders that changed in version 5 from previous versions 7
Looking at the whole picture 8
Our first program 9
Writing the Ext JS code 11
Adding interaction to the program 13
Tools and editors 15
XAMPP or WAMP 15
Aptana 16
Sencha Architect 17
What's new in Ext JS 5? 19
Summary 22
Chapter 2: The Core Concepts 23
The class system 24
Naming conventions 24
Writing your first class 25
Simple inheritance 28
Preprocessors and postprocessors 31
Mixing many classes (the use of mixins) 34
An explanation of mixins 37
Using the mixinConfig property 38

[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

Chapter 6: Doing It with Forms 165


The form component 165
The anatomy of the fields 172
The available fields 172
The TextField class 174
The number field 177
The ComboBox field 179
The Tag field 183
The Date field 184
The Checkbox and the CheckboxGroup fields 187
The Radio and RadioGroup buttons 188
The field container 190
Triggers 192
Submitting the data 194
Summary 197
Chapter 7: Give Me the Grid 199
The data connection (models and stores) 200
A basic grid 202
Columns 204
The column row number 206
The number column 207
The template column 207
The date column 208
The Boolean column 208
The check column 209
The action column 209
Column renderers 211
The Widget column 214
Selection models 218
Grid listeners 221
Features 224
Ext.grid.feature.Grouping 224
Ext.grid.feature.GroupingSummary 226
Ext.grid.feature.RowBody 228
Ext.grid.feature.Summary 229
Plugins 230
Ext.grid.plugin.CellEditing 230
Ext.grid.plugin.RowEditing 233

[ iv ]
Table of Contents

Grid paging 236


Infinite scrolling 238
Summary 241
Chapter 8: DataViews and Templates 243
The data connection (model and store) 244
A basic DataView 245
Handling events in DataView 247
Templates 248
Ext.Template 248
Ext.XTemplate 250
A more complex DataView component 253
Summary 256
Chapter 9: The Tree Panel 257
A basic tree panel 258
The TreeStore 261
Tree nodes 263
Adding and removing nodes 264
The check tree 270
The tree grid panel 272
Summary 275
Chapter 10: Architecture 277
The MVC and MVVM patterns 278
Model-View-Controller (MVC) 278
Model-View-ViewModel (MVVM) 279
Creating our first application 280
The views 282
The controller 287
Listening to events 288
Opening modules 291
Creating a module 292
ViewController 296
ViewModel 299
Binding and data binding 301
Router – implementing and using 311
Summary 314

[v]
Table of Contents

Chapter 11: The Look and Feel 315


Setting up our environment 315
The packages folder 317
Variables 320
Advanced theming 323
Changing the component's style 323
Adding new gradients 324
Styling the tabs 326
Adding custom fonts to our theme 327
Different styles for the same component 330
Supporting legacy browsers 339
Summary 342
Chapter 12: Responsive Configurations and Tablet Support 343
Overview 344
New themes 346
Neptune touch and Crisp touch 346
Implementing responsiveness to the application 347
Creating responsiveness 348
Investigating the output 352
Checking all panels 354
Summary 361
Chapter 13: From Drawing to Charting 363
Basic drawing 364
Adding interaction 369
Charts 373
Legend 374
Axis 374
Series 375
Themes 375
Series examples 376
Bar charts (building our first chart) 376
Pie charts 381
More charts 385
Introducing chart themes 386
Enhancing our application with charts 388
Summary 393

[ vi ]
Table of Contents

Chapter 14: Finishing the Application 395


Preparing for deployment 396
The app.json file 397
The Sencha command 398
Customizing the build.xml file 400
Compressing the code 401
Packaging and deploying 404
Testing the application 405
Summary 405
Chapter 15: What's Next? 407
Forums 407
Resources 409
Third-party plugins (commercial) 412
Third-party plugins (free) 414
The future 414
Final thoughts 414
Summary 415
Index 417

[ 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.

What this book covers


Chapter 1, An Introduction to Ext JS 5, covers an explanation of how to start by getting
the framework (downloading the file) and setting up the basic requirements you
need in order to begin coding. This chapter also provides an explanation of how the
framework is structured, how to set up some required tools, and gives a quick peek
at the product, Sencha Architect.

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).

What you need for this book


The web browsers recommended for use are as follows:

• Google Chrome: http://www.google.com/chrome


• Firefox: https://www.mozilla.org/en-US/firefox/new/
• Firefox for developers: https://www.mozilla.org/en-US/firefox/
developer/

These browsers come in handy because they come with debugging tools for
easy development.

For a web server with PHP support, use this:

• Xampp: https://www.apachefriends.org/index.html

For the database, use the following:

• MySQL: http://dev.mysql.com/downloads/mysql/ (this also comes


bundled in Xampp)

For Sencha Cmd and the required tools, use these:

• Sencha Cmd: http://www.sencha.com/products/sencha-cmd/download


• Ruby 1.8 or 1.9: http://www.ruby-lang.org/en/downloads/
• Sass: http://sass-lang.com/
• Compass: http://compass-style.org/

[ xi ]
Preface

• Java RTE (version 1.7.0): http://www.oracle.com/technetwork/java/


javase/downloads/java-se-jre-7-download-432155.html
• Apache ANT: http://ant.apache.org/bindownload.cgi
• Ext JS (of course): http://www.sencha.com/products/extjs/

We will use Ext JS 5.1.1 in this book.

Who this book is for


If you are new developers who are beginners in Ext JS, developers familiar with Ext JS
who want to augment the skills of creating better applications, or developers who
haven't yet used version 5.x and want to know more about it, this is the book for you.

Users should possess a basic knowledge of HTML/JavaScript/CSS/Sass/Compass,


and an understanding of JSON, XML, and any server-side language (such as PHP,
ASP, JAVA, and so on) is required.

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."

A block of code is set as follows:


Ext.define('myApp.model.modulesModel', {
extend: 'Ext.data.Model',
requires: [
'Ext.data.field.String',
'Ext.data.field.Boolean',
'Ext.data.field.Integer'
],
fields: [

[ xii ]
Preface

{type: 'string', name: 'description'},


{type: 'boolean', name: 'allowaccess'},
{type: 'int', name: 'level'},
{type: 'string', name: 'moduleType', defaultValue: ''},
{type: 'string', name: 'moduleAlias', defaultValue: ''},
{type: 'string', name: 'options'}
]
});

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."

Warnings or important notes appear in a box like this.

Tips and tricks appear like this.

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.

To send us general feedback, simply send an e-mail to feedback@packtpub.com,


and mention the book title via the subject of your message. If there is a topic that you
have expertise in and you are interested in either writing or contributing to a book,
see our author guide on www.packtpub.com/authors.

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.

Downloading the example code


You can download the example code files for all Packt books you have purchased
from your account at http://www.packtpub.com. If you purchased this book
elsewhere, you can visit http://www.packtpub.com/support and register to have
the files e-mailed directly to you.

[ 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.

Please contact us at copyright@packtpub.com with a link to the suspected


pirated material.

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.

• Considering Ext JS for your next project


• Getting started with Ext JS—our first program

[1]
An Introduction to Ext JS 5

• Tools and editors


• What's new in Ext JS 5?

Considering Ext JS for your next project


Ext JS is a great library to create RIAs that require a lot of interactivity with the user.
If you need complex components to manage your information, then Ext is your best
option because it contains a lot of widgets such as the grid, forms, trees, panels, and
a great data package and class system.

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.

Getting started with Ext JS


So, let's begin with Ext JS! The first thing we should do is download the framework
from the official website, http://www.sencha.com/products/extjs/. The version
available at the time of writing this book is 5.1.1.

There are three types of license:

• The open source license: If you are creating or want to develop an


open source application compatible under the GNU GPL license v3
(http://www.gnu.org/copyleft/gpl.html).
• The commercial license: You need to buy this if you are planning/wanting
to develop a closed source project and want to keep the source code as your
own property. Usually used by corporations, banks, or enterprises.
• The commercial OEM: If you want to use Ext JS to create your own
commercial SDK or web application builder, or use it as frontend for
some embedded device, then this comes into the picture. As this type of
license can vary, it's customized for each customer.

You can see more detailed information about this subject at


http://www.sencha.com/products/extjs/licensing.

[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]
Exploring the Variety of Random
Documents with Different Content
parasten opettajaimme ja hurskainten ja ymmärtäväisinten
naistemme kaitsennon alaisiksi.

— Tuo ei tosin, sanoi esimunkki, olisi estänyt perisyntiä


pääsemästä heidän mukanaan yli tuohon rauhotettuun maahan. Olisi
paha sielläkin näkymättömistä siemenistä itänyt ja taiminut, mutta
tarkalla hoidolla olisi rikkaruoho pitänyt säätämän harvenemaan ja
hyvä siemen ihanasti versomaan.

— Esiveli, mitä kirjallisuutta sinä olisit suonut mukaan vietäväksi?


kysyi Sven herra.

— Kirjallisuutta ja taidetta vaille eivät uudet yhteiskunnat olisi


jääneet. Mutta kirjallisuus olisi supistettu käsittämään paraita
kristillisiä ja käytöllisesti hyödyllisiä kirjoja, joihin luen matematiset ja
kielitieteelliset. Maalaajoita olisi seurannut mukana, semmoisia kuin
enkelinvertainen Fra Giovanni Fiesolesta ja — miksei niinkin? —
semmoisia kuin mestari Gudmund, ja rakennusmestareita olisi
mennyt myötä semmoisia, joista minulle on sanottu, että he,
rakentaessaan kirkkoja kristikunnalle, aina pitivät silmällä sitä suurta
magisteriumia, jota he koettivat kirkkorakennusten muodoissa
eduskuvallisesti esittää ja loivat oman elämänsä vaellusretkeksi
taivasta-tavottelevain holvikaarrosten alla, joita ikuisuuden ikävöintä
ponnisti ylöspäin. Kuvanveistäjiäkin olisin mielelläni sinne lähettänyt
semmoisia kuin Kultaisen-portin mestarin Freibergissä.

— Minä jätän herrain harkittavaksi, sanoi Sven herra, eikö sentään


saisi jättää jotain saarta likellä rannikkoa siivojen humanistien
turvapaikaksi, jossa Cicero ja Horatiuskin kuritettuna, Virgilius,
Seneka ja Lukanus, ehkäpä myös nuo oppineet herrat Skaliger ja
Reuchlin saisivat asua. Minä tulisin toimeen lukkarin virassa sillä
saarella.
Gudmund mestari oli kuullut mainittavan kirjaa Utopian saaresta,
ja kysyi, oliko joku hänen oppineista veljistään lukenut sen tai
osaisiko siitä selkoa tehdä. Kyllä, Svante tohtori oli lukenut
englantilaisen kanslerin Thomas Moruksen kirjan Paraasta
yhteiskuntajärjestyksestä eli siitä uudesta Ei-missälän (Utopian)
saaresta.

— Etupäässä haluaisin tietysti tietää, niille kannalle pappien olo


siellä on järjestetty — jos siellä pappia on, virkkoi kirkkoherra.

— Pappia siellä on, tiesi tohtori sanoa, vaikka ei paljo. Ne valitsee


kansa semmoisien seasta, jotka elämässään ovat osottaneet
erinomaista puhtautta ja omanhyödyn pyytämättömyyttä. He ovat
velvolliset opettamaan nuorisoa, auttamaan vanhempia ihmisiä
neuvoilla, opastamaan esimerkillään kansaa sekä kodillisten että
kansallisten hyveiden tiellä. He elävät toimekasta elämää yhteisen
hyvän eteen ja lähtevät sotaankin, jos vihollinen uhkaa isänmaata.

— Saavatko he naida?

— Avioliittoon meno on heidän velvollisuutenaan.

— Onhan sillä hyvä puolensa, sen myönnän suoraan, sanoi Sven


herra, mutta on sillä vaaransakin. Kellä on omia lapsia, hän on
luonnostaan taipuisa katsomaan etupäässä näiden parasta ja
kohtelemaan kirkolta saamiansa lapsia isäpuolen tavalla. Mitä
uskontoa nämä papit julistavat?

— Valtion uskontoa, jossa on vain kolme uskonkappalta: 1) on


olemassa korkein olento; 2) ihmishenki on kuolematon; 3)
ruumiillisen kuoleman jälkeen tulee palkka. Muutoin saa kukin
vapaasti tunnustaa omaa uskoansa; saarella on paljo kristityltä.
Yrityksiä pakottamaan toisen omaatuntoa rangaistaan rikoksina.

— Entäs yhteiskuntarakennus?

— Se on kansanvaltainen, vaikka yläkerran muodostaa oppi-


ylimystö. Virkamiehet ovat kansan valittavat, mitkä vuodeksi, mitkä
elinijäksi. Hallitsija valitaan elinijäksi. Hän sekä ylimmät virkamiehet,
niinkuin myöskin papit, valitaan kuitenkin eri luokasta: oppineitten.
Tähän säätyluokkaan on vapaa pääsy lahjakkaimmilla nuorukaisilla,
syntyperästä huolimatta. Useimmat kansalaiset ovat maanviljelijöitä
ja ovat sen ohessa tavallisesti myös oppineet jotain käsityötä. Työ on
järjestelmän mukaan säänneltyä, ja virkamiesten on valvottava, että
kukin suorittaa määräosansa ja saa nauttia leponsa. Työn tuote on
yhteistä omaisuutta. On orjaluokkakin, joka toimittaa alhaisimmat
tehtävät: se on harvalukuinen ja siihen otetaan väki pahantekijöistä.
Lakeja on vähä ja ne ovat yleistajuisia.

— Sanokaa nyt Svante tohtori, mitä te tämmöisestä


yhteiskuntalaitoksesta arvelette?

— Sillä näyttää mielestäni olevan se ansio, ettei sitä haittaa


nykyisten yhteiskuntien pahimmat virheet. Näinhän siinä tunnustan
paljon hyvää. Mutta minua haluttaisi tietää, tokkohan vapautta
rakastava mies siinä viihtyisi ja voisi elää. En minä ainakaan tahtoisi
olla virkamiehen ajettavana työhön ja levolle määrähetkinä, ja
epäilen tokko ruotsalaiset miehet semmoiseen suostuisivat. Epäilen
lisäksi, voisiko tuo yhteiskuntajärjestys säilyä muuttumatta. Ja
muuttuessaan se ei pyrkisi paranemaan, vaan pahenemaan. Sillä
ihmeellistä olisi, jos ei sen oppinut ylimystö saisi samaa halua kuin
muutkin ylimystöt: anastaa itselleen kaiken vallan yhteiskunnassa,
enentää entisiä etujansa yhä suuremmiksi ja jättää ne lastensa
perittäviksi. Ennemmin tai myöhemmin nähdään tämmöisillä
työnjohtajilla egyptiläisen työvoudin naama, ja kuta lujemmaksi
virkamieslaitos varttuu ja kuta enemmän se yhteyteensä liittää
väestön taitavimpia ja kunnianhimoisimpia jäseniä, sitä
ankarampaan orjuuteen he tulevat painamaan työtätekeviä. Vaikeita
yhteiskuntaongelmia minä en pysty selvittämään, ja pidän siis
toistaiseksi parempana yhteiskuntakoneistoa, joka ei ole niin
säntilleen rakennettu. Tämmöinen käyköön kyllä epätasaisesti ja
tuhlatkoon voimia, mutta se antaa korvaukseksi persoonallista
vapautta. Minä soisin että joka miehellä olisi oma kontunsa, jolla hän
itsenäisenä eläisi omissa oloissaan, hoitaen talouttaan omaa
mieltänsä myöten; soisin älyn viljelyksen siksi leviävän, että vapaat
miehet ymmärtävät kuinka tärkeää monesti on rauhassa ja sodassa
suunnitella toimet ja tuumat yhteisen tarkotuksen mukaan; soisin että
joka miehellä olisi aseet suojellakseen itseään, sillä aseen suojatta
oltaissa oikeutta aina poljetaan. Sanalla sanoen: minä tahdon yhä
täydellisempää valtiolaitosta sillä pohjalla, jolle Ruotsin kuningas ja
kansa nyt ovat alkaneet rakentaa.

Valtiolliselle alalle jouduttua ruvettiin nyt puhumaan valtiopäivistä


ja valtiopäiväoikeudesta. Olihan hiljan pidetty tärkeitä valtiopäiviä
Strängnäsissä ja Vadstenassa ja neuvoskunta oli ollut koossa
Jönköpingissä. Esimunkki lausui mielipiteen, joka näyttänee
kummalliselta: että jos joku osa kansaa oli valtiopäiviltä suljettava,
pitäisi sen olla mahtavimman ja rikkaimman osan, koska rikkaus
yksistäänkin tuottaa omistajalleen kohtuullista suuremman
vaikutusvallan yhteiskunnassa, ja koska rikkaat ja mahtavat,
ilmankin valtiopäiväoikeutta, saavat sanansa kuuluviin ja etunsa
huomioon otetuiksi valtaistuimen edessä; mutta köyhimmillä ja enin
rasitetuilta luokilta puuttuu voimaa suojella itseään, ell'eivät
yhdistynein voimin nouse kapinaan, josta Jumala varjelkoon, ja
edustusoikeutta vaille jätettyinä he yleensä eivät voi valittaa
hätäänsä, ilmottaa tarpeitansa tai saada puutteitaan poistetuksi.
Euroopan valtakunnissa yhteiskunta ei vielä likimainkaan seiso
oikeuden, saatikka kristillisyyden perustuksella. Mutta, lisäsi
esimunkki, emme ainoastaan ole oikeutetut, vaan vieläpä
velvollisetkin säilyttämään toivon parempiin aikoihin, sillä Jumala on
ne meille luvannut.

Veniant modo tempora justa,


Cum spem Deus impleat omnem.

[Kunhan vaan ajat tulevat, jolloin oikeus saapi vallan ja Jumala


täyttää kaiken toivomme. — Hymnistä jonka on tehnyt Aurelius
Prudentius.]

Svante tohtori lausui: Esiveljen mielipiteeseen yhdyn minä siinä,


että epäkristillinen ja hyljättävä on yhteiskuntalaitos semmoinen,
jossa köyhän ääni ei kuulu yhtä korkealle kansankäräjissä ja
valtaistuimen edessä kuin rikkaankin. Tämä olisikin kaiketi selvä
kaikille oikeinajatteleville ja kristillismielisille, ellei eräs omituinen este
olisi tiellä. Köyhäthän ne tavallisesti ovat, joilla on vähin määrä oppia
ja tietoa, vaikka, totta pannakseni, hirveä tietämättömyys tavataan
aatelissakin Euroopan kaikissa maissa, niin että melkein tekee mieli
kysyä, eiköhän tietämättömyys ylpeyden liitossa ole yhteiskunnalle
turmiollisempi kuin tietämättömyys, johon yhtyy oman pienuuden
tunto. Este, jota karkotan, on se eräältä Kreikan filosofilta [Platonilta]
peritty oppi, jonka Thomas Morus myös jossain määrin on
omaksunut, että viisaimmat hallitkoot ja kaikki yhteiset asiat
päättäkööt. Tämä kuuluu hyvältä. Mutta viisainten tulisi, nähdäkseni,
olla siksi viisaita että ymmärtävät, että mitä nuo vähemmän viisaat,
vieläpä nekin yhteiskuntalaiset, jotka eivät millään viisaudella
kerskaile, tuntevat, kärsivät ja tahtovat, että kaikki se on jotain hyvin
tärkeää, josta viisaimmilla tarvitsee olla selvä tieto, etteivät joutuisi
umpimähkään ottelemaan salaperäisen voiman kanssa. Ja vielä:
kutka ovat nuo viisaimmat? Nekö jotka itsensä niiksi luulevat? Silloin
saamme niitä hakea kaikkein pöyhkeimpäin ja tyhmänylpeimpäin
ihmisten seasta. Tosi viisaissa on luullakseni joku määrä kainoutta,
joka estää heitä lukeutumasta siihen laumaan, joka huutaa: meillä on
tiedot, meidän tulee hallita. Tosiviisaat eivät koskaan näin tuo
näytteille itseään. Sentähden on etsitty ja luultu löytäneensä
ulkonainen viisauden tunnusmerkki. Viisaus pitäisi etupäässä
löytymän tietorikkaitten hallussa. Ovathan nyt tosin runsaat tiedot ja
viisaus eri asioita, mutta jälkimmäinen edellyttää halusti edellisiä.
Siihen seikkaan perustuu se ajatus, että oppineitten ja sivistyneiden
tulee hallita, heidän mieltään tulee hallitsevain kuulla ja noudattaa.
Tässä unohdetaan se mitä kristinusko kutsuu perisynniksi, joka
juureltaan on itsekkäisyyttä. Sitä ei saa suljetuksi kouluseinäin
ulkopuolelle eikä valtameren taa, ja epäilenpä onko runsailla tiedoilla
varustettu itsekkäisyys menettelevä kohtuullisemmin ja
kristillisemmin alempia luokkia kohtaan kuin rautapukuisten ja
kultakannuksisten herrain köyhätietoinen itsekkäisyys, ellei omat
selvemmin älytyt edut vaadi tuota kohtuullisuutta. Olen erittäin
Italiassa, jossa todella löytyy monitieteinen ja monipuolisesti
sivistynyt kansanluokka, tämän saman keskellä tavannut niin
häikäilemätöntä häjyyttä, semmoista riettautta ja kataluutta, että
kysymys tiedollisuuden suhteesta siveellisyyteen on minulle käynyt
probleemiksi, yhdeksi niitä joita ajatukseni yrittää selvittää,
astellessani harppu kädessä teitä ja polkuja. Voidakseen jalosti elää,
tarvitsee tuntea sisässään jotain, jota ei saa tahrata likaan. Muutama
sivu Tuomas Kempiläisen kirjasta luettuna saattaa köyhimmässäkin
herättää tämän tunteen eleille, yliopiston-oppi ei tee sitä yhtä
varmasti. Kun tiedot astuvat sen tunteen palvelukseen, silloin älyn
viljelys kasvattaa terveitä, yhteiskunnalle hyödyllisiä hedelmiä;
muutoin siitä kai pikemmin kasvaa ja kypsyy Sodomanomenoita.

Ilmotettiin illallis-aterian olevan valmiina.

Sittenkun puheenjohtaja oli kiittänyt isäntää ja isäntä vieraita,


päätettiin kokous vanhaan tapaan siten, että jäsenet seisaalta
lauloivat latinaisen virrenvärssyn, joka ylistää Isää, Poikaa ja Pyhää
henkeä, toivottaa ijäistä autuutta kaikille vainajille ja rukoilee rauhaa
Ruotsille. Jos Lauri olisi ollut läsnä, olisi hän keskeyttänyt laulun ja
tuominnut tämän värssyn perkeleelliseksi sen toivotuksen johdosta,
jolla siinä kuolleita muistetaan.

Sit laus, honor Deo patri, laus perennis ejus Nato, iubilus
Spiritui sancto, salus aeterna defunctis; Pax sit regno Suetie.

[Ylistys olkoon Isälle, ijäinen kiitos Pojalle, ylistys soikoon


Hengelle; ikuinen autuus vainaille, ja rauha Ruotsin vallalle!]

Sitten syötiin illallinen tiilikartanon salissa. Svante tohtori ilmotti,


että hänen täytyi jo seuraavana päivänä lähteä matkalle, jolla hän oli
viipyvä kuukauden tai päällekin. Tämä oli pettymys läsnäolijoille,
jotka olivat toivoneet että "Suoraan sydämestä" yhtyisi ensi
kokoukseensa Talavidiin. Juotiin mestarin paraasta viinistä
sydämellinen malja onneksi matkalle ja onneksi harpulle, josta soi
vain ylentäviä, johduttavia ja suloisia säveliä seutujen asukkaille.
Vieläpä maljalla toivottiin talon omalle pojallekin menestystä hänen
kohta tehtävälle matkalleen saksalaisiin yliopistoihin, sekä vihdoin
Margareeta emännälle.
XII.

MARGIT JA ARVI NIILONPOIKA. VELKA LYBECKIIN.

Sill'aikaa kuin "Suoraan sydämestä" jutteli maalarimajassa, astui


Arvi Niilonpoika sisään Gudmund mestarin ristikkoportista,
huomattuaan sen säleitten välistä kauniin kolmetoistavuotiaan
sukulaisensa Margitin istuvan Fabben penkillä lehmuksen alla, jossa
tyttö lepäsi seuran aterian valmistuspuuhista, joissa hänkin osaltaan
oli ollut apuna, sillä äiti oli aikaisin totuttanut tytärtään ottamaan osaa
taloustoimiin, mikäli tämä sitä tarvitsi voidakseen vuorostaan hänkin
tulla taitavaksi, kunnon emännäksi.

Se arvo ja kunnia, minkä herra Ture Jönsinpoika Roosin pitoihin


kutsu oli tuottanut Arville, ei estänyt tätä useiden sepänsällien
nähden juoksemasta kilpaa Margitin kanssa ristikkoportilta pitkää
pihaa myöten alas laiturille, jossa hän nosti tytön purteen ja istui
airojen ääreen.

— Missä Lauri on? kysyi hän. — Kortebossa. — Se on hyvä.


Minun silmissäni hän näyttää kauniilta niin pitkän matkan päästä,
ettei häntä näe. Milloin hän lähtee Saksaan?
— Muutaman päivän päästä erään kuormueen mukana, jonka on
määrä mennä
Skooneen.

— Entä jos hän ja tuo kuomillekin joutuisi Slatten käsiin! Se olisi


ikävä asia tavarain tähden. Anna anteeksi minulle, orpana, että
puhun näin sinun veljestäsi ja minun koulukumppanistani! Mutta
eihän meillä, sinulla ja minulla, koskaan ole ollut toisiltamme
salattavia asioita. Hän on minulle yhtä epämieluinen kuin sinä olet
mieluinen, ja näitä makujani en saa mitenkään muutettua.

— Oliko sinun hauskaa herra Ture Jönsinpoika Roosin luona?

— Oli ja ei ollut. Onhan siitä nuorukaiselle oppimista ja kunniaa


päästä semmoiseen seuraan. Mutta ei siellä erittäin hupaista ollut.
Isäntä ja ylhäiset vieraat kohtelivat minua hyvin ystävällisesti ja
antoivat minun varsin varovasti ymmärtää, että olin viidentenä
vaununpyöränä ja kutsuttuna isäni enkä itseni takia, jonka tiesin
ennestään. Skaran piispa, joka oli siellä, kyseli minulta niitä näitä
latinaksi. Minä epäilen, saisiko hänen latinansa parasta arvolausetta
Sven kirkkoherralta, ja minä vastasin hienotunteisesti latinalla, jota
koetin puhua yhtä huonosti kuin hän. Piispa painoi mieleeni, että
Ruotsin aatelisnuorison tulee kaunistaa itseään tiedoilla ja taidoilla,
ettei kanslereita ja muita arvonmiehiä tarvitsisi laivoilla tuoda tänne
ulkomailta. Sitä on isänikin minulle sanonut, ja sen johdosta olen
päättänyt uudestaan ruveta koulupojaksi, ja käydä Sven herran ja,
jos hyvä isäsi sen sallii, hänenkin kouluaan. Sven herra opettakoon
minulle latinaa joka kelpaa diplomaattien, kanslerien ja ruhtinasten
edessä. Gudmund mestarilta tahdon oppia maalaamaan, joka on
samalla kaunis ja huvittava taito, mutta etupäässä tahdon häneltä
oppia piirtämään linnoja ja sotavarustuksia, sillä surkeaa on
mielestäni, että täytyy turvata ulkomaalaisten apuun milloin isompia
rakennuksia meillä on tehtävä. Kyllä meissä on siinä älyä ja kykyä
kuin heissäkin.

— Arvi, sitte tulet taaskin istuneeksi tuntikausia isän luona


maalarimajassa! Sepä hauskaa! Sekös vasta ilahuttaa isää, joka
pitää niin paljon sinusta!

— Kun vain Lauri on poissa, ei minun puolestani mikään estä.


Mutta mennä sinne hänen kanssaan riitelemään, sitä en tahdo. Tulet
kai sitten, kuten ennenkin, aina vähä väliä maalarimajaan katsomaan
isääsi ja minua? Tee niin Margit!

— Mielelläni.

— Ollaan kuin lapset taas, sinä ja minä. Lapsihan todella vielä


oletkin — ainoastaan kolmentoista vuoden ikäinen. Vielä on sinulla
täysi oikeus suudella minua kainostelematta, ihan kuin ennen.

— Sinähän minua suutelit.

— Me tavattiin toisemme puolivälissä, jos oikein muistan. Niinpä


me tuolla rahilla järviaitan seinustalla tapasimme toisemme viisi
kertaa peräkkäin, toisinaan kymmenen, kaksikymmentä kertaa
luulen ma. Ei mikään estä hyvää jatkoa.

— Estääpä.

— Mikäs niin? kysyi Arvi, käsi airon varassa.

— Olen kyllä vain kolmentoista ikäinen, mutta olen saanut arvon.

— Arvon! Mitä tarkotat Margit?


— Vakuutan sinulle, että olen saanut arvon, hengellisen arvon.

— Sepä hassua. Sinä saanut hengellisen arvon? Oletko jossain


luostarissa apetissana.

— En, ei semmoista arvoa. En minä nunnaksi rupea. En suinkaan.


Ei, toisen arvon.

— Minkä?

— Se on salaisuus.

— Se oli hyvä. Sitten sun tulee se sanoa minulle. Sillä sinulla ja


minulla on kaikki salaisuutemme yhteisinä.

— Mutt'ei tämä.

— Sitten minäkin laitan itselleni salaisuuden, jota sinä et saa


tietää. Sitte tulee loppu tuosta ihanasta tuttavallisuudestamme,
jolloin saatoin sanoa itselleni kaikesta, mitä muuten pidin kaikkein
salaisimpana: tämän tietää yksin Margit ja minä. Enpä sentään tahdo
olla utelias. Sinä olet itsepintainen, kun on jotain päähäsi pistänyt,
eikä auta ruveta sinulta salaisuuttasi urkkimaan. Se on minun
mieleeni, sillä juoruttelevia naisia meillä on kylliksi. Ah Margit, iloitsen
ajatellessani että taaskin saan istua koulunpenkillä. Saada jotain
ajateltavaa ja päätä ponnistavaa, siitä syntyy toivoakseni hyvä
vastapaino halulleni hullutella, ilveillä ja kujeilla. Sanos nyt minulle,
orpana, kuka on sinulle mieleisin maan päällä?

— Isäni.

— Ja sitten?
— Äitini.

— Ja sitten?

— Gunnar Svantenpoika.

— En ole mustankipeä. Entäs sitten?

— Svante tohtori.

— Ai! Sitte?

— Fabbe.

— Sitte?

— Herra Sven ja taatto Mathias.

— Sitte?

— Sinä.

— Kiitos! Toiste kun kysyn tätä, alan alapäästä. Silloin pääsen


minä ensisijaan.

*****

Ruotsin velka Lybeckiin oli maksettava, ja kun valtiolta puuttui


varoja tähän, täytyi Gösta kuninkaan ryhtyä kirkkojen ja luostarien
kalliisiin kaluihin ja tavaroihin. Se oli vaarallinen hanke, mutta ei hätä
lakia lue. Vaara oli selvänä jokaiselle ken joutui kuulemaan rahvaan
sanoja, näkemään sen silmäyksiä ja eleitä, kun se, kirkkojensa
juurille kokoontuneena katseli, kuinka kalkkeja ja öylättilautasia
vietiin pois. Sama kansa, joka alttiisti kantoi päivän kuormaa ja
hellettä, joka nöyrästi kesti nälkää ja kaikkia litaniassa mainittuja
maanvaivoja, nurkui ja puristi nyrkkiään peitsen ja kirveen varren
ympäri, kun inhimillinen käskyvalta näkyi sen oikeutta sortavan, ja se
halusi heti käyttää aseitaan, kun tuo oikeudensorto lisäksi samalla oli
pyhyydensolvausta. Näissä tilaisuuksissa nähtiin milloin milläkin
kirkonmäellä Smoolannin, Länsi- ja Itägöötanmaan kihlakunnissa
mies jota kansa kummeksien katseli ja kuitenkin melkein kaikkialla
ihmeellisellä luottamuksella kohteli, harpunsoittaja Svante. Nekin
vanhemmat ja vaikuttavammat maalaisisännät, jotka muuten olivat
luonteeltaan epäluuloisia, tahtoivat taata, että hän oli kansanystävä.
Liikkui huhuja, että hän oli syntyisin jostakin suvusta, joka ennen oli
Ruotsissa pätenyt paljon ja suojellut kansan oikeutta ja maan
parasta. Ekesjön seuduilla moniaat luulivat tuntevansa hänet
ennestään, nähneensä hänet siellä poikasena linnanpihalla, jolloin
häntä muka pidettiin jonakin Sturen suvun jälkivesana. Toiset
juttelivat toisin. Samoin kerrottiin, että Jouif Slatte, "Rosvo-Oden",
jota moni myös luuli kansanystäväksi, vaikka aivan omituisen,
epäkristillisen ja hirveän laatuiseksi, oli henkipatoksi julistanut sen
miehen, joka uskaltaisi harpunsoittajan päästä hiuskarvaakaan
katkaista.

Tuon tuostakin keräytyi kansaa kirkonmäille tämän ympäri


kuulemaan, mitä hänellä oli päivän tapauksista sanottavaa. Hän ei
koettanut vähentää sen merkitystä mitä oli tapahtunut ja ehkä vasta
tapahtuisi; päinvastoin sanoi hän arvaavansa, että sittenkun rahoja,
ehtoolliskalkkeja ja öylättiastioita oli otettu, piakkoin taitaisi tulla
kirkonkellojenkin vuoro, sillä peräti köyhtyneen maan velka oli suuri
ja paljo kulunkeja kysyi valtakunnan järjestäminen ja suojeleminen.
Hän ei yrittänyt heikontaa sitä vaikutusta, jonka pakolliset
kirkonryöstöt tekivät rahvaan mieliin; hän paremmin puheilla ja
lauluilla syventeli tätä vaikutusta, mutta muunteli sitä samalla sen
kaltaiseksi, mitä hän itse tunsi. Seurattuaan kirkolta kotia jotakuta
etevämpää isäntämiestä, jolloin tavallisesti monta seudun miestä ja
naista yhtyi samaan joukkoon, lauloi hän siellä ensin virsiä ja
hengellisiä lauluja, jotka olivat heille tuttuja ja rakkaita, sitten
Engelbrektinlaulun tai jonkun muun semmoisen, mikä herätti mieliin
isänmaallisia muistoja, sen perästä jonkun laulun, jonka hän tekaisi
hetken herättämäin tunteiden vallassa.

Milloin lauleli hän ehtoollismonstransista, josta sukupolvi toisensa


jälkeen oli pyrkinyt Nasaretilaisen kansanvapahtajan jumalallisuuden
yhteyteen; josta mies miehen, nainen naisen perästä oli saanut
salaperäisen voiman halulla ja toivokkaana lähtemään siihen
maahan, niissä poismenneet odottavat maailman uudestiluomisen
päivää…

Milloin kirkonkelloista, jotka sointuisalla soitollaan julistavat


jumalanpalveluksen ja levon päivät; joiden soidessa vastasyntyneet
tuodaan kasteelle ja kuolleet viedään haudan lepoon.

Pian ne ehkä vaikenevat, vuosisatoja heläyteltyään


malmihuuliltaan soinnukkaita ajanrenkaita luomaan liittoa täältä pois
liiteleväin ja tänne saapuvain sielujen välille.

Mutta entä sitten?

Painanevatko nämä uhrit enemmän kuin se, että Ruotsin kansa


menettäisi kunniansa? Velka on maksettava, vaikkapa vaivoillakin
kuolemaan asti. Velka on hiisi, joka surmaa sielusi jalouden, jollet
sinä surmaa häntä. Alentava häpeän tieto rasittaisi työtäsi vainiolla ja
salossa, Ruotsin mies. Se silpoisi siivet rukouksilta, joita lennättelet
korkeuteen sarkojesi viljan, kotosi ilon ja rauhan puolesta.
Säilyneen kunnian tunto on kyntävä vakosi syvemmältä ja lisää
idinvoimaa siemeniin, joita niihin kylvät. Se luo rukoustesi siivet
jänteviksi. Se nostaa selkäsi suoraksi, niiden edessä, jotka tahtovat
sinua orjuuttaa, ja se lisää monikertaista tehoa niihin iskuihin, joita
lyöt vapauden, lain ja oikeuden puolesta. Auranvaosta ja
rukouksesta ja verestäsi, jota oikeuden edestä sotiessa vuodatat, on
versova siunattu sato; siunatusta sadosta parempia kaunisteita
alttareillesi, heleämpiä ja väkevämpiä kellonsäveliä soimaan yli
Ruotsinmaan. —

Tämmöistä Svante harppunsa säesteellä lauleli. Ja niinkuin


kuningas Hjarrande harpullaan osasi kiistää myrskyt ja aallot
alenemaan, samoin tämänkin harpunsoittajan sävelistä toistaiseksi
asettui se myrsky, joka oli uhannut ruveta riehumaan.
NELJÄN VUODEN KULUTTUA.
XIII.

MAISTERI LAURI.

Lauri Gudmundinpoika eli Laurentius Gudmundi oli palannut


Jönköpingiin saatuaan Wittenbergissä maisterinarvon sekä runsaan
laihon kunnialaakereita, joita hän oli korjannut kokouksissa ja
väittäjäisissä moniaalla Saksassa, Hollannissa ja Sveitsissä. Hänen
maineensa oli käynyt hänen edellään Tukholmaan asti, jossa
paremmin kuin hänen pienessä syntymäkaupungissaan tiedettiin,
että hänestä Saksan yliopistopiireissä oli paisunut aika mies, jota
huomattiin, jollei juuri humanistisen oppinsa vuoksi, sillä sitä hänellä
oli ainoastaan vähin välttämätön määrä, niin ainakin hehkuvasta
teologisesta innostaan ja verrattomasta taistelukyvystään
katederissa. Hän oli voitolla lähtenyt julkisista kiistoista katolilaisten,
salakatolilaisten, kalvinistein ja zwingliläisten kanssa; useimmiten
hän jollakin äkkiarvaamattomalla johtopäätöksellä onnistui
ällistyttämään vastustajansa ja saattamaan heidät siksi kertaa
sanattomiksi. Ankara hän oli saarnamies; täysinäiset kirkot pohjois-
ja keski-Saksassa olivat hartaalla hämmästyksellä kuunnelleet tuon
hartevan pohjoismaisen jättiläisen jyriseviä soimaussaarnoja ajan
moninaista harhaoppia vastaan ja hänen kauheita ennustuksiaan
niiden johdosta. Eipä korkeimmanarvoisia lutheris-mielisiäkään
opettajia säästetty, jos Lauri luuli heidän mielipiteissään
vainunneensa edes vienointakaan vivahdusta, joka poikkesi siitä
mitä hän oli puhdas-oppisuudeksi säätänyt. Kirkossa samoin kuin
oppisalissa riippui hänellä pitkä miekka vyöllään — ei aivankaan
harvinainen tapa sen ajan saarnaajilla ja oppi-istuinten isännillä, jota
oikeutti yhtä yleinen tarve käyttää itsepuolustusta persoonallista
väkivaltaa vastaan. Lauri maisteri itse vakuutti varustaneensa
miekan itselleen ainoastaan sentähden, ettei se ollut niin
hengenvaarallinen ase kuin hänen nyrkkinsä. Häntä huvitti näytellä
voimaansa, esimerkiksi taittamalla poikki paksuja rautoja ja
vetämällä hevosenkenkiä oikoisiksi. Mutta niissäkin tiloissa, milloin
hän suvaitsi antaa urheilunäytteitä, osotti hän olennossaan
majesteetillista mahtavuutta ja käskevää ylhäisyyttä, jonka
nähdessään jopa vanhat kunnianarvoisat professorit ja tohtoritkin
tunsivat jotakin hädän ja levottomuuden tapaista ja heidän oli
mielestään pakko myöntyä, etenkin koska sitä säesti kaksi kylmää,
harmaata käskevää silmää, joista puhui horjumaton itsevarmuus.

Olisipa luullut Laurin näinä opintojen, kiistojen ja voittojen vuosina


kaukaisilla mailla unohtaneen tuon vanhan vihreäniljaisen pölkyn
isänsä laiturissa. Eipä suinkaan! Hän oli ajatuksissaan tuon tuostakin
hautonut sitä sotaretkeä, jota hän ennen lähtöään päätti käytäväksi
Gudmund mestarin "muistoja" vastaan, hänen tuhmia tapojansa ja
kerettiläisiä luulojansa vastaan, ja rynnäkkö mainitun pölkyn
kimppuun oli oleva ikäänkuin sodan alkajaisleikkinä.

Gudmund mestari myöntyi kuin myöntyikin kohta, vaikka kyllä


huokaillen, kun Lauri nyt uudelleen väitti, että pölkky ei enää
kelvannut virkaansa ja pitäisi poistettaman. Niin tapahtuikin. Fabbe,
joka oli mukana puuhassa, hakkasi kirveellään pari kertaa puuhun ja
näytti, että tämä rakas muisto Pietari Maununpojan ja mestari
Gudmundin nuoruuden ajalta vielä oli sisältä terve. Mutta Lauri
maisteri lausui ehdottoman päätelmänsä, että pölkky oli laho, koska
sen täytyi olla laho, se kun oli maannut vedessä sata vuotta ehkä
enemmänkin. Fabbe tahtoi väittää vastaan; mutta "vaiti mies!" ja
ojennettu koura tukki häneltä suun.

Laiturilta tultaessa sanoi Lauri maisteri Gudmund mestarille: Sinä


rupeat nyt käymään vanhaksi, isä, ja minä ajattelen että lepo
vanhuuden päivillä tekisi sulle hyvää. Olen ajatellut, että möisit tai
vuokraisit pois pajat, mutta pitäisit niellotehtaan. Niellotaidossa olet
sinä mitä etevin. Se työ huvittaa sinua ja tuottaa sinulle kunniaa ja
rahaa. Niin, arvelenpa että se tulee sinua huvittamaan yhä enemmin
ja että kyllästyt tuohon maalustelemiseen, joka vaan kiusaa vanhoja
silmiäsi.

— En suinkaan, sanoi Gudmund; värit ilahuttavat ja luullakseni


virkistävätkin silmiäni.

— Se on mahdotonta, sanoi Lauri; väreistä ne pilaantuvat, siitä


emme huoli kiistelläkään.

— En voi vuokrata pois enkä myydä pajojamme, jakamatta


tonttiamme tai saattamatta tänne vieraita ihmisiä, ja sepä, pelkään
mä, vähentäisi kotihauskuuttamme. Sitä paitsi talo on isäin perintöä,
jota en tahdo hajottaa.

— Eihän se sen arvoa enennä, että se on isiltä peritty. Talonala on


niin tilava, että siihen mahtuisi ruhtinaallinen linna. Näkisitpä vaan,
kuinka ahtailla tonteilla Saksan kaupungeissa rikkaimmatkin porvarit
tulevat toimeen. Meidän, jolla prameilee kaksi kartanoa kadun
puolella rautaristikkoineen, joka on tuhlausta, näyttää suorastaan
ylpeältä ja muistuttaa minulle sananpartta, että ylpeys käy
lankeemuksen edellä. Se kerskaa jokaiselle joka astuu tästä ohitse:
"tässä asuu Jönköpingin rikkain porvari". Minun on vaikea saarnata
ylpeyttä vastaan, niin kauvan kuin me näin uljaasti asumme. Vaikea
on minun myöskään saarnata Herran käskyä Sinailta: "älä tee
itsellesi kuvia", niinkauvan kuin näen neitsyt Maarian kuvan ja Vidrik
Valandinpojan päädyillämme. Olen tiedustellut Vidrik Valandinpojan
elämäkertaa ja oppineesta lähteestä saanut tietää, että hän
enemmän oli joku pakanain epäjumala, toisin sanoen siis perkele
kuin kristitty ihminen. Mutta siitä saamme puhua enemmän toiste.
Ymmärrät sen kyllä itsekin, ettei kristitty pappi ja pilaantumattoman
opin tunnustaja tahdo pitää perkeleenkuvaa seinällään
kummittelemassa. Siitä olemme kaiketi yhtä mieltä. Mitä nyt tulee
talon alaan, on sinun paras jakaa se pitkinpäin ja myydä läntinen
puolikas ynnä siinä vanha puinen asuinrakennus pajoineen. Itäinen
puolikas jää sinulle, ja olkoon se entisellään, paitsi että teet
maalarimajan niellopajaksi ja revität tulipirtin, joka on pakanain pesä.

— Jos talontila jaetaan pitkinpäin, miten silloin käy vanhan


hoitopuumme keskellä pihaa?

122

123

— Hoitopuun, mitä sillä nimellä tarkotat?

— Perhepuumme.

— Perhepuu! Olemmeko lähemmin sukua sille puulle kuin mille


muulle tahansa tässä maailmassa? Isä hyvä, kyllä sinä jo joutaisit
peseytyä puhtaaksi pakanallisesta taikauskosta. Ei mitään saastaista
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade

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.

Let us accompany you on the journey of exploring knowledge and


personal growth!

textbookfull.com

You might also like