Creating Toolbars for MultiView Elements in Netbeans Platform
Monday April 23 2018

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 MultiViewElement interface.

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:

Netbeans MultiView Toolbar

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 with Generic FormViews
Thursday April 19 2018

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.

The Scenario

To add some context to this tutorial, let's say we want to implement one of those kind of nested searches you see on some sites. Where you can select a field from a dropdown, and type in a search value for each field. Fields can be added and removed dynamically using JavaScript. Something like this:

Nested Search Example

For this tutorial, we will use the following model as an example:

class Book(models.Model):
    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:

  1. The query field: Indicates which field of the model we will query.
  2. The lookup type: Indicates which lookup is going to be used to make the query.
  3. The query value: Indicates what we want to actually search for (i.e Harry Potter for the book title.)


Custom File Types in Netbeans Platform
Wednesday March 28 2018

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


Building a Django Continuous Integration and Delivery Pipeline to AWS
Tuesday January 30 2018

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:

  1. Code will be pushed to source control repository. For this article, I will use Github.
  2. Project will be built and tested in a CI job at TravisCI.
  3. 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.