On a previous post I talked about creating a new file type that Netbeans Platform can recognize and display the file's data in different ways by creating different visual editors that implement the
However, that tutorial did not cover how to add a custom toolbar to each multi view. Like the one Netbeans already provides when editing source code:
This is a very handy toolbar that can be used to add buttons that perform different kinds of actions with the current active file.
A Deeper Look Into the MultiViewElement Object
If you recall from the previous post, a
JPanel that implements
MultiViewElement was created after finishing the wizard. This
MultiViewElement object has some very important characteristics that are key to this tutorial:
Django Formsets is an extremely handy feature for handling multiple clones of forms in a single view. In this post I will go over how to implement them using one of Django's built-in generic class based views, the FormView.
For this tutorial, we will use the following model as an example:
title = models.CharField()
author = models.ForeignKey(Author)
isbn = models.CharField()
editorial = models.ForeignKey(Editorial)
Creating the Form
We will begin by creating the form that will be cloned. That is, the form that will represent one search query out of the many that will/could be nested together.
For our case, the form will only contain 3 fields:
- The query field: Indicates which field of the model we will query.
- The lookup type: Indicates which lookup is going to be used to make the query.
- The query value: Indicates what we want to actually search for (i.e Harry Potter for the book title.)
If your desktop Java application needs to deal with very particular or special kinds of files, we can make use of Netbeans Platform's custom File Type feature to define a file that our application can recognize, and display visual and editing components to view and edit the file's data.
Moreover, we can also make use of Netbeans Platform's Favorites pane, which displays a tree view of a file system, where we can open the special files we need to work with.
Creating a New Module
For this article, we are going to create a new file type for CSV (Comma Separated Value) files. When we open these files, our application will display a visual representation in the form of an editable JTable.
All this functionaltiy will live in its own Netbeans Platform Module. Meaning that it can be plugged in into different applications in a modular fashion.
We are going to create the module and build it using Maven, since we are also going to be adding some functionalities that depend on external libraries that we can easily include in our project with Maven. But you can also just create the module without Maven as well. To create the module go to New Project > Maven > Netbeans Module
Pytest has become my favorite Python testing framework. And in this article I want to go over on how I learned to write nice tests for Django and Django REST Framework.
We will be using the following tools:
Building a CI/CD (Continuous Integration / Continuous Delivery) flow for your web application is a must nowadays. With so many things that can go wrong, and the amount of time and effort the deployment process of an application takes, a flow like this will give you peace of mind that your application is running without (or with less) errors and that your application will be production ready on every new commit to its source code.
In this post I want to talk about building such a pipeline, with emphasis on deploying a Django 1.11 application to AWS ElasticBeanstalk, which is an Amazon service very similar to Heroku. Additionally I will talk about how to include other services to the delivery flow, such as Amazon S3 for storage of static files and Amazon RDS (Relational Database Service) for a relational database that will be connected to our application.
The pipeline will work as follows:
- Code will be pushed to source control repository. For this article, I will use Github.
- Project will be built and tested in a CI job at TravisCI.
- TravisCI will perform a deployment to ElasticBeanstalk once the build passes successfully.
We will be using both the ElasticBeanstalk CLI (ebcli) and the AWS ElasticBeanstalk Console to achieve this.